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

436 lines
1.1 MiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[86,5,6,7],{"+NIl":function(_t,Je,ne){(function(ue){ue(ne("VrN/"))})(function(ue){"use strict";ue.defineMode("stex",function(Z,P){"use strict";function $(h,o){h.cmdState.push(o)}function B(h){return h.cmdState.length>0?h.cmdState[h.cmdState.length-1]:null}function U(h){var o=h.cmdState.pop();o&&o.closeBracket()}function K(h){for(var o=h.cmdState,f=o.length-1;f>=0;f--){var l=o[f];if(l.name=="DEFAULT")continue;return l}return{styleIdentifier:function(){return null}}}function G(h,o,f){return function(){this.name=h,this.bracketNo=0,this.style=o,this.styles=f,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var M={};M.importmodule=G("importmodule","tag",["string","builtin"]),M.documentclass=G("documentclass","tag",["","atom"]),M.usepackage=G("usepackage","tag",["atom"]),M.begin=G("begin","tag",["atom"]),M.end=G("end","tag",["atom"]),M.label=G("label","tag",["atom"]),M.ref=G("ref","tag",["atom"]),M.eqref=G("eqref","tag",["atom"]),M.cite=G("cite","tag",["atom"]),M.bibitem=G("bibitem","tag",["atom"]),M.Bibitem=G("Bibitem","tag",["atom"]),M.RBibitem=G("RBibitem","tag",["atom"]),M.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function O(h,o){h.f=o}function v(h,o){var f;if(h.match(/^\\[a-zA-Z@]+/)){var l=h.current().slice(1);return f=M.hasOwnProperty(l)?M[l]:M.DEFAULT,f=new f,$(o,f),O(o,p),f.style}if(h.match(/^\\[$&%#{}_]/))return"tag";if(h.match(/^\\[,;!\/\\]/))return"tag";if(h.match("\\["))return O(o,function(s,c){return m(s,c,"\\]")}),"keyword";if(h.match("\\("))return O(o,function(s,c){return m(s,c,"\\)")}),"keyword";if(h.match("$$"))return O(o,function(s,c){return m(s,c,"$$")}),"keyword";if(h.match("$"))return O(o,function(s,c){return m(s,c,"$")}),"keyword";var r=h.next();if(r=="%")return h.skipToEnd(),"comment";if(r=="}"||r=="]"){if(f=B(o),f)f.closeBracket(r),O(o,p);else return"error";return"bracket"}else return r=="{"||r=="["?(f=M.DEFAULT,f=new f,$(o,f),"bracket"):/\d/.test(r)?(h.eatWhile(/[\w.%]/),"atom"):(h.eatWhile(/[\w\-_]/),f=K(o),f.name=="begin"&&(f.argument=h.current()),f.styleIdentifier())}function m(h,o,f){if(h.eatSpace())return null;if(f&&h.match(f))return O(o,v),"keyword";if(h.match(/^\\[a-zA-Z@]+/))return"tag";if(h.match(/^[a-zA-Z]+/))return"variable-2";if(h.match(/^\\[$&%#{}_]/))return"tag";if(h.match(/^\\[,;!\/]/))return"tag";if(h.match(/^[\^_&]/))return"tag";if(h.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(h.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var l=h.next();return l=="{"||l=="}"||l=="["||l=="]"||l=="("||l==")"?"bracket":l=="%"?(h.skipToEnd(),"comment"):"error"}function p(h,o){var f=h.peek(),l;return f=="{"||f=="["?(l=B(o),l.openBracket(f),h.eat(f),O(o,v),"bracket"):/[ \t\r]/.test(f)?(h.eat(f),null):(O(o,v),U(o),v(h,o))}return{startState:function(){var h=P.inMathMode?function(o,f){return m(o,f)}:v;return{cmdState:[],f:h}},copyState:function(h){return{cmdState:h.cmdState.slice(),f:h.f}},token:function(h,o){return o.f(h,o)},blankLine:function(h){h.f=v,h.cmdState.length=0},lineComment:"%"}}),ue.defineMIME("text/x-stex","stex"),ue.defineMIME("text/x-latex","stex")})},"+ua5":function(_t,Je,ne){},"19Vz":function(_t,Je,ne){(function(ue){ue(ne("VrN/"))})(function(ue){ue.defineOption("placeholder","",function(G,M,O){var v=O&&O!=ue.Init;if(M&&!v)G.on("blur",B),G.on("change",U),G.on("swapDoc",U),ue.on(G.getInputField(),"compositionupdate",G.state.placeholderCompose=function(){$(G)}),U(G);else if(!M&&v){G.off("blur",B),G.off("change",U),G.off("swapDoc",U),ue.off(G.getInputField(),"compositionupdate",G.state.placeholderCompose),Z(G);var m=G.getWrapperElement();m.className=m.className.replace(" CodeMirror-empty","")}M&&!G.hasFocus()&&B(G)});function Z(G){G.state.placeholder&&(G.state.placeholder.parentNode.removeChild(G.state.placeholder),G.state.placeholder=null)}function P(G){Z(G);var M=G.state.placeholder=document.createElement("pre");M.style.cssText="height: 0; overflow: visible",M.style.direction=G.getOption("direction"),M.className="CodeMirror-placeholder CodeMirror-line-like";var O=G.getOption("placeholder");typeof O=="string"&&(O=document.createTextNode(O)),M.appendChild(O),G.display.lineSpace.insertBefore(M,G.display.lineSpace.firstChild)}function $(G){setTimeout(function(){var M=!1,O=G.getInputField();O.nodeName=="TEXTAREA"?M=!O.value:G.lineCount()==1&&(M=!/[^\u200b]/.test(O.querySelector(".CodeMirror-line").textContent)),M?P(G):Z(G)},20)}function B(G){K(G)&&P(G)}function U(G){var M=G.getWrapperElement(),O=K(G);M.className=M.className.replace(" CodeMirror-empty","")+(O?" CodeMirror-empty":""),O?P(G):Z(G)}function K(G){return G.lineCount()===1&&G.getLine(0)===""}})},"1eCo":function(_t,Je,ne){(function(ue){ue(ne("VrN/"))})(function(ue){"use strict";var Z={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},P={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ue.defineMode("xml",function($,B){var U=$.indentUnit,K={},G=B.htmlMode?Z:P;for(var M in G)K[M]=G[M];for(var M in B)K[M]=B[M];var O,v;function m(d,u){function g(D){return u.tokenize=D,D(d,u)}var E=d.next();if(E=="<")return d.eat("!")?d.eat("[")?d.match("CDATA[")?g(o("atom","]]>")):null:d.match("--")?g(o("comment","-->")):d.match("DOCTYPE",!0,!0)?(d.eatWhile(/[\w\._\-]/),g(f(1))):null:d.eat("?")?(d.eatWhile(/[\w\._\-]/),u.tokenize=o("meta","?>"),"meta"):(O=d.eat("/")?"closeTag":"openTag",u.tokenize=p,"tag bracket");if(E=="&"){var N;return d.eat("#")?d.eat("x")?N=d.eatWhile(/[a-fA-F\d]/)&&d.eat(";"):N=d.eatWhile(/[\d]/)&&d.eat(";"):N=d.eatWhile(/[\w\.\-:]/)&&d.eat(";"),N?"atom":"error"}else return d.eatWhile(/[^&<]/),null}m.isInText=!0;function p(d,u){var g=d.next();if(g==">"||g=="/"&&d.eat(">"))return u.tokenize=m,O=g==">"?"endTag":"selfcloseTag","tag bracket";if(g=="=")return O="equals",null;if(g=="<"){u.tokenize=m,u.state=c,u.tagName=u.tagStart=null;var E=u.tokenize(d,u);return E?E+" tag error":"tag error"}else return/[\'\"]/.test(g)?(u.tokenize=h(g),u.stringStartCol=d.column(),u.tokenize(d,u)):(d.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function h(d){var u=function(g,E){for(;!g.eol();)if(g.next()==d){E.tokenize=p;break}return"string"};return u.isInAttribute=!0,u}function o(d,u){return function(g,E){for(;!g.eol();){if(g.match(u)){E.tokenize=m;break}g.next()}return d}}function f(d){return function(u,g){for(var E;(E=u.next())!=null;){if(E=="<")return g.tokenize=f(d+1),g.tokenize(u,g);if(E==">")if(d==1){g.tokenize=m;break}else return g.tokenize=f(d-1),g.tokenize(u,g)}return"meta"}}function l(d,u,g){this.prev=d.context,this.tagName=u,this.indent=d.indented,this.startOfLine=g,(K.doNotIndent.hasOwnProperty(u)||d.context&&d.context.noIndent)&&(this.noIndent=!0)}function r(d){d.context&&(d.context=d.context.prev)}function s(d,u){for(var g;;){if(!d.context)return;if(g=d.context.tagName,!K.contextGrabbers.hasOwnProperty(g)||!K.contextGrabbers[g].hasOwnProperty(u))return;r(d)}}function c(d,u,g){return d=="openTag"?(g.tagStart=u.column(),L):d=="closeTag"?w:c}function L(d,u,g){return d=="word"?(g.tagName=u.current(),v="tag",C):K.allowMissingTagName&&d=="endTag"?(v="tag bracket",C(d,u,g)):(v="error",L)}function w(d,u,g){if(d=="word"){var E=u.current();return g.context&&g.context.tagName!=E&&K.implicitlyClosed.hasOwnProperty(g.context.tagName)&&r(g),g.context&&g.context.tagName==E||K.matchClosing===!1?(v="tag",T):(v="tag error",R)}else return K.allowMissingTagName&&d=="endTag"?(v="tag bracket",T(d,u,g)):(v="error",R)}function T(d,u,g){return d!="endTag"?(v="error",T):(r(g),c)}function R(d,u,g){return v="error",T(d,u,g)}function C(d,u,g){if(d=="word")return v="attribute",S;if(d=="endTag"||d=="selfcloseTag"){var E=g.tagName,N=g.tagStart;return g.tagName=g.tagStart=null,d=="selfcloseTag"||K.autoSelfClosers.hasOwnProperty(E)?s(g,E):(s(g,E),g.context=new l(g,E,N==g.indented)),c}return v="error",C}function S(d,u,g){return d=="equals"?x:(K.allowMissing||(v="error"),C(d,u,g))}function x(d,u,g){return d=="string"?_:d=="word"&&K.allowUnquoted?(v="string",C):(v="error",C(d,u,g))}function _(d,u,g){return d=="string"?_:C(d,u,g)}return{startState:function(d){var u={tokenize:m,state:c,indented:d||0,tagName:null,tagStart:null,context:null};return d!=null&&(u.baseIndent=d),u},token:function(d,u){if(!u.tagName&&d.sol()&&(u.indented=d.indentation()),d.eatSpace())return null;O=null;var g=u.tokenize(d,u);return(g||O)&&g!="comment"&&(v=null,u.state=u.state(O||g,d,u),v&&(g=v=="error"?g+" error":v)),g},indent:function(d,u,g){var E=d.context;if(d.tokenize.isInAttribute)return d.tagStart==d.indented?d.stringStartCol+1:d.indented+U;if(E&&E.noIndent)return ue.Pass;if(d.tokenize!=p&&d.tokenize!=m)return g?g.match(/^(\s*)/)[0].length:0;if(d.tagName)return K.multilineTagIndentPastTag!==!1?d.tagStart+d.tagName.length+2:d.tagStart+U*(K.multilineTagIndentFactor||1);if(K.alignCDATA&&/<!\[CDATA\[/.test(u))return 0;var N=u&&/^<(\/)?([\w_:\.-]*)/.exec(u);if(N&&N[1])for(;E;)if(E.tagName==N[2]){E=E.prev;break}else if(K.implicitlyClosed.hasOwnProperty(E.tagName))E=E.prev;else break;else if(N)for(;E;){var D=K.contextGrabbers[E.tagName];if(D&&D.hasOwnProperty(N[2]))E=E.prev;else break}for(;E&&E.prev&&!E.startOfLine;)E=E.prev;return E?E.indent+U:d.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:K.htmlMode?"html":"xml",helperType:K.htmlMode?"html":"xml",skipAttribute:function(d){d.state==x&&(d.state=C)},xmlCurrentTag:function(d){return d.tagName?{name:d.tagName,close:d.type=="closeTag"}:null},xmlCurrentContext:function(d){for(var u=[],g=d.context;g;g=g.prev)g.tagName&&u.push(g.tagName);return u.reverse()}}}),ue.defineMIME("text/xml","xml"),ue.defineMIME("application/xml","xml"),ue.mimeModes.hasOwnProperty("text/html")||ue.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"500L":function(_t,Je,ne){"use strict";ne.d(Je,"a",function(){return w});var ue=ne("+L6B"),Z=ne("2/Rp"),P=ne("2qtc"),$=ne("kLXV"),B=ne("9og8"),U=ne("k1fw"),K=ne("miYZ"),G=ne("tsqr"),M=ne("oBTY"),O=ne("tJVT"),v=ne("DZo9"),m=ne("8z0m"),p=ne("WmNS"),h=ne.n(p),o=ne("q1tI"),f=ne.n(o),l=ne("m3rI"),r=ne("wzkS"),s=ne("y5JW"),c=ne("LtfV"),L=m.a.Dragger;function w(T){var R=[];return T&&T.length>0&&(R=T.map(function(C){return{uid:C.id,id:C.id,name:C.title+s.c+C.filesize,url:C.url,filesize:C.filesize,status:"done",response:{id:C.id}}})),R}Je.b=function(T){var R=T.value,C=T.onChange,S=T.action,x=T.className,_=T.maxSize,d=_===void 0?150:_,u=T.title,g=u===void 0?"\u4E0A\u4F20\u9644\u4EF6":u,E=T.showRemoveModal,N=E===void 0?!1:E,D=T.accept,H=D===void 0?"":D,j=T.additionalText,I=T.isDragger,b=T.number,W=b===void 0?1e3:b,Y=T.aloneClear,ie=Y===void 0?!1:Y,oe=Object(o.useState)(!1),xe=Object(O.a)(oe,2),ve=xe[0],we=xe[1],Ce=Object(o.useState)(R||[]),Se=Object(O.a)(Ce,2),fe=Se[0],le=Se[1];Object(o.useEffect)(function(){R&&(le(Object(M.a)(R)),W===(R==null?void 0:R.length)&&we(!0))},[R]);var te=function(){setTimeout(function(){fe.pop(),le(Object(M.a)(fe))},500)},de={multiple:!0,disabled:ve,accept:H,withCredentials:!0,fileList:fe,beforeUpload:function(Le,Te){var Ie=Le.size/1024/1024;return fe.concat(Te).length>W?(fe.pop(),le(Object(M.a)(fe)),G.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat(W,"\u4E2A\u6587\u4EF6")),ie?Promise.reject():(te(),!1)):!0},action:S||"".concat(l.a.API_SERVER,"/api/attachments.json"),onChange:function(Le){var Te,Ie,Ue=Object(M.a)(Le.fileList);if(Le.file.status==="done"&&((Te=Le.file)===null||Te===void 0||((Ie=Te.response)===null||Ie===void 0)?void 0:Ie.status)===-1){var We,Fe;G.b.error((We=Le.file)===null||We===void 0||((Fe=We.response)===null||Fe===void 0)?void 0:Fe.message);return}Ue.length>=W?we(!0):we(!1),le(Object(M.a)(Ue)),Ue=Ue.map(function(Ne){var Me;if(Ne!=null&&(Me=Ne.response)!==null&&Me!==void 0&&Me.id){var $e;Ne.url="/api/attachments/".concat(Ne==null||(($e=Ne.response)===null||$e===void 0)?void 0:$e.id)}return Ne.name.indexOf(s.c)===-1&&(Ne.name="".concat(Ne.name).concat(s.c).concat(Object(s.a)(Ne.size))),Object(U.a)({},Ne)}),console.log("info:",Le),C(Ue)},onRemove:function(){var Re=Object(B.a)(h.a.mark(function Te(Ie){var Ue;return h.a.wrap(function(Fe){for(;;)switch(Fe.prev=Fe.next){case 0:if(Ue=function(){var Ne=Object(B.a)(h.a.mark(function Me(){var $e,et;return h.a.wrap(function(Ze){for(;;)switch(Ze.prev=Ze.next){case 0:if($e=Ie.response?Ie.response.id:Ie.id,!$e){Ze.next=8;break}return Ze.next=4,Object(r.d)(Ie.response?Ie.response.id:Ie.uid);case 4:return et=Ze.sent,Ze.abrupt("return",et);case 8:return Ze.abrupt("return",!0);case 9:case"end":return Ze.stop()}},Me)}));return function(){return Ne.apply(this,arguments)}}(),!N){Fe.next=5;break}return Fe.abrupt("return",new Promise(function(Ne,Me){$.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:f.a.createElement("div",{className:"tc font16"},"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),onOk:function(){var $e=Object(B.a)(h.a.mark(function Qe(){var Ze;return h.a.wrap(function(it){for(;;)switch(it.prev=it.next){case 0:return it.next=2,Ue();case 2:Ze=it.sent,G.b.success("\u5220\u9664\u6210\u529F"),Ne(!0);case 5:case"end":return it.stop()}},Qe)}));function et(){return $e.apply(this,arguments)}return et}(),onCancel:function(){return Ne(!1)}})}));case 5:return Fe.next=7,Ue();case 7:return Fe.abrupt("return",Fe.sent);case 8:case"end":return Fe.stop()}},Te)}));function Le(Te){return Re.apply(this,arguments)}return Le}()};function se(Re){Re.preventDefault(),Re.stopPropagation()}return f.a.createElement("div",{className:"multi-upload ".concat(x||"")},I&&f.a.createElement(L,de,f.a.createElement("p",{className:"ant-upload-drag-icon"},f.a.createElement(c.a,null)),f.a.createElement("p",{className:"ant-upload-text"},"\u70B9\u51FB\u4E0A\u4F20\u56FE\u6807\uFF0C\u9009\u62E9\u8981\u4E0A\u4F20\u7684\u6587\u4EF6\u6216\u5C06\u6587\u4EF6\u62D6\u62FD\u5230\u6B64",f.a.createElement("br",null),"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",d,"MB)"," "),j),!I&&f.a.createElement(m.a,de,f.a.createElement(Z.a,{style:{width:"108px",height:"32px",background:"#F6F7F9 linear-gradient(180deg, #FFFFFF 0%, #F6F7F9 100%)",boxShadow:"0px 2px 4px 0px #E0DFE1, inset 0px 1px 3px 0px rgba(255,255,255,0.5)",borderRadius:"2px",border:"1px solid #BACFFE",color:"#3061D0"},icon:f.a.createElement("i",{className:"iconfont icon-shangchuan3",style:{marginRight:"6px"}}),disabled:ve},g),f.a.createElement("span",{onClick:se,style:{marginLeft:10,color:"#FA6400"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",d,"MB)"," ")))}},"55Ip":function(_t,Je,ne){"use strict";ne.d(Je,"a",function(){return s});var ue=ne("Ty5D"),Z=ne("dI71"),P=ne("q1tI"),$=ne.n(P),B=ne("YS25"),U=ne("17x9"),K=ne.n(U),G=ne("wx14"),M=ne("zLVn"),O=ne("9R94"),v=function(x){Object(Z.a)(_,x);function _(){for(var u,g=arguments.length,E=new Array(g),N=0;N<g;N++)E[N]=arguments[N];return u=x.call.apply(x,[this].concat(E))||this,u.history=Object(B.a)(u.props),u}var d=_.prototype;return d.render=function(){return $.a.createElement(ue.c,{history:this.history,children:this.props.children})},_}($.a.Component),m=function(x){Object(Z.a)(_,x);function _(){for(var u,g=arguments.length,E=new Array(g),N=0;N<g;N++)E[N]=arguments[N];return u=x.call.apply(x,[this].concat(E))||this,u.history=Object(B.b)(u.props),u}var d=_.prototype;return d.render=function(){return $.a.createElement(ue.c,{history:this.history,children:this.props.children})},_}($.a.Component),p=function(_,d){return typeof _=="function"?_(d):_},h=function(_,d){return typeof _=="string"?Object(B.c)(_,null,null,d):_},o=function(_){return _},f=$.a.forwardRef;typeof f=="undefined"&&(f=o);function l(x){return!!(x.metaKey||x.altKey||x.ctrlKey||x.shiftKey)}var r=f(function(x,_){var d=x.innerRef,u=x.navigate,g=x.onClick,E=Object(M.a)(x,["innerRef","navigate","onClick"]),N=E.target,D=Object(G.a)({},E,{onClick:function(j){try{g&&g(j)}catch(I){throw j.preventDefault(),I}!j.defaultPrevented&&j.button===0&&(!N||N==="_self")&&!l(j)&&(j.preventDefault(),u())}});return o!==f?D.ref=_||d:D.ref=d,$.a.createElement("a",D)}),s=f(function(x,_){var d=x.component,u=d===void 0?r:d,g=x.replace,E=x.to,N=x.innerRef,D=Object(M.a)(x,["component","replace","to","innerRef"]);return $.a.createElement(ue.e.Consumer,null,function(H){H||Object(O.a)(!1);var j=H.history,I=h(p(E,H.location),H.location),b=I?j.createHref(I):"",W=Object(G.a)({},D,{href:b,navigate:function(){var ie=p(E,H.location),oe=g?j.replace:j.push;oe(ie)}});return o!==f?W.ref=_||N:W.innerRef=N,$.a.createElement(u,W)})});if(!1)var c,L;var w=function(_){return _},T=$.a.forwardRef;typeof T=="undefined"&&(T=w);function R(){for(var x=arguments.length,_=new Array(x),d=0;d<x;d++)_[d]=arguments[d];return _.filter(function(u){return u}).join(" ")}var C=T(function(x,_){var d=x["aria-current"],u=d===void 0?"page":d,g=x.activeClassName,E=g===void 0?"active":g,N=x.activeStyle,D=x.className,H=x.exact,j=x.isActive,I=x.location,b=x.sensitive,W=x.strict,Y=x.style,ie=x.to,oe=x.innerRef,xe=Object(M.a)(x,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return $.a.createElement(ue.e.Consumer,null,function(ve){ve||Object(O.a)(!1);var we=I||ve.location,Ce=h(p(ie,we),we),Se=Ce.pathname,fe=Se&&Se.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),le=fe?Object(ue.f)(we.pathname,{path:fe,exact:H,sensitive:b,strict:W}):null,te=!!(j?j(le,we):le),de=te?R(D,E):D,se=te?Object(G.a)({},Y,{},N):Y,Re=Object(G.a)({"aria-current":te&&u||null,className:de,style:se,to:Ce},xe);return w!==T?Re.ref=_||oe:Re.innerRef=oe,$.a.createElement(s,Re)})});if(!1)var S},"5VLF":function(_t,Je,ne){"use strict";var ue,Z;function P($,B,U){var K=function(G,M){return $.js_beautify(G,M)};return K.js=$.js_beautify,K.css=B.css_beautify,K.html=U.html_beautify,K.js_beautify=$.js_beautify,K.css_beautify=B.css_beautify,K.html_beautify=U.html_beautify,K}!(ue=[ne("6UM0"),ne("TXwP"),ne("psGv")],Z=function($,B,U){return P($,B,U)}.apply(Je,ue),Z!==void 0&&(_t.exports=Z))},"6UM0":function(_t,Je,ne){var ue,Z;(function(){var P;(function(){"use strict";var B=[function(M,O,v){var m=v(1).Beautifier,p=v(5).Options;function h(o,f){var l=new m(o,f);return l.beautify()}M.exports=h,M.exports.defaultOptions=function(){return new p}},function(M,O,v){var m=v(2).Output,p=v(3).Token,h=v(4),o=v(5).Options,f=v(7).Tokenizer,l=v(7).line_starters,r=v(7).positionable_operators,s=v(7).TOKEN;function c(b,W){return W.indexOf(b)!==-1}function L(b){return b.replace(/^\s+/g,"")}function w(b){for(var W={},Y=0;Y<b.length;Y++)W[b[Y].replace(/-/g,"_")]=b[Y];return W}function T(b,W){return b&&b.type===s.RESERVED&&b.text===W}function R(b,W){return b&&b.type===s.RESERVED&&c(b.text,W)}var C=["case","return","do","if","throw","else","await","break","continue","async"],S=["before-newline","after-newline","preserve-newline"],x=w(S),_=[x.before_newline,x.preserve_newline],d={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function u(b,W){if(W.multiline_frame||W.mode===d.ForInitializer||W.mode===d.Conditional)return;b.remove_indent(W.start_line_index)}function g(b){b=b.replace(h.allLineBreaks,`
`);for(var W=[],Y=b.indexOf(`
`);Y!==-1;)W.push(b.substring(0,Y)),b=b.substring(Y+1),Y=b.indexOf(`
`);return b.length&&W.push(b),W}function E(b){return b===d.ArrayLiteral}function N(b){return c(b,[d.Expression,d.ForInitializer,d.Conditional])}function D(b,W){for(var Y=0;Y<b.length;Y++){var ie=b[Y].trim();if(ie.charAt(0)!==W)return!1}return!0}function H(b,W){for(var Y=0,ie=b.length,oe;Y<ie;Y++)if(oe=b[Y],oe&&oe.indexOf(W)!==0)return!1;return!0}function j(b,W){W=W||{},this._source_text=b||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new o(W)}j.prototype.create_flags=function(b,W){var Y=0;b&&(Y=b.indentation_level,!this._output.just_added_newline()&&b.line_indent_level>Y&&(Y=b.line_indent_level));var ie={mode:W,parent:b,last_token:b?b.last_token:new p(s.START_BLOCK,""),last_word:b?b.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,class_start_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,case_block:!1,indentation_level:Y,alignment:0,line_indent_level:b?b.line_indent_level:Y,start_line_index:this._output.get_line_number(),ternary_depth:0};return ie},j.prototype._reset=function(b){var W=b.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new m(this._options,W),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(d.BlockStatement);var Y=new f(b,this._options);return this._tokens=Y.tokenize(),b},j.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var b,W=this._reset(this._source_text),Y=this._options.eol;this._options.eol==="auto"&&(Y=`
`,W&&h.lineBreak.test(W||"")&&(Y=W.match(h.lineBreak)[0]));for(var ie=this._tokens.next();ie;)this.handle_token(ie),this._last_last_text=this._flags.last_token.text,this._flags.last_token=ie,ie=this._tokens.next();return b=this._output.get_code(Y),b},j.prototype.handle_token=function(b,W){b.type===s.START_EXPR?this.handle_start_expr(b):b.type===s.END_EXPR?this.handle_end_expr(b):b.type===s.START_BLOCK?this.handle_start_block(b):b.type===s.END_BLOCK?this.handle_end_block(b):b.type===s.WORD?this.handle_word(b):b.type===s.RESERVED?this.handle_word(b):b.type===s.SEMICOLON?this.handle_semicolon(b):b.type===s.STRING?this.handle_string(b):b.type===s.EQUALS?this.handle_equals(b):b.type===s.OPERATOR?this.handle_operator(b):b.type===s.COMMA?this.handle_comma(b):b.type===s.BLOCK_COMMENT?this.handle_block_comment(b,W):b.type===s.COMMENT?this.handle_comment(b,W):b.type===s.DOT?this.handle_dot(b):b.type===s.EOF?this.handle_eof(b):b.type===s.UNKNOWN?this.handle_unknown(b,W):this.handle_unknown(b,W)},j.prototype.handle_whitespace_and_comments=function(b,W){var Y=b.newlines,ie=this._options.keep_array_indentation&&E(this._flags.mode);if(b.comments_before)for(var oe=b.comments_before.next();oe;)this.handle_whitespace_and_comments(oe,W),this.handle_token(oe,W),oe=b.comments_before.next();if(ie)for(var xe=0;xe<Y;xe+=1)this.print_newline(xe>0,W);else if(this._options.max_preserve_newlines&&Y>this._options.max_preserve_newlines&&(Y=this._options.max_preserve_newlines),this._options.preserve_newlines&&Y>1){this.print_newline(!1,W);for(var ve=1;ve<Y;ve+=1)this.print_newline(!0,W)}};var I=["async","break","continue","return","throw","yield"];j.prototype.allow_wrap_or_preserved_newline=function(b,W){if(W=W===void 0?!1:W,this._output.just_added_newline())return;var Y=this._options.preserve_newlines&&b.newlines||W,ie=c(this._flags.last_token.text,r)||c(b.text,r);if(ie){var oe=c(this._flags.last_token.text,r)&&c(this._options.operator_position,_)||c(b.text,r);Y=Y&&oe}if(Y)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(R(this._flags.last_token,I))return;this._output.set_wrap_point()}},j.prototype.print_newline=function(b,W){if(!W&&(this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==s.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")))for(var Y=this._tokens.peek();this._flags.mode===d.Statement&&!(this._flags.if_block&&T(Y,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(b)&&(this._flags.multiline_frame=!0)},j.prototype.print_token_line_indentation=function(b){this._output.just_added_newline()&&(this._options.keep_array_indentation&&b.newlines&&(b.text==="["||E(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(b.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},j.prototype.print_token=function(b){if(this._output.raw){this._output.add_raw_token(b);return}if(this._options.comma_first&&b.previous&&b.previous.type===s.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var W=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(W),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(b),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(b),this._output.non_breaking_space=!0,this._output.add_token(b.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},j.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},j.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},j.prototype.set_mode=function(b){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,b),this._flags=this.create_flags(this._previous_flags,b),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},j.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===d.Statement&&u(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},j.prototype.start_of_object_property=function(){return this._flags.parent.mode===d.ObjectLiteral&&this._flags.mode===d.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||R(this._flags.last_token,["get","set"]))},j.prototype.start_of_statement=function(b){var W=!1;return W=W||R(this._flags.last_token,["var","let","const"])&&b.type===s.WORD,W=W||T(this._flags.last_token,"do"),W=W||!(this._flags.parent.mode===d.ObjectLiteral&&this._flags.mode===d.Statement)&&R(this._flags.last_token,I)&&!b.newlines,W=W||T(this._flags.last_token,"else")&&!(T(b,"if")&&!b.comments_before),W=W||this._flags.last_token.type===s.END_EXPR&&(this._previous_flags.mode===d.ForInitializer||this._previous_flags.mode===d.Conditional),W=W||this._flags.last_token.type===s.WORD&&this._flags.mode===d.BlockStatement&&!this._flags.in_case&&!(b.text==="--"||b.text==="++")&&this._last_last_text!=="function"&&b.type!==s.WORD&&b.type!==s.RESERVED,W=W||this._flags.mode===d.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||R(this._flags.last_token,["get","set"])),W?(this.set_mode(d.Statement),this.indent(),this.handle_whitespace_and_comments(b,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(b,R(b,["do","for","if","while"])),!0):!1},j.prototype.handle_start_expr=function(b){this.start_of_statement(b)||this.handle_whitespace_and_comments(b);var W=d.Expression;if(b.text==="["){if(this._flags.last_token.type===s.WORD||this._flags.last_token.text===")"){R(this._flags.last_token,l)&&(this._output.space_before_token=!0),this.print_token(b),this.set_mode(W),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}W=d.ArrayLiteral,E(this._flags.mode)&&((this._flags.last_token.text==="["||this._flags.last_token.text===","&&(this._last_last_text==="]"||this._last_last_text==="}"))&&(this._options.keep_array_indentation||this.print_newline())),c(this._flags.last_token.type,[s.START_EXPR,s.END_EXPR,s.WORD,s.OPERATOR,s.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===s.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,W=d.ForInitializer):c(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,W=d.Conditional):c(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&b.whitespace_before===""?this._output.space_before_token=!1:(c(this._flags.last_token.text,l)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===s.EQUALS||this._flags.last_token.type===s.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(b);else if(this._flags.last_token.type===s.WORD){this._output.space_before_token=!1;var Y=this._tokens.peek(-3);if(this._options.space_after_named_function&&Y){var ie=this._tokens.peek(-4);R(Y,["async","function"])||Y.text==="*"&&R(ie,["async","function"])?this._output.space_before_token=!0:this._flags.mode===d.ObjectLiteral?(Y.text==="{"||Y.text===","||Y.text==="*"&&(ie.text==="{"||ie.text===","))&&(this._output.space_before_token=!0):this._flags.parent&&this._flags.parent.class_start_block&&(this._output.space_before_token=!0)}}else this.allow_wrap_or_preserved_newline(b);(this._flags.last_token.type===s.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(c(this._last_last_text,["function","yield"])||this._flags.mode===d.ObjectLiteral&&c(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}this._flags.last_token.text===";"||this._flags.last_token.type===s.START_BLOCK?this.print_newline():(this._flags.last_token.type===s.END_EXPR||this._flags.last_token.type===s.START_EXPR||this._flags.last_token.type===s.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===s.COMMA)&&this.allow_wrap_or_preserved_newline(b,b.newlines),this.print_token(b),this.set_mode(W),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},j.prototype.handle_end_expr=function(b){for(;this._flags.mode===d.Statement;)this.restore_mode();this.handle_whitespace_and_comments(b),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(b,b.text==="]"&&E(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===s.START_EXPR&&!this._options.space_in_empty_paren?(this._output.trim(),this._output.space_before_token=!1):this._output.space_before_token=!0),this.deindent(),this.print_token(b),this.restore_mode(),u(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===d.Conditional&&(this._previous_flags.mode=d.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},j.prototype.handle_start_block=function(b){this.handle_whitespace_and_comments(b);var W=this._tokens.peek(),Y=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===s.END_EXPR?(this.set_mode(d.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(d.BlockStatement):Y&&(c(Y.text,[":",","])&&c(W.type,[s.STRING,s.WORD,s.RESERVED])||c(W.text,["get","set","..."])&&c(Y.type,[s.WORD,s.RESERVED]))?c(this._last_last_text,["class","interface"])&&!c(Y.text,[":",","])?this.set_mode(d.BlockStatement):this.set_mode(d.ObjectLiteral):this._flags.last_token.type===s.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(d.BlockStatement):c(this._flags.last_token.type,[s.EQUALS,s.START_EXPR,s.COMMA,s.OPERATOR])||R(this._flags.last_token,["return","throw","import","default"])?this.set_mode(d.ObjectLiteral):this.set_mode(d.BlockStatement),this._flags.last_token&&(R(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var ie=!W.comments_before&&W.text==="}",oe=ie&&this._flags.last_word==="function"&&this._flags.last_token.type===s.END_EXPR;if(this._options.brace_preserve_inline){var xe=0,ve=null;this._flags.inline_frame=!0;do if(xe+=1,ve=this._tokens.peek(xe-1),ve.newlines){this._flags.inline_frame=!1;break}while(ve.type!==s.EOF&&!(ve.type===s.END_BLOCK&&ve.opened===b))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&b.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==s.OPERATOR&&(oe||this._flags.last_token.type===s.EQUALS||R(this._flags.last_token,C)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(E(this._previous_flags.mode)&&(this._flags.last_token.type===s.START_EXPR||this._flags.last_token.type===s.COMMA)&&((this._flags.last_token.type===s.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===s.COMMA||this._flags.last_token.type===s.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(b),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==s.OPERATOR&&this._flags.last_token.type!==s.START_EXPR&&(this._flags.last_token.type===s.START_BLOCK&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(b),this.indent(),!ie&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},j.prototype.handle_end_block=function(b){for(this.handle_whitespace_and_comments(b);this._flags.mode===d.Statement;)this.restore_mode();var W=this._flags.last_token.type===s.START_BLOCK;this._flags.inline_frame&&!W?this._output.space_before_token=!0:this._options.brace_style==="expand"?W||this.print_newline():W||(E(this._flags.mode)&&this._options.keep_array_indentation?(this._options.keep_array_indentation=!1,this.print_newline(),this._options.keep_array_indentation=!0):this.print_newline()),this.restore_mode(),this.print_token(b)},j.prototype.handle_word=function(b){if(b.type===s.RESERVED){if(c(b.text,["set","get"])&&this._flags.mode!==d.ObjectLiteral)b.type=s.WORD;else if(b.text==="import"&&c(this._tokens.peek().text,["(","."]))b.type=s.WORD;else if(c(b.text,["as","from"])&&!this._flags.import_block)b.type=s.WORD;else if(this._flags.mode===d.ObjectLiteral){var W=this._tokens.peek();W.text===":"&&(b.type=s.WORD)}}if(this.start_of_statement(b)?R(this._flags.last_token,["var","let","const"])&&b.type===s.WORD&&(this._flags.declaration_statement=!0):b.newlines&&!N(this._flags.mode)&&(this._flags.last_token.type!==s.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==s.EQUALS&&(this._options.preserve_newlines||!R(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(b),this.print_newline()):this.handle_whitespace_and_comments(b),this._flags.do_block&&!this._flags.do_while)if(T(b,"while")){this._output.space_before_token=!0,this.print_token(b),this._output.space_before_token=!0,this._flags.do_while=!0;return}else this.print_newline(),this._flags.do_block=!1;if(this._flags.if_block)if(!this._flags.else_block&&T(b,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===d.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&R(b,["case","default"])){this.print_newline(),!this._flags.case_block&&(this._flags.case_body||this._options.jslint_happy)&&this.deindent(),this._flags.case_body=!1,this.print_token(b),this._flags.in_case=!0;return}if((this._flags.last_token.type===s.COMMA||this._flags.last_token.type===s.START_EXPR||this._flags.last_token.type===s.EQUALS||this._flags.last_token.type===s.OPERATOR)&&(this.start_of_object_property()||this.allow_wrap_or_preserved_newline(b)),T(b,"function")){(c(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(c(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===s.OPERATOR))&&(!this._output.just_added_blankline()&&!b.comments_before&&(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===s.RESERVED||this._flags.last_token.type===s.WORD?R(this._flags.last_token,["get","set","new","export"])||R(this._flags.last_token,I)?this._output.space_before_token=!0:T(this._flags.last_token,"default")&&this._last_last_text==="export"?this._output.space_before_token=!0:this._flags.last_token.text==="declare"?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===s.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(N(this._flags.mode)||E(this._flags.mode))||this.print_newline(),this.print_token(b),this._flags.last_word=b.text;return}var Y="NONE";if(this._flags.last_token.type===s.END_BLOCK?this._previous_flags.inline_frame?Y="SPACE":R(b,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&b.newlines?Y="NEWLINE":(Y="SPACE",this._output.space_before_token=!0):Y="NEWLINE":this._flags.last_token.type===s.SEMICOLON&&this._flags.mode===d.BlockStatement?Y="NEWLINE":this._flags.last_token.type===s.SEMICOLON&&N(this._flags.mode)?Y="SPACE":this._flags.last_token.type===s.STRING?Y="NEWLINE":this._flags.last_token.type===s.RESERVED||this._flags.last_token.type===s.WORD||this._flags.last_token.text==="*"&&(c(this._last_last_text,["function","yield"])||this._flags.mode===d.ObjectLiteral&&c(this._last_last_text,["{",","]))?Y="SPACE":this._flags.last_token.type===s.START_BLOCK?this._flags.inline_frame?Y="SPACE":Y="NEWLINE":this._flags.last_token.type===s.END_EXPR&&(this._output.space_before_token=!0,Y="NEWLINE"),R(b,l)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?Y="SPACE":Y="NEWLINE"),R(b,["else","catch","finally"]))if((!(this._flags.last_token.type===s.END_BLOCK&&this._previous_flags.mode===d.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&b.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var ie=this._output.current_line;ie.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else Y==="NEWLINE"?R(this._flags.last_token,C)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&R(b,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==s.END_EXPR?(this._flags.last_token.type!==s.START_EXPR||!R(b,["var","let","const"]))&&this._flags.last_token.text!==":"&&(T(b,"if")&&T(b.previous,"else")?this._output.space_before_token=!0:this.print_newline()):R(b,l)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&E(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():Y==="SPACE"&&(this._output.space_before_token=!0);b.previous&&(b.previous.type===s.WORD||b.previous.type===s.RESERVED)&&(this._output.space_before_token=!0),this.print_token(b),this._flags.last_word=b.text,b.type===s.RESERVED&&(b.text==="do"?this._flags.do_block=!0:b.text==="if"?this._flags.if_block=!0:b.text==="import"?this._flags.import_block=!0:this._flags.import_block&&T(b,"from")&&(this._flags.import_block=!1))},j.prototype.handle_semicolon=function(b){this.start_of_statement(b)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(b);for(var W=this._tokens.peek();this._flags.mode===d.Statement&&!(this._flags.if_block&&T(W,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(b)},j.prototype.handle_string=function(b){b.text.startsWith("`")&&b.newlines===0&&b.whitespace_before===""&&(b.previous.text===")"||this._flags.last_token.type===s.WORD)||(this.start_of_statement(b)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(b),this._flags.last_token.type===s.RESERVED||this._flags.last_token.type===s.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===s.COMMA||this._flags.last_token.type===s.START_EXPR||this._flags.last_token.type===s.EQUALS||this._flags.last_token.type===s.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(b):b.text.startsWith("`")&&this._flags.last_token.type===s.END_EXPR&&(b.previous.text==="]"||b.previous.text===")")&&b.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(b)},j.prototype.handle_equals=function(b){this.start_of_statement(b)||this.handle_whitespace_and_comments(b),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(b),this._output.space_before_token=!0},j.prototype.handle_comma=function(b){this.handle_whitespace_and_comments(b,!0),this.print_token(b),this._output.space_before_token=!0,this._flags.declaration_statement?(N(this._flags.parent.mode)&&(this._flags.declaration_assignment=!1),this._flags.declaration_assignment?(this._flags.declaration_assignment=!1,this.print_newline(!1,!0)):this._options.comma_first&&this.allow_wrap_or_preserved_newline(b)):this._flags.mode===d.ObjectLiteral||this._flags.mode===d.Statement&&this._flags.parent.mode===d.ObjectLiteral?(this._flags.mode===d.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(b)},j.prototype.handle_operator=function(b){var W=b.text==="*"&&(R(this._flags.last_token,["function","yield"])||c(this._flags.last_token.type,[s.START_BLOCK,s.COMMA,s.END_BLOCK,s.SEMICOLON])),Y=c(b.text,["-","+"])&&(c(this._flags.last_token.type,[s.START_BLOCK,s.START_EXPR,s.EQUALS,s.OPERATOR])||c(this._flags.last_token.text,l)||this._flags.last_token.text===",");if(!this.start_of_statement(b)){var ie=!W;this.handle_whitespace_and_comments(b,ie)}if(b.text==="*"&&this._flags.last_token.type===s.DOT){this.print_token(b);return}if(b.text==="::"){this.print_token(b);return}if(this._flags.last_token.type===s.OPERATOR&&c(this._options.operator_position,_)&&this.allow_wrap_or_preserved_newline(b),b.text===":"&&this._flags.in_case){this.print_token(b),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==s.START_BLOCK?(this.indent(),this.print_newline(),this._flags.case_block=!1):(this._flags.case_block=!0,this._output.space_before_token=!0);return}var oe=!0,xe=!0,ve=!1;if(b.text===":"?this._flags.ternary_depth===0?oe=!1:(this._flags.ternary_depth-=1,ve=!0):b.text==="?"&&(this._flags.ternary_depth+=1),!Y&&!W&&this._options.preserve_newlines&&c(b.text,r)){var we=b.text===":",Ce=we&&ve,Se=we&&!ve;switch(this._options.operator_position){case x.before_newline:this._output.space_before_token=!Se,this.print_token(b),(!we||Ce)&&this.allow_wrap_or_preserved_newline(b),this._output.space_before_token=!0;return;case x.after_newline:this._output.space_before_token=!0,!we||Ce?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(b):this._output.space_before_token=!1,this.print_token(b),this._output.space_before_token=!0;return;case x.preserve_newline:Se||this.allow_wrap_or_preserved_newline(b),oe=!(this._output.just_added_newline()||Se),this._output.space_before_token=oe,this.print_token(b),this._output.space_before_token=!0;return}}if(W){this.allow_wrap_or_preserved_newline(b),oe=!1;var fe=this._tokens.peek();xe=fe&&c(fe.type,[s.WORD,s.RESERVED])}else if(b.text==="...")this.allow_wrap_or_preserved_newline(b),oe=this._flags.last_token.type===s.START_BLOCK,xe=!1;else if(c(b.text,["--","++","!","~"])||Y){if((this._flags.last_token.type===s.COMMA||this._flags.last_token.type===s.START_EXPR)&&this.allow_wrap_or_preserved_newline(b),oe=!1,xe=!1,b.newlines&&(b.text==="--"||b.text==="++"||b.text==="~")){var le=R(this._flags.last_token,C)&&b.newlines;le&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(le,!0)}this._flags.last_token.text===";"&&N(this._flags.mode)&&(oe=!0),this._flags.last_token.type===s.RESERVED?oe=!0:this._flags.last_token.type===s.END_EXPR?oe=!(this._flags.last_token.text==="]"&&(b.text==="--"||b.text==="++")):this._flags.last_token.type===s.OPERATOR&&(oe=c(b.text,["--","-","++","+"])&&c(this._flags.last_token.text,["--","-","++","+"]),c(b.text,["+","-"])&&c(this._flags.last_token.text,["--","++"])&&(xe=!0)),(this._flags.mode===d.BlockStatement&&!this._flags.inline_frame||this._flags.mode===d.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||oe,this.print_token(b),this._output.space_before_token=xe},j.prototype.handle_block_comment=function(b,W){if(this._output.raw){this._output.add_raw_token(b),b.directives&&b.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(b.directives){this.print_newline(!1,W),this.print_token(b),b.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!h.newline.test(b.text)&&!b.newlines){this._output.space_before_token=!0,this.print_token(b),this._output.space_before_token=!0;return}else this.print_block_commment(b,W)},j.prototype.print_block_commment=function(b,W){var Y=g(b.text),ie,oe=!1,xe=!1,ve=b.whitespace_before,we=ve.length;if(this.print_newline(!1,W),this.print_token_line_indentation(b),this._output.add_token(Y[0]),this.print_newline(!1,W),Y.length>1){for(Y=Y.slice(1),oe=D(Y,"*"),xe=H(Y,ve),oe&&(this._flags.alignment=1),ie=0;ie<Y.length;ie++)oe?(this.print_token_line_indentation(b),this._output.add_token(L(Y[ie]))):xe&&Y[ie]?(this.print_token_line_indentation(b),this._output.add_token(Y[ie].substring(we))):(this._output.current_line.set_indent(-1),this._output.add_token(Y[ie])),this.print_newline(!1,W);this._flags.alignment=0}},j.prototype.handle_comment=function(b,W){b.newlines?this.print_newline(!1,W):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(b),this.print_newline(!1,W)},j.prototype.handle_dot=function(b){this.start_of_statement(b)||this.handle_whitespace_and_comments(b,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),R(this._flags.last_token,C)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(b,this._flags.last_token.text===")"&&this._options.break_chained_methods),this._options.unindent_chained_methods&&this._output.just_added_newline()&&this.deindent(),this.print_token(b)},j.prototype.handle_unknown=function(b,W){this.print_token(b),b.text[b.text.length-1]===`
`&&this.print_newline(!1,W)},j.prototype.handle_eof=function(b){for(;this._flags.mode===d.Statement;)this.restore_mode();this.handle_whitespace_and_comments(b)},M.exports.Beautifier=j},function(M){function O(p){this.__parent=p,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}O.prototype.clone_empty=function(){var p=new O(this.__parent);return p.set_indent(this.__indent_count,this.__alignment_count),p},O.prototype.item=function(p){return p<0?this.__items[this.__items.length+p]:this.__items[p]},O.prototype.has_match=function(p){for(var h=this.__items.length-1;h>=0;h--)if(this.__items[h].match(p))return!0;return!1},O.prototype.set_indent=function(p,h){this.is_empty()&&(this.__indent_count=p||0,this.__alignment_count=h||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},O.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},O.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},O.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var p=this.__parent.current_line;return p.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),p.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),p.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,p.__items[0]===" "&&(p.__items.splice(0,1),p.__character_count-=1),!0}return!1},O.prototype.is_empty=function(){return this.__items.length===0},O.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},O.prototype.push=function(p){this.__items.push(p);var h=p.lastIndexOf(`
`);h!==-1?this.__character_count=p.length-h:this.__character_count+=p.length},O.prototype.pop=function(){var p=null;return this.is_empty()||(p=this.__items.pop(),this.__character_count-=p.length),p},O.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},O.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},O.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},O.prototype.toString=function(){var p="";return this.is_empty()?this.__parent.indent_empty_lines&&(p=this.__parent.get_indent_string(this.__indent_count)):(p=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),p+=this.__items.join("")),p};function v(p,h){this.__cache=[""],this.__indent_size=p.indent_size,this.__indent_string=p.indent_char,p.indent_with_tabs||(this.__indent_string=new Array(p.indent_size+1).join(p.indent_char)),h=h||"",p.indent_level>0&&(h=new Array(p.indent_level+1).join(this.__indent_string)),this.__base_string=h,this.__base_string_length=h.length}v.prototype.get_indent_size=function(p,h){var o=this.__base_string_length;return h=h||0,p<0&&(o=0),o+=p*this.__indent_size,o+=h,o},v.prototype.get_indent_string=function(p,h){var o=this.__base_string;return h=h||0,p<0&&(p=0,o=""),h+=p*this.__indent_size,this.__ensure_cache(h),o+=this.__cache[h],o},v.prototype.__ensure_cache=function(p){for(;p>=this.__cache.length;)this.__add_column()},v.prototype.__add_column=function(){var p=this.__cache.length,h=0,o="";this.__indent_size&&p>=this.__indent_size&&(h=Math.floor(p/this.__indent_size),p-=h*this.__indent_size,o=new Array(h+1).join(this.__indent_string)),p&&(o+=new Array(p+1).join(" ")),this.__cache.push(o)};function m(p,h){this.__indent_cache=new v(p,h),this.raw=!1,this._end_with_newline=p.end_with_newline,this.indent_size=p.indent_size,this.wrap_line_length=p.wrap_line_length,this.indent_empty_lines=p.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new O(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}m.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},m.prototype.get_line_number=function(){return this.__lines.length},m.prototype.get_indent_string=function(p,h){return this.__indent_cache.get_indent_string(p,h)},m.prototype.get_indent_size=function(p,h){return this.__indent_cache.get_indent_size(p,h)},m.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},m.prototype.add_new_line=function(p){return this.is_empty()||!p&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},m.prototype.get_code=function(p){this.trim(!0);var h=this.current_line.pop();h&&(h[h.length-1]===`
`&&(h=h.replace(/\n+$/g,"")),this.current_line.push(h)),this._end_with_newline&&this.__add_outputline();var o=this.__lines.join(`
`);return p!==`
`&&(o=o.replace(/[\n]/g,p)),o},m.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},m.prototype.set_indent=function(p,h){return p=p||0,h=h||0,this.next_line.set_indent(p,h),this.__lines.length>1?(this.current_line.set_indent(p,h),!0):(this.current_line.set_indent(),!1)},m.prototype.add_raw_token=function(p){for(var h=0;h<p.newlines;h++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(p.whitespace_before),this.current_line.push(p.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},m.prototype.add_token=function(p){this.__add_space_before_token(),this.current_line.push(p),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},m.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},m.prototype.remove_indent=function(p){for(var h=this.__lines.length;p<h;)this.__lines[p]._remove_indent(),p++;this.current_line._remove_wrap_indent()},m.prototype.trim=function(p){for(p=p===void 0?!1:p,this.current_line.trim();p&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},m.prototype.just_added_newline=function(){return this.current_line.is_empty()},m.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},m.prototype.ensure_empty_line_above=function(p,h){for(var o=this.__lines.length-2;o>=0;){var f=this.__lines[o];if(f.is_empty())break;if(f.item(0).indexOf(p)!==0&&f.item(-1)!==h){this.__lines.splice(o+1,0,new O(this)),this.previous_line=this.__lines[this.__lines.length-2];break}o--}},M.exports.Output=m},function(M){function O(v,m,p,h){this.type=v,this.text=m,this.comments_before=null,this.newlines=p||0,this.whitespace_before=h||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}M.exports.Token=O},function(M,O){var v="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",m="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",p="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc",h="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f",o="(?:\\\\u[0-9a-fA-F]{4}|["+v+p+"])",f="(?:\\\\u[0-9a-fA-F]{4}|["+m+p+h+"])*";O.identifier=new RegExp(o+f,"g"),O.identifierStart=new RegExp(o),O.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+m+p+h+"])+");var l=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;O.newline=/[\n\r\u2028\u2029]/,O.lineBreak=new RegExp(`\r
|`+O.newline.source),O.allLineBreaks=new RegExp(O.lineBreak.source,"g")},function(M,O,v){var m=v(6).Options,p=["before-newline","after-newline","preserve-newline"];function h(o){m.call(this,o,"js");var f=this.raw_options.brace_style||null;f==="expand-strict"?this.raw_options.brace_style="expand":f==="collapse-preserve-inline"?this.raw_options.brace_style="collapse,preserve-inline":this.raw_options.braces_on_own_line!==void 0&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var l=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var r=0;r<l.length;r++)l[r]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=l[r];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",p),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}h.prototype=new m,M.exports.Options=h},function(M){function O(p,h){this.raw_options=v(p,h),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}O.prototype._get_array=function(p,h){var o=this.raw_options[p],f=h||[];return typeof o=="object"?o!==null&&typeof o.concat=="function"&&(f=o.concat()):typeof o=="string"&&(f=o.split(/[^a-zA-Z0-9_\/\-]+/)),f},O.prototype._get_boolean=function(p,h){var o=this.raw_options[p],f=o===void 0?!!h:!!o;return f},O.prototype._get_characters=function(p,h){var o=this.raw_options[p],f=h||"";return typeof o=="string"&&(f=o.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),f},O.prototype._get_number=function(p,h){var o=this.raw_options[p];h=parseInt(h,10),isNaN(h)&&(h=0);var f=parseInt(o,10);return isNaN(f)&&(f=h),f},O.prototype._get_selection=function(p,h,o){var f=this._get_selection_list(p,h,o);if(f.length!==1)throw new Error("Invalid Option Value: The option '"+p+`' can only be one of the following values:
`+h+`
You passed in: '`+this.raw_options[p]+"'");return f[0]},O.prototype._get_selection_list=function(p,h,o){if(!h||h.length===0)throw new Error("Selection list cannot be empty.");if(o=o||[h[0]],!this._is_valid_selection(o,h))throw new Error("Invalid Default Value!");var f=this._get_array(p,o);if(!this._is_valid_selection(f,h))throw new Error("Invalid Option Value: The option '"+p+`' can contain only the following values:
`+h+`
You passed in: '`+this.raw_options[p]+"'");return f},O.prototype._is_valid_selection=function(p,h){return p.length&&h.length&&!p.some(function(o){return h.indexOf(o)===-1})};function v(p,h){var o={};p=m(p);var f;for(f in p)f!==h&&(o[f]=p[f]);if(h&&p[h])for(f in p[h])o[f]=p[h][f];return o}function m(p){var h={},o;for(o in p){var f=o.replace(/-/g,"_");h[f]=p[o]}return h}M.exports.Options=O,M.exports.normalizeOpts=m,M.exports.mergeOpts=v},function(M,O,v){var m=v(8).InputScanner,p=v(9).Tokenizer,h=v(9).TOKEN,o=v(13).Directives,f=v(4),l=v(12).Pattern,r=v(14).TemplatablePattern;function s(D,H){return H.indexOf(D)!==-1}var c={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:h.START,RAW:h.RAW,EOF:h.EOF},L=new o(/\/\*/,/\*\//),w=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,T=/[0-9]/,R=/[^\d\.]/,C=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),S=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";S=S.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),S="\\?\\.(?!\\d) "+S,S=S.replace(/ /g,"|");var x=new RegExp(S),_="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),d=_.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),u=new RegExp("^(?:"+d.join("|")+")$"),g,E=function(D,H){p.call(this,D,H),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var j=new l(this._input),I=new r(this._input).read_options(this._options);this.__patterns={template:I,identifier:I.starting_with(f.identifier).matching(f.identifierMatch),number:j.matching(w),punct:j.matching(x),comment:j.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:j.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:j.matching(/<!--/),html_comment_end:j.matching(/-->/),include:j.starting_with(/#include/).until_after(f.lineBreak),shebang:j.starting_with(/#!/).until_after(f.lineBreak),xml:j.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),single_quote:I.until(/['\\\n\r\u2028\u2029]/),double_quote:I.until(/["\\\n\r\u2028\u2029]/),template_text:I.until(/[`\\$]/),template_expression:I.until(/[`}\\]/)}};E.prototype=new p,E.prototype._is_comment=function(D){return D.type===c.COMMENT||D.type===c.BLOCK_COMMENT||D.type===c.UNKNOWN},E.prototype._is_opening=function(D){return D.type===c.START_BLOCK||D.type===c.START_EXPR},E.prototype._is_closing=function(D,H){return(D.type===c.END_BLOCK||D.type===c.END_EXPR)&&H&&(D.text==="]"&&H.text==="["||D.text===")"&&H.text==="("||D.text==="}"&&H.text==="{")},E.prototype._reset=function(){g=!1},E.prototype._get_next_token=function(D,H){var j=null;this._readWhitespace();var I=this._input.peek();return I===null?this._create_token(c.EOF,""):(j=j||this._read_non_javascript(I),j=j||this._read_string(I),j=j||this._read_word(D),j=j||this._read_singles(I),j=j||this._read_comment(I),j=j||this._read_regexp(I,D),j=j||this._read_xml(I,D),j=j||this._read_punctuation(),j=j||this._create_token(c.UNKNOWN,this._input.next()),j)},E.prototype._read_word=function(D){var H;if(H=this.__patterns.identifier.read(),H!=="")return H=H.replace(f.allLineBreaks,`
`),!(D.type===c.DOT||D.type===c.RESERVED&&(D.text==="set"||D.text==="get"))&&u.test(H)?(H==="in"||H==="of")&&(D.type===c.WORD||D.type===c.STRING)?this._create_token(c.OPERATOR,H):this._create_token(c.RESERVED,H):this._create_token(c.WORD,H);if(H=this.__patterns.number.read(),H!=="")return this._create_token(c.WORD,H)},E.prototype._read_singles=function(D){var H=null;return D==="("||D==="["?H=this._create_token(c.START_EXPR,D):D===")"||D==="]"?H=this._create_token(c.END_EXPR,D):D==="{"?H=this._create_token(c.START_BLOCK,D):D==="}"?H=this._create_token(c.END_BLOCK,D):D===";"?H=this._create_token(c.SEMICOLON,D):D==="."&&R.test(this._input.peek(1))?H=this._create_token(c.DOT,D):D===","&&(H=this._create_token(c.COMMA,D)),H&&this._input.next(),H},E.prototype._read_punctuation=function(){var D=this.__patterns.punct.read();if(D!=="")return D==="="?this._create_token(c.EQUALS,D):D==="?."?this._create_token(c.DOT,D):this._create_token(c.OPERATOR,D)},E.prototype._read_non_javascript=function(D){var H="";if(D==="#"){if(this._is_first_token()&&(H=this.__patterns.shebang.read(),H))return this._create_token(c.UNKNOWN,H.trim()+`
`);if(H=this.__patterns.include.read(),H)return this._create_token(c.UNKNOWN,H.trim()+`
`);D=this._input.next();var j="#";if(this._input.hasNext()&&this._input.testChar(T)){do D=this._input.next(),j+=D;while(this._input.hasNext()&&D!=="#"&&D!=="=");return D==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(j+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(j+="{}",this._input.next(),this._input.next())),this._create_token(c.WORD,j)}this._input.back()}else if(D==="<"&&this._is_first_token()){if(H=this.__patterns.html_comment_start.read(),H){for(;this._input.hasNext()&&!this._input.testChar(f.newline);)H+=this._input.next();return g=!0,this._create_token(c.COMMENT,H)}}else if(g&&D==="-"&&(H=this.__patterns.html_comment_end.read(),H))return g=!1,this._create_token(c.COMMENT,H);return null},E.prototype._read_comment=function(D){var H=null;if(D==="/"){var j="";if(this._input.peek(1)==="*"){j=this.__patterns.block_comment.read();var I=L.get_directives(j);I&&I.ignore==="start"&&(j+=L.readIgnored(this._input)),j=j.replace(f.allLineBreaks,`
`),H=this._create_token(c.BLOCK_COMMENT,j),H.directives=I}else this._input.peek(1)==="/"&&(j=this.__patterns.comment.read(),H=this._create_token(c.COMMENT,j))}return H},E.prototype._read_string=function(D){if(D==="`"||D==="'"||D==='"'){var H=this._input.next();return this.has_char_escapes=!1,D==="`"?H+=this._read_string_recursive("`",!0,"${"):H+=this._read_string_recursive(D),this.has_char_escapes&&this._options.unescape_strings&&(H=N(H)),this._input.peek()===D&&(H+=this._input.next()),H=H.replace(f.allLineBreaks,`
`),this._create_token(c.STRING,H)}return null},E.prototype._allow_regexp_or_xml=function(D){return D.type===c.RESERVED&&s(D.text,["return","case","throw","else","do","typeof","yield"])||D.type===c.END_EXPR&&D.text===")"&&D.opened.previous.type===c.RESERVED&&s(D.opened.previous.text,["if","while","for"])||s(D.type,[c.COMMENT,c.START_EXPR,c.START_BLOCK,c.START,c.END_BLOCK,c.OPERATOR,c.EQUALS,c.EOF,c.SEMICOLON,c.COMMA])},E.prototype._read_regexp=function(D,H){if(D==="/"&&this._allow_regexp_or_xml(H)){for(var j=this._input.next(),I=!1,b=!1;this._input.hasNext()&&(I||b||this._input.peek()!==D)&&!this._input.testChar(f.newline);)j+=this._input.peek(),I?I=!1:(I=this._input.peek()==="\\",this._input.peek()==="["?b=!0:this._input.peek()==="]"&&(b=!1)),this._input.next();return this._input.peek()===D&&(j+=this._input.next(),j+=this._input.read(f.identifier)),this._create_token(c.STRING,j)}return null},E.prototype._read_xml=function(D,H){if(this._options.e4x&&D==="<"&&this._allow_regexp_or_xml(H)){var j="",I=this.__patterns.xml.read_match();if(I){for(var b=I[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),W=b.indexOf("{")===0,Y=0;I;){var ie=!!I[1],oe=I[2],xe=!!I[I.length-1]||oe.slice(0,8)==="![CDATA[";if(!xe&&(oe===b||W&&oe.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(ie?--Y:++Y),j+=I[0],Y<=0)break;I=this.__patterns.xml.read_match()}return I||(j+=this._input.match(/[\s\S]*/g)[0]),j=j.replace(f.allLineBreaks,`
`),this._create_token(c.STRING,j)}}return null};function N(D){for(var H="",j=0,I=new m(D),b=null;I.hasNext();)if(b=I.match(/([\s]|[^\\]|\\\\)+/g),b&&(H+=b[0]),I.peek()==="\\"){if(I.next(),I.peek()==="x")b=I.match(/x([0-9A-Fa-f]{2})/g);else if(I.peek()==="u")b=I.match(/u([0-9A-Fa-f]{4})/g);else{H+="\\",I.hasNext()&&(H+=I.next());continue}if(!b)return D;if(j=parseInt(b[1],16),j>126&&j<=255&&b[0].indexOf("x")===0)return D;if(j>=0&&j<32){H+="\\"+b[0];continue}else j===34||j===39||j===92?H+="\\"+String.fromCharCode(j):H+=String.fromCharCode(j)}return H}E.prototype._read_string_recursive=function(D,H,j){var I,b;D==="'"?b=this.__patterns.single_quote:D==='"'?b=this.__patterns.double_quote:D==="`"?b=this.__patterns.template_text:D==="}"&&(b=this.__patterns.template_expression);for(var W=b.read(),Y="";this._input.hasNext();){if(Y=this._input.next(),Y===D||!H&&f.newline.test(Y)){this._input.back();break}else Y==="\\"&&this._input.hasNext()?(I=this._input.peek(),I==="x"||I==="u"?this.has_char_escapes=!0:I==="\r"&&this._input.peek(1)===`
`&&this._input.next(),Y+=this._input.next()):j&&(j==="${"&&Y==="$"&&this._input.peek()==="{"&&(Y+=this._input.next()),j===Y&&(D==="`"?Y+=this._read_string_recursive("}",H,"`"):Y+=this._read_string_recursive("`",H,"${"),this._input.hasNext()&&(Y+=this._input.next())));Y+=b.read(),W+=Y}return W},M.exports.Tokenizer=E,M.exports.TOKEN=c,M.exports.positionable_operators=C.slice(),M.exports.line_starters=_.slice()},function(M){var O=RegExp.prototype.hasOwnProperty("sticky");function v(m){this.__input=m||"",this.__input_length=this.__input.length,this.__position=0}v.prototype.restart=function(){this.__position=0},v.prototype.back=function(){this.__position>0&&(this.__position-=1)},v.prototype.hasNext=function(){return this.__position<this.__input_length},v.prototype.next=function(){var m=null;return this.hasNext()&&(m=this.__input.charAt(this.__position),this.__position+=1),m},v.prototype.peek=function(m){var p=null;return m=m||0,m+=this.__position,m>=0&&m<this.__input_length&&(p=this.__input.charAt(m)),p},v.prototype.__match=function(m,p){m.lastIndex=p;var h=m.exec(this.__input);return h&&!(O&&m.sticky)&&(h.index!==p&&(h=null)),h},v.prototype.test=function(m,p){return p=p||0,p+=this.__position,p>=0&&p<this.__input_length?!!this.__match(m,p):!1},v.prototype.testChar=function(m,p){var h=this.peek(p);return m.lastIndex=0,h!==null&&m.test(h)},v.prototype.match=function(m){var p=this.__match(m,this.__position);return p?this.__position+=p[0].length:p=null,p},v.prototype.read=function(m,p,h){var o="",f;return m&&(f=this.match(m),f&&(o+=f[0])),p&&(f||!m)&&(o+=this.readUntil(p,h)),o},v.prototype.readUntil=function(m,p){var h="",o=this.__position;m.lastIndex=this.__position;var f=m.exec(this.__input);return f?(o=f.index,p&&(o+=f[0].length)):o=this.__input_length,h=this.__input.substring(this.__position,o),this.__position=o,h},v.prototype.readUntilAfter=function(m){return this.readUntil(m,!0)},v.prototype.get_regexp=function(m,p){var h=null,o="g";return p&&O&&(o="y"),typeof m=="string"&&m!==""?h=new RegExp(m,o):m&&(h=new RegExp(m.source,o)),h},v.prototype.get_literal_regexp=function(m){return RegExp(m.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},v.prototype.peekUntilAfter=function(m){var p=this.__position,h=this.readUntilAfter(m);return this.__position=p,h},v.prototype.lookBack=function(m){var p=this.__position-1;return p>=m.length&&this.__input.substring(p-m.length,p).toLowerCase()===m},M.exports.InputScanner=v},function(M,O,v){var m=v(8).InputScanner,p=v(3).Token,h=v(10).TokenStream,o=v(11).WhitespacePattern,f={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},l=function(r,s){this._input=new m(r),this._options=s||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new o(this._input)};l.prototype.tokenize=function(){this._input.restart(),this.__tokens=new h,this._reset();for(var r,s=new p(f.START,""),c=null,L=[],w=new h;s.type!==f.EOF;){for(r=this._get_next_token(s,c);this._is_comment(r);)w.add(r),r=this._get_next_token(s,c);w.isEmpty()||(r.comments_before=w,w=new h),r.parent=c,this._is_opening(r)?(L.push(c),c=r):c&&this._is_closing(r,c)&&(r.opened=c,c.closed=r,c=L.pop(),r.parent=c),r.previous=s,s.next=r,this.__tokens.add(r),s=r}return this.__tokens},l.prototype._is_first_token=function(){return this.__tokens.isEmpty()},l.prototype._reset=function(){},l.prototype._get_next_token=function(r,s){this._readWhitespace();var c=this._input.read(/.+/g);return c?this._create_token(f.RAW,c):this._create_token(f.EOF,"")},l.prototype._is_comment=function(r){return!1},l.prototype._is_opening=function(r){return!1},l.prototype._is_closing=function(r,s){return!1},l.prototype._create_token=function(r,s){var c=new p(r,s,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return c},l.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},M.exports.Tokenizer=l,M.exports.TOKEN=f},function(M){function O(v){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=v}O.prototype.restart=function(){this.__position=0},O.prototype.isEmpty=function(){return this.__tokens_length===0},O.prototype.hasNext=function(){return this.__position<this.__tokens_length},O.prototype.next=function(){var v=null;return this.hasNext()&&(v=this.__tokens[this.__position],this.__position+=1),v},O.prototype.peek=function(v){var m=null;return v=v||0,v+=this.__position,v>=0&&v<this.__tokens_length&&(m=this.__tokens[v]),m},O.prototype.add=function(v){this.__parent_token&&(v.parent=this.__parent_token),this.__tokens.push(v),this.__tokens_length+=1},M.exports.TokenStream=O},function(M,O,v){var m=v(12).Pattern;function p(h,o){m.call(this,h,o),o?this._line_regexp=this._input.get_regexp(o._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}p.prototype=new m,p.prototype.__set_whitespace_patterns=function(h,o){h+="\\t ",o+="\\n\\r",this._match_pattern=this._input.get_regexp("["+h+o+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+o+"]")},p.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var h=this._input.read(this._match_pattern);if(h===" ")this.whitespace_before_token=" ";else if(h){var o=this.__split(this._newline_regexp,h);this.newline_count=o.length-1,this.whitespace_before_token=o[this.newline_count]}return h},p.prototype.matching=function(h,o){var f=this._create();return f.__set_whitespace_patterns(h,o),f._update(),f},p.prototype._create=function(){return new p(this._input,this)},p.prototype.__split=function(h,o){h.lastIndex=0;for(var f=0,l=[],r=h.exec(o);r;)l.push(o.substring(f,r.index)),f=r.index+r[0].length,r=h.exec(o);return f<o.length?l.push(o.substring(f,o.length)):l.push(""),l},M.exports.WhitespacePattern=p},function(M){function O(v,m){this._input=v,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,m&&(this._starting_pattern=this._input.get_regexp(m._starting_pattern,!0),this._match_pattern=this._input.get_regexp(m._match_pattern,!0),this._until_pattern=this._input.get_regexp(m._until_pattern),this._until_after=m._until_after)}O.prototype.read=function(){var v=this._input.read(this._starting_pattern);return(!this._starting_pattern||v)&&(v+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),v},O.prototype.read_match=function(){return this._input.match(this._match_pattern)},O.prototype.until_after=function(v){var m=this._create();return m._until_after=!0,m._until_pattern=this._input.get_regexp(v),m._update(),m},O.prototype.until=function(v){var m=this._create();return m._until_after=!1,m._until_pattern=this._input.get_regexp(v),m._update(),m},O.prototype.starting_with=function(v){var m=this._create();return m._starting_pattern=this._input.get_regexp(v,!0),m._update(),m},O.prototype.matching=function(v){var m=this._create();return m._match_pattern=this._input.get_regexp(v,!0),m._update(),m},O.prototype._create=function(){return new O(this._input,this)},O.prototype._update=function(){},M.exports.Pattern=O},function(M){function O(v,m){v=typeof v=="string"?v:v.source,m=typeof m=="string"?m:m.source,this.__directives_block_pattern=new RegExp(v+/ beautify( \w+[:]\w+)+ /.source+m,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(v+/\sbeautify\signore:end\s/.source+m,"g")}O.prototype.get_directives=function(v){if(!v.match(this.__directives_block_pattern))return null;var m={};this.__directive_pattern.lastIndex=0;for(var p=this.__directive_pattern.exec(v);p;)m[p[1]]=p[2],p=this.__directive_pattern.exec(v);return m},O.prototype.readIgnored=function(v){return v.readUntilAfter(this.__directives_end_ignore_pattern)},M.exports.Directives=O},function(M,O,v){var m=v(12).Pattern,p={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function h(o,f){m.call(this,o,f),this.__template_pattern=null,this._disabled=Object.assign({},p),this._excluded=Object.assign({},p),f&&(this.__template_pattern=this._input.get_regexp(f.__template_pattern),this._excluded=Object.assign(this._excluded,f._excluded),this._disabled=Object.assign(this._disabled,f._disabled));var l=new m(o);this.__patterns={handlebars_comment:l.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:l.starting_with(/{{{/).until_after(/}}}/),handlebars:l.starting_with(/{{/).until_after(/}}/),php:l.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:l.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:l.starting_with(/{%/).until_after(/%}/),django_value:l.starting_with(/{{/).until_after(/}}/),django_comment:l.starting_with(/{#/).until_after(/#}/),smarty:l.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:l.starting_with(/{\*/).until_after(/\*}/),smarty_literal:l.starting_with(/{literal}/).until_after(/{\/literal}/)}}h.prototype=new m,h.prototype._create=function(){return new h(this._input,this)},h.prototype._update=function(){this.__set_templated_pattern()},h.prototype.disable=function(o){var f=this._create();return f._disabled[o]=!0,f._update(),f},h.prototype.read_options=function(o){var f=this._create();for(var l in p)f._disabled[l]=o.templating.indexOf(l)===-1;return f._update(),f},h.prototype.exclude=function(o){var f=this._create();return f._excluded[o]=!0,f._update(),f},h.prototype.read=function(){var o="";this._match_pattern?o=this._input.read(this._starting_pattern):o=this._input.read(this._starting_pattern,this.__template_pattern);for(var f=this._read_template();f;)this._match_pattern?f+=this._input.read(this._match_pattern):f+=this._input.readUntil(this.__template_pattern),o+=f,f=this._read_template();return this._until_after&&(o+=this._input.readUntilAfter(this._until_pattern)),o},h.prototype.__set_templated_pattern=function(){var o=[];this._disabled.php||o.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||o.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||o.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(o.push(this.__patterns.django._starting_pattern.source),o.push(this.__patterns.django_value._starting_pattern.source),o.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||o.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&o.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+o.join("|")+")")},h.prototype._read_template=function(){var o="",f=this._input.peek();if(f==="<"){var l=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&l==="?"&&(o=o||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&l==="%"&&(o=o||this.__patterns.erb.read())}else f==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(o=o||this.__patterns.handlebars_comment.read(),o=o||this.__patterns.handlebars_unescaped.read(),o=o||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(o=o||this.__patterns.django_value.read()),this._excluded.django||(o=o||this.__patterns.django_comment.read(),o=o||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(o=o||this.__patterns.smarty_comment.read(),o=o||this.__patterns.smarty_literal.read(),o=o||this.__patterns.smarty.read()));return o},M.exports.TemplatablePattern=h}],U={};function K(M){var O=U[M];if(O!==void 0)return O.exports;var v=U[M]={exports:{}};return B[M](v,v.exports,K),v.exports}var G=K(0);P=G})();var $=P;!(ue=[],Z=function(){return{js_beautify:$}}.apply(Je,ue),Z!==void 0&&(_t.exports=Z))})()},"7Cbv":function(_t,Je,ne){"use strict";var ue=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Z=new Uint8Array(16);function P(){if(!ue)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ue(Z)}var $=/^(?:[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 B(p){return typeof p=="string"&&$.test(p)}for(var U=B,K=[],G=0;G<256;++G)K.push((G+256).toString(16).substr(1));function M(p){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=(K[p[h+0]]+K[p[h+1]]+K[p[h+2]]+K[p[h+3]]+"-"+K[p[h+4]]+K[p[h+5]]+"-"+K[p[h+6]]+K[p[h+7]]+"-"+K[p[h+8]]+K[p[h+9]]+"-"+K[p[h+10]]+K[p[h+11]]+K[p[h+12]]+K[p[h+13]]+K[p[h+14]]+K[p[h+15]]).toLowerCase();if(!U(o))throw TypeError("Stringified UUID is invalid");return o}var O=M;function v(p,h,o){p=p||{};var f=p.random||(p.rng||P)();if(f[6]=f[6]&15|64,f[8]=f[8]&63|128,h){o=o||0;for(var l=0;l<16;++l)h[o+l]=f[l];return h}return O(f)}var m=Je.a=v},"7ahc":function(_t,Je,ne){"use strict";ne.d(Je,"a",function(){return L});var ue=ne("k1fw"),Z=ne("0Owb"),P=ne("+L6B"),$=ne("2/Rp"),B=ne("y8nQ"),U=ne("Vl3Y"),K=ne("tJVT"),G=ne("OaEy"),M=ne("2fM7"),O=ne("q1tI"),v=ne.n(O),m=ne("VrN/"),p=ne.n(m),h=ne("p77/"),o=ne.n(h),f=ne("c5Ni"),l=ne.n(f),r=M.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},c={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};Je.b=function(w){var T=w.callback,R=w.onCancel,C=Object(O.useState)("python"),S=Object(K.a)(C,2),x=S[0],_=S[1];function d(g){_(c[g][1])}function u(g){T(g)}return v.a.createElement(U.a,Object(Z.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:u}),v.a.createElement(U.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},v.a.createElement(M.a,{onChange:d},Object.keys(c).map(function(g){return v.a.createElement(r,{key:g,value:g},c[g][0])}))),v.a.createElement(U.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},v.a.createElement(L,{mode:x})),v.a.createElement("div",{className:"flex-container flex-end"},v.a.createElement($.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement($.a,{type:"ghost",onClick:R},"\u53D6\u6D88")))};function L(w){var T=w.value,R=w.onChange,C=w.mode,S=w.options,x=S===void 0?{}:S,_=Object(O.useRef)(),d=Object(O.useState)(),u=Object(K.a)(d,2),g=u[0],E=u[1];return Object(O.useEffect)(function(){if(g){function N(D){var H=D.getValue();R&&R(H)}return g.on("change",N),function(){g.off("change",N)}}},[g,R]),Object(O.useEffect)(function(){g&&g.setOption("mode",C)},[g,C]),Object(O.useEffect)(function(){g&&((T!==g.getValue()||T==="")&&setTimeout(function(){g.setValue(T||" ")},300))},[g,T]),Object(O.useEffect)(function(){if(_.current&&!g){var N=p.a.fromTextArea(_.current,Object(ue.a)({mode:C,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},x));E(N)}},[_.current,g]),v.a.createElement("div",{className:"my-codemirror-container"},v.a.createElement("textarea",{ref:_}))}},"8EBN":function(_t,Je,ne){(function(ue){ue(ne("VrN/"))})(function(ue){"use strict";ue.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var Z=0;Z<ue.modeInfo.length;Z++){var P=ue.modeInfo[Z];P.mimes&&(P.mime=P.mimes[0])}ue.findModeByMIME=function($){$=$.toLowerCase();for(var B=0;B<ue.modeInfo.length;B++){var U=ue.modeInfo[B];if(U.mime==$)return U;if(U.mimes){for(var K=0;K<U.mimes.length;K++)if(U.mimes[K]==$)return U}}if(/\+xml$/.test($))return ue.findModeByMIME("application/xml");if(/\+json$/.test($))return ue.findModeByMIME("application/json")},ue.findModeByExtension=function($){$=$.toLowerCase();for(var B=0;B<ue.modeInfo.length;B++){var U=ue.modeInfo[B];if(U.ext){for(var K=0;K<U.ext.length;K++)if(U.ext[K]==$)return U}}},ue.findModeByFileName=function($){for(var B=0;B<ue.modeInfo.length;B++){var U=ue.modeInfo[B];if(U.file&&U.file.test($))return U}var K=$.lastIndexOf("."),G=K>-1&&$.substring(K+1,$.length);if(G)return ue.findModeByExtension(G)},ue.findModeByName=function($){$=$.toLowerCase();for(var B=0;B<ue.modeInfo.length;B++){var U=ue.modeInfo[B];if(U.name.toLowerCase()==$)return U;if(U.alias){for(var K=0;K<U.alias.length;K++)if(U.alias[K].toLowerCase()==$)return U}}}})},"8hTe":function(_t,Je,ne){_t.exports={button:"button___1wy9m"}},"9Bee":function(_t,Je,ne){"use strict";var ue=ne("DYRE"),Z=ne("zeV3"),P=ne("+L6B"),$=ne("2/Rp"),B=ne("k1fw"),U=ne("9og8"),K=ne("tJVT"),G=ne("WmNS"),M=ne.n(G),O=ne("q1tI"),v=ne.n(O),m=ne("vg9a"),p=ne("DlQD"),h=ne.n(p),o=ne("rUJ1");function f(X,y){var A=X.match(/^(\s+)(?:```)/);if(A===null)return y;var F=A[1];return y.split(`
`).map(function(q){var V=q.match(/^\s+/);if(V===null)return q;var me=Object(K.a)(V,1),He=me[0];return He.length>=F.length?q.slice(F.length):q}).join(`
`)}var l=[],r=["<ul>"],s=new h.a.Renderer,c=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function L(){l.length=0,r=["<ul>"]}var w={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function T(X,y,A,F){if(y>=X.length||X[y].level<=A)return y;var q=X[y];F.push("<li><a href='#"+q.anchor+"'>"+q.text+"</a>"),y++;var V=[];return y=T(X,y,q.level,V),V.length>0&&(F.push("<ul>"),V.forEach(function(me){F.push(me)}),F.push("</ul>")),F.push("</li>"),y=T(X,y,A,F),y}function R(){return T(l,0,0,r),r.push("</ul>"),r.join("")}var C={heading:function(y){var A=c.exec(y);if(A)return{type:"heading",raw:A[0],depth:A[1].length,text:A[2]}},fences:function(y){var A=this.rules.block.fences.exec(y);if(A){var F=A[0],q=f(F,A[3]||""),V=A[2]?A[2].trim():A[2];if(["latex","katex","math"].indexOf(V)>=0){var me=_(),He=q;q=me,d[me]={type:"block",expression:He}}return{type:"code",raw:F,lang:V,text:q}}}},S=/(?:\${2})([^\n`]+?)(?:\${2})/gi,x=0,_=function(){return"__special_katext_id_".concat(x++,"__")},d={};function u(){return d}function g(){x=0,d={}}function E(X){return X=X.replace(S,function(y,A){var F=_();return d[F]={type:"inline",expression:A},F}),X}var N=s.listitem;s.listitem=function(X){return N(E(X))};var D=s.paragraph;s.paragraph=function(X){return D(E(X))};var H=s.tablecell;s.tablecell=function(X,y){return H(E(X),y)},s.code=function(X,y,A){var F=(y||"").match(/\S*/)[0];return F?["latex","katex","math"].indexOf(F)>=0?"<p class='editormd-tex'>".concat(X,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(y,'">').concat(A?X:Object(o.escape)(X,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(A?X:Object(o.escape)(X,!0))+"</code></pre>"},s.heading=function(X,y,A){var F=this.options.headerPrefix+A.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return l.push({anchor:F,level:y,text:X}),"<h"+y+' id="'+F+'">'+X+"</h"+y+">"},h.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),h.a.use({tokenizer:C,renderer:s});var j=h.a,I=ne("SJMd"),b=ne("ulZh"),W=ne.n(b),Y=ne("m3rI"),ie=ne("Oy/b"),oe=ne("p5ED"),xe=ne("ErOA");/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var ve=function(X,y){return(ve=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,F){A.__proto__=F}||function(A,F){for(var q in F)Object.prototype.hasOwnProperty.call(F,q)&&(A[q]=F[q])})(X,y)};function we(X,y){function A(){this.constructor=X}ve(X,y),X.prototype=y===null?Object.create(y):(A.prototype=y.prototype,new A)}function Ce(X,y,A,F){return new(A||(A=Promise))(function(q,V){function me(yt){try{nt(F.next(yt))}catch(ze){V(ze)}}function He(yt){try{nt(F.throw(yt))}catch(ze){V(ze)}}function nt(yt){var ze;yt.done?q(yt.value):(ze=yt.value,ze instanceof A?ze:new A(function(xt){xt(ze)})).then(me,He)}nt((F=F.apply(X,y||[])).next())})}function Se(X,y){var A,F,q,V,me={label:0,sent:function(){if(1&q[0])throw q[1];return q[1]},trys:[],ops:[]};return V={next:He(0),throw:He(1),return:He(2)},typeof Symbol=="function"&&(V[Symbol.iterator]=function(){return this}),V;function He(nt){return function(yt){return function(ze){if(A)throw new TypeError("Generator is already executing.");for(;me;)try{if(A=1,F&&(q=2&ze[0]?F.return:ze[0]?F.throw||((q=F.return)&&q.call(F),0):F.next)&&!(q=q.call(F,ze[1])).done)return q;switch(F=0,q&&(ze=[2&ze[0],q.value]),ze[0]){case 0:case 1:q=ze;break;case 4:return me.label++,{value:ze[1],done:!1};case 5:me.label++,F=ze[1],ze=[0];continue;case 7:ze=me.ops.pop(),me.trys.pop();continue;default:if(!(q=me.trys,(q=q.length>0&&q[q.length-1])||ze[0]!==6&&ze[0]!==2)){me=0;continue}if(ze[0]===3&&(!q||ze[1]>q[0]&&ze[1]<q[3])){me.label=ze[1];break}if(ze[0]===6&&me.label<q[1]){me.label=q[1],q=ze;break}if(q&&me.label<q[2]){me.label=q[2],me.ops.push(ze);break}q[2]&&me.ops.pop(),me.trys.pop();continue}ze=y.call(X,me)}catch(xt){ze=[6,xt],F=0}finally{A=q=0}if(5&ze[0])throw ze[1];return{value:ze[0]?ze[1]:void 0,done:!0}}([nt,yt])}}}function fe(){for(var X=0,y=0,A=arguments.length;y<A;y++)X+=arguments[y].length;var F=Array(X),q=0;for(y=0;y<A;y++)for(var V=arguments[y],me=0,He=V.length;me<He;me++,q++)F[q]=V[me];return F}var le=function(){function X(){}return X.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},X.setAttributes=function(y,A){for(var F=0,q=A;F<q.length;F++){var V=q[F],me=V[0],He=V[1];y.setAttribute(me,He)}},X.createRect=function(y,A,F){var q=document.createElementNS("http://www.w3.org/2000/svg","rect");return q.setAttribute("width",y.toString()),q.setAttribute("height",A.toString()),F&&X.setAttributes(q,F),q},X.createLine=function(y,A,F,q,V){var me=document.createElementNS("http://www.w3.org/2000/svg","line");return me.setAttribute("x1",y.toString()),me.setAttribute("y1",A.toString()),me.setAttribute("x2",F.toString()),me.setAttribute("y2",q.toString()),V&&X.setAttributes(me,V),me},X.createPolygon=function(y,A){var F=document.createElementNS("http://www.w3.org/2000/svg","polygon");return F.setAttribute("points",y),A&&X.setAttributes(F,A),F},X.createCircle=function(y,A){var F=document.createElementNS("http://www.w3.org/2000/svg","circle");return F.setAttribute("cx",(y/2).toString()),F.setAttribute("cy",(y/2).toString()),F.setAttribute("r",y.toString()),A&&X.setAttributes(F,A),F},X.createEllipse=function(y,A,F){var q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return q.setAttribute("cx",(y/2).toString()),q.setAttribute("cy",(A/2).toString()),q.setAttribute("rx",(y/2).toString()),q.setAttribute("ry",(A/2).toString()),F&&X.setAttributes(q,F),q},X.createGroup=function(y){var A=document.createElementNS("http://www.w3.org/2000/svg","g");return y&&X.setAttributes(A,y),A},X.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},X.createMarker=function(y,A,F,q,V,me,He){var nt=document.createElementNS("http://www.w3.org/2000/svg","marker");return X.setAttributes(nt,[["id",y],["orient",A],["markerWidth",F.toString()],["markerHeight",q.toString()],["refX",V.toString()],["refY",me.toString()]]),nt.appendChild(He),nt},X.createText=function(y){var A=document.createElementNS("http://www.w3.org/2000/svg","text");return A.setAttribute("x","0"),A.setAttribute("y","0"),y&&X.setAttributes(A,y),A},X.createTSpan=function(y,A){var F=document.createElementNS("http://www.w3.org/2000/svg","tspan");return F.textContent=y,A&&X.setAttributes(F,A),F},X.createImage=function(y){var A=document.createElementNS("http://www.w3.org/2000/svg","image");return y&&X.setAttributes(A,y),A},X.createPoint=function(y,A){var F=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return F.x=y,F.y=A,F},X.createPath=function(y,A){var F=document.createElementNS("http://www.w3.org/2000/svg","path");return F.setAttribute("d",y),A&&X.setAttributes(F,A),F},X}(),te=function(){function X(){}return X.addKey=function(y){X.key=y},Object.defineProperty(X,"isLicensed",{get:function(){return!!X.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(X.key)},enumerable:!1,configurable:!0}),X}(),de=function(){function X(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return X.prototype.rasterize=function(y,A,F){var q=this;return new Promise(function(V){var me=F!==void 0?F:document.createElement("canvas");y===null&&(q.markersOnly=!0,q.naturalSize=!1);var He=document.createElementNS("http://www.w3.org/2000/svg","svg");He.setAttribute("xmlns","http://www.w3.org/2000/svg"),He.setAttribute("width",A.width.baseVal.valueAsString),He.setAttribute("height",A.height.baseVal.valueAsString),He.setAttribute("viewBox","0 0 "+A.viewBox.baseVal.width.toString()+" "+A.viewBox.baseVal.height.toString()),He.innerHTML=A.innerHTML,q.naturalSize===!0?(He.width.baseVal.value=y.naturalWidth,He.height.baseVal.value=y.naturalHeight):q.width!==void 0&&q.height!==void 0&&(He.width.baseVal.value=q.width,He.height.baseVal.value=q.height),me.width=He.width.baseVal.value,me.height=He.height.baseVal.value;var nt=He.outerHTML,yt=me.getContext("2d");q.markersOnly!==!0&&yt.drawImage(y,0,0,me.width,me.height);var ze=window.URL,xt=new Image(me.width,me.height);xt.setAttribute("crossOrigin","anonymous");var Kt=new Blob([nt],{type:"image/svg+xml"}),ti=ze.createObjectURL(Kt);xt.onload=function(){yt.drawImage(xt,0,0),ze.revokeObjectURL(ti);var ki=me.toDataURL(q.imageType,q.imageQuality);V(ki)},xt.src=ti})},X}(),se=function(){},Re=function(){function X(y){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+y+"_"}return Object.defineProperty(X.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(X.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(X.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),X.prototype.addClass=function(y){return this.styleSheet===void 0&&this.addStyleSheet(),y.name=""+this.classNamePrefix+y.localName,this.classes.push(y),this.styleSheet.sheet.insertRule("."+y.name+" {"+y.style+"}",this.styleSheet.sheet.cssRules.length),y},X.prototype.addRule=function(y){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(y),this.styleSheet.sheet.insertRule(y.selector+" {"+y.style+"}",this.styleSheet.sheet.cssRules.length)},X.prototype.addStyleSheet=function(){var y;this.styleSheet=document.createElement("style"),((y=this.styleSheetRoot)!==null&&y!==void 0?y:document.head).appendChild(this.styleSheet),this.addRule(new Le("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Le("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new Le("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new Te("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new Te("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},X.prototype.removeStyleSheet=function(){var y;this.styleSheet&&(((y=this.styleSheetRoot)!==null&&y!==void 0?y:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},X}(),Le=function(X,y){this.selector=X,this.style=y},Te=function(X,y){this.localName=X,this.style=y},Ie=function(){function X(y,A,F,q,V){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=y,this.displayMode=A,this.markerItems=F,this.uiStyleSettings=q,this.styles=V,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return X.prototype.show=function(y){var A=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=y,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var F=document.createElement("div");F.className=this.toolbarBlockStyleClass.name,F.style.whiteSpace="nowrap",this.uiContainer.appendChild(F),this.addActionButton(F,'<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(F,'<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(F,'<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(F,'<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(F,'<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(F,'<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(F,'<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(F,'<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(V){var me=document.createElement("div");me.className=""+A.toolbarButtonStyleClass.name,me.setAttribute("data-type-name",V.typeName),me.innerHTML=V.icon,me.addEventListener("click",function(){A.markerToolbarButtonClicked(me,V)}),A.buttons.push(me),A.markerButtons.push(me)}),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 q=document.createElement("div");q.className=this.toolbarBlockStyleClass.name,q.style.whiteSpace="nowrap",q.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(q),this.addActionButton(q,'<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(q,'<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()},X.prototype.addButtonClickListener=function(y){this.buttonClickListeners.push(y)},X.prototype.removeButtonClickListener=function(y){this.buttonClickListeners.indexOf(y)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(y),1)},X.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},X.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var y=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var A=0;A<this.markerButtons.length;A++)A<y||A===y&&this.markerButtons.length-1===y?this.markerButtonBlock.appendChild(this.markerButtons[A]):(A===y&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[A]))}},X.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")},X.prototype.resetButtonStyles=function(){var y=this;this.buttons.forEach(function(A){A.className=A.className.replace(y.uiStyleSettings.toolbarButtonStyleColorsClassName?y.uiStyleSettings.toolbarButtonStyleColorsClassName:y.toolbarButtonStyleColorsClass.name,"").trim(),A.className=A.className.replace(y.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?y.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:y.toolbarActiveButtonStyleColorsClass.name,"").trim(),A.className+=" "+(y.uiStyleSettings.toolbarButtonStyleColorsClassName?y.uiStyleSettings.toolbarButtonStyleColorsClassName:y.toolbarButtonStyleColorsClass.name)})},X.prototype.addActionButton=function(y,A,F){var q=this,V=document.createElement("div");switch(V.className=""+this.toolbarButtonStyleClass.name,V.innerHTML=A,V.setAttribute("data-action",F),V.addEventListener("click",function(){q.actionToolbarButtonClicked(V,F)}),F){case"select":V.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":V.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":V.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":V.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":V.style.fill=this.uiStyleSettings.closeButtonColor}y.appendChild(V),this.buttons.push(V)},X.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Te("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 Te("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Te("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new Te("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 Te("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var y=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Te("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*y)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*y)+`px;
padding: `+y+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Te("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Te("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Le("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new Le("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},X.prototype.markerToolbarButtonClicked=function(y,A){this.setActiveButton(y),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(F){return F("marker",A)}),this.markerButtonOverflowBlock.style.display="none"},X.prototype.actionToolbarButtonClicked=function(y,A){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(F){return F("action",A)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},X.prototype.setActiveButton=function(y){this.resetButtonStyles(),y.className=y.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),y.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},X.prototype.setActiveMarkerButton=function(y){var A=this.markerButtons.find(function(F){return F.getAttribute("data-type-name")===y});A&&this.setActiveButton(A)},X.prototype.setCurrentMarker=function(y){var A=this;this.currentMarker=y,this.buttons.filter(function(F){return/delete|notes/.test(F.getAttribute("data-action"))}).forEach(function(F){A.currentMarker===void 0?(F.style.fillOpacity="0.4",F.style.pointerEvents="none"):(F.style.fillOpacity="1",F.style.pointerEvents="all")})},X}(),Ue=function(){function X(y,A,F,q){this.panels=[],this.panelButtons=[],this.markerjsContainer=y,this.displayMode=A,this.uiStyleSettings=F,this.styles=q,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return X.prototype.addStyles=function(){var y;this.toolboxStyleClass=this.styles.addClass(new Te("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 Te("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var A=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Te("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Te("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Te("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 Te("toolbox-panel-row_colors",`
background-color: `+((y=this.uiStyleSettings.toolboxBackgroundColor)!==null&&y!==void 0?y:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new Te("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*A)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*A)+`px;
padding: `+A+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new Te("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Te("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new Le("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Le("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},X.prototype.show=function(y){var A;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=y,this.uiContainer.className=this.toolboxStyleClass.name+" "+((A=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&A!==void 0?A:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},X.prototype.setPanelButtons=function(y){var A,F,q=this;this.panels=y,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((A=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&A!==void 0?A:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((F=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&F!==void 0?F:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(V){var me;V.uiStyleSettings=q.uiStyleSettings;var He=document.createElement("div");He.className=q.toolboxButtonStyleClass.name+" "+((me=q.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&me!==void 0?me:q.toolboxButtonStyleColorsClass.name),He.innerHTML=V.icon,He.title=V.title,He.addEventListener("click",function(){q.panelButtonClick(V)}),q.panelButtons.push(He),q.buttonRow.appendChild(He)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},X.prototype.panelButtonClick=function(y){var A=this,F=-1;if(y!==this.activePanel){F=this.panels.indexOf(y),this.panelRow.innerHTML="";var q=y.getUi();q.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(q),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=y}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){A.displayMode==="inline"?A.panelRow.style.display="none":A.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(V,me){var He,nt;V.className=A.toolboxButtonStyleClass.name+" "+(me===F?""+((He=A.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&He!==void 0?He:A.toolboxActiveButtonStyleColorsClass.name):""+((nt=A.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&nt!==void 0?nt:A.toolboxButtonStyleColorsClass.name))})},X}(),We=function(X,y){this.title=X,this.icon=y},Fe=function(X){function y(A,F,q,V){var me=X.call(this,A,V||'<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 me.colors=[],me.addTransparent=!1,me.colorBoxes=[],me.colors=F,me.currentColor=q,me.setCurrentColor=me.setCurrentColor.bind(me),me.getColorBox=me.getColorBox.bind(me),me}return we(y,X),y.prototype.getUi=function(){var A=this,F=document.createElement("div");return F.style.overflow="hidden",F.style.whiteSpace="nowrap",this.colors.forEach(function(q){var V=A.getColorBox(q);F.appendChild(V),A.colorBoxes.push(V)}),F},y.prototype.getColorBox=function(A){var F=this,q=this.uiStyleSettings.toolbarHeight/4,V=this.uiStyleSettings.toolbarHeight-q,me=document.createElement("div");me.style.display="inline-block",me.style.boxSizing="content-box",me.style.width=V-2+"px",me.style.height=V-2+"px",me.style.padding="1px",me.style.marginRight="2px",me.style.marginBottom="2px",me.style.borderWidth="2px",me.style.borderStyle="solid",me.style.borderRadius=(V+2)/2+"px",me.style.borderColor=A===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",me.addEventListener("click",function(){F.setCurrentColor(A,me)});var He=document.createElement("div");return He.style.display="inline-block",He.style.width=V-2+"px",He.style.height=V-2+"px",He.style.backgroundColor=A,He.style.borderRadius=V/2+"px",A==="transparent"&&(He.style.fill=this.uiStyleSettings.toolboxAccentColor,He.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>`),me.appendChild(He),me},y.prototype.setCurrentColor=function(A,F){var q=this;this.currentColor=A,this.colorBoxes.forEach(function(V){V.style.borderColor=V===F?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(A)},y}(We),Ne=function(){function X(y,A,F){this._state="new",this._isSelected=!1,this._container=y,this._overlayContainer=A,this.globalSettings=F,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(X.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),X.prototype.ownsTarget=function(y){return!1},Object.defineProperty(X.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),X.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},X.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},X.prototype.pointerDown=function(y,A){},X.prototype.dblClick=function(y,A){},X.prototype.manipulate=function(y){},X.prototype.pointerUp=function(y){this.stateChanged()},X.prototype.dispose=function(){},X.prototype.addMarkerVisualToContainer=function(y){this.container.childNodes.length>0?this.container.insertBefore(y,this.container.childNodes[0]):this.container.appendChild(y)},X.prototype.getState=function(){return{typeName:X.typeName,state:this.state,notes:this.notes}},X.prototype.restoreState=function(y){this._state=y.state,this.notes=y.notes},X.prototype.scale=function(y,A){},X.prototype.colorChanged=function(y){this.onColorChanged&&this.onColorChanged(y),this.stateChanged()},X.prototype.fillColorChanged=function(y){this.onFillColorChanged&&this.onFillColorChanged(y),this.stateChanged()},X.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var y=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),y.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(y)&&this.onStateChanged(this)}},X.typeName="MarkerBase",X}(),Me=function(){function X(){this.findGripByVisual=this.findGripByVisual.bind(this)}return X.prototype.findGripByVisual=function(y){return this.topLeft.ownsTarget(y)?this.topLeft:this.topCenter.ownsTarget(y)?this.topCenter:this.topRight.ownsTarget(y)?this.topRight:this.centerLeft.ownsTarget(y)?this.centerLeft:this.centerRight.ownsTarget(y)?this.centerRight:this.bottomLeft.ownsTarget(y)?this.bottomLeft:this.bottomCenter.ownsTarget(y)?this.bottomCenter:this.bottomRight.ownsTarget(y)?this.bottomRight:void 0},X}(),$e=function(){function X(){this.GRIP_SIZE=10,this.visual=le.createGroup(),this.visual.appendChild(le.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(le.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return X.prototype.ownsTarget=function(y){return y===this.visual||y===this.visual.childNodes[0]||y===this.visual.childNodes[1]},X}(),et=function(){function X(){}return X.toITransformMatrix=function(y){return{a:y.a,b:y.b,c:y.c,d:y.d,e:y.e,f:y.f}},X.toSVGMatrix=function(y,A){return y.a=A.a,y.b=A.b,y.c=A.c,y.d=A.d,y.e=A.e,y.f=A.f,y},X}(),Qe=function(X){function y(A,F,q){var V=X.call(this,A,F,q)||this;return V.left=0,V.top=0,V.width=0,V.height=0,V.defaultSize={x:50,y:20},V.offsetX=0,V.offsetY=0,V.rotationAngle=0,V.CB_DISTANCE=10,V._suppressMarkerCreateEvent=!1,V.container.transform.baseVal.appendItem(le.createTransform()),V.setupControlBox(),V}return we(y,X),Object.defineProperty(y.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"visual",{get:function(){return this._visual},set:function(A){this._visual=A;var F=le.createTransform();this._visual.transform.baseVal.appendItem(F)},enumerable:!1,configurable:!0}),y.prototype.ownsTarget=function(A){return!!X.prototype.ownsTarget.call(this,A)||!!(this.controlGrips.findGripByVisual(A)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(A))},y.prototype.pointerDown=function(A,F){X.prototype.pointerDown.call(this,A,F),this.state==="new"&&(this.left=A.x,this.top=A.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var q=this.unrotatePoint(A);if(this.manipulationStartX=q.x,this.manipulationStartY=q.y,this.offsetX=q.x-this.left,this.offsetY=q.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(F),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(F)){this.activeGrip=this.rotatorGrip;var V=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=V.x-this.width/2,this.top=V.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var me=this.container.transform.baseVal.getItem(0);me.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(me,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},y.prototype.pointerUp=function(A){var F=this.state;X.prototype.pointerUp.call(this,A),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(A),this._state="select",F==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},y.prototype.moveVisual=function(A){this.visual.style.transform="translate("+A.x+"px, "+A.y+"px)"},y.prototype.manipulate=function(A){var F=this.unrotatePoint(A);this.state==="creating"?this.resize(A):this.state==="move"?(this.left=this.manipulationStartLeft+(F.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(F.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(F):this.state==="rotate"&&this.rotate(A)},y.prototype.resize=function(A){var F=this.manipulationStartLeft,q=this.manipulationStartWidth,V=this.manipulationStartTop,me=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:F=this.manipulationStartLeft+A.x-this.manipulationStartX,q=this.manipulationStartWidth+this.manipulationStartLeft-F;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:q=this.manipulationStartWidth+A.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:V=this.manipulationStartTop+A.y-this.manipulationStartY,me=this.manipulationStartHeight+this.manipulationStartTop-V;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:me=this.manipulationStartHeight+A.y-this.manipulationStartY}q>=0?(this.left=F,this.width=q):(this.left=F+q,this.width=-q),me>=0?(this.top=V,this.height=me):(this.top=V+me,this.height=-me),this.setSize()},y.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},y.prototype.rotate=function(A){if(Math.abs(A.x-this.centerX)>.1){var F=Math.sign(A.x-this.centerX);this.rotationAngle=180*Math.atan((A.y-this.centerY)/(A.x-this.centerX))/Math.PI+90*F,this.applyRotation()}},y.prototype.applyRotation=function(){var A=this.container.transform.baseVal.getItem(0);A.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(A,0)},y.prototype.rotatePoint=function(A){if(this.rotationAngle===0)return A;var F=this.container.getCTM(),q=le.createPoint(A.x,A.y);return{x:(q=q.matrixTransform(F)).x,y:q.y}},y.prototype.unrotatePoint=function(A){if(this.rotationAngle===0)return A;var F=this.container.getCTM();F=F.inverse();var q=le.createPoint(A.x,A.y);return{x:(q=q.matrixTransform(F)).x,y:q.y}},y.prototype.select=function(){X.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},y.prototype.deselect=function(){X.prototype.deselect.call(this),this.controlBox.style.display="none"},y.prototype.setupControlBox=function(){this.controlBox=le.createGroup();var A=le.createTransform();A.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(A),this.container.appendChild(this.controlBox),this.controlRect=le.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=le.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new Me,this.addControlGrips(),this.controlBox.style.display="none"},y.prototype.adjustControlBox=function(){var A=this.controlBox.transform.baseVal.getItem(0);A.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(A,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},y.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()},y.prototype.createGrip=function(){var A=new $e;return A.visual.transform.baseVal.appendItem(le.createTransform()),this.controlBox.appendChild(A.visual),A},y.prototype.positionGrips=function(){var A=this.controlGrips.topLeft.GRIP_SIZE,F=-A/2,q=F,V=(this.width+this.CB_DISTANCE)/2-A/2,me=(this.height+this.CB_DISTANCE)/2-A/2,He=this.height+this.CB_DISTANCE-A/2,nt=this.width+this.CB_DISTANCE-A/2;this.positionGrip(this.controlGrips.topLeft.visual,F,q),this.positionGrip(this.controlGrips.topCenter.visual,V,q),this.positionGrip(this.controlGrips.topRight.visual,nt,q),this.positionGrip(this.controlGrips.centerLeft.visual,F,me),this.positionGrip(this.controlGrips.centerRight.visual,nt,me),this.positionGrip(this.controlGrips.bottomLeft.visual,F,He),this.positionGrip(this.controlGrips.bottomCenter.visual,V,He),this.positionGrip(this.controlGrips.bottomRight.visual,nt,He),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,V,q-3*this.CB_DISTANCE)},y.prototype.positionGrip=function(A,F,q){var V=A.transform.baseVal.getItem(0);V.setTranslate(F,q),A.transform.baseVal.replaceItem(V,0)},y.prototype.hideControlBox=function(){this.controlBox.style.display="none"},y.prototype.showControlBox=function(){this.controlBox.style.display=""},y.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:et.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:et.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},X.prototype.getState.call(this))},y.prototype.restoreState=function(A){X.prototype.restoreState.call(this,A);var F=A;this.left=F.left,this.top=F.top,this.width=F.width,this.height=F.height,this.rotationAngle=F.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(et.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,F.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(et.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,F.containerTransformMatrix))},y.prototype.scale=function(A,F){X.prototype.scale.call(this,A,F);var q=this.rotatePoint({x:this.left,y:this.top}),V=this.unrotatePoint({x:q.x*A,y:q.y*F});this.left=V.x,this.top=V.y,this.width=this.width*A,this.height=this.height*F,this.adjustControlBox()},y}(Ne),Ze=function(X){function y(A,F,q){var V=X.call(this,A,F,q)||this;return V.fillColor="transparent",V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.opacity=1,V.setStrokeColor=V.setStrokeColor.bind(V),V.setFillColor=V.setFillColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.createVisual=V.createVisual.bind(V),V}return we(y,X),y.prototype.ownsTarget=function(A){return!(!X.prototype.ownsTarget.call(this,A)&&A!==this.visual)},y.prototype.createVisual=function(){this.visual=le.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},y.prototype.pointerDown=function(A,F){X.prototype.pointerDown.call(this,A,F),this.state==="new"&&(this.createVisual(),this.moveVisual(A),this._state="creating")},y.prototype.manipulate=function(A){X.prototype.manipulate.call(this,A)},y.prototype.resize=function(A){X.prototype.resize.call(this,A),this.setSize()},y.prototype.setSize=function(){X.prototype.setSize.call(this),le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},y.prototype.pointerUp=function(A){X.prototype.pointerUp.call(this,A),this.setSize()},y.prototype.setStrokeColor=function(A){this.strokeColor=A,this.visual&&le.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(A),this.stateChanged()},y.prototype.setFillColor=function(A){this.fillColor=A,this.visual&&le.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},y.prototype.setStrokeWidth=function(A){this.strokeWidth=A,this.visual&&le.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},y.prototype.setStrokeDasharray=function(A){this.strokeDasharray=A,this.visual&&le.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},y.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},X.prototype.getState.call(this))},y.prototype.restoreState=function(A){var F=A;this.fillColor=F.fillColor,this.strokeColor=F.strokeColor,this.strokeWidth=F.strokeWidth,this.strokeDasharray=F.strokeDasharray,this.opacity=F.opacity,this.createVisual(),X.prototype.restoreState.call(this,A),this.setSize()},y.prototype.scale=function(A,F){X.prototype.scale.call(this,A,F),this.setSize()},y.title="Rectangle marker",y}(Qe),dt=function(X){function y(A,F,q,V){var me=X.call(this,A,V||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return me.widths=[],me.widthBoxes=[],me.widths=F,me.currentWidth=q,me.setCurrentWidth=me.setCurrentWidth.bind(me),me}return we(y,X),y.prototype.getUi=function(){var A=this,F=document.createElement("div");return F.style.display="flex",F.style.overflow="hidden",F.style.flexGrow="2",this.widths.forEach(function(q){var V=document.createElement("div");V.style.display="flex",V.style.flexGrow="2",V.style.alignItems="center",V.style.justifyContent="space-between",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.borderColor=q===A.currentWidth?A.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){A.setCurrentWidth(q,V)}),F.appendChild(V);var me=document.createElement("div");me.innerText=q.toString(),me.style.marginRight="5px",V.appendChild(me);var He=document.createElement("div");He.style.minHeight="20px",He.style.flexGrow="2",He.style.display="flex",He.style.alignItems="center";var nt=document.createElement("hr");nt.style.minWidth="20px",nt.style.border="0px",nt.style.borderTop=q+"px solid "+A.uiStyleSettings.toolboxColor,nt.style.flexGrow="2",He.appendChild(nt),V.appendChild(He),A.widthBoxes.push(V)}),F},y.prototype.setCurrentWidth=function(A,F){var q=this;this.currentWidth=A,this.widthBoxes.forEach(function(V){V.style.borderColor=V===F?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},y}(We),it=function(X){function y(A,F,q,V){var me=X.call(this,A,V||'<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 me.styles=[],me.styleBoxes=[],me.styles=F,me.currentStyle=q,me.setCurrentStyle=me.setCurrentStyle.bind(me),me}return we(y,X),y.prototype.getUi=function(){var A=this,F=document.createElement("div");return F.style.display="flex",F.style.overflow="hidden",F.style.flexGrow="2",this.styles.forEach(function(q){var V=document.createElement("div");V.style.display="flex",V.style.alignItems="center",V.style.justifyContent="space-between",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.overflow="hidden",V.style.maxWidth=100/A.styles.length-5+"%",V.style.borderColor=q===A.currentStyle?A.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){A.setCurrentStyle(q,V)}),F.appendChild(V);var me=document.createElement("div");me.style.minHeight="20px",me.style.flexGrow="2",me.style.overflow="hidden";var He=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+A.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(q!==""?'stroke-dasharray="'+q+'"':"")+` />
</svg>`;me.innerHTML=He,V.appendChild(me),A.styleBoxes.push(V)}),F},y.prototype.setCurrentStyle=function(A,F){var q=this;this.currentStyle=A,this.styleBoxes.forEach(function(V){V.style.borderColor=V===F?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},y}(We),at=function(X){function y(A,F,q){var V=X.call(this,A,F,q)||this;return V.strokeColor=q.defaultColor,V.strokeWidth=q.defaultStrokeWidth,V.strokeDasharray=q.defaultStrokeDasharray,V.strokePanel=new Fe("Line color",q.defaultColorSet,q.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.strokeWidthPanel=new dt("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new it("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V}return we(y,X),Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var A=X.prototype.getState.call(this);return A.typeName=y.typeName,A},y.typeName="FrameMarker",y.title="Frame marker",y.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',y}(Ze),Pe=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},ut=function(X){function y(A,F,q){var V=X.call(this,A,F,q)||this;return V.x1=0,V.y1=0,V.x2=0,V.y2=0,V.defaultLength=50,V.manipulationStartX=0,V.manipulationStartY=0,V.manipulationStartX1=0,V.manipulationStartY1=0,V.manipulationStartX2=0,V.manipulationStartY2=0,V.setupControlBox(),V}return we(y,X),y.prototype.ownsTarget=function(A){return!!X.prototype.ownsTarget.call(this,A)||!(!this.grip1.ownsTarget(A)&&!this.grip2.ownsTarget(A))},y.prototype.pointerDown=function(A,F){X.prototype.pointerDown.call(this,A,F),this.manipulationStartX=A.x,this.manipulationStartY=A.y,this.state==="new"&&(this.x1=A.x,this.y1=A.y,this.x2=A.x,this.y2=A.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(F)?this.activeGrip=this.grip1:this.grip2.ownsTarget(F)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},y.prototype.pointerUp=function(A){var F=this.state;X.prototype.pointerUp.call(this,A),this.state==="creating"&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(A),this._state="select",F==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},y.prototype.adjustVisual=function(){},y.prototype.manipulate=function(A){this.state==="creating"?this.resize(A):this.state==="move"?(this.x1=this.manipulationStartX1+A.x-this.manipulationStartX,this.y1=this.manipulationStartY1+A.y-this.manipulationStartY,this.x2=this.manipulationStartX2+A.x-this.manipulationStartX,this.y2=this.manipulationStartY2+A.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(A)},y.prototype.resize=function(A){switch(this.activeGrip){case this.grip1:this.x1=A.x,this.y1=A.y;break;case this.grip2:case void 0:this.x2=A.x,this.y2=A.y}this.adjustVisual(),this.adjustControlBox()},y.prototype.select=function(){X.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},y.prototype.deselect=function(){X.prototype.deselect.call(this),this.controlBox.style.display="none"},y.prototype.setupControlBox=function(){this.controlBox=le.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},y.prototype.adjustControlBox=function(){this.positionGrips()},y.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},y.prototype.createGrip=function(){var A=new $e;return A.visual.transform.baseVal.appendItem(le.createTransform()),this.controlBox.appendChild(A.visual),A},y.prototype.positionGrips=function(){var A=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-A/2,this.y1-A/2),this.positionGrip(this.grip2.visual,this.x2-A/2,this.y2-A/2)},y.prototype.positionGrip=function(A,F,q){var V=A.transform.baseVal.getItem(0);V.setTranslate(F,q),A.transform.baseVal.replaceItem(V,0)},y.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},X.prototype.getState.call(this))},y.prototype.restoreState=function(A){X.prototype.restoreState.call(this,A);var F=A;this.x1=F.x1,this.y1=F.y1,this.x2=F.x2,this.y2=F.y2},y.prototype.scale=function(A,F){X.prototype.scale.call(this,A,F),this.x1=this.x1*A,this.y1=this.y1*F,this.x2=this.x2*A,this.y2=this.y2*F,this.adjustVisual(),this.adjustControlBox()},y}(Ne),tt=function(X){function y(A,F,q){var V=X.call(this,A,F,q)||this;return V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.setStrokeColor=V.setStrokeColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.strokeColor=q.defaultColor,V.strokeWidth=q.defaultStrokeWidth,V.strokeDasharray=q.defaultStrokeDasharray,V.strokePanel=new Fe("Line color",q.defaultColorSet,q.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.strokeWidthPanel=new dt("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new it("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V}return we(y,X),y.prototype.ownsTarget=function(A){return!(!X.prototype.ownsTarget.call(this,A)&&A!==this.visual&&A!==this.selectorLine&&A!==this.visibleLine)},y.prototype.createVisual=function(){this.visual=le.createGroup(),this.selectorLine=le.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=le.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},y.prototype.pointerDown=function(A,F){X.prototype.pointerDown.call(this,A,F),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},y.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),le.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),le.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),le.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},y.prototype.setStrokeColor=function(A){this.strokeColor=A,this.adjustVisual(),this.colorChanged(A)},y.prototype.setStrokeWidth=function(A){this.strokeWidth=A,this.adjustVisual()},y.prototype.setStrokeDasharray=function(A){this.strokeDasharray=A,this.adjustVisual(),this.stateChanged()},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var A=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},X.prototype.getState.call(this));return A.typeName=y.typeName,A},y.prototype.restoreState=function(A){X.prototype.restoreState.call(this,A);var F=A;this.strokeColor=F.strokeColor,this.strokeWidth=F.strokeWidth,this.strokeDasharray=F.strokeDasharray,this.createVisual(),this.adjustVisual()},y.typeName="LineMarker",y.title="Line marker",y.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',y}(ut),ke=function(X){function y(A,F,q,V){var me=X.call(this,A,V||'<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 me.fonts=[],me.fontBoxes=[],me.fonts=F,me.currentFont=q,me.setCurrentFont=me.setCurrentFont.bind(me),me}return we(y,X),y.prototype.getUi=function(){var A=this,F=document.createElement("div");return F.style.overflow="hidden",F.style.flexGrow="2",this.fonts.forEach(function(q){var V=document.createElement("div");V.style.display="inline-block",V.style.alignItems="center",V.style.justifyContent="space-between",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.overflow="hidden",V.style.maxWidth=100/A.fonts.length-5+"%",V.style.borderColor=q===A.currentFont?A.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){A.setCurrentFont(q,V)}),F.appendChild(V);var me=document.createElement("div");me.style.display="flex",me.style.minHeight="20px",me.style.flexGrow="2",me.style.fontFamily=q,me.style.overflow="hidden";var He=document.createElement("div");He.style.whiteSpace="nowrap",He.style.overflow="hidden",He.style.textOverflow="ellipsis",He.innerHTML="The quick brown fox jumps over the lazy dog",me.appendChild(He),V.appendChild(me),A.fontBoxes.push(V)}),F},y.prototype.setCurrentFont=function(A,F){var q=this;this.currentFont=A,this.fontBoxes.forEach(function(V){V.style.borderColor=V===F?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},y}(We),Ge=function(X){function y(A,F,q){var V=X.call(this,A,F,q)||this;return V.color="transparent",V.padding=5,V.DEFAULT_TEXT="your text here",V.text=V.DEFAULT_TEXT,V.isMoved=!1,V.color=q.defaultColor,V.fontFamily=q.defaultFontFamily,V.defaultSize={x:100,y:30},V.setColor=V.setColor.bind(V),V.setFont=V.setFont.bind(V),V.renderText=V.renderText.bind(V),V.sizeText=V.sizeText.bind(V),V.textEditDivClicked=V.textEditDivClicked.bind(V),V.showTextEditor=V.showTextEditor.bind(V),V.setSize=V.setSize.bind(V),V.positionTextEditor=V.positionTextEditor.bind(V),V.colorPanel=new Fe("Color",q.defaultColorSet,q.defaultColor),V.colorPanel.onColorChanged=V.setColor,V.fontFamilyPanel=new ke("Font",q.defaultFontFamilies,q.defaultFontFamily),V.fontFamilyPanel.onFontChanged=V.setFont,V}return we(y,X),y.prototype.ownsTarget=function(A){if(X.prototype.ownsTarget.call(this,A)||A===this.visual||A===this.textElement||A===this.bgRectangle)return!0;var F=!1;return this.textElement.childNodes.forEach(function(q){q===A&&(F=!0)}),F},y.prototype.createVisual=function(){this.visual=le.createGroup(),this.bgRectangle=le.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=le.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(le.createTransform()),this.textElement.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},y.prototype.pointerDown=function(A,F){X.prototype.pointerDown.call(this,A,F),this.isMoved=!1,this.pointerDownPoint=A,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(A),this._state="creating")},y.prototype.renderText=function(){var A=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(F){A.textElement.appendChild(le.createTSpan(F.trim()===""?" ":F.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},y.prototype.getTextScale=function(){var A=this.textElement.getBBox(),F=1;if(A.width>0&&A.height>0){var q=(1*this.width-this.width*this.padding*2/100)/A.width,V=(1*this.height-this.height*this.padding*2/100)/A.height;F=Math.min(q,V)}return F},y.prototype.getTextPosition=function(A){var F=this.textElement.getBBox(),q=0,V=0;return F.width>0&&F.height>0&&(q=(this.width-F.width*A)/2,V=this.height/2-F.height*A/2),{x:q,y:V}},y.prototype.sizeText=function(){var A=this.textElement.getBBox(),F=this.getTextScale(),q=this.getTextPosition(F);q.y-=A.y*F,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+q.x+"px, "+q.y+"px) scale("+F+", "+F+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(q.x,q.y),this.textElement.transform.baseVal.getItem(1).setScale(F,F))},y.prototype.manipulate=function(A){X.prototype.manipulate.call(this,A),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(A.x-this.pointerDownPoint.x)>5||Math.abs(A.y-this.pointerDownPoint.y)>5)},y.prototype.resize=function(A){X.prototype.resize.call(this,A),this.isMoved=!0,this.setSize(),this.sizeText()},y.prototype.setSize=function(){X.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},y.prototype.pointerUp=function(A){var F=this.state;F==="creating"&&(this._suppressMarkerCreateEvent=!0),X.prototype.pointerUp.call(this,A),this.setSize(),(F==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},y.prototype.showTextEditor=function(){var A=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(F){F.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var F=Number.parseFloat(A.textEditor.style.fontSize);A.textEditor.clientWidth>=Number.parseInt(A.textEditor.style.maxWidth)&&F>.9;)F-=.1,A.textEditor.style.fontSize=Math.max(F,.9)+"em"}),this.textEditor.addEventListener("keyup",function(F){F.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(F){if(F.clipboardData){var q=F.clipboardData.getData("text"),V=window.getSelection();if(!V.rangeCount)return!1;V.deleteFromDocument(),V.getRangeAt(0).insertNode(document.createTextNode(q)),F.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){A.textEditDivClicked(A.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},y.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var A=this.getTextScale(),F=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),q=this.textElement.getBBox(),V={x:q.width*A,y:q.height*A};F.x-=V.x/2,F.y-=V.y/2,this.textEditor.style.top=F.y+"px",this.textEditor.style.left=F.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-F.x+"px",this.textEditor.style.fontSize=Math.max(16*A,12)+"px",this.textElement.style.display="none"}},y.prototype.textEditDivClicked=function(A){this.text=A.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},y.prototype.select=function(){X.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},y.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),X.prototype.deselect.call(this)},y.prototype.dblClick=function(A,F){X.prototype.dblClick.call(this,A,F),this.showTextEditor()},y.prototype.setColor=function(A){this.textElement&&le.setAttributes(this.textElement,[["fill",A]]),this.color=A,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(A)},y.prototype.setFont=function(A){this.textElement&&le.setAttributes(this.textElement,[["font-family",A]]),this.fontFamily=A,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},y.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},y.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var A=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},X.prototype.getState.call(this));return A.typeName=y.typeName,A},y.prototype.restoreState=function(A){var F=A;this.color=F.color,this.fontFamily=F.fontFamily,this.padding=F.padding,this.text=F.text,this.createVisual(),X.prototype.restoreState.call(this,A),this.setSize()},y.prototype.scale=function(A,F){X.prototype.scale.call(this,A,F),this.setSize(),this.sizeText(),this.positionTextEditor()},y.typeName="TextMarker",y.title="Text marker",y.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>',y}(Qe),Ee=function(X){function y(A,F,q){var V=X.call(this,A,F,q)||this;return V.color="transparent",V.lineWidth=3,V.drawing=!1,V.pixelRatio=1,V.color=q.defaultColor,V.lineWidth=q.defaultStrokeWidth,V.pixelRatio=q.freehandPixelRatio,V.setColor=V.setColor.bind(V),V.addCanvas=V.addCanvas.bind(V),V.finishCreation=V.finishCreation.bind(V),V.setLineWidth=V.setLineWidth.bind(V),V.colorPanel=new Fe("Color",q.defaultColorSet,q.defaultColor),V.colorPanel.onColorChanged=V.setColor,V.lineWidthPanel=new dt("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),V.lineWidthPanel.onWidthChanged=V.setLineWidth,V}return we(y,X),y.prototype.ownsTarget=function(A){return!(!X.prototype.ownsTarget.call(this,A)&&A!==this.visual&&A!==this.drawingImage)},y.prototype.createVisual=function(){this.visual=le.createGroup(),this.drawingImage=le.createImage(),this.visual.appendChild(this.drawingImage);var A=le.createTransform();this.visual.transform.baseVal.appendItem(A),this.addMarkerVisualToContainer(this.visual)},y.prototype.pointerDown=function(A,F){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(A.x,A.y),this.drawing=!0):X.prototype.pointerDown.call(this,A,F)},y.prototype.manipulate=function(A){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(A.x,A.y),this.canvasContext.stroke()):X.prototype.manipulate.call(this,A)},y.prototype.resize=function(A){X.prototype.resize.call(this,A),le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},y.prototype.pointerUp=function(A){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):X.prototype.pointerUp.call(this,A)},y.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)},y.prototype.select=function(){this.state==="creating"&&this.finishCreation(),X.prototype.select.call(this)},y.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),X.prototype.deselect.call(this)},y.prototype.finishCreation=function(){for(var A=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),F=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],q=F[0],V=F[1],me=F[2],He=F[3],nt=!1,yt=0;yt<this.canvasElement.height;yt++)for(var ze=0;ze<this.canvasElement.width;ze++)A.data[yt*this.canvasElement.width*4+4*ze+3]>0&&(nt=!0,yt<V&&(V=yt),ze<q&&(q=ze),yt>He&&(He=yt),ze>me&&(me=ze));if(nt){this.left=q/this.pixelRatio,this.top=V/this.pixelRatio,this.width=(me-q)/this.pixelRatio,this.height=(He-V)/this.pixelRatio;var xt=document.createElement("canvas");xt.width=me-q,xt.height=He-V,xt.getContext("2d").putImageData(this.canvasContext.getImageData(q,V,me-q,He-V),0,0),this.drawingImgUrl=xt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},y.prototype.setDrawingImage=function(){le.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},y.prototype.setColor=function(A){this.color=A,this.colorChanged(A)},y.prototype.setLineWidth=function(A){this.lineWidth=A},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var A=Object.assign({drawingImgUrl:this.drawingImgUrl},X.prototype.getState.call(this));return A.typeName=y.typeName,A},y.prototype.restoreState=function(A){this.createVisual(),X.prototype.restoreState.call(this,A),this.drawingImgUrl=A.drawingImgUrl,this.setDrawingImage()},y.prototype.scale=function(A,F){X.prototype.scale.call(this,A,F),this.setDrawingImage()},y.typeName="FreehandMarker",y.title="Freehand marker",y.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>',y}(Qe),pe=function(X){function y(A,F,q){var V=X.call(this,A,q||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return V.typeBoxes=[],V.currentType=F,V.setCurrentType=V.setCurrentType.bind(V),V}return we(y,X),y.prototype.getUi=function(){var A=this,F=document.createElement("div");F.style.display="flex",F.style.overflow="hidden",F.style.flexGrow="2";for(var q=function(He){var nt="both";switch(He){case 0:nt="both";break;case 1:nt="start";break;case 2:nt="end";break;case 3:nt="none"}var yt=document.createElement("div");if(yt.style.display="flex",yt.style.flexGrow="2",yt.style.alignItems="center",yt.style.justifyContent="space-between",yt.style.padding="5px",yt.style.borderWidth="2px",yt.style.borderStyle="solid",yt.style.borderColor=nt===V.currentType?V.uiStyleSettings.toolboxAccentColor:"transparent",yt.addEventListener("click",function(){A.setCurrentType(nt,yt)}),F.appendChild(yt),nt==="both"||nt==="start"){var ze=document.createElement("div");ze.style.display="flex",ze.style.alignItems="center",ze.style.minHeight="20px",ze.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="`+(V.uiStyleSettings!==void 0?V.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,ze.style.marginLeft="5px",yt.appendChild(ze)}var xt=document.createElement("div");xt.style.display="flex",xt.style.alignItems="center",xt.style.minHeight="20px",xt.style.flexGrow="2";var Kt=document.createElement("hr");if(Kt.style.minWidth="20px",Kt.style.border="0px",Kt.style.borderTop="3px solid "+(V.uiStyleSettings!==void 0?V.uiStyleSettings.toolboxColor:"#eeeeee"),Kt.style.flexGrow="2",xt.appendChild(Kt),yt.appendChild(xt),nt==="both"||nt==="end"){var ti=document.createElement("div");ti.style.display="flex",ti.style.alignItems="center",ti.style.minHeight="20px",ti.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="`+(V.uiStyleSettings!==void 0?V.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,ti.style.marginRight="5px",yt.appendChild(ti)}V.typeBoxes.push(yt)},V=this,me=0;me<4;me++)q(me);return F},y.prototype.setCurrentType=function(A,F){var q=this;this.currentType=A,this.typeBoxes.forEach(function(V){V.style.borderColor=V===F?q.uiStyleSettings!==void 0?q.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},y}(We),_e=function(X){function y(A,F,q){var V=X.call(this,A,F,q)||this;return V.arrowType="end",V.arrowBaseHeight=10,V.arrowBaseWidth=10,V.getArrowPoints=V.getArrowPoints.bind(V),V.setArrowType=V.setArrowType.bind(V),V.arrowTypePanel=new pe("Arrow type","end"),V.arrowTypePanel.onArrowTypeChanged=V.setArrowType,V}return we(y,X),y.prototype.ownsTarget=function(A){return!(!X.prototype.ownsTarget.call(this,A)&&A!==this.arrow1&&A!==this.arrow2)},y.prototype.getArrowPoints=function(A,F){var q=this.arrowBaseWidth+2*this.strokeWidth,V=this.arrowBaseHeight+2*this.strokeWidth;return A-q/2+","+(F+V/2)+" "+A+","+(F-V/2)+" "+(A+q/2)+","+(F+V/2)},y.prototype.createTips=function(){this.arrow1=le.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=le.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.arrow2)},y.prototype.pointerDown=function(A,F){X.prototype.pointerDown.call(this,A,F),this.state==="creating"&&this.createTips()},y.prototype.adjustVisual=function(){if(X.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",le.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),le.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var A=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),F=this.arrow1.transform.baseVal.getItem(0);F.setRotate(A,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(F,0);var q=this.arrow2.transform.baseVal.getItem(0);q.setRotate(A+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(q,0)}},y.prototype.setArrowType=function(A){this.arrowType=A,this.adjustVisual(),this.stateChanged()},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var A=Object.assign({arrowType:this.arrowType},X.prototype.getState.call(this));return A.typeName=y.typeName,A},y.prototype.restoreState=function(A){X.prototype.restoreState.call(this,A);var F=A;this.arrowType=F.arrowType,this.createTips(),this.adjustVisual()},y.typeName="ArrowMarker",y.title="Arrow marker",y.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',y}(tt),re=function(X){function y(A,F,q){var V=X.call(this,A,F,q)||this;return V.fillColor=q.defaultFillColor,V.strokeWidth=0,V.fillPanel=new Fe("Color",q.defaultColorSet,q.defaultFillColor),V.fillPanel.onColorChanged=V.setFillColor,V}return we(y,X),Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var A=X.prototype.getState.call(this);return A.typeName=y.typeName,A},y.typeName="CoverMarker",y.title="Cover marker",y.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',y}(Ze),ae=function(X){function y(A,F,q,V){var me=X.call(this,A,V||'<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 me.opacities=[],me.opacityBoxes=[],me.opacities=F,me.currentOpacity=q,me.setCurrentOpacity=me.setCurrentOpacity.bind(me),me}return we(y,X),y.prototype.getUi=function(){var A=this,F=document.createElement("div");return F.style.display="flex",F.style.overflow="hidden",F.style.flexGrow="2",F.style.justifyContent="space-between",this.opacities.forEach(function(q){var V=document.createElement("div");V.style.display="flex",V.style.alignItems="center",V.style.justifyContent="center",V.style.padding="5px",V.style.borderWidth="2px",V.style.borderStyle="solid",V.style.borderColor=q===A.currentOpacity?A.uiStyleSettings.toolboxAccentColor:"transparent",V.addEventListener("click",function(){A.setCurrentOpacity(q,V)}),F.appendChild(V);var me=document.createElement("div");me.innerText=100*q+"%",V.appendChild(me),A.opacityBoxes.push(V)}),F},y.prototype.setCurrentOpacity=function(A,F){var q=this;this.currentOpacity=A,this.opacityBoxes.forEach(function(V){V.style.borderColor=V===F?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},y}(We),he=function(X){function y(A,F,q){var V=X.call(this,A,F,q)||this;return V.setOpacity=V.setOpacity.bind(V),V.fillColor=q.defaultHighlightColor,V.strokeWidth=0,V.opacity=q.defaultHighlightOpacity,V.fillPanel=new Fe("Color",q.defaultColorSet,V.fillColor),V.fillPanel.onColorChanged=V.setFillColor,V.opacityPanel=new ae("Opacity",q.defaultOpacitySteps,V.opacity),V.opacityPanel.onOpacityChanged=V.setOpacity,V}return we(y,X),y.prototype.setOpacity=function(A){this.opacity=A,this.visual&&le.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var A=X.prototype.getState.call(this);return A.typeName=y.typeName,A},y.typeName="HighlightMarker",y.title="Highlight marker",y.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>',y}(re),ge='<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>',be=function(X){function y(A,F,q){var V=X.call(this,A,F,q)||this;return V.bgColor="transparent",V.tipPosition={x:0,y:0},V.tipBase1Position={x:0,y:0},V.tipBase2Position={x:0,y:0},V.tipMoving=!1,V.color=q.defaultStrokeColor,V.bgColor=q.defaultFillColor,V.fontFamily=q.defaultFontFamily,V.defaultSize={x:100,y:30},V.setBgColor=V.setBgColor.bind(V),V.getTipPoints=V.getTipPoints.bind(V),V.positionTip=V.positionTip.bind(V),V.setTipPoints=V.setTipPoints.bind(V),V.colorPanel=new Fe("Text color",q.defaultColorSet,V.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>'),V.colorPanel.onColorChanged=V.setColor,V.bgColorPanel=new Fe("Fill color",q.defaultColorSet,V.bgColor,ge),V.bgColorPanel.onColorChanged=V.setBgColor,V.fontFamilyPanel=new ke("Font",q.defaultFontFamilies,q.defaultFontFamily),V.fontFamilyPanel.onFontChanged=V.setFont,V.tipGrip=new $e,V.tipGrip.visual.transform.baseVal.appendItem(le.createTransform()),V.controlBox.appendChild(V.tipGrip.visual),V}return we(y,X),y.prototype.ownsTarget=function(A){return X.prototype.ownsTarget.call(this,A)||this.tipGrip.ownsTarget(A)||this.tip===A},y.prototype.createTip=function(){le.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=le.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},y.prototype.pointerDown=function(A,F){this.state==="new"&&X.prototype.pointerDown.call(this,A,F),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(F)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):X.prototype.pointerDown.call(this,A,F)},y.prototype.pointerUp=function(A){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,X.prototype.pointerUp.call(this,A);else{var F=this.state==="creating";X.prototype.pointerUp.call(this,A),this.setTipPoints(F),this.positionTip()}},y.prototype.manipulate=function(A){if(this.tipMoving){var F=this.unrotatePoint(A);this.tipPosition={x:F.x-this.manipulationStartLeft,y:F.y-this.manipulationStartTop},this.positionTip()}else X.prototype.manipulate.call(this,A)},y.prototype.setBgColor=function(A){this.bgRectangle&&this.tip&&(le.setAttributes(this.bgRectangle,[["fill",A]]),le.setAttributes(this.tip,[["fill",A]])),this.bgColor=A,this.fillColorChanged(A)},y.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},y.prototype.setTipPoints=function(A){A===void 0&&(A=!1);var F=Math.min(this.height/2,15),q=this.height/5;A&&(this.tipPosition={x:F+q/2,y:this.height+20});var V=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?V<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(q=this.width/5,F=Math.min(this.width/2,15),this.tipBase1Position={x:F,y:0},this.tipBase2Position={x:F+q,y:0}):(this.tipBase1Position={x:0,y:F},this.tipBase2Position={x:0,y:F+q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?V<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(q=this.width/5,F=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-F-q,y:0},this.tipBase2Position={x:this.width-F,y:0}):(this.tipBase1Position={x:this.width,y:F},this.tipBase2Position={x:this.width,y:F+q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?V<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(q=this.width/5,F=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-F-q,y:this.height},this.tipBase2Position={x:this.width-F,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-F-q},this.tipBase2Position={x:this.width,y:this.height-F}):V<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(q=this.width/5,F=Math.min(this.width/2,15),this.tipBase1Position={x:F,y:this.height},this.tipBase2Position={x:F+q,y:this.height}):(this.tipBase1Position={x:0,y:this.height-F},this.tipBase2Position={x:0,y:this.height-F-q})},y.prototype.resize=function(A){X.prototype.resize.call(this,A),this.positionTip()},y.prototype.positionTip=function(){le.setAttributes(this.tip,[["points",this.getTipPoints()]]);var A=this.tipGrip.visual.transform.baseVal.getItem(0);A.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(A,0)},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),y.prototype.select=function(){this.positionTip(),X.prototype.select.call(this)},y.prototype.getState=function(){var A=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},X.prototype.getState.call(this));return A.typeName=y.typeName,A},y.prototype.restoreState=function(A){var F=A;this.bgColor=F.bgColor,this.tipPosition=F.tipPosition,X.prototype.restoreState.call(this,A),this.createTip(),this.setTipPoints()},y.prototype.scale=function(A,F){X.prototype.scale.call(this,A,F),this.tipPosition={x:this.tipPosition.x*A,y:this.tipPosition.y*F},this.positionTip()},y.typeName="CalloutMarker",y.title="Callout marker",y.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>',y}(Ge),De=function(X){function y(A,F,q){var V=X.call(this,A,F,q)||this;return V.fillColor="transparent",V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.opacity=1,V.strokeColor=q.defaultColor,V.strokeWidth=q.defaultStrokeWidth,V.strokeDasharray=q.defaultStrokeDasharray,V.fillColor=q.defaultFillColor,V.setStrokeColor=V.setStrokeColor.bind(V),V.setFillColor=V.setFillColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.setOpacity=V.setOpacity.bind(V),V.createVisual=V.createVisual.bind(V),V.strokePanel=new Fe("Line color",fe(q.defaultColorSet,["transparent"]),q.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.fillPanel=new Fe("Fill color",fe(q.defaultColorSet,["transparent"]),V.fillColor,ge),V.fillPanel.onColorChanged=V.setFillColor,V.strokeWidthPanel=new dt("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new it("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V.opacityPanel=new ae("Opacity",q.defaultOpacitySteps,V.opacity),V.opacityPanel.onOpacityChanged=V.setOpacity,V}return we(y,X),y.prototype.ownsTarget=function(A){return!(!X.prototype.ownsTarget.call(this,A)&&A!==this.visual)},y.prototype.createVisual=function(){this.visual=le.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},y.prototype.pointerDown=function(A,F){X.prototype.pointerDown.call(this,A,F),this.state==="new"&&(this.createVisual(),this.moveVisual(A),this._state="creating")},y.prototype.manipulate=function(A){X.prototype.manipulate.call(this,A)},y.prototype.resize=function(A){X.prototype.resize.call(this,A),this.setSize()},y.prototype.setSize=function(){X.prototype.setSize.call(this),le.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},y.prototype.pointerUp=function(A){X.prototype.pointerUp.call(this,A),this.setSize()},y.prototype.setStrokeColor=function(A){this.strokeColor=A,this.visual&&le.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(A),this.stateChanged()},y.prototype.setFillColor=function(A){this.fillColor=A,this.visual&&le.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(A),this.stateChanged()},y.prototype.setStrokeWidth=function(A){this.strokeWidth=A,this.visual&&le.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},y.prototype.setStrokeDasharray=function(A){this.strokeDasharray=A,this.visual&&le.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},y.prototype.setOpacity=function(A){this.opacity=A,this.visual&&le.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var A=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},X.prototype.getState.call(this));return A.typeName=y.typeName,A},y.prototype.restoreState=function(A){var F=A;this.fillColor=F.fillColor,this.strokeColor=F.strokeColor,this.strokeWidth=F.strokeWidth,this.strokeDasharray=F.strokeDasharray,this.opacity=F.opacity,this.createVisual(),X.prototype.restoreState.call(this,A),this.setSize()},y.prototype.scale=function(A,F){X.prototype.scale.call(this,A,F),this.setSize()},y.typeName="EllipseMarker",y.title="Ellipse marker",y.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>',y}(Qe),je=function(X){function y(A,F,q){return X.call(this,A,F,q)||this}return we(y,X),Object.defineProperty(y.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),y.prototype.ownsTarget=function(A){return!(!X.prototype.ownsTarget.call(this,A)&&A!==this.tip1&&A!==this.tip2)},y.prototype.createTips=function(){this.tip1=le.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.tip1),this.tip2=le.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.tip2)},y.prototype.pointerDown=function(A,F){X.prototype.pointerDown.call(this,A,F),this.state==="creating"&&this.createTips()},y.prototype.adjustVisual=function(){if(X.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(le.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),le.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var A=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),F=this.tip1.transform.baseVal.getItem(0);F.setRotate(A,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(F,0);var q=this.tip2.transform.baseVal.getItem(0);q.setRotate(A+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(q,0)}},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var A=X.prototype.getState.call(this);return A.typeName=y.typeName,A},y.prototype.restoreState=function(A){X.prototype.restoreState.call(this,A),this.createTips(),this.adjustVisual()},y.typeName="MeasurementMarker",y.title="Measurement marker",y.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>',y}(tt),lt=function(X){function y(A,F,q){var V=X.call(this,A,F,q)||this;return V.strokePanel.colors=q.defaultColorSet,V.fillColor="transparent",V}return we(y,X),Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var A=X.prototype.getState.call(this);return A.typeName=y.typeName,A},y.typeName="EllipseFrameMarker",y.title="Ellipse frame marker",y.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>',y}(De),mt=function(){function X(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(X.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),X.prototype.addUndoStep=function(y){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(y)||(this.undoStack.push(y),JSON.stringify(this.lastRedoStep)!==JSON.stringify(y)&&this.redoStack.splice(0,this.redoStack.length))},X.prototype.replaceLastUndoStep=function(y){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=y)},X.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},X.prototype.undo=function(){if(this.undoStack.length>1){var y=this.undoStack.pop();return y!==void 0&&this.redoStack.push(y),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},X.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},X}(),pt=function(X){function y(A,F,q){var V=X.call(this,A,F,q)||this;return V.strokeColor="transparent",V.strokeWidth=0,V.strokeDasharray="",V.curveX=0,V.curveY=0,V.manipulationStartCurveX=0,V.manipulationStartCurveY=0,V.setStrokeColor=V.setStrokeColor.bind(V),V.setStrokeWidth=V.setStrokeWidth.bind(V),V.setStrokeDasharray=V.setStrokeDasharray.bind(V),V.positionGrips=V.positionGrips.bind(V),V.addControlGrips=V.addControlGrips.bind(V),V.adjustVisual=V.adjustVisual.bind(V),V.setupControlBox=V.setupControlBox.bind(V),V.resize=V.resize.bind(V),V.strokeColor=q.defaultColor,V.strokeWidth=q.defaultStrokeWidth,V.strokeDasharray=q.defaultStrokeDasharray,V.strokePanel=new Fe("Line color",q.defaultColorSet,q.defaultColor),V.strokePanel.onColorChanged=V.setStrokeColor,V.strokeWidthPanel=new dt("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),V.strokeWidthPanel.onWidthChanged=V.setStrokeWidth,V.strokeStylePanel=new it("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),V.strokeStylePanel.onStyleChanged=V.setStrokeDasharray,V}return we(y,X),y.prototype.ownsTarget=function(A){return!(!X.prototype.ownsTarget.call(this,A)&&A!==this.visual&&A!==this.selectorCurve&&A!==this.visibleCurve&&!this.curveGrip.ownsTarget(A))},y.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},y.prototype.createVisual=function(){this.visual=le.createGroup(),this.selectorCurve=le.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=le.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},y.prototype.pointerDown=function(A,F){X.prototype.pointerDown.call(this,A,F),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=A.x,this.curveY=A.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(F)&&(this.activeGrip=this.curveGrip,this._state="resize")},y.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),le.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),le.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),le.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},y.prototype.setupControlBox=function(){X.prototype.setupControlBox.call(this),this.curveControlLine1=le.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=le.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},y.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,X.prototype.addControlGrips.call(this)},y.prototype.positionGrips=function(){X.prototype.positionGrips.call(this);var A=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-A/2,this.curveY-A/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},y.prototype.manipulate=function(A){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+A.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+A.y-this.manipulationStartY),X.prototype.manipulate.call(this,A)},y.prototype.resize=function(A){this.activeGrip===this.curveGrip&&(this.curveX=A.x,this.curveY=A.y),X.prototype.resize.call(this,A),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},y.prototype.setStrokeColor=function(A){this.strokeColor=A,this.adjustVisual(),this.colorChanged(A)},y.prototype.setStrokeWidth=function(A){this.strokeWidth=A,this.adjustVisual()},y.prototype.setStrokeDasharray=function(A){this.strokeDasharray=A,this.adjustVisual()},y.prototype.scale=function(A,F){this.curveX=this.curveX*A,this.curveY=this.curveY*F,X.prototype.scale.call(this,A,F)},Object.defineProperty(y.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),y.prototype.getState=function(){var A=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},X.prototype.getState.call(this));return A.typeName=y.typeName,A},y.prototype.restoreState=function(A){X.prototype.restoreState.call(this,A);var F=A;this.strokeColor=F.strokeColor,this.strokeWidth=F.strokeWidth,this.strokeDasharray=F.strokeDasharray,this.curveX=F.curveX,this.curveY=F.curveY,this.createVisual(),this.adjustVisual()},y.typeName="CurveMarker",y.title="Curve marker",y.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>',y}(ut),Ot=function(){function X(y,A){A===void 0&&(A=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=y,this.cancelable=A}return Object.defineProperty(X.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),X.prototype.preventDefault=function(){this._defaultPrevented=!0},X}(),Rt=function(X){function y(A,F,q){var V=X.call(this,A,!1)||this;return V.dataUrl=F,V.state=q,V}return we(y,X),y}(Ot),ft=function(X){function y(A,F,q){q===void 0&&(q=!1);var V=X.call(this,A,q)||this;return V.marker=F,V}return we(y,X),y}(Ot),It=function(){function X(){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 X.prototype.addEventListener=function(y,A){this[y].push(A)},X.prototype.removeEventListener=function(y,A){var F=this[y].indexOf(A);F>-1&&this[y].splice(F,1)},X}(),Bt=function(){function X(y){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Pe,this._isOpen=!1,this.undoRedoManager=new mt,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 It,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=X.instanceCounter++,this.styles=new Re(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=y,this.targetRoot=document.body,this.width=y.clientWidth,this.height=y.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(X.prototype,"ALL_MARKER_TYPES",{get:function(){return[at,Ee,_e,Ge,lt,De,he,be,je,re,tt,pt]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[at,Ee,_e,Ge,De,he,be]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"BASIC_MARKER_TYPES",{get:function(){return[at,Ee,_e,Ge,he]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(y){var A=this;this._availableMarkerTypes.splice(0),y.forEach(function(F){if(typeof F=="string"){var q=A.ALL_MARKER_TYPES.find(function(V){return V.typeName===F});q!==void 0&&A._availableMarkerTypes.push(q)}else A._availableMarkerTypes.push(F)})},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(y){this._zoomLevel=y,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(X.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),X.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),te.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},X.prototype.show=function(){var y=this;this.styles.styleSheetRoot===void 0&&se.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=se.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(A){return A(new Ot(y))})},X.prototype.render=function(){return Ce(this,void 0,void 0,function(){var y;return Se(this,function(A){switch(A.label){case 0:return this.setCurrentMarker(),(y=new de).naturalSize=this.renderAtNaturalSize,y.imageType=this.renderImageType,y.imageQuality=this.renderImageQuality,y.markersOnly=this.renderMarkersOnly,y.width=this.renderWidth,y.height=this.renderHeight,[4,y.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return A.sent(),[4,y.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,A.sent()]}})})},X.prototype.close=function(y){var A=this;if(y===void 0&&(y=!1),this.isOpen){var F=!1;y||this.eventListeners.beforeclose.forEach(function(q){var V=new Ot(A,!0);q(V),V.defaultPrevented&&(F=!0)}),F||(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(q){return q(new Ot(A))}),this.detachEvents(),this._isOpen=!1)}},X.prototype.addMarkersToToolbar=function(){for(var y,A=[],F=0;F<arguments.length;F++)A[F]=arguments[F];(y=this._availableMarkerTypes).push.apply(y,A)},X.prototype.addRenderEventListener=function(y){this.addEventListener("render",function(A){y(A.dataUrl,A.state)})},X.prototype.removeRenderEventListener=function(y){},X.prototype.addCloseEventListener=function(y){this.addEventListener("close",function(){y()})},X.prototype.removeCloseEventListener=function(y){},X.prototype.setupResizeObserver=function(){var y=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){y.resize(y.target.clientWidth,y.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return y.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},X.prototype.onPopupTargetResize=function(){var y=1*this.target.clientWidth/this.target.clientHeight,A=this.editorCanvas.clientWidth/y>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*y:this.editorCanvas.clientWidth,F=A<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/y;this.resize(A,F)},X.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},X.prototype.resize=function(y,A){this._isResizing=!0;var F=y/this.imageWidth,q=A/this.imageHeight;this.imageWidth=Math.round(y),this.imageHeight=Math.round(A),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(F,q),this._isResizing=!1},X.prototype.scaleMarkers=function(y,A){var F,q=this;this._currentMarker&&this._currentMarker instanceof Ge?this._currentMarker.scale(y,A):(F=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(V){V!==q._currentMarker&&V.scale(y,A)}),F!==void 0&&this.setCurrentMarker(F)},X.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"},X.prototype.setTopLeft=function(){var y=this.editingTarget.getBoundingClientRect(),A=this.editorCanvas.getBoundingClientRect();this.left=y.left-A.left,this.top=y.top-A.top},X.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)},X.prototype.addDefs=function(){for(var y,A=[],F=0;F<arguments.length;F++)A[F]=arguments[F];this.defs=le.createDefs(),this.addDefsToImage(),(y=this.defs).append.apply(y,A)},X.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},X.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)},X.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},X.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},X.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)},X.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},X.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)},X.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 y=document.createElement("a");y.href="https://markerjs.com/",y.target="_blank",y.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>',y.title="Powered by marker.js",y.style.display="grid",y.style.alignItems="center",y.style.justifyItems="center",y.style.padding="3px",y.style.width="20px",y.style.height="20px",this.logoUI.appendChild(y),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},X.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")},X.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"},X.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},X.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 y=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=y+"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 Ie(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 Ue(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},X.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},X.prototype.removeMarker=function(y){this.markerImage.removeChild(y.container),this.markers.indexOf(y)>-1&&this.markers.splice(this.markers.indexOf(y),1),y.dispose()},X.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())},X.prototype.toolbarButtonClicked=function(y,A){if(y==="marker"&&A!==void 0)this.createNewMarker(A);else if(y==="action")switch(A){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},X.prototype.deleteSelectedMarker=function(){var y=this;if(this._currentMarker!==void 0){var A=!1;if(this.eventListeners.markerbeforedelete.forEach(function(q){var V=new ft(y,y._currentMarker,!0);q(V),V.defaultPrevented&&(A=!0)}),!A){var F=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(q){return q(new ft(y,F))})}}},X.prototype.clear=function(){var y=this,A=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(me){var He=new ft(y,void 0,!0);me(He),He.defaultPrevented&&(A=!0)}),!A)){this.setCurrentMarker();for(var F=function(me){var He=q.markers[me];q.setCurrentMarker(q.markers[me]),q._currentMarker.dispose(),q.markerImage.removeChild(q._currentMarker.container),q.markers.splice(q.markers.indexOf(q._currentMarker),1),q.eventListeners.markerdelete.forEach(function(nt){return nt(new ft(y,He))})},q=this,V=this.markers.length-1;V>=0;V--)F(V);this.addUndoStep()}},Object.defineProperty(X.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),X.prototype.showNotesEditor=function(){var y;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=(y=this._currentMarker.notes)!==null&&y!==void 0?y:"",this.overlayContainer.appendChild(this.notesArea))},X.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)},X.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},X.prototype.addUndoStep=function(){var y=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var A=this.getState(),F=this.undoRedoManager.getLastUndoStep();if(!F||F.width===A.width&&F.height===A.height){var q=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(A),q<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(V){return V(new Ot(y))})}else this.undoRedoManager.replaceLastUndoStep(A),this.eventListeners.statechange.forEach(function(V){return V(new Ot(y))})}},X.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},X.prototype.undoStep=function(){var y=this,A=this.undoRedoManager.undo();A!==void 0&&(this.restoreState(A),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(F){return F(new Ot(y))}))},X.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},X.prototype.redoStep=function(){var y=this,A=this.undoRedoManager.redo();A!==void 0&&(this.restoreState(A),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(F){return F(new Ot(y))}))},X.prototype.stepZoom=function(){var y=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=y<this.zoomSteps.length-1?this.zoomSteps[y+1]:this.zoomSteps[0]},X.prototype.panTo=function(y){this.contentDiv.scrollBy({left:this.prevPanPoint.x-y.x,top:this.prevPanPoint.y-y.y}),this.prevPanPoint=y},X.prototype.startRenderAndClose=function(){return Ce(this,void 0,void 0,function(){var y,A,F=this;return Se(this,function(q){switch(q.label){case 0:return[4,this.render()];case 1:return y=q.sent(),A=this.getState(),this.eventListeners.render.forEach(function(V){return V(new Rt(F,y,A))}),this.close(!0),[2]}})})},X.prototype.getState=function(y){y===!0&&this.setCurrentMarker();var A={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(F){return A.markers.push(F.getState())}),A},X.prototype.restoreState=function(y){var A=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);y.markers.forEach(function(F){var q=A._availableMarkerTypes.find(function(me){return me.typeName===F.typeName});if(q!==void 0){var V=A.addNewMarker(q);V.restoreState(F),A.markers.push(V)}}),y.width&&y.height&&(y.width!==this.imageWidth||y.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/y.width,this.imageHeight/y.height),this.eventListeners.restorestate.forEach(function(F){return F(new Ot(A))})},X.prototype.addNewMarker=function(y){var A=le.createGroup();return this.markerImage.appendChild(A),new y(A,this.overlayContainer,this.settings)},X.prototype.createNewMarker=function(y){var A,F=this;(A=typeof y=="string"?this._availableMarkerTypes.find(function(q){return q.typeName===y}):y)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(A),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(A.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(q){return q(new ft(F,F._currentMarker))}))},X.prototype.markerCreated=function(y){var A=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(y),this.setCurrentMarker(y),y instanceof Ee&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Ee):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(F){return F(new ft(A,A._currentMarker))})},X.prototype.colorChanged=function(y){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=y,this.settings.defaultStrokeColor=y)},X.prototype.fillColorChanged=function(y){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=y)},X.prototype.markerStateChanged=function(y){var A=this;this.eventListeners.markerchange.forEach(function(F){return F(new ft(A,y))})},X.prototype.setCurrentMarker=function(y){var A=this;this._currentMarker!==y&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(F){return F(new ft(A,A._currentMarker))})),this._currentMarker=y,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(F){return F(new ft(A,A._currentMarker))}))},X.prototype.onPointerDown=function(y){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||y.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var A=this.markers.find(function(F){return F.ownsTarget(y.target)});A!==void 0?(this.setCurrentMarker(A),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(y.clientX,y.clientY),y.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:y.clientX,y:y.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(y.clientX,y.clientY))},X.prototype.onDblClick=function(y){if(this._isFocused||this.focus(),this.mode==="select"){var A=this.markers.find(function(F){return F.ownsTarget(y.target)});A!==void 0&&A!==this._currentMarker&&this.setCurrentMarker(A),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(y.clientX,y.clientY),y.target):this.setCurrentMarker()}},X.prototype.onPointerMove=function(y){this.touchPoints!==1&&y.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||y.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(y.clientX,y.clientY)):this.zoomLevel>1&&this.panTo({x:y.clientX,y:y.clientY}))},X.prototype.onPointerUp=function(y){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(y.clientX,y.clientY)),this.isDragging=!1,this.addUndoStep()},X.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},X.prototype.onKeyUp=function(y){this._currentMarker===void 0||this.notesArea!==void 0||y.key!=="Delete"&&y.key!=="Backspace"||this.deleteSelectedMarker()},X.prototype.clientToLocalCoordinates=function(y,A){var F=this.markerImage.getBoundingClientRect();return{x:(y-F.left)/this.zoomLevel,y:(A-F.top)/this.zoomLevel}},X.prototype.onWindowResize=function(){this.positionUI()},X.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var y=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=y+"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()},X.prototype.addLicenseKey=function(y){te.addKey(y)},X.prototype.addEventListener=function(y,A){this.eventListeners.addEventListener(y,A)},X.prototype.removeEventListener=function(y,A){this.eventListeners.removeEventListener(y,A)},X.prototype.renderState=function(y){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(y),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(X.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),X.prototype.focus=function(){var y=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(A){return A(new Ot(y))}))},X.prototype.blur=function(){var y=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(A){return A(new Ot(y))}))},X.instanceCounter=0,X}();/* **********************************
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 ht=function(X,y){return(ht=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,F){A.__proto__=F}||function(A,F){for(var q in F)Object.prototype.hasOwnProperty.call(F,q)&&(A[q]=F[q])})(X,y)};function ei(X,y){if(typeof y!="function"&&y!==null)throw new TypeError("Class extends value "+String(y)+" is not a constructor or null");function A(){this.constructor=X}ht(X,y),X.prototype=y===null?Object.create(y):(A.prototype=y.prototype,new A)}function Ut(X,y,A,F){return new(A||(A=Promise))(function(q,V){function me(yt){try{nt(F.next(yt))}catch(ze){V(ze)}}function He(yt){try{nt(F.throw(yt))}catch(ze){V(ze)}}function nt(yt){var ze;yt.done?q(yt.value):(ze=yt.value,ze instanceof A?ze:new A(function(xt){xt(ze)})).then(me,He)}nt((F=F.apply(X,y||[])).next())})}function fi(X,y){var A,F,q,V,me={label:0,sent:function(){if(1&q[0])throw q[1];return q[1]},trys:[],ops:[]};return V={next:He(0),throw:He(1),return:He(2)},typeof Symbol=="function"&&(V[Symbol.iterator]=function(){return this}),V;function He(nt){return function(yt){return function(ze){if(A)throw new TypeError("Generator is already executing.");for(;me;)try{if(A=1,F&&(q=2&ze[0]?F.return:ze[0]?F.throw||((q=F.return)&&q.call(F),0):F.next)&&!(q=q.call(F,ze[1])).done)return q;switch(F=0,q&&(ze=[2&ze[0],q.value]),ze[0]){case 0:case 1:q=ze;break;case 4:return me.label++,{value:ze[1],done:!1};case 5:me.label++,F=ze[1],ze=[0];continue;case 7:ze=me.ops.pop(),me.trys.pop();continue;default:if(!(q=me.trys,(q=q.length>0&&q[q.length-1])||ze[0]!==6&&ze[0]!==2)){me=0;continue}if(ze[0]===3&&(!q||ze[1]>q[0]&&ze[1]<q[3])){me.label=ze[1];break}if(ze[0]===6&&me.label<q[1]){me.label=q[1],q=ze;break}if(q&&me.label<q[2]){me.label=q[2],me.ops.push(ze);break}q[2]&&me.ops.pop(),me.trys.pop();continue}ze=y.call(X,me)}catch(xt){ze=[6,xt],F=0}finally{A=q=0}if(5&ze[0])throw ze[1];return{value:ze[0]?ze[1]:void 0,done:!0}}([nt,yt])}}}var Ve=function(){function X(){}return X.addKey=function(y){X.key=y},Object.defineProperty(X,"isLicensed",{get:function(){return!!X.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(X.key)},enumerable:!1,configurable:!0}),X}(),Xe=function(){function X(){}return X.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},X.setAttributes=function(y,A){for(var F=0,q=A;F<q.length;F++){var V=q[F],me=V[0],He=V[1];y.setAttribute(me,He)}},X.createRect=function(y,A,F){var q=document.createElementNS("http://www.w3.org/2000/svg","rect");return q.setAttribute("width",y.toString()),q.setAttribute("height",A.toString()),F&&X.setAttributes(q,F),q},X.createLine=function(y,A,F,q,V){var me=document.createElementNS("http://www.w3.org/2000/svg","line");return me.setAttribute("x1",y.toString()),me.setAttribute("y1",A.toString()),me.setAttribute("x2",F.toString()),me.setAttribute("y2",q.toString()),V&&X.setAttributes(me,V),me},X.createPolygon=function(y,A){var F=document.createElementNS("http://www.w3.org/2000/svg","polygon");return F.setAttribute("points",y),A&&X.setAttributes(F,A),F},X.createCircle=function(y,A){var F=document.createElementNS("http://www.w3.org/2000/svg","circle");return F.setAttribute("cx",(y/2).toString()),F.setAttribute("cy",(y/2).toString()),F.setAttribute("r",y.toString()),A&&X.setAttributes(F,A),F},X.createEllipse=function(y,A,F){var q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return q.setAttribute("cx",(y/2).toString()),q.setAttribute("cy",(A/2).toString()),q.setAttribute("rx",(y/2).toString()),q.setAttribute("ry",(A/2).toString()),F&&X.setAttributes(q,F),q},X.createGroup=function(y){var A=document.createElementNS("http://www.w3.org/2000/svg","g");return y&&X.setAttributes(A,y),A},X.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},X.createMarker=function(y,A,F,q,V,me,He){var nt=document.createElementNS("http://www.w3.org/2000/svg","marker");return X.setAttributes(nt,[["id",y],["orient",A],["markerWidth",F.toString()],["markerHeight",q.toString()],["refX",V.toString()],["refY",me.toString()]]),nt.appendChild(He),nt},X.createText=function(y){var A=document.createElementNS("http://www.w3.org/2000/svg","text");return A.setAttribute("x","0"),A.setAttribute("y","0"),y&&X.setAttributes(A,y),A},X.createTSpan=function(y,A){var F=document.createElementNS("http://www.w3.org/2000/svg","tspan");return F.textContent=y,A&&X.setAttributes(F,A),F},X.createImage=function(y){var A=document.createElementNS("http://www.w3.org/2000/svg","image");return y&&X.setAttributes(A,y),A},X.createPoint=function(y,A){var F=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return F.x=y,F.y=A,F},X.createPath=function(y,A){var F=document.createElementNS("http://www.w3.org/2000/svg","path");return F.setAttribute("d",y),A&&X.setAttributes(F,A),F},X.createElement=function(y,A){var F=document.createElementNS("http://www.w3.org/2000/svg",y);return A&&X.setAttributes(F,A),F},X.getHollowRectanglePath=function(y,A,F,q,V,me,He,nt){return"M"+y+","+A+"V"+(A+q)+"H"+(y+F)+"V"+A+"H"+V+"V"+me+"H"+(V+He)+"V"+(me+nt)+"H"+V+"V"+A+"Z"},X}(),Et=function(){function X(y){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+y+"_"}return Object.defineProperty(X.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(X.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(X.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),X.prototype.addClass=function(y){return this.styleSheet===void 0&&this.addStyleSheet(),y.name=""+this.classNamePrefix+y.localName,this.classes.push(y),this.styleSheet.sheet.insertRule("."+y.name+" {"+y.style+"}",this.styleSheet.sheet.cssRules.length),y},X.prototype.addRule=function(y){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(y),this.styleSheet.sheet.insertRule(y.selector+" {"+y.style+"}",this.styleSheet.sheet.cssRules.length)},X.prototype.addStyleSheet=function(){var y;this.styleSheet=document.createElement("style"),((y=this.styleSheetRoot)!==null&&y!==void 0?y:document.head).appendChild(this.styleSheet),this.addRule(new Dt("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Dt("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new Dt("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new Pt("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new Pt("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},X.prototype.removeStyleSheet=function(){var y;this.styleSheet&&(((y=this.styleSheetRoot)!==null&&y!==void 0?y:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},X}(),Dt=function(X,y){this.selector=X,this.style=y},Pt=function(X,y){this.localName=X,this.style=y},si=function(){function X(){this.blocks=[],this.display=""}return X.prototype.addButtonBlock=function(y){y.className=this.blockClassName,y.buttonClassName=this.buttonClassName,y.buttonColorsClassName=this.buttonColorsClassName,y.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(y)},X.prototype.addElementBlock=function(y){y.className===void 0&&(y.className=this.blockClassName),this.blocks.push(y)},X.prototype.getUI=function(){var y=document.createElement("div");return y.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,y.style.display=this.display,this.blocks.forEach(function(A){return y.appendChild(A.getUI())}),y},X}(),an=function(){function X(){}return X.prototype.getUI=function(){var y=document.createElement("div");if(y.className=this.className,this.minWidth!==void 0&&(y.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":y.style.justifyContent="flex-start";break;case"center":y.style.justifyContent="center";break;case"end":y.style.justifyContent="flex-end"}return y.style.whiteSpace="nowrap",y},X}(),sn=function(X){function y(){var A=X!==null&&X.apply(this,arguments)||this;return A.buttons=[],A}return ei(y,X),y.prototype.addButton=function(A){A.className=this.buttonClassName,A.colorsClassName=this.buttonColorsClassName,A.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(A)},y.prototype.getUI=function(){var A=X.prototype.getUI.call(this);return this.buttons.forEach(function(F){return A.appendChild(F.getUI())}),A},y}(an),zt=function(){function X(y,A){this._isActive=!1,this._isHidden=!1,this._icon=y,this.title=A,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(X.prototype,"icon",{get:function(){return this._icon},set:function(y){this._icon=y,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isActive",{get:function(){return this._isActive},set:function(y){this._isActive=y,this.adjustClassName()},enumerable:!1,configurable:!0}),X.prototype.getUI=function(){var y=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 y.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},X.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,"")))},X.prototype.hide=function(){this._isHidden=!0},X}(),vt=function(X){function y(){var A=X!==null&&X.apply(this,arguments)||this;return A.elements=[],A}return ei(y,X),y.prototype.addElement=function(A){this.elements.push(A)},y.prototype.getUI=function(){var A=X.prototype.getUI.call(this);return this.elements.forEach(function(F){return A.appendChild(F)}),A},y}(an),ji=function(){function X(y,A){this.horizontal=y,this.vertical=A}return Object.defineProperty(X.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),X.prototype.getVerticalLength=function(y){return y/this.ratio},X.prototype.getHorizontalLength=function(y){return y*this.ratio},X}(),nn=function(){function X(){}return X.getIcon=function(y,A){if(y>0&&A>0){var F=new ji(y,A),q=F.ratio>=1?20:F.getHorizontalLength(20),V=F.ratio<1?20:F.getVerticalLength(20),me=document.createElementNS("http://www.w3.org/2000/svg","svg");me.setAttribute("xmlns","http://www.w3.org/2000/svg"),me.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(me);var He=Xe.createDefs();me.appendChild(He);var nt=Xe.createElement("clipPath",[["id","text-bg-clip"]]);He.appendChild(nt);var yt=Xe.createPath(Xe.getHollowRectanglePath((24-q)/2,(24-V)/2,q,V,(24-q)/2+2,(24-V)/2+2,q-4,V-4));me.appendChild(yt);var ze=Xe.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);ze.appendChild(Xe.createTSpan(y+":"+A)),me.appendChild(ze);var xt=ze.getBBox();Xe.setAttributes(ze,[["x",((24-xt.width)/2).toString()],["y",((24-xt.height)/2-xt.y).toString()]]);var Kt=Xe.createPath(Xe.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(xt.width))/2,(24-Math.ceil(xt.height))/2,Math.ceil(xt.width),Math.ceil(xt.height)));return nt.appendChild(Kt),Xe.setAttributes(yt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(me),me.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>'},X}(),Ei=function(X){function y(A,F,q){var V=X.call(this,A,F)||this;return V.isDropdownOpen=!1,V.onClick=V.dropdownButtonClicked,V.dropdownButtons=q,V}return ei(y,X),y.prototype.setupDropdown=function(){var A=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(F){F.className=A.className,F.colorsClassName=A.colorsClassName,A.dropdownBlock.appendChild(F.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},y.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},y.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},y.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},y.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},y.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},y}(zt),Mt=function(){function X(y,A){this.GRIP_SIZE=10,this.color=y,this.fillColor=A,this.visual=Xe.createGroup(),this.visual.appendChild(Xe.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Xe.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return X.prototype.ownsTarget=function(y){return y===this.visual||y===this.visual.childNodes[0]||y===this.visual.childNodes[1]},X.prototype.setCenter=function(y,A){this.visual.childNodes.forEach(function(F){return Xe.setAttributes(F,[["cx",y.toString()],["cy",A.toString()]])})},X}(),Hi=function(){function X(y,A,F,q){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=y,this.canvasHeight=A,this.margin=F,this.container=q,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(X.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(y){this._aspectRatio=y,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(y){this._isGridVisible=y,this.gridContainer&&Xe.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(y){this._zoomFactor=y,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),X.prototype.open=function(){var y=this;this.cropShadeElement=Xe.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Xe.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var A=0;A<this.numberOfGridLines;A++)this.horizontalGridLines.push(Xe.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(Xe.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(F){return y.gridContainer.appendChild(F)}),this.verticalGridLines.forEach(function(F){return y.gridContainer.appendChild(F)}),this.cropRectElement=Xe.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Mt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Mt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Mt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Mt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},X.prototype.setCropRectangle=function(y){this.cropRect=y;var A=Object.assign({},this.cropRect);this.zoomFactor!==1&&(A.width=this.cropRect.width*this.zoomFactor,A.height=this.cropRect.height*this.zoomFactor,A.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-A.width/2,A.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-A.height/2),Xe.setAttributes(this.cropRectElement,[["x",A.x.toString()],["y",A.y.toString()],["width",A.width.toString()],["height",A.height.toString()]]);var F=A.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(V,me){var He=A.y+F*(me+1);Xe.setAttributes(V,[["x1",""+A.x],["y1",""+He],["x2",""+(A.x+A.width)],["y2",""+He]])});var q=A.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(V,me){var He=A.x+q*(me+1);Xe.setAttributes(V,[["x1",""+He],["y1",""+A.y],["x2",""+He],["y2",""+(A.y+A.height)]])}),Xe.setAttributes(this.cropShadeElement,[["d",Xe.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,A.x,A.y,A.width,A.height)]]),this.topLeftGrip.setCenter(A.x,A.y),this.topRightGrip.setCenter(A.x+A.width,A.y),this.bottomLeftGrip.setCenter(A.x,A.y+A.height),this.bottomRightGrip.setCenter(A.x+A.width,A.y+A.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},X.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)},X.prototype.clientToLocalCoordinates=function(y,A){var F=this.container.getBoundingClientRect();return{x:y-F.left+this.margin,y:A-F.top+this.margin}},X.prototype.onPointerDown=function(y){this.container.setPointerCapture(y.pointerId),this.previousPoint=this.clientToLocalCoordinates(y.clientX,y.clientY),this.cropRectElement===y.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(y.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(y.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(y.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(y.target)&&(this.activeGrip=this.bottomRightGrip)},X.prototype.onPointerMove=function(y){if(this.isMoving)this.move(this.clientToLocalCoordinates(y.clientX,y.clientY));else if(this.activeGrip){var A=this.clientToLocalCoordinates(y.clientX,y.clientY);this.resize(A)}y.preventDefault()},X.prototype.onPointerUp=function(y){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(y.pointerId)},X.prototype.move=function(y){var A=y.x-this.previousPoint.x,F=y.y-this.previousPoint.y;this.zoomFactor!==1&&(A=-A/this.zoomFactor,F=-F/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+A),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+F),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=y},X.prototype.resize=function(y){var A=Object.assign({},this.cropRect),F=y.x-this.previousPoint.x,q=y.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:A.x+F<this.margin&&(F=this.margin-A.x),A.x+=F,A.width=this.cropRect.x+this.cropRect.width-A.x;break;case this.bottomRightGrip:case this.topRightGrip:A.width+F>this.canvasWidth*this.zoomFactor&&(F=this.canvasWidth*this.zoomFactor-A.width),A.width+=F}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(A.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(F),A.height=this.aspectRatio.getVerticalLength(A.width)):(A.y+=q,A.height=this.cropRect.y+this.cropRect.height-A.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?A.height=this.aspectRatio.getVerticalLength(A.width):A.height+=q}A.width<10&&(A.x=this.cropRect.x,A.width=10),A.height<10&&(A.y=this.cropRect.y,A.height=10),this.previousPoint=y,A.x>=this.margin&&A.y>=this.margin&&A.x-this.margin+A.width<=this.canvasWidth&&A.y-this.margin+A.height<=this.canvasHeight&&(this.cropRect=A,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},X.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var y=this.cropRect.x+this.cropRect.width/2,A=this.cropRect.y+this.cropRect.height/2,F=this.aspectRatio.getHorizontalLength(this.cropRect.height),q=this.aspectRatio.getVerticalLength(this.cropRect.width);F/this.canvasWidth<q/this.canvasHeight?this.cropRect.width=F:this.cropRect.height=q,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=y-this.cropRect.width/2,this.cropRect.y=A-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},X.prototype.getRescaledRect=function(y,A,F,q,V,me){var He=F/y,nt=q/A;return{x:(V.x-me)*He+me,y:(V.y-me)*nt+me,width:V.width*He,height:V.height*nt}},X.prototype.scaleCanvas=function(y,A){var F=this.getRescaledRect(this.canvasWidth,this.canvasHeight,y,A,this.cropRect,this.margin);this.canvasWidth=y,this.canvasHeight=A,this.onCropChange&&this.onCropChange(F),this.setCropRectangle(F)},X}(),Ri=function(){function X(y){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=y,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(X.prototype,"angle",{get:function(){return this._angle},set:function(y){this._angle=y,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),X.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},X.prototype.onPointerDown=function(y){this.controlContainer.setPointerCapture(y.pointerId),this.isDragging=!0,this.previousPoint={x:y.clientX,y:y.clientY}},X.prototype.onPointerMove=function(y){this.isDragging&&(this.onAngleChange&&this.onAngleChange((y.clientX-this.previousPoint.x)/5),this.previousPoint.x=y.clientX)},X.prototype.onPointerUp=function(y){this.isDragging&&this.onAngleChange&&this.onAngleChange((y.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(y.pointerId)},X.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var y=this.angleLabelText.getBBox();Xe.setAttributes(this.angleLabelElement,[["x",((this.width-y.width)/2).toString()],["y",(this.height/2).toString()]])}},X.prototype.positionScaleShape=function(){if(this.scaleShape){var y=this.scaleShape.transform.baseVal.getItem(0);y.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(y,0)}},X.prototype.getVisual=function(){var y=document.createElementNS("http://www.w3.org/2000/svg","svg");y.setAttribute("xmlns","http://www.w3.org/2000/svg"),y.setAttribute("width",this.width+"px"),y.setAttribute("height",this.height+"px"),y.setAttribute("viewBox","0 0 "+this.width+" "+this.height),y.style.flexShrink="0",document.body.appendChild(y);for(var A="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,F=1;F<=this.width/5+10;F++){var q=F%5==0?this.height/3:this.height/6;A+="h4v"+-q+"h1v"+q}A+="v1H0Z",this.scaleShape=Xe.createPath(A);var V=Xe.createTransform();this.scaleShape.transform.baseVal.appendItem(V),y.appendChild(this.scaleShape),this.angleLabelElement=Xe.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Xe.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var me=Xe.createTSpan("");return me.innerHTML="&deg;",this.angleLabelElement.appendChild(me),y.appendChild(this.angleLabelElement),document.body.removeChild(y),y},X}(),pn=function(){function X(){this.naturalSize=!1,this.imageType="image/png"}return X.prototype.rasterize=function(y,A,F,q,V,me,He){var nt=this;return new Promise(function(yt){var ze=document.createElement("canvas");ze.width=y.width.baseVal.value-2*q,ze.height=y.height.baseVal.value-2*q;var xt=1,Kt=1;nt.naturalSize===!0?(xt=A.naturalWidth/(y.width.baseVal.value-2*q)/me,Kt=A.naturalHeight/(y.height.baseVal.value-2*q)/He,ze.width=A.naturalWidth/me,ze.height=A.naturalHeight/He):nt.width!==void 0&&nt.height!==void 0&&(xt=nt.width/F.width,Kt=nt.height/F.height,ze.width*=xt,ze.height*=Kt);var ti=ze.getContext("2d");ti.translate(ze.width/2,ze.height/2),ti.rotate(V*Math.PI/180),ti.scale(me,He),ti.translate(-ze.width/2,-ze.height/2),ti.drawImage(A,0,0,ze.width,ze.height);var ki=document.createElement("canvas");ki.width=F.width*xt,ki.height=F.height*Kt,ki.getContext("2d").putImageData(ti.getImageData((F.x-q)*xt,(F.y-q)*Kt,F.width*xt,F.height*Kt),0,0),yt(ki.toDataURL(nt.imageType,nt.imageQuality))})},X}(),Ye=function(){function X(y){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=X.instanceCounter++,this.styles=new Et(this.instanceNo),this.target=y,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(X.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(y){this._zoomToCropEnabled=y,y?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(y){this._isGridVisible=y,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"gridLines",{get:function(){return this._gridLines},set:function(y){this._gridLines=y,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(y){this._rotationAngle=y,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"aspectRatio",{get:function(){var y;return(y=this._aspectRatio)!==null&&y!==void 0?y:this.aspectRatios[0]},set:function(y){this._aspectRatio=y},enumerable:!1,configurable:!0}),X.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},X.prototype.show=function(){this.showUI(),this.open()},X.prototype.close=function(y){y===void 0&&(y=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),y||this.closeEventListeners.forEach(function(A){return A()}),this._isOpen=!1)},X.prototype.addRenderEventListener=function(y){this.renderEventListeners.push(y)},X.prototype.removeRenderEventListener=function(y){this.renderEventListeners.indexOf(y)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(y),1)},X.prototype.addCloseEventListener=function(y){this.closeEventListeners.push(y)},X.prototype.removeCloseEventListener=function(y){this.closeEventListeners.indexOf(y)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(y),1)},X.prototype.setupResizeObserver=function(){var y=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){y.resize(y.target.clientWidth,y.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))},X.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var y=1*this.target.clientWidth/this.target.clientHeight,A=this.contentDiv.clientWidth/y>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*y:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,F=A+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/y;this.resize(A,F)}},X.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},X.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",Xe.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},X.prototype.resize=function(y,A){this.imageWidth=Math.round(y),this.imageHeight=Math.round(A),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},X.prototype.setEditingTarget=function(){var y=document.createElement("canvas");y.width=this.target.naturalWidth,y.height=this.target.naturalHeight,y.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var A=y.toDataURL();Xe.setAttributes(this.editingTarget,[["href",A]]),this.setEditingTargetSize()},X.prototype.setTopLeft=function(){var y=this.target.getBoundingClientRect(),A=this.editorCanvas.getBoundingClientRect();this.left=y.left-A.left-this.CANVAS_MARGIN,this.top=y.top-A.top-this.CANVAS_MARGIN},X.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=Xe.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=Xe.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=Xe.createGroup(),this.editingTargetRotationScaleContainer=Xe.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var y=Xe.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(y);var A=Xe.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(A),this.editingTargetContainer=Xe.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)},X.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},X.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=Xe.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Hi(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()},X.prototype.zoomToCrop=function(){if(this.cropRect){var y=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,A=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=y+"px "+A+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-y+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-A+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},X.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)},X.prototype.cropRectChanged=function(y){this.cropRect=y,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},X.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},X.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"},X.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},X.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 y=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,A=this.target.offsetTop>y+this.CANVAS_MARGIN?this.target.offsetTop-(y+this.CANVAS_MARGIN):0;this.coverDiv.style.top=A+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},X.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},X.prototype.addTopToolbar=function(){var y=this;this.topToolbar=new si,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var A=new sn;A.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(A);var F=[];this.aspectRatios.forEach(function(Kt){var ti=new zt(nn.getIcon(Kt.horizontal,Kt.vertical),Kt.horizontal===0&&Kt.vertical===0?"FREE":Kt.horizontal+":"+Kt.vertical);ti.onClick=function(){return y.ratioButtonClicked(Kt)},F.push(ti)}),this.aspectRatioButton=new Ei(nn.getIcon(0,0),"Aspect ratio",F),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,A.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var q=new zt('<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");q.isActive=this.isGridVisible,q.onClick=function(){y.isGridVisible=!y.isGridVisible,q.isActive=y.isGridVisible},A.addButton(q);var V=new zt('<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(V.isActive=this.zoomToCropEnabled,V.onClick=function(){y.zoomToCropEnabled=!y.zoomToCropEnabled,V.isActive=y.zoomToCropEnabled},A.addButton(V),!Ve.isLicensed){var me=new vt;this.topToolbar.addElementBlock(me);var He=document.createElement("div");He.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var nt=document.createElement("a");nt.style.color="currentColor",nt.href="https://markerjs.com/products/cropro",nt.target="_blank",nt.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>',He.appendChild(nt),me.addElement(He)}var yt=new sn;yt.minWidth=3*this.toolbarHeight+"px",yt.contentAlign="end",this.topToolbar.addButtonBlock(yt);var ze=new zt('<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");ze.onClick=this.startRenderAndClose,yt.addButton(ze),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(ze.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var xt=new zt('<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");xt.onClick=this.close,yt.addButton(xt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(xt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},X.prototype.addBottomToolbar=function(){var y=this;this.bottomToolbar=new si,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var A=new sn;A.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(A);var F=new zt('<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");F.onClick=this.rotateLeftButtonClicked,A.addButton(F);var q=new zt('<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");q.onClick=this.rotateRightButtonClicked,A.addButton(q);var V=new vt;V.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(V),this.straightener=new Ri("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(yt){y.rotateBy(yt),y.straightener.angle=y.rotationAngle},V.addElement(this.straightener.getUI());var me=new sn;me.minWidth=2*this.toolbarHeight+"px",me.contentAlign="end",this.bottomToolbar.addButtonBlock(me);var He=new zt('<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");He.onClick=this.flipHorizontallyButtonClicked,me.addButton(He);var nt=new zt('<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");nt.onClick=this.flipVerticallyButtonClicked,me.addButton(nt)},X.prototype.ratioButtonClicked=function(y){this.aspectRatio=y,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},X.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=nn.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},X.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new ji(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},X.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},X.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},X.prototype.restoreState=function(y){if(y){var A=this.cropLayer.getRescaledRect(y.width,y.height,this.imageWidth,this.imageHeight,y.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(A),this.cropRectChanged(A),this.flippedHorizontally=y.flippedHorizontally,this.flippedVertically=y.flippedVertically,this.applyFlip(),this.rotationAngle=y.rotationAngle,this.applyRotation()}},X.prototype.clientToLocalCoordinates=function(y,A){var F=this.cropImage.getBoundingClientRect();return{x:y-F.left,y:A-F.top}},X.prototype.onWindowResize=function(){this.positionUI()},X.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var y=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=y+"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()},X.prototype.rotateLeftButtonClicked=function(){var y=this.rotationAngle-90;this.rotationAngle%90!=0&&(y+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(y)},X.prototype.rotateRightButtonClicked=function(){var y=this.rotationAngle+90;this.rotationAngle%90!=0&&(y-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(y)},X.prototype.rotateTo=function(y){y=(y=y>180?y-360:y)<=-180?y+360:y,this.rotationAngle=y,this.applyRotation()},X.prototype.rotateBy=function(y){this.rotateTo((this.rotationAngle+y)%360)},X.prototype.applyRotation=function(){var y=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var A=this.editingTargetRotationContainer.transform.baseVal.getItem(0);A.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(A,0);var F=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/F.width,this.imageHeight/F.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=y},X.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},X.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},X.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},X.prototype.startRenderAndClose=function(){return Ut(this,void 0,void 0,function(){var y,A;return fi(this,function(F){switch(F.label){case 0:return[4,this.render()];case 1:return y=F.sent(),A=this.getState(),this.renderEventListeners.forEach(function(q){return q(y,A)}),this.close(!0),[2]}})})},X.prototype.render=function(){return Ut(this,void 0,void 0,function(){var y;return fi(this,function(A){switch(A.label){case 0:return(y=new pn).naturalSize=this.renderAtNaturalSize,y.imageType=this.renderImageType,y.imageQuality=this.renderImageQuality,y.width=this.renderWidth,y.height=this.renderHeight,this.unzoomFromCrop(),Xe.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,y.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return A.sent(),[4,y.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,A.sent()]}})})},X.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Pt("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 Pt("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Pt("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var y=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Pt("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*y)+`px;
height: `+(this.toolbarHeight-2*y)+`px;
padding: `+y+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Pt("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Pt("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new Dt("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new Dt("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Pt("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 Pt("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Pt("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 Pt("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*y)+`px;
padding: `+y+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Pt("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},X.instanceCounter=0,X}(),Ct=ne("8hTe"),mn=ne.n(Ct),gn=/<pre[^>]*>/g;function vn(X){var y=document.createElement("div");return y.innerHTML=X,y.childNodes.length===0?"":y.childNodes[0].nodeValue}var Zi=Je.a=function(X){var y=X.value,A=y===void 0?"":y,F=X.edit,q=F===void 0?!1:F,V=X.className,me=X.showTextOnly,He=X.showLines,nt=X.replaces,yt=X.zoomImg,ze=X.hasMask,xt=X.style,Kt=xt===void 0?{}:xt,ti=X.stylesPrev,ki=ti===void 0?{}:ti,xi=String(A),ui=Object(O.useRef)(),Qi=Object(O.useRef)(),on=Object(O.useState)(""),pi=Object(K.a)(on,2),Ni=pi[0],ln=pi[1],qi=Object(O.useState)("office"),rt=Object(K.a)(qi,2),kt=rt[0],Jt=rt[1],wt=function(){var Yt=new Ye(Qi.current);Yt.displayMode="popup",Yt.addRenderEventListener(function(){var Oi=Object(U.a)(M.a.mark(function Ht(mi){var ii;return M.a.wrap(function(Ti){for(;;)switch(Ti.prev=Ti.next){case 0:return ui.current.style.display="none",Ti.next=3,Object(xe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:mi}});case 3:ii=Ti.sent,ii!=null&&ii.id&&nt(Qi.current.getAttribute("src").replace(Y.a.API_SERVER,""),"/api/attachments/".concat(ii==null?void 0:ii.id,"?type=").concat(ii.content_type));case 5:case"end":return Ti.stop()}},Ht)}));return function(Ht){return Oi.apply(this,arguments)}}()),Yt.show()},$t=function(){var Yt=new Bt(Qi.current);Yt.settings.displayMode="popup",Yt.addEventListener("render",function(){var Oi=Object(U.a)(M.a.mark(function Ht(mi){var ii;return M.a.wrap(function(Ti){for(;;)switch(Ti.prev=Ti.next){case 0:if(ui.current.style.display="none",!Qi.current){Ti.next=6;break}return Ti.next=4,Object(xe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:mi.dataUrl}});case 4:ii=Ti.sent,ii!=null&&ii.id&&nt(Qi.current.getAttribute("src").replace(Y.a.API_SERVER,""),"/api/attachments/".concat(ii==null?void 0:ii.id,"?type=").concat(ii.content_type));case 6:case"end":return Ti.stop()}},Ht)}));return function(Ht){return Oi.apply(this,arguments)}}()),Yt.show(),window.markerArea=Yt},Vt=Object(O.useMemo)(function(){ui.current&&(ui.current.style.zIndex=-1);try{var oi=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Yt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Oi=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;xi=xi.replace(oi,"("+Y.a.API_SERVER+"/api/attachments/").replace(Yt,'"'+Y.a.API_SERVER+"/api/attachments/").replace(Oi,'"'+Y.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(yn){}var Ht=j(xi),mi=u();if(xi.match(/\[TOC\]/)&&(Ht=Ht.replace("<p>[TOC]</p>",R()),L()),Ht=Ht.replace(/(__special_katext_id_\d+__)/g,function(yn,Ti){var Ui=mi[Ti],Yn=Ui.type,An=Ui.expression;return Object(ie.renderToString)(vn(An)||"",{displayMode:Yn==="block",throwOnError:!1,output:"html"})}),Ht=Ht.replace(/▁/g,"\u2581\u2581\u2581"),g(),me){var ii=document.createElement("div");return ii.innerHTML=Ht,ii.innerText}return setTimeout(function(){return un()},500),Ht},[xi]),jt=Object(O.useRef)();w.WebkitLineClamp=He,He&&(Kt=Object(B.a)(Object(B.a)({},Kt),w));function Zt(oi){var Yt=oi.target;if(Yt.tagName.toUpperCase()==="IMG"){if(yt){var Oi=Yt.getAttribute("src");ln(Oi),Jt("image")}}else if(Yt.tagName.toUpperCase()==="A"){var Ht=Yt.getAttribute("href");if(Ht.indexOf("office")>-1)oi.preventDefault(),ln(Ht),Jt("office");else if(Ht.indexOf("application/pdf")>-1)oi.preventDefault(),ln(Ht),Jt("pdf");else if(Ht.indexOf("text/html")>-1)oi.preventDefault(),ln(Ht),Jt("html");else if(Ht.startsWith("#")){oi.preventDefault();var mi=document.getElementById(Ht.replace("#",""));mi&&mi.scrollIntoView(!0)}}}var un=function(){var Yt,Oi=(Yt=jt.current)===null||Yt===void 0?void 0:Yt.querySelectorAll("video");Oi==null||Oi.forEach(function(Ht){if(Ht.oncontextmenu=function(){return!1},Ht.src.indexOf(".m3u8")>-1&&!Ht.canPlayType("application/vnd.apple.mpegurl")){if(W.a.isSupported()){var mi=new W.a;mi.loadSource(Ht.src),mi.attachMedia(Ht)}}})};Object(O.useEffect)(function(){if(jt.current&&Vt&&(Vt.match(gn)&&window.PR.prettyPrint()),jt.current)return jt.current.addEventListener("click",Zt),function(){jt.current.removeEventListener("click",Zt),g(),L()}},[Vt,jt.current,Zt]);var yi=function(Yt){if(!q)return;Yt.target.nodeName==="IMG"?(ui.current.style.zIndex=1,ui.current.style.display="flex",ui.current.style.width=Yt.target.clientWidth+"px",ui.current.style.height=Yt.target.clientHeight+"px",ui.current.style.top=Yt.target.offsetTop+"px",ui.current.style.left=Yt.target.offsetLeft+"px",Qi.current.src=Yt.target.getAttribute("src")):ui.current.style.display="none"};return v.a.createElement("div",{style:{position:"relative"}},v.a.createElement("div",{ref:jt,style:Object(B.a)({},Kt),className:"".concat(V||""," markdown-body ").concat(mn.a.mdBody),onMouseOver:yi,dangerouslySetInnerHTML:{__html:Vt}}),v.a.createElement("div",{ref:ui,className:mn.a.button},v.a.createElement(Z.a,null,v.a.createElement($.a,{onClick:function(){return wt()}},"\u88C1\u526A"),v.a.createElement($.a,{onClick:function(){return $t()}},"\u7F16\u8F91"))),v.a.createElement("img",{ref:Qi,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),v.a.createElement(oe.a,{close:!0,data:Ni,type:Ni!=null&&Ni.length?kt:"",style:Object(B.a)({},ki),onClose:function(){return ln("")}}))}},"9VGf":function(_t,Je,ne){"use strict";ne.d(Je,"a",function(){return P});var ue=ne("q1tI"),Z=ne.n(ue);function P($,B){var U=Object(ue.useRef)();Object(ue.useEffect)(function(){U.current=$}),Object(ue.useEffect)(function(){function K(){U.current()}if(B!==null){var G=setInterval(K,B);return function(){return clearInterval(G)}}},[B])}},BU3w:function(_t,Je,ne){"use strict";ne.d(Je,"a",function(){return U});var ue=ne("MNnm"),Z="rc-util-key";function P(K){if(K.attachTo)return K.attachTo;var G=document.querySelector("head");return G||document.body}function $(K){var G,M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ue.a)())return null;var O=document.createElement("style");if((G=M.csp)===null||G===void 0?void 0:G.nonce){var v;O.nonce=(v=M.csp)===null||v===void 0?void 0:v.nonce}O.innerHTML=K;var m=P(M),p=m.firstChild;return M.prepend&&m.prepend?m.prepend(O):M.prepend&&p?m.insertBefore(O,p):m.appendChild(O),O}var B=new Map;function U(K,G){var M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},O=P(M);if(!B.has(O)){var v=$("",M),m=v.parentNode;B.set(O,m),m.removeChild(v)}var p=Array.from(B.get(O).children).find(function(r){return r.tagName==="STYLE"&&r[Z]===G});if(p){var h,o;if(((h=M.csp)===null||h===void 0?void 0:h.nonce)&&p.nonce!==((o=M.csp)===null||o===void 0?void 0:o.nonce)){var f;p.nonce=(f=M.csp)===null||f===void 0?void 0:f.nonce}return p.innerHTML!==K&&(p.innerHTML=K),p}var l=$(K,M);return l[Z]=G,l}},Bd2K:function(_t,Je,ne){(function(ue){ue(ne("VrN/"),ne("osHv"))})(function(ue){ue.defineOption("autoCloseTags",!1,function(M,O,v){if(v!=ue.Init&&v&&M.removeKeyMap("autoCloseTags"),!O)return;var m={name:"autoCloseTags"};(typeof O!="object"||O.whenClosing!==!1)&&(m["'/'"]=function(p){return U(p)}),(typeof O!="object"||O.whenOpening!==!1)&&(m["'>'"]=function(p){return $(p)}),M.addKeyMap(m)});var Z=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],P=["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 $(M){if(M.getOption("disableInput"))return ue.Pass;for(var O=M.listSelections(),v=[],m=M.getOption("autoCloseTags"),p=0;p<O.length;p++){if(!O[p].empty())return ue.Pass;var h=O[p].head,o=M.getTokenAt(h),f=ue.innerMode(M.getMode(),o.state),l=f.state,r=f.mode.xmlCurrentTag&&f.mode.xmlCurrentTag(l),s=r&&r.name;if(!s)return ue.Pass;var c=f.mode.configuration=="html",L=typeof m=="object"&&m.dontCloseTags||c&&Z,w=typeof m=="object"&&m.indentTags||c&&P;o.end>h.ch&&(s=s.slice(0,s.length-o.end+h.ch));var T=s.toLowerCase();if(!s||o.type=="string"&&(o.end!=h.ch||!/[\"\']/.test(o.string.charAt(o.string.length-1))||o.string.length==1)||o.type=="tag"&&r.close||o.string.indexOf("/")==h.ch-o.start-1||L&&K(L,T)>-1||G(M,f.mode.xmlCurrentContext&&f.mode.xmlCurrentContext(l)||[],s,h,!0))return ue.Pass;var R=typeof m=="object"&&m.emptyTags;if(R&&K(R,s)>-1){v[p]={text:"/>",newPos:ue.Pos(h.line,h.ch+2)};continue}var C=w&&K(w,T)>-1;v[p]={indent:C,text:">"+(C?`
`:"")+"</"+s+">",newPos:C?ue.Pos(h.line+1,0):ue.Pos(h.line,h.ch+1)}}for(var S=typeof m=="object"&&m.dontIndentOnAutoClose,p=O.length-1;p>=0;p--){var x=v[p];M.replaceRange(x.text,O[p].head,O[p].anchor,"+insert");var _=M.listSelections().slice(0);_[p]={head:x.newPos,anchor:x.newPos},M.setSelections(_),!S&&x.indent&&(M.indentLine(x.newPos.line,null,!0),M.indentLine(x.newPos.line+1,null,!0))}}function B(M,O){for(var v=M.listSelections(),m=[],p=O?"/":"</",h=M.getOption("autoCloseTags"),o=typeof h=="object"&&h.dontIndentOnSlash,f=0;f<v.length;f++){if(!v[f].empty())return ue.Pass;var l=v[f].head,r=M.getTokenAt(l),s=ue.innerMode(M.getMode(),r.state),c=s.state;if(O&&(r.type=="string"||r.string.charAt(0)!="<"||r.start!=l.ch-1))return ue.Pass;var L,w=s.mode.name!="xml"&&M.getMode().name=="htmlmixed";if(w&&s.mode.name=="javascript")L=p+"script";else if(w&&s.mode.name=="css")L=p+"style";else{var T=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(c);if(!T||T.length&&G(M,T,T[T.length-1],l))return ue.Pass;L=p+T[T.length-1]}M.getLine(l.line).charAt(r.end)!=">"&&(L+=">"),m[f]=L}if(M.replaceSelections(m),v=M.listSelections(),!o)for(var f=0;f<v.length;f++)(f==v.length-1||v[f].head.line<v[f+1].head.line)&&M.indentLine(v[f].head.line)}function U(M){return M.getOption("disableInput")?ue.Pass:B(M,!0)}ue.commands.closeTag=function(M){return B(M)};function K(M,O){if(M.indexOf)return M.indexOf(O);for(var v=0,m=M.length;v<m;++v)if(M[v]==O)return v;return-1}function G(M,O,v,m,p){if(!ue.scanForClosingTag)return!1;var h=Math.min(M.lastLine()+1,m.line+500),o=ue.scanForClosingTag(M,m,null,h);if(!o||o.tag!=v)return!1;for(var f=p?1:0,l=O.length-1;l>=0&&O[l]==v;l--)++f;m=o.to;for(var l=1;l<f;l++){var r=ue.scanForClosingTag(M,m,null,h);if(!r||r.tag!=v)return!1;m=r.to}return!0}})},BjJ7:function(_t,Je,ne){"use strict";ne.d(Je,"d",function(){return Z}),ne.d(Je,"c",function(){return P}),ne.d(Je,"e",function(){return $}),ne.d(Je,"b",function(){return B}),ne.d(Je,"a",function(){return K});var ue=ne("m3rI");function Z(G){var M=!0;if(G.length>0){for(var O=0;O<G.length;O++)if(G[O].compile_success==0||!G[O].compile_success){M=!1;break}}else M=!1;return M}function P(G){for(var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",O=[],v=0;v<G.length;v++){var m=G[v],p=M?"".concat(M,"/").concat(m.name):"".concat(m.name);O.push({title:m.name,isLeaf:!(m.type==="tree"),key:p})}return O}function $(G,M,O){for(var v=0;v<G.length;v++){var m=G[v];if(m.key===M){m.children=O;break}m.children&&$(m.children,M,O)}return G}function B(G,M,O){var v;return function(){var m=this,p=arguments,h=function(){v=null,O||G.apply(m,p)},o=O&&!v;clearTimeout(v),v=setTimeout(h,M),o&&G.apply(m,p)}}var U=!0,K=ue.a.API_SERVER},"C+DQ":function(_t,Je,ne){},DlQD:function(_t,Je,ne){(function(ue,Z){_t.exports=Z()})(this,function(){"use strict";function ue(Ee,pe){for(var _e=0;_e<pe.length;_e++){var re=pe[_e];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(Ee,re.key,re)}}function Z(Ee,pe,_e){return pe&&ue(Ee.prototype,pe),_e&&ue(Ee,_e),Ee}function P(Ee,pe){if(!Ee)return;if(typeof Ee=="string")return $(Ee,pe);var _e=Object.prototype.toString.call(Ee).slice(8,-1);if(_e==="Object"&&Ee.constructor&&(_e=Ee.constructor.name),_e==="Map"||_e==="Set")return Array.from(Ee);if(_e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(_e))return $(Ee,pe)}function $(Ee,pe){(pe==null||pe>Ee.length)&&(pe=Ee.length);for(var _e=0,re=new Array(pe);_e<pe;_e++)re[_e]=Ee[_e];return re}function B(Ee,pe){var _e;if(typeof Symbol=="undefined"||Ee[Symbol.iterator]==null){if(Array.isArray(Ee)||(_e=P(Ee))||pe&&Ee&&typeof Ee.length=="number"){_e&&(Ee=_e);var re=0;return function(){return re>=Ee.length?{done:!0}:{done:!1,value:Ee[re++]}}}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 _e=Ee[Symbol.iterator](),_e.next.bind(_e)}function U(Ee,pe){return pe={exports:{}},Ee(pe,pe.exports),pe.exports}var K=U(function(Ee){function pe(){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 _e(re){Ee.exports.defaults=re}Ee.exports={defaults:pe(),getDefaults:pe,changeDefaults:_e}}),G=K.defaults,M=K.getDefaults,O=K.changeDefaults,v=/[&<>"']/,m=/[&<>"']/g,p=/[<>"']|&(?!#?\w+;)/,h=/[<>"']|&(?!#?\w+;)/g,o={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},f=function(pe){return o[pe]};function l(Ee,pe){if(pe){if(v.test(Ee))return Ee.replace(m,f)}else if(p.test(Ee))return Ee.replace(h,f);return Ee}var r=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(Ee){return Ee.replace(r,function(pe,_e){return _e=_e.toLowerCase(),_e==="colon"?":":_e.charAt(0)==="#"?_e.charAt(1)==="x"?String.fromCharCode(parseInt(_e.substring(2),16)):String.fromCharCode(+_e.substring(1)):""})}var c=/(^|[^\[])\^/g;function L(Ee,pe){Ee=Ee.source||Ee,pe=pe||"";var _e={replace:function(ae,he){return he=he.source||he,he=he.replace(c,"$1"),Ee=Ee.replace(ae,he),_e},getRegex:function(){return new RegExp(Ee,pe)}};return _e}var w=/[^\w:]/g,T=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function R(Ee,pe,_e){if(Ee){var re;try{re=decodeURIComponent(s(_e)).replace(w,"").toLowerCase()}catch(ae){return null}if(re.indexOf("javascript:")===0||re.indexOf("vbscript:")===0||re.indexOf("data:")===0)return null}pe&&!T.test(_e)&&(_e=d(pe,_e));try{_e=encodeURI(_e).replace(/%25/g,"%")}catch(ae){return null}return _e}var C={},S=/^[^:]+:\/*[^/]*$/,x=/^([^:]+:)[\s\S]*$/,_=/^([^:]+:\/*[^/]*)[\s\S]*$/;function d(Ee,pe){C[" "+Ee]||(S.test(Ee)?C[" "+Ee]=Ee+"/":C[" "+Ee]=N(Ee,"/",!0)),Ee=C[" "+Ee];var _e=Ee.indexOf(":")===-1;return pe.substring(0,2)==="//"?_e?pe:Ee.replace(x,"$1")+pe:pe.charAt(0)==="/"?_e?pe:Ee.replace(_,"$1")+pe:Ee+pe}var u={exec:function(){}};function g(Ee){for(var pe=1,_e,re;pe<arguments.length;pe++){_e=arguments[pe];for(re in _e)Object.prototype.hasOwnProperty.call(_e,re)&&(Ee[re]=_e[re])}return Ee}function E(Ee,pe){var _e=Ee.replace(/\|/g,function(he,ge,be){for(var De=!1,je=ge;--je>=0&&be[je]==="\\";)De=!De;return De?"|":" |"}),re=_e.split(/ \|/),ae=0;if(re.length>pe)re.splice(pe);else for(;re.length<pe;)re.push("");for(;ae<re.length;ae++)re[ae]=re[ae].trim().replace(/\\\|/g,"|");return re}function N(Ee,pe,_e){var re=Ee.length;if(re===0)return"";for(var ae=0;ae<re;){var he=Ee.charAt(re-ae-1);if(he===pe&&!_e)ae++;else if(he!==pe&&_e)ae++;else break}return Ee.substr(0,re-ae)}function D(Ee,pe){if(Ee.indexOf(pe[1])===-1)return-1;for(var _e=Ee.length,re=0,ae=0;ae<_e;ae++)if(Ee[ae]==="\\")ae++;else if(Ee[ae]===pe[0])re++;else if(Ee[ae]===pe[1]&&(re--,re<0))return ae;return-1}function H(Ee){Ee&&Ee.sanitize&&!Ee.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 j={escape:l,unescape:s,edit:L,cleanUrl:R,resolveUrl:d,noopTest:u,merge:g,splitCells:E,rtrim:N,findClosingBracket:D,checkSanitizeDeprecation:H},I=K.defaults,b=j.rtrim,W=j.splitCells,Y=j.escape,ie=j.findClosingBracket;function oe(Ee,pe,_e){var re=pe.href,ae=pe.title?Y(pe.title):null,he=Ee[1].replace(/\\([\[\]])/g,"$1");return Ee[0].charAt(0)!=="!"?{type:"link",raw:_e,href:re,title:ae,text:he}:{type:"image",raw:_e,href:re,title:ae,text:Y(he)}}function xe(Ee,pe){var _e=Ee.match(/^(\s+)(?:```)/);if(_e===null)return pe;var re=_e[1];return pe.split(`
`).map(function(ae){var he=ae.match(/^\s+/);if(he===null)return ae;var ge=he[0];return ge.length>=re.length?ae.slice(re.length):ae}).join(`
`)}var ve=function(){function Ee(_e){this.options=_e||I}var pe=Ee.prototype;return pe.space=function(re){var ae=this.rules.block.newline.exec(re);if(ae)return ae[0].length>1?{type:"space",raw:ae[0]}:{raw:`
`}},pe.code=function(re,ae){var he=this.rules.block.code.exec(re);if(he){var ge=ae[ae.length-1];if(ge&&ge.type==="paragraph")return{raw:he[0],text:he[0].trimRight()};var be=he[0].replace(/^ {4}/gm,"");return{type:"code",raw:he[0],codeBlockStyle:"indented",text:this.options.pedantic?be:b(be,`
`)}}},pe.fences=function(re){var ae=this.rules.block.fences.exec(re);if(ae){var he=ae[0],ge=xe(he,ae[3]||"");return{type:"code",raw:he,lang:ae[2]?ae[2].trim():ae[2],text:ge}}},pe.heading=function(re){var ae=this.rules.block.heading.exec(re);if(ae)return{type:"heading",raw:ae[0],depth:ae[1].length,text:ae[2]}},pe.nptable=function(re){var ae=this.rules.block.nptable.exec(re);if(ae){var he={type:"table",header:W(ae[1].replace(/^ *| *\| *$/g,"")),align:ae[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ae[3]?ae[3].replace(/\n$/,"").split(`
`):[],raw:ae[0]};if(he.header.length===he.align.length){var ge=he.align.length,be;for(be=0;be<ge;be++)/^ *-+: *$/.test(he.align[be])?he.align[be]="right":/^ *:-+: *$/.test(he.align[be])?he.align[be]="center":/^ *:-+ *$/.test(he.align[be])?he.align[be]="left":he.align[be]=null;for(ge=he.cells.length,be=0;be<ge;be++)he.cells[be]=W(he.cells[be],he.header.length);return he}}},pe.hr=function(re){var ae=this.rules.block.hr.exec(re);if(ae)return{type:"hr",raw:ae[0]}},pe.blockquote=function(re){var ae=this.rules.block.blockquote.exec(re);if(ae){var he=ae[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ae[0],text:he}}},pe.list=function(re){var ae=this.rules.block.list.exec(re);if(ae){for(var he=ae[0],ge=ae[2],be=ge.length>1,De=ge[ge.length-1]===")",je={type:"list",raw:he,ordered:be,start:be?+ge.slice(0,-1):"",loose:!1,items:[]},lt=ae[0].match(this.rules.block.item),mt=!1,pt,Ot,Rt,ft,It,Bt,ht,ei=lt.length,Ut=0;Ut<ei;Ut++)pt=lt[Ut],he=pt,Ot=pt.length,pt=pt.replace(/^ *([*+-]|\d+[.)]) */,""),~pt.indexOf(`
`)&&(Ot-=pt.length,pt=this.options.pedantic?pt.replace(/^ {1,4}/gm,""):pt.replace(new RegExp("^ {1,"+Ot+"}","gm"),"")),Ut!==ei-1&&(Rt=this.rules.block.bullet.exec(lt[Ut+1])[0],(be?Rt.length===1||!De&&Rt[Rt.length-1]===")":Rt.length>1||this.options.smartLists&&Rt!==ge)&&(ft=lt.slice(Ut+1).join(`
`),je.raw=je.raw.substring(0,je.raw.length-ft.length),Ut=ei-1)),It=mt||/\n\n(?!\s*$)/.test(pt),Ut!==ei-1&&(mt=pt.charAt(pt.length-1)===`
`,It||(It=mt)),It&&(je.loose=!0),Bt=/^\[[ xX]\] /.test(pt),ht=void 0,Bt&&(ht=pt[1]!==" ",pt=pt.replace(/^\[[ xX]\] +/,"")),je.items.push({type:"list_item",raw:he,task:Bt,checked:ht,loose:It,text:pt});return je}},pe.html=function(re){var ae=this.rules.block.html.exec(re);if(ae)return{type:this.options.sanitize?"paragraph":"html",raw:ae[0],pre:!this.options.sanitizer&&(ae[1]==="pre"||ae[1]==="script"||ae[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ae[0]):Y(ae[0]):ae[0]}},pe.def=function(re){var ae=this.rules.block.def.exec(re);if(ae){ae[3]&&(ae[3]=ae[3].substring(1,ae[3].length-1));var he=ae[1].toLowerCase().replace(/\s+/g," ");return{tag:he,raw:ae[0],href:ae[2],title:ae[3]}}},pe.table=function(re){var ae=this.rules.block.table.exec(re);if(ae){var he={type:"table",header:W(ae[1].replace(/^ *| *\| *$/g,"")),align:ae[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ae[3]?ae[3].replace(/\n$/,"").split(`
`):[]};if(he.header.length===he.align.length){he.raw=ae[0];var ge=he.align.length,be;for(be=0;be<ge;be++)/^ *-+: *$/.test(he.align[be])?he.align[be]="right":/^ *:-+: *$/.test(he.align[be])?he.align[be]="center":/^ *:-+ *$/.test(he.align[be])?he.align[be]="left":he.align[be]=null;for(ge=he.cells.length,be=0;be<ge;be++)he.cells[be]=W(he.cells[be].replace(/^ *\| *| *\| *$/g,""),he.header.length);return he}}},pe.lheading=function(re){var ae=this.rules.block.lheading.exec(re);if(ae)return{type:"heading",raw:ae[0],depth:ae[2].charAt(0)==="="?1:2,text:ae[1]}},pe.paragraph=function(re){var ae=this.rules.block.paragraph.exec(re);if(ae)return{type:"paragraph",raw:ae[0],text:ae[1].charAt(ae[1].length-1)===`
`?ae[1].slice(0,-1):ae[1]}},pe.text=function(re,ae){var he=this.rules.block.text.exec(re);if(he){var ge=ae[ae.length-1];return ge&&ge.type==="text"?{raw:he[0],text:he[0]}:{type:"text",raw:he[0],text:he[0]}}},pe.escape=function(re){var ae=this.rules.inline.escape.exec(re);if(ae)return{type:"escape",raw:ae[0],text:Y(ae[1])}},pe.tag=function(re,ae,he){var ge=this.rules.inline.tag.exec(re);if(ge)return!ae&&/^<a /i.test(ge[0])?ae=!0:ae&&/^<\/a>/i.test(ge[0])&&(ae=!1),!he&&/^<(pre|code|kbd|script)(\s|>)/i.test(ge[0])?he=!0:he&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ge[0])&&(he=!1),{type:this.options.sanitize?"text":"html",raw:ge[0],inLink:ae,inRawBlock:he,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ge[0]):Y(ge[0]):ge[0]}},pe.link=function(re){var ae=this.rules.inline.link.exec(re);if(ae){var he=ie(ae[2],"()");if(he>-1){var ge=ae[0].indexOf("!")===0?5:4,be=ge+ae[1].length+he;ae[2]=ae[2].substring(0,he),ae[0]=ae[0].substring(0,be).trim(),ae[3]=""}var De=ae[2],je="";if(this.options.pedantic){var lt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(De);lt?(De=lt[1],je=lt[3]):je=""}else je=ae[3]?ae[3].slice(1,-1):"";De=De.trim().replace(/^<([\s\S]*)>$/,"$1");var mt=oe(ae,{href:De&&De.replace(this.rules.inline._escapes,"$1"),title:je&&je.replace(this.rules.inline._escapes,"$1")},ae[0]);return mt}},pe.reflink=function(re,ae){var he;if((he=this.rules.inline.reflink.exec(re))||(he=this.rules.inline.nolink.exec(re))){var ge=(he[2]||he[1]).replace(/\s+/g," ");if(ge=ae[ge.toLowerCase()],!ge||!ge.href){var be=he[0].charAt(0);return{type:"text",raw:be,text:be}}var De=oe(he,ge,he[0]);return De}},pe.strong=function(re,ae,he){he===void 0&&(he="");var ge=this.rules.inline.strong.start.exec(re);if(ge&&(!ge[1]||ge[1]&&(he===""||this.rules.inline.punctuation.exec(he)))){ae=ae.slice(-1*re.length);var be=ge[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;be.lastIndex=0;for(var De;(ge=be.exec(ae))!=null;)if(De=this.rules.inline.strong.middle.exec(ae.slice(0,ge.index+3)),De)return{type:"strong",raw:re.slice(0,De[0].length),text:re.slice(2,De[0].length-2)}}},pe.em=function(re,ae,he){he===void 0&&(he="");var ge=this.rules.inline.em.start.exec(re);if(ge&&(!ge[1]||ge[1]&&(he===""||this.rules.inline.punctuation.exec(he)))){ae=ae.slice(-1*re.length);var be=ge[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;be.lastIndex=0;for(var De;(ge=be.exec(ae))!=null;)if(De=this.rules.inline.em.middle.exec(ae.slice(0,ge.index+2)),De)return{type:"em",raw:re.slice(0,De[0].length),text:re.slice(1,De[0].length-1)}}},pe.codespan=function(re){var ae=this.rules.inline.code.exec(re);if(ae){var he=ae[2].replace(/\n/g," "),ge=/[^ ]/.test(he),be=he.startsWith(" ")&&he.endsWith(" ");return ge&&be&&(he=he.substring(1,he.length-1)),he=Y(he,!0),{type:"codespan",raw:ae[0],text:he}}},pe.br=function(re){var ae=this.rules.inline.br.exec(re);if(ae)return{type:"br",raw:ae[0]}},pe.del=function(re){var ae=this.rules.inline.del.exec(re);if(ae)return{type:"del",raw:ae[0],text:ae[1]}},pe.autolink=function(re,ae){var he=this.rules.inline.autolink.exec(re);if(he){var ge,be;return he[2]==="@"?(ge=Y(this.options.mangle?ae(he[1]):he[1]),be="mailto:"+ge):(ge=Y(he[1]),be=ge),{type:"link",raw:he[0],text:ge,href:be,tokens:[{type:"text",raw:ge,text:ge}]}}},pe.url=function(re,ae){var he;if(he=this.rules.inline.url.exec(re)){var ge,be;if(he[2]==="@")ge=Y(this.options.mangle?ae(he[0]):he[0]),be="mailto:"+ge;else{var De;do De=he[0],he[0]=this.rules.inline._backpedal.exec(he[0])[0];while(De!==he[0]);ge=Y(he[0]),he[1]==="www."?be="http://"+ge:be=ge}return{type:"link",raw:he[0],text:ge,href:be,tokens:[{type:"text",raw:ge,text:ge}]}}},pe.inlineText=function(re,ae,he){var ge=this.rules.inline.text.exec(re);if(ge){var be;return ae?be=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ge[0]):Y(ge[0]):ge[0]:be=Y(this.options.smartypants?he(ge[0]):ge[0]),{type:"text",raw:ge[0],text:be}}},Ee}(),we=j.noopTest,Ce=j.edit,Se=j.merge,fe={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:we,table:we,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};fe._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,fe._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,fe.def=Ce(fe.def).replace("label",fe._label).replace("title",fe._title).getRegex(),fe.bullet=/(?:[*+-]|\d{1,9}[.)])/,fe.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,fe.item=Ce(fe.item,"gm").replace(/bull/g,fe.bullet).getRegex(),fe.list=Ce(fe.list).replace(/bull/g,fe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+fe.def.source+")").getRegex(),fe._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",fe._comment=/<!--(?!-?>)[\s\S]*?-->/,fe.html=Ce(fe.html,"i").replace("comment",fe._comment).replace("tag",fe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),fe.paragraph=Ce(fe._paragraph).replace("hr",fe.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",fe._tag).getRegex(),fe.blockquote=Ce(fe.blockquote).replace("paragraph",fe.paragraph).getRegex(),fe.normal=Se({},fe),fe.gfm=Se({},fe.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),fe.gfm.nptable=Ce(fe.gfm.nptable).replace("hr",fe.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",fe._tag).getRegex(),fe.gfm.table=Ce(fe.gfm.table).replace("hr",fe.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",fe._tag).getRegex(),fe.pedantic=Se({},fe.normal,{html:Ce(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",fe._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:we,paragraph:Ce(fe.normal._paragraph).replace("hr",fe.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",fe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var le={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:we,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:we,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};le._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",le.punctuation=Ce(le.punctuation).replace(/punctuation/g,le._punctuation).getRegex(),le._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",le._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",le.em.start=Ce(le.em.start).replace(/punctuation/g,le._punctuation).getRegex(),le.em.middle=Ce(le.em.middle).replace(/punctuation/g,le._punctuation).replace(/overlapSkip/g,le._overlapSkip).getRegex(),le.em.endAst=Ce(le.em.endAst,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.em.endUnd=Ce(le.em.endUnd,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.strong.start=Ce(le.strong.start).replace(/punctuation/g,le._punctuation).getRegex(),le.strong.middle=Ce(le.strong.middle).replace(/punctuation/g,le._punctuation).replace(/blockSkip/g,le._blockSkip).getRegex(),le.strong.endAst=Ce(le.strong.endAst,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.strong.endUnd=Ce(le.strong.endUnd,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.blockSkip=Ce(le._blockSkip,"g").getRegex(),le.overlapSkip=Ce(le._overlapSkip,"g").getRegex(),le._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,le._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,le._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,le.autolink=Ce(le.autolink).replace("scheme",le._scheme).replace("email",le._email).getRegex(),le._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,le.tag=Ce(le.tag).replace("comment",fe._comment).replace("attribute",le._attribute).getRegex(),le._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,le._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,le._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,le.link=Ce(le.link).replace("label",le._label).replace("href",le._href).replace("title",le._title).getRegex(),le.reflink=Ce(le.reflink).replace("label",le._label).getRegex(),le.reflinkSearch=Ce(le.reflinkSearch,"g").replace("reflink",le.reflink).replace("nolink",le.nolink).getRegex(),le.normal=Se({},le),le.pedantic=Se({},le.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Ce(/^!?\[(label)\]\((.*?)\)/).replace("label",le._label).getRegex(),reflink:Ce(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",le._label).getRegex()}),le.gfm=Se({},le.normal,{escape:Ce(le.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),le.gfm.url=Ce(le.gfm.url,"i").replace("email",le.gfm._extended_email).getRegex(),le.breaks=Se({},le.gfm,{br:Ce(le.br).replace("{2,}","*").getRegex(),text:Ce(le.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var te={block:fe,inline:le},de=K.defaults,se=te.block,Re=te.inline;function Le(Ee){return Ee.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 Te(Ee){var pe="",_e,re,ae=Ee.length;for(_e=0;_e<ae;_e++)re=Ee.charCodeAt(_e),Math.random()>.5&&(re="x"+re.toString(16)),pe+="&#"+re+";";return pe}var Ie=function(){function Ee(_e){this.tokens=[],this.tokens.links=Object.create(null),this.options=_e||de,this.options.tokenizer=this.options.tokenizer||new ve,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var re={block:se.normal,inline:Re.normal};this.options.pedantic?(re.block=se.pedantic,re.inline=Re.pedantic):this.options.gfm&&(re.block=se.gfm,this.options.breaks?re.inline=Re.breaks:re.inline=Re.gfm),this.tokenizer.rules=re}Ee.lex=function(re,ae){var he=new Ee(ae);return he.lex(re)};var pe=Ee.prototype;return pe.lex=function(re){return re=re.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(re,this.tokens,!0),this.inline(this.tokens),this.tokens},pe.blockTokens=function(re,ae,he){ae===void 0&&(ae=[]),he===void 0&&(he=!0),re=re.replace(/^ +$/gm,"");for(var ge,be,De,je;re;){if(ge=this.tokenizer.space(re)){re=re.substring(ge.raw.length),ge.type&&ae.push(ge);continue}if(ge=this.tokenizer.code(re,ae)){re=re.substring(ge.raw.length),ge.type?ae.push(ge):(je=ae[ae.length-1],je.raw+=`
`+ge.raw,je.text+=`
`+ge.text);continue}if(ge=this.tokenizer.fences(re)){re=re.substring(ge.raw.length),ae.push(ge);continue}if(ge=this.tokenizer.heading(re)){re=re.substring(ge.raw.length),ae.push(ge);continue}if(ge=this.tokenizer.nptable(re)){re=re.substring(ge.raw.length),ae.push(ge);continue}if(ge=this.tokenizer.hr(re)){re=re.substring(ge.raw.length),ae.push(ge);continue}if(ge=this.tokenizer.blockquote(re)){re=re.substring(ge.raw.length),ge.tokens=this.blockTokens(ge.text,[],he),ae.push(ge);continue}if(ge=this.tokenizer.list(re)){for(re=re.substring(ge.raw.length),De=ge.items.length,be=0;be<De;be++)ge.items[be].tokens=this.blockTokens(ge.items[be].text,[],!1);ae.push(ge);continue}if(ge=this.tokenizer.html(re)){re=re.substring(ge.raw.length),ae.push(ge);continue}if(he&&(ge=this.tokenizer.def(re))){re=re.substring(ge.raw.length),this.tokens.links[ge.tag]||(this.tokens.links[ge.tag]={href:ge.href,title:ge.title});continue}if(ge=this.tokenizer.table(re)){re=re.substring(ge.raw.length),ae.push(ge);continue}if(ge=this.tokenizer.lheading(re)){re=re.substring(ge.raw.length),ae.push(ge);continue}if(he&&(ge=this.tokenizer.paragraph(re))){re=re.substring(ge.raw.length),ae.push(ge);continue}if(ge=this.tokenizer.text(re,ae)){re=re.substring(ge.raw.length),ge.type?ae.push(ge):(je=ae[ae.length-1],je.raw+=`
`+ge.raw,je.text+=`
`+ge.text);continue}if(re){var lt="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(lt);break}else throw new Error(lt)}}return ae},pe.inline=function(re){var ae,he,ge,be,De,je,lt=re.length;for(ae=0;ae<lt;ae++){je=re[ae];switch(je.type){case"paragraph":case"text":case"heading":{je.tokens=[],this.inlineTokens(je.text,je.tokens);break}case"table":{for(je.tokens={header:[],cells:[]},be=je.header.length,he=0;he<be;he++)je.tokens.header[he]=[],this.inlineTokens(je.header[he],je.tokens.header[he]);for(be=je.cells.length,he=0;he<be;he++)for(De=je.cells[he],je.tokens.cells[he]=[],ge=0;ge<De.length;ge++)je.tokens.cells[he][ge]=[],this.inlineTokens(De[ge],je.tokens.cells[he][ge]);break}case"blockquote":{this.inline(je.tokens);break}case"list":{for(be=je.items.length,he=0;he<be;he++)this.inline(je.items[he].tokens);break}}}return re},pe.inlineTokens=function(re,ae,he,ge,be){ae===void 0&&(ae=[]),he===void 0&&(he=!1),ge===void 0&&(ge=!1),be===void 0&&(be="");var De,je=re,lt;if(this.tokens.links){var mt=Object.keys(this.tokens.links);if(mt.length>0)for(;(lt=this.tokenizer.rules.inline.reflinkSearch.exec(je))!=null;)mt.includes(lt[0].slice(lt[0].lastIndexOf("[")+1,-1))&&(je=je.slice(0,lt.index)+"["+"a".repeat(lt[0].length-2)+"]"+je.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(lt=this.tokenizer.rules.inline.blockSkip.exec(je))!=null;)je=je.slice(0,lt.index)+"["+"a".repeat(lt[0].length-2)+"]"+je.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;re;){if(De=this.tokenizer.escape(re)){re=re.substring(De.raw.length),ae.push(De);continue}if(De=this.tokenizer.tag(re,he,ge)){re=re.substring(De.raw.length),he=De.inLink,ge=De.inRawBlock,ae.push(De);continue}if(De=this.tokenizer.link(re)){re=re.substring(De.raw.length),De.type==="link"&&(De.tokens=this.inlineTokens(De.text,[],!0,ge)),ae.push(De);continue}if(De=this.tokenizer.reflink(re,this.tokens.links)){re=re.substring(De.raw.length),De.type==="link"&&(De.tokens=this.inlineTokens(De.text,[],!0,ge)),ae.push(De);continue}if(De=this.tokenizer.strong(re,je,be)){re=re.substring(De.raw.length),De.tokens=this.inlineTokens(De.text,[],he,ge),ae.push(De);continue}if(De=this.tokenizer.em(re,je,be)){re=re.substring(De.raw.length),De.tokens=this.inlineTokens(De.text,[],he,ge),ae.push(De);continue}if(De=this.tokenizer.codespan(re)){re=re.substring(De.raw.length),ae.push(De);continue}if(De=this.tokenizer.br(re)){re=re.substring(De.raw.length),ae.push(De);continue}if(De=this.tokenizer.del(re)){re=re.substring(De.raw.length),De.tokens=this.inlineTokens(De.text,[],he,ge),ae.push(De);continue}if(De=this.tokenizer.autolink(re,Te)){re=re.substring(De.raw.length),ae.push(De);continue}if(!he&&(De=this.tokenizer.url(re,Te))){re=re.substring(De.raw.length),ae.push(De);continue}if(De=this.tokenizer.inlineText(re,ge,Le)){re=re.substring(De.raw.length),be=De.raw.slice(-1),ae.push(De);continue}if(re){var pt="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(pt);break}else throw new Error(pt)}}return ae},Z(Ee,null,[{key:"rules",get:function(){return{block:se,inline:Re}}}]),Ee}(),Ue=K.defaults,We=j.cleanUrl,Fe=j.escape,Ne=function(){function Ee(_e){this.options=_e||Ue}var pe=Ee.prototype;return pe.code=function(re,ae,he){var ge=(ae||"").match(/\S*/)[0];if(this.options.highlight){var be=this.options.highlight(re,ge);be!=null&&be!==re&&(he=!0,re=be)}return ge?'<pre><code class="'+this.options.langPrefix+Fe(ge,!0)+'">'+(he?re:Fe(re,!0))+`</code></pre>
`:"<pre><code>"+(he?re:Fe(re,!0))+`</code></pre>
`},pe.blockquote=function(re){return`<blockquote>
`+re+`</blockquote>
`},pe.html=function(re){return re},pe.heading=function(re,ae,he,ge){return this.options.headerIds?"<h"+ae+' id="'+this.options.headerPrefix+ge.slug(he)+'">'+re+"</h"+ae+`>
`:"<h"+ae+">"+re+"</h"+ae+`>
`},pe.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},pe.list=function(re,ae,he){var ge=ae?"ol":"ul",be=ae&&he!==1?' start="'+he+'"':"";return"<"+ge+be+`>
`+re+"</"+ge+`>
`},pe.listitem=function(re){return"<li>"+re+`</li>
`},pe.checkbox=function(re){return"<input "+(re?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},pe.paragraph=function(re){return"<p>"+re+`</p>
`},pe.table=function(re,ae){return ae&&(ae="<tbody>"+ae+"</tbody>"),`<table>
<thead>
`+re+`</thead>
`+ae+`</table>
`},pe.tablerow=function(re){return`<tr>
`+re+`</tr>
`},pe.tablecell=function(re,ae){var he=ae.header?"th":"td",ge=ae.align?"<"+he+' align="'+ae.align+'">':"<"+he+">";return ge+re+"</"+he+`>
`},pe.strong=function(re){return"<strong>"+re+"</strong>"},pe.em=function(re){return"<em>"+re+"</em>"},pe.codespan=function(re){return"<code>"+re+"</code>"},pe.br=function(){return this.options.xhtml?"<br/>":"<br>"},pe.del=function(re){return"<del>"+re+"</del>"},pe.link=function(re,ae,he){if(re=We(this.options.sanitize,this.options.baseUrl,re),re===null)return he;var ge='<a href="'+Fe(re)+'"';return ae&&(ge+=' title="'+ae+'"'),ge+=">"+he+"</a>",ge},pe.image=function(re,ae,he){if(re=We(this.options.sanitize,this.options.baseUrl,re),re===null)return he;var ge='<img src="'+re+'" alt="'+he+'"';return ae&&(ge+=' title="'+ae+'"'),ge+=this.options.xhtml?"/>":">",ge},pe.text=function(re){return re},Ee}(),Me=function(){function Ee(){}var pe=Ee.prototype;return pe.strong=function(re){return re},pe.em=function(re){return re},pe.codespan=function(re){return re},pe.del=function(re){return re},pe.html=function(re){return re},pe.text=function(re){return re},pe.link=function(re,ae,he){return""+he},pe.image=function(re,ae,he){return""+he},pe.br=function(){return""},Ee}(),$e=function(){function Ee(){this.seen={}}var pe=Ee.prototype;return pe.slug=function(re){var ae=re.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ae)){var he=ae;do this.seen[he]++,ae=he+"-"+this.seen[he];while(this.seen.hasOwnProperty(ae))}return this.seen[ae]=0,ae},Ee}(),et=K.defaults,Qe=j.unescape,Ze=function(){function Ee(_e){this.options=_e||et,this.options.renderer=this.options.renderer||new Ne,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Me,this.slugger=new $e}Ee.parse=function(re,ae){var he=new Ee(ae);return he.parse(re)};var pe=Ee.prototype;return pe.parse=function(re,ae){ae===void 0&&(ae=!0);var he="",ge,be,De,je,lt,mt,pt,Ot,Rt,ft,It,Bt,ht,ei,Ut,fi,Ve,Xe,Et=re.length;for(ge=0;ge<Et;ge++){ft=re[ge];switch(ft.type){case"space":continue;case"hr":{he+=this.renderer.hr();continue}case"heading":{he+=this.renderer.heading(this.parseInline(ft.tokens),ft.depth,Qe(this.parseInline(ft.tokens,this.textRenderer)),this.slugger);continue}case"code":{he+=this.renderer.code(ft.text,ft.lang,ft.escaped);continue}case"table":{for(Ot="",pt="",je=ft.header.length,be=0;be<je;be++)pt+=this.renderer.tablecell(this.parseInline(ft.tokens.header[be]),{header:!0,align:ft.align[be]});for(Ot+=this.renderer.tablerow(pt),Rt="",je=ft.cells.length,be=0;be<je;be++){for(mt=ft.tokens.cells[be],pt="",lt=mt.length,De=0;De<lt;De++)pt+=this.renderer.tablecell(this.parseInline(mt[De]),{header:!1,align:ft.align[De]});Rt+=this.renderer.tablerow(pt)}he+=this.renderer.table(Ot,Rt);continue}case"blockquote":{Rt=this.parse(ft.tokens),he+=this.renderer.blockquote(Rt);continue}case"list":{for(It=ft.ordered,Bt=ft.start,ht=ft.loose,je=ft.items.length,Rt="",be=0;be<je;be++)Ut=ft.items[be],fi=Ut.checked,Ve=Ut.task,ei="",Ut.task&&(Xe=this.renderer.checkbox(fi),ht?Ut.tokens.length>0&&Ut.tokens[0].type==="text"?(Ut.tokens[0].text=Xe+" "+Ut.tokens[0].text,Ut.tokens[0].tokens&&Ut.tokens[0].tokens.length>0&&Ut.tokens[0].tokens[0].type==="text"&&(Ut.tokens[0].tokens[0].text=Xe+" "+Ut.tokens[0].tokens[0].text)):Ut.tokens.unshift({type:"text",text:Xe}):ei+=Xe),ei+=this.parse(Ut.tokens,ht),Rt+=this.renderer.listitem(ei,Ve,fi);he+=this.renderer.list(Rt,It,Bt);continue}case"html":{he+=this.renderer.html(ft.text);continue}case"paragraph":{he+=this.renderer.paragraph(this.parseInline(ft.tokens));continue}case"text":{for(Rt=ft.tokens?this.parseInline(ft.tokens):ft.text;ge+1<Et&&re[ge+1].type==="text";)ft=re[++ge],Rt+=`
`+(ft.tokens?this.parseInline(ft.tokens):ft.text);he+=ae?this.renderer.paragraph(Rt):Rt;continue}default:{var Dt='Token with "'+ft.type+'" type was not found.';if(this.options.silent){console.error(Dt);return}else throw new Error(Dt)}}}return he},pe.parseInline=function(re,ae){ae=ae||this.renderer;var he="",ge,be,De=re.length;for(ge=0;ge<De;ge++){be=re[ge];switch(be.type){case"escape":{he+=ae.text(be.text);break}case"html":{he+=ae.html(be.text);break}case"link":{he+=ae.link(be.href,be.title,this.parseInline(be.tokens,ae));break}case"image":{he+=ae.image(be.href,be.title,be.text);break}case"strong":{he+=ae.strong(this.parseInline(be.tokens,ae));break}case"em":{he+=ae.em(this.parseInline(be.tokens,ae));break}case"codespan":{he+=ae.codespan(be.text);break}case"br":{he+=ae.br();break}case"del":{he+=ae.del(this.parseInline(be.tokens,ae));break}case"text":{he+=ae.text(be.text);break}default:{var je='Token with "'+be.type+'" type was not found.';if(this.options.silent){console.error(je);return}else throw new Error(je)}}}return he},Ee}(),dt=j.merge,it=j.checkSanitizeDeprecation,at=j.escape,Pe=K.getDefaults,ut=K.changeDefaults,tt=K.defaults;function ke(Ee,pe,_e){if(typeof Ee=="undefined"||Ee===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Ee!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Ee)+", string expected");if(typeof pe=="function"&&(_e=pe,pe=null),pe=dt({},ke.defaults,pe||{}),it(pe),_e){var re=pe.highlight,ae;try{ae=Ie.lex(Ee,pe)}catch(De){return _e(De)}var he=function(je){var lt;if(!je)try{lt=Ze.parse(ae,pe)}catch(mt){je=mt}return pe.highlight=re,je?_e(je):_e(null,lt)};if(!re||re.length<3)return he();if(delete pe.highlight,!ae.length)return he();var ge=0;ke.walkTokens(ae,function(De){De.type==="code"&&(ge++,setTimeout(function(){re(De.text,De.lang,function(je,lt){if(je)return he(je);lt!=null&&lt!==De.text&&(De.text=lt,De.escaped=!0),ge--,ge===0&&he()})},0))}),ge===0&&he();return}try{var be=Ie.lex(Ee,pe);return pe.walkTokens&&ke.walkTokens(be,pe.walkTokens),Ze.parse(be,pe)}catch(De){if(De.message+=`
Please report this to https://github.com/markedjs/marked.`,pe.silent)return"<p>An error occurred:</p><pre>"+at(De.message+"",!0)+"</pre>";throw De}}ke.options=ke.setOptions=function(Ee){return dt(ke.defaults,Ee),ut(ke.defaults),ke},ke.getDefaults=Pe,ke.defaults=tt,ke.use=function(Ee){var pe=dt({},Ee);if(Ee.renderer&&function(){var re=ke.defaults.renderer||new Ne,ae=function(be){var De=re[be];re[be]=function(){for(var je=arguments.length,lt=new Array(je),mt=0;mt<je;mt++)lt[mt]=arguments[mt];var pt=Ee.renderer[be].apply(re,lt);return pt===!1&&(pt=De.apply(re,lt)),pt}};for(var he in Ee.renderer)ae(he);pe.renderer=re}(),Ee.tokenizer&&function(){var re=ke.defaults.tokenizer||new ve,ae=function(be){var De=re[be];re[be]=function(){for(var je=arguments.length,lt=new Array(je),mt=0;mt<je;mt++)lt[mt]=arguments[mt];var pt=Ee.tokenizer[be].apply(re,lt);return pt===!1&&(pt=De.apply(re,lt)),pt}};for(var he in Ee.tokenizer)ae(he);pe.tokenizer=re}(),Ee.walkTokens){var _e=ke.defaults.walkTokens;pe.walkTokens=function(re){Ee.walkTokens(re),_e&&_e(re)}}ke.setOptions(pe)},ke.walkTokens=function(Ee,pe){for(var _e=B(Ee),re;!(re=_e()).done;){var ae=re.value;pe(ae);switch(ae.type){case"table":{for(var he=B(ae.tokens.header),ge;!(ge=he()).done;){var be=ge.value;ke.walkTokens(be,pe)}for(var De=B(ae.tokens.cells),je;!(je=De()).done;)for(var lt=je.value,mt=B(lt),pt;!(pt=mt()).done;){var Ot=pt.value;ke.walkTokens(Ot,pe)}break}case"list":{ke.walkTokens(ae.items,pe);break}default:ae.tokens&&ke.walkTokens(ae.tokens,pe)}}},ke.Parser=Ze,ke.parser=Ze.parse,ke.Renderer=Ne,ke.TextRenderer=Me,ke.Lexer=Ie,ke.lexer=Ie.lex,ke.Tokenizer=ve,ke.Slugger=$e,ke.parse=ke;var Ge=ke;return Ge})},ELLl:function(_t,Je,ne){(function(ue){ue(ne("VrN/"))})(function(ue){var Z={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},P=ue.Pos;ue.defineOption("autoCloseBrackets",!1,function(o,f,l){l&&l!=ue.Init&&(o.removeKeyMap(B),o.state.closeBrackets=null),f&&(U($(f,"pairs")),o.state.closeBrackets=f,o.addKeyMap(B))});function $(o,f){return f=="pairs"&&typeof o=="string"?o:typeof o=="object"&&o[f]!=null?o[f]:Z[f]}var B={Backspace:M,Enter:O};function U(o){for(var f=0;f<o.length;f++){var l=o.charAt(f),r="'"+l+"'";B[r]||(B[r]=K(l))}}U(Z.pairs+"`");function K(o){return function(f){return m(f,o)}}function G(o){var f=o.state.closeBrackets;if(!f||f.override)return f;var l=o.getModeAt(o.getCursor());return l.closeBrackets||f}function M(o){var f=G(o);if(!f||o.getOption("disableInput"))return ue.Pass;for(var l=$(f,"pairs"),r=o.listSelections(),s=0;s<r.length;s++){if(!r[s].empty())return ue.Pass;var c=p(o,r[s].head);if(!c||l.indexOf(c)%2!=0)return ue.Pass}for(var s=r.length-1;s>=0;s--){var L=r[s].head;o.replaceRange("",P(L.line,L.ch-1),P(L.line,L.ch+1),"+delete")}}function O(o){var f=G(o),l=f&&$(f,"explode");if(!l||o.getOption("disableInput"))return ue.Pass;for(var r=o.listSelections(),s=0;s<r.length;s++){if(!r[s].empty())return ue.Pass;var c=p(o,r[s].head);if(!c||l.indexOf(c)%2!=0)return ue.Pass}o.operation(function(){var L=o.lineSeparator()||`
`;o.replaceSelection(L+L,null),o.execCommand("goCharLeft"),r=o.listSelections();for(var w=0;w<r.length;w++){var T=r[w].head.line;o.indentLine(T,null,!0),o.indentLine(T+1,null,!0)}})}function v(o){var f=ue.cmpPos(o.anchor,o.head)>0;return{anchor:new P(o.anchor.line,o.anchor.ch+(f?-1:1)),head:new P(o.head.line,o.head.ch+(f?1:-1))}}function m(o,f){var l=G(o);if(!l||o.getOption("disableInput"))return ue.Pass;var r=$(l,"pairs"),s=r.indexOf(f);if(s==-1)return ue.Pass;for(var c=$(l,"closeBefore"),L=$(l,"triples"),w=r.charAt(s+1)==f,T=o.listSelections(),R=s%2==0,C,S=0;S<T.length;S++){var x=T[S],_=x.head,d,u=o.getRange(_,P(_.line,_.ch+1));if(R&&!x.empty())d="surround";else if((w||!R)&&u==f)w&&h(o,_)?d="both":L.indexOf(f)>=0&&o.getRange(_,P(_.line,_.ch+3))==f+f+f?d="skipThree":d="skip";else if(w&&_.ch>1&&L.indexOf(f)>=0&&o.getRange(P(_.line,_.ch-2),_)==f+f){if(_.ch>2&&/\bstring/.test(o.getTokenTypeAt(P(_.line,_.ch-2))))return ue.Pass;d="addFour"}else if(w){var g=_.ch==0?" ":o.getRange(P(_.line,_.ch-1),_);if(!ue.isWordChar(u)&&g!=f&&!ue.isWordChar(g))d="both";else return ue.Pass}else if(R&&(u.length===0||/\s/.test(u)||c.indexOf(u)>-1))d="both";else return ue.Pass;if(!C)C=d;else if(C!=d)return ue.Pass}var E=s%2?r.charAt(s-1):f,N=s%2?f:r.charAt(s+1);o.operation(function(){if(C=="skip")o.execCommand("goCharRight");else if(C=="skipThree")for(var D=0;D<3;D++)o.execCommand("goCharRight");else if(C=="surround"){for(var H=o.getSelections(),D=0;D<H.length;D++)H[D]=E+H[D]+N;o.replaceSelections(H,"around"),H=o.listSelections().slice();for(var D=0;D<H.length;D++)H[D]=v(H[D]);o.setSelections(H)}else C=="both"?(o.replaceSelection(E+N,null),o.triggerElectric(E+N),o.execCommand("goCharLeft")):C=="addFour"&&(o.replaceSelection(E+E+E+E,"before"),o.execCommand("goCharRight"))})}function p(o,f){var l=o.getRange(P(f.line,f.ch-1),P(f.line,f.ch+1));return l.length==2?l:null}function h(o,f){var l=o.getTokenAt(P(f.line,f.ch+1));return/\bstring/.test(l.type)&&l.start==f.ch&&(f.ch==0||!/\bstring/.test(o.getTokenTypeAt(f)))}})},GfqC:function(_t,Je,ne){"use strict";var ue=ne("q1tI"),Z=ne.n(ue),P=ne("TSYQ"),$=ne.n(P);function B(j,I){var b="cannot "+j.method+" "+j.action+" "+I.status+"'",W=new Error(b);return W.status=I.status,W.method=j.method,W.url=j.action,W}function U(j){var I=j.responseText||j.response;if(!I)return I;try{return JSON.parse(I)}catch(b){return I}}function K(j){var I=new XMLHttpRequest;j.onProgress&&I.upload&&(I.upload.onprogress=function(ie){ie.total>0&&(ie.percent=ie.loaded/ie.total*100),j.onProgress(ie)});var b=new FormData;j.data&&Object.keys(j.data).forEach(function(Y){var ie=j.data[Y];if(Array.isArray(ie)){ie.forEach(function(oe){b.append(Y+"[]",oe)});return}b.append(Y,j.data[Y])}),j.file instanceof Blob?b.append(j.filename,j.file,j.file.name):b.append(j.filename,j.file),I.onerror=function(ie){j.onError(ie)},I.onload=function(){return I.status<200||I.status>=300?j.onError(B(j,I),U(I)):j.onSuccess(U(I),I)},I.open(j.method,j.action,!0),j.withCredentials&&"withCredentials"in I&&(I.withCredentials=!0);var W=j.headers||{};return W["X-Requested-With"]!==null&&I.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(W).forEach(function(Y){W[Y]!==null&&I.setRequestHeader(Y,W[Y])}),I.send(b),{abort:function(){I.abort()}}}var G=+new Date,M=0;function O(){return"rc-upload-"+G+"-"+ ++M}function v(j,I){return j.indexOf(I,j.length-I.length)!==-1}var m=function(j,I){if(j&&I){var b=Array.isArray(I)?I:I.split(","),W=j.name||"",Y=j.type||"",ie=Y.replace(/\/.*$/,"");return b.some(function(oe){var xe=oe.trim();return xe.charAt(0)==="."?v(W.toLowerCase(),xe.toLowerCase()):/\/\*$/.test(xe)?ie===xe.replace(/\/.*$/,""):Y===xe})}return!0};function p(j,I){var b=j.createReader(),W=[];function Y(){b.readEntries(function(ie){var oe=Array.prototype.slice.apply(ie);W=W.concat(oe);var xe=!oe.length;xe?I(W):Y()})}Y()}var h=function(I,b,W){var Y=function ie(oe,xe){xe=xe||"",oe.isFile?oe.file(function(ve){W(ve)&&(oe.fullPath&&!ve.webkitRelativePath&&(Object.defineProperties(ve,{webkitRelativePath:{writable:!0}}),ve.webkitRelativePath=oe.fullPath.replace(/^\//,""),Object.defineProperties(ve,{webkitRelativePath:{writable:!1}})),b([ve]))}):oe.isDirectory&&p(oe,function(ve){ve.forEach(function(we){ie(we,""+xe+oe.name+"/")})})};I.forEach(function(ie){Y(ie.webkitGetAsEntry())})},o=h,f=Object.assign||function(j){for(var I=1;I<arguments.length;I++){var b=arguments[I];for(var W in b)Object.prototype.hasOwnProperty.call(b,W)&&(j[W]=b[W])}return j},l=function(){function j(I,b){var W=[],Y=!0,ie=!1,oe=void 0;try{for(var xe=I[Symbol.iterator](),ve;!(Y=(ve=xe.next()).done)&&!(W.push(ve.value),b&&W.length===b);Y=!0);}catch(we){ie=!0,oe=we}finally{try{!Y&&xe.return&&xe.return()}finally{if(ie)throw oe}}return W}return function(I,b){if(Array.isArray(I))return I;if(Symbol.iterator in Object(I))return j(I,b);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),r=function(){function j(I,b){for(var W=0;W<b.length;W++){var Y=b[W];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(I,Y.key,Y)}}return function(I,b,W){return b&&j(I.prototype,b),W&&j(I,W),I}}();function s(j,I,b){return I in j?Object.defineProperty(j,I,{value:b,enumerable:!0,configurable:!0,writable:!0}):j[I]=b,j}function c(j,I){var b={};for(var W in j){if(I.indexOf(W)>=0)continue;if(!Object.prototype.hasOwnProperty.call(j,W))continue;b[W]=j[W]}return b}function L(j,I){if(!(j instanceof I))throw new TypeError("Cannot call a class as a function")}function w(j,I){if(!j)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:j}function T(j,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);j.prototype=Object.create(I&&I.prototype,{constructor:{value:j,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(j,I):j.__proto__=I)}var R=function(I){return Object.keys(I).reduce(function(b,W){return(W.substr(0,5)==="data-"||W.substr(0,5)==="aria-"||W==="role")&&(b[W]=I[W]),b},{})},C=function(j){T(I,j);function I(){var b,W,Y,ie;L(this,I);for(var oe=arguments.length,xe=Array(oe),ve=0;ve<oe;ve++)xe[ve]=arguments[ve];return ie=(W=(Y=w(this,(b=I.__proto__||Object.getPrototypeOf(I)).call.apply(b,[this].concat(xe))),Y),Y.state={uid:O()},Y.reqs={},Y.onChange=function(we){var Ce=we.target.files;Y.uploadFiles(Ce),Y.reset()},Y.onClick=function(we){var Ce=Y.fileInput;if(!Ce)return;var Se=Y.props,fe=Se.children,le=Se.onClick;fe&&fe.type==="button"&&(Ce.parentNode.focus(),Ce.parentNode.querySelector("button").blur()),Ce.click(),le&&le(we)},Y.onKeyDown=function(we){we.key==="Enter"&&Y.onClick()},Y.onFileDrop=function(we){var Ce=Y.props.multiple;if(we.preventDefault(),we.type==="dragover")return;if(Y.props.directory)o(Array.prototype.slice.call(we.dataTransfer.items),Y.uploadFiles,function(fe){return m(fe,Y.props.accept)});else{var Se=Array.prototype.slice.call(we.dataTransfer.files).filter(function(fe){return m(fe,Y.props.accept)});Ce===!1&&(Se=Se.slice(0,1)),Y.uploadFiles(Se)}},Y.uploadFiles=function(we){var Ce=Array.prototype.slice.call(we);Ce.map(function(Se){return Se.uid=O(),Se}).forEach(function(Se){Y.upload(Se,Ce)})},Y.saveFileInput=function(we){Y.fileInput=we},W),w(Y,ie)}return r(I,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(W,Y){var ie=this,oe=this.props;if(!oe.beforeUpload)return setTimeout(function(){return ie.post(W)},0);var xe=oe.beforeUpload(W,Y);xe&&xe.then?xe.then(function(ve){var we=Object.prototype.toString.call(ve);return we==="[object File]"||we==="[object Blob]"?ie.post(ve):ie.post(W)}).catch(function(ve){console.log(ve)}):xe!==!1&&setTimeout(function(){return ie.post(W)},0);return}},{key:"post",value:function(W){var Y=this;if(!this._isMounted)return;var ie=this.props,oe=ie.onStart,xe=ie.onProgress,ve=ie.transformFile,we=ve===void 0?function(Ce){return Ce}:ve;new Promise(function(Ce){var Se=ie.action;return typeof Se=="function"&&(Se=Se(W)),Ce(Se)}).then(function(Ce){var Se=W.uid,fe=ie.customRequest||K,le=Promise.resolve(we(W)).then(function(te){var de=ie.data;return typeof de=="function"&&(de=de(te)),Promise.all([te,de])}).catch(function(te){console.error(te)});le.then(function(te){var de=l(te,2),se=de[0],Re=de[1],Le={action:Ce,filename:ie.name,data:Re,file:se,headers:ie.headers,withCredentials:ie.withCredentials,method:ie.method||"post",onProgress:xe?function(Te){xe(Te,W)}:null,onSuccess:function(Ie,Ue){delete Y.reqs[Se],ie.onSuccess(Ie,W,Ue)},onError:function(Ie,Ue){delete Y.reqs[Se],ie.onError(Ie,Ue,W)}};oe(W),Y.reqs[Se]=fe(Le)})})}},{key:"reset",value:function(){this.setState({uid:O()})}},{key:"abort",value:function(W){var Y=this.reqs;if(W){var ie=W;W&&W.uid&&(ie=W.uid),Y[ie]&&Y[ie].abort&&Y[ie].abort(),delete Y[ie]}else Object.keys(Y).forEach(function(oe){Y[oe]&&Y[oe].abort&&Y[oe].abort(),delete Y[oe]})}},{key:"render",value:function(){var W,Y=this.props,ie=Y.component,oe=Y.prefixCls,xe=Y.className,ve=Y.disabled,we=Y.id,Ce=Y.style,Se=Y.multiple,fe=Y.accept,le=Y.children,te=Y.directory,de=Y.openFileDialogOnClick,se=Y.onMouseEnter,Re=Y.onMouseLeave,Le=c(Y,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),Te=$()((W={},s(W,oe,!0),s(W,oe+"-disabled",ve),s(W,xe,xe),W)),Ie=ve?{}:{onClick:de?this.onClick:function(){},onKeyDown:de?this.onKeyDown:function(){},onMouseEnter:se,onMouseLeave:Re,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return Z.a.createElement(ie,f({},Ie,{className:Te,role:"button",style:Ce}),Z.a.createElement("input",f({},R(Le),{id:we,type:"file",ref:this.saveFileInput,onClick:function(We){return We.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:fe,directory:te?"directory":null,webkitdirectory:te?"webkitdirectory":null,multiple:Se,onChange:this.onChange})),le)}}]),I}(ue.Component),S=C,x=Object.assign||function(j){for(var I=1;I<arguments.length;I++){var b=arguments[I];for(var W in b)Object.prototype.hasOwnProperty.call(b,W)&&(j[W]=b[W])}return j},_=function(){function j(I,b){for(var W=0;W<b.length;W++){var Y=b[W];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(I,Y.key,Y)}}return function(I,b,W){return b&&j(I.prototype,b),W&&j(I,W),I}}();function d(j,I){if(!(j instanceof I))throw new TypeError("Cannot call a class as a function")}function u(j,I){if(!j)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:j}function g(j,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);j.prototype=Object.create(I&&I.prototype,{constructor:{value:j,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(j,I):j.__proto__=I)}function E(){}var N=function(j){g(I,j);function I(){var b,W,Y,ie;d(this,I);for(var oe=arguments.length,xe=Array(oe),ve=0;ve<oe;ve++)xe[ve]=arguments[ve];return ie=(W=(Y=u(this,(b=I.__proto__||Object.getPrototypeOf(I)).call.apply(b,[this].concat(xe))),Y),Y.saveUploader=function(we){Y.uploader=we},W),u(Y,ie)}return _(I,[{key:"abort",value:function(W){this.uploader.abort(W)}},{key:"render",value:function(){return Z.a.createElement(S,x({},this.props,{ref:this.saveUploader}))}}]),I}(ue.Component);N.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:E,onError:E,onSuccess:E,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var D=N,H=Je.a=D},HmJG:function(_t,Je,ne){},LdHM:function(_t,Je,ne){"use strict";ne.d(Je,"b",function(){return c}),ne.d(Je,"a",function(){return w});var ue=ne("1OyB"),Z=ne("vuIU"),P=ne("Ji7U"),$=ne("LK+K"),B=ne("q1tI"),U=ne("rePB"),K=ne("Ff2n"),G=ne("ODXe"),M=ne("4IlW"),O=ne("bX4T"),v=ne("YrtM"),m=ne("TSYQ"),p=ne.n(m),h=ne("+nKL"),o=ne("8OUc"),f=function(W,Y){var ie=W.prefixCls,oe=W.id,xe=W.flattenOptions,ve=W.childrenAsData,we=W.values,Ce=W.searchValue,Se=W.multiple,fe=W.defaultActiveFirstOption,le=W.height,te=W.itemHeight,de=W.notFoundContent,se=W.open,Re=W.menuItemSelectedIcon,Le=W.virtual,Te=W.onSelect,Ie=W.onToggleOpen,Ue=W.onActiveValue,We=W.onScroll,Fe=W.onMouseEnter,Ne="".concat(ie,"-item"),Me=Object(v.a)(function(){return xe},[se,xe],function(Ge,Ee){return Ee[0]&&Ge[1]!==Ee[1]}),$e=B.useRef(null),et=function(Ee){Ee.preventDefault()},Qe=function(Ee){$e.current&&$e.current.scrollTo({index:Ee})},Ze=function(Ee){for(var pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,_e=Me.length,re=0;re<_e;re+=1){var ae=(Ee+re*pe+_e)%_e,he=Me[ae],ge=he.group,be=he.data;if(!ge&&!be.disabled)return ae}return-1},dt=B.useState(function(){return Ze(0)}),it=Object(G.a)(dt,2),at=it[0],Pe=it[1],ut=function(Ee){Pe(Ee);var pe=Me[Ee];if(!pe){Ue(null,-1);return}Ue(pe.data.value,Ee)};B.useEffect(function(){ut(fe!==!1?Ze(0):-1)},[Me.length,Ce]),B.useEffect(function(){var Ge=setTimeout(function(){if(!Se&&se&&we.size===1){var Ee=Array.from(we)[0],pe=Me.findIndex(function(_e){var re=_e.data;return re.value===Ee});ut(pe),Qe(pe)}});return function(){return clearTimeout(Ge)}},[se]);var tt=function(Ee){Ee!==void 0&&Te(Ee,{selected:!we.has(Ee)}),Se||Ie(!1)};if(B.useImperativeHandle(Y,function(){return{onKeyDown:function(Ee){var pe=Ee.which;switch(pe){case M.a.UP:case M.a.DOWN:{var _e=0;if(pe===M.a.UP?_e=-1:pe===M.a.DOWN&&(_e=1),_e!==0){var re=Ze(at+_e,_e);Qe(re),ut(re)}break}case M.a.ENTER:{var ae=Me[at];ae&&!ae.data.disabled?tt(ae.data.value):tt(void 0),se&&Ee.preventDefault();break}case M.a.ESC:Ie(!1)}},onKeyUp:function(){},scrollTo:function(Ee){Qe(Ee)}}}),Me.length===0)return B.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),className:"".concat(Ne,"-empty"),onMouseDown:et},de);function ke(Ge){var Ee=Me[Ge];if(!Ee)return null;var pe=Ee.data||{},_e=pe.value,re=pe.label,ae=pe.children,he=Object(O.a)(pe,!0),ge=ve?ae:re;return Ee?B.createElement("div",Object.assign({"aria-label":typeof ge=="string"?ge:null},he,{key:Ge,role:"option",id:"".concat(oe,"_list_").concat(Ge),"aria-selected":we.has(_e)}),_e):null}return B.createElement(B.Fragment,null,B.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),style:{height:0,width:0,overflow:"hidden"}},ke(at-1),ke(at),ke(at+1)),B.createElement(h.a,{itemKey:"key",ref:$e,data:Me,height:le,itemHeight:te,fullHeight:!1,onMouseDown:et,onScroll:We,virtual:Le,onMouseEnter:Fe},function(Ge,Ee){var pe,_e=Ge.group,re=Ge.groupOption,ae=Ge.data,he=ae.label,ge=ae.key;if(_e)return B.createElement("div",{className:p()(Ne,"".concat(Ne,"-group"))},he!==void 0?he:ge);var be=ae.disabled,De=ae.value,je=ae.title,lt=ae.children,mt=ae.style,pt=ae.className,Ot=Object(K.a)(ae,["disabled","value","title","children","style","className"]),Rt=we.has(De),ft="".concat(Ne,"-option"),It=p()(Ne,ft,pt,(pe={},Object(U.a)(pe,"".concat(ft,"-grouped"),re),Object(U.a)(pe,"".concat(ft,"-active"),at===Ee&&!be),Object(U.a)(pe,"".concat(ft,"-disabled"),be),Object(U.a)(pe,"".concat(ft,"-selected"),Rt),pe)),Bt=ve?lt:he,ht=!Re||typeof Re=="function"||Rt;return B.createElement("div",Object.assign({},Ot,{"aria-selected":Rt,className:It,title:je,onMouseMove:function(){if(at===Ee||be)return;ut(Ee)},onClick:function(){be||tt(De)},style:mt}),B.createElement("div",{className:"".concat(ft,"-content")},Bt||De),B.isValidElement(Re)||Rt,ht&&B.createElement(o.a,{className:"".concat(Ne,"-option-state"),customizeIcon:Re,customizeIconProps:{isSelected:Rt}},Rt?"\u2713":null))}))},l=B.forwardRef(f);l.displayName="OptionList";var r=l,s=function(){return null};s.isSelectOption=!0;var c=s,L=function(){return null};L.isSelectOptGroup=!0;var w=L,T=ne("VTBJ"),R=ne("Zm9Q");function C(b){var W=b.key,Y=b.props,ie=Y.children,oe=Y.value,xe=Object(K.a)(Y,["children","value"]);return Object(T.a)({key:W,value:oe!==void 0?oe:W,children:ie},xe)}function S(b){var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(R.a)(b).map(function(Y,ie){if(!B.isValidElement(Y)||!Y.type)return null;var oe=Y.type.isSelectOptGroup,xe=Y.key,ve=Y.props,we=ve.children,Ce=Object(K.a)(ve,["children"]);return W||!oe?C(Y):Object(T.a)(Object(T.a)({key:"__RC_SELECT_GRP__".concat(xe===null?ie:xe,"__"),label:xe},Ce),{},{options:S(we)})}).filter(function(Y){return Y})}var x=ne("2Qr1"),_=ne("qNPg"),d=ne("U8pU"),u=ne("Kwbf"),g=ne("WKfj");function E(b){var W=b.mode,Y=b.options,ie=b.children,oe=b.backfill,xe=b.allowClear,ve=b.placeholder,we=b.getInputElement,Ce=b.showSearch,Se=b.onSearch,fe=b.defaultOpen,le=b.autoFocus,te=b.labelInValue,de=b.value,se=b.inputValue,Re=b.optionLabelProp,Le=W==="multiple"||W==="tags",Te=Ce!==void 0?Ce:Le||W==="combobox",Ie=Y||S(ie);if(Object(u.a)(W!=="tags"||Ie.every(function(Ne){return!Ne.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),W==="tags"||W==="combobox"){var Ue=Ie.some(function(Ne){return Ne.options?Ne.options.some(function(Me){return typeof("value"in Me?Me.value:Me.key)=="number"}):typeof("value"in Ne?Ne.value:Ne.key)=="number"});Object(u.a)(!Ue,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(u.a)(W!=="combobox"||!Re,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(u.a)(W==="combobox"||!oe,"`backfill` only works with `combobox` mode."),Object(u.a)(W==="combobox"||!we,"`getInputElement` only work with `combobox` mode."),Object(u.b)(W!=="combobox"||!we||!xe||!ve,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Se&&!Te&&W!=="combobox"&&W!=="tags"&&Object(u.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(u.b)(!fe||le,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),de!=null){var We=Object(g.d)(de);Object(u.a)(!te||We.every(function(Ne){return Object(d.a)(Ne)==="object"&&("key"in Ne||"value"in Ne)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(u.a)(!Le||Array.isArray(de),"`value` should be array when `mode` is `multiple` or `tags`")}if(ie){var Fe=null;Object(R.a)(ie).some(function(Ne){if(!B.isValidElement(Ne)||!Ne.type)return!1;var Me=Ne.type;if(Me.isSelectOption)return!1;if(Me.isSelectOptGroup){var $e=Object(R.a)(Ne.props.children).every(function(et){return!B.isValidElement(et)||!Ne.type||et.type.isSelectOption?!0:(Fe=et.type,!1)});return!$e}return Fe=Me,!0}),Fe&&Object(u.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Fe.displayName||Fe.name||Fe,"`.")),Object(u.a)(se===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var N=E,D=Object(_.a)({prefixCls:"rc-select",components:{optionList:r},convertChildrenToData:S,flattenOptions:x.d,getLabeledValue:x.e,filterOptions:x.b,isValueDisabled:x.g,findValueOption:x.c,warningProps:N,fillOptionsWithMissingValue:x.a}),H=function(b){Object(P.a)(Y,b);var W=Object($.a)(Y);function Y(){var ie;return Object(ue.a)(this,Y),ie=W.apply(this,arguments),ie.selectRef=B.createRef(),ie.focus=function(){ie.selectRef.current.focus()},ie.blur=function(){ie.selectRef.current.blur()},ie}return Object(Z.a)(Y,[{key:"render",value:function(){return B.createElement(D,Object.assign({ref:this.selectRef},this.props))}}]),Y}(B.Component);H.Option=c,H.OptGroup=w;var j=H,I=Je.c=j},M8RZ:function(_t,Je,ne){"use strict";ne.d(Je,"a",function(){return M});var ue=ne("fWQN"),Z=ne("mtLc"),P=ne("yKVA"),$=ne("879j"),B=ne("q1tI"),U=ne.n(B),K=ne("i8i4"),G=ne.n(K),M=function(O){Object(P.a)(m,O);var v=Object($.a)(m);function m(p){var h;Object(ue.a)(this,m),h=v.call(this,p);var o=window.document;return h.node=o.createElement("div"),o.body.appendChild(h.node),h}return Object(Z.a)(m,[{key:"render",value:function(){var h=this.props.children;return Object(K.createPortal)(h,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),m}(U.a.Component)},Ot1p:function(_t,Je,ne){"use strict";var ue=ne("2qtc"),Z=ne("kLXV"),P=ne("rAM+"),$=ne("miYZ"),B=ne("tsqr"),U=ne("9og8"),K=ne("tJVT"),G=ne("jrin"),M=ne("WmNS"),O=ne.n(M),v=ne("q1tI"),m=ne.n(v),p=ne("VrN/"),h=ne.n(p),o=ne("bdgK"),f=ne("p77/"),l=ne("Bd2K"),r=ne("ELLl"),s=ne("19Vz"),c=ne("lZu9"),L=ne("+NIl"),w=ne("kSUc"),T=ne("9Bee"),R=function(be){var De=be.value,je=De===void 0?"":De,lt=be.className,mt=be.showTextOnly,pt=be.showLines,Ot=be.style,Rt=Ot===void 0?{}:Ot,ft=Object(v.useMemo)(function(){return""},[je]);return m.a.createElement(m.a.Fragment,null,m.a.createElement("div",{dangerouslySetInnerHTML:{__html:ft}}))},C=ne("0Owb"),S=ne("dejd"),x=ne("C+DQ"),_=ne("1vsH"),d=ne("m3rI"),u=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function g(be){var De=be.onActionCallback,je=be.title,lt=be.icon,mt=be.actionName,pt=be.className,Ot=pt===void 0?"":pt,Rt=be.children;function ft(){De(mt)}return m.a.createElement("a",{title:je,className:Ot,onClick:ft},m.a.createElement("i",{className:"md-iconfont ".concat(lt)}),Rt)}var E=function(be){var De=be.watch,je=be.showNullButton,lt=be.onActionCallback,mt=be.fullScreen,pt=be.insertTemp,Ot=be.hidetoolBar,Rt=be.uuid,ft=be.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(_.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(_.F)("_educoder_session"),"&key=").concat(Rt,"&api=").concat(encodeURIComponent(d.a.PROXY_SERVER)));var It=[].concat(u,[{title:"".concat(De?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(De?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return m.a.createElement("ul",{className:"markdown-toolbar-container"},!Ot&&It.map(function(Bt,ht){return m.a.createElement("li",{key:ht},Bt.actionName?m.a.createElement(g,Object(C.a)({},Bt,{onActionCallback:lt})):m.a.createElement("span",{className:"v-line"}))}),je?m.a.createElement("li",null,m.a.createElement(g,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:lt},m.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,pt&&m.a.createElement("li",null,m.a.createElement(g,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(pt),onActionCallback:lt},m.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),m.a.createElement("li",{className:"btn-full-screen"},m.a.createElement(g,{icon:"".concat(mt?"icon-shrink":"icon-enlarge"),title:mt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:lt})))},N=ne("M8RZ"),D=ne("+L6B"),H=ne("2/Rp"),j=ne("y8nQ"),I=ne("Vl3Y"),b=ne("5NDa"),W=ne("5rEg"),Y={labelCol:{span:4},wrapperCol:{span:20}},ie=function(be){var De=be.callback,je=be.onCancel;function lt(mt){De(mt)}return m.a.createElement(I.a,Object(C.a)({},Y,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:lt}),m.a.createElement(I.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},m.a.createElement(W.a,null)),m.a.createElement(I.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},m.a.createElement(W.a,null)),m.a.createElement("div",{className:"flex-container flex-end"},m.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),m.a.createElement(H.a,{type:"ghost",onClick:je},"\u53D6\u6D88")))},oe=ne("7ahc"),xe=ne("HmJG"),ve=ne("BjJ7"),we=I.a.useForm,Ce={width:280,marginRight:10},Se={labelCol:{span:5},wrapperCol:{span:19}},fe=function(be){var De=be.callback,je=be.onCancel,lt=we(),mt=Object(K.a)(lt,1),pt=mt[0];function Ot(It){De(It)}function Rt(It,Bt){if(It.status===-1){B.b.error(It.message);return}pt.setFieldsValue({src:"/api/attachments/".concat(It.id),type:Bt.type})}function ft(It){var Bt=It.target.files[0];te(Bt,Rt)}return m.a.createElement(I.a,Object(C.a)({form:pt},Se,{className:"upload-image-panel",onFinish:Ot}),m.a.createElement(I.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},m.a.createElement("div",{className:"flex-container"},m.a.createElement(I.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},m.a.createElement(W.a,{style:Ce})),m.a.createElement(le,{onFileChange:ft}))),m.a.createElement(I.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},m.a.createElement(W.a,{style:{width:264}})),m.a.createElement(I.a.Item,{style:{textAlign:"right"}},m.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),m.a.createElement(H.a,{type:"ghost",onClick:je},"\u53D6\u6D88")))};function le(be){var De=be.onFileChange;return m.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",m.a.createElement("input",{type:"file",onChange:De}))}function te(be,De){if(!be)throw new String("\u6CA1\u6709\u6587\u4EF6");var je=new FormData;je.append("editormd-image-file",be),je.append("file_param_name","editormd-image-file"),je.append("byxhr","true");var lt=new window.XMLHttpRequest;lt.withCredentials=!0,lt.addEventListener("load",function(mt){De(JSON.parse(mt.target.responseText),be)},!1),lt.addEventListener("error",function(mt){console.error(mt)},!1),lt.open("POST","".concat(ve.a,"/api/attachments.json")),lt.send(je)}var de=ne("giR+"),se=ne("fyUT"),Re=ne("7Kak"),Le=ne("9yH6"),Te=Le.a.Group,Ie={margin:"0 8px"},Ue=function(be){var De=be.callback,je=be.onCancel;function lt(mt){De(mt)}return m.a.createElement(I.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:lt},m.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},m.a.createElement("span",{style:Ie},"\u5355\u5143\u683C\u6570\uFF1A"),m.a.createElement("span",{style:Ie},"\u884C\u6570"),m.a.createElement(I.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},m.a.createElement(se.a,null)),m.a.createElement("span",{style:Ie},"\u5217\u6570"),m.a.createElement(I.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},m.a.createElement(se.a,null))),m.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},m.a.createElement("span",{style:Ie},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),m.a.createElement(I.a.Item,{name:"align"},m.a.createElement(Te,null,m.a.createElement(Le.a,{value:"default"},m.a.createElement("i",{className:"fa fa-align-justify"})),m.a.createElement(Le.a,{value:"left"},m.a.createElement("i",{className:"fa fa-align-left"})),m.a.createElement(Le.a,{value:"center"},m.a.createElement("i",{className:"fa fa-align-center"})),m.a.createElement(Le.a,{value:"right"},m.a.createElement("i",{className:"fa fa-align-right"}))))),m.a.createElement("div",{className:"flex-container flex-end"},m.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),m.a.createElement(H.a,{type:"ghost",onClick:je},"\u53D6\u6D88")))},We=ne("ErOA"),Fe=ne("7Cbv"),Ne="link",Me="upload-image",$e="code-block",et="add-table",Qe="------------",Ze={default:Qe,left:":".concat(Qe),center:":".concat(Qe,":"),right:"".concat(Qe,":")},dt=ne("9VGf"),it,at;function Pe(){}var ut=0,tt=1e4,ke="\u2581",Ge=`
**\u6A21\u677F\u6807\u9898**
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function Ee(be){return/^\d+$/.test(be)?"".concat(be,"px"):be}var pe=navigator.platform.toUpperCase().indexOf("MAC")>=0,_e=pe?"Cmd":"Ctrl",re=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],ae=(it={},Object(G.a)(it,_e+"-B","bold"),Object(G.a)(it,_e+"-I","italic"),it),he=(at={},Object(G.a)(at,Ne,"\u6DFB\u52A0\u94FE\u63A5"),Object(G.a)(at,$e,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(G.a)(at,Me,"\u6DFB\u52A0\u6587\u4EF6"),Object(G.a)(at,et,"\u6DFB\u52A0\u8868\u683C"),at),ge=Je.a=function(be){var De=be.defaultValue,je=De===void 0?"":De,lt=be.onChange,mt=be.width,pt=mt===void 0?"100%":mt,Ot=be.height,Rt=Ot===void 0?400:Ot,ft=be.miniToolbar,It=ft===void 0?!1:ft,Bt=be.isFocus,ht=Bt===void 0?!1:Bt,ei=be.watch,Ut=be.insertTemp,fi=be.mode,Ve=fi===void 0?"markdown":fi,Xe=be.id,Et=Xe===void 0?"markdown-editor-id":Xe,Dt=be.showResizeBar,Pt=Dt===void 0?!1:Dt,si=be.noStorage,an=si===void 0?!1:si,sn=be.showNullButton,zt=sn===void 0?!1:sn,vt=be.hidetoolBar,ji=vt===void 0?!1:vt,nn=be.fullScreen,Ei=nn===void 0?!1:nn,Mt=be.onBlur,Hi=be.onCMBeforeChange,Ri=be.onFullScreen,pn=be.className,Ye=pn===void 0?"":pn,Ct=be.disablePaste,mn=Ct===void 0?!1:Ct,gn=be.placeholder,vn=gn===void 0?"":gn,Zi=be.values,X=Zi===void 0?"":Zi,y=Object(v.useState)(null),A=Object(K.a)(y,2),F=A[0],q=A[1],V=Object(v.useState)(je),me=Object(K.a)(V,2),He=me[0],nt=me[1],yt=Object(v.useState)(ei),ze=Object(K.a)(yt,2),xt=ze[0],Kt=ze[1],ti=Object(v.useState)(Ei),ki=Object(K.a)(ti,2),xi=ki[0],ui=ki[1],Qi=Object(v.useState)(""),on=Object(K.a)(Qi,2),pi=on[0],Ni=on[1],ln=Object(v.useState)(0),qi=Object(K.a)(ln,2),rt=qi[0],kt=qi[1],Jt=Object(v.useState)(Rt),wt=Object(K.a)(Jt,2),$t=wt[0],Vt=wt[1],jt=Object(v.useState)(!1),Zt=Object(K.a)(jt,2),un=Zt[0],yi=Zt[1],oi=Object(v.useRef)(Object(Fe.a)()),Yt=Object(v.useRef)(!1),Oi=Object(v.useRef)(),Ht=Object(v.useRef)(),mi=Object(v.useRef)(),ii=Object(v.useRef)(),yn=Object(v.useRef)(),Ti=function(){var bt=Object(U.a)(O.a.mark(function Lt(){var St,Ft;return O.a.wrap(function(ri){for(;;)switch(ri.prev=ri.next){case 0:return ri.next=2,Object(We.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:oi.current}});case 2:Ft=ri.sent,Ft!=null&&(St=Ft.attachments)!==null&&St!==void 0&&St.length&&(console.log("cm:",F,Ht),Ft.attachments.map(function(Gt){Gt.content_type.indexOf("image")>-1?F.replaceSelection("![,](/api/attachments/".concat(Gt.id,"?type=").concat(Gt.content_type,")")):Gt.content_type.indexOf("video")>-1?F.replaceSelection('<video width="100%" controls src="'.concat(d.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Gt.content_type.indexOf("pdf")>-1?F.replaceSelection('<a href="'.concat(d.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Gt.content_type,'&disposition=inline" target="_blank">').concat(Gt.name,"</a>")):F.replaceSelection("[".concat(Gt.name,"](").concat(d.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Gt.content_type,")"))}));case 4:case"end":return ri.stop()}},Lt)}));return function(){return bt.apply(this,arguments)}}();Object(v.useEffect)(function(){nt(X),F==null||F.setValue(X)},[X]),Object(v.useEffect)(function(){Ri==null||Ri(xi)},[xi]),Object(v.useEffect)(function(){if(Ht.current){var bt=h.a.fromTextArea(Ht.current,{mode:Ve,lineNumbers:!It,lineWrapping:!0,value:je,autoCloseTags:!0,autoCloseBrackets:!0});ht&&bt.focus();function Lt(St,Ft){if(mn){Ft.preventDefault();return}var Xt=Ft.clipboardData;if(Xt){var ri=Xt.types.toString(),Gt=Xt.items;if(ri==="Files"||Xt.types.indexOf("Files")>-1){if(Ft.preventDefault(),Ve=="stex")return;try{var _i,Wi=Gt[1];((_i=Gt[0])===null||_i===void 0?void 0:_i.kind)==="file"&&(Wi=Gt[0]);var Wt=Wi.getAsFile(),Tn=Wt.name.split(".").pop();te(Wt,function(Qt){if(Qt.id){var Gi,Di,rn;(Wt==null||((Gi=Wt.type)===null||Gi===void 0)?void 0:Gi.indexOf("image"))>-1?bt.replaceSelection("![,](/api/attachments/".concat(Qt.id,"?type=").concat(Qt.content_type,")")):(Wt==null||((Di=Wt.type)===null||Di===void 0)?void 0:Di.indexOf("video"))>-1?bt.replaceSelection('<video width="100%" controls src="'.concat(d.a.API_SERVER,"/api/attachments/").concat(Qt.id,'"></video>')):(Wt==null||((rn=Wt.type)===null||rn===void 0)?void 0:rn.indexOf("pdf"))>-1?bt.replaceSelection('<a href="'.concat(d.a.API_SERVER,"/api/attachments/").concat(Qt.id,"?type=").concat(Wt.type,'&disposition=inline" target="_blank">').concat(Wt.name,"</a>")):re.includes(Tn)?bt.replaceSelection('<a href="'.concat(d.a.API_SERVER,"/api/attachments/").concat(Qt.id,'?type=office&disposition=inline" target="_blank">').concat(Wt.name,"</a>")):bt.replaceSelection("[".concat(Wt.name,"](").concat(d.a.API_SERVER,"/api/attachments/").concat(Qt.id,"?type=").concat(Qt.content_type,")"))}else(Qt==null?void 0:Qt.status)===401&&(document.location.href="/user/login")})}catch(Qt){B.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return bt.on("paste",Lt),bt.on("dragleave",function(St,Ft){mi.current.classList.remove("mouse-hover-md")}),bt.on("dragover",function(St,Ft){mi.current.classList.add("mouse-hover-md")}),bt.on("drop",function(St,Ft){mi.current.classList.add("mouse-hover-md");var Xt;if(Xt=Ft.dataTransfer.files,Xt.length>0){Ft.preventDefault(),Ft.stopPropagation();for(var ri=function(Wi){var Wt=Xt[Wi],Tn=Wt.name.split(".").pop();te(Wt,function(Qt){if(Qt.id){var Gi,Di,rn;(Wt==null||((Gi=Wt.type)===null||Gi===void 0)?void 0:Gi.indexOf("image"))>-1?bt.replaceSelection("![,](/api/attachments/".concat(Qt.id,"?type=").concat(Qt.content_type,")")):(Wt==null||((Di=Wt.type)===null||Di===void 0)?void 0:Di.indexOf("video"))>-1?bt.replaceSelection('<video width="100%" controls src="'.concat(d.a.API_SERVER,"/api/attachments/").concat(Qt.id,'"></video>')):(Wt==null||((rn=Wt.type)===null||rn===void 0)?void 0:rn.indexOf("pdf"))>-1?bt.replaceSelection('<a href="'.concat(d.a.API_SERVER,"/api/attachments/").concat(Qt.id,"?type=").concat(Wt.type,'&disposition=inline" target="_blank">').concat(Wt.name,"</a>")):re.includes(Tn)?bt.replaceSelection('<a href="'.concat(d.a.API_SERVER,"/api/attachments/").concat(Qt.id,'?type=office&disposition=inline" target="_blank">').concat(Wt.name,"</a>")):bt.replaceSelection("[".concat(Wt.name,"](").concat(d.a.API_SERVER,"/api/attachments/").concat(Qt.id,"?type=").concat(Qt.content_type,")"))}else(Qt==null?void 0:Qt.status)===401&&(document.location.href="/user/login")})},Gt=0;Gt<Xt.length;Gt++)ri(Gt)}}),q(bt),function(){bt.off("paste",Lt)}}},[]);var Ui=Object(v.useCallback)(function(){if(mi.current)try{}catch(bt){console.log(bt,"---- to set md editor body height")}},[$t,mi,xi]);Object(v.useEffect)(function(){function bt(){var St=new o.default(function(Ft){var Xt=Object(P.a)(Ft),ri;try{for(Xt.s();!(ri=Xt.n()).done;){var Gt=ri.value;(Gt.target.offsetHeight>0||Gt.target.offsetWidth>0)&&(Ui(),F.setSize("100%","100%"),F.refresh())}}catch(_i){Xt.e(_i)}finally{Xt.f()}});return St.observe(Ht.current.parentElement),St}if(F){var Lt=bt();return function(){Lt.unobserve(Ht.current.parentElement)}}},[F,Ui]),Object(v.useEffect)(function(){if(F){for(var bt=[],Lt=function(){var Gt=Ft[St];Xt=Object(K.a)(Gt,2);var _i=Xt[0],Wi=Xt[1],Wt=Object(G.a)({},_i,function(){Yn(Wi)});bt.push(Wt),F.addKeyMap(Wt)},St=0,Ft=Object.entries(ae);St<Ft.length;St++){var Xt;Lt()}return Oi.current=setInterval(function(){Yt.current&&Ti()},4e3),function(){clearInterval(Oi.current);var ri=Object(P.a)(bt),Gt;try{for(ri.s();!(Gt=ri.n()).done;){var _i=Gt.value;F.removeKeyMap(_i)}}catch(Wi){ri.e(Wi)}finally{ri.f()}}}},[F]),Object(v.useEffect)(function(){Ei!==xi&&ui(Ei)},[Ei]),Object(dt.a)(function(){if(!an&&rt>0){var bt=new Date().getTime(),Lt=window.sessionStorage.getItem(Et);bt>=rt+tt&&(!Lt||Lt!==He)&&(window.sessionStorage.setItem(Et,He),yi(!0))}},tt),Object(v.useEffect)(function(){Kt(ei)},[F,ei]),Object(v.useEffect)(function(){F&&(ht&&F.focus())},[F,ht]),Object(v.useEffect)(function(){if(xt&&F){var bt=F.getScrollerElement();function Lt(St){var Ft=St.target;if(yn.current){var Xt=Ft.scrollTop/Ft.scrollHeight;yn.current.scrollTop=yn.current.scrollHeight*Xt}}return bt.addEventListener("scroll",Lt),function(){bt.removeEventListener("scroll",Lt)}}},[F,xt]),Object(v.useEffect)(function(){if(F&&Hi){function bt(Lt,St){Hi(Lt,St)}return F.on("beforeChange",bt),function(){F.off("beforeChange",bt)}}},[F,Hi]),Object(v.useEffect)(function(){if(F&&Mt){function bt(){Mt(F.getValue())}return F.on("blur",bt),function(){F.off("blur",bt)}}},[F,Mt]),Object(v.useEffect)(function(){if(F){function bt(Lt){var St=Lt.getValue();nt(St),kt(new Date().getTime()),Lt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),lt&&lt(St)}return F.on("change",bt),function(){F.off("change",bt)}}},[F,lt]),Object(v.useEffect)(function(){F&&(je==null?(F.setValue(""),nt("")):je!==F.getValue()&&(F.setValue(je),nt(je),F.setCursor(F.lineCount(),0)))},[F,je]);var Yn=Object(v.useCallback)(function(bt){var Lt=F.getCursor(),St=F.getSelection(),Ft=St.split(`
`);switch(bt){case"bold":return F.replaceSelection("**"+St+"**"),St===""&&F.setCursor(Lt.line,Lt.ch+2),F.focus();case"italic":return F.replaceSelection("*"+St+"*"),St===""&&F.setCursor(Lt.line,Lt.ch+1),F.focus();case"code":return F.replaceSelection("`"+St+"`"),St===""&&F.setCursor(Lt.line,Lt.ch+1),F.focus();case"inline-latex":return F.replaceSelection("`$$"+St+"$$`"),St===""&&F.setCursor(Lt.line,Lt.ch+3),F.focus();case"latex":return F.replaceSelection("```latex\n"+St+"\n```"),F.setCursor(Lt.line+1,St.length+1),F.focus();case"line-break":return F.replaceSelection(`<br/>
`),F.focus();case"list-ul":return St===""?F.replaceSelection("- "+St):F.replaceSelection(Ft.map(function(Xt){return Xt===""?"":"- ".concat(Xt)}).join(`
`)),F.focus();case"list-ol":return St===""?F.replaceSelection("1. "+St):F.replaceSelection(Ft.map(function(Xt,ri){return Xt===""?"":"".concat(ri+1,". ").concat(Xt)}).join(`
`)),F.focus();case"add-null-ch":return St===""&&F.setCursor(Lt.line,Lt.ch+1),F.replaceSelection(ke),F.focus();case"inster-template-1":return St===""&&F.setCursor(Lt.line,Lt.ch),F.replaceSelection(Ge),F.focus();case"eraser":return F.setValue(""),F.focus();case"trigger-watch":return Kt(!xt),F.focus();case"trigger-full-screen":return ui(!xi),F.focus();case Ne:Ni(Ne);return;case $e:Ni($e);return;case Me:Ni(Me);return;case et:Ni(et);return;default:throw new Error}},[F,xt,xi]),An=Object(v.useCallback)(function(bt){Ni("");switch(pi){case Ne:var Lt=bt.title,St=bt.link;return F.replaceSelection("[".concat(Lt,"](").concat(St,")")),F.focus();case $e:var Ft=bt.language,Xt=bt.content;return F.replaceSelection(["```"+Ft,Xt,"```"].join(`
`)),F.focus();case Me:var ri=bt.src,Gt=bt.alt;return Gt?F.replaceSelection("![ ".concat(Gt," ]( ").concat(ri,' "').concat(Gt,'" )')):F.replaceSelection("![,](".concat(ri,")")),F.focus();case et:for(var _i=bt.row,Wi=bt.col,Wt=bt.align,Tn=`
`,Qt=0;Qt<_i;Qt++){for(var Gi=[],Di=[],rn=0;rn<Wi;rn++)Qt===1&&Di.push(Ze[Wt]),Gi.push(" ");Qt===1&&(Tn+="| ".concat(Di.join(" | "),` |
`)),Tn+="| ".concat(Gi.join(Wi===1?"":" | "),` |
`)}return F.replaceSelection(Tn+`
`),F.focus();default:throw new Error}},[F,pi]),cr=Object(v.useMemo)(function(){switch(pi){case Ne:return m.a.createElement(ie,{callback:An,onCancel:Rn});case $e:return m.a.createElement(oe.b,{callback:An,onCancel:Rn});case Me:return m.a.createElement(fe,{callback:An,onCancel:Rn});case et:return m.a.createElement(Ue,{callback:An,onCancel:Rn});default:return null}},[pi]);function Rn(){Ni("")}Object(v.useEffect)(function(){if(ii.current){var bt=ii.current,Lt=!1,St=0;function Ft(Gt){Lt=!0,St=Gt.pageY}function Xt(){Lt=!1}function ri(Gt){if(Lt){var _i=Gt.pageY-St;_i<0&&(_i=0),_i>300&&(_i=300);var Wi=Rt+_i+"px";Vt(Wi)}}return bt.addEventListener("mousedown",Ft),document.addEventListener("mousemove",ri),document.addEventListener("mouseup",Xt),function(){bt.removeEventListener("mousedown",Ft),document.removeEventListener("mousemove",ri),document.removeEventListener("mouseup",Xt)}}},[F,ii]),Object(v.useEffect)(function(){Vt(Rt)},[Rt]);var _n=Ee(pt),fr=Ee($t),hn={width:_n,height:fr},pr=Object(v.useMemo)(function(){if(rt){var bt=new Date(rt),Lt=bt.getHours(),St=bt.getMinutes(),Ft=bt.getSeconds();return Lt=Lt<10?"0"+Lt:Lt,St=St<10?"0"+St:St,Ft=Ft<10?"0"+Ft:Ft,"".concat(Lt,":").concat(St,":").concat(Ft)}return 0},[rt]);function jr(){window.sessionStorage.removeItem(Et),yi(!1),kt(0)}function Un(){yi(!1),kt(0),F.setValue(window.sessionStorage.getItem(Et))}function ua(bt,Lt){var St=F.getValue();St=St.replace(bt,Lt),nt(St),F==null||F.setValue(St)}return m.a.createElement(v.Fragment,null,m.a.createElement("div",{className:"markdown-editor-wrapper",ref:mi},m.a.createElement("div",{className:"markdown-editor-container ".concat(Ye," ").concat(xt?"on-preview":""," ").concat(It?"mini":""," ").concat(xi?"full-screen":""),style:hn},m.a.createElement(E,{insertTemp:Ut,watch:xt,fullScreen:xi,showNullButton:zt,onActionCallback:Yn,hidetoolBar:ji,uuid:oi.current,setOpenPhones:function(){Yt.current=!0}}),m.a.createElement("div",{className:"markdown-editor-body"},m.a.createElement("div",{className:"codemirror-container"},m.a.createElement("textarea",{ref:Ht,placeholder:vn})),xt?m.a.createElement("div",{ref:yn,className:"preview-container"},Ve==="stex"&&m.a.createElement(R,{value:He}),Ve!=="stex"&&m.a.createElement(T.a,{edit:!0,value:He,replaces:ua})):null))),Pt?m.a.createElement("a",{ref:ii,className:"editor-resize"}):null,m.a.createElement(N.a,null,he[pi]?m.a.createElement(Z.a,{centered:!0,title:he[pi],visible:!0,onCancel:Rn,footer:null,className:"markdown-popup-form"},cr):null))}},SJMd:function(_t,Je){/**
* @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 ne,ue,Z,P=!1,$,B;window.PR_SHOULD_USE_CONTINUATION=!0;var U,K;(function(){var G=window,M=["break,continue,do,else,for,if,return,while"],O=[M,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],v=[O,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],m=[v,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],p=[v,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],h=[v,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],o="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",f=[v,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],l="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",r=[M,"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"],s=[M,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],c=[M,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],L=[m,h,p,f,l,r,s,c],w=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,T="str",R="kwd",C="com",S="typ",x="lit",_="pun",d="pln",u="tag",g="dec",E="src",N="atn",D="atv",H="nocode",j="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function I(Te){for(var Ie=0,Ue=!1,We=!1,Fe=0,Ne=Te.length;Fe<Ne;++Fe){var Me=Te[Fe];if(Me.ignoreCase)We=!0;else if(/[a-z]/i.test(Me.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Ue=!0,We=!1;break}}var $e={b:8,t:9,n:10,v:11,f:12,r:13};function et(at){var Pe=at.charCodeAt(0);if(Pe!==92)return Pe;var ut=at.charAt(1);return Pe=$e[ut],Pe||("0"<=ut&&ut<="7"?parseInt(at.substring(1),8):ut==="u"||ut==="x"?parseInt(at.substring(2),16):at.charCodeAt(1))}function Qe(at){if(at<32)return(at<16?"\\x0":"\\x")+at.toString(16);var Pe=String.fromCharCode(at);return Pe==="\\"||Pe==="-"||Pe==="]"||Pe==="^"?"\\"+Pe:Pe}function Ze(at){var Pe=at.substring(1,at.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")),ut=[],tt=Pe[0]==="^",ke=["["];tt&&ke.push("^");for(var Ge=tt?1:0,Ee=Pe.length;Ge<Ee;++Ge){var pe=Pe[Ge];if(/\\[bdsw]/i.test(pe))ke.push(pe);else{var _e=et(pe),re;Ge+2<Ee&&Pe[Ge+1]==="-"?(re=et(Pe[Ge+2]),Ge+=2):re=_e,ut.push([_e,re]),re<65||_e>122||(re<65||_e>90||ut.push([Math.max(65,_e)|32,Math.min(re,90)|32]),re<97||_e>122||ut.push([Math.max(97,_e)&~32,Math.min(re,122)&~32]))}}ut.sort(function(be,De){return be[0]-De[0]||De[1]-be[1]});for(var ae=[],he=[],Ge=0;Ge<ut.length;++Ge){var ge=ut[Ge];ge[0]<=he[1]+1?he[1]=Math.max(he[1],ge[1]):ae.push(he=ge)}for(var Ge=0;Ge<ae.length;++Ge){var ge=ae[Ge];ke.push(Qe(ge[0])),ge[1]>ge[0]&&(ge[1]+1>ge[0]&&ke.push("-"),ke.push(Qe(ge[1])))}return ke.push("]"),ke.join("")}function dt(at){for(var Pe=at.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")),ut=Pe.length,tt=[],ke=0,Ge=0;ke<ut;++ke){var Ee=Pe[ke];if(Ee==="(")++Ge;else if(Ee.charAt(0)==="\\"){var pe=+Ee.substring(1);pe&&(pe<=Ge?tt[pe]=-1:Pe[ke]=Qe(pe))}}for(var ke=1;ke<tt.length;++ke)tt[ke]===-1&&(tt[ke]=++Ie);for(var ke=0,Ge=0;ke<ut;++ke){var Ee=Pe[ke];if(Ee==="(")++Ge,tt[Ge]||(Pe[ke]="(?:");else if(Ee.charAt(0)==="\\"){var pe=+Ee.substring(1);pe&&pe<=Ge&&(Pe[ke]="\\"+tt[pe])}}for(var ke=0;ke<ut;++ke)Pe[ke]==="^"&&Pe[ke+1]!=="^"&&(Pe[ke]="");if(at.ignoreCase&&Ue)for(var ke=0;ke<ut;++ke){var Ee=Pe[ke],_e=Ee.charAt(0);Ee.length>=2&&_e==="["?Pe[ke]=Ze(Ee):_e!=="\\"&&(Pe[ke]=Ee.replace(/[a-zA-Z]/g,function(he){var ge=he.charCodeAt(0);return"["+String.fromCharCode(ge&~32,ge|32)+"]"}))}return Pe.join("")}for(var it=[],Fe=0,Ne=Te.length;Fe<Ne;++Fe){var Me=Te[Fe];if(Me.global||Me.multiline)throw new Error(""+Me);it.push("(?:"+dt(Me)+")")}return new RegExp(it.join("|"),We?"gi":"g")}function b(Te,Ie){var Ue=/(?:^|\s)nocode(?:\s|$)/,We=[],Fe=0,Ne=[],Me=0;function $e(et){var Qe=et.nodeType;if(Qe==1){if(Ue.test(et.className))return;for(var Ze=et.firstChild;Ze;Ze=Ze.nextSibling)$e(Ze);var dt=et.nodeName.toLowerCase();(dt==="br"||dt==="li")&&(We[Me]=`
`,Ne[Me<<1]=Fe++,Ne[Me++<<1|1]=et)}else if(Qe==3||Qe==4){var it=et.nodeValue;it.length&&(Ie?it=it.replace(/\r\n?/g,`
`):it=it.replace(/[ \t\r\n]+/g," "),We[Me]=it,Ne[Me<<1]=Fe,Fe+=it.length,Ne[Me++<<1|1]=et)}}return $e(Te),{sourceCode:We.join("").replace(/\n$/,""),spans:Ne}}function W(Te,Ie,Ue,We,Fe){if(!Ue)return;var Ne={sourceNode:Te,pre:1,langExtension:null,numberLines:null,sourceCode:Ue,spans:null,basePos:Ie,decorations:null};We(Ne),Fe.push.apply(Fe,Ne.decorations)}var Y=/\S/;function ie(Te){for(var Ie=void 0,Ue=Te.firstChild;Ue;Ue=Ue.nextSibling){var We=Ue.nodeType;Ie=We===1?Ie?Te:Ue:We===3&&Y.test(Ue.nodeValue)?Te:Ie}return Ie===Te?void 0:Ie}function oe(Te,Ie){var Ue={},We;(function(){for(var Me=Te.concat(Ie),$e=[],et={},Qe=0,Ze=Me.length;Qe<Ze;++Qe){var dt=Me[Qe],it=dt[3];if(it)for(var at=it.length;--at>=0;)Ue[it.charAt(at)]=dt;var Pe=dt[1],ut=""+Pe;et.hasOwnProperty(ut)||($e.push(Pe),et[ut]=null)}$e.push(/[\0-\uffff]/),We=I($e)})();var Fe=Ie.length,Ne=function(Me){for(var $e=Me.sourceCode,et=Me.basePos,Qe=Me.sourceNode,Ze=[et,d],dt=0,it=$e.match(We)||[],at={},Pe=0,ut=it.length;Pe<ut;++Pe){var tt=it[Pe],ke=at[tt],Ge=void 0,Ee;if(typeof ke=="string")Ee=!1;else{var pe=Ue[tt.charAt(0)];if(pe)Ge=tt.match(pe[1]),ke=pe[0];else{for(var _e=0;_e<Fe;++_e)if(pe=Ie[_e],Ge=tt.match(pe[1]),Ge){ke=pe[0];break}Ge||(ke=d)}Ee=ke.length>=5&&ke.substring(0,5)==="lang-",Ee&&!(Ge&&typeof Ge[1]=="string")&&(Ee=!1,ke=E),Ee||(at[tt]=ke)}var re=dt;if(dt+=tt.length,!Ee)Ze.push(et+re,ke);else{var ae=Ge[1],he=tt.indexOf(ae),ge=he+ae.length;Ge[2]&&(ge=tt.length-Ge[2].length,he=ge-ae.length);var be=ke.substring(5);W(Qe,et+re,tt.substring(0,he),Ne,Ze),W(Qe,et+re+he,ae,le(be,ae),Ze),W(Qe,et+re+ge,tt.substring(ge),Ne,Ze)}}Me.decorations=Ze};return Ne}function xe(Te){var Ie=[],Ue=[];Te.tripleQuotedStrings?Ie.push([T,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Te.multiLineStrings?Ie.push([T,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Ie.push([T,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Te.verbatimStrings&&Ue.push([T,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var We=Te.hashComments;We&&(Te.cStyleComments?(We>1?Ie.push([C,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Ie.push([C,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ue.push([T,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Ie.push([C,/^#[^\r\n]*/,null,"#"])),Te.cStyleComments&&(Ue.push([C,/^\/\/[^\r\n]*/,null]),Ue.push([C,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Fe=Te.regexLiterals;if(Fe){var Ne=Fe>1?"":`
\r`,Me=Ne?".":"[\\S\\s]",$e="/(?=[^/*"+Ne+"])(?:[^/\\x5B\\x5C"+Ne+"]|\\x5C"+Me+"|\\x5B(?:[^\\x5C\\x5D"+Ne+"]|\\x5C"+Me+")*(?:\\x5D|$))+/";Ue.push(["lang-regex",RegExp("^"+j+"("+$e+")")])}var et=Te.types;et&&Ue.push([S,et]);var Qe=(""+Te.keywords).replace(/^ | $/g,"");Qe.length&&Ue.push([R,new RegExp("^(?:"+Qe.replace(/[\s,]+/g,"|")+")\\b"),null]),Ie.push([d,/^\s+/,null,` \r
\xA0`]);var Ze="^.[^\\s\\w.$@'\"`/\\\\]*";return Te.regexLiterals&&(Ze+="(?!s*/)"),Ue.push([x,/^@[a-z_$][a-z_$@0-9]*/i,null],[S,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[d,/^[a-z_$][a-z_$@0-9]*/i,null],[x,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[d,/^\\[\s\S]?/,null],[_,new RegExp(Ze),null]),oe(Ie,Ue)}var ve=xe({keywords:L,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function we(Te,Ie,Ue){for(var We=/(?:^|\s)nocode(?:\s|$)/,Fe=/\r\n?|\n/,Ne=Te.ownerDocument,Me=Ne.createElement("li");Te.firstChild;)Me.appendChild(Te.firstChild);var $e=[Me];function et(Pe){var ut=Pe.nodeType;if(ut==1&&!We.test(Pe.className))if(Pe.nodeName==="br")Qe(Pe),Pe.parentNode&&Pe.parentNode.removeChild(Pe);else for(var tt=Pe.firstChild;tt;tt=tt.nextSibling)et(tt);else if((ut==3||ut==4)&&Ue){var ke=Pe.nodeValue,Ge=ke.match(Fe);if(Ge){var Ee=ke.substring(0,Ge.index);Pe.nodeValue=Ee;var pe=ke.substring(Ge.index+Ge[0].length);if(pe){var _e=Pe.parentNode;_e.insertBefore(Ne.createTextNode(pe),Pe.nextSibling)}Qe(Pe),Ee||Pe.parentNode.removeChild(Pe)}}}function Qe(Pe){for(;!Pe.nextSibling;)if(Pe=Pe.parentNode,!Pe)return;function ut(Ge,Ee){var pe=Ee?Ge.cloneNode(!1):Ge,_e=Ge.parentNode;if(_e){var re=ut(_e,1),ae=Ge.nextSibling;re.appendChild(pe);for(var he=ae;he;he=ae)ae=he.nextSibling,re.appendChild(he)}return pe}for(var tt=ut(Pe.nextSibling,0),ke;(ke=tt.parentNode)&&ke.nodeType===1;)tt=ke;$e.push(tt)}for(var Ze=0;Ze<$e.length;++Ze)et($e[Ze]);Ie===(Ie|0)&&$e[0].setAttribute("value",Ie);var dt=Ne.createElement("ol");dt.className="linenums";for(var it=Math.max(0,Ie-1|0)||0,Ze=0,at=$e.length;Ze<at;++Ze)Me=$e[Ze],Me.className="L"+(Ze+it)%10,Me.firstChild||Me.appendChild(Ne.createTextNode("\xA0")),dt.appendChild(Me);Te.appendChild(dt)}function Ce(Te){var Ie=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Ie=Ie&&+Ie[1]<=8;var Ue=/\n/g,We=Te.sourceCode,Fe=We.length,Ne=0,Me=Te.spans,$e=Me.length,et=0,Qe=Te.decorations,Ze=Qe.length,dt=0;Qe[Ze]=Fe;var it,at;for(at=it=0;at<Ze;)Qe[at]!==Qe[at+2]?(Qe[it++]=Qe[at++],Qe[it++]=Qe[at++]):at+=2;for(Ze=it,at=it=0;at<Ze;){for(var Pe=Qe[at],ut=Qe[at+1],tt=at+2;tt+2<=Ze&&Qe[tt+1]===ut;)tt+=2;Qe[it++]=Pe,Qe[it++]=ut,at=tt}Ze=Qe.length=it;var ke=Te.sourceNode,Ge="";ke&&(Ge=ke.style.display,ke.style.display="none");try{for(var Ee=null;et<$e;){var pe=Me[et],_e=Me[et+2]||Fe,re=Qe[dt+2]||Fe,tt=Math.min(_e,re),ae=Me[et+1],he;if(ae.nodeType!==1&&(he=We.substring(Ne,tt))){Ie&&(he=he.replace(Ue,"\r")),ae.nodeValue=he;var ge=ae.ownerDocument,be=ge.createElement("span");be.className=Qe[dt+1];var De=ae.parentNode;De.replaceChild(be,ae),be.appendChild(ae),Ne<_e&&(Me[et+1]=ae=ge.createTextNode(We.substring(tt,_e)),De.insertBefore(ae,be.nextSibling))}Ne=tt,Ne>=_e&&(et+=2),Ne>=re&&(dt+=2)}}finally{ke&&(ke.style.display=Ge)}}var Se={};function fe(Te,Ie){for(var Ue=Ie.length;--Ue>=0;){var We=Ie[Ue];Se.hasOwnProperty(We)?G.console&&console.warn("cannot override language handler %s",We):Se[We]=Te}}function le(Te,Ie){return Te&&Se.hasOwnProperty(Te)||(Te=/^\s*</.test(Ie)?"default-markup":"default-code"),Se[Te]}fe(ve,["default-code"]),fe(oe([],[[d,/^[^<?]+/],[g,/^<!\w[^>]*(?:>|$)/],[C,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\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"]),fe(oe([[d,/^[\s]+/,null,` \r
`],[D,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[u,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[N,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\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"]),fe(oe([],[[D,/^[\s\S]+/]]),["uq.val"]),fe(xe({keywords:m,hashComments:!0,cStyleComments:!0,types:w}),["c","cc","cpp","cxx","cyc","m"]),fe(xe({keywords:"null,true,false"}),["json"]),fe(xe({keywords:h,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:w}),["cs"]),fe(xe({keywords:p,cStyleComments:!0}),["java"]),fe(xe({keywords:c,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),fe(xe({keywords:r,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),fe(xe({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),fe(xe({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),fe(xe({keywords:f,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),fe(xe({keywords:o,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),fe(oe([],[[T,/^[\s\S]+/]]),["regex"]);function te(Te){var Ie=Te.langExtension;try{var Ue=b(Te.sourceNode,Te.pre),We=Ue.sourceCode;Te.sourceCode=We,Te.spans=Ue.spans,Te.basePos=0,le(Ie,We)(Te),Ce(Te)}catch(Fe){G.console&&console.log(Fe&&Fe.stack||Fe)}}function de(Te,Ie,Ue){var We=Ue||!1,Fe=Ie||null,Ne=document.createElement("div");Ne.innerHTML="<pre>"+Te+"</pre>",Ne=Ne.firstChild,We&&we(Ne,We,!0);var Me={langExtension:Fe,numberLines:We,sourceNode:Ne,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return te(Me),Ne.innerHTML}function se(Te,Ie){var Ue=Ie||document.body,We=Ue.ownerDocument||document;function Fe(pe){return Ue.getElementsByTagName(pe)}for(var Ne=[Fe("pre"),Fe("code"),Fe("xmp")],Me=[],$e=0;$e<Ne.length;++$e)for(var et=0,Qe=Ne[$e].length;et<Qe;++et)Me.push(Ne[$e][et]);Ne=null;var Ze=Date;Ze.now||(Ze={now:function(){return+new Date}});var dt=0,it=/\blang(?:uage)?-([\w.]+)(?!\S)/,at=/\bprettyprint\b/,Pe=/\bprettyprinted\b/,ut=/pre|xmp/i,tt=/^code$/i,ke=/^(?:pre|code|xmp)$/i,Ge={};function Ee(){for(var pe=G.PR_SHOULD_USE_CONTINUATION?Ze.now()+250:Infinity;dt<Me.length&&Ze.now()<pe;dt++){for(var _e=Me[dt],re=Ge,ae=_e;ae=ae.previousSibling;){var he=ae.nodeType,ge=(he===7||he===8)&&ae.nodeValue;if(ge?!/^\??prettify\b/.test(ge):he!==3||/\S/.test(ae.nodeValue))break;if(ge){re={},ge.replace(/\b(\w+)=([\w:.%+-]+)/g,function(ei,Ut,fi){re[Ut]=fi});break}}var be=_e.className;if((re!==Ge||at.test(be))&&!Pe.test(be)){for(var De=!1,je=_e.parentNode;je;je=je.parentNode){var lt=je.tagName;if(ke.test(lt)&&je.className&&at.test(je.className)){De=!0;break}}if(!De){_e.className+=" prettyprinted";var mt=re.lang;if(!mt){mt=be.match(it);var pt;!mt&&(pt=ie(_e))&&tt.test(pt.tagName)&&(mt=pt.className.match(it)),mt&&(mt=mt[1])}var Ot;if(ut.test(_e.tagName))Ot=1;else{var Rt=_e.currentStyle,ft=We.defaultView,It=Rt?Rt.whiteSpace:ft&&ft.getComputedStyle?ft.getComputedStyle(_e,null).getPropertyValue("white-space"):0;Ot=It&&It.substring(0,3)==="pre"}var Bt=re.linenums;(Bt=Bt==="true"||+Bt)||(Bt=be.match(/\blinenums\b(?::(\d+))?/),Bt=Bt?Bt[1]&&Bt[1].length?+Bt[1]:!0:!1),Bt&&we(_e,Bt,Ot);var ht={langExtension:mt,sourceNode:_e,numberLines:Bt,pre:Ot,sourceCode:null,basePos:null,spans:null,decorations:null};te(ht)}}}dt<Me.length?G.setTimeout(Ee,250):typeof Te=="function"&&Te()}Ee()}var Re=G.PR={createSimpleLexer:oe,registerLangHandler:fe,sourceDecorator:xe,PR_ATTRIB_NAME:N,PR_ATTRIB_VALUE:D,PR_COMMENT:C,PR_DECLARATION:g,PR_KEYWORD:R,PR_LITERAL:x,PR_NOCODE:H,PR_PLAIN:d,PR_PUNCTUATION:_,PR_SOURCE:E,PR_STRING:T,PR_TAG:u,PR_TYPE:S,prettyPrintOne:P?G.prettyPrintOne=de:U=de,prettyPrint:K=P?G.prettyPrint=se:K=se},Le=G.define;typeof Le=="function"&&Le.amd&&Le("google-code-prettify",[],function(){return Re})})()},Sdqs:function(_t,Je,ne){"use strict";ne.r(Je);var ue=ne("5Dmo"),Z=ne("3S7+"),P=ne("+L6B"),$=ne("2/Rp"),B=ne("giR+"),U=ne("fyUT"),K=ne("sRBo"),G=ne("kaz8"),M=ne("/zsF"),O=ne("PArb"),v=ne("14J3"),m=ne("BMrR"),p=ne("jCWc"),h=ne("kPKH"),o=ne("sPJy"),f=ne("bE4q"),l=ne("miYZ"),r=ne("tsqr"),s=ne("9og8"),c=ne("k1fw"),L=ne("y8nQ"),w=ne("Vl3Y"),T=ne("2qtc"),R=ne("kLXV"),C=ne("tJVT"),S=ne("PpiC"),x=ne("WmNS"),_=ne.n(x),d=ne("q1tI"),u=ne.n(d),g=ne("Ty5D"),E=ne("9kvl"),N=ne("55Ip"),D=ne("jhfD"),H=ne("/MfK"),j=ne("kaH+"),I=ne("Ot1p"),b=ne("dhSg"),W=ne("wd/R"),Y=ne.n(W),ie=ne("m3rI"),oe=ne("LvDl"),xe=ne("XYT7"),ve=ne("5NDa"),we=ne("5rEg"),Ce=ne("ErOA"),Se=function(Me){var $e=Me.shixunHomeworks,et=Me.dispatch,Qe=Object(g.i)(),Ze=Object(d.useState)(!0),dt=Object(C.a)(Ze,2),it=dt[0],at=dt[1],Pe=w.a.useForm(),ut=Object(C.a)(Pe,1),tt=ut[0];return u.a.createElement(u.a.Fragment,null,u.a.createElement(R.a,{centered:!0,title:"\u8C03\u5206",visible:$e.actionTabs.key==="\u8C03\u5206",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",onOk:Object(s.a)(_.a.mark(function ke(){var Ge,Ee;return _.a.wrap(function(_e){for(;;)switch(_e.prev=_e.next){case 0:return _e.next=2,tt.validateFields();case 2:return Ge=tt.getFieldsValue(),_e.next=5,Object(Ce.a)("/api/student_works/".concat($e.actionTabs.id,"/adjust_score.json"),{method:"post",body:Object(c.a)({},Ge)});case 5:Ee=_e.sent,Ee.status===0&&(r.b.success("\u8BC4\u9605\u6210\u529F"),tt.resetFields(),et({type:"shixunHomeworks/setActionTabs",payload:{}}),et({type:"shixunHomeworks/getStudentWorkCommon",payload:Object(c.a)({},Qe)}));case 7:case"end":return _e.stop()}},ke)})),onCancel:function(){et({type:"shixunHomeworks/setActionTabs",payload:{}})}},u.a.createElement("p",{className:"tc"},"\u8BE5\u5B66\u751F\u7684\u6700\u7EC8\u6210\u7EE9\u5C06\u4E0D\u4F1A\u6309\u7167\u8BC4\u5206\u89C4\u5219\u8FDB\u884C\u8BA1\u7B97"),u.a.createElement(w.a,{form:tt,layout:"horizontal"},u.a.createElement("div",{style:{display:"flex",alignItems:"baseline"}},u.a.createElement(w.a.Item,{label:"\u6210\u7EE9",name:"score",rules:[{required:!0,message:"\u8BF7\u8F93\u5165!"}]},u.a.createElement(U.a,{min:0,placeholder:"\u8BF7\u586B\u5199\u5206\u6570"})),u.a.createElement("span",{className:"ml10"},"\u5206")),u.a.createElement("div",null,u.a.createElement(w.a.Item,{name:"comment"},u.a.createElement(we.a.TextArea,{placeholder:"\u8BF7\u586B\u5199\u60A8\u5BF9\u4F5C\u54C1\u8C03\u5206\u7684\u539F\u56E0",rows:8}))))))},fe=Object(E.a)(function(Ne){var Me=Ne.shixunHomeworks;return{shixunHomeworks:Me}})(Se),le=ne("500L"),te=function(Me){var $e=Me.classroomList,et=Me.loading,Qe=Me.dispatch,Ze=Object(g.i)(),dt=w.a.useForm(),it=Object(C.a)(dt,1),at=it[0];return u.a.createElement(R.a,{centered:!0,title:"\u8865\u4EA4\u9644\u4EF6",visible:$e.actionTabs.key==="\u8865\u4EA4\u9644\u4EF6",bodyStyle:{minHeight:200},onOk:Object(s.a)(_.a.mark(function Pe(){var ut,tt,ke,Ge;return _.a.wrap(function(pe){for(;;)switch(pe.prev=pe.next){case 0:return pe.next=2,at.validateFields();case 2:return tt=Object(c.a)({},at.getFieldValue()),ke=$e.actionTabs.selectArrs,tt.attachment_ids=(ut=tt.attachment_ids)===null||ut===void 0?void 0:ut.map(function(_e){return _e.response.id}),pe.next=7,Object(xe.V)(Object(c.a)(Object(c.a)({},tt),{},{homeworkId:ke.work_id}));case 7:Ge=pe.sent,Ge.status===0&&(Qe({type:"shixunHomeworks/getStudentWorkSupplyDetail",payload:Object(c.a)({},$e.actionTabs.params)}),Qe({type:"classroomList/setActionTabs",payload:{}}));case 9:case"end":return pe.stop()}},Pe)})),onCancel:function(){Qe({type:"classroomList/setActionTabs",payload:{}})}},u.a.createElement(w.a,{form:at,initialValues:{}},u.a.createElement(w.a.Item,{name:"attachment_ids",rules:[{required:!0,message:"\u8BF7\u4E0A\u4F20\u9644\u4EF6"}]},u.a.createElement(le.b,null)),u.a.createElement(w.a.Item,{name:"description"},u.a.createElement(we.a.TextArea,{placeholder:"\u8BF7\u5728\u6B64\u8F93\u5165\u8865\u4EA4\u9644\u4EF6\u7684\u539F\u56E0\uFF0C\u6700\u5927\u9650\u5236100\u4E2A\u5B57\u7B26",rows:7}))))},de=Object(E.a)(function(Ne){var Me=Ne.classroomList,$e=Ne.loading;return{classroomList:Me,loading:$e}})(te),se=ne("xKgJ"),Re=ne("T/ev"),Le=ne.n(Re),Te=ne("9Bee"),Ie=ne("1vsH"),Ue=["\u5355\u9009\u9898","\u591A\u9009\u9898","\u5224\u65AD\u9898","\u586B\u7A7A\u9898","\u7B80\u7B54\u9898","\u5B9E\u8BAD\u9898"],We=function(Me){var $e,et,Qe,Ze,dt,it,at,Pe,ut,tt,ke,Ge,Ee,pe,_e,re,ae,he,ge,be,De,je,lt,mt,pt=Me.shixunHomeworks,Ot=Me.globalSetting,Rt=Me.loading,ft=Me.user,It=Me.dispatch,Bt=Object(S.a)(Me,["shixunHomeworks","globalSetting","loading","user","dispatch"]),ht=Object(g.i)(),ei=Object(d.useRef)(),Ut=Object(g.h)(),fi=ft.userInfo,Ve=pt.studentWorkDetail,Xe=pt.studentWorkCommon,Et=pt.studentWorkSupplyDetail,Dt=pt.workList,Pt=Object(d.useState)({}),si=Object(C.a)(Pt,2),an=si[0],sn=si[1],zt=Object(d.useState)(""),vt=Object(C.a)(zt,2),ji=vt[0],nn=vt[1],Ei=Object(d.useState)(!1),Mt=Object(C.a)(Ei,2),Hi=Mt[0],Ri=Mt[1],pn=R.a.useModal(),Ye=Object(C.a)(pn,2),Ct=Ye[0],mn=Ye[1],gn=w.a.useForm(),vn=Object(C.a)(gn,1),Zi=vn[0],X=Object(d.useState)({last:!1}),y=Object(C.a)(X,2),A=y[0],F=y[1],q=Object(d.useState)({last:!1}),V=Object(C.a)(q,2),me=V[0],He=V[1],nt=Object(d.useState)(!1),yt=Object(C.a)(nt,2),ze=yt[0],xt=yt[1],Kt=Object(d.useState)(""),ti=Object(C.a)(Kt,2),ki=ti[0],xi=ti[1],ui=function(){It({type:"shixunHomeworks/getStudentWorkCommon",payload:Object(c.a)({},ht)})};Object(d.useEffect)(function(){return It({type:"globalSetting/footerToggle",payload:!1}),function(){It({type:"globalSetting/footerToggle",payload:!0})}},[]),Object(d.useEffect)(function(){It({type:"shixunHomeworks/getStudentWorkDetail",payload:Object(c.a)({},ht)}),It({type:"shixunHomeworks/getStudentWorkSupplyDetail",payload:Object(c.a)({},ht)}),ui(),Qi(),ei.current.onclick=function(rt){rt.target.nodeName==="IMG"&&rt.target.alt!==""&&b.a.publish("preview-image",rt.target.src)}},[ht.categoryId,ht.userId]);function Qi(){return on.apply(this,arguments)}function on(){return on=Object(s.a)(_.a.mark(function rt(){var kt,Jt,wt,$t,Vt,jt,Zt;return _.a.wrap(function(yi){for(;;)switch(yi.prev=yi.next){case 0:return wt=JSON.parse(localStorage.getItem("all_student_works_param")||"{}"),yi.next=3,It({type:"shixunHomeworks/getAllStudentWorks",payload:Object(c.a)(Object(c.a)({},ht),wt)});case 3:$t=yi.sent,Vt=(kt=$t.all_student_works)===null||kt===void 0?void 0:kt.map(function(oi){return String(oi.student_work_id)}).indexOf(ht.userId),Vt===((Jt=$t.all_student_works)===null||Jt===void 0?void 0:Jt.length)-1?F({last:!0}):F((jt=$t.all_student_works)===null||jt===void 0?void 0:jt[Vt+1]),Vt===0?He({last:!0}):He((Zt=$t.all_student_works)===null||Zt===void 0?void 0:Zt[Vt-1]);case 7:case"end":return yi.stop()}},rt)})),on.apply(this,arguments)}var pi=function(kt){Ct.confirm({title:"\u662F\u5426\u786E\u8BA4\u5220\u9664?",onOk:function(){var Jt=Object(s.a)(_.a.mark(function $t(){var Vt;return _.a.wrap(function(Zt){for(;;)switch(Zt.prev=Zt.next){case 0:return Zt.next=2,It({type:"shixunHomeworks/deleteReply",payload:{object_id:kt.id,object_type:"journals_for_message"}});case 2:Vt=Zt.sent,Vt.status===0&&(r.b.success("\u5220\u9664\u6210\u529F"),ui());case 4:case"end":return Zt.stop()}},$t)}));function wt(){return Jt.apply(this,arguments)}return wt}()})},Ni=function(kt){Ct.confirm({title:"\u662F\u5426\u786E\u8BA4\u5220\u9664?",onOk:function(){var Jt=Object(s.a)(_.a.mark(function $t(){var Vt;return _.a.wrap(function(Zt){for(;;)switch(Zt.prev=Zt.next){case 0:return Zt.next=2,Object(xe.k)({score_id:kt.comment_id,userId:ht.userId});case 2:Vt=Zt.sent,Vt.status===0&&(r.b.success("\u5220\u9664\u6210\u529F"),ui());case 4:case"end":return Zt.stop()}},$t)}));function wt(){return Jt.apply(this,arguments)}return wt}()})},ln=function(){var rt=Object(s.a)(_.a.mark(function kt(Jt){var wt,$t;return _.a.wrap(function(jt){for(;;)switch(jt.prev=jt.next){case 0:return Jt.attachment_ids=(wt=Jt.attachment_ids)===null||wt===void 0?void 0:wt.map(function(Zt){var un;return Zt==null||((un=Zt.response)===null||un===void 0)?void 0:un.id}),jt.next=3,Object(xe.e)(Object(c.a)(Object(c.a)({},Jt),{},{userId:ht.userId}));case 3:$t=jt.sent,$t.status===0&&(r.b.success("\u63D0\u4EA4\u6210\u529F"),Zi.resetFields(),ui());case 5:case"end":return jt.stop()}},kt)}));return function(Jt){return rt.apply(this,arguments)}}(),qi=function(){var rt=Object(s.a)(_.a.mark(function kt(Jt){var wt,$t,Vt,jt,Zt;return _.a.wrap(function(yi){for(;;)switch(yi.prev=yi.next){case 0:if(wt=Zi.getFieldsValue(),$t=wt.comment,Vt=wt.score,jt=wt.attachment_ids,Zt=!Object(oe.isNil)(Vt),console.log("-------",ht),!($t||Zt||jt)){yi.next=6;break}return R.a.confirm({centered:!0,okText:"\u79BB\u5F00",cancelText:"\u53D6\u6D88",title:"\u79BB\u5F00\u6B64\u9875\u63D0\u793A",content:u.a.createElement("div",{className:"tc"},"\u7CFB\u7EDF\u53EF\u80FD\u4E0D\u4F1A\u4FDD\u5B58\u60A8\u6240\u505A\u7684\u66F4\u6539"),onOk:function(){Zi.resetFields(),Jt==="last"?E.d.push("/classrooms/".concat(ht==null?void 0:ht.coursesId,"/group_homework/").concat(ht==null?void 0:ht.commonHomeworkId,"/review/").concat(me==null?void 0:me.student_work_id)):Jt==="read"?E.d.push("/classrooms/".concat(ht==null?void 0:ht.coursesId,"/group_homework/").concat(ht==null?void 0:ht.commonHomeworkId,"/review/").concat(A==null?void 0:A.student_work_id)):E.d.push("/classrooms/".concat(ht.coursesId,"/group_homework/").concat(ht.commonHomeworkId,"/detail"))}}),yi.abrupt("return");case 6:Jt==="last"?E.d.push("/classrooms/".concat(ht==null?void 0:ht.coursesId,"/group_homework/").concat(ht==null?void 0:ht.commonHomeworkId,"/review/").concat(me==null?void 0:me.student_work_id)):Jt==="read"?E.d.push("/classrooms/".concat(ht==null?void 0:ht.coursesId,"/group_homework/").concat(ht==null?void 0:ht.commonHomeworkId,"/review/").concat(A==null?void 0:A.student_work_id)):E.d.push("/classrooms/".concat(ht.coursesId,"/group_homework/").concat(ht.commonHomeworkId,"/detail"));case 7:case"end":return yi.stop()}},kt)}));return function(Jt){return rt.apply(this,arguments)}}();return u.a.createElement("section",{className:"edu-container",ref:ei},u.a.createElement("section",{className:"animated fadeIn"},u.a.createElement("aside",{className:"mt10"},fi&&u.a.createElement(f.a,{separator:">"},u.a.createElement(f.a.Item,null,u.a.createElement(N.a,{to:"/classrooms/".concat(ht.coursesId,"/group_homework")},fi==null||(($e=fi.course)===null||$e===void 0)?void 0:$e.course_name)),u.a.createElement(f.a.Item,null,u.a.createElement(N.a,{to:"/classrooms/".concat(ht.coursesId,"/group_homework")},"\u5206\u7EC4\u4F5C\u4E1A")),u.a.createElement(f.a.Item,null,u.a.createElement(N.a,{to:"/classrooms/".concat(ht.coursesId,"/group_homework/").concat(ht.commonHomeworkId,"/detail")},"\u4F5C\u4E1A\u8BE6\u60C5")),u.a.createElement(f.a.Item,null,Ve==null?void 0:Ve.author_name))),u.a.createElement("aside",{className:[Le.a.title,"mt20"].join(" ")},u.a.createElement(m.a,{style:{width:"100%"}},u.a.createElement(h.a,{flex:"1"},u.a.createElement(N.a,{to:"/classrooms/".concat(ht.coursesId,"/group_homework")},u.a.createElement(D.a,{className:"font16 c-black"})),u.a.createElement("strong",{className:"font20 ml5"},Ve==null?void 0:Ve.homework_name),u.a.createElement(Ie.m,{status:Ve==null?void 0:Ve.homework_status})),u.a.createElement(h.a,null,Object(se.s)()&&(Ve==null||((et=Ve.homework_status)===null||et===void 0)?void 0:et.includes("\u8865\u4EA4\u4E2D"))&&u.a.createElement("span",{onClick:function(){It({type:"classroomList/setActionTabs",payload:{key:"\u8865\u4EA4\u9644\u4EF6",params:ht,selectArrs:{homework_id:ht.commonHomeworkId,work_id:ht.userId}}})},className:"c-blue current font14"},"\u8865\u4EA4\u9644\u4EF6"))))),u.a.createElement("section",{className:[Le.a.bg,"pt30","pl30","pr30","pb30","mt20"].join(" ")},(Ve==null?void 0:Ve.description)&&u.a.createElement("aside",null,u.a.createElement("div",{className:"font16"},"\u5185\u5BB9"),u.a.createElement("div",{className:"pl30 mt20"},u.a.createElement(Te.a,{value:(Ve==null?void 0:Ve.description)||"\u6682\u65E0\uFF5E"})),Ve==null||((Qe=Ve.attachments)===null||Qe===void 0)?void 0:Qe.map(function(rt,kt){return u.a.createElement("div",{className:"pl30",key:kt},u.a.createElement("a",{href:"".concat(ie.a.API_SERVER).concat(rt.url)},u.a.createElement("span",{className:"iconfont icon-fujian c-green font14"}),u.a.createElement("span",{className:"ml10 c-black"},rt.title),u.a.createElement("span",{className:"c-light-black ml20 font12"},rt.filesize)))}),u.a.createElement("aside",{className:"tr"},u.a.createElement("span",{className:" c-light-black"},Y()(Ve.commit_time).format("YYYY-MM-DD HH:mm")),u.a.createElement("span",{className:"ml10"},Ve.commit_user_name),u.a.createElement("span",{className:"ml10 c-light-black"},"\u63D0\u4EA4"),u.a.createElement("span",{className:"ml30 c-light-black"},Y()(Ve.update_time).format("YYYY-MM-DD HH:mm")),u.a.createElement("span",{className:"ml10"},Ve.update_user_name),u.a.createElement("span",{className:"ml10 c-light-black"},"\u66F4\u65B0"))),(Ve==null?void 0:Ve.redo_description)&&u.a.createElement("aside",null,u.a.createElement(O.a,null),u.a.createElement("div",{className:"font16"},"\u91CD\u505A\u8BB0\u5F55"),u.a.createElement("div",{className:"pl30 mt20"},u.a.createElement(Te.a,{value:(Ve==null?void 0:Ve.redo_description)||"\u6682\u65E0\uFF5E"})),Ve==null||((Ze=Ve.redo_attachments)===null||Ze===void 0)?void 0:Ze.map(function(rt,kt){return u.a.createElement("div",{className:"pl30",key:kt},u.a.createElement("a",{href:"".concat(ie.a.API_SERVER).concat(rt.url)},u.a.createElement("span",{className:"iconfont icon-fujian c-green font14"}),u.a.createElement("span",{className:"ml10 c-black"},rt.title),u.a.createElement("span",{className:"c-light-black ml20 font12"},rt.filesize)))}),u.a.createElement("aside",{className:"tr"},u.a.createElement("span",{className:" c-light-black"},Y()(Ve.redo_commit_time).format("YYYY-MM-DD HH:mm")),u.a.createElement("span",{className:"ml10"},Ve.commit_user_name),u.a.createElement("span",{className:"ml10 c-light-black"},"\u63D0\u4EA4"),u.a.createElement("span",{className:"ml30 c-light-black"},Y()(Ve.redo_update_time).format("YYYY-MM-DD HH:mm")),u.a.createElement("span",{className:"ml10"},Ve.update_user_name),u.a.createElement("span",{className:"ml10 c-light-black"},"\u66F4\u65B0"))),(Et==null?void 0:Et.revise_reason)&&u.a.createElement("aside",null,u.a.createElement(O.a,null),u.a.createElement("div",{className:"font16"},"\u8865\u4EA4\u5185\u5BB9"),u.a.createElement("div",{className:"pl30 mt20"},u.a.createElement(Te.a,{value:(Et==null?void 0:Et.revise_reason)||"\u6682\u65E0\uFF5E"})),Et==null||((dt=Et.revise_attachments)===null||dt===void 0)?void 0:dt.map(function(rt,kt){return u.a.createElement("div",{className:"pl30",key:kt},u.a.createElement("a",{href:"".concat(ie.a.API_SERVER).concat(rt.url)},u.a.createElement("span",{className:"iconfont icon-fujian c-green font14"}),u.a.createElement("span",{className:"ml10 c-black"},rt.title),u.a.createElement("span",{className:"c-light-black ml20 font12"},rt.filesize)))}),u.a.createElement("aside",{className:"tr"},u.a.createElement("span",{className:"ml30 c-light-black"},Y()(Et.atta_update_time).format("YYYY-MM-DD HH:mm")),u.a.createElement("span",{className:"ml10"},Et.atta_update_user),u.a.createElement("span",{className:"ml10 c-light-black"},"\u66F4\u65B0"))),u.a.createElement(O.a,null),(Ve==null||((it=Ve.project_info)===null||it===void 0)?void 0:it.id)&&u.a.createElement("aside",null,u.a.createElement("div",{className:"font16"},"\u5173\u8054\u9879\u76EE"),u.a.createElement("div",{className:"pl30 mt20"},(Ve==null||((at=Ve.project_info)===null||at===void 0)?void 0:at.id)===-1&&u.a.createElement("span",{className:"c-blue"},Ve==null||((Pe=Ve.project_info)===null||Pe===void 0)?void 0:Pe.name),(Ve==null||((ut=Ve.project_info)===null||ut===void 0)?void 0:ut.id)!==-1&&u.a.createElement("a",{target:"_blank",href:"".concat((tt=ft.navigationInfo)===null||tt===void 0||((ke=tt.top)===null||ke===void 0)?void 0:ke.old_url).concat(Ve==null||((Ge=Ve.project_info)===null||Ge===void 0)?void 0:Ge.id)},Ve==null||((Ee=Ve.project_info)===null||Ee===void 0)?void 0:Ee.name))),u.a.createElement(O.a,null),(Ve==null||((pe=Ve.project_info)===null||pe===void 0)?void 0:pe.id)&&u.a.createElement("aside",null,u.a.createElement("div",{className:"font16"},"\u5168\u90E8\u7EC4\u5458"),u.a.createElement("div",{className:"pl30 mt20"},"\u5F53\u524D\u7EC4\u5458\uFF1A",Ve==null?void 0:Ve.author_name," ",(Ve==null?void 0:Ve.is_leader_work)&&u.a.createElement("span",{className:Le.a.leader},"\u7EC4\u957F"),u.a.createElement("br",null),(Ve==null||((_e=Ve.work_members)===null||_e===void 0)?void 0:_e.length)>0&&u.a.createElement("span",null,"\u5176\u4ED6\u7EC4\u5458\uFF1A",Ve==null||((re=Ve.work_members)===null||re===void 0)?void 0:re.map(function(rt,kt){return Object(se.s)()?u.a.createElement("a",{style:{pointerEvents:"none"}},rt.user_name,(rt==null?void 0:rt.is_leader)&&u.a.createElement("span",{className:Le.a.leader},"\u7EC4\u957F")):u.a.createElement(N.a,{key:kt,className:"mr10",to:"/classrooms/".concat(ht.coursesId,"/group_homework/").concat(ht.commonHomeworkId,"/review/").concat(rt.work_id),target:"_blank"},rt.user_name,(rt==null?void 0:rt.is_leader)&&u.a.createElement("span",{className:Le.a.leader},"\u7EC4\u957F"))}))),!Object(se.s)()&&u.a.createElement("div",{className:"c-grey-999 pl30"},"\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u5176\u4ED6\u7EC4\u5458\u7684\u59D3\u540D\uFF0C\u53EF\u4EE5\u5FEB\u901F\u8BC4\u9605TA\u7684\u4F5C\u54C1"))),(Ve==null?void 0:Ve.anonymous_comment)&&Object(se.e)()&&u.a.createElement("section",null,u.a.createElement("aside",{className:[Le.a.replyList,"bg-white"].join(" ")},u.a.createElement("span",{style:{fontSize:"16px"}},"\u533F\u8BC4\u5B66\u5458"),u.a.createElement("br",null),(Ve==null||((ae=Ve.no_commented_user_names)===null||ae===void 0)?void 0:ae.length)>0&&u.a.createElement("p",{style:{marginTop:"1em"}},"\u672A\u5B8C\u6210\u533F\u8BC4\uFF1A",Ve==null||((he=Ve.no_commented_user_names)===null||he===void 0)?void 0:he.toString()),u.a.createElement("span",{style:{marginTop:(Ve==null||((ge=Ve.no_commented_user_names)===null||ge===void 0)?void 0:ge.length)>0?"":"1em",display:"flex"}},"\u5DF2\u5B8C\u6210\u533F\u8BC4\uFF1A",Ve==null||((be=Ve.commented_user_names)===null||be===void 0)?void 0:be.toString()))),(Object(se.c)()||(Ve==null||((De=Ve.homework_status)===null||De===void 0)?void 0:De.includes("\u533F\u8BC4\u4E2D"))||(Ve==null||((je=Ve.homework_status)===null||je===void 0)?void 0:je.includes("\u7533\u8BC9\u4E2D")))&&u.a.createElement("section",null,u.a.createElement("aside",{className:[Le.a.replyList,"bg-white"].join(" ")},u.a.createElement(m.a,{gutter:[10,20]},u.a.createElement(h.a,{flex:1},u.a.createElement("span",{className:"font-16"},"\u5168\u90E8\u8BC4\u9605(",Xe==null?void 0:Xe.comment_count,")")),u.a.createElement(h.a,{style:{lineHeight:"40px"}},Object(se.c)()&&(Xe==null?void 0:Xe.ultimate)&&u.a.createElement("span",{className:"font-16 c-blue current",onClick:function(){It({type:"shixunHomeworks/setActionTabs",payload:{key:"\u8C03\u5206",selectArrs:Ve,id:ht.userId,params:ht}})}},"\u8C03\u5206")),u.a.createElement(h.a,null)),(!(Xe!=null&&Xe.ultimate)||(Ve==null||((lt=Ve.homework_status)===null||lt===void 0)?void 0:lt.includes("\u533F\u8BC4\u4E2D")))&&!(Xe!=null&&Xe.is_author)&&u.a.createElement("aside",null,u.a.createElement(w.a,{layout:"vertical",form:Zi,onFinish:function(kt){return ln(kt)},initialValues:{same_score:!0}},u.a.createElement(w.a.Item,{label:"\u8BC4\u8BED",name:"comment",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u8BC4\u8BED"}]},u.a.createElement(I.a,{placeholder:"\u8BF7\u5728\u6B64\u8F93\u5165\u5BF9\u672C\u4F5C\u54C1\u7684\u8BC4\u8BED\uFF0C\u6700\u5927\u9650\u52362000\u4E2A\u5B57\u7B26",maxLength:2e3,defaultValue:"",height:200})),u.a.createElement(w.a.Item,{name:"same_score",valuePropName:"checked"},u.a.createElement(G.a,null,"\u6574\u7EC4\u540C\u8BC4(\u9009\u4E2D\uFF0C\u5219\u672C\u6B21\u8BC4\u9605\u5BF9\u8C61\u6307\u5C0F\u7EC4\u5168\u90E8\u6210\u5458\uFF0C\u5426\u5219\u4EC5\u8BC4\u9605\u6B64\u6210\u54581\u4EBA )")),u.a.createElement("div",null,u.a.createElement(w.a.Item,{name:"attachment_ids"},u.a.createElement(le.b,null))),u.a.createElement("div",{className:"mt10"},u.a.createElement(m.a,null,u.a.createElement(h.a,{flex:"1"},u.a.createElement(m.a,{align:"middle",justify:"start"},u.a.createElement(h.a,null,u.a.createElement(w.a.Item,{noStyle:!0,name:"score",rules:[{required:!Object(se.c)(),message:"\u8BF7\u586B\u5199\u5206\u6570"}]},u.a.createElement(U.a,{min:0,step:.1,style:{width:100},size:"large",placeholder:"\u8BF7\u586B\u5199\u5206\u6570"}))),u.a.createElement(h.a,null,u.a.createElement("span",{className:"ml5 mr20"},"\u5206")))))),u.a.createElement("aside",{className:"".concat(Le.a.buttonFixed)},u.a.createElement("aside",{className:"edu-container"},u.a.createElement(m.a,{align:"middle"},u.a.createElement(h.a,{flex:"1"},u.a.createElement($.a,{type:"default",onClick:function(){return qi("list")}},"\u8FD4\u56DE\u5217\u8868")),u.a.createElement(h.a,{flex:"1",className:"tr"},!Object(se.s)()&&u.a.createElement($.a,{type:"default",onClick:function(){return qi("last")},disabled:me==null?void 0:me.last},"\u4E0A\u4E00\u4E2A"),!Object(se.s)()&&u.a.createElement($.a,{type:"default",disabled:A==null?void 0:A.last,style:{marginLeft:"20px",marginRight:"20px"},onClick:function(){return qi("read")}},"\u4E0B\u4E00\u4E2A"),u.a.createElement($.a,{htmlType:"submit",type:"primary"},"\u63D0\u4EA4\u8BC4\u9605"))))))),u.a.createElement(O.a,null),Xe==null||((mt=Xe.comment_scores)===null||mt===void 0)?void 0:mt.map(function(rt,kt){var Jt;return u.a.createElement("aside",{key:kt},u.a.createElement(m.a,{gutter:[12,12],key:kt},u.a.createElement(h.a,{flex:"40px"},u.a.createElement("img",{className:Le.a.headpic,width:"40",src:"".concat(ie.a.IMG_SERVER,"/images/").concat(rt==null?void 0:rt.user_image_url)})),u.a.createElement(h.a,{flex:"1"},u.a.createElement(m.a,{align:"middle"},u.a.createElement(h.a,{span:24},u.a.createElement(m.a,null,u.a.createElement(h.a,{flex:1},u.a.createElement("span",{className:"c-light-black"},rt==null?void 0:rt.user_name),u.a.createElement("span",{className:"c-light-black"},"\uFF08",rt==null?void 0:rt.comment_role,"\uFF09"),u.a.createElement("span",{className:"c-light-black ml10"},Y()(rt==null?void 0:rt.comment_time).format("YYYY-MM-DD HH:mm")),rt.score!==null&&u.a.createElement("span",{className:"ml30 c-orange"},rt.score,"\u5206")),u.a.createElement(h.a,null,kt===0?u.a.createElement("aside",null,rt.delete&&u.a.createElement("span",{className:"c-blue current",onClick:function(){Ni(rt)}},"\u5220\u9664"),rt.can_appeal&&u.a.createElement("span",{className:"c-blue current",onClick:function(){Ri(!0)}},"\u7533\u8BC9"),rt.can_reply&&u.a.createElement("span",{className:"c-blue current ml10",onClick:function(){return Ri(!0)}},"\u56DE\u590D")):u.a.createElement("aside",null,rt.delete&&u.a.createElement("span",{className:"c-blue current",onClick:function(){Ni(rt)}},"\u5220\u9664"),rt.can_appeal&&u.a.createElement("span",{className:"c-blue current",onClick:function(){Ri(!0)}},"\u7533\u8BC9"),rt.can_reply&&u.a.createElement("span",{className:"c-blue current ml10",onClick:function(){return Ri(!0)}},"\u56DE\u590D"),!rt.can_reply&&u.a.createElement("span",{className:"c-light-black ml10"},"\u5931\u6548"))))),u.a.createElement(h.a,{span:24},rt.content&&u.a.createElement(Te.a,{value:rt.content}),!rt.content&&u.a.createElement("span",{className:"c-light-black"},"\u6682\u672A\u5199\u8BC4\u8BED"),rt==null||((Jt=rt.attachments)===null||Jt===void 0)?void 0:Jt.map(function(wt,$t){return u.a.createElement("div",{key:$t},u.a.createElement("a",{href:"".concat(ie.a.API_SERVER).concat(wt.url)},u.a.createElement("span",{className:"iconfont icon-fujian c-green font14"}),u.a.createElement("span",{className:"ml10 c-black"},wt.title),u.a.createElement("span",{className:"c-light-black ml20 font12"},wt.filesize)))})),rt.journals!=""&&u.a.createElement("div",{className:"w100"},u.a.createElement(O.a,null),u.a.createElement("aside",{className:[Le.a.comment,"w100"].join(" ")},rt.journals.map(function(wt,$t){var Vt,jt;return u.a.createElement("aside",{key:$t},u.a.createElement(m.a,{key:$t},u.a.createElement(h.a,{span:24},u.a.createElement(m.a,null,u.a.createElement(h.a,{flex:"50px"},u.a.createElement("img",{className:Le.a.headpic,width:"40",src:"".concat(ie.a.IMG_SERVER,"/images/").concat(wt==null||((Vt=wt.user_info)===null||Vt===void 0)?void 0:Vt.user_image_url)})),u.a.createElement(h.a,{flex:"1"},wt==null||((jt=wt.user_info)===null||jt===void 0)?void 0:jt.user_name,u.a.createElement("span",{className:"c-light-black ml10"},Y()(wt==null?void 0:wt.time).format("YYYY-MM-DD HH:mm")),u.a.createElement("br",null),u.a.createElement("strong",null,u.a.createElement(Te.a,{value:wt.content}))),u.a.createElement(h.a,null,u.a.createElement(Z.a,{title:"\u5220\u9664"},u.a.createElement(H.a,{className:"current c-light-black",onClick:function(){pi(wt)}})))))),u.a.createElement(O.a,null))})))),Hi&&kt===0&&u.a.createElement("aside",{className:["bg-white"].join(" ")},u.a.createElement(I.a,{onChange:function($t){nn($t)},height:150,isFocus:!0,watch:!0}),u.a.createElement(m.a,null,u.a.createElement(h.a,{span:24,className:"tr"},u.a.createElement($.a,{type:"default",size:"large",onClick:Object(s.a)(_.a.mark(function wt(){return _.a.wrap(function(Vt){for(;;)switch(Vt.prev=Vt.next){case 0:Ri(!1);case 1:case"end":return Vt.stop()}},wt)}))},"\u53D6\u6D88"),u.a.createElement($.a,{type:"primary",size:"large",className:"ml20",onClick:Object(s.a)(_.a.mark(function wt(){var $t;return _.a.wrap(function(jt){for(;;)switch(jt.prev=jt.next){case 0:if(!(ji==="")){jt.next=4;break}r.b.error("\u8BF7\u8F93\u5165\u5185\u5BB9"),jt.next=8;break;case 4:return jt.next=6,Object(xe.f)({comment:ji,userId:ht.userId,score_id:rt.score_id});case 6:$t=jt.sent,$t.status===0&&(r.b.success("\u64CD\u4F5C\u6210\u529F"),Ri(!1),ui());case 8:case"end":return jt.stop()}},wt)}))},"\u4FDD\u5B58")))))),u.a.createElement(O.a,null))}))),u.a.createElement(fe,null),u.a.createElement(de,null),u.a.createElement(j.a,null),u.a.createElement(R.a,{title:"\u786E\u8BA4\u6253\u56DE\u91CD\u505A",visible:ze,destroyOnClose:!0,forceRender:!0,onCancel:function(){xt(!1)},onOk:Object(s.a)(_.a.mark(function rt(){var kt;return _.a.wrap(function(wt){for(;;)switch(wt.prev=wt.next){case 0:if(ki){wt.next=3;break}return r.b.info("\u8BC4\u8BED\u4E0D\u80FD\u4E3A\u7A7A"),wt.abrupt("return");case 3:return wt.next=5,Object(Ce.a)("/api/student_works/".concat(ht.userId,"/redo_modal.json"),{method:"post",body:{comment:ki,id:ht.userId}});case 5:kt=wt.sent,(kt==null?void 0:kt.status)===0&&(r.b.info("\u6253\u56DE\u91CD\u505A\u6210\u529F"),xt(!1),ui());case 7:case"end":return wt.stop()}},rt)})),width:700},u.a.createElement("div",{style:{padding:"32px"}},u.a.createElement("span",null,"\u786E\u8BA4\u5C06",Ve==null?void 0:Ve.author_name,"\u7684\u4F5C\u4E1A\u6253\u56DE\u91CD\u505A\u5417"),u.a.createElement("div",{style:{marginTop:"20px"}},u.a.createElement("label",null,u.a.createElement("span",{style:{marginRight:"5px",color:"red"}},"*"),"\u8BC4\u8BED\uFF1A"),u.a.createElement(I.a,{className:Le.a.MdEditor,onChange:function(kt){return xi(kt)},defaultValue:"",height:250})))),mn)},Fe=Je.default=Object(E.a)(function(Ne){var Me=Ne.shixunHomeworks,$e=Ne.loading,et=Ne.user,Qe=Ne.globalSetting;return{shixunHomeworks:Me,globalSetting:Qe,user:et,loading:$e.effects}})(We)},"T/ev":function(_t,Je,ne){_t.exports={flex_box_center:"flex_box_center___YeRn8",flex_space_between:"flex_space_between___1Koq4",flex_box_vertical_center:"flex_box_vertical_center___iwltW",flex_box_center_end:"flex_box_center_end___Wt8Ci",flex_box_column:"flex_box_column___1_Hpq",bg:"bg___DLoEi",title:"title___Rt3xF",replyList:"replyList___1-Na2",leader:"leader___2AO79",buttonFixed:"buttonFixed___LfzzJ",exitComment:"exitComment___1F28w",nextComment:"nextComment___3Jkyg",modal:"modal___1isyX",MdEditor:"MdEditor___3xy6-"}},TXwP:function(_t,Je,ne){var ue,Z;(function(){var P;(function(){"use strict";var B=[,,function(M){function O(p){this.__parent=p,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}O.prototype.clone_empty=function(){var p=new O(this.__parent);return p.set_indent(this.__indent_count,this.__alignment_count),p},O.prototype.item=function(p){return p<0?this.__items[this.__items.length+p]:this.__items[p]},O.prototype.has_match=function(p){for(var h=this.__items.length-1;h>=0;h--)if(this.__items[h].match(p))return!0;return!1},O.prototype.set_indent=function(p,h){this.is_empty()&&(this.__indent_count=p||0,this.__alignment_count=h||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},O.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},O.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},O.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var p=this.__parent.current_line;return p.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),p.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),p.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,p.__items[0]===" "&&(p.__items.splice(0,1),p.__character_count-=1),!0}return!1},O.prototype.is_empty=function(){return this.__items.length===0},O.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},O.prototype.push=function(p){this.__items.push(p);var h=p.lastIndexOf(`
`);h!==-1?this.__character_count=p.length-h:this.__character_count+=p.length},O.prototype.pop=function(){var p=null;return this.is_empty()||(p=this.__items.pop(),this.__character_count-=p.length),p},O.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},O.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},O.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},O.prototype.toString=function(){var p="";return this.is_empty()?this.__parent.indent_empty_lines&&(p=this.__parent.get_indent_string(this.__indent_count)):(p=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),p+=this.__items.join("")),p};function v(p,h){this.__cache=[""],this.__indent_size=p.indent_size,this.__indent_string=p.indent_char,p.indent_with_tabs||(this.__indent_string=new Array(p.indent_size+1).join(p.indent_char)),h=h||"",p.indent_level>0&&(h=new Array(p.indent_level+1).join(this.__indent_string)),this.__base_string=h,this.__base_string_length=h.length}v.prototype.get_indent_size=function(p,h){var o=this.__base_string_length;return h=h||0,p<0&&(o=0),o+=p*this.__indent_size,o+=h,o},v.prototype.get_indent_string=function(p,h){var o=this.__base_string;return h=h||0,p<0&&(p=0,o=""),h+=p*this.__indent_size,this.__ensure_cache(h),o+=this.__cache[h],o},v.prototype.__ensure_cache=function(p){for(;p>=this.__cache.length;)this.__add_column()},v.prototype.__add_column=function(){var p=this.__cache.length,h=0,o="";this.__indent_size&&p>=this.__indent_size&&(h=Math.floor(p/this.__indent_size),p-=h*this.__indent_size,o=new Array(h+1).join(this.__indent_string)),p&&(o+=new Array(p+1).join(" ")),this.__cache.push(o)};function m(p,h){this.__indent_cache=new v(p,h),this.raw=!1,this._end_with_newline=p.end_with_newline,this.indent_size=p.indent_size,this.wrap_line_length=p.wrap_line_length,this.indent_empty_lines=p.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new O(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}m.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},m.prototype.get_line_number=function(){return this.__lines.length},m.prototype.get_indent_string=function(p,h){return this.__indent_cache.get_indent_string(p,h)},m.prototype.get_indent_size=function(p,h){return this.__indent_cache.get_indent_size(p,h)},m.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},m.prototype.add_new_line=function(p){return this.is_empty()||!p&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},m.prototype.get_code=function(p){this.trim(!0);var h=this.current_line.pop();h&&(h[h.length-1]===`
`&&(h=h.replace(/\n+$/g,"")),this.current_line.push(h)),this._end_with_newline&&this.__add_outputline();var o=this.__lines.join(`
`);return p!==`
`&&(o=o.replace(/[\n]/g,p)),o},m.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},m.prototype.set_indent=function(p,h){return p=p||0,h=h||0,this.next_line.set_indent(p,h),this.__lines.length>1?(this.current_line.set_indent(p,h),!0):(this.current_line.set_indent(),!1)},m.prototype.add_raw_token=function(p){for(var h=0;h<p.newlines;h++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(p.whitespace_before),this.current_line.push(p.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},m.prototype.add_token=function(p){this.__add_space_before_token(),this.current_line.push(p),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},m.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},m.prototype.remove_indent=function(p){for(var h=this.__lines.length;p<h;)this.__lines[p]._remove_indent(),p++;this.current_line._remove_wrap_indent()},m.prototype.trim=function(p){for(p=p===void 0?!1:p,this.current_line.trim();p&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},m.prototype.just_added_newline=function(){return this.current_line.is_empty()},m.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},m.prototype.ensure_empty_line_above=function(p,h){for(var o=this.__lines.length-2;o>=0;){var f=this.__lines[o];if(f.is_empty())break;if(f.item(0).indexOf(p)!==0&&f.item(-1)!==h){this.__lines.splice(o+1,0,new O(this)),this.previous_line=this.__lines[this.__lines.length-2];break}o--}},M.exports.Output=m},,,,function(M){function O(p,h){this.raw_options=v(p,h),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}O.prototype._get_array=function(p,h){var o=this.raw_options[p],f=h||[];return typeof o=="object"?o!==null&&typeof o.concat=="function"&&(f=o.concat()):typeof o=="string"&&(f=o.split(/[^a-zA-Z0-9_\/\-]+/)),f},O.prototype._get_boolean=function(p,h){var o=this.raw_options[p],f=o===void 0?!!h:!!o;return f},O.prototype._get_characters=function(p,h){var o=this.raw_options[p],f=h||"";return typeof o=="string"&&(f=o.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),f},O.prototype._get_number=function(p,h){var o=this.raw_options[p];h=parseInt(h,10),isNaN(h)&&(h=0);var f=parseInt(o,10);return isNaN(f)&&(f=h),f},O.prototype._get_selection=function(p,h,o){var f=this._get_selection_list(p,h,o);if(f.length!==1)throw new Error("Invalid Option Value: The option '"+p+`' can only be one of the following values:
`+h+`
You passed in: '`+this.raw_options[p]+"'");return f[0]},O.prototype._get_selection_list=function(p,h,o){if(!h||h.length===0)throw new Error("Selection list cannot be empty.");if(o=o||[h[0]],!this._is_valid_selection(o,h))throw new Error("Invalid Default Value!");var f=this._get_array(p,o);if(!this._is_valid_selection(f,h))throw new Error("Invalid Option Value: The option '"+p+`' can contain only the following values:
`+h+`
You passed in: '`+this.raw_options[p]+"'");return f},O.prototype._is_valid_selection=function(p,h){return p.length&&h.length&&!p.some(function(o){return h.indexOf(o)===-1})};function v(p,h){var o={};p=m(p);var f;for(f in p)f!==h&&(o[f]=p[f]);if(h&&p[h])for(f in p[h])o[f]=p[h][f];return o}function m(p){var h={},o;for(o in p){var f=o.replace(/-/g,"_");h[f]=p[o]}return h}M.exports.Options=O,M.exports.normalizeOpts=m,M.exports.mergeOpts=v},,function(M){var O=RegExp.prototype.hasOwnProperty("sticky");function v(m){this.__input=m||"",this.__input_length=this.__input.length,this.__position=0}v.prototype.restart=function(){this.__position=0},v.prototype.back=function(){this.__position>0&&(this.__position-=1)},v.prototype.hasNext=function(){return this.__position<this.__input_length},v.prototype.next=function(){var m=null;return this.hasNext()&&(m=this.__input.charAt(this.__position),this.__position+=1),m},v.prototype.peek=function(m){var p=null;return m=m||0,m+=this.__position,m>=0&&m<this.__input_length&&(p=this.__input.charAt(m)),p},v.prototype.__match=function(m,p){m.lastIndex=p;var h=m.exec(this.__input);return h&&!(O&&m.sticky)&&(h.index!==p&&(h=null)),h},v.prototype.test=function(m,p){return p=p||0,p+=this.__position,p>=0&&p<this.__input_length?!!this.__match(m,p):!1},v.prototype.testChar=function(m,p){var h=this.peek(p);return m.lastIndex=0,h!==null&&m.test(h)},v.prototype.match=function(m){var p=this.__match(m,this.__position);return p?this.__position+=p[0].length:p=null,p},v.prototype.read=function(m,p,h){var o="",f;return m&&(f=this.match(m),f&&(o+=f[0])),p&&(f||!m)&&(o+=this.readUntil(p,h)),o},v.prototype.readUntil=function(m,p){var h="",o=this.__position;m.lastIndex=this.__position;var f=m.exec(this.__input);return f?(o=f.index,p&&(o+=f[0].length)):o=this.__input_length,h=this.__input.substring(this.__position,o),this.__position=o,h},v.prototype.readUntilAfter=function(m){return this.readUntil(m,!0)},v.prototype.get_regexp=function(m,p){var h=null,o="g";return p&&O&&(o="y"),typeof m=="string"&&m!==""?h=new RegExp(m,o):m&&(h=new RegExp(m.source,o)),h},v.prototype.get_literal_regexp=function(m){return RegExp(m.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},v.prototype.peekUntilAfter=function(m){var p=this.__position,h=this.readUntilAfter(m);return this.__position=p,h},v.prototype.lookBack=function(m){var p=this.__position-1;return p>=m.length&&this.__input.substring(p-m.length,p).toLowerCase()===m},M.exports.InputScanner=v},,,,,function(M){function O(v,m){v=typeof v=="string"?v:v.source,m=typeof m=="string"?m:m.source,this.__directives_block_pattern=new RegExp(v+/ beautify( \w+[:]\w+)+ /.source+m,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(v+/\sbeautify\signore:end\s/.source+m,"g")}O.prototype.get_directives=function(v){if(!v.match(this.__directives_block_pattern))return null;var m={};this.__directive_pattern.lastIndex=0;for(var p=this.__directive_pattern.exec(v);p;)m[p[1]]=p[2],p=this.__directive_pattern.exec(v);return m},O.prototype.readIgnored=function(v){return v.readUntilAfter(this.__directives_end_ignore_pattern)},M.exports.Directives=O},,function(M,O,v){var m=v(16).Beautifier,p=v(17).Options;function h(o,f){var l=new m(o,f);return l.beautify()}M.exports=h,M.exports.defaultOptions=function(){return new p}},function(M,O,v){var m=v(17).Options,p=v(2).Output,h=v(8).InputScanner,o=v(13).Directives,f=new o(/\/\*/,/\*\//),l=/\r\n|[\r\n]/,r=/\r\n|[\r\n]/g,s=/\s/,c=/(?:\s|\n)+/g,L=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,w=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function T(R,C){this._source_text=R||"",this._options=new m(C),this._ch=null,this._input=null,this.NESTED_AT_RULE={"@page":!0,"@font-face":!0,"@keyframes":!0,"@media":!0,"@supports":!0,"@document":!0},this.CONDITIONAL_GROUP_RULE={"@media":!0,"@supports":!0,"@document":!0},this.NON_SEMICOLON_NEWLINE_PROPERTY=["grid-template-areas","grid-template"]}T.prototype.eatString=function(R){var C="";for(this._ch=this._input.next();this._ch;){if(C+=this._ch,this._ch==="\\")C+=this._input.next();else if(R.indexOf(this._ch)!==-1||this._ch===`
`)break;this._ch=this._input.next()}return C},T.prototype.eatWhitespace=function(R){for(var C=s.test(this._input.peek()),S=0;s.test(this._input.peek());)this._ch=this._input.next(),R&&this._ch===`
`&&((S===0||S<this._options.max_preserve_newlines)&&(S++,this._output.add_new_line(!0)));return C},T.prototype.foundNestedPseudoClass=function(){for(var R=0,C=1,S=this._input.peek(C);S;){if(S==="{")return!0;if(S==="(")R+=1;else if(S===")"){if(R===0)return!1;R-=1}else if(S===";"||S==="}")return!1;C++,S=this._input.peek(C)}return!1},T.prototype.print_string=function(R){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(R)},T.prototype.preserveSingleSpace=function(R){R&&(this._output.space_before_token=!0)},T.prototype.indent=function(){this._indentLevel++},T.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},T.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var R=this._source_text,C=this._options.eol;C==="auto"&&(C=`
`,R&&l.test(R||"")&&(C=R.match(l)[0])),R=R.replace(r,`
`);var S=R.match(/^[\t ]*/)[0];this._output=new p(this._options,S),this._input=new h(R),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var x=0,_=!1,d=!1,u=!1,g=!1,E=!1,N=!1,D=this._ch,H=!1,j,I,b;j=this._input.read(c),I=j!=="",b=D,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),D=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var W=this._input.read(L),Y=f.get_directives(W);Y&&Y.ignore==="start"&&(W+=f.readIgnored(this._input)),this.print_string(W),this.eatWhitespace(!0),this._output.add_new_line()}else if(this._ch==="/"&&this._input.peek()==="/")this._output.space_before_token=!0,this._input.back(),this.print_string(this._input.read(w)),this.eatWhitespace(!0);else if(this._ch==="@"||this._ch==="$")if(this.preserveSingleSpace(I),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var ie=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);ie.match(/[ :]$/)&&(ie=this.eatString(": ").replace(/\s$/,""),this.print_string(ie),this._output.space_before_token=!0),ie=ie.replace(/\s$/,""),ie==="extend"?g=!0:ie==="import"&&(E=!0),ie in this.NESTED_AT_RULE?(this._nestedLevel+=1,ie in this.CONDITIONAL_GROUP_RULE&&(u=!0)):!_&&x===0&&ie.indexOf(":")!==-1&&(d=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(I),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")d&&(d=!1,this.outdent()),u?(u=!1,_=this._indentLevel>=this._nestedLevel):_=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&_&&(this._output.previous_line&&this._output.previous_line.item(-1)!=="{"&&this._output.ensure_empty_line_above("/",",")),this._output.space_before_token=!0,this._options.brace_style==="expand"?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):(b==="("?this._output.space_before_token=!1:b!==","&&this.indent(),this.print_string(this._ch)),this.eatWhitespace(!0),this._output.add_new_line();else if(this._ch==="}")this.outdent(),this._output.add_new_line(),b==="{"&&this._output.trim(!0),E=!1,g=!1,d&&(this.outdent(),d=!1),this.print_string(this._ch),_=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&(this._input.peek()!=="}"&&this._output.add_new_line(!0)),this._input.peek()===")"&&(this._output.trim(!0),this._options.brace_style==="expand"&&this._output.add_new_line(!0));else if(this._ch===":"){for(var oe=0;oe<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;oe++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[oe])){H=!0;break}(_||u)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!g&&x===0?(this.print_string(":"),d||(d=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var xe=b==='"'||b==="'";this.preserveSingleSpace(xe||I),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")H=!1,x===0?(d&&(this.outdent(),d=!1),g=!1,E=!1,this.print_string(this._ch),this.eatWhitespace(!0),this._input.peek()!=="/"&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if(this._ch==="(")if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),x++,this.indent(),this._ch=this._input.next(),this._ch===")"||this._ch==='"'||this._ch==="'"?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),x&&(x--,this.outdent()));else{var ve=!1;this._input.lookBack("with")&&(ve=!0),this.preserveSingleSpace(I||ve),this.print_string(this._ch),d&&b==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),N=!0):(this.eatWhitespace(),x++,this.indent())}else if(this._ch===")")x&&(x--,this.outdent()),N&&this._input.peek()===";"&&this._options.selector_separator_newline&&(N=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(this._ch===",")this.print_string(this._ch),this.eatWhitespace(!0),this._options.selector_separator_newline&&(!d||N)&&x===0&&!E&&!g?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!d&&x===0)this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&s.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(I),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),s.test(this._ch)&&(this._ch="");else if(this._ch==="!"&&!this._input.lookBack("\\"))this._output.space_before_token=!0,this.print_string(this._ch);else{var we=b==='"'||b==="'";this.preserveSingleSpace(we||I),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
`&&H&&this._output.add_new_line()}var Ce=this._output.get_code(C);return Ce},M.exports.Beautifier=T},function(M,O,v){var m=v(6).Options;function p(h){m.call(this,h,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var o=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||o;var f=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var l=0;l<f.length;l++)f[l]!=="expand"?this.brace_style="collapse":this.brace_style=f[l]}p.prototype=new m,M.exports.Options=p}],U={};function K(M){var O=U[M];if(O!==void 0)return O.exports;var v=U[M]={exports:{}};return B[M](v,v.exports,K),v.exports}var G=K(15);P=G})();var $=P;!(ue=[],Z=function(){return{css_beautify:$}}.apply(Je,ue),Z!==void 0&&(_t.exports=Z))})()},UZu5:function(_t,Je,ne){},"VrN/":function(_t,Je,ne){(function(ue,Z){_t.exports=Z()})(this,function(){"use strict";var ue=navigator.userAgent,Z=navigator.platform,P=/gecko\/\d/i.test(ue),$=/MSIE \d/.test(ue),B=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ue),U=/Edge\/(\d+)/.exec(ue),K=$||B||U,G=K&&($?document.documentMode||6:+(U||B)[1]),M=!U&&/WebKit\//.test(ue),O=M&&/Qt\/\d+\.\d+/.test(ue),v=!U&&/Chrome\//.test(ue),m=/Opera\//.test(ue),p=/Apple Computer/.test(navigator.vendor),h=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ue),o=/PhantomJS/.test(ue),f=!U&&/AppleWebKit/.test(ue)&&/Mobile\/\w+/.test(ue),l=/Android/.test(ue),r=f||l||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ue),s=f||/Mac/.test(Z),c=/\bCrOS\b/.test(ue),L=/win/i.test(Z),w=m&&ue.match(/Version\/(\d*\.\d*)/);w&&(w=Number(w[1])),w&&w>=15&&(m=!1,M=!0);var T=s&&(O||m&&(w==null||w<12.11)),R=P||K&&G>=9;function C(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var S=function(e,t){var n=e.className,i=C(t).exec(n);if(i){var a=n.slice(i.index+i[0].length);e.className=n.slice(0,i.index)+(a?i[1]+a:"")}};function x(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function _(e,t){return x(e).appendChild(t)}function d(e,t,n,i){var a=document.createElement(e);if(n&&(a.className=n),i&&(a.style.cssText=i),typeof t=="string")a.appendChild(document.createTextNode(t));else if(t)for(var k=0;k<t.length;++k)a.appendChild(t[k]);return a}function u(e,t,n,i){var a=d(e,t,n,i);return a.setAttribute("role","presentation"),a}var g;document.createRange?g=function(e,t,n,i){var a=document.createRange();return a.setEnd(i||e,n),a.setStart(e,t),a}:g=function(e,t,n){var i=document.body.createTextRange();try{i.moveToElementText(e.parentNode)}catch(a){return i}return i.collapse(!0),i.moveEnd("character",n),i.moveStart("character",t),i};function E(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 N(){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 D(e,t){var n=e.className;C(t).test(n)||(e.className+=(n?" ":"")+t)}function H(e,t){for(var n=e.split(" "),i=0;i<n.length;i++)n[i]&&!C(n[i]).test(t)&&(t+=" "+n[i]);return t}var j=function(e){e.select()};f?j=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:K&&(j=function(e){try{e.select()}catch(t){}});function I(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function b(e,t,n){t||(t={});for(var i in e)e.hasOwnProperty(i)&&(n!==!1||!t.hasOwnProperty(i))&&(t[i]=e[i]);return t}function W(e,t,n,i,a){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var k=i||0,z=a||0;;){var J=e.indexOf(" ",k);if(J<0||J>=t)return z+(t-k);z+=J-k,z+=n-z%n,k=J+1}}var Y=function(){this.id=null,this.f=null,this.time=0,this.handler=I(this.onTimeout,this)};Y.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Y.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 ie(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var oe=50,xe={toString:function(){return"CodeMirror.Pass"}},ve={scroll:!1},we={origin:"*mouse"},Ce={origin:"+move"};function Se(e,t,n){for(var i=0,a=0;;){var k=e.indexOf(" ",i);k==-1&&(k=e.length);var z=k-i;if(k==e.length||a+z>=t)return i+Math.min(z,t-a);if(a+=k-i,a+=n-a%n,i=k+1,a>=t)return i}}var fe=[""];function le(e){for(;fe.length<=e;)fe.push(te(fe)+" ");return fe[e]}function te(e){return e[e.length-1]}function de(e,t){for(var n=[],i=0;i<e.length;i++)n[i]=t(e[i],i);return n}function se(e,t,n){for(var i=0,a=n(t);i<e.length&&n(e[i])<=a;)i++;e.splice(i,0,t)}function Re(){}function Le(e,t){var n;return Object.create?n=Object.create(e):(Re.prototype=e,n=new Re),t&&b(t,n),n}var Te=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Ie(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Te.test(e))}function Ue(e,t){return t?t.source.indexOf("\\w")>-1&&Ie(e)?!0:t.test(e):Ie(e)}function We(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Fe=/[\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 Ne(e){return e.charCodeAt(0)>=768&&Fe.test(e)}function Me(e,t,n){for(;(n<0?t>0:t<e.length)&&Ne(e.charAt(t));)t+=n;return t}function $e(e,t,n){for(var i=t>n?-1:1;;){if(t==n)return t;var a=(t+n)/2,k=i<0?Math.ceil(a):Math.floor(a);if(k==t)return e(k)?t:n;e(k)?n=k:t=k+i}}function et(e,t,n,i){if(!e)return i(t,n,"ltr",0);for(var a=!1,k=0;k<e.length;++k){var z=e[k];(z.from<n&&z.to>t||t==n&&z.to==t)&&(i(Math.max(z.from,t),Math.min(z.to,n),z.level==1?"rtl":"ltr",k),a=!0)}a||i(t,n,"ltr")}var Qe=null;function Ze(e,t,n){var i;Qe=null;for(var a=0;a<e.length;++a){var k=e[a];if(k.from<t&&k.to>t)return a;k.to==t&&(k.from!=k.to&&n=="before"?i=a:Qe=a),k.from==t&&(k.from!=k.to&&n!="before"?i=a:Qe=a)}return i!=null?i:Qe}var dt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(ee){return ee<=247?e.charAt(ee):1424<=ee&&ee<=1524?"R":1536<=ee&&ee<=1785?t.charAt(ee-1536):1774<=ee&&ee<=2220?"r":8192<=ee&&ee<=8203?"w":ee==8204?"b":"L"}var i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,a=/[stwN]/,k=/[LRr]/,z=/[Lb1n]/,J=/[1n]/;function Q(ee,ce,ye){this.level=ee,this.from=ce,this.to=ye}return function(ee,ce){var ye=ce=="ltr"?"L":"R";if(ee.length==0||ce=="ltr"&&!i.test(ee))return!1;for(var Oe=ee.length,Ae=[],Be=0;Be<Oe;++Be)Ae.push(n(ee.charCodeAt(Be)));for(var Ke=0,qe=ye;Ke<Oe;++Ke){var st=Ae[Ke];st=="m"?Ae[Ke]=qe:qe=st}for(var ct=0,ot=ye;ct<Oe;++ct){var gt=Ae[ct];gt=="1"&&ot=="r"?Ae[ct]="n":k.test(gt)&&(ot=gt,gt=="r"&&(Ae[ct]="R"))}for(var At=1,Tt=Ae[0];At<Oe-1;++At){var Nt=Ae[At];Nt=="+"&&Tt=="1"&&Ae[At+1]=="1"?Ae[At]="1":Nt==","&&Tt==Ae[At+1]&&(Tt=="1"||Tt=="n")&&(Ae[At]=Tt),Tt=Nt}for(var ai=0;ai<Oe;++ai){var Ci=Ae[ai];if(Ci==",")Ae[ai]="N";else if(Ci=="%"){var hi=void 0;for(hi=ai+1;hi<Oe&&Ae[hi]=="%";++hi);for(var Ji=ai&&Ae[ai-1]=="!"||hi<Oe&&Ae[hi]=="1"?"1":"N",Vi=ai;Vi<hi;++Vi)Ae[Vi]=Ji;ai=hi-1}}for(var gi=0,Xi=ye;gi<Oe;++gi){var Ii=Ae[gi];Xi=="L"&&Ii=="1"?Ae[gi]="L":k.test(Ii)&&(Xi=Ii)}for(var bi=0;bi<Oe;++bi)if(a.test(Ae[bi])){var vi=void 0;for(vi=bi+1;vi<Oe&&a.test(Ae[vi]);++vi);for(var di=(bi?Ae[bi-1]:ye)=="L",Yi=(vi<Oe?Ae[vi]:ye)=="L",hr=di==Yi?di?"L":"R":ye,Nn=bi;Nn<vi;++Nn)Ae[Nn]=hr;bi=vi-1}for(var Mi=[],xn,Ai=0;Ai<Oe;)if(z.test(Ae[Ai])){var Va=Ai;for(++Ai;Ai<Oe&&z.test(Ae[Ai]);++Ai);Mi.push(new Q(0,Va,Ai))}else{var Cn=Ai,Vn=Mi.length,Xn=ce=="rtl"?1:0;for(++Ai;Ai<Oe&&Ae[Ai]!="L";++Ai);for(var Bi=Cn;Bi<Ai;)if(J.test(Ae[Bi])){Cn<Bi&&(Mi.splice(Vn,0,new Q(1,Cn,Bi)),Vn+=Xn);var dr=Bi;for(++Bi;Bi<Ai&&J.test(Ae[Bi]);++Bi);Mi.splice(Vn,0,new Q(2,dr,Bi)),Vn+=Xn,Cn=Bi}else++Bi;Cn<Ai&&Mi.splice(Vn,0,new Q(1,Cn,Ai))}return ce=="ltr"&&(Mi[0].level==1&&(xn=ee.match(/^\s+/))&&(Mi[0].from=xn[0].length,Mi.unshift(new Q(0,0,xn[0].length))),te(Mi).level==1&&(xn=ee.match(/\s+$/))&&(te(Mi).to-=xn[0].length,Mi.push(new Q(0,Oe-xn[0].length,Oe)))),ce=="rtl"?Mi.reverse():Mi}}();function it(e,t){var n=e.order;return n==null&&(n=e.order=dt(e.text,t)),n}var at=[],Pe=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var i=e._handlers||(e._handlers={});i[t]=(i[t]||at).concat(n)}};function ut(e,t){return e._handlers&&e._handlers[t]||at}function tt(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var i=e._handlers,a=i&&i[t];if(a){var k=ie(a,n);k>-1&&(i[t]=a.slice(0,k).concat(a.slice(k+1)))}}}function ke(e,t){var n=ut(e,t);if(!n.length)return;for(var i=Array.prototype.slice.call(arguments,2),a=0;a<n.length;++a)n[a].apply(null,i)}function Ge(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),ke(e,n||t.type,e,t),he(t)||t.codemirrorIgnore}function Ee(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),i=0;i<t.length;++i)ie(n,t[i])==-1&&n.push(t[i])}function pe(e,t){return ut(e,t).length>0}function _e(e){e.prototype.on=function(t,n){Pe(this,t,n)},e.prototype.off=function(t,n){tt(this,t,n)}}function re(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ae(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function he(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ge(e){re(e),ae(e)}function be(e){return e.target||e.srcElement}function De(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),s&&e.ctrlKey&&t==1&&(t=3),t}var je=function(){if(K&&G<9)return!1;var e=d("div");return"draggable"in e||"dragDrop"in e}(),lt;function mt(e){if(lt==null){var t=d("span","\u200B");_(e,d("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(lt=t.offsetWidth<=1&&t.offsetHeight>2&&!(K&&G<8))}var n=lt?d("span","\u200B"):d("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var pt;function Ot(e){if(pt!=null)return pt;var t=_(e,document.createTextNode("A\u062EA")),n=g(t,0,1).getBoundingClientRect(),i=g(t,1,2).getBoundingClientRect();return x(e),!n||n.left==n.right?!1:pt=i.right-n.right<3}var Rt=`
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],i=e.length;t<=i;){var a=e.indexOf(`
`,t);a==-1&&(a=e.length);var k=e.slice(t,e.charAt(a-1)=="\r"?a-1:a),z=k.indexOf("\r");z!=-1?(n.push(k.slice(0,z)),t+=z+1):(n.push(k),t=a+1)}return n}:function(e){return e.split(/\r\n?|\n/)},ft=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},It=function(){var e=d("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Bt=null;function ht(e){if(Bt!=null)return Bt;var t=_(e,d("span","x")),n=t.getBoundingClientRect(),i=g(t,0,1).getBoundingClientRect();return Bt=Math.abs(n.left-i.left)>1}var ei={},Ut={};function fi(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),ei[e]=t}function Ve(e,t){Ut[e]=t}function Xe(e){if(typeof e=="string"&&Ut.hasOwnProperty(e))e=Ut[e];else if(e&&typeof e.name=="string"&&Ut.hasOwnProperty(e.name)){var t=Ut[e.name];typeof t=="string"&&(t={name:t}),e=Le(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Xe("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Xe("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Et(e,t){t=Xe(t);var n=ei[t.name];if(!n)return Et(e,"text/plain");var i=n(e,t);if(Dt.hasOwnProperty(t.name)){var a=Dt[t.name];for(var k in a){if(!a.hasOwnProperty(k))continue;i.hasOwnProperty(k)&&(i["_"+k]=i[k]),i[k]=a[k]}}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var z in t.modeProps)i[z]=t.modeProps[z];return i}var Dt={};function Pt(e,t){var n=Dt.hasOwnProperty(e)?Dt[e]:Dt[e]={};b(t,n)}function si(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var i in t){var a=t[i];a instanceof Array&&(a=a.concat([])),n[i]=a}return n}function an(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 sn(e,t,n){return e.startState?e.startState(t,n):!0}var zt=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};zt.prototype.eol=function(){return this.pos>=this.string.length},zt.prototype.sol=function(){return this.pos==this.lineStart},zt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},zt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},zt.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},zt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},zt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},zt.prototype.skipToEnd=function(){this.pos=this.string.length},zt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},zt.prototype.backUp=function(e){this.pos-=e},zt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=W(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?W(this.string,this.lineStart,this.tabSize):0)},zt.prototype.indentation=function(){return W(this.string,null,this.tabSize)-(this.lineStart?W(this.string,this.lineStart,this.tabSize):0)},zt.prototype.match=function(e,t,n){if(typeof e=="string"){var i=function(z){return n?z.toLowerCase():z},a=this.string.substr(this.pos,e.length);if(i(a)==i(e))return t!==!1&&(this.pos+=e.length),!0}else{var k=this.string.slice(this.pos).match(e);return k&&k.index>0?null:(k&&t!==!1&&(this.pos+=k[0].length),k)}},zt.prototype.current=function(){return this.string.slice(this.start,this.pos)},zt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},zt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},zt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function vt(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 i=0;;++i){var a=n.children[i],k=a.chunkSize();if(t<k){n=a;break}t-=k}return n.lines[t]}function ji(e,t,n){var i=[],a=t.line;return e.iter(t.line,n.line+1,function(k){var z=k.text;a==n.line&&(z=z.slice(0,n.ch)),a==t.line&&(z=z.slice(t.ch)),i.push(z),++a}),i}function nn(e,t,n){var i=[];return e.iter(t,n,function(a){i.push(a.text)}),i}function Ei(e,t){var n=t-e.height;if(n)for(var i=e;i;i=i.parent)i.height+=n}function Mt(e){if(e.parent==null)return null;for(var t=e.parent,n=ie(t.lines,e),i=t.parent;i;t=i,i=i.parent)for(var a=0;!(i.children[a]==t);++a)n+=i.children[a].chunkSize();return n+t.first}function Hi(e,t){var n=e.first;e:do{for(var i=0;i<e.children.length;++i){var a=e.children[i],k=a.height;if(t<k){e=a;continue e}t-=k,n+=a.chunkSize()}return n}while(!e.lines);for(var z=0;z<e.lines.length;++z){var J=e.lines[z],Q=J.height;if(t<Q)break;t-=Q}return n+z}function Ri(e,t){return t>=e.first&&t<e.first+e.size}function pn(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ye(e,t,n){if(n===void 0&&(n=null),!(this instanceof Ye))return new Ye(e,t,n);this.line=e,this.ch=t,this.sticky=n}function Ct(e,t){return e.line-t.line||e.ch-t.ch}function mn(e,t){return e.sticky==t.sticky&&Ct(e,t)==0}function gn(e){return Ye(e.line,e.ch)}function vn(e,t){return Ct(e,t)<0?t:e}function Zi(e,t){return Ct(e,t)<0?e:t}function X(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function y(e,t){if(t.line<e.first)return Ye(e.first,0);var n=e.first+e.size-1;return t.line>n?Ye(n,vt(e,n).text.length):A(t,vt(e,t.line).text.length)}function A(e,t){var n=e.ch;return n==null||n>t?Ye(e.line,t):n<0?Ye(e.line,0):e}function F(e,t){for(var n=[],i=0;i<t.length;i++)n[i]=y(e,t[i]);return n}var q=function(e,t){this.state=e,this.lookAhead=t},V=function(e,t,n,i){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};V.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},V.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}},V.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},V.fromSaved=function(e,t,n){return t instanceof q?new V(e,si(e.mode,t.state),n,t.lookAhead):new V(e,si(e.mode,t),n)},V.prototype.save=function(e){var t=e!==!1?si(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new q(t,this.maxLookAhead):t};function me(e,t,n,i){var a=[e.state.modeGen],k={};xi(e,t.text,e.doc.mode,n,function(ee,ce){return a.push(ee,ce)},k,i);for(var z=n.state,J=function(ee){n.baseTokens=a;var ce=e.state.overlays[ee],ye=1,Oe=0;n.state=!0,xi(e,t.text,ce.mode,n,function(Ae,Be){for(var Ke=ye;Oe<Ae;){var qe=a[ye];qe>Ae&&a.splice(ye,1,Ae,a[ye+1],qe),ye+=2,Oe=Math.min(Ae,qe)}if(!Be)return;if(ce.opaque)a.splice(Ke,ye-Ke,Ae,"overlay "+Be),ye=Ke+2;else for(;Ke<ye;Ke+=2){var st=a[Ke+1];a[Ke+1]=(st?st+" ":"")+"overlay "+Be}},k),n.state=z,n.baseTokens=null,n.baseTokenPos=1},Q=0;Q<e.state.overlays.length;++Q)J(Q);return{styles:a,classes:k.bgClass||k.textClass?k:null}}function He(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var i=nt(e,Mt(t)),a=t.text.length>e.options.maxHighlightLength&&si(e.doc.mode,i.state),k=me(e,t,i);a&&(i.state=a),t.stateAfter=i.save(!a),t.styles=k.styles,k.classes?t.styleClasses=k.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 nt(e,t,n){var i=e.doc,a=e.display;if(!i.mode.startState)return new V(i,!0,t);var k=ui(e,t,n),z=k>i.first&&vt(i,k-1).stateAfter,J=z?V.fromSaved(i,z,k):new V(i,sn(i.mode),k);return i.iter(k,t,function(Q){yt(e,Q.text,J);var ee=J.line;Q.stateAfter=ee==t-1||ee%5==0||ee>=a.viewFrom&&ee<a.viewTo?J.save():null,J.nextLine()}),n&&(i.modeFrontier=J.line),J}function yt(e,t,n,i){var a=e.doc.mode,k=new zt(t,e.options.tabSize,n);for(k.start=k.pos=i||0,t==""&&ze(a,n.state);!k.eol();)xt(a,k,n.state),k.start=k.pos}function ze(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=an(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function xt(e,t,n,i){for(var a=0;a<10;a++){i&&(i[0]=an(e,n).mode);var k=e.token(t,n);if(t.pos>t.start)return k}throw new Error("Mode "+e.name+" failed to advance stream.")}var Kt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function ti(e,t,n,i){var a=e.doc,k=a.mode,z;t=y(a,t);var J=vt(a,t.line),Q=nt(e,t.line,n),ee=new zt(J.text,e.options.tabSize,Q),ce;for(i&&(ce=[]);(i||ee.pos<t.ch)&&!ee.eol();)ee.start=ee.pos,z=xt(k,ee,Q.state),i&&ce.push(new Kt(ee,z,si(a.mode,Q.state)));return i?ce:new Kt(ee,z,Q.state)}function ki(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 i=n[1]?"bgClass":"textClass";t[i]==null?t[i]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[i])||(t[i]+=" "+n[2])}return e}function xi(e,t,n,i,a,k,z){var J=n.flattenSpans;J==null&&(J=e.options.flattenSpans);var Q=0,ee=null,ce=new zt(t,e.options.tabSize,i),ye,Oe=e.options.addModeClass&&[null];for(t==""&&ki(ze(n,i.state),k);!ce.eol();){if(ce.pos>e.options.maxHighlightLength?(J=!1,z&&yt(e,t,i,ce.pos),ce.pos=t.length,ye=null):ye=ki(xt(n,ce,i.state,Oe),k),Oe){var Ae=Oe[0].name;Ae&&(ye="m-"+(ye?Ae+" "+ye:Ae))}if(!J||ee!=ye){for(;Q<ce.start;)Q=Math.min(ce.start,Q+5e3),a(Q,ee);ee=ye}ce.start=ce.pos}for(;Q<ce.pos;){var Be=Math.min(ce.pos,Q+5e3);a(Be,ee),Q=Be}}function ui(e,t,n){for(var i,a,k=e.doc,z=n?-1:t-(e.doc.mode.innerMode?1e3:100),J=t;J>z;--J){if(J<=k.first)return k.first;var Q=vt(k,J-1),ee=Q.stateAfter;if(ee&&(!n||J+(ee instanceof q?ee.lookAhead:0)<=k.modeFrontier))return J;var ce=W(Q.text,null,e.options.tabSize);(a==null||i>ce)&&(a=J-1,i=ce)}return a}function Qi(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,i=t-1;i>n;i--){var a=vt(e,i).stateAfter;if(a&&(!(a instanceof q)||i+a.lookAhead<t)){n=i+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var on=!1,pi=!1;function Ni(){on=!0}function ln(){pi=!0}function qi(e,t,n){this.marker=e,this.from=t,this.to=n}function rt(e,t){if(e)for(var n=0;n<e.length;++n){var i=e[n];if(i.marker==t)return i}}function kt(e,t){for(var n,i=0;i<e.length;++i)e[i]!=t&&(n||(n=[])).push(e[i]);return n}function Jt(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function wt(e,t,n){var i;if(e)for(var a=0;a<e.length;++a){var k=e[a],z=k.marker,J=k.from==null||(z.inclusiveLeft?k.from<=t:k.from<t);if(J||k.from==t&&z.type=="bookmark"&&(!n||!k.marker.insertLeft)){var Q=k.to==null||(z.inclusiveRight?k.to>=t:k.to>t);(i||(i=[])).push(new qi(z,k.from,Q?null:k.to))}}return i}function $t(e,t,n){var i;if(e)for(var a=0;a<e.length;++a){var k=e[a],z=k.marker,J=k.to==null||(z.inclusiveRight?k.to>=t:k.to>t);if(J||k.from==t&&z.type=="bookmark"&&(!n||k.marker.insertLeft)){var Q=k.from==null||(z.inclusiveLeft?k.from<=t:k.from<t);(i||(i=[])).push(new qi(z,Q?null:k.from-t,k.to==null?null:k.to-t))}}return i}function Vt(e,t){if(t.full)return null;var n=Ri(e,t.from.line)&&vt(e,t.from.line).markedSpans,i=Ri(e,t.to.line)&&vt(e,t.to.line).markedSpans;if(!n&&!i)return null;var a=t.from.ch,k=t.to.ch,z=Ct(t.from,t.to)==0,J=wt(n,a,z),Q=$t(i,k,z),ee=t.text.length==1,ce=te(t.text).length+(ee?a:0);if(J)for(var ye=0;ye<J.length;++ye){var Oe=J[ye];if(Oe.to==null){var Ae=rt(Q,Oe.marker);Ae?ee&&(Oe.to=Ae.to==null?null:Ae.to+ce):Oe.to=a}}if(Q)for(var Be=0;Be<Q.length;++Be){var Ke=Q[Be];if(Ke.to!=null&&(Ke.to+=ce),Ke.from==null){var qe=rt(J,Ke.marker);qe||(Ke.from=ce,ee&&(J||(J=[])).push(Ke))}else Ke.from+=ce,ee&&(J||(J=[])).push(Ke)}J&&(J=jt(J)),Q&&Q!=J&&(Q=jt(Q));var st=[J];if(!ee){var ct=t.text.length-2,ot;if(ct>0&&J)for(var gt=0;gt<J.length;++gt)J[gt].to==null&&(ot||(ot=[])).push(new qi(J[gt].marker,null,null));for(var At=0;At<ct;++At)st.push(ot);st.push(Q)}return st}function jt(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 Zt(e,t,n){var i=null;if(e.iter(t.line,n.line+1,function(Ae){if(Ae.markedSpans)for(var Be=0;Be<Ae.markedSpans.length;++Be){var Ke=Ae.markedSpans[Be].marker;Ke.readOnly&&(!i||ie(i,Ke)==-1)&&(i||(i=[])).push(Ke)}}),!i)return null;for(var a=[{from:t,to:n}],k=0;k<i.length;++k)for(var z=i[k],J=z.find(0),Q=0;Q<a.length;++Q){var ee=a[Q];if(Ct(ee.to,J.from)<0||Ct(ee.from,J.to)>0)continue;var ce=[Q,1],ye=Ct(ee.from,J.from),Oe=Ct(ee.to,J.to);(ye<0||!z.inclusiveLeft&&!ye)&&ce.push({from:ee.from,to:J.from}),(Oe>0||!z.inclusiveRight&&!Oe)&&ce.push({from:J.to,to:ee.to}),a.splice.apply(a,ce),Q+=ce.length-3}return a}function un(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 yi(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function oi(e){return e.inclusiveLeft?-1:0}function Yt(e){return e.inclusiveRight?1:0}function Oi(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var i=e.find(),a=t.find(),k=Ct(i.from,a.from)||oi(e)-oi(t);if(k)return-k;var z=Ct(i.to,a.to)||Yt(e)-Yt(t);return z||t.id-e.id}function Ht(e,t){var n=pi&&e.markedSpans,i;if(n)for(var a=void 0,k=0;k<n.length;++k)a=n[k],a.marker.collapsed&&(t?a.from:a.to)==null&&(!i||Oi(i,a.marker)<0)&&(i=a.marker);return i}function mi(e){return Ht(e,!0)}function ii(e){return Ht(e,!1)}function yn(e,t){var n=pi&&e.markedSpans,i;if(n)for(var a=0;a<n.length;++a){var k=n[a];k.marker.collapsed&&(k.from==null||k.from<t)&&(k.to==null||k.to>t)&&(!i||Oi(i,k.marker)<0)&&(i=k.marker)}return i}function Ti(e,t,n,i,a){var k=vt(e,t),z=pi&&k.markedSpans;if(z)for(var J=0;J<z.length;++J){var Q=z[J];if(!Q.marker.collapsed)continue;var ee=Q.marker.find(0),ce=Ct(ee.from,n)||oi(Q.marker)-oi(a),ye=Ct(ee.to,i)||Yt(Q.marker)-Yt(a);if(ce>=0&&ye<=0||ce<=0&&ye>=0)continue;if(ce<=0&&(Q.marker.inclusiveRight&&a.inclusiveLeft?Ct(ee.to,n)>=0:Ct(ee.to,n)>0)||ce>=0&&(Q.marker.inclusiveRight&&a.inclusiveLeft?Ct(ee.from,i)<=0:Ct(ee.from,i)<0))return!0}}function Ui(e){for(var t;t=mi(e);)e=t.find(-1,!0).line;return e}function Yn(e){for(var t;t=ii(e);)e=t.find(1,!0).line;return e}function An(e){for(var t,n;t=ii(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function cr(e,t){var n=vt(e,t),i=Ui(n);return n==i?t:Mt(i)}function Rn(e,t){if(t>e.lastLine())return t;var n=vt(e,t),i;if(!_n(e,n))return t;for(;i=ii(n);)n=i.find(1,!0).line;return Mt(n)+1}function _n(e,t){var n=pi&&t.markedSpans;if(n)for(var i=void 0,a=0;a<n.length;++a){if(i=n[a],!i.marker.collapsed)continue;if(i.from==null)return!0;if(i.marker.widgetNode)continue;if(i.from==0&&i.marker.inclusiveLeft&&fr(e,t,i))return!0}}function fr(e,t,n){if(n.to==null){var i=n.marker.find(1,!0);return fr(e,i.line,rt(i.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var a=void 0,k=0;k<t.markedSpans.length;++k)if(a=t.markedSpans[k],a.marker.collapsed&&!a.marker.widgetNode&&a.from==n.to&&(a.to==null||a.to!=n.from)&&(a.marker.inclusiveLeft||n.marker.inclusiveRight)&&fr(e,t,a))return!0}function hn(e){e=Ui(e);for(var t=0,n=e.parent,i=0;i<n.lines.length;++i){var a=n.lines[i];if(a==e)break;t+=a.height}for(var k=n.parent;k;n=k,k=n.parent)for(var z=0;z<k.children.length;++z){var J=k.children[z];if(J==n)break;t+=J.height}return t}function pr(e){if(e.height==0)return 0;for(var t=e.text.length,n,i=e;n=mi(i);){var a=n.find(0,!0);i=a.from.line,t+=a.from.ch-a.to.ch}for(i=e;n=ii(i);){var k=n.find(0,!0);t-=i.text.length-k.from.ch,i=k.to.line,t+=i.text.length-k.to.ch}return t}function jr(e){var t=e.display,n=e.doc;t.maxLine=vt(n,n.first),t.maxLineLength=pr(t.maxLine),t.maxLineChanged=!0,n.iter(function(i){var a=pr(i);a>t.maxLineLength&&(t.maxLineLength=a,t.maxLine=i)})}var Un=function(e,t,n){this.text=e,yi(this,t),this.height=n?n(this):1};Un.prototype.lineNo=function(){return Mt(this)},_e(Un);function ua(e,t,n,i){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),un(e),yi(e,n);var a=i?i(e):1;a!=e.height&&Ei(e,a)}function bt(e){e.parent=null,un(e)}var Lt={},St={};function Ft(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?St:Lt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Xt(e,t){var n=u("span",null,null,M?"padding-right: .1px":null),i={pre:u("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var a=0;a<=(t.rest?t.rest.length:0);a++){var k=a?t.rest[a-1]:t.line,z=void 0;i.pos=0,i.addToken=Gt,Ot(e.display.measure)&&(z=it(k,e.doc.direction))&&(i.addToken=Wi(i.addToken,z)),i.map=[];var J=t!=e.display.externalMeasured&&Mt(k);Tn(k,i,He(e,k,J)),k.styleClasses&&(k.styleClasses.bgClass&&(i.bgClass=H(k.styleClasses.bgClass,i.bgClass||"")),k.styleClasses.textClass&&(i.textClass=H(k.styleClasses.textClass,i.textClass||""))),i.map.length==0&&i.map.push(0,0,i.content.appendChild(mt(e.display.measure))),a==0?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(M){var Q=i.content.lastChild;(/\bcm-tab\b/.test(Q.className)||Q.querySelector&&Q.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return ke(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=H(i.pre.className,i.textClass||"")),i}function ri(e){var t=d("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Gt(e,t,n,i,a,k,z){if(!t)return;var J=e.splitSpaces?_i(t,e.trailingSpace):t,Q=e.cm.state.specialChars,ee=!1,ce;if(!Q.test(t))e.col+=t.length,ce=document.createTextNode(J),e.map.push(e.pos,e.pos+t.length,ce),K&&G<9&&(ee=!0),e.pos+=t.length;else{ce=document.createDocumentFragment();for(var ye=0;;){Q.lastIndex=ye;var Oe=Q.exec(t),Ae=Oe?Oe.index-ye:t.length-ye;if(Ae){var Be=document.createTextNode(J.slice(ye,ye+Ae));K&&G<9?ce.appendChild(d("span",[Be])):ce.appendChild(Be),e.map.push(e.pos,e.pos+Ae,Be),e.col+=Ae,e.pos+=Ae}if(!Oe)break;ye+=Ae+1;var Ke=void 0;if(Oe[0]==" "){var qe=e.cm.options.tabSize,st=qe-e.col%qe;Ke=ce.appendChild(d("span",le(st),"cm-tab")),Ke.setAttribute("role","presentation"),Ke.setAttribute("cm-text"," "),e.col+=st}else Oe[0]=="\r"||Oe[0]==`
`?(Ke=ce.appendChild(d("span",Oe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ke.setAttribute("cm-text",Oe[0]),e.col+=1):(Ke=e.cm.options.specialCharPlaceholder(Oe[0]),Ke.setAttribute("cm-text",Oe[0]),K&&G<9?ce.appendChild(d("span",[Ke])):ce.appendChild(Ke),e.col+=1);e.map.push(e.pos,e.pos+1,Ke),e.pos++}}if(e.trailingSpace=J.charCodeAt(t.length-1)==32,n||i||a||ee||k||z){var ct=n||"";i&&(ct+=i),a&&(ct+=a);var ot=d("span",[ce],ct,k);if(z)for(var gt in z)z.hasOwnProperty(gt)&&gt!="style"&&gt!="class"&&ot.setAttribute(gt,z[gt]);return e.content.appendChild(ot)}e.content.appendChild(ce)}function _i(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,i="",a=0;a<e.length;a++){var k=e.charAt(a);k==" "&&n&&(a==e.length-1||e.charCodeAt(a+1)==32)&&(k="\xA0"),i+=k,n=k==" "}return i}function Wi(e,t){return function(n,i,a,k,z,J,Q){a=a?a+" cm-force-border":"cm-force-border";for(var ee=n.pos,ce=ee+i.length;;){for(var ye=void 0,Oe=0;Oe<t.length&&!(ye=t[Oe],ye.to>ee&&ye.from<=ee);Oe++);if(ye.to>=ce)return e(n,i,a,k,z,J,Q);e(n,i.slice(0,ye.to-ee),a,k,null,J,Q),k=null,i=i.slice(ye.to-ee),ee=ye.to}}}function Wt(e,t,n,i){var a=!i&&n.widgetNode;a&&e.map.push(e.pos,e.pos+t,a),!i&&e.cm.display.input.needsContentAttribute&&(a||(a=e.content.appendChild(document.createElement("span"))),a.setAttribute("cm-marker",n.id)),a&&(e.cm.display.input.setUneditable(a),e.content.appendChild(a)),e.pos+=t,e.trailingSpace=!1}function Tn(e,t,n){var i=e.markedSpans,a=e.text,k=0;if(!i){for(var z=1;z<n.length;z+=2)t.addToken(t,a.slice(k,k=n[z]),Ft(n[z+1],t.cm.options));return}for(var J=a.length,Q=0,ee=1,ce="",ye,Oe,Ae=0,Be,Ke,qe,st,ct;;){if(Ae==Q){Be=Ke=qe=Oe="",ct=null,st=null,Ae=Infinity;for(var ot=[],gt=void 0,At=0;At<i.length;++At){var Tt=i[At],Nt=Tt.marker;if(Nt.type=="bookmark"&&Tt.from==Q&&Nt.widgetNode)ot.push(Nt);else if(Tt.from<=Q&&(Tt.to==null||Tt.to>Q||Nt.collapsed&&Tt.to==Q&&Tt.from==Q)){if(Tt.to!=null&&Tt.to!=Q&&Ae>Tt.to&&(Ae=Tt.to,Ke=""),Nt.className&&(Be+=" "+Nt.className),Nt.css&&(Oe=(Oe?Oe+";":"")+Nt.css),Nt.startStyle&&Tt.from==Q&&(qe+=" "+Nt.startStyle),Nt.endStyle&&Tt.to==Ae&&(gt||(gt=[])).push(Nt.endStyle,Tt.to),Nt.title&&((ct||(ct={})).title=Nt.title),Nt.attributes)for(var ai in Nt.attributes)(ct||(ct={}))[ai]=Nt.attributes[ai];Nt.collapsed&&(!st||Oi(st.marker,Nt)<0)&&(st=Tt)}else Tt.from>Q&&Ae>Tt.from&&(Ae=Tt.from)}if(gt)for(var Ci=0;Ci<gt.length;Ci+=2)gt[Ci+1]==Ae&&(Ke+=" "+gt[Ci]);if(!st||st.from==Q)for(var hi=0;hi<ot.length;++hi)Wt(t,0,ot[hi]);if(st&&(st.from||0)==Q){if(Wt(t,(st.to==null?J+1:st.to)-Q,st.marker,st.from==null),st.to==null)return;st.to==Q&&(st=!1)}}if(Q>=J)break;for(var Ji=Math.min(J,Ae);;){if(ce){var Vi=Q+ce.length;if(!st){var gi=Vi>Ji?ce.slice(0,Ji-Q):ce;t.addToken(t,gi,ye?ye+Be:Be,qe,Q+gi.length==Ae?Ke:"",Oe,ct)}if(Vi>=Ji){ce=ce.slice(Ji-Q),Q=Ji;break}Q=Vi,qe=""}ce=a.slice(k,k=n[ee++]),ye=Ft(n[ee++],t.cm.options)}}}function Qt(e,t,n){this.line=t,this.rest=An(t),this.size=this.rest?Mt(te(this.rest))-n+1:1,this.node=this.text=null,this.hidden=_n(e,t)}function Gi(e,t,n){for(var i=[],a,k=t;k<n;k=a){var z=new Qt(e.doc,vt(e.doc,k),k);a=k+z.size,i.push(z)}return i}var Di=null;function rn(e){Di?Di.ops.push(e):e.ownsGroup=Di={ops:[e],delayedCallbacks:[]}}function Lo(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var i=0;i<e.ops.length;i++){var a=e.ops[i];if(a.cursorActivityHandlers)for(;a.cursorActivityCalled<a.cursorActivityHandlers.length;)a.cursorActivityHandlers[a.cursorActivityCalled++].call(null,a.cm)}}while(n<t.length)}function Io(e,t){var n=e.ownsGroup;if(!n)return;try{Lo(n)}finally{Di=null,t(n)}}var mr=null;function Li(e,t){var n=ut(e,t);if(!n.length)return;var i=Array.prototype.slice.call(arguments,2),a;Di?a=Di.delayedCallbacks:mr?a=mr:(a=mr=[],setTimeout(ko,0));for(var k=function(J){a.push(function(){return n[J].apply(null,i)})},z=0;z<n.length;++z)k(z)}function ko(){var e=mr;mr=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,n,i){for(var a=0;a<t.changes.length;a++){var k=t.changes[a];k=="text"?Po(e,t):k=="gutter"?Ja(e,t,n,i):k=="class"?ha(e,t):k=="widget"&&Mo(e,t,i)}t.changes=null}function gr(e){return e.node==e.text&&(e.node=d("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),K&&G<8&&(e.node.style.zIndex=2)),e.node}function Do(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 i=gr(t);t.background=i.insertBefore(d("div",null,n),i.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):Xt(e,t)}function Po(e,t){var n=t.text.className,i=$a(e,t);t.text==t.node&&(t.node=i.pre),t.text.parentNode.replaceChild(i.pre,t.text),t.text=i.pre,i.bgClass!=t.bgClass||i.textClass!=t.textClass?(t.bgClass=i.bgClass,t.textClass=i.textClass,ha(e,t)):n&&(t.text.className=n)}function ha(e,t){Do(e,t),t.line.wrapClass?gr(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,i){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 a=gr(t);t.gutterBackground=d("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px; width: "+i.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),a.insertBefore(t.gutterBackground,t.text)}var k=t.line.gutterMarkers;if(e.options.lineNumbers||k){var z=gr(t),J=t.gutter=d("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px");if(e.display.input.setUneditable(J),z.insertBefore(J,t.text),t.line.gutterClass&&(J.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!k||!k["CodeMirror-linenumbers"])&&(t.lineNumber=J.appendChild(d("div",pn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),k)for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var ee=e.display.gutterSpecs[Q].className,ce=k.hasOwnProperty(ee)&&k[ee];ce&&J.appendChild(d("div",[ce],"CodeMirror-gutter-elt","left: "+i.gutterLeft[ee]+"px; width: "+i.gutterWidth[ee]+"px"))}}}function Mo(e,t,n){t.alignable&&(t.alignable=null);for(var i=C("CodeMirror-linewidget"),a=t.node.firstChild,k=void 0;a;a=k)k=a.nextSibling,i.test(a.className)&&t.node.removeChild(a);Za(e,t,n)}function No(e,t,n,i){var a=$a(e,t);return t.text=t.node=a.pre,a.bgClass&&(t.bgClass=a.bgClass),a.textClass&&(t.textClass=a.textClass),ha(e,t),Ja(e,t,n,i),Za(e,t,i),t.node}function Za(e,t,n){if(Qa(e,t.line,t,n,!0),t.rest)for(var i=0;i<t.rest.length;i++)Qa(e,t.rest[i],t,n,!1)}function Qa(e,t,n,i,a){if(!t.widgets)return;for(var k=gr(n),z=0,J=t.widgets;z<J.length;++z){var Q=J[z],ee=d("div",[Q.node],"CodeMirror-linewidget"+(Q.className?" "+Q.className:""));Q.handleMouseEvents||ee.setAttribute("cm-ignore-events","true"),Uo(Q,ee,n,i),e.display.input.setUneditable(ee),a&&Q.above?k.insertBefore(ee,n.gutter||n.text):k.appendChild(ee),Li(Q,"redraw")}}function Uo(e,t,n,i){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var a=i.wrapperWidth;t.style.left=i.fixedPos+"px",e.coverGutter||(a-=i.gutterTotalWidth,t.style.paddingLeft=i.gutterTotalWidth+"px"),t.style.width=a+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-i.gutterTotalWidth+"px"))}function vr(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!E(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;"),_(t.display.measure,d("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function wn(e,t){for(var n=be(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 Hr(e){return e.lineSpace.offsetTop}function da(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=_(e.measure,d("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,i={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(i.left)&&!isNaN(i.right)&&(e.cachedPaddingH=i),i}function bn(e){return oe-e.display.nativeBarWidth}function Fn(e){return e.display.scroller.clientWidth-bn(e)-e.display.barWidth}function ca(e){return e.display.scroller.clientHeight-bn(e)-e.display.barHeight}function Fo(e,t,n){var i=e.options.lineWrapping,a=i&&Fn(e);if(!t.measure.heights||i&&t.measure.width!=a){var k=t.measure.heights=[];if(i){t.measure.width=a;for(var z=t.text.firstChild.getClientRects(),J=0;J<z.length-1;J++){var Q=z[J],ee=z[J+1];Math.abs(Q.bottom-ee.bottom)>2&&k.push((Q.bottom+ee.top)/2-n.top)}}k.push(n.bottom-n.top)}}function es(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var i=0;i<e.rest.length;i++)if(e.rest[i]==t)return{map:e.measure.maps[i],cache:e.measure.caches[i]};for(var a=0;a<e.rest.length;a++)if(Mt(e.rest[a])>n)return{map:e.measure.maps[a],cache:e.measure.caches[a],before:!0}}function Bo(e,t){t=Ui(t);var n=Mt(t),i=e.display.externalMeasured=new Qt(e.doc,t,n);i.lineN=n;var a=i.built=Xt(e,i);return i.text=a.pre,_(e.display.lineMeasure,a.pre),i}function ts(e,t,n,i){return En(e,$n(e,t),n,i)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Hn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function $n(e,t){var n=Mt(t),i=fa(e,n);i&&!i.text?i=null:i&&i.changes&&(Ya(e,i,n,_a(e)),e.curOp.forceUpdate=!0),i||(i=Bo(e,t));var a=es(i,t,n);return{line:t,view:i,rect:null,map:a.map,cache:a.cache,before:a.before,hasHeights:!1}}function En(e,t,n,i,a){t.before&&(n=-1);var k=n+(i||""),z;return t.cache.hasOwnProperty(k)?z=t.cache[k]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Fo(e,t.view,t.rect),t.hasHeights=!0),z=Ho(e,t,n,i),z.bogus||(t.cache[k]=z)),{left:z.left,right:z.right,top:a?z.rtop:z.top,bottom:a?z.rbottom:z.bottom}}var is={left:0,right:0,top:0,bottom:0};function ns(e,t,n){for(var i,a,k,z,J,Q,ee=0;ee<e.length;ee+=3)if(J=e[ee],Q=e[ee+1],t<J?(a=0,k=1,z="left"):t<Q?(a=t-J,k=a+1):(ee==e.length-3||t==Q&&e[ee+3]>t)&&(k=Q-J,a=k-1,t>=Q&&(z="right")),a!=null){if(i=e[ee+2],J==Q&&n==(i.insertLeft?"left":"right")&&(z=n),n=="left"&&a==0)for(;ee&&e[ee-2]==e[ee-3]&&e[ee-1].insertLeft;)i=e[(ee-=3)+2],z="left";if(n=="right"&&a==Q-J)for(;ee<e.length-3&&e[ee+3]==e[ee+4]&&!e[ee+5].insertLeft;)i=e[(ee+=3)+2],z="right";break}return{node:i,start:a,end:k,collapse:z,coverStart:J,coverEnd:Q}}function jo(e,t){var n=is;if(t=="left")for(var i=0;i<e.length&&!((n=e[i]).left!=n.right);i++);else for(var a=e.length-1;a>=0&&!((n=e[a]).left!=n.right);a--);return n}function Ho(e,t,n,i){var a=ns(t.map,n,i),k=a.node,z=a.start,J=a.end,Q=a.collapse,ee;if(k.nodeType==3){for(var ce=0;ce<4;ce++){for(;z&&Ne(t.line.text.charAt(a.coverStart+z));)--z;for(;a.coverStart+J<a.coverEnd&&Ne(t.line.text.charAt(a.coverStart+J));)++J;if(K&&G<9&&z==0&&J==a.coverEnd-a.coverStart?ee=k.parentNode.getBoundingClientRect():ee=jo(g(k,z,J).getClientRects(),i),ee.left||ee.right||z==0)break;J=z,z=z-1,Q="right"}K&&G<11&&(ee=Wo(e.display.measure,ee))}else{z>0&&(Q=i="right");var ye;e.options.lineWrapping&&(ye=k.getClientRects()).length>1?ee=ye[i=="right"?ye.length-1:0]:ee=k.getBoundingClientRect()}if(K&&G<9&&!z&&(!ee||!ee.left&&!ee.right)){var Oe=k.parentNode.getClientRects()[0];Oe?ee={left:Oe.left,right:Oe.left+Zn(e.display),top:Oe.top,bottom:Oe.bottom}:ee=is}for(var Ae=ee.top-t.rect.top,Be=ee.bottom-t.rect.top,Ke=(Ae+Be)/2,qe=t.view.measure.heights,st=0;st<qe.length-1&&!(Ke<qe[st]);st++);var ct=st?qe[st-1]:0,ot=qe[st],gt={left:(Q=="right"?ee.right:ee.left)-t.rect.left,right:(Q=="left"?ee.left:ee.right)-t.rect.left,top:ct,bottom:ot};return!ee.left&&!ee.right&&(gt.bogus=!0),e.options.singleCursorHeightPerLine||(gt.rtop=Ae,gt.rbottom=Be),gt}function Wo(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!ht(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*i,bottom:t.bottom*i}}function rs(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 as(e){e.display.externalMeasure=null,x(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)rs(e.display.view[t])}function yr(e){as(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function ss(){return v&&l?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function os(){return v&&l?-(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+=vr(e.widgets[n]));return t}function Wr(e,t,n,i,a){if(!a){var k=pa(t);n.top+=k,n.bottom+=k}if(i=="line")return n;i||(i="local");var z=hn(t);if(i=="local"?z+=Hr(e.display):z-=e.display.viewOffset,i=="page"||i=="window"){var J=e.display.lineSpace.getBoundingClientRect();z+=J.top+(i=="window"?0:os());var Q=J.left+(i=="window"?0:ss());n.left+=Q,n.right+=Q}return n.top+=z,n.bottom+=z,n}function ls(e,t,n){if(n=="div")return t;var i=t.left,a=t.top;if(n=="page")i-=ss(),a-=os();else if(n=="local"||!n){var k=e.display.sizer.getBoundingClientRect();i+=k.left,a+=k.top}var z=e.display.lineSpace.getBoundingClientRect();return{left:i-z.left,top:a-z.top}}function ma(e,t,n,i,a){return i||(i=vt(e.doc,t.line)),Wr(e,i,ts(e,i,t.ch,a),n)}function dn(e,t,n,i,a,k){i=i||vt(e.doc,t.line),a||(a=$n(e,i));function z(Be,Ke){var qe=En(e,a,Be,Ke?"right":"left",k);return Ke?qe.left=qe.right:qe.right=qe.left,Wr(e,i,qe,n)}var J=it(i,e.doc.direction),Q=t.ch,ee=t.sticky;if(Q>=i.text.length?(Q=i.text.length,ee="before"):Q<=0&&(Q=0,ee="after"),!J)return z(ee=="before"?Q-1:Q,ee=="before");function ce(Be,Ke,qe){var st=J[Ke],ct=st.level==1;return z(qe?Be-1:Be,ct!=qe)}var ye=Ze(J,Q,ee),Oe=Qe,Ae=ce(Q,ye,ee=="before");return Oe!=null&&(Ae.other=ce(Q,Oe,ee!="before")),Ae}function us(e,t){var n=0;t=y(e.doc,t),e.options.lineWrapping||(n=Zn(e.display)*t.ch);var i=vt(e.doc,t.line),a=hn(i)+Hr(e.display);return{left:n,right:n,top:a,bottom:a+i.height}}function ga(e,t,n,i,a){var k=Ye(e,t,n);return k.xRel=a,i&&(k.outside=i),k}function va(e,t,n){var i=e.doc;if(n+=e.display.viewOffset,n<0)return ga(i.first,0,null,-1,-1);var a=Hi(i,n),k=i.first+i.size-1;if(a>k)return ga(i.first+i.size-1,vt(i,k).text.length,null,1,1);t<0&&(t=0);for(var z=vt(i,a);;){var J=Go(e,z,a,t,n),Q=yn(z,J.ch+(J.xRel>0||J.outside>0?1:0));if(!Q)return J;var ee=Q.find(1);if(ee.line==a)return ee;z=vt(i,a=ee.line)}}function hs(e,t,n,i){i-=pa(t);var a=t.text.length,k=$e(function(z){return En(e,n,z-1).bottom<=i},a,0);return a=$e(function(z){return En(e,n,z).top>i},k,a),{begin:k,end:a}}function ds(e,t,n,i){n||(n=$n(e,t));var a=Wr(e,t,En(e,n,i),"line").top;return hs(e,t,n,a)}function ya(e,t,n,i){return e.bottom<=n?!1:e.top>n?!0:(i?e.left:e.right)>t}function Go(e,t,n,i,a){a-=hn(t);var k=$n(e,t),z=pa(t),J=0,Q=t.text.length,ee=!0,ce=it(t,e.doc.direction);if(ce){var ye=(e.options.lineWrapping?Ko:zo)(e,t,n,k,ce,i,a);ee=ye.level!=1,J=ee?ye.from:ye.to-1,Q=ee?ye.to:ye.from-1}var Oe=null,Ae=null,Be=$e(function(At){var Tt=En(e,k,At);return Tt.top+=z,Tt.bottom+=z,ya(Tt,i,a,!1)?(Tt.top<=a&&Tt.left<=i&&(Oe=At,Ae=Tt),!0):!1},J,Q),Ke,qe,st=!1;if(Ae){var ct=i-Ae.left<Ae.right-i,ot=ct==ee;Be=Oe+(ot?0:1),qe=ot?"after":"before",Ke=ct?Ae.left:Ae.right}else{!ee&&(Be==Q||Be==J)&&Be++,qe=Be==0?"after":Be==t.text.length?"before":En(e,k,Be-(ee?1:0)).bottom+z<=a==ee?"after":"before";var gt=dn(e,Ye(n,Be,qe),"line",t,k);Ke=gt.left,st=a<gt.top?-1:a>=gt.bottom?1:0}return Be=Me(t.text,Be,1),ga(n,Be,qe,st,i-Ke)}function zo(e,t,n,i,a,k,z){var J=$e(function(ye){var Oe=a[ye],Ae=Oe.level!=1;return ya(dn(e,Ye(n,Ae?Oe.to:Oe.from,Ae?"before":"after"),"line",t,i),k,z,!0)},0,a.length-1),Q=a[J];if(J>0){var ee=Q.level!=1,ce=dn(e,Ye(n,ee?Q.from:Q.to,ee?"after":"before"),"line",t,i);ya(ce,k,z,!0)&&ce.top>z&&(Q=a[J-1])}return Q}function Ko(e,t,n,i,a,k,z){var J=hs(e,t,i,z),Q=J.begin,ee=J.end;/\s/.test(t.text.charAt(ee-1))&&ee--;for(var ce=null,ye=null,Oe=0;Oe<a.length;Oe++){var Ae=a[Oe];if(Ae.from>=ee||Ae.to<=Q)continue;var Be=Ae.level!=1,Ke=En(e,i,Be?Math.min(ee,Ae.to)-1:Math.max(Q,Ae.from)).right,qe=Ke<k?k-Ke+1e9:Ke-k;(!ce||ye>qe)&&(ce=Ae,ye=qe)}return ce||(ce=a[a.length-1]),ce.from<Q&&(ce={from:Q,to:ce.to,level:ce.level}),ce.to>ee&&(ce={from:ce.from,to:ee,level:ce.level}),ce}var Bn;function Jn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Bn==null){Bn=d("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Bn.appendChild(document.createTextNode("x")),Bn.appendChild(d("br"));Bn.appendChild(document.createTextNode("x"))}_(e.measure,Bn);var n=Bn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),x(e.measure),n||1}function Zn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=d("span","xxxxxxxxxx"),n=d("pre",[t],"CodeMirror-line-like");_(e.measure,n);var i=t.getBoundingClientRect(),a=(i.right-i.left)/10;return a>2&&(e.cachedCharWidth=a),a||10}function _a(e){for(var t=e.display,n={},i={},a=t.gutters.clientLeft,k=t.gutters.firstChild,z=0;k;k=k.nextSibling,++z){var J=e.display.gutterSpecs[z].className;n[J]=k.offsetLeft+k.clientLeft+a,i[J]=k.clientWidth}return{fixedPos:ba(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function ba(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function cs(e){var t=Jn(e.display),n=e.options.lineWrapping,i=n&&Math.max(5,e.display.scroller.clientWidth/Zn(e.display)-3);return function(a){if(_n(e.doc,a))return 0;var k=0;if(a.widgets)for(var z=0;z<a.widgets.length;z++)a.widgets[z].height&&(k+=a.widgets[z].height);return n?k+(Math.ceil(a.text.length/i)||1)*t:k+t}}function Ea(e){var t=e.doc,n=cs(e);t.iter(function(i){var a=n(i);a!=i.height&&Ei(i,a)})}function jn(e,t,n,i){var a=e.display;if(!n&&be(t).getAttribute("cm-not-content")=="true")return null;var k,z,J=a.lineSpace.getBoundingClientRect();try{k=t.clientX-J.left,z=t.clientY-J.top}catch(ye){return null}var Q=va(e,k,z),ee;if(i&&Q.xRel>0&&(ee=vt(e.doc,Q.line).text).length==Q.ch){var ce=W(ee,ee.length,e.options.tabSize)-ee.length;Q=Ye(Q.line,Math.max(0,Math.round((k-qa(e.display).left)/Zn(e.display))-ce))}return Q}function Hn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,i=0;i<n.length;i++)if(t-=n[i].size,t<0)return i}function zi(e,t,n,i){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),i||(i=0);var a=e.display;if(i&&n<a.viewTo&&(a.updateLineNumbers==null||a.updateLineNumbers>t)&&(a.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=a.viewTo)pi&&cr(e.doc,t)<a.viewTo&&Ln(e);else if(n<=a.viewFrom)pi&&Rn(e.doc,n+i)>a.viewFrom?Ln(e):(a.viewFrom+=i,a.viewTo+=i);else if(t<=a.viewFrom&&n>=a.viewTo)Ln(e);else if(t<=a.viewFrom){var k=Gr(e,n,n+i,1);k?(a.view=a.view.slice(k.index),a.viewFrom=k.lineN,a.viewTo+=i):Ln(e)}else if(n>=a.viewTo){var z=Gr(e,t,t,-1);z?(a.view=a.view.slice(0,z.index),a.viewTo=z.lineN):Ln(e)}else{var J=Gr(e,t,t,-1),Q=Gr(e,n,n+i,1);J&&Q?(a.view=a.view.slice(0,J.index).concat(Gi(e,J.lineN,Q.lineN)).concat(a.view.slice(Q.index)),a.viewTo+=i):Ln(e)}var ee=a.externalMeasured;ee&&(n<ee.lineN?ee.lineN+=i:t<ee.lineN+ee.size&&(a.externalMeasured=null))}function On(e,t,n){e.curOp.viewChanged=!0;var i=e.display,a=e.display.externalMeasured;if(a&&t>=a.lineN&&t<a.lineN+a.size&&(i.externalMeasured=null),t<i.viewFrom||t>=i.viewTo)return;var k=i.view[Hn(e,t)];if(k.node==null)return;var z=k.changes||(k.changes=[]);ie(z,n)==-1&&z.push(n)}function Ln(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Gr(e,t,n,i){var a=Hn(e,t),k,z=e.display.view;if(!pi||n==e.doc.first+e.doc.size)return{index:a,lineN:n};for(var J=e.display.viewFrom,Q=0;Q<a;Q++)J+=z[Q].size;if(J!=t){if(i>0){if(a==z.length-1)return null;k=J+z[a].size-t,a++}else k=J-t;t+=k,n+=k}for(;cr(e.doc,n)!=n;){if(a==(i<0?0:z.length-1))return null;n+=i*z[a-(i<0?1:0)].size,a+=i}return{index:a,lineN:n}}function Vo(e,t,n){var i=e.display,a=i.view;a.length==0||t>=i.viewTo||n<=i.viewFrom?(i.view=Gi(e,t,n),i.viewFrom=t):(i.viewFrom>t?i.view=Gi(e,t,i.viewFrom).concat(i.view):i.viewFrom<t&&(i.view=i.view.slice(Hn(e,t))),i.viewFrom=t,i.viewTo<n?i.view=i.view.concat(Gi(e,i.viewTo,n)):i.viewTo>n&&(i.view=i.view.slice(0,Hn(e,n)))),i.viewTo=n}function fs(e){for(var t=e.display.view,n=0,i=0;i<t.length;i++){var a=t[i];!a.hidden&&(!a.node||a.changes)&&++n}return n}function _r(e){e.display.input.showSelection(e.display.input.prepareSelection())}function ps(e,t){t===void 0&&(t=!0);for(var n=e.doc,i={},a=i.cursors=document.createDocumentFragment(),k=i.selection=document.createDocumentFragment(),z=0;z<n.sel.ranges.length;z++){if(!t&&z==n.sel.primIndex)continue;var J=n.sel.ranges[z];if(J.from().line>=e.display.viewTo||J.to().line<e.display.viewFrom)continue;var Q=J.empty();(Q||e.options.showCursorWhenSelecting)&&ms(e,J.head,a),Q||Xo(e,J,k)}return i}function ms(e,t,n){var i=dn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),a=n.appendChild(d("div","\xA0","CodeMirror-cursor"));if(a.style.left=i.left+"px",a.style.top=i.top+"px",a.style.height=Math.max(0,i.bottom-i.top)*e.options.cursorHeight+"px",i.other){var k=n.appendChild(d("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));k.style.display="",k.style.left=i.other.left+"px",k.style.top=i.other.top+"px",k.style.height=(i.other.bottom-i.other.top)*.85+"px"}}function zr(e,t){return e.top-t.top||e.left-t.left}function Xo(e,t,n){var i=e.display,a=e.doc,k=document.createDocumentFragment(),z=qa(e.display),J=z.left,Q=Math.max(i.sizerWidth,Fn(e)-i.sizer.offsetLeft)-z.right,ee=a.direction=="ltr";function ce(ot,gt,At,Tt){gt<0&&(gt=0),gt=Math.round(gt),Tt=Math.round(Tt),k.appendChild(d("div",null,"CodeMirror-selected","position: absolute; left: "+ot+`px;
top: `+gt+"px; width: "+(At==null?Q-ot:At)+`px;
height: `+(Tt-gt)+"px"))}function ye(ot,gt,At){var Tt=vt(a,ot),Nt=Tt.text.length,ai,Ci;function hi(gi,Xi){return ma(e,Ye(ot,gi),"div",Tt,Xi)}function Ji(gi,Xi,Ii){var bi=ds(e,Tt,null,gi),vi=Xi=="ltr"==(Ii=="after")?"left":"right",di=Ii=="after"?bi.begin:bi.end-(/\s/.test(Tt.text.charAt(bi.end-1))?2:1);return hi(di,vi)[vi]}var Vi=it(Tt,a.direction);return et(Vi,gt||0,At==null?Nt:At,function(gi,Xi,Ii,bi){var vi=Ii=="ltr",di=hi(gi,vi?"left":"right"),Yi=hi(Xi-1,vi?"right":"left"),hr=gt==null&&gi==0,Nn=At==null&&Xi==Nt,Mi=bi==0,xn=!Vi||bi==Vi.length-1;if(Yi.top-di.top<=3){var Ai=(ee?hr:Nn)&&Mi,Va=(ee?Nn:hr)&&xn,Cn=Ai?J:(vi?di:Yi).left,Vn=Va?Q:(vi?Yi:di).right;ce(Cn,di.top,Vn-Cn,di.bottom)}else{var Xn,Bi,dr,Xa;vi?(Xn=ee&&hr&&Mi?J:di.left,Bi=ee?Q:Ji(gi,Ii,"before"),dr=ee?J:Ji(Xi,Ii,"after"),Xa=ee&&Nn&&xn?Q:Yi.right):(Xn=ee?Ji(gi,Ii,"before"):J,Bi=!ee&&hr&&Mi?Q:di.right,dr=!ee&&Nn&&xn?J:Yi.left,Xa=ee?Ji(Xi,Ii,"after"):Q),ce(Xn,di.top,Bi-Xn,di.bottom),di.bottom<Yi.top&&ce(J,di.bottom,null,Yi.top),ce(dr,Yi.top,Xa-dr,Yi.bottom)}(!ai||zr(di,ai)<0)&&(ai=di),zr(Yi,ai)<0&&(ai=Yi),(!Ci||zr(di,Ci)<0)&&(Ci=di),zr(Yi,Ci)<0&&(Ci=Yi)}),{start:ai,end:Ci}}var Oe=t.from(),Ae=t.to();if(Oe.line==Ae.line)ye(Oe.line,Oe.ch,Ae.ch);else{var Be=vt(a,Oe.line),Ke=vt(a,Ae.line),qe=Ui(Be)==Ui(Ke),st=ye(Oe.line,Oe.ch,qe?Be.text.length+1:null).end,ct=ye(Ae.line,qe?0:null,Ae.ch).start;qe&&(st.top<ct.top-2?(ce(st.right,st.top,null,st.bottom),ce(J,ct.top,ct.left,ct.bottom)):ce(st.right,st.top,ct.left-st.right,st.bottom)),st.bottom<ct.top&&ce(J,st.bottom,null,ct.top)}n.appendChild(k)}function xa(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()||Qn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function gs(e){e.state.focused||(e.display.input.focus(),Ta(e))}function vs(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Qn(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(ke(e,"focus",e,t),e.state.focused=!0,D(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),M&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),xa(e)}function Qn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(ke(e,"blur",e,t),e.state.focused=!1,S(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Kr(e){for(var t=e.display,n=t.lineDiv.offsetTop,i=0;i<t.view.length;i++){var a=t.view[i],k=e.options.lineWrapping,z=void 0,J=0;if(a.hidden)continue;if(K&&G<8){var Q=a.node.offsetTop+a.node.offsetHeight;z=Q-n,n=Q}else{var ee=a.node.getBoundingClientRect();z=ee.bottom-ee.top,!k&&a.text.firstChild&&(J=a.text.firstChild.getBoundingClientRect().right-ee.left-1)}var ce=a.line.height-z;if((ce>.005||ce<-.005)&&(Ei(a.line,z),ys(a.line),a.rest))for(var ye=0;ye<a.rest.length;ye++)ys(a.rest[ye]);if(J>e.display.sizerWidth){var Oe=Math.ceil(J/Zn(e.display));Oe>e.display.maxLineLength&&(e.display.maxLineLength=Oe,e.display.maxLine=a.line,e.display.maxLineChanged=!0)}}}function ys(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],i=n.node.parentNode;i&&(n.height=i.offsetHeight)}}function Vr(e,t,n){var i=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;i=Math.floor(i-Hr(e));var a=n&&n.bottom!=null?n.bottom:i+e.wrapper.clientHeight,k=Hi(t,i),z=Hi(t,a);if(n&&n.ensure){var J=n.ensure.from.line,Q=n.ensure.to.line;J<k?(k=J,z=Hi(t,hn(vt(t,J))+e.wrapper.clientHeight)):Math.min(Q,t.lastLine())>=z&&(k=Hi(t,hn(vt(t,Q))-e.wrapper.clientHeight),z=Q)}return{from:k,to:Math.max(z,k+1)}}function Yo(e,t){if(Ge(e,"scrollCursorIntoView"))return;var n=e.display,i=n.sizer.getBoundingClientRect(),a=null;if(t.top+i.top<0?a=!0:t.bottom+i.top>(window.innerHeight||document.documentElement.clientHeight)&&(a=!1),a!=null&&!o){var k=d("div","\u200B",null,`position: absolute;
top: `+(t.top-n.viewOffset-Hr(e.display))+`px;
height: `+(t.bottom-t.top+bn(e)+n.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(k),k.scrollIntoView(a),e.display.lineSpace.removeChild(k)}}function $o(e,t,n,i){i==null&&(i=0);var a;!e.options.lineWrapping&&t==n&&(t=t.ch?Ye(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Ye(t.line,t.ch+1,"before"):t);for(var k=0;k<5;k++){var z=!1,J=dn(e,t),Q=!n||n==t?J:dn(e,n);a={left:Math.min(J.left,Q.left),top:Math.min(J.top,Q.top)-i,right:Math.max(J.left,Q.left),bottom:Math.max(J.bottom,Q.bottom)+i};var ee=wa(e,a),ce=e.doc.scrollTop,ye=e.doc.scrollLeft;if(ee.scrollTop!=null&&(Er(e,ee.scrollTop),Math.abs(e.doc.scrollTop-ce)>1&&(z=!0)),ee.scrollLeft!=null&&(Wn(e,ee.scrollLeft),Math.abs(e.doc.scrollLeft-ye)>1&&(z=!0)),!z)break}return a}function Jo(e,t){var n=wa(e,t);n.scrollTop!=null&&Er(e,n.scrollTop),n.scrollLeft!=null&&Wn(e,n.scrollLeft)}function wa(e,t){var n=e.display,i=Jn(e.display);t.top<0&&(t.top=0);var a=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,k=ca(e),z={};t.bottom-t.top>k&&(t.bottom=t.top+k);var J=e.doc.height+da(n),Q=t.top<i,ee=t.bottom>J-i;if(t.top<a)z.scrollTop=Q?0:t.top;else if(t.bottom>a+k){var ce=Math.min(t.top,(ee?J:t.bottom)-k);ce!=a&&(z.scrollTop=ce)}var ye=e.options.fixedGutter?0:n.gutters.offsetWidth,Oe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ye,Ae=Fn(e)-n.gutters.offsetWidth,Be=t.right-t.left>Ae;return Be&&(t.right=t.left+Ae),t.left<10?z.scrollLeft=0:t.left<Oe?z.scrollLeft=Math.max(0,t.left+ye-(Be?0:10)):t.right>Ae+Oe-3&&(z.scrollLeft=t.right+(Be?0:10)-Ae),z}function Sa(e,t){if(t==null)return;Xr(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function qn(e){Xr(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function br(e,t,n){(t!=null||n!=null)&&Xr(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Zo(e,t){Xr(e),e.curOp.scrollToPos=t}function Xr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=us(e,t.from),i=us(e,t.to);_s(e,n,i,t.margin)}}function _s(e,t,n,i){var a=wa(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-i,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+i});br(e,a.scrollLeft,a.scrollTop)}function Er(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;P||Aa(e,{top:t}),bs(e,t,!0),P&&Aa(e),wr(e,100)}function bs(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 Wn(e,t,n,i){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)&&!i)return;e.doc.scrollLeft=t,Ss(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function xr(e){var t=e.display,n=t.gutters.offsetWidth,i=Math.round(e.doc.height+da(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:i,scrollHeight:i+bn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Gn=function(e,t,n){this.cm=n;var i=this.vert=d("div",[d("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),a=this.horiz=d("div",[d("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=a.tabIndex=-1,e(i),e(a),Pe(i,"scroll",function(){i.clientHeight&&t(i.scrollTop,"vertical")}),Pe(a,"scroll",function(){a.clientWidth&&t(a.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,K&&G<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Gn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?i+"px":"0";var a=e.viewHeight-(t?i:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+a)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?i+"px":"0",this.horiz.style.left=e.barLeft+"px";var k=e.viewWidth-e.barLeft-(n?i:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+k)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(i==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?i:0,bottom:t?i:0}},Gn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Gn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Gn.prototype.zeroWidthHack=function(){var e=s&&!h?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Y,this.disableVert=new Y},Gn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function i(){var a=e.getBoundingClientRect(),k=n=="vert"?document.elementFromPoint(a.right-1,(a.top+a.bottom)/2):document.elementFromPoint((a.right+a.left)/2,a.bottom-1);k!=e?e.style.pointerEvents="none":t.set(1e3,i)}t.set(1e3,i)},Gn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Tr=function(){};Tr.prototype.update=function(){return{bottom:0,right:0}},Tr.prototype.setScrollLeft=function(){},Tr.prototype.setScrollTop=function(){},Tr.prototype.clear=function(){};function er(e,t){t||(t=xr(e));var n=e.display.barWidth,i=e.display.barHeight;Es(e,t);for(var a=0;a<4&&n!=e.display.barWidth||i!=e.display.barHeight;a++)n!=e.display.barWidth&&e.options.lineWrapping&&Kr(e),Es(e,xr(e)),n=e.display.barWidth,i=e.display.barHeight}function Es(e,t){var n=e.display,i=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=i.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=i.bottom)+"px",n.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=i.bottom+"px",n.scrollbarFiller.style.width=i.right+"px"):n.scrollbarFiller.style.display="",i.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=i.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var xs={native:Gn,null:Tr};function Ts(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&S(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new xs[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Pe(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"?Wn(e,t):Er(e,t)},e),e.display.scrollbars.addClass&&D(e.display.wrapper,e.display.scrollbars.addClass)}var Qo=0;function zn(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:++Qo},rn(e.curOp)}function Kn(e){var t=e.curOp;t&&Io(t,function(n){for(var i=0;i<n.ops.length;i++)n.ops[i].cm.curOp=null;qo(n)})}function qo(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var i=0;i<t.length;i++)tl(t[i]);for(var a=0;a<t.length;a++)il(t[a]);for(var k=0;k<t.length;k++)nl(t[k]);for(var z=0;z<t.length;z++)rl(t[z])}function el(e){var t=e.cm,n=t.display;sl(t),e.updateMaxLine&&jr(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 Yr(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Ca(e.cm,e.update)}function il(e){var t=e.cm,n=t.display;e.updatedDisplay&&Kr(t),e.barMeasure=xr(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=ts(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+bn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Fn(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&&Wn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==N();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&er(t,e.barMeasure),e.updatedDisplay&&Oa(t,e.barMeasure),e.selectionChanged&&xa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&gs(e.cm)}function rl(e){var t=e.cm,n=t.display,i=t.doc;if(e.updatedDisplay&&ws(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&bs(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Wn(t,e.scrollLeft,!0,!0),e.scrollToPos){var a=$o(t,y(i,e.scrollToPos.from),y(i,e.scrollToPos.to),e.scrollToPos.margin);Yo(t,a)}var k=e.maybeHiddenMarkers,z=e.maybeUnhiddenMarkers;if(k)for(var J=0;J<k.length;++J)k[J].lines.length||ke(k[J],"hide");if(z)for(var Q=0;Q<z.length;++Q)z[Q].lines.length&&ke(z[Q],"unhide");n.wrapper.offsetHeight&&(i.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&ke(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function $i(e,t){if(e.curOp)return t();zn(e);try{return t()}finally{Kn(e)}}function wi(e,t){return function(){if(e.curOp)return t.apply(e,arguments);zn(e);try{return t.apply(e,arguments)}finally{Kn(e)}}}function Fi(e){return function(){if(this.curOp)return e.apply(this,arguments);zn(this);try{return e.apply(this,arguments)}finally{Kn(this)}}}function Si(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);zn(t);try{return e.apply(this,arguments)}finally{Kn(t)}}}function wr(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,I(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,i=nt(e,t.highlightFrontier),a=[];t.iter(i.line,Math.min(t.first+t.size,e.display.viewTo+500),function(k){if(i.line>=e.display.viewFrom){var z=k.styles,J=k.text.length>e.options.maxHighlightLength?si(t.mode,i.state):null,Q=me(e,k,i,!0);J&&(i.state=J),k.styles=Q.styles;var ee=k.styleClasses,ce=Q.classes;ce?k.styleClasses=ce:ee&&(k.styleClasses=null);for(var ye=!z||z.length!=k.styles.length||ee!=ce&&(!ee||!ce||ee.bgClass!=ce.bgClass||ee.textClass!=ce.textClass),Oe=0;!ye&&Oe<z.length;++Oe)ye=z[Oe]!=k.styles[Oe];ye&&a.push(i.line),k.stateAfter=i.save(),i.nextLine()}else k.text.length<=e.options.maxHighlightLength&&yt(e,k.text,i),k.stateAfter=i.line%5==0?i.save():null,i.nextLine();if(+new Date>n)return wr(e,e.options.workDelay),!0}),t.highlightFrontier=i.line,t.modeFrontier=Math.max(t.modeFrontier,i.line),a.length&&$i(e,function(){for(var k=0;k<a.length;k++)On(e,a[k],"text")})}var Yr=function(e,t,n){var i=e.display;this.viewport=t,this.visible=Vr(i,e.doc,t),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.wrapperWidth=i.wrapper.clientWidth,this.oldDisplayWidth=Fn(e),this.force=n,this.dims=_a(e),this.events=[]};Yr.prototype.signal=function(e,t){pe(e,t)&&this.events.push(arguments)},Yr.prototype.finish=function(){for(var e=0;e<this.events.length;e++)ke.apply(null,this.events[e])};function sl(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=bn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=bn(e)+"px",t.scrollbarsClipped=!0)}function ol(e){if(e.hasFocus())return null;var t=N();if(!t||!E(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var i=window.getSelection();i.anchorNode&&i.extend&&E(e.display.lineDiv,i.anchorNode)&&(n.anchorNode=i.anchorNode,n.anchorOffset=i.anchorOffset,n.focusNode=i.focusNode,n.focusOffset=i.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==N())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&E(document.body,e.anchorNode)&&E(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 Ca(e,t){var n=e.display,i=e.doc;if(t.editorIsHidden)return Ln(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&&fs(e)==0)return!1;Cs(e)&&(Ln(e),t.dims=_a(e));var a=i.first+i.size,k=Math.max(t.visible.from-e.options.viewportMargin,i.first),z=Math.min(a,t.visible.to+e.options.viewportMargin);n.viewFrom<k&&k-n.viewFrom<20&&(k=Math.max(i.first,n.viewFrom)),n.viewTo>z&&n.viewTo-z<20&&(z=Math.min(a,n.viewTo)),pi&&(k=cr(e.doc,k),z=Rn(e.doc,z));var J=k!=n.viewFrom||z!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vo(e,k,z),n.viewOffset=hn(vt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var Q=fs(e);if(!J&&Q==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var ee=ol(e);return Q>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),Q>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(ee),x(n.cursorDiv),x(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,J&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,wr(e,400)),n.updateLineNumbers=null,!0}function ws(e,t){for(var n=t.viewport,i=!0;;i=!1){if(!i||!e.options.lineWrapping||t.oldDisplayWidth==Fn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+da(e.display)-ca(e),n.top)}),t.visible=Vr(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else i&&(t.visible=Vr(e.display,e.doc,n));if(!Ca(e,t))break;Kr(e);var a=xr(e);_r(e),er(e,a),Oa(e,a),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 Yr(e,t);if(Ca(e,n)){Kr(e),ws(e,n);var i=xr(e);_r(e),er(e,i),Oa(e,i),n.finish()}}function ul(e,t,n){var i=e.display,a=e.options.lineNumbers,k=i.lineDiv,z=k.firstChild;function J(Be){var Ke=Be.nextSibling;return M&&s&&e.display.currentWheelTarget==Be?Be.style.display="none":Be.parentNode.removeChild(Be),Ke}for(var Q=i.view,ee=i.viewFrom,ce=0;ce<Q.length;ce++){var ye=Q[ce];if(!ye.hidden)if(!ye.node||ye.node.parentNode!=k){var Oe=No(e,ye,ee,n);k.insertBefore(Oe,z)}else{for(;z!=ye.node;)z=J(z);var Ae=a&&t!=null&&t<=ee&&ye.lineNumber;ye.changes&&(ie(ye.changes,"gutter")>-1&&(Ae=!1),Ya(e,ye,ee,n)),Ae&&(x(ye.lineNumber),ye.lineNumber.appendChild(document.createTextNode(pn(e.options,ee)))),z=ye.node.nextSibling}ee+=ye.size}for(;z;)z=J(z)}function Ra(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Oa(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+bn(e)+"px"}function Ss(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var i=ba(t)-t.scroller.scrollLeft+e.doc.scrollLeft,a=t.gutters.offsetWidth,k=i+"px",z=0;z<n.length;z++)if(!n[z].hidden){e.options.fixedGutter&&(n[z].gutter&&(n[z].gutter.style.left=k),n[z].gutterBackground&&(n[z].gutterBackground.style.left=k));var J=n[z].alignable;if(J)for(var Q=0;Q<J.length;Q++)J[Q].style.left=k}e.options.fixedGutter&&(t.gutters.style.left=i+a+"px")}function Cs(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=pn(e.options,t.first+t.size-1),i=e.display;if(n.length!=i.lineNumChars){var a=i.measure.appendChild(d("div",[d("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),k=a.firstChild.offsetWidth,z=a.offsetWidth-k;return i.lineGutter.style.width="",i.lineNumInnerWidth=Math.max(k,i.lineGutter.offsetWidth-z)+1,i.lineNumWidth=i.lineNumInnerWidth+z,i.lineNumChars=i.lineNumInnerWidth?n.length:-1,i.lineGutter.style.width=i.lineNumWidth+"px",Ra(e.display),!0}return!1}function La(e,t){for(var n=[],i=!1,a=0;a<e.length;a++){var k=e[a],z=null;if(typeof k!="string"&&(z=k.style,k=k.className),k=="CodeMirror-linenumbers")if(t)i=!0;else continue;n.push({className:k,style:z})}return t&&!i&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function As(e){var t=e.gutters,n=e.gutterSpecs;x(t),e.lineGutter=null;for(var i=0;i<n.length;++i){var a=n[i],k=a.className,z=a.style,J=t.appendChild(d("div",null,"CodeMirror-gutter "+k));z&&(J.style.cssText=z),k=="CodeMirror-linenumbers"&&(e.lineGutter=J,J.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Ra(e)}function Sr(e){As(e.display),zi(e),Ss(e)}function hl(e,t,n,i){var a=this;this.input=n,a.scrollbarFiller=d("div",null,"CodeMirror-scrollbar-filler"),a.scrollbarFiller.setAttribute("cm-not-content","true"),a.gutterFiller=d("div",null,"CodeMirror-gutter-filler"),a.gutterFiller.setAttribute("cm-not-content","true"),a.lineDiv=u("div",null,"CodeMirror-code"),a.selectionDiv=d("div",null,null,"position: relative; z-index: 1"),a.cursorDiv=d("div",null,"CodeMirror-cursors"),a.measure=d("div",null,"CodeMirror-measure"),a.lineMeasure=d("div",null,"CodeMirror-measure"),a.lineSpace=u("div",[a.measure,a.lineMeasure,a.selectionDiv,a.cursorDiv,a.lineDiv],null,"position: relative; outline: none");var k=u("div",[a.lineSpace],"CodeMirror-lines");a.mover=d("div",[k],null,"position: relative"),a.sizer=d("div",[a.mover],"CodeMirror-sizer"),a.sizerWidth=null,a.heightForcer=d("div",null,null,"position: absolute; height: "+oe+"px; width: 1px;"),a.gutters=d("div",null,"CodeMirror-gutters"),a.lineGutter=null,a.scroller=d("div",[a.sizer,a.heightForcer,a.gutters],"CodeMirror-scroll"),a.scroller.setAttribute("tabIndex","-1"),a.wrapper=d("div",[a.scrollbarFiller,a.gutterFiller,a.scroller],"CodeMirror"),K&&G<8&&(a.gutters.style.zIndex=-1,a.scroller.style.paddingRight=0),!M&&!(P&&r)&&(a.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(a.wrapper):e(a.wrapper)),a.viewFrom=a.viewTo=t.first,a.reportedViewFrom=a.reportedViewTo=t.first,a.view=[],a.renderedView=null,a.externalMeasured=null,a.viewOffset=0,a.lastWrapHeight=a.lastWrapWidth=0,a.updateLineNumbers=null,a.nativeBarWidth=a.barHeight=a.barWidth=0,a.scrollbarsClipped=!1,a.lineNumWidth=a.lineNumInnerWidth=a.lineNumChars=null,a.alignWidgets=!1,a.cachedCharWidth=a.cachedTextHeight=a.cachedPaddingH=null,a.maxLine=null,a.maxLineLength=0,a.maxLineChanged=!1,a.wheelDX=a.wheelDY=a.wheelStartX=a.wheelStartY=null,a.shift=!1,a.selForContextMenu=null,a.activeTouch=null,a.gutterSpecs=La(i.gutters,i.lineNumbers),As(a),n.init(a)}var $r=0,en=null;K?en=-.53:P?en=15:v?en=-.7:p&&(en=-1/3);function Rs(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 dl(e){var t=Rs(e);return t.x*=en,t.y*=en,t}function Os(e,t){var n=Rs(t),i=n.x,a=n.y,k=e.display,z=k.scroller,J=z.scrollWidth>z.clientWidth,Q=z.scrollHeight>z.clientHeight;if(!(i&&J||a&&Q))return;if(a&&s&&M){e:for(var ee=t.target,ce=k.view;ee!=z;ee=ee.parentNode)for(var ye=0;ye<ce.length;ye++)if(ce[ye].node==ee){e.display.currentWheelTarget=ee;break e}}if(i&&!P&&!m&&en!=null){a&&Q&&Er(e,Math.max(0,z.scrollTop+a*en)),Wn(e,Math.max(0,z.scrollLeft+i*en)),(!a||a&&Q)&&re(t),k.wheelStartX=null;return}if(a&&en!=null){var Oe=a*en,Ae=e.doc.scrollTop,Be=Ae+k.wrapper.clientHeight;Oe<0?Ae=Math.max(0,Ae+Oe-50):Be=Math.min(e.doc.height,Be+Oe+50),Aa(e,{top:Ae,bottom:Be})}$r<20&&(k.wheelStartX==null?(k.wheelStartX=z.scrollLeft,k.wheelStartY=z.scrollTop,k.wheelDX=i,k.wheelDY=a,setTimeout(function(){if(k.wheelStartX==null)return;var Ke=z.scrollLeft-k.wheelStartX,qe=z.scrollTop-k.wheelStartY,st=qe&&k.wheelDY&&qe/k.wheelDY||Ke&&k.wheelDX&&Ke/k.wheelDX;if(k.wheelStartX=k.wheelStartY=null,!st)return;en=(en*$r+st)/($r+1),++$r},200)):(k.wheelDX+=i,k.wheelDY+=a))}var tn=function(e,t){this.ranges=e,this.primIndex=t};tn.prototype.primary=function(){return this.ranges[this.primIndex]},tn.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],i=e.ranges[t];if(!mn(n.anchor,i.anchor)||!mn(n.head,i.head))return!1}return!0},tn.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new qt(gn(this.ranges[t].anchor),gn(this.ranges[t].head));return new tn(e,this.primIndex)},tn.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},tn.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var i=this.ranges[n];if(Ct(t,i.from())>=0&&Ct(e,i.to())<=0)return n}return-1};var qt=function(e,t){this.anchor=e,this.head=t};qt.prototype.from=function(){return Zi(this.anchor,this.head)},qt.prototype.to=function(){return vn(this.anchor,this.head)},qt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function cn(e,t,n){var i=e&&e.options.selectionsMayTouch,a=t[n];t.sort(function(Oe,Ae){return Ct(Oe.from(),Ae.from())}),n=ie(t,a);for(var k=1;k<t.length;k++){var z=t[k],J=t[k-1],Q=Ct(J.to(),z.from());if(i&&!z.empty()?Q>0:Q>=0){var ee=Zi(J.from(),z.from()),ce=vn(J.to(),z.to()),ye=J.empty()?z.from()==z.head:J.from()==J.head;k<=n&&--n,t.splice(--k,2,new qt(ye?ce:ee,ye?ee:ce))}}return new tn(t,n)}function In(e,t){return new tn([new qt(e,t||e)],0)}function kn(e){return e.text?Ye(e.from.line+e.text.length-1,te(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ls(e,t){if(Ct(e,t.from)<0)return e;if(Ct(e,t.to)<=0)return kn(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=kn(t).ch-t.to.ch),Ye(n,i)}function Ia(e,t){for(var n=[],i=0;i<e.sel.ranges.length;i++){var a=e.sel.ranges[i];n.push(new qt(Ls(a.anchor,t),Ls(a.head,t)))}return cn(e.cm,n,e.sel.primIndex)}function Is(e,t,n){return e.line==t.line?Ye(n.line,e.ch-t.ch+n.ch):Ye(n.line+(e.line-t.line),e.ch)}function cl(e,t,n){for(var i=[],a=Ye(e.first,0),k=a,z=0;z<t.length;z++){var J=t[z],Q=Is(J.from,a,k),ee=Is(kn(J),a,k);if(a=J.to,k=ee,n=="around"){var ce=e.sel.ranges[z],ye=Ct(ce.head,ce.anchor)<0;i[z]=new qt(ye?ee:Q,ye?Q:ee)}else i[z]=new qt(Q,Q)}return new tn(i,e.sel.primIndex)}function ka(e){e.doc.mode=Et(e.options,e.doc.modeOption),Cr(e)}function Cr(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,wr(e,100),e.state.modeGen++,e.curOp&&zi(e)}function ks(e,t){return t.from.ch==0&&t.to.ch==0&&te(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Da(e,t,n,i){function a(ct){return n?n[ct]:null}function k(ct,ot,gt){ua(ct,ot,gt,i),Li(ct,"change",ct,t)}function z(ct,ot){for(var gt=[],At=ct;At<ot;++At)gt.push(new Un(ee[At],a(At),i));return gt}var J=t.from,Q=t.to,ee=t.text,ce=vt(e,J.line),ye=vt(e,Q.line),Oe=te(ee),Ae=a(ee.length-1),Be=Q.line-J.line;if(t.full)e.insert(0,z(0,ee.length)),e.remove(ee.length,e.size-ee.length);else if(ks(e,t)){var Ke=z(0,ee.length-1);k(ye,ye.text,Ae),Be&&e.remove(J.line,Be),Ke.length&&e.insert(J.line,Ke)}else if(ce==ye)if(ee.length==1)k(ce,ce.text.slice(0,J.ch)+Oe+ce.text.slice(Q.ch),Ae);else{var qe=z(1,ee.length-1);qe.push(new Un(Oe+ce.text.slice(Q.ch),Ae,i)),k(ce,ce.text.slice(0,J.ch)+ee[0],a(0)),e.insert(J.line+1,qe)}else if(ee.length==1)k(ce,ce.text.slice(0,J.ch)+ee[0]+ye.text.slice(Q.ch),a(0)),e.remove(J.line+1,Be);else{k(ce,ce.text.slice(0,J.ch)+ee[0],a(0)),k(ye,Oe+ye.text.slice(Q.ch),Ae);var st=z(1,ee.length-1);Be>1&&e.remove(J.line+1,Be-1),e.insert(J.line+1,st)}Li(e,"change",e,t)}function Dn(e,t,n){function i(a,k,z){if(a.linked)for(var J=0;J<a.linked.length;++J){var Q=a.linked[J];if(Q.doc==k)continue;var ee=z&&Q.sharedHist;if(n&&!ee)continue;t(Q.doc,ee),i(Q.doc,a,ee)}}i(e,null,!0)}function Ds(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ea(e),ka(e),Ps(e),e.options.lineWrapping||jr(e),e.options.mode=t.modeOption,zi(e)}function Ps(e){(e.doc.direction=="rtl"?D:S)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){$i(e,function(){Ps(e),zi(e)})}function Jr(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 Pa(e,t){var n={from:gn(t.from),to:kn(t),text:ji(e,t.from,t.to)};return Us(e,n,t.from.line,t.to.line+1),Dn(e,function(i){return Us(i,n,t.from.line,t.to.line+1)},!0),n}function Ms(e){for(;e.length;){var t=te(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Ms(e.done),te(e.done);if(e.done.length&&!te(e.done).ranges)return te(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),te(e.done)}function Ns(e,t,n,i){var a=e.history;a.undone.length=0;var k=+new Date,z,J;if((a.lastOp==i||a.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&a.lastModTime>k-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(z=pl(a,a.lastOp==i)))J=te(z.changes),Ct(t.from,t.to)==0&&Ct(t.from,J.to)==0?J.to=kn(t):z.changes.push(Pa(e,t));else{var Q=te(a.done);for((!Q||!Q.ranges)&&Zr(e.sel,a.done),z={changes:[Pa(e,t)],generation:a.generation},a.done.push(z);a.done.length>a.undoDepth;)a.done.shift(),a.done[0].ranges||a.done.shift()}a.done.push(n),a.generation=++a.maxGeneration,a.lastModTime=a.lastSelTime=k,a.lastOp=a.lastSelOp=i,a.lastOrigin=a.lastSelOrigin=t.origin,J||ke(e,"historyAdded")}function ml(e,t,n,i){var a=t.charAt(0);return a=="*"||a=="+"&&n.ranges.length==i.ranges.length&&n.somethingSelected()==i.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,i){var a=e.history,k=i&&i.origin;n==a.lastSelOp||k&&a.lastSelOrigin==k&&(a.lastModTime==a.lastSelTime&&a.lastOrigin==k||ml(e,k,te(a.done),t))?a.done[a.done.length-1]=t:Zr(t,a.done),a.lastSelTime=+new Date,a.lastSelOrigin=k,a.lastSelOp=n,i&&i.clearRedo!==!1&&Ms(a.undone)}function Zr(e,t){var n=te(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Us(e,t,n,i){var a=t["spans_"+e.id],k=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,i),function(z){z.markedSpans&&((a||(a=t["spans_"+e.id]={}))[k]=z.markedSpans),++k})}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 i=[],a=0;a<t.text.length;++a)i.push(vl(n[a]));return i}function Fs(e,t){var n=yl(e,t),i=Vt(e,t);if(!n)return i;if(!i)return n;for(var a=0;a<n.length;++a){var k=n[a],z=i[a];if(k&&z){e:for(var J=0;J<z.length;++J){for(var Q=z[J],ee=0;ee<k.length;++ee)if(k[ee].marker==Q.marker)continue e;k.push(Q)}}else z&&(n[a]=z)}return n}function tr(e,t,n){for(var i=[],a=0;a<e.length;++a){var k=e[a];if(k.ranges){i.push(n?tn.prototype.deepCopy.call(k):k);continue}var z=k.changes,J=[];i.push({changes:J});for(var Q=0;Q<z.length;++Q){var ee=z[Q],ce=void 0;if(J.push({from:ee.from,to:ee.to,text:ee.text}),t)for(var ye in ee)(ce=ye.match(/^spans_(\d+)$/))&&(ie(t,Number(ce[1]))>-1&&(te(J)[ye]=ee[ye],delete ee[ye]))}}return i}function Ma(e,t,n,i){if(i){var a=e.anchor;if(n){var k=Ct(t,a)<0;k!=Ct(n,a)<0?(a=t,t=n):k!=Ct(t,n)<0&&(t=n)}return new qt(a,t)}else return new qt(n||t,t)}function Qr(e,t,n,i,a){a==null&&(a=e.cm&&(e.cm.display.shift||e.extend)),Pi(e,new tn([Ma(e.sel.primary(),t,n,a)],0),i)}function Bs(e,t,n){for(var i=[],a=e.cm&&(e.cm.display.shift||e.extend),k=0;k<e.sel.ranges.length;k++)i[k]=Ma(e.sel.ranges[k],t[k],null,a);var z=cn(e.cm,i,e.sel.primIndex);Pi(e,z,n)}function Na(e,t,n,i){var a=e.sel.ranges.slice(0);a[t]=n,Pi(e,cn(e.cm,a,e.sel.primIndex),i)}function js(e,t,n,i){Pi(e,In(t,n),i)}function _l(e,t,n){var i={ranges:t.ranges,update:function(a){this.ranges=[];for(var k=0;k<a.length;k++)this.ranges[k]=new qt(y(e,a[k].anchor),y(e,a[k].head))},origin:n&&n.origin};return ke(e,"beforeSelectionChange",e,i),e.cm&&ke(e.cm,"beforeSelectionChange",e.cm,i),i.ranges!=t.ranges?cn(e.cm,i.ranges,i.ranges.length-1):t}function Hs(e,t,n){var i=e.history.done,a=te(i);a&&a.ranges?(i[i.length-1]=t,qr(e,t,n)):Pi(e,t,n)}function Pi(e,t,n){qr(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function qr(e,t,n){(pe(e,"beforeSelectionChange")||e.cm&&pe(e.cm,"beforeSelectionChange"))&&(t=_l(e,t,n));var i=n&&n.bias||(Ct(t.primary().head,e.sel.primary().head)<0?-1:1);Ws(e,zs(e,t,i,!0)),!(n&&n.scroll===!1)&&e.cm&&qn(e.cm)}function Ws(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Ee(e.cm)),Li(e,"cursorActivity",e)}function Gs(e){Ws(e,zs(e,e.sel,null,!1))}function zs(e,t,n,i){for(var a,k=0;k<t.ranges.length;k++){var z=t.ranges[k],J=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[k],Q=ea(e,z.anchor,J&&J.anchor,n,i),ee=ea(e,z.head,J&&J.head,n,i);(a||Q!=z.anchor||ee!=z.head)&&(a||(a=t.ranges.slice(0,k)),a[k]=new qt(Q,ee))}return a?cn(e.cm,a,t.primIndex):t}function ir(e,t,n,i,a){var k=vt(e,t.line);if(k.markedSpans)for(var z=0;z<k.markedSpans.length;++z){var J=k.markedSpans[z],Q=J.marker,ee="selectLeft"in Q?!Q.selectLeft:Q.inclusiveLeft,ce="selectRight"in Q?!Q.selectRight:Q.inclusiveRight;if((J.from==null||(ee?J.from<=t.ch:J.from<t.ch))&&(J.to==null||(ce?J.to>=t.ch:J.to>t.ch))){if(a&&(ke(Q,"beforeCursorEnter"),Q.explicitlyCleared))if(k.markedSpans){--z;continue}else break;if(!Q.atomic)continue;if(n){var ye=Q.find(i<0?1:-1),Oe=void 0;if((i<0?ce:ee)&&(ye=Ks(e,ye,-i,ye&&ye.line==t.line?k:null)),ye&&ye.line==t.line&&(Oe=Ct(ye,n))&&(i<0?Oe<0:Oe>0))return ir(e,ye,t,i,a)}var Ae=Q.find(i<0?-1:1);return(i<0?ee:ce)&&(Ae=Ks(e,Ae,i,Ae.line==t.line?k:null)),Ae?ir(e,Ae,t,i,a):null}}return t}function ea(e,t,n,i,a){var k=i||1,z=ir(e,t,n,k,a)||!a&&ir(e,t,n,k,!0)||ir(e,t,n,-k,a)||!a&&ir(e,t,n,-k,!0);return z||(e.cantEdit=!0,Ye(e.first,0))}function Ks(e,t,n,i){return n<0&&t.ch==0?t.line>e.first?y(e,Ye(t.line-1)):null:n>0&&t.ch==(i||vt(e,t.line)).text.length?t.line<e.first+e.size-1?Ye(t.line+1,0):null:new Ye(t.line,t.ch+n)}function Vs(e){e.setSelection(Ye(e.firstLine(),0),Ye(e.lastLine()),ve)}function Xs(e,t,n){var i={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return i.canceled=!0}};return n&&(i.update=function(a,k,z,J){a&&(i.from=y(e,a)),k&&(i.to=y(e,k)),z&&(i.text=z),J!==void 0&&(i.origin=J)}),ke(e,"beforeChange",e,i),e.cm&&ke(e.cm,"beforeChange",e.cm,i),i.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:i.from,to:i.to,text:i.text,origin:i.origin}}function nr(e,t,n){if(e.cm){if(!e.cm.curOp)return wi(e.cm,nr)(e,t,n);if(e.cm.state.suppressEdits)return}if((pe(e,"beforeChange")||e.cm&&pe(e.cm,"beforeChange"))&&(t=Xs(e,t,!0),!t))return;var i=on&&!n&&Zt(e,t.from,t.to);if(i)for(var a=i.length-1;a>=0;--a)Ys(e,{from:i[a].from,to:i[a].to,text:a?[""]:t.text,origin:t.origin});else Ys(e,t)}function Ys(e,t){if(t.text.length==1&&t.text[0]==""&&Ct(t.from,t.to)==0)return;var n=Ia(e,t);Ns(e,t,n,e.cm?e.cm.curOp.id:NaN),Ar(e,t,n,Vt(e,t));var i=[];Dn(e,function(a,k){!k&&ie(i,a.history)==-1&&(Qs(a.history,t),i.push(a.history)),Ar(a,t,null,Vt(a,t))})}function ta(e,t,n){var i=e.cm&&e.cm.state.suppressEdits;if(i&&!n)return;for(var a=e.history,k,z=e.sel,J=t=="undo"?a.done:a.undone,Q=t=="undo"?a.undone:a.done,ee=0;ee<J.length&&!(k=J[ee],n?k.ranges&&!k.equals(e.sel):!k.ranges);ee++);if(ee==J.length)return;for(a.lastOrigin=a.lastSelOrigin=null;;)if(k=J.pop(),k.ranges){if(Zr(k,Q),n&&!k.equals(e.sel)){Pi(e,k,{clearRedo:!1});return}z=k}else if(i){J.push(k);return}else break;var ce=[];Zr(z,Q),Q.push({changes:ce,generation:a.generation}),a.generation=k.generation||++a.maxGeneration;for(var ye=pe(e,"beforeChange")||e.cm&&pe(e.cm,"beforeChange"),Oe=function(Ke){var qe=k.changes[Ke];if(qe.origin=t,ye&&!Xs(e,qe,!1))return J.length=0,{};ce.push(Pa(e,qe));var st=Ke?Ia(e,qe):te(J);Ar(e,qe,st,Fs(e,qe)),!Ke&&e.cm&&e.cm.scrollIntoView({from:qe.from,to:kn(qe)});var ct=[];Dn(e,function(ot,gt){!gt&&ie(ct,ot.history)==-1&&(Qs(ot.history,qe),ct.push(ot.history)),Ar(ot,qe,null,Fs(ot,qe))})},Ae=k.changes.length-1;Ae>=0;--Ae){var Be=Oe(Ae);if(Be)return Be.v}}function $s(e,t){if(t==0)return;if(e.first+=t,e.sel=new tn(de(e.sel.ranges,function(a){return new qt(Ye(a.anchor.line+t,a.anchor.ch),Ye(a.head.line+t,a.head.ch))}),e.sel.primIndex),e.cm){zi(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,i=n.viewFrom;i<n.viewTo;i++)On(e.cm,i,"gutter")}}function Ar(e,t,n,i){if(e.cm&&!e.cm.curOp)return wi(e.cm,Ar)(e,t,n,i);if(t.to.line<e.first){$s(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 a=t.text.length-1-(e.first-t.from.line);$s(e,a),t={from:Ye(e.first,0),to:Ye(t.to.line+a,t.to.ch),text:[te(t.text)],origin:t.origin}}var k=e.lastLine();t.to.line>k&&(t={from:t.from,to:Ye(k,vt(e,k).text.length),text:[t.text[0]],origin:t.origin}),t.removed=ji(e,t.from,t.to),n||(n=Ia(e,t)),e.cm?bl(e.cm,t,i):Da(e,t,i),qr(e,n,ve),e.cantEdit&&ea(e,Ye(e.firstLine(),0))&&(e.cantEdit=!1)}function bl(e,t,n){var i=e.doc,a=e.display,k=t.from,z=t.to,J=!1,Q=k.line;e.options.lineWrapping||(Q=Mt(Ui(vt(i,k.line))),i.iter(Q,z.line+1,function(Ae){if(Ae==a.maxLine)return J=!0,!0})),i.sel.contains(t.from,t.to)>-1&&Ee(e),Da(i,t,n,cs(e)),e.options.lineWrapping||(i.iter(Q,k.line+t.text.length,function(Ae){var Be=pr(Ae);Be>a.maxLineLength&&(a.maxLine=Ae,a.maxLineLength=Be,a.maxLineChanged=!0,J=!1)}),J&&(e.curOp.updateMaxLine=!0)),Qi(i,k.line),wr(e,400);var ee=t.text.length-(z.line-k.line)-1;t.full?zi(e):k.line==z.line&&t.text.length==1&&!ks(e.doc,t)?On(e,k.line,"text"):zi(e,k.line,z.line+1,ee);var ce=pe(e,"changes"),ye=pe(e,"change");if(ye||ce){var Oe={from:k,to:z,text:t.text,removed:t.removed,origin:t.origin};ye&&Li(e,"change",e,Oe),ce&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Oe)}e.display.selForContextMenu=null}function rr(e,t,n,i,a){var k;i||(i=n),Ct(i,n)<0&&(k=[i,n],n=k[0],i=k[1]),typeof t=="string"&&(t=e.splitLines(t)),nr(e,{from:n,to:i,text:t,origin:a})}function Js(e,t,n,i){n<e.line?e.line+=i:t<e.line&&(e.line=t,e.ch=0)}function Zs(e,t,n,i){for(var a=0;a<e.length;++a){var k=e[a],z=!0;if(k.ranges){k.copied||(k=e[a]=k.deepCopy(),k.copied=!0);for(var J=0;J<k.ranges.length;J++)Js(k.ranges[J].anchor,t,n,i),Js(k.ranges[J].head,t,n,i);continue}for(var Q=0;Q<k.changes.length;++Q){var ee=k.changes[Q];if(n<ee.from.line)ee.from=Ye(ee.from.line+i,ee.from.ch),ee.to=Ye(ee.to.line+i,ee.to.ch);else if(t<=ee.to.line){z=!1;break}}z||(e.splice(0,a+1),a=0)}}function Qs(e,t){var n=t.from.line,i=t.to.line,a=t.text.length-(i-n)-1;Zs(e.done,n,i,a),Zs(e.undone,n,i,a)}function Rr(e,t,n,i){var a=t,k=t;return typeof t=="number"?k=vt(e,X(e,t)):a=Mt(t),a==null?null:(i(k,a)&&e.cm&&On(e.cm,a,n),k)}function Or(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}Or.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,i=e+t;n<i;++n){var a=this.lines[n];this.height-=a.height,bt(a),Li(a,"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 i=0;i<t.length;++i)t[i].parent=this},iterN:function(e,t,n){for(var i=e+t;e<i;++e)if(n(this.lines[e]))return!0}};function Lr(e){this.children=e;for(var t=0,n=0,i=0;i<e.length;++i){var a=e[i];t+=a.chunkSize(),n+=a.height,a.parent=this}this.size=t,this.height=n,this.parent=null}Lr.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var i=this.children[n],a=i.chunkSize();if(e<a){var k=Math.min(t,a-e),z=i.height;if(i.removeInner(e,k),this.height-=z-i.height,a==k&&(this.children.splice(n--,1),i.parent=null),(t-=k)==0)break;e=0}else e-=a}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Or))){var J=[];this.collapse(J),this.children=[new Or(J)],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 i=0;i<this.children.length;++i){var a=this.children[i],k=a.chunkSize();if(e<=k){if(a.insertInner(e,t,n),a.lines&&a.lines.length>50){for(var z=a.lines.length%25+25,J=z;J<a.lines.length;){var Q=new Or(a.lines.slice(J,J+=25));a.height-=Q.height,this.children.splice(++i,0,Q),Q.parent=this}a.lines=a.lines.slice(0,z),this.maybeSpill()}break}e-=k}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new Lr(t);if(e.parent){e.size-=n.size,e.height-=n.height;var a=ie(e.parent.children,e);e.parent.children.splice(a+1,0,n)}else{var i=new Lr(e.children);i.parent=e,e.children=[i,n],e=i}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var i=0;i<this.children.length;++i){var a=this.children[i],k=a.chunkSize();if(e<k){var z=Math.min(t,k-e);if(a.iterN(e,z,n))return!0;if((t-=z)==0)break;e=0}else e-=k}}};var Ir=function(e,t,n){if(n)for(var i in n)n.hasOwnProperty(i)&&(this[i]=n[i]);this.doc=e,this.node=t};Ir.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,i=Mt(n);if(i==null||!t)return;for(var a=0;a<t.length;++a)t[a]==this&&t.splice(a--,1);t.length||(n.widgets=null);var k=vr(this);Ei(n,Math.max(0,n.height-k)),e&&($i(e,function(){qs(e,n,-k),On(e,i,"widget")}),Li(e,"lineWidgetCleared",e,this,i))},Ir.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,i=this.line;this.height=null;var a=vr(this)-t;if(!a)return;_n(this.doc,i)||Ei(i,i.height+a),n&&$i(n,function(){n.curOp.forceUpdate=!0,qs(n,i,a),Li(n,"lineWidgetChanged",n,e,Mt(i))})},_e(Ir);function qs(e,t,n){hn(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Sa(e,n)}function El(e,t,n,i){var a=new Ir(e,n,i),k=e.cm;return k&&a.noHScroll&&(k.display.alignWidgets=!0),Rr(e,t,"widget",function(z){var J=z.widgets||(z.widgets=[]);if(a.insertAt==null?J.push(a):J.splice(Math.min(J.length-1,Math.max(0,a.insertAt)),0,a),a.line=z,k&&!_n(e,z)){var Q=hn(z)<e.scrollTop;Ei(z,z.height+vr(a)),Q&&Sa(k,a.height),k.curOp.forceUpdate=!0}return!0}),k&&Li(k,"lineWidgetAdded",k,a,typeof t=="number"?t:Mt(t)),a}var eo=0,Pn=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++eo};Pn.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&zn(e),pe(this,"clear")){var n=this.find();n&&Li(this,"clear",n.from,n.to)}for(var i=null,a=null,k=0;k<this.lines.length;++k){var z=this.lines[k],J=rt(z.markedSpans,this);e&&!this.collapsed?On(e,Mt(z),"text"):e&&(J.to!=null&&(a=Mt(z)),J.from!=null&&(i=Mt(z))),z.markedSpans=kt(z.markedSpans,J),J.from==null&&this.collapsed&&!_n(this.doc,z)&&e&&Ei(z,Jn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var Q=0;Q<this.lines.length;++Q){var ee=Ui(this.lines[Q]),ce=pr(ee);ce>e.display.maxLineLength&&(e.display.maxLine=ee,e.display.maxLineLength=ce,e.display.maxLineChanged=!0)}i!=null&&e&&this.collapsed&&zi(e,i,a+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Gs(e.doc)),e&&Li(e,"markerCleared",e,this,i,a),t&&Kn(e),this.parent&&this.parent.clear()},Pn.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,i,a=0;a<this.lines.length;++a){var k=this.lines[a],z=rt(k.markedSpans,this);if(z.from!=null&&(n=Ye(t?k:Mt(k),z.from),e==-1))return n;if(z.to!=null&&(i=Ye(t?k:Mt(k),z.to),e==1))return i}return n&&{from:n,to:i}},Pn.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,i=this.doc.cm;if(!t||!i)return;$i(i,function(){var a=t.line,k=Mt(t.line),z=fa(i,k);if(z&&(rs(z),i.curOp.selectionChanged=i.curOp.forceUpdate=!0),i.curOp.updateMaxLine=!0,!_n(n.doc,a)&&n.height!=null){var J=n.height;n.height=null;var Q=vr(n)-J;Q&&Ei(a,a.height+Q)}Li(i,"markerChanged",i,e)})},Pn.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ie(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Pn.prototype.detachLine=function(e){if(this.lines.splice(ie(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},_e(Pn);function ar(e,t,n,i,a){if(i&&i.shared)return xl(e,t,n,i,a);if(e.cm&&!e.cm.curOp)return wi(e.cm,ar)(e,t,n,i,a);var k=new Pn(e,a),z=Ct(t,n);if(i&&b(i,k,!1),z>0||z==0&&k.clearWhenEmpty!==!1)return k;if(k.replacedWith&&(k.collapsed=!0,k.widgetNode=u("span",[k.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||k.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(k.widgetNode.insertLeft=!0)),k.collapsed){if(Ti(e,t.line,t,n,k)||t.line!=n.line&&Ti(e,n.line,t,n,k))throw new Error("Inserting collapsed marker partially overlapping an existing one");ln()}k.addToHistory&&Ns(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var J=t.line,Q=e.cm,ee;if(e.iter(J,n.line+1,function(ye){Q&&k.collapsed&&!Q.options.lineWrapping&&Ui(ye)==Q.display.maxLine&&(ee=!0),k.collapsed&&J!=t.line&&Ei(ye,0),Jt(ye,new qi(k,J==t.line?t.ch:null,J==n.line?n.ch:null)),++J}),k.collapsed&&e.iter(t.line,n.line+1,function(ye){_n(e,ye)&&Ei(ye,0)}),k.clearOnEnter&&Pe(k,"beforeCursorEnter",function(){return k.clear()}),k.readOnly&&(Ni(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),k.collapsed&&(k.id=++eo,k.atomic=!0),Q){if(ee&&(Q.curOp.updateMaxLine=!0),k.collapsed)zi(Q,t.line,n.line+1);else if(k.className||k.startStyle||k.endStyle||k.css||k.attributes||k.title)for(var ce=t.line;ce<=n.line;ce++)On(Q,ce,"text");k.atomic&&Gs(Q.doc),Li(Q,"markerAdded",Q,k)}return k}var kr=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};kr.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Li(this,"clear")},kr.prototype.find=function(e,t){return this.primary.find(e,t)},_e(kr);function xl(e,t,n,i,a){i=b(i),i.shared=!1;var k=[ar(e,t,n,i,a)],z=k[0],J=i.widgetNode;return Dn(e,function(Q){J&&(i.widgetNode=J.cloneNode(!0)),k.push(ar(Q,y(Q,t),y(Q,n),i,a));for(var ee=0;ee<Q.linked.length;++ee)if(Q.linked[ee].isParent)return;z=te(k)}),new kr(k,z)}function to(e){return e.findMarks(Ye(e.first,0),e.clipPos(Ye(e.lastLine())),function(t){return t.parent})}function Tl(e,t){for(var n=0;n<t.length;n++){var i=t[n],a=i.find(),k=e.clipPos(a.from),z=e.clipPos(a.to);if(Ct(k,z)){var J=ar(e,k,z,i.primary,i.primary.type);i.markers.push(J),J.parent=i}}}function wl(e){for(var t=function(i){var a=e[i],k=[a.primary.doc];Dn(a.primary.doc,function(Q){return k.push(Q)});for(var z=0;z<a.markers.length;z++){var J=a.markers[z];ie(k,J.doc)==-1&&(J.parent=null,a.markers.splice(z--,1))}},n=0;n<e.length;n++)t(n)}var Sl=0,Ki=function(e,t,n,i,a){if(!(this instanceof Ki))return new Ki(e,t,n,i,a);n==null&&(n=0),Lr.call(this,[new Or([new Un("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var k=Ye(n,0);this.sel=In(k),this.history=new Jr(null),this.id=++Sl,this.modeOption=t,this.lineSep=i,this.direction=a=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Da(this,{from:k,to:k,text:e}),Pi(this,In(k),ve)};Ki.prototype=Le(Lr.prototype,{constructor:Ki,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,i=0;i<t.length;++i)n+=t[i].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=nn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Si(function(e){var t=Ye(this.first,0),n=this.first+this.size-1;nr(this,{from:t,to:Ye(n,vt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&br(this.cm,0,0),Pi(this,In(t),ve)}),replaceRange:function(e,t,n,i){t=y(this,t),n=n?y(this,n):t,rr(this,e,t,n,i)},getRange:function(e,t,n){var i=ji(this,y(this,e),y(this,t));return n===!1?i:i.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Ri(this,e))return vt(this,e)},getLineNumber:function(e){return Mt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=vt(this,e)),Ui(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return y(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:Si(function(e,t,n){js(this,y(this,typeof e=="number"?Ye(e,t||0):e),null,n)}),setSelection:Si(function(e,t,n){js(this,y(this,e),y(this,t||e),n)}),extendSelection:Si(function(e,t,n){Qr(this,y(this,e),t&&y(this,t),n)}),extendSelections:Si(function(e,t){Bs(this,F(this,e),t)}),extendSelectionsBy:Si(function(e,t){var n=de(this.sel.ranges,e);Bs(this,F(this,n),t)}),setSelections:Si(function(e,t,n){if(!e.length)return;for(var i=[],a=0;a<e.length;a++)i[a]=new qt(y(this,e[a].anchor),y(this,e[a].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Pi(this,cn(this.cm,i,t),n)}),addSelection:Si(function(e,t,n){var i=this.sel.ranges.slice(0);i.push(new qt(y(this,e),y(this,t||e))),Pi(this,cn(this.cm,i,i.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,i=0;i<t.length;i++){var a=ji(this,t[i].from(),t[i].to());n=n?n.concat(a):a}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,i=0;i<n.length;i++){var a=ji(this,n[i].from(),n[i].to());e!==!1&&(a=a.join(e||this.lineSeparator())),t[i]=a}return t},replaceSelection:function(e,t,n){for(var i=[],a=0;a<this.sel.ranges.length;a++)i[a]=e;this.replaceSelections(i,t,n||"+input")},replaceSelections:Si(function(e,t,n){for(var i=[],a=this.sel,k=0;k<a.ranges.length;k++){var z=a.ranges[k];i[k]={from:z.from(),to:z.to(),text:this.splitLines(e[k]),origin:n}}for(var J=t&&t!="end"&&cl(this,i,t),Q=i.length-1;Q>=0;Q--)nr(this,i[Q]);J?Hs(this,J):this.cm&&qn(this.cm)}),undo:Si(function(){ta(this,"undo")}),redo:Si(function(){ta(this,"redo")}),undoSelection:Si(function(){ta(this,"undo",!0)}),redoSelection:Si(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,i=0;i<e.done.length;i++)e.done[i].ranges||++t;for(var a=0;a<e.undone.length;a++)e.undone[a].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Jr(this.history.maxGeneration),Dn(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:tr(this.history.done),undone:tr(this.history.undone)}},setHistory:function(e){var t=this.history=new Jr(this.history.maxGeneration);t.done=tr(e.done.slice(0),null,!0),t.undone=tr(e.undone.slice(0),null,!0)},setGutterMarker:Si(function(e,t,n){return Rr(this,e,"gutter",function(i){var a=i.gutterMarkers||(i.gutterMarkers={});return a[t]=n,!n&&We(a)&&(i.gutterMarkers=null),!0})}),clearGutter:Si(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&Rr(t,n,"gutter",function(){return n.gutterMarkers[e]=null,We(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Ri(this,e))return null;if(t=e,e=vt(this,e),!e)return null}else if(t=Mt(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:Si(function(e,t,n){return Rr(this,e,t=="gutter"?"gutter":"class",function(i){var a=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!i[a])i[a]=n;else{if(C(n).test(i[a]))return!1;i[a]+=" "+n}return!0})}),removeLineClass:Si(function(e,t,n){return Rr(this,e,t=="gutter"?"gutter":"class",function(i){var a=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",k=i[a];if(k)if(n==null)i[a]=null;else{var z=k.match(C(n));if(!z)return!1;var J=z.index+z[0].length;i[a]=k.slice(0,z.index)+(!z.index||J==k.length?"":" ")+k.slice(J)||null}else return!1;return!0})}),addLineWidget:Si(function(e,t,n){return El(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return ar(this,y(this,e),y(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=y(this,e),ar(this,e,e,n,"bookmark")},findMarksAt:function(e){e=y(this,e);var t=[],n=vt(this,e.line).markedSpans;if(n)for(var i=0;i<n.length;++i){var a=n[i];(a.from==null||a.from<=e.ch)&&(a.to==null||a.to>=e.ch)&&t.push(a.marker.parent||a.marker)}return t},findMarks:function(e,t,n){e=y(this,e),t=y(this,t);var i=[],a=e.line;return this.iter(e.line,t.line+1,function(k){var z=k.markedSpans;if(z)for(var J=0;J<z.length;J++){var Q=z[J];!(Q.to!=null&&a==e.line&&e.ch>=Q.to||Q.from==null&&a!=e.line||Q.from!=null&&a==t.line&&Q.from>=t.ch)&&(!n||n(Q.marker))&&i.push(Q.marker.parent||Q.marker)}++a}),i},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var i=0;i<n.length;++i)n[i].from!=null&&e.push(n[i].marker)}),e},posFromIndex:function(e){var t,n=this.first,i=this.lineSeparator().length;return this.iter(function(a){var k=a.text.length+i;if(k>e)return t=e,!0;e-=k,++n}),y(this,Ye(n,t))},indexFromPos:function(e){e=y(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(i){t+=i.text.length+n}),t},copy:function(e){var t=new Ki(nn(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var i=new Ki(nn(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(i.history=this.history),(this.linked||(this.linked=[])).push({doc:i,sharedHist:e.sharedHist}),i.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Tl(i,to(this)),i},unlinkDoc:function(e){if(e instanceof li&&(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),wl(to(this));break}if(e.history==this.history){var i=[e.id];Dn(e,function(a){return i.push(a.id)},!0),e.history=new Jr(null),e.history.done=tr(this.history.done,i),e.history.undone=tr(this.history.undone,i)}},iterLinkedDocs:function(e){Dn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Rt(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:Si(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)})}),Ki.prototype.eachLine=Ki.prototype.iter;var io=0;function Cl(e){var t=this;if(no(t),Ge(t,e)||wn(t.display,e))return;re(e),K&&(io=+new Date);var n=jn(t,e,!0),i=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(i&&i.length&&window.FileReader&&window.File)for(var a=i.length,k=Array(a),z=0,J=function(){++z==a&&wi(t,function(){n=y(t.doc,n);var Ae={from:n,to:n,text:t.doc.splitLines(k.filter(function(Be){return Be!=null}).join(t.doc.lineSeparator())),origin:"paste"};nr(t.doc,Ae),Hs(t.doc,In(y(t.doc,n),y(t.doc,kn(Ae))))})()},Q=function(Ae,Be){if(t.options.allowDropFileTypes&&ie(t.options.allowDropFileTypes,Ae.type)==-1){J();return}var Ke=new FileReader;Ke.onerror=function(){return J()},Ke.onload=function(){var qe=Ke.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(qe)){J();return}k[Be]=qe,J()},Ke.readAsText(Ae)},ee=0;ee<i.length;ee++)Q(i[ee],ee);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 ce=e.dataTransfer.getData("Text");if(ce){var ye;if(t.state.draggingText&&!t.state.draggingText.copy&&(ye=t.listSelections()),qr(t.doc,In(n,n)),ye)for(var Oe=0;Oe<ye.length;++Oe)rr(t.doc,"",ye[Oe].anchor,ye[Oe].head,"drag");t.replaceSelection(ce,"around","paste"),t.display.input.focus()}}catch(Ae){}}}function Al(e,t){if(K&&(!e.state.draggingText||+new Date-io<100)){ge(t);return}if(Ge(e,t)||wn(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!p){var n=d("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",m&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),m&&n.parentNode.removeChild(n)}}function Rl(e,t){var n=jn(e,t);if(!n)return;var i=document.createDocumentFragment();ms(e,n,i),e.display.dragCursor||(e.display.dragCursor=d("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),_(e.display.dragCursor,i)}function no(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ro(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],i=0;i<t.length;i++){var a=t[i].CodeMirror;a&&n.push(a)}n.length&&n[0].operation(function(){for(var k=0;k<n.length;k++)e(n[k])})}var ao=!1;function Ol(){if(ao)return;Ll(),ao=!0}function Ll(){var e;Pe(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ro(Il)},100))}),Pe(window,"blur",function(){return ro(Qn)})}function Il(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Mn={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"},Dr=0;Dr<10;Dr++)Mn[Dr+48]=Mn[Dr+96]=String(Dr);for(var ia=65;ia<=90;ia++)Mn[ia]=String.fromCharCode(ia);for(var Pr=1;Pr<=12;Pr++)Mn[Pr+111]=Mn[Pr+63235]="F"+Pr;var Sn={};Sn.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"},Sn.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"},Sn.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"},Sn.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"]},Sn.default=s?Sn.macDefault:Sn.pcDefault;function kl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,i,a,k,z=0;z<t.length-1;z++){var J=t[z];if(/^(cmd|meta|m)$/i.test(J))k=!0;else if(/^a(lt)?$/i.test(J))n=!0;else if(/^(c|ctrl|control)$/i.test(J))i=!0;else if(/^s(hift)?$/i.test(J))a=!0;else throw new Error("Unrecognized modifier name: "+J)}return n&&(e="Alt-"+e),i&&(e="Ctrl-"+e),k&&(e="Cmd-"+e),a&&(e="Shift-"+e),e}function Dl(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(i=="..."){delete e[n];continue}for(var a=de(n.split(" "),kl),k=0;k<a.length;k++){var z=void 0,J=void 0;k==a.length-1?(J=a.join(" "),z=i):(J=a.slice(0,k+1).join(" "),z="...");var Q=t[J];if(!Q)t[J]=z;else if(Q!=z)throw new Error("Inconsistent bindings for "+J)}delete e[n]}for(var ee in t)e[ee]=t[ee];return e}function sr(e,t,n,i){t=na(t);var a=t.call?t.call(e,i):t[e];if(a===!1)return"nothing";if(a==="...")return"multi";if(a!=null&&n(a))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return sr(e,t.fallthrough,n,i);for(var k=0;k<t.fallthrough.length;k++){var z=sr(e,t.fallthrough[k],n,i);if(z)return z}}}function so(e){var t=typeof e=="string"?e:Mn[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function oo(e,t,n){var i=e;return t.altKey&&i!="Alt"&&(e="Alt-"+e),(T?t.metaKey:t.ctrlKey)&&i!="Ctrl"&&(e="Ctrl-"+e),(T?t.ctrlKey:t.metaKey)&&i!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&i!="Shift"&&(e="Shift-"+e),e}function lo(e,t){if(m&&e.keyCode==34&&e.char)return!1;var n=Mn[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),oo(n,e,t))}function na(e){return typeof e=="string"?Sn[e]:e}function or(e,t){for(var n=e.doc.sel.ranges,i=[],a=0;a<n.length;a++){for(var k=t(n[a]);i.length&&Ct(k.from,te(i).to)<=0;){var z=i.pop();if(Ct(z.from,k.from)<0){k.from=z.from;break}}i.push(k)}$i(e,function(){for(var J=i.length-1;J>=0;J--)rr(e.doc,"",i[J].from,i[J].to,"+delete");qn(e)})}function Ua(e,t,n){var i=Me(e.text,t+n,n);return i<0||i>e.text.length?null:i}function Fa(e,t,n){var i=Ua(e,t.ch,n);return i==null?null:new Ye(t.line,i,n<0?"after":"before")}function Ba(e,t,n,i,a){if(e){t.doc.direction=="rtl"&&(a=-a);var k=it(n,t.doc.direction);if(k){var z=a<0?te(k):k[0],J=a<0==(z.level==1),Q=J?"after":"before",ee;if(z.level>0||t.doc.direction=="rtl"){var ce=$n(t,n);ee=a<0?n.text.length-1:0;var ye=En(t,ce,ee).top;ee=$e(function(Oe){return En(t,ce,Oe).top==ye},a<0==(z.level==1)?z.from:z.to-1,ee),Q=="before"&&(ee=Ua(n,ee,1))}else ee=a<0?z.to:z.from;return new Ye(i,ee,Q)}}return new Ye(i,a<0?n.text.length:0,a<0?"before":"after")}function Pl(e,t,n,i){var a=it(t,e.doc.direction);if(!a)return Fa(t,n,i);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var k=Ze(a,n.ch,n.sticky),z=a[k];if(e.doc.direction=="ltr"&&z.level%2==0&&(i>0?z.to>n.ch:z.from<n.ch))return Fa(t,n,i);var J=function(st,ct){return Ua(t,st instanceof Ye?st.ch:st,ct)},Q,ee=function(st){return e.options.lineWrapping?(Q=Q||$n(e,t),ds(e,t,Q,st)):{begin:0,end:t.text.length}},ce=ee(n.sticky=="before"?J(n,-1):n.ch);if(e.doc.direction=="rtl"||z.level==1){var ye=z.level==1==i<0,Oe=J(n,ye?1:-1);if(Oe!=null&&(ye?Oe<=z.to&&Oe<=ce.end:Oe>=z.from&&Oe>=ce.begin)){var Ae=ye?"before":"after";return new Ye(n.line,Oe,Ae)}}var Be=function(st,ct,ot){for(var gt=function(ai,Ci){return Ci?new Ye(n.line,J(ai,1),"before"):new Ye(n.line,ai,"after")};st>=0&&st<a.length;st+=ct){var At=a[st],Tt=ct>0==(At.level!=1),Nt=Tt?ot.begin:J(ot.end,-1);if(At.from<=Nt&&Nt<At.to)return gt(Nt,Tt);if(Nt=Tt?At.from:J(At.to,-1),ot.begin<=Nt&&Nt<ot.end)return gt(Nt,Tt)}},Ke=Be(k+i,i,ce);if(Ke)return Ke;var qe=i>0?ce.end:J(ce.begin,-1);return qe!=null&&!(i>0&&qe==t.text.length)&&(Ke=Be(i>0?0:a.length-1,i,ee(qe)),Ke)?Ke:null}var Mr={selectAll:Vs,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ve)},killLine:function(e){return or(e,function(t){if(t.empty()){var n=vt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Ye(t.head.line+1,0)}:{from:t.head,to:Ye(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return or(e,function(t){return{from:Ye(t.from().line,0),to:y(e.doc,Ye(t.to().line+1,0))}})},delLineLeft:function(e){return or(e,function(t){return{from:Ye(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return or(e,function(t){var n=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:n},"div");return{from:i,to:t.from()}})},delWrappedLineRight:function(e){return or(e,function(t){var n=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:i}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Ye(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ye(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return uo(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ho(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Ml(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")},Ce)},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")},Ce)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:n},"div");return i.ch<e.getLine(i.line).search(/\S/)?ho(e,t.head):i},Ce)},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(),i=e.options.tabSize,a=0;a<n.length;a++){var k=n[a].from(),z=W(e.getLine(k.line),k.ch,i);t.push(le(i-z%i))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return $i(e,function(){for(var t=e.listSelections(),n=[],i=0;i<t.length;i++){if(!t[i].empty())continue;var a=t[i].head,k=vt(e.doc,a.line).text;if(k){if(a.ch==k.length&&(a=new Ye(a.line,a.ch-1)),a.ch>0)a=new Ye(a.line,a.ch+1),e.replaceRange(k.charAt(a.ch-1)+k.charAt(a.ch-2),Ye(a.line,a.ch-2),a,"+transpose");else if(a.line>e.doc.first){var z=vt(e.doc,a.line-1).text;z&&(a=new Ye(a.line,1),e.replaceRange(k.charAt(0)+e.doc.lineSeparator()+z.charAt(z.length-1),Ye(a.line-1,z.length-1),a,"+transpose"))}}n.push(new qt(a,a))}e.setSelections(n)})},newlineAndIndent:function(e){return $i(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 i=0;i<t.length;i++)e.indentLine(t[i].from().line,null,!0);qn(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function uo(e,t){var n=vt(e.doc,t),i=Ui(n);return i!=n&&(t=Mt(i)),Ba(!0,e,i,t,1)}function Ml(e,t){var n=vt(e.doc,t),i=Yn(n);return i!=n&&(t=Mt(i)),Ba(!0,e,n,t,-1)}function ho(e,t){var n=uo(e,t.line),i=vt(e.doc,n.line),a=it(i,e.doc.direction);if(!a||a[0].level==0){var k=Math.max(n.ch,i.text.search(/\S/)),z=t.line==n.line&&t.ch<=k&&t.ch;return Ye(n.line,z?0:k,n.sticky)}return n}function ra(e,t,n){if(typeof t=="string"&&(t=Mr[t],!t))return!1;e.display.input.ensurePolled();var i=e.display.shift,a=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),a=t(e)!=xe}finally{e.display.shift=i,e.state.suppressEdits=!1}return a}function Nl(e,t,n){for(var i=0;i<e.state.keyMaps.length;i++){var a=sr(t,e.state.keyMaps[i],n,e);if(a)return a}return e.options.extraKeys&&sr(t,e.options.extraKeys,n,e)||sr(t,e.options.keyMap,n,e)}var Ul=new Y;function Nr(e,t,n,i){var a=e.state.keySeq;if(a){if(so(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ul.set(50,function(){e.state.keySeq==a&&(e.state.keySeq=null,e.display.input.reset())}),co(e,a+" "+t,n,i))return!0}return co(e,t,n,i)}function co(e,t,n,i){var a=Nl(e,t,i);return a=="multi"&&(e.state.keySeq=t),a=="handled"&&Li(e,"keyHandled",e,t,n),(a=="handled"||a=="multi")&&(re(n),xa(e)),!!a}function fo(e,t){var n=lo(t,!0);return n?t.shiftKey&&!e.state.keySeq?Nr(e,"Shift-"+n,t,function(i){return ra(e,i,!0)})||Nr(e,n,t,function(i){if(typeof i=="string"?/^go[A-Z]/.test(i):i.motion)return ra(e,i)}):Nr(e,n,t,function(i){return ra(e,i)}):!1}function Fl(e,t,n){return Nr(e,"'"+n+"'",t,function(i){return ra(e,i,!0)})}var ja=null;function po(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=N(),Ge(t,e))return;K&&G<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var i=fo(t,e);m&&(ja=i?n:null,!i&&n==88&&!It&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),P&&!s&&!i&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;D(t,"CodeMirror-crosshair");function n(i){(i.keyCode==18||!i.altKey)&&(S(t,"CodeMirror-crosshair"),tt(document,"keyup",n),tt(document,"mouseover",n))}Pe(document,"keyup",n),Pe(document,"mouseover",n)}function mo(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ge(this,e)}function go(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(wn(t.display,e)||Ge(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,i=e.charCode;if(m&&n==ja){ja=null,re(e);return}if(m&&(!e.which||e.which<10)&&fo(t,e))return;var a=String.fromCharCode(i==null?n:i);if(a=="\b")return;if(Fl(t,e,a))return;t.display.input.onKeyPress(e)}var jl=400,Ha=function(e,t,n){this.time=e,this.pos=t,this.button=n};Ha.prototype.compare=function(e,t,n){return this.time+jl>e&&Ct(t,this.pos)==0&&n==this.button};var Ur,Fr;function Hl(e,t){var n=+new Date;return Fr&&Fr.compare(n,e,t)?(Ur=Fr=null,"triple"):Ur&&Ur.compare(n,e,t)?(Fr=new Ha(n,e,t),Ur=null,"double"):(Ur=new Ha(n,e,t),Fr=null,"single")}function vo(e){var t=this,n=t.display;if(Ge(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,wn(n,e)){M||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Wa(t,e))return;var i=jn(t,e),a=De(e),k=i?Hl(i,a):"single";if(window.focus(),a==1&&t.state.selectingText&&t.state.selectingText(e),i&&Wl(t,a,i,k,e))return;a==1?i?zl(t,i,k,e):be(e)==n.scroller&&re(e):a==2?(i&&Qr(t.doc,i),setTimeout(function(){return n.input.focus()},20)):a==3&&(R?t.display.input.onContextMenu(e):vs(t))}function Wl(e,t,n,i,a){var k="Click";return i=="double"?k="Double"+k:i=="triple"&&(k="Triple"+k),k=(t==1?"Left":t==2?"Middle":"Right")+k,Nr(e,oo(k,a),a,function(z){if(typeof z=="string"&&(z=Mr[z]),!z)return!1;var J=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),J=z(e,n)!=xe}finally{e.state.suppressEdits=!1}return J})}function Gl(e,t,n){var i=e.getOption("configureMouse"),a=i?i(e,t,n):{};if(a.unit==null){var k=c?n.shiftKey&&n.metaKey:n.altKey;a.unit=k?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(a.extend==null||e.doc.extend)&&(a.extend=e.doc.extend||n.shiftKey),a.addNew==null&&(a.addNew=s?n.metaKey:n.ctrlKey),a.moveOnDrag==null&&(a.moveOnDrag=!(s?n.altKey:n.ctrlKey)),a}function zl(e,t,n,i){K?setTimeout(I(gs,e),0):e.curOp.focus=N();var a=Gl(e,n,i),k=e.doc.sel,z;e.options.dragDrop&&je&&!e.isReadOnly()&&n=="single"&&(z=k.contains(t))>-1&&(Ct((z=k.ranges[z]).from(),t)<0||t.xRel>0)&&(Ct(z.to(),t)>0||t.xRel<0)?Kl(e,i,t,a):Vl(e,i,t,a)}function Kl(e,t,n,i){var a=e.display,k=!1,z=wi(e,function(ee){M&&(a.scroller.draggable=!1),e.state.draggingText=!1,tt(a.wrapper.ownerDocument,"mouseup",z),tt(a.wrapper.ownerDocument,"mousemove",J),tt(a.scroller,"dragstart",Q),tt(a.scroller,"drop",z),k||(re(ee),i.addNew||Qr(e.doc,n,null,null,i.extend),M&&!p||K&&G==9?setTimeout(function(){a.wrapper.ownerDocument.body.focus({preventScroll:!0}),a.input.focus()},20):a.input.focus())}),J=function(ee){k=k||Math.abs(t.clientX-ee.clientX)+Math.abs(t.clientY-ee.clientY)>=10},Q=function(){return k=!0};M&&(a.scroller.draggable=!0),e.state.draggingText=z,z.copy=!i.moveOnDrag,a.scroller.dragDrop&&a.scroller.dragDrop(),Pe(a.wrapper.ownerDocument,"mouseup",z),Pe(a.wrapper.ownerDocument,"mousemove",J),Pe(a.scroller,"dragstart",Q),Pe(a.scroller,"drop",z),vs(e),setTimeout(function(){return a.input.focus()},20)}function yo(e,t,n){if(n=="char")return new qt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new qt(Ye(t.line,0),y(e.doc,Ye(t.line+1,0)));var i=n(e,t);return new qt(i.from,i.to)}function Vl(e,t,n,i){var a=e.display,k=e.doc;re(t);var z,J,Q=k.sel,ee=Q.ranges;if(i.addNew&&!i.extend?(J=k.sel.contains(n),J>-1?z=ee[J]:z=new qt(n,n)):(z=k.sel.primary(),J=k.sel.primIndex),i.unit=="rectangle")i.addNew||(z=new qt(n,n)),n=jn(e,t,!0,!0),J=-1;else{var ce=yo(e,n,i.unit);i.extend?z=Ma(z,ce.anchor,ce.head,i.extend):z=ce}i.addNew?J==-1?(J=ee.length,Pi(k,cn(e,ee.concat([z]),J),{scroll:!1,origin:"*mouse"})):ee.length>1&&ee[J].empty()&&i.unit=="char"&&!i.extend?(Pi(k,cn(e,ee.slice(0,J).concat(ee.slice(J+1)),0),{scroll:!1,origin:"*mouse"}),Q=k.sel):Na(k,J,z,we):(J=0,Pi(k,new tn([z],0),we),Q=k.sel);var ye=n;function Oe(ot){if(Ct(ye,ot)==0)return;if(ye=ot,i.unit=="rectangle"){for(var gt=[],At=e.options.tabSize,Tt=W(vt(k,n.line).text,n.ch,At),Nt=W(vt(k,ot.line).text,ot.ch,At),ai=Math.min(Tt,Nt),Ci=Math.max(Tt,Nt),hi=Math.min(n.line,ot.line),Ji=Math.min(e.lastLine(),Math.max(n.line,ot.line));hi<=Ji;hi++){var Vi=vt(k,hi).text,gi=Se(Vi,ai,At);ai==Ci?gt.push(new qt(Ye(hi,gi),Ye(hi,gi))):Vi.length>gi&&gt.push(new qt(Ye(hi,gi),Ye(hi,Se(Vi,Ci,At))))}gt.length||gt.push(new qt(n,n)),Pi(k,cn(e,Q.ranges.slice(0,J).concat(gt),J),{origin:"*mouse",scroll:!1}),e.scrollIntoView(ot)}else{var Xi=z,Ii=yo(e,ot,i.unit),bi=Xi.anchor,vi;Ct(Ii.anchor,bi)>0?(vi=Ii.head,bi=Zi(Xi.from(),Ii.anchor)):(vi=Ii.anchor,bi=vn(Xi.to(),Ii.head));var di=Q.ranges.slice(0);di[J]=Xl(e,new qt(y(k,bi),vi)),Pi(k,cn(e,di,J),we)}}var Ae=a.wrapper.getBoundingClientRect(),Be=0;function Ke(ot){var gt=++Be,At=jn(e,ot,!0,i.unit=="rectangle");if(!At)return;if(Ct(At,ye)!=0){e.curOp.focus=N(),Oe(At);var Tt=Vr(a,k);(At.line>=Tt.to||At.line<Tt.from)&&setTimeout(wi(e,function(){Be==gt&&Ke(ot)}),150)}else{var Nt=ot.clientY<Ae.top?-20:ot.clientY>Ae.bottom?20:0;Nt&&setTimeout(wi(e,function(){if(Be!=gt)return;a.scroller.scrollTop+=Nt,Ke(ot)}),50)}}function qe(ot){e.state.selectingText=!1,Be=Infinity,ot&&(re(ot),a.input.focus()),tt(a.wrapper.ownerDocument,"mousemove",st),tt(a.wrapper.ownerDocument,"mouseup",ct),k.history.lastSelOrigin=null}var st=wi(e,function(ot){ot.buttons===0||!De(ot)?qe(ot):Ke(ot)}),ct=wi(e,qe);e.state.selectingText=ct,Pe(a.wrapper.ownerDocument,"mousemove",st),Pe(a.wrapper.ownerDocument,"mouseup",ct)}function Xl(e,t){var n=t.anchor,i=t.head,a=vt(e.doc,n.line);if(Ct(n,i)==0&&n.sticky==i.sticky)return t;var k=it(a);if(!k)return t;var z=Ze(k,n.ch,n.sticky),J=k[z];if(J.from!=n.ch&&J.to!=n.ch)return t;var Q=z+(J.from==n.ch==(J.level!=1)?0:1);if(Q==0||Q==k.length)return t;var ee;if(i.line!=n.line)ee=(i.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ce=Ze(k,i.ch,i.sticky),ye=ce-z||(i.ch-n.ch)*(J.level==1?-1:1);ce==Q-1||ce==Q?ee=ye<0:ee=ye>0}var Oe=k[Q+(ee?-1:0)],Ae=ee==(Oe.level==1),Be=Ae?Oe.from:Oe.to,Ke=Ae?"after":"before";return n.ch==Be&&n.sticky==Ke?t:new qt(new Ye(n.line,Be,Ke),i)}function _o(e,t,n,i){var a,k;if(t.touches)a=t.touches[0].clientX,k=t.touches[0].clientY;else try{a=t.clientX,k=t.clientY}catch(Oe){return!1}if(a>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;i&&re(t);var z=e.display,J=z.lineDiv.getBoundingClientRect();if(k>J.bottom||!pe(e,n))return he(t);k-=J.top-z.viewOffset;for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var ee=z.gutters.childNodes[Q];if(ee&&ee.getBoundingClientRect().right>=a){var ce=Hi(e.doc,k),ye=e.display.gutterSpecs[Q];return ke(e,n,e,ce,ye.className,t),he(t)}}}function Wa(e,t){return _o(e,t,"gutterClick",!0)}function bo(e,t){if(wn(e.display,t)||Yl(e,t))return;if(Ge(e,t,"contextmenu"))return;R||e.display.input.onContextMenu(t)}function Yl(e,t){return pe(e,"gutterContextMenu")?_o(e,t,"gutterContextMenu",!1):!1}function Eo(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),yr(e)}var lr={toString:function(){return"CodeMirror.Init"}},xo={},aa={};function $l(e){var t=e.optionHandlers;function n(i,a,k,z){e.defaults[i]=a,k&&(t[i]=z?function(J,Q,ee){ee!=lr&&k(J,Q,ee)}:k)}e.defineOption=n,e.Init=lr,n("value","",function(i,a){return i.setValue(a)},!0),n("mode",null,function(i,a){i.doc.modeOption=a,ka(i)},!0),n("indentUnit",2,ka,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(i){Cr(i),yr(i),zi(i)},!0),n("lineSeparator",null,function(i,a){if(i.doc.lineSep=a,!a)return;var k=[],z=i.doc.first;i.doc.iter(function(Q){for(var ee=0;;){var ce=Q.text.indexOf(a,ee);if(ce==-1)break;ee=ce+a.length,k.push(Ye(z,ce))}z++});for(var J=k.length-1;J>=0;J--)rr(i.doc,a,k[J],Ye(k[J].line,k[J].ch+a.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(i,a,k){i.state.specialChars=new RegExp(a.source+(a.test(" ")?"":"| "),"g"),k!=lr&&i.refresh()}),n("specialCharPlaceholder",ri,function(i){return i.refresh()},!0),n("electricChars",!0),n("inputStyle",r?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(i,a){return i.getInputField().spellcheck=a},!0),n("autocorrect",!1,function(i,a){return i.getInputField().autocorrect=a},!0),n("autocapitalize",!1,function(i,a){return i.getInputField().autocapitalize=a},!0),n("rtlMoveVisually",!L),n("wholeLineUpdateBefore",!0),n("theme","default",function(i){Eo(i),Sr(i)},!0),n("keyMap","default",function(i,a,k){var z=na(a),J=k!=lr&&na(k);J&&J.detach&&J.detach(i,z),z.attach&&z.attach(i,J||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Zl,!0),n("gutters",[],function(i,a){i.display.gutterSpecs=La(a,i.options.lineNumbers),Sr(i)},!0),n("fixedGutter",!0,function(i,a){i.display.gutters.style.left=a?ba(i.display)+"px":"0",i.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(i){return er(i)},!0),n("scrollbarStyle","native",function(i){Ts(i),er(i),i.display.scrollbars.setScrollTop(i.doc.scrollTop),i.display.scrollbars.setScrollLeft(i.doc.scrollLeft)},!0),n("lineNumbers",!1,function(i,a){i.display.gutterSpecs=La(i.options.gutters,a),Sr(i)},!0),n("firstLineNumber",1,Sr,!0),n("lineNumberFormatter",function(i){return i},Sr,!0),n("showCursorWhenSelecting",!1,_r,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(i,a){a=="nocursor"&&(Qn(i),i.display.input.blur()),i.display.input.readOnlyChanged(a)}),n("screenReaderLabel",null,function(i,a){a=a===""?null:a,i.display.input.screenReaderLabelChanged(a)}),n("disableInput",!1,function(i,a){a||i.display.input.reset()},!0),n("dragDrop",!0,Jl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,_r,!0),n("singleCursorHeightPerLine",!0,_r,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Cr,!0),n("addModeClass",!1,Cr,!0),n("pollInterval",100),n("undoDepth",200,function(i,a){return i.doc.history.undoDepth=a}),n("historyEventDelay",1250),n("viewportMargin",10,function(i){return i.refresh()},!0),n("maxHighlightLength",1e4,Cr,!0),n("moveInputWithCursor",!0,function(i,a){a||i.display.input.resetPosition()}),n("tabindex",null,function(i,a){return i.display.input.getField().tabIndex=a||""}),n("autofocus",null),n("direction","ltr",function(i,a){return i.doc.setDirection(a)},!0),n("phrases",null)}function Jl(e,t,n){var i=n&&n!=lr;if(!t!=!i){var a=e.display.dragFunctions,k=t?Pe:tt;k(e.display.scroller,"dragstart",a.start),k(e.display.scroller,"dragenter",a.enter),k(e.display.scroller,"dragover",a.over),k(e.display.scroller,"dragleave",a.leave),k(e.display.scroller,"drop",a.drop)}}function Zl(e){e.options.lineWrapping?(D(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(S(e.display.wrapper,"CodeMirror-wrap"),jr(e)),Ea(e),zi(e),yr(e),setTimeout(function(){return er(e)},100)}function li(e,t){var n=this;if(!(this instanceof li))return new li(e,t);this.options=t=t?b(t):{},b(xo,t,!1);var i=t.value;typeof i=="string"?i=new Ki(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode),this.doc=i;var a=new li.inputStyles[t.inputStyle](this),k=this.display=new hl(e,i,a,t);k.wrapper.CodeMirror=this,Eo(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ts(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 Y,keySeq:null,specialChars:null},t.autofocus&&!r&&k.input.focus(),K&&G<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Ql(this),Ol(),zn(this),this.curOp.forceUpdate=!0,Ds(this,i),t.autofocus&&!r||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Ta(n)},20):Qn(this);for(var z in aa)aa.hasOwnProperty(z)&&aa[z](this,t[z],lr);Cs(this),t.finishInit&&t.finishInit(this);for(var J=0;J<Ga.length;++J)Ga[J](this);Kn(this),M&&t.lineWrapping&&getComputedStyle(k.lineDiv).textRendering=="optimizelegibility"&&(k.lineDiv.style.textRendering="auto")}li.defaults=xo,li.optionHandlers=aa;function Ql(e){var t=e.display;Pe(t.scroller,"mousedown",wi(e,vo)),K&&G<11?Pe(t.scroller,"dblclick",wi(e,function(Q){if(Ge(e,Q))return;var ee=jn(e,Q);if(!ee||Wa(e,Q)||wn(e.display,Q))return;re(Q);var ce=e.findWordAt(ee);Qr(e.doc,ce.anchor,ce.head)})):Pe(t.scroller,"dblclick",function(Q){return Ge(e,Q)||re(Q)}),Pe(t.scroller,"contextmenu",function(Q){return bo(e,Q)}),Pe(t.input.getField(),"contextmenu",function(Q){t.scroller.contains(Q.target)||bo(e,Q)});var n,i={end:0};function a(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),i=t.activeTouch,i.end=+new Date)}function k(Q){if(Q.touches.length!=1)return!1;var ee=Q.touches[0];return ee.radiusX<=1&&ee.radiusY<=1}function z(Q,ee){if(ee.left==null)return!0;var ce=ee.left-Q.left,ye=ee.top-Q.top;return ce*ce+ye*ye>20*20}Pe(t.scroller,"touchstart",function(Q){if(!Ge(e,Q)&&!k(Q)&&!Wa(e,Q)){t.input.ensurePolled(),clearTimeout(n);var ee=+new Date;t.activeTouch={start:ee,moved:!1,prev:ee-i.end<=300?i:null},Q.touches.length==1&&(t.activeTouch.left=Q.touches[0].pageX,t.activeTouch.top=Q.touches[0].pageY)}}),Pe(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Pe(t.scroller,"touchend",function(Q){var ee=t.activeTouch;if(ee&&!wn(t,Q)&&ee.left!=null&&!ee.moved&&new Date-ee.start<300){var ce=e.coordsChar(t.activeTouch,"page"),ye;!ee.prev||z(ee,ee.prev)?ye=new qt(ce,ce):!ee.prev.prev||z(ee,ee.prev.prev)?ye=e.findWordAt(ce):ye=new qt(Ye(ce.line,0),y(e.doc,Ye(ce.line+1,0))),e.setSelection(ye.anchor,ye.head),e.focus(),re(Q)}a()}),Pe(t.scroller,"touchcancel",a),Pe(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Er(e,t.scroller.scrollTop),Wn(e,t.scroller.scrollLeft,!0),ke(e,"scroll",e))}),Pe(t.scroller,"mousewheel",function(Q){return Os(e,Q)}),Pe(t.scroller,"DOMMouseScroll",function(Q){return Os(e,Q)}),Pe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(Q){Ge(e,Q)||ge(Q)},over:function(Q){Ge(e,Q)||(Rl(e,Q),ge(Q))},start:function(Q){return Al(e,Q)},drop:wi(e,Cl),leave:function(Q){Ge(e,Q)||no(e)}};var J=t.input.getField();Pe(J,"keyup",function(Q){return mo.call(e,Q)}),Pe(J,"keydown",wi(e,po)),Pe(J,"keypress",wi(e,go)),Pe(J,"focus",function(Q){return Ta(e,Q)}),Pe(J,"blur",function(Q){return Qn(e,Q)})}var Ga=[];li.defineInitHook=function(e){return Ga.push(e)};function Br(e,t,n,i){var a=e.doc,k;n==null&&(n="add"),n=="smart"&&(a.mode.indent?k=nt(e,t).state:n="prev");var z=e.options.tabSize,J=vt(a,t),Q=W(J.text,null,z);J.stateAfter&&(J.stateAfter=null);var ee=J.text.match(/^\s*/)[0],ce;if(!i&&!/\S/.test(J.text))ce=0,n="not";else if(n=="smart"&&(ce=a.mode.indent(k,J.text.slice(ee.length),J.text),ce==xe||ce>150)){if(!i)return;n="prev"}n=="prev"?t>a.first?ce=W(vt(a,t-1).text,null,z):ce=0:n=="add"?ce=Q+e.options.indentUnit:n=="subtract"?ce=Q-e.options.indentUnit:typeof n=="number"&&(ce=Q+n),ce=Math.max(0,ce);var ye="",Oe=0;if(e.options.indentWithTabs)for(var Ae=Math.floor(ce/z);Ae;--Ae)Oe+=z,ye+=" ";if(Oe<ce&&(ye+=le(ce-Oe)),ye!=ee)return rr(a,ye,Ye(t,0),Ye(t,ee.length),"+input"),J.stateAfter=null,!0;for(var Be=0;Be<a.sel.ranges.length;Be++){var Ke=a.sel.ranges[Be];if(Ke.head.line==t&&Ke.head.ch<ee.length){var qe=Ye(t,ee.length);Na(a,Be,new qt(qe,qe));break}}}var fn=null;function sa(e){fn=e}function za(e,t,n,i,a){var k=e.doc;e.display.shift=!1,i||(i=k.sel);var z=+new Date-200,J=a=="paste"||e.state.pasteIncoming>z,Q=Rt(t),ee=null;if(J&&i.ranges.length>1)if(fn&&fn.text.join(`
`)==t){if(i.ranges.length%fn.text.length==0){ee=[];for(var ce=0;ce<fn.text.length;ce++)ee.push(k.splitLines(fn.text[ce]))}}else Q.length==i.ranges.length&&e.options.pasteLinesPerSelection&&(ee=de(Q,function(st){return[st]}));for(var ye=e.curOp.updateInput,Oe=i.ranges.length-1;Oe>=0;Oe--){var Ae=i.ranges[Oe],Be=Ae.from(),Ke=Ae.to();Ae.empty()&&(n&&n>0?Be=Ye(Be.line,Be.ch-n):e.state.overwrite&&!J?Ke=Ye(Ke.line,Math.min(vt(k,Ke.line).text.length,Ke.ch+te(Q).length)):J&&fn&&fn.lineWise&&fn.text.join(`
`)==Q.join(`
`)&&(Be=Ke=Ye(Be.line,0)));var qe={from:Be,to:Ke,text:ee?ee[Oe%ee.length]:Q,origin:a||(J?"paste":e.state.cutIncoming>z?"cut":"+input")};nr(e.doc,qe),Li(e,"inputRead",e,qe)}t&&!J&&wo(e,t),qn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ye),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function To(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&$i(t,function(){return za(t,n,0,null,"paste")}),!0}function wo(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,i=n.ranges.length-1;i>=0;i--){var a=n.ranges[i];if(a.head.ch>100||i&&n.ranges[i-1].head.line==a.head.line)continue;var k=e.getModeAt(a.head),z=!1;if(k.electricChars){for(var J=0;J<k.electricChars.length;J++)if(t.indexOf(k.electricChars.charAt(J))>-1){z=Br(e,a.head.line,"smart");break}}else k.electricInput&&(k.electricInput.test(vt(e.doc,a.head.line).text.slice(0,a.head.ch))&&(z=Br(e,a.head.line,"smart")));z&&Li(e,"electricInput",e,a.head.line)}}function So(e){for(var t=[],n=[],i=0;i<e.doc.sel.ranges.length;i++){var a=e.doc.sel.ranges[i].head.line,k={anchor:Ye(a,0),head:Ye(a+1,0)};n.push(k),t.push(e.getRange(k.anchor,k.head))}return{text:t,ranges:n}}function Co(e,t,n,i){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",i?"":"off"),e.setAttribute("spellcheck",!!t)}function Ao(){var e=d("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=d("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return M?e.style.width="1000px":e.setAttribute("wrap","off"),f&&(e.style.border="1px solid black"),Co(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(i,a){var k=this.options,z=k[i];if(k[i]==a&&i!="mode")return;k[i]=a,t.hasOwnProperty(i)&&wi(this,t[i])(this,a,z),ke(this,"optionChange",this,i)},getOption:function(i){return this.options[i]},getDoc:function(){return this.doc},addKeyMap:function(i,a){this.state.keyMaps[a?"push":"unshift"](na(i))},removeKeyMap:function(i){for(var a=this.state.keyMaps,k=0;k<a.length;++k)if(a[k]==i||a[k].name==i)return a.splice(k,1),!0},addOverlay:Fi(function(i,a){var k=i.token?i:e.getMode(this.options,i);if(k.startState)throw new Error("Overlays may not be stateful.");se(this.state.overlays,{mode:k,modeSpec:i,opaque:a&&a.opaque,priority:a&&a.priority||0},function(z){return z.priority}),this.state.modeGen++,zi(this)}),removeOverlay:Fi(function(i){for(var a=this.state.overlays,k=0;k<a.length;++k){var z=a[k].modeSpec;if(z==i||typeof i=="string"&&z.name==i){a.splice(k,1),this.state.modeGen++,zi(this);return}}}),indentLine:Fi(function(i,a,k){typeof a!="string"&&typeof a!="number"&&(a==null?a=this.options.smartIndent?"smart":"prev":a=a?"add":"subtract"),Ri(this.doc,i)&&Br(this,i,a,k)}),indentSelection:Fi(function(i){for(var a=this.doc.sel.ranges,k=-1,z=0;z<a.length;z++){var J=a[z];if(J.empty())J.head.line>k&&(Br(this,J.head.line,i,!0),k=J.head.line,z==this.doc.sel.primIndex&&qn(this));else{var Q=J.from(),ee=J.to(),ce=Math.max(k,Q.line);k=Math.min(this.lastLine(),ee.line-(ee.ch?0:1))+1;for(var ye=ce;ye<k;++ye)Br(this,ye,i);var Oe=this.doc.sel.ranges;Q.ch==0&&a.length==Oe.length&&Oe[z].from().ch>0&&Na(this.doc,z,new qt(Q,Oe[z].to()),ve)}}}),getTokenAt:function(i,a){return ti(this,i,a)},getLineTokens:function(i,a){return ti(this,Ye(i),a,!0)},getTokenTypeAt:function(i){i=y(this.doc,i);var a=He(this,vt(this.doc,i.line)),k=0,z=(a.length-1)/2,J=i.ch,Q;if(J==0)Q=a[2];else for(;;){var ee=k+z>>1;if((ee?a[ee*2-1]:0)>=J)z=ee;else if(a[ee*2+1]<J)k=ee+1;else{Q=a[ee*2+2];break}}var ce=Q?Q.indexOf("overlay "):-1;return ce<0?Q:ce==0?null:Q.slice(0,ce-1)},getModeAt:function(i){var a=this.doc.mode;return a.innerMode?e.innerMode(a,this.getTokenAt(i).state).mode:a},getHelper:function(i,a){return this.getHelpers(i,a)[0]},getHelpers:function(i,a){var k=[];if(!n.hasOwnProperty(a))return k;var z=n[a],J=this.getModeAt(i);if(typeof J[a]=="string")z[J[a]]&&k.push(z[J[a]]);else if(J[a])for(var Q=0;Q<J[a].length;Q++){var ee=z[J[a][Q]];ee&&k.push(ee)}else J.helperType&&z[J.helperType]?k.push(z[J.helperType]):z[J.name]&&k.push(z[J.name]);for(var ce=0;ce<z._global.length;ce++){var ye=z._global[ce];ye.pred(J,this)&&ie(k,ye.val)==-1&&k.push(ye.val)}return k},getStateAfter:function(i,a){var k=this.doc;return i=X(k,i==null?k.first+k.size-1:i),nt(this,i+1,a).state},cursorCoords:function(i,a){var k,z=this.doc.sel.primary();return i==null?k=z.head:typeof i=="object"?k=y(this.doc,i):k=i?z.from():z.to(),dn(this,k,a||"page")},charCoords:function(i,a){return ma(this,y(this.doc,i),a||"page")},coordsChar:function(i,a){return i=ls(this,i,a||"page"),va(this,i.left,i.top)},lineAtHeight:function(i,a){return i=ls(this,{top:i,left:0},a||"page").top,Hi(this.doc,i+this.display.viewOffset)},heightAtLine:function(i,a,k){var z=!1,J;if(typeof i=="number"){var Q=this.doc.first+this.doc.size-1;i<this.doc.first?i=this.doc.first:i>Q&&(i=Q,z=!0),J=vt(this.doc,i)}else J=i;return Wr(this,J,{top:0,left:0},a||"page",k||z).top+(z?this.doc.height-hn(J):0)},defaultTextHeight:function(){return Jn(this.display)},defaultCharWidth:function(){return Zn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(i,a,k,z,J){var Q=this.display;i=dn(this,y(this.doc,i));var ee=i.bottom,ce=i.left;if(a.style.position="absolute",a.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(a),Q.sizer.appendChild(a),z=="over")ee=i.top;else if(z=="above"||z=="near"){var ye=Math.max(Q.wrapper.clientHeight,this.doc.height),Oe=Math.max(Q.sizer.clientWidth,Q.lineSpace.clientWidth);(z=="above"||i.bottom+a.offsetHeight>ye)&&i.top>a.offsetHeight?ee=i.top-a.offsetHeight:i.bottom+a.offsetHeight<=ye&&(ee=i.bottom),ce+a.offsetWidth>Oe&&(ce=Oe-a.offsetWidth)}a.style.top=ee+"px",a.style.left=a.style.right="",J=="right"?(ce=Q.sizer.clientWidth-a.offsetWidth,a.style.right="0px"):(J=="left"?ce=0:J=="middle"&&(ce=(Q.sizer.clientWidth-a.offsetWidth)/2),a.style.left=ce+"px"),k&&Jo(this,{left:ce,top:ee,right:ce+a.offsetWidth,bottom:ee+a.offsetHeight})},triggerOnKeyDown:Fi(po),triggerOnKeyPress:Fi(go),triggerOnKeyUp:mo,triggerOnMouseDown:Fi(vo),execCommand:function(i){if(Mr.hasOwnProperty(i))return Mr[i].call(null,this)},triggerElectric:Fi(function(i){wo(this,i)}),findPosH:function(i,a,k,z){var J=1;a<0&&(J=-1,a=-a);for(var Q=y(this.doc,i),ee=0;ee<a&&!(Q=Ka(this.doc,Q,J,k,z),Q.hitSide);++ee);return Q},moveH:Fi(function(i,a){var k=this;this.extendSelectionsBy(function(z){return k.display.shift||k.doc.extend||z.empty()?Ka(k.doc,z.head,i,a,k.options.rtlMoveVisually):i<0?z.from():z.to()},Ce)}),deleteH:Fi(function(i,a){var k=this.doc.sel,z=this.doc;k.somethingSelected()?z.replaceSelection("",null,"+delete"):or(this,function(J){var Q=Ka(z,J.head,i,a,!1);return i<0?{from:Q,to:J.head}:{from:J.head,to:Q}})}),findPosV:function(i,a,k,z){var J=1,Q=z;a<0&&(J=-1,a=-a);for(var ee=y(this.doc,i),ce=0;ce<a;++ce){var ye=dn(this,ee,"div");if(Q==null?Q=ye.left:ye.left=Q,ee=Ro(this,ye,J,k),ee.hitSide)break}return ee},moveV:Fi(function(i,a){var k=this,z=this.doc,J=[],Q=!this.display.shift&&!z.extend&&z.sel.somethingSelected();if(z.extendSelectionsBy(function(ce){if(Q)return i<0?ce.from():ce.to();var ye=dn(k,ce.head,"div");ce.goalColumn!=null&&(ye.left=ce.goalColumn),J.push(ye.left);var Oe=Ro(k,ye,i,a);return a=="page"&&ce==z.sel.primary()&&Sa(k,ma(k,Oe,"div").top-ye.top),Oe},Ce),J.length)for(var ee=0;ee<z.sel.ranges.length;ee++)z.sel.ranges[ee].goalColumn=J[ee]}),findWordAt:function(i){var a=this.doc,k=vt(a,i.line).text,z=i.ch,J=i.ch;if(k){var Q=this.getHelper(i,"wordChars");(i.sticky=="before"||J==k.length)&&z?--z:++J;for(var ee=k.charAt(z),ce=Ue(ee,Q)?function(ye){return Ue(ye,Q)}:/\s/.test(ee)?function(ye){return/\s/.test(ye)}:function(ye){return!/\s/.test(ye)&&!Ue(ye)};z>0&&ce(k.charAt(z-1));)--z;for(;J<k.length&&ce(k.charAt(J));)++J}return new qt(Ye(i.line,z),Ye(i.line,J))},toggleOverwrite:function(i){if(i!=null&&i==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?D(this.display.cursorDiv,"CodeMirror-overwrite"):S(this.display.cursorDiv,"CodeMirror-overwrite"),ke(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==N()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Fi(function(i,a){br(this,i,a)}),getScrollInfo:function(){var i=this.display.scroller;return{left:i.scrollLeft,top:i.scrollTop,height:i.scrollHeight-bn(this)-this.display.barHeight,width:i.scrollWidth-bn(this)-this.display.barWidth,clientHeight:ca(this),clientWidth:Fn(this)}},scrollIntoView:Fi(function(i,a){i==null?(i={from:this.doc.sel.primary().head,to:null},a==null&&(a=this.options.cursorScrollMargin)):typeof i=="number"?i={from:Ye(i,0),to:null}:i.from==null&&(i={from:i,to:null}),i.to||(i.to=i.from),i.margin=a||0,i.from.line!=null?Zo(this,i):_s(this,i.from,i.to,i.margin)}),setSize:Fi(function(i,a){var k=this,z=function(Q){return typeof Q=="number"||/^\d+$/.test(String(Q))?Q+"px":Q};i!=null&&(this.display.wrapper.style.width=z(i)),a!=null&&(this.display.wrapper.style.height=z(a)),this.options.lineWrapping&&as(this);var J=this.display.viewFrom;this.doc.iter(J,this.display.viewTo,function(Q){if(Q.widgets){for(var ee=0;ee<Q.widgets.length;ee++)if(Q.widgets[ee].noHScroll){On(k,J,"widget");break}}++J}),this.curOp.forceUpdate=!0,ke(this,"refresh",this)}),operation:function(i){return $i(this,i)},startOperation:function(){return zn(this)},endOperation:function(){return Kn(this)},refresh:Fi(function(){var i=this.display.cachedTextHeight;zi(this),this.curOp.forceUpdate=!0,yr(this),br(this,this.doc.scrollLeft,this.doc.scrollTop),Ra(this.display),(i==null||Math.abs(i-Jn(this.display))>.5||this.options.lineWrapping)&&Ea(this),ke(this,"refresh",this)}),swapDoc:Fi(function(i){var a=this.doc;return a.cm=null,this.state.selectingText&&this.state.selectingText(),Ds(this,i),yr(this),this.display.input.reset(),br(this,i.scrollLeft,i.scrollTop),this.curOp.forceScroll=!0,Li(this,"swapDoc",this,a),a}),phrase:function(i){var a=this.options.phrases;return a&&Object.prototype.hasOwnProperty.call(a,i)?a[i]:i},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}},_e(e),e.registerHelper=function(i,a,k){n.hasOwnProperty(i)||(n[i]=e[i]={_global:[]}),n[i][a]=k},e.registerGlobalHelper=function(i,a,k,z){e.registerHelper(i,a,z),n[i]._global.push({pred:k,val:z})}}function Ka(e,t,n,i,a){var k=t,z=n,J=vt(e,t.line),Q=a&&e.direction=="rtl"?-n:n;function ee(){var ct=t.line+Q;return ct<e.first||ct>=e.first+e.size?!1:(t=new Ye(ct,t.ch,t.sticky),J=vt(e,ct))}function ce(ct){var ot;if(i=="codepoint"){var gt=J.text.charCodeAt(t.ch+(i>0?0:-1));isNaN(gt)?ot=null:ot=new Ye(t.line,Math.max(0,Math.min(J.text.length,t.ch+n*(gt>=55296&&gt<56320?2:1))),-n)}else a?ot=Pl(e.cm,J,t,n):ot=Fa(J,t,n);if(ot==null)if(!ct&&ee())t=Ba(a,e.cm,J,t.line,Q);else return!1;else t=ot;return!0}if(i=="char"||i=="codepoint")ce();else if(i=="column")ce(!0);else if(i=="word"||i=="group")for(var ye=null,Oe=i=="group",Ae=e.cm&&e.cm.getHelper(t,"wordChars"),Be=!0;!(n<0&&!ce(!Be));Be=!1){var Ke=J.text.charAt(t.ch)||`
`,qe=Ue(Ke,Ae)?"w":Oe&&Ke==`
`?"n":!Oe||/\s/.test(Ke)?null:"p";if(Oe&&!Be&&!qe&&(qe="s"),ye&&ye!=qe){n<0&&(n=1,ce(),t.sticky="after");break}if(qe&&(ye=qe),n>0&&!ce(!Be))break}var st=ea(e,t,k,z,!0);return mn(k,st)&&(st.hitSide=!0),st}function Ro(e,t,n,i){var a=e.doc,k=t.left,z;if(i=="page"){var J=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),Q=Math.max(J-.5*Jn(e.display),3);z=(n>0?t.bottom:t.top)+n*Q}else i=="line"&&(z=n>0?t.bottom+3:t.top-3);for(var ee;!(ee=va(e,k,z),!ee.outside);){if(n<0?z<=0:z>=a.height){ee.hitSide=!0;break}z+=n*5}return ee}var ni=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Y,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};ni.prototype.init=function(e){var t=this,n=this,i=n.cm,a=n.div=e.lineDiv;Co(a,i.options.spellcheck,i.options.autocorrect,i.options.autocapitalize);function k(J){for(var Q=J.target;Q;Q=Q.parentNode){if(Q==a)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(Q.className))break}return!1}Pe(a,"paste",function(J){if(!k(J)||Ge(i,J)||To(J,i))return;G<=11&&setTimeout(wi(i,function(){return t.updateFromDOM()}),20)}),Pe(a,"compositionstart",function(J){t.composing={data:J.data,done:!1}}),Pe(a,"compositionupdate",function(J){t.composing||(t.composing={data:J.data,done:!1})}),Pe(a,"compositionend",function(J){t.composing&&(J.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Pe(a,"touchstart",function(){return n.forceCompositionEnd()}),Pe(a,"input",function(){t.composing||t.readFromDOMSoon()});function z(J){if(!k(J)||Ge(i,J))return;if(i.somethingSelected())sa({lineWise:!1,text:i.getSelections()}),J.type=="cut"&&i.replaceSelection("",null,"cut");else if(i.options.lineWiseCopyCut){var Q=So(i);sa({lineWise:!0,text:Q.text}),J.type=="cut"&&i.operation(function(){i.setSelections(Q.ranges,0,ve),i.replaceSelection("",null,"cut")})}else return;if(J.clipboardData){J.clipboardData.clearData();var ee=fn.text.join(`
`);if(J.clipboardData.setData("Text",ee),J.clipboardData.getData("Text")==ee){J.preventDefault();return}}var ce=Ao(),ye=ce.firstChild;i.display.lineSpace.insertBefore(ce,i.display.lineSpace.firstChild),ye.value=fn.text.join(`
`);var Oe=document.activeElement;j(ye),setTimeout(function(){i.display.lineSpace.removeChild(ce),Oe.focus(),Oe==a&&n.showPrimarySelection()},50)}Pe(a,"copy",z),Pe(a,"cut",z)},ni.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},ni.prototype.prepareSelection=function(){var e=ps(this.cm,!1);return e.focus=document.activeElement==this.div,e},ni.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},ni.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},ni.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),i=n.from(),a=n.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||a.line<t.display.viewFrom){e.removeAllRanges();return}var k=oa(t,e.anchorNode,e.anchorOffset),z=oa(t,e.focusNode,e.focusOffset);if(k&&!k.bad&&z&&!z.bad&&Ct(Zi(k,z),i)==0&&Ct(vn(k,z),a)==0)return;var J=t.display.view,Q=i.line>=t.display.viewFrom&&Oo(t,i)||{node:J[0].measure.map[2],offset:0},ee=a.line<t.display.viewTo&&Oo(t,a);if(!ee){var ce=J[J.length-1].measure,ye=ce.maps?ce.maps[ce.maps.length-1]:ce.map;ee={node:ye[ye.length-1],offset:ye[ye.length-2]-ye[ye.length-3]}}if(!Q||!ee){e.removeAllRanges();return}var Oe=e.rangeCount&&e.getRangeAt(0),Ae;try{Ae=g(Q.node,Q.offset,ee.offset,ee.node)}catch(Be){}Ae&&(!P&&t.state.focused?(e.collapse(Q.node,Q.offset),Ae.collapsed||(e.removeAllRanges(),e.addRange(Ae))):(e.removeAllRanges(),e.addRange(Ae)),Oe&&e.anchorNode==null?e.addRange(Oe):P&&this.startGracePeriod()),this.rememberSelection()},ni.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)},ni.prototype.showMultipleSelections=function(e){_(this.cm.display.cursorDiv,e.cursors),_(this.cm.display.selectionDiv,e.selection)},ni.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},ni.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return E(this.div,t)},ni.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},ni.prototype.blur=function(){this.div.blur()},ni.prototype.getField=function(){return this.div},ni.prototype.supportsTouch=function(){return!0},ni.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():$i(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)},ni.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},ni.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(l&&v&&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=oa(t,e.anchorNode,e.anchorOffset),i=oa(t,e.focusNode,e.focusOffset);n&&i&&$i(t,function(){Pi(t.doc,In(n,i),ve),(n.bad||i.bad)&&(t.curOp.selectionChanged=!0)})},ni.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),i=n.from(),a=n.to();if(i.ch==0&&i.line>e.firstLine()&&(i=Ye(i.line-1,vt(e.doc,i.line-1).length)),a.ch==vt(e.doc,a.line).text.length&&a.line<e.lastLine()&&(a=Ye(a.line+1,0)),i.line<t.viewFrom||a.line>t.viewTo-1)return!1;var k,z,J;i.line==t.viewFrom||(k=Hn(e,i.line))==0?(z=Mt(t.view[0].line),J=t.view[0].node):(z=Mt(t.view[k].line),J=t.view[k-1].node.nextSibling);var Q=Hn(e,a.line),ee,ce;if(Q==t.view.length-1?(ee=t.viewTo-1,ce=t.lineDiv.lastChild):(ee=Mt(t.view[Q+1].line)-1,ce=t.view[Q+1].node.previousSibling),!J)return!1;for(var ye=e.doc.splitLines(tu(e,J,ce,z,ee)),Oe=ji(e.doc,Ye(z,0),Ye(ee,vt(e.doc,ee).text.length));ye.length>1&&Oe.length>1;)if(te(ye)==te(Oe))ye.pop(),Oe.pop(),ee--;else if(ye[0]==Oe[0])ye.shift(),Oe.shift(),z++;else break;for(var Ae=0,Be=0,Ke=ye[0],qe=Oe[0],st=Math.min(Ke.length,qe.length);Ae<st&&Ke.charCodeAt(Ae)==qe.charCodeAt(Ae);)++Ae;for(var ct=te(ye),ot=te(Oe),gt=Math.min(ct.length-(ye.length==1?Ae:0),ot.length-(Oe.length==1?Ae:0));Be<gt&&ct.charCodeAt(ct.length-Be-1)==ot.charCodeAt(ot.length-Be-1);)++Be;if(ye.length==1&&Oe.length==1&&z==i.line)for(;Ae&&Ae>i.ch&&ct.charCodeAt(ct.length-Be-1)==ot.charCodeAt(ot.length-Be-1);)Ae--,Be++;ye[ye.length-1]=ct.slice(0,ct.length-Be).replace(/^\u200b+/,""),ye[0]=ye[0].slice(Ae).replace(/\u200b+$/,"");var At=Ye(z,Ae),Tt=Ye(ee,Oe.length?te(Oe).length-Be:0);if(ye.length>1||ye[0]||Ct(At,Tt))return rr(e.doc,ye,At,Tt,"+input"),!0},ni.prototype.ensurePolled=function(){this.forceCompositionEnd()},ni.prototype.reset=function(){this.forceCompositionEnd()},ni.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},ni.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)},ni.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&$i(this.cm,function(){return zi(e.cm)})},ni.prototype.setUneditable=function(e){e.contentEditable="false"},ni.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||wi(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},ni.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},ni.prototype.onContextMenu=function(){},ni.prototype.resetPosition=function(){},ni.prototype.needsContentAttribute=!0;function Oo(e,t){var n=fa(e,t.line);if(!n||n.hidden)return null;var i=vt(e.doc,t.line),a=es(n,i,t.line),k=it(i,e.doc.direction),z="left";if(k){var J=Ze(k,t.ch);z=J%2?"right":"left"}var Q=ns(a.map,t.ch,z);return Q.offset=Q.collapse=="right"?Q.end:Q.start,Q}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function ur(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,i,a){var k="",z=!1,J=e.doc.lineSeparator(),Q=!1;function ee(Ae){return function(Be){return Be.id==Ae}}function ce(){z&&(k+=J,Q&&(k+=J),z=Q=!1)}function ye(Ae){Ae&&(ce(),k+=Ae)}function Oe(Ae){if(Ae.nodeType==1){var Be=Ae.getAttribute("cm-text");if(Be){ye(Be);return}var Ke=Ae.getAttribute("cm-marker"),qe;if(Ke){var st=e.findMarks(Ye(i,0),Ye(a+1,0),ee(+Ke));st.length&&(qe=st[0].find(0))&&ye(ji(e.doc,qe.from,qe.to).join(J));return}if(Ae.getAttribute("contenteditable")=="false")return;var ct=/^(pre|div|p|li|table|br)$/i.test(Ae.nodeName);if(!/^br$/i.test(Ae.nodeName)&&Ae.textContent.length==0)return;ct&&ce();for(var ot=0;ot<Ae.childNodes.length;ot++)Oe(Ae.childNodes[ot]);/^(pre|p)$/i.test(Ae.nodeName)&&(Q=!0),ct&&(z=!0)}else Ae.nodeType==3&&ye(Ae.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Oe(t),t==n);)t=t.nextSibling,Q=!1;return k}function oa(e,t,n){var i;if(t==e.display.lineDiv){if(i=e.display.lineDiv.childNodes[n],!i)return ur(e.clipPos(Ye(e.display.viewTo-1)),!0);t=null,n=0}else for(i=t;;i=i.parentNode){if(!i||i==e.display.lineDiv)return null;if(i.parentNode&&i.parentNode==e.display.lineDiv)break}for(var a=0;a<e.display.view.length;a++){var k=e.display.view[a];if(k.node==i)return iu(k,t,n)}}function iu(e,t,n){var i=e.text.firstChild,a=!1;if(!t||!E(i,t))return ur(Ye(Mt(e.line),0),!0);if(t==i&&(a=!0,t=i.childNodes[n],n=0,!t)){var k=e.rest?te(e.rest):e.line;return ur(Ye(Mt(k),k.text.length),a)}var z=t.nodeType==3?t:null,J=t;for(!z&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(z=t.firstChild,n&&(n=z.nodeValue.length));J.parentNode!=i;)J=J.parentNode;var Q=e.measure,ee=Q.maps;function ce(qe,st,ct){for(var ot=-1;ot<(ee?ee.length:0);ot++)for(var gt=ot<0?Q.map:ee[ot],At=0;At<gt.length;At+=3){var Tt=gt[At+2];if(Tt==qe||Tt==st){var Nt=Mt(ot<0?e.line:e.rest[ot]),ai=gt[At]+ct;return(ct<0||Tt!=qe)&&(ai=gt[At+(ct?1:0)]),Ye(Nt,ai)}}}var ye=ce(z,J,n);if(ye)return ur(ye,a);for(var Oe=J.nextSibling,Ae=z?z.nodeValue.length-n:0;Oe;Oe=Oe.nextSibling){if(ye=ce(Oe,Oe.firstChild,0),ye)return ur(Ye(ye.line,ye.ch-Ae),a);Ae+=Oe.textContent.length}for(var Be=J.previousSibling,Ke=n;Be;Be=Be.previousSibling){if(ye=ce(Be,Be.firstChild,-1),ye)return ur(Ye(ye.line,ye.ch+Ke),a);Ke+=Be.textContent.length}}var ci=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Y,this.hasSelection=!1,this.composing=null};ci.prototype.init=function(e){var t=this,n=this,i=this.cm;this.createField(e);var a=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),f&&(a.style.width="0px"),Pe(a,"input",function(){K&&G>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Pe(a,"paste",function(z){if(Ge(i,z)||To(z,i))return;i.state.pasteIncoming=+new Date,n.fastPoll()});function k(z){if(Ge(i,z))return;if(i.somethingSelected())sa({lineWise:!1,text:i.getSelections()});else if(i.options.lineWiseCopyCut){var J=So(i);sa({lineWise:!0,text:J.text}),z.type=="cut"?i.setSelections(J.ranges,null,ve):(n.prevInput="",a.value=J.text.join(`
`),j(a))}else return;z.type=="cut"&&(i.state.cutIncoming=+new Date)}Pe(a,"cut",k),Pe(a,"copy",k),Pe(e.scroller,"paste",function(z){if(wn(e,z)||Ge(i,z))return;if(!a.dispatchEvent){i.state.pasteIncoming=+new Date,n.focus();return}var J=new Event("paste");J.clipboardData=z.clipboardData,a.dispatchEvent(J)}),Pe(e.lineSpace,"selectstart",function(z){wn(e,z)||re(z)}),Pe(a,"compositionstart",function(){var z=i.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:z,range:i.markText(z,i.getCursor("to"),{className:"CodeMirror-composing"})}}),Pe(a,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},ci.prototype.createField=function(e){this.wrapper=Ao(),this.textarea=this.wrapper.firstChild},ci.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},ci.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,i=ps(e);if(e.options.moveInputWithCursor){var a=dn(e,n.sel.primary().head,"div"),k=t.wrapper.getBoundingClientRect(),z=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,a.top+z.top-k.top)),i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,a.left+z.left-k.left))}return i},ci.prototype.showSelection=function(e){var t=this.cm,n=t.display;_(n.cursorDiv,e.cursors),_(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},ci.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&&j(this.textarea),K&&G>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",K&&G>=9&&(this.hasSelection=null))},ci.prototype.getField=function(){return this.textarea},ci.prototype.supportsTouch=function(){return!1},ci.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!r||N()!=this.textarea))try{this.textarea.focus()}catch(e){}},ci.prototype.blur=function(){this.textarea.blur()},ci.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},ci.prototype.receivedFocus=function(){this.slowPoll()},ci.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()})},ci.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var i=t.poll();!i&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},ci.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,i=this.prevInput;if(this.contextMenuPending||!t.state.focused||ft(n)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var a=n.value;if(a==i&&!t.somethingSelected())return!1;if(K&&G>=9&&this.hasSelection===a||s&&/[\uf700-\uf7ff]/.test(a))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var k=a.charCodeAt(0);if(k==8203&&!i&&(i="\u200B"),k==8666)return this.reset(),this.cm.execCommand("undo")}for(var z=0,J=Math.min(i.length,a.length);z<J&&i.charCodeAt(z)==a.charCodeAt(z);)++z;return $i(t,function(){za(t,a.slice(z),i.length-z,null,e.composing?"*compose":null),a.length>1e3||a.indexOf(`
`)>-1?n.value=e.prevInput="":e.prevInput=a,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ci.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},ci.prototype.onKeyPress=function(){K&&G>=9&&(this.hasSelection=null),this.fastPoll()},ci.prototype.onContextMenu=function(e){var t=this,n=t.cm,i=n.display,a=t.textarea;t.contextMenuPending&&t.contextMenuPending();var k=jn(n,e),z=i.scroller.scrollTop;if(!k||m)return;var J=n.options.resetSelectionOnContextMenu;J&&n.doc.sel.contains(k)==-1&&wi(n,Pi)(n.doc,In(k),ve);var Q=a.style.cssText,ee=t.wrapper.style.cssText,ce=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",a.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-ce.top-5)+"px; left: "+(e.clientX-ce.left-5)+`px;
z-index: 1000; background: `+(K?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ye;M&&(ye=window.scrollY),i.input.focus(),M&&window.scrollTo(null,ye),i.input.reset(),n.somethingSelected()||(a.value=t.prevInput=" "),t.contextMenuPending=Ae,i.selForContextMenu=n.doc.sel,clearTimeout(i.detectingSelectAll);function Oe(){if(a.selectionStart!=null){var Ke=n.somethingSelected(),qe="\u200B"+(Ke?a.value:"");a.value="\u21DA",a.value=qe,t.prevInput=Ke?"":"\u200B",a.selectionStart=1,a.selectionEnd=qe.length,i.selForContextMenu=n.doc.sel}}function Ae(){if(t.contextMenuPending!=Ae)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=ee,a.style.cssText=Q,K&&G<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=z),a.selectionStart!=null){(!K||K&&G<9)&&Oe();var Ke=0,qe=function(){i.selForContextMenu==n.doc.sel&&a.selectionStart==0&&a.selectionEnd>0&&t.prevInput=="\u200B"?wi(n,Vs)(n):Ke++<10?i.detectingSelectAll=setTimeout(qe,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(qe,200)}}if(K&&G>=9&&Oe(),R){ge(e);var Be=function(){tt(window,"mouseup",Be),setTimeout(Ae,20)};Pe(window,"mouseup",Be)}else setTimeout(Ae,50)},ci.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},ci.prototype.setUneditable=function(){},ci.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?b(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=N();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function i(){e.value=J.getValue()}var a;if(e.form&&(Pe(e.form,"submit",i),!t.leaveSubmitMethodAlone)){var k=e.form;a=k.submit;try{var z=k.submit=function(){i(),k.submit=a,k.submit(),k.submit=z}}catch(Q){}}t.finishInit=function(Q){Q.save=i,Q.getTextArea=function(){return e},Q.toTextArea=function(){Q.toTextArea=isNaN,i(),e.parentNode.removeChild(Q.getWrapperElement()),e.style.display="",e.form&&(tt(e.form,"submit",i),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=a))}},e.style.display="none";var J=li(function(Q){return e.parentNode.insertBefore(Q,e.nextSibling)},t);return J}function ru(e){e.off=tt,e.on=Pe,e.wheelEventPixels=dl,e.Doc=Ki,e.splitLines=Rt,e.countColumn=W,e.findColumn=Se,e.isWordChar=Ie,e.Pass=xe,e.signal=ke,e.Line=Un,e.changeEnd=kn,e.scrollbarModel=xs,e.Pos=Ye,e.cmpPos=Ct,e.modes=ei,e.mimeModes=Ut,e.resolveMode=Xe,e.getMode=Et,e.modeExtensions=Dt,e.extendMode=Pt,e.copyState=si,e.startState=sn,e.innerMode=an,e.commands=Mr,e.keyMap=Sn,e.keyName=lo,e.isModifierKey=so,e.lookupKey=sr,e.normalizeKeyMap=Dl,e.StringStream=zt,e.SharedTextMarker=kr,e.TextMarker=Pn,e.LineWidget=Ir,e.e_preventDefault=re,e.e_stopPropagation=ae,e.e_stop=ge,e.addClass=D,e.contains=E,e.rmClass=S,e.keyNames=Mn}$l(li),ql(li);var au="iter insert remove copy getEditor constructor".split(" ");for(var la in Ki.prototype)Ki.prototype.hasOwnProperty(la)&&ie(au,la)<0&&(li.prototype[la]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ki.prototype[la]));return _e(Ki),li.inputStyles={textarea:ci,contenteditable:ni},li.defineMode=function(e){!li.defaults.mode&&e!="null"&&(li.defaults.mode=e),fi.apply(this,arguments)},li.defineMIME=Ve,li.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),li.defineMIME("text/plain","null"),li.defineExtension=function(e,t){li.prototype[e]=t},li.defineDocExtension=function(e,t){Ki.prototype[e]=t},li.fromTextArea=nu,ru(li),li.version="5.58.2",li})},Y1PL:function(_t,Je,ne){"use strict";ne.r(Je),ne.d(Je,"ResizableTextArea",function(){return ie});var ue=ne("wx14"),Z=ne("1OyB"),P=ne("vuIU"),$=ne("Ji7U"),B=ne("LK+K"),U=ne("q1tI"),K=ne("VTBJ"),G=ne("rePB"),M=ne("Zm9Q"),O=ne("Kwbf"),v=ne("c+Xe"),m=ne("m+aA"),p=ne("bdgK"),h=new Map;function o(ve){ve.forEach(function(we){var Ce,Se=we.target;(Ce=h.get(Se))===null||Ce===void 0||Ce.forEach(function(fe){return fe(Se)})})}var f=new p.default(o),l=null,r=null;function s(ve,we){h.has(ve)||(h.set(ve,new Set),f.observe(ve)),h.get(ve).add(we)}function c(ve,we){h.has(ve)&&(h.get(ve).delete(we),h.get(ve).size||(f.unobserve(ve),h.delete(ve)))}var L=function(ve){Object($.a)(Ce,ve);var we=Object(B.a)(Ce);function Ce(){return Object(Z.a)(this,Ce),we.apply(this,arguments)}return Object(P.a)(Ce,[{key:"render",value:function(){return this.props.children}}]),Ce}(U.Component),w=U.createContext(null);function T(ve){var we=ve.children,Ce=ve.onBatchResize,Se=U.useRef(0),fe=U.useRef([]),le=U.useContext(w),te=U.useCallback(function(de,se,Re){Se.current+=1;var Le=Se.current;fe.current.push({size:de,element:se,data:Re}),Promise.resolve().then(function(){Le===Se.current&&(Ce==null||Ce(fe.current),fe.current=[])}),le==null||le(de,se,Re)},[Ce,le]);return U.createElement(w.Provider,{value:te},we)}function R(ve){var we=ve.children,Ce=ve.disabled,Se=U.useRef(null),fe=U.useRef(null),le=U.useContext(w),te=U.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),de=U.isValidElement(we)&&Object(v.c)(we),se=de?we.ref:null,Re=U.useMemo(function(){return Object(v.a)(se,Se)},[se,Se]),Le=U.useRef(ve);Le.current=ve;var Te=U.useCallback(function(Ie){var Ue=Le.current,We=Ue.onResize,Fe=Ue.data,Ne=Ie.getBoundingClientRect(),Me=Ne.width,$e=Ne.height,et=Ie.offsetWidth,Qe=Ie.offsetHeight,Ze=Math.floor(Me),dt=Math.floor($e);if(te.current.width!==Ze||te.current.height!==dt||te.current.offsetWidth!==et||te.current.offsetHeight!==Qe){var it={width:Ze,height:dt,offsetWidth:et,offsetHeight:Qe};te.current=it;var at=et===Math.round(Me)?Me:et,Pe=Qe===Math.round($e)?$e:Qe,ut=Object(K.a)(Object(K.a)({},it),{},{offsetWidth:at,offsetHeight:Pe});le==null||le(ut,Ie,Fe),We&&Promise.resolve().then(function(){We(ut,Ie)})}},[]);return U.useEffect(function(){var Ie=Object(m.a)(Se.current)||Object(m.a)(fe.current);return Ie&&!Ce&&s(Ie,Te),function(){return c(Ie,Te)}},[Se.current,Ce]),U.createElement(L,{ref:fe},de?U.cloneElement(we,{ref:Re}):we)}var C="rc-observer-key";function S(ve){var we=ve.children,Ce=Object(M.a)(we);return Ce.map(function(Se,fe){var le=(Se==null?void 0:Se.key)||"".concat(C,"-").concat(fe);return U.createElement(R,Object(ue.a)({},ve,{key:le}),Se)})}S.Collection=T;var x=S,_=ne("bT9E"),d=ne("TSYQ"),u=ne.n(d),g=`
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important
`,E=["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"],N={},D;function H(ve){var we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ce=ve.getAttribute("id")||ve.getAttribute("data-reactid")||ve.getAttribute("name");if(we&&N[Ce])return N[Ce];var Se=window.getComputedStyle(ve),fe=Se.getPropertyValue("box-sizing")||Se.getPropertyValue("-moz-box-sizing")||Se.getPropertyValue("-webkit-box-sizing"),le=parseFloat(Se.getPropertyValue("padding-bottom"))+parseFloat(Se.getPropertyValue("padding-top")),te=parseFloat(Se.getPropertyValue("border-bottom-width"))+parseFloat(Se.getPropertyValue("border-top-width")),de=E.map(function(Re){return"".concat(Re,":").concat(Se.getPropertyValue(Re))}).join(";"),se={sizingStyle:de,paddingSize:le,borderSize:te,boxSizing:fe};return we&&Ce&&(N[Ce]=se),se}function j(ve){var we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ce=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Se=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;D||(D=document.createElement("textarea"),D.setAttribute("tab-index","-1"),D.setAttribute("aria-hidden","true"),document.body.appendChild(D)),ve.getAttribute("wrap")?D.setAttribute("wrap",ve.getAttribute("wrap")):D.removeAttribute("wrap");var fe=H(ve,we),le=fe.paddingSize,te=fe.borderSize,de=fe.boxSizing,se=fe.sizingStyle;D.setAttribute("style","".concat(se,";").concat(g)),D.value=ve.value||ve.placeholder||"";var Re=Number.MIN_SAFE_INTEGER,Le=Number.MAX_SAFE_INTEGER,Te=D.scrollHeight,Ie;if(de==="border-box"?Te+=te:de==="content-box"&&(Te-=le),Ce!==null||Se!==null){D.value=" ";var Ue=D.scrollHeight-le;Ce!==null&&(Re=Ue*Ce,de==="border-box"&&(Re=Re+le+te),Te=Math.max(Re,Te)),Se!==null&&(Le=Ue*Se,de==="border-box"&&(Le=Le+le+te),Ie=Te>Le?"":"hidden",Te=Math.min(Le,Te))}return{height:Te,minHeight:Re,maxHeight:Le,overflowY:Ie,resize:"none"}}var I=ne("Gytx"),b=ne.n(I),W;(function(ve){ve[ve.NONE=0]="NONE",ve[ve.RESIZING=1]="RESIZING",ve[ve.RESIZED=2]="RESIZED"})(W||(W={}));var Y=function(ve){Object($.a)(Ce,ve);var we=Object(B.a)(Ce);function Ce(Se){var fe;return Object(Z.a)(this,Ce),fe=we.call(this,Se),fe.nextFrameActionId=void 0,fe.resizeFrameId=void 0,fe.textArea=void 0,fe.saveTextArea=function(le){fe.textArea=le},fe.handleResize=function(le){var te=fe.state.resizeStatus,de=fe.props,se=de.autoSize,Re=de.onResize;if(te!==W.NONE)return;typeof Re=="function"&&Re(le),se&&fe.resizeOnNextFrame()},fe.resizeOnNextFrame=function(){cancelAnimationFrame(fe.nextFrameActionId),fe.nextFrameActionId=requestAnimationFrame(fe.resizeTextarea)},fe.resizeTextarea=function(){var le=fe.props.autoSize;if(!le||!fe.textArea)return;var te=le.minRows,de=le.maxRows,se=j(fe.textArea,!1,te,de);fe.setState({textareaStyles:se,resizeStatus:W.RESIZING},function(){cancelAnimationFrame(fe.resizeFrameId),fe.resizeFrameId=requestAnimationFrame(function(){fe.setState({resizeStatus:W.RESIZED},function(){fe.resizeFrameId=requestAnimationFrame(function(){fe.setState({resizeStatus:W.NONE}),fe.fixFirefoxAutoScroll()})})})})},fe.renderTextArea=function(){var le=fe.props,te=le.prefixCls,de=te===void 0?"rc-textarea":te,se=le.autoSize,Re=le.onResize,Le=le.className,Te=le.disabled,Ie=fe.state,Ue=Ie.textareaStyles,We=Ie.resizeStatus,Fe=Object(_.a)(fe.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ne=u()(de,Le,Object(G.a)({},"".concat(de,"-disabled"),Te));"value"in Fe&&(Fe.value=Fe.value||"");var Me=Object(K.a)(Object(K.a)(Object(K.a)({},fe.props.style),Ue),We===W.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return U.createElement(x,{onResize:fe.handleResize,disabled:!(se||Re)},U.createElement("textarea",Object(ue.a)({},Fe,{className:Ne,style:Me,ref:fe.saveTextArea})))},fe.state={textareaStyles:{},resizeStatus:W.NONE},fe}return Object(P.a)(Ce,[{key:"componentDidUpdate",value:function(fe){(fe.value!==this.props.value||!b()(fe.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var fe=this.textArea.selectionStart,le=this.textArea.selectionEnd;this.textArea.setSelectionRange(fe,le)}}catch(te){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Ce}(U.Component),ie=Y,oe=function(ve){Object($.a)(Ce,ve);var we=Object(B.a)(Ce);function Ce(Se){var fe;Object(Z.a)(this,Ce),fe=we.call(this,Se),fe.resizableTextArea=void 0,fe.focus=function(){fe.resizableTextArea.textArea.focus()},fe.saveTextArea=function(te){fe.resizableTextArea=te},fe.handleChange=function(te){var de=fe.props.onChange;fe.setValue(te.target.value,function(){fe.resizableTextArea.resizeTextarea()}),de&&de(te)},fe.handleKeyDown=function(te){var de=fe.props,se=de.onPressEnter,Re=de.onKeyDown;te.keyCode===13&&se&&se(te),Re&&Re(te)};var le=typeof Se.value=="undefined"||Se.value===null?Se.defaultValue:Se.value;return fe.state={value:le},fe}return Object(P.a)(Ce,[{key:"setValue",value:function(fe,le){"value"in this.props||this.setState({value:fe},le)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return U.createElement(ie,Object(ue.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(fe){return"value"in fe?{value:fe.value}:null}}]),Ce}(U.Component),xe=Je.default=oe},ZW9T:function(_t,Je,ne){"use strict";ne.d(Je,"a",function(){return j});var ue=ne("k1fw"),Z=ne("miYZ"),P=ne("tsqr"),$=ne("rAM+"),B=ne("tJVT"),U=ne("PpiC"),K=ne("q1tI"),G=ne.n(K),M=ne("bdgK"),O=ne("oBTY"),v=ne("9og8"),m=ne("WmNS"),p=ne.n(m),h={keywords:["print","auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while"]},o={quickKey:[{label:"main",content:["public static void main(String[] args) {"," $0","}"].join(`
`)},{label:"System.out.println",content:["System.out.println($0)"].join(`
`)},{label:"System.out.print",content:["System.out.print($0)"].join(`
`)}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},f={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","for","friend","gcnew","generic","goto","if","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`)},{label:"#include",content:'include "$0"'},{label:"printf",content:"printf($0)"},{label:"main",content:["int main () {"," $0","}"].join(`
`)},{label:"for",content:["for( ; ; ){"," $0","}"].join(`
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
`)},{label:"#include <iostream>",content:["#include <iostream>"].join(`
`)},{label:"#include <vector>",content:["#include <vector>"].join(`
`)},{label:"#include <sstream>",content:["#include <sstream>"].join(`
`)},{label:"#include <string>",content:["#include <string>"].join(`
`)},{label:"#include <cmath>",content:["#include <cmath>"].join(`
`)}]},l={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join(`
`)}]},r=ne("5VLF"),s=ne.n(r),c={languages:["c","abap","apex","azcli","bat","cameligo","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","graphql","handlebars","html","ini","java","javascript","json","kotlin","less","lua","markdown","mips","msdax","mysql","objective-c","pascal","pascaligo","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","restructuredtext","ruby","rust","sb","scheme","scss","shell","solidity","sophia","sql","st","swift","tcl","twig","vb","xml","yaml'"],tables:{users:["name","id","email","phone","password"],roles:["id","name","order","created_at","updated_at","deleted_at"]}},L=function(b,W){return W.map(function(Y){return{label:Y,kind:b.languages.CompletionItemKind.Keyword,insertText:Y}})},w=function(b){return Object.keys(c.tables).map(function(W){return{label:W,kind:b.languages.CompletionItemKind.Variable,insertText:W}})},T=function(b,W){var Y=c.tables[b];return Y?Y.map(function(ie){return{label:ie,kind:W.languages.CompletionItemKind.Field,insertText:ie}}):[]};function R(I,b,W,Y,ie){var oe=b.getWordUntilPosition(W),xe={startLineNumber:W.lineNumber,endLineNumber:W.lineNumber,startColumn:oe.startColumn,endColumn:oe.endColumn},ve=Y.map(function(we){return{label:we,kind:I.languages.CompletionItemKind.Keyword,insertText:we,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:xe}});return ie.map(function(we){ve.push(Object(ue.a)(Object(ue.a)({},we),{},{range:xe}))}),ve}var C=function(I){c.languages.map(function(ie){return I.languages.registerDocumentFormattingEditProvider(ie,{provideDocumentFormattingEdits:function(xe,ve,we){return Object(v.a)(p.a.mark(function Ce(){var Se;return p.a.wrap(function(le){for(;;)switch(le.prev=le.next){case 0:return Se=s()(xe.getValue(),{indent_size:"2",indent_char:" ",max_preserve_newlines:"2",preserve_newlines:!0,keep_array_indentation:!0,break_chained_methods:!1,indent_scripts:"normal",brace_style:"collapse",space_before_conditional:!0,unescape_strings:!1,jslint_happy:!1,end_with_newline:!0,wrap_line_length:"0",indent_inner_html:!1,comma_first:!1,e4x:!1,indent_empty_lines:!1}),le.abrupt("return",[{range:xe.getFullModelRange(),text:Se}]);case 2:case"end":return le.stop()}},Ce)}))()}}),ie});var b=f.quickKey.map(function(ie){return{label:ie.label,kind:I.languages.CompletionItemKind.Method,insertText:ie.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),W=l.quickKey.map(function(ie){return{label:ie.label,kind:I.languages.CompletionItemKind.Method,insertText:ie.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),Y=o.quickKey.map(function(ie){return{label:ie.label,kind:I.languages.CompletionItemKind.Method,insertText:ie.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet}});I.languages.registerCompletionItemProvider("cpp",{triggerCharacters:["."," ","#"].concat(Object(O.a)(f.keywords),Object(O.a)(f.quickKey.map(function(ie){return ie.label}))),provideCompletionItems:function(oe,xe){var ve=oe.getValueInRange({startLineNumber:xe.lineNumber,startColumn:1,endLineNumber:xe.lineNumber,endColumn:xe.column}),we=ve.match(/cu/gim);console.log("match:",we,xe,ve,oe);var Ce=[],Se=xe.lineNumber,fe=xe.column,le=oe.getValueInRange({startLineNumber:Se,startColumn:0,endLineNumber:Se,endColumn:fe}),te=le.trim().split(/\s+/),de=te[te.length-1];if(de.endsWith(".")){var se=de.slice(0,de.length-1);Object.keys(c.tables).includes(se)&&(Ce=Object(O.a)(T(se,I)))}else de==="."?Ce=[]:Ce=[].concat(Object(O.a)(w(I)),Object(O.a)(L(I,f.keywords)),Object(O.a)(b));return{suggestions:Ce}}}),I.languages.registerCompletionItemProvider("c",{triggerCharacters:["."," ","#"].concat(Object(O.a)(h.keywords)),provideCompletionItems:function(oe,xe){var ve=oe.getValueInRange({startLineNumber:xe.lineNumber,startColumn:1,endLineNumber:xe.lineNumber,endColumn:xe.column}),we=ve.match(/cu/gim);console.log("match:",we,xe,ve,oe);var Ce=[],Se=xe.lineNumber,fe=xe.column,le=oe.getValueInRange({startLineNumber:Se,startColumn:0,endLineNumber:Se,endColumn:fe}),te=le.trim().split(/\s+/),de=te[te.length-1];if(de.endsWith(".")){var se=de.slice(0,de.length-1);Object.keys(c.tables).includes(se)&&(Ce=Object(O.a)(T(se,I)))}else de==="."?Ce=[]:Ce=[].concat(Object(O.a)(w(I)),Object(O.a)(L(I,h.keywords)));return{suggestions:Ce}}}),I.languages.registerCompletionItemProvider("java",{triggerCharacters:["."," "].concat(Object(O.a)(o.keywords)),provideCompletionItems:function(oe,xe){var ve=[],we=xe.lineNumber,Ce=xe.column,Se=oe.getValueInRange({startLineNumber:we,startColumn:0,endLineNumber:we,endColumn:Ce}),fe=Se.trim().split(/\s+/),le=fe[fe.length-1];if(le.endsWith(".")){var te=le.slice(0,le.length-1);Object.keys(c.tables).includes(te)&&(ve=Object(O.a)(T(te,I)))}else le==="."?ve=[]:ve=[].concat(Object(O.a)(w(I)),Object(O.a)(L(I,o.keywords)),Object(O.a)(Y));return{suggestions:ve}}}),I.languages.registerCompletionItemProvider("python",{triggerCharacters:["."," "].concat(Object(O.a)(l.keywords)),provideCompletionItems:function(oe,xe){var ve=[],we=xe.lineNumber,Ce=xe.column,Se=oe.getValueInRange({startLineNumber:we,startColumn:0,endLineNumber:we,endColumn:Ce}),fe=Se.trim().split(/\s+/),le=fe[fe.length-1];if(le.endsWith(".")){var te=le.slice(0,le.length-1);Object.keys(c.tables).includes(te)&&(ve=Object(O.a)(T(te,I)))}else le==="."?ve=[]:ve=[].concat(Object(O.a)(w(I)),Object(O.a)(L(I,l.keywords)),Object(O.a)(W));return{suggestions:ve}}})},S="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",x=ne("LvDl"),_=ne("+ua5");function d(I){return/^\d+$/.test(I)?"".concat(I,"px"):I}function u(){}var g=!1,E={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function N(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],b=I;if(Array.isArray(I)){for(var W=0;W<I.length;W++){var Y=E[I[W]];if(Y)return Y}return b[0]}return E[b]||b}var D=null,H=Je.b=function(I){var b=I.width,W=b===void 0?"100%":b,Y=I.height,ie=Y===void 0?"100%":Y,oe=I.value,xe=I.language,ve=xe===void 0?"javascript":xe,we=I.style,Ce=we===void 0?{}:we,Se=I.options,fe=Se===void 0?{}:Se,le=I.overrideServices,te=le===void 0?{}:le,de=I.theme,se=de===void 0?"vs-dark":de,Re=I.onEditBlur,Le=I.onSave,Te=I.autoHeight,Ie=Te===void 0?!1:Te,Ue=I.forbidCopy,We=Ue===void 0?!1:Ue,Fe=I.onChange,Ne=Fe===void 0?u:Fe,Me=I.editorDidMount,$e=Me===void 0?u:Me,et=I.onFocus,Qe=et===void 0?u:et,Ze=I.filename,dt=Ze===void 0?"educoder.txt":Ze,it=I.errorLine,at=I.errorContent,Pe=at===void 0?"":at,ut=Object(U.a)(I,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),tt=Object(K.useRef)(),ke=Object(K.useRef)({}),Ge=Object(K.useRef)(),Ee=Object(K.useRef)(!1),pe=Object(K.useRef)(),_e=Object(K.useState)(!1),re=Object(B.a)(_e,2),ae=re[0],he=re[1];function ge(){var Xe;return tt.current&&(Xe=new M.default(function(Et){var Dt=Object($.a)(Et),Pt;try{for(Dt.s();!(Pt=Dt.n()).done;){var si=Pt.value;(si.target.offsetHeight>0||si.target.offsetWidth>0)&&ke.current.instance.layout()}}catch(an){Dt.e(an)}finally{Dt.f()}}),Xe.observe(tt.current)),Xe}function be(){P.b.warn(decodeURIComponent(S))}var De=function(){var Et=ke.current.instance;if(oe!=null&&Et&&ae){var Dt=Et.getModel();Dt&&oe!==Dt.getValue()&&(g=!0,Dt.setValue(oe),Et.layout(),g=!1)}};Object(K.useEffect)(function(){Ge.current&&clearTimeout(Ge.current),Ge.current=setTimeout(function(){De()},500)},[oe,ae,ke.current]),Object(K.useEffect)(function(){if(it&&ke.current&&ke.current.instance){var Xe=ke.current.instance;Xe.changeViewZones(function(Dt){var Pt=document.createElement("div");Pt.style.padding="10px 20px",Pt.style.width="calc(100% - 20px)",Pt.className="my-error-line-wrp",Pt.innerHTML=Pe,Dt.addZone({afterLineNumber:it||11,heightInLines:3,domNode:Pt})});var Et={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};Xe.addOverlayWidget(Et),Xe.revealPositionInCenter({lineNumber:20,column:1})}},[it,ke.current,ae]);function je(){var Xe=ke.current.instance;if(Xe){var Et=Xe.getSelection(),Dt=ke.current.pastePos||{},Pt=new D.Range(Dt.startLineNumber||Et.endLineNumber,Dt.startColumn||Et.endColumn,Dt.endLineNumber||Et.endLineNumber,Dt.endColumn||Et.endColumn);setTimeout(function(){Xe.executeEdits("",[{range:Pt,text:""}])},300)}}function lt(Xe){(window.navigator.platform.match("Mac")?Xe.metaKey:Xe.ctrlKey)&&Xe.keyCode==83&&(Xe.preventDefault(),Le())}var mt=function(){if(Ie&&ke.current.instance){var Et=ke.current.instance.getContentHeight();fi(Et<ie?ie:Et)}else fi(ie)};function pt(Xe){var Et=document.createEvent("MouseEvents");Et.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Xe.dispatchEvent(Et)}function Ot(Xe,Et){var Dt=window.URL||window.webkitURL||window,Pt=new Blob([Et]),si=document.createElementNS("http://www.w3.org/1999/xhtml","a");si.href=Dt.createObjectURL(Pt),si.download=Xe,pt(si)}Object(K.useEffect)(function(){mt()},[mt]),Object(K.useEffect)(function(){tt.current&&!ae&&ne.e(27).then(ne.t.bind(null,"M/lh",7)).then(function(Xe){try{D=Xe,ke.current.instance=D.editor.create(tt.current,{value:oe,language:N(ve),theme:se,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},te);var Et=ke.current.instance;if($e(Et,D),setTimeout(function(){mt(),ke.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Ot(dt||"educoder.txt",Et.getValue())}})},500),ke.current.subscription=Et.onDidChangeModelContent(function(Pt){Ee.current?clearTimeout(pe.current):(mt(),Ne(Et.getValue(),Pt)),pe.current=setTimeout(function(){Ee.current=!1},500)}),window.Monaco||C(D),We&&(Et.addCommand(D.KeyMod.CtrlCmd|D.KeyMod.Shift|D.KeyCode.KEY_V,function(){return be(),null}),Et.addCommand(D.KeyMod.CtrlCmd|D.KeyCode.KEY_C,function(){return be(),null})),window.Monaco=D,Re&&Et.onDidBlurEditorWidget(function(){Re(Et.getValue())}),Qe&&Et.onDidFocusEditorText(function(){Qe(Et.getValue())}),We){Et.addCommand(D.KeyMod.CtrlCmd|D.KeyCode.KEY_V,function(){return be(),null}),Et.onDidPaste(function(Pt){ke.current.pastePos=Pt});try{window.addEventListener("paste",je)}catch(Pt){}}var Dt=ge();return he(!0),function(){var Pt=ke.current.instance;Pt.dispose();var si=Pt.getModel();si&&si.dispose(),ke.current.subscription&&ke.current.subscription.dispose(),We&&window.removeEventListener("paste",je),Dt.unobserve(tt.current)}}catch(Pt){}})},[]),Object(K.useEffect)(function(){var Xe=ke.current.instance;if(Xe&&ae)return document.addEventListener("keydown",lt,!1),function(){document.removeEventListener("keydown",lt)}},[Le,ae]),Object(K.useEffect)(function(){var Xe=ke.current.instance;if(Xe&&ae){var Et=N(ve);D.editor.setModelLanguage(Xe.getModel(),Et),console.log("language:",ve,Xe.getModel(),Et)}},[ve,ae]),Object(K.useEffect)(function(){var Xe=ke.current.instance;Xe&&ae&&D.editor.setTheme(se)},[se,ae]),Object(K.useEffect)(function(){var Xe=ke.current.instance;Xe&&ae&&(Xe.updateOptions(Object(ue.a)({},fe)),setTimeout(function(){Xe.getModel().updateOptions(Object(ue.a)({},fe))},200))},[JSON.stringify(fe),ae]),Object(K.useEffect)(function(){var Xe=ke.current.instance;Xe&&ae&&Xe.layout()},[W,ie,ae]);var Rt=Object(K.useState)(d(W)),ft=Object(B.a)(Rt,2),It=ft[0],Bt=ft[1],ht=Object(K.useState)(d(ie)),ei=Object(B.a)(ht,2),Ut=ei[0],fi=ei[1],Ve=Object(ue.a)(Object(ue.a)({},Ce),{},{width:It,height:Ut});return G.a.createElement("div",{className:"my-monaco-editor",ref:tt,style:Ve})};function j(I){var b=I.width,W=b===void 0?"100%":b,Y=I.height,ie=Y===void 0?"100%":Y,oe=I.original,xe=I.modified,ve=I.language,we=I.options,Ce=we===void 0?{}:we,Se=Object(K.useRef)(),fe=Object(K.useState)(null),le=Object(B.a)(fe,2),te=le[0],de=le[1];function se(Ie){var Ue;return Se.current&&(Ue=new M.default(function(We){var Fe=Object($.a)(We),Ne;try{for(Fe.s();!(Ne=Fe.n()).done;){var Me=Ne.value;(Me.target.offsetHeight>0||Me.target.offsetWidth>0)&&Ie.layout()}}catch($e){Fe.e($e)}finally{Fe.f()}}),Ue.observe(Se.current)),Ue}Object(K.useEffect)(function(){Se.current&&ne.e(27).then(ne.t.bind(null,"M/lh",7)).then(function(Ie){D=Ie;var Ue=D.editor.createDiffEditor(Se.current,Object(ue.a)(Object(ue.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},Ce),{},{wordWrap:!0}));de(Ue);var We=se(Ue);return function(){Ue.dispose();var Fe=Ue.getModel();Fe&&Fe.dispose(),We.unobserve(Se.current)}})},[]),Object(K.useEffect)(function(){te&&te.setModel({original:D.editor.createModel(oe,ve),modified:D.editor.createModel(xe,ve)})},[oe,xe,ve,te]);var Re=d(W),Le=d(ie),Te={width:Re,height:Le};return G.a.createElement("div",{className:"my-diff-editor",ref:Se,style:Te})}},ZpRC:function(_t,Je,ne){"use strict";function ue(v){return typeof v=="object"&&v!=null&&v.nodeType===1}function Z(v,m){return(!m||v!=="hidden")&&v!=="visible"&&v!=="clip"}function P(v,m){if(v.clientHeight<v.scrollHeight||v.clientWidth<v.scrollWidth){var p=getComputedStyle(v,null);return Z(p.overflowY,m)||Z(p.overflowX,m)||function(h){var o=function(f){if(!f.ownerDocument||!f.ownerDocument.defaultView)return null;try{return f.ownerDocument.defaultView.frameElement}catch(l){return null}}(h);return!!o&&(o.clientHeight<h.scrollHeight||o.clientWidth<h.scrollWidth)}(v)}return!1}function $(v,m,p,h,o,f,l,r){return f<v&&l>m||f>v&&l<m?0:f<=v&&r<=p||l>=m&&r>=p?f-v-h:l>m&&r<p||f<v&&r>p?l-m+o:0}var B=function(v,m){var p=window,h=m.scrollMode,o=m.block,f=m.inline,l=m.boundary,r=m.skipOverflowHiddenElements,s=typeof l=="function"?l:function(Ue){return Ue!==l};if(!ue(v))throw new TypeError("Invalid target");for(var c=document.scrollingElement||document.documentElement,L=[],w=v;ue(w)&&s(w);){if((w=w.parentElement)===c){L.push(w);break}w!=null&&w===document.body&&P(w)&&!P(document.documentElement)||w!=null&&P(w,r)&&L.push(w)}for(var T=p.visualViewport?p.visualViewport.width:innerWidth,R=p.visualViewport?p.visualViewport.height:innerHeight,C=window.scrollX||pageXOffset,S=window.scrollY||pageYOffset,x=v.getBoundingClientRect(),_=x.height,d=x.width,u=x.top,g=x.right,E=x.bottom,N=x.left,D=o==="start"||o==="nearest"?u:o==="end"?E:u+_/2,H=f==="center"?N+d/2:f==="end"?g:N,j=[],I=0;I<L.length;I++){var b=L[I],W=b.getBoundingClientRect(),Y=W.height,ie=W.width,oe=W.top,xe=W.right,ve=W.bottom,we=W.left;if(h==="if-needed"&&u>=0&&N>=0&&E<=R&&g<=T&&u>=oe&&E<=ve&&N>=we&&g<=xe)return j;var Ce=getComputedStyle(b),Se=parseInt(Ce.borderLeftWidth,10),fe=parseInt(Ce.borderTopWidth,10),le=parseInt(Ce.borderRightWidth,10),te=parseInt(Ce.borderBottomWidth,10),de=0,se=0,Re="offsetWidth"in b?b.offsetWidth-b.clientWidth-Se-le:0,Le="offsetHeight"in b?b.offsetHeight-b.clientHeight-fe-te:0;if(c===b)de=o==="start"?D:o==="end"?D-R:o==="nearest"?$(S,S+R,R,fe,te,S+D,S+D+_,_):D-R/2,se=f==="start"?H:f==="center"?H-T/2:f==="end"?H-T:$(C,C+T,T,Se,le,C+H,C+H+d,d),de=Math.max(0,de+S),se=Math.max(0,se+C);else{de=o==="start"?D-oe-fe:o==="end"?D-ve+te+Le:o==="nearest"?$(oe,ve,Y,fe,te+Le,D,D+_,_):D-(oe+Y/2)+Le/2,se=f==="start"?H-we-Se:f==="center"?H-(we+ie/2)+Re/2:f==="end"?H-xe+le+Re:$(we,xe,ie,Se,le+Re,H,H+d,d);var Te=b.scrollLeft,Ie=b.scrollTop;D+=Ie-(de=Math.max(0,Math.min(Ie+de,b.scrollHeight-Y+Le))),H+=Te-(se=Math.max(0,Math.min(Te+se,b.scrollWidth-ie+Re)))}j.push({el:b,top:de,left:se})}return j};function U(v){return v===Object(v)&&Object.keys(v).length!==0}function K(v,m){m===void 0&&(m="auto");var p="scrollBehavior"in document.body.style;v.forEach(function(h){var o=h.el,f=h.top,l=h.left;o.scroll&&p?o.scroll({top:f,left:l,behavior:m}):(o.scrollTop=f,o.scrollLeft=l)})}function G(v){return v===!1?{block:"end",inline:"nearest"}:U(v)?v:{block:"start",inline:"nearest"}}function M(v,m){var p=!v.ownerDocument.documentElement.contains(v);if(U(m)&&typeof m.behavior=="function")return m.behavior(p?[]:B(v,m));if(p)return;var h=G(m);return K(B(v,h),h.behavior)}var O=Je.a=M},Zss7:function(_t,Je,ne){var ue;(function(Z){var P=/^\s+/,$=/\s+$/,B=0,U=Z.round,K=Z.min,G=Z.max,M=Z.random;function O(te,de){if(te=te||"",de=de||{},te instanceof O)return te;if(!(this instanceof O))return new O(te,de);var se=v(te);this._originalInput=te,this._r=se.r,this._g=se.g,this._b=se.b,this._a=se.a,this._roundA=U(100*this._a)/100,this._format=de.format||se.format,this._gradientType=de.gradientType,this._r<1&&(this._r=U(this._r)),this._g<1&&(this._g=U(this._g)),this._b<1&&(this._b=U(this._b)),this._ok=se.ok,this._tc_id=B++}O.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var te=this.toRgb();return(te.r*299+te.g*587+te.b*114)/1e3},getLuminance:function(){var te=this.toRgb(),de,se,Re,Le,Te,Ie;return de=te.r/255,se=te.g/255,Re=te.b/255,de<=.03928?Le=de/12.92:Le=Z.pow((de+.055)/1.055,2.4),se<=.03928?Te=se/12.92:Te=Z.pow((se+.055)/1.055,2.4),Re<=.03928?Ie=Re/12.92:Ie=Z.pow((Re+.055)/1.055,2.4),.2126*Le+.7152*Te+.0722*Ie},setAlpha:function(te){return this._a=j(te),this._roundA=U(100*this._a)/100,this},toHsv:function(){var te=o(this._r,this._g,this._b);return{h:te.h*360,s:te.s,v:te.v,a:this._a}},toHsvString:function(){var te=o(this._r,this._g,this._b),de=U(te.h*360),se=U(te.s*100),Re=U(te.v*100);return this._a==1?"hsv("+de+", "+se+"%, "+Re+"%)":"hsva("+de+", "+se+"%, "+Re+"%, "+this._roundA+")"},toHsl:function(){var te=p(this._r,this._g,this._b);return{h:te.h*360,s:te.s,l:te.l,a:this._a}},toHslString:function(){var te=p(this._r,this._g,this._b),de=U(te.h*360),se=U(te.s*100),Re=U(te.l*100);return this._a==1?"hsl("+de+", "+se+"%, "+Re+"%)":"hsla("+de+", "+se+"%, "+Re+"%, "+this._roundA+")"},toHex:function(te){return l(this._r,this._g,this._b,te)},toHexString:function(te){return"#"+this.toHex(te)},toHex8:function(te){return r(this._r,this._g,this._b,this._a,te)},toHex8String:function(te){return"#"+this.toHex8(te)},toRgb:function(){return{r:U(this._r),g:U(this._g),b:U(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+U(this._r)+", "+U(this._g)+", "+U(this._b)+")":"rgba("+U(this._r)+", "+U(this._g)+", "+U(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:U(I(this._r,255)*100)+"%",g:U(I(this._g,255)*100)+"%",b:U(I(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+U(I(this._r,255)*100)+"%, "+U(I(this._g,255)*100)+"%, "+U(I(this._b,255)*100)+"%)":"rgba("+U(I(this._r,255)*100)+"%, "+U(I(this._g,255)*100)+"%, "+U(I(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:D[l(this._r,this._g,this._b,!0)]||!1},toFilter:function(te){var de="#"+s(this._r,this._g,this._b,this._a),se=de,Re=this._gradientType?"GradientType = 1, ":"";if(te){var Le=O(te);se="#"+s(Le._r,Le._g,Le._b,Le._a)}return"progid:DXImageTransform.Microsoft.gradient("+Re+"startColorstr="+de+",endColorstr="+se+")"},toString:function(te){var de=!!te;te=te||this._format;var se=!1,Re=this._a<1&&this._a>=0,Le=!de&&Re&&(te==="hex"||te==="hex6"||te==="hex3"||te==="hex4"||te==="hex8"||te==="name");return Le?te==="name"&&this._a===0?this.toName():this.toRgbString():(te==="rgb"&&(se=this.toRgbString()),te==="prgb"&&(se=this.toPercentageRgbString()),(te==="hex"||te==="hex6")&&(se=this.toHexString()),te==="hex3"&&(se=this.toHexString(!0)),te==="hex4"&&(se=this.toHex8String(!0)),te==="hex8"&&(se=this.toHex8String()),te==="name"&&(se=this.toName()),te==="hsl"&&(se=this.toHslString()),te==="hsv"&&(se=this.toHsvString()),se||this.toHexString())},clone:function(){return O(this.toString())},_applyModification:function(te,de){var se=te.apply(null,[this].concat([].slice.call(de)));return this._r=se._r,this._g=se._g,this._b=se._b,this.setAlpha(se._a),this},lighten:function(){return this._applyModification(T,arguments)},brighten:function(){return this._applyModification(R,arguments)},darken:function(){return this._applyModification(C,arguments)},desaturate:function(){return this._applyModification(c,arguments)},saturate:function(){return this._applyModification(L,arguments)},greyscale:function(){return this._applyModification(w,arguments)},spin:function(){return this._applyModification(S,arguments)},_applyCombination:function(te,de){return te.apply(null,[this].concat([].slice.call(de)))},analogous:function(){return this._applyCombination(g,arguments)},complement:function(){return this._applyCombination(x,arguments)},monochromatic:function(){return this._applyCombination(E,arguments)},splitcomplement:function(){return this._applyCombination(u,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(d,arguments)}},O.fromRatio=function(te,de){if(typeof te=="object"){var se={};for(var Re in te)te.hasOwnProperty(Re)&&(Re==="a"?se[Re]=te[Re]:se[Re]=xe(te[Re]));te=se}return O(te,de)};function v(te){var de={r:0,g:0,b:0},se=1,Re=null,Le=null,Te=null,Ie=!1,Ue=!1;return typeof te=="string"&&(te=fe(te)),typeof te=="object"&&(Se(te.r)&&Se(te.g)&&Se(te.b)?(de=m(te.r,te.g,te.b),Ie=!0,Ue=String(te.r).substr(-1)==="%"?"prgb":"rgb"):Se(te.h)&&Se(te.s)&&Se(te.v)?(Re=xe(te.s),Le=xe(te.v),de=f(te.h,Re,Le),Ie=!0,Ue="hsv"):Se(te.h)&&Se(te.s)&&Se(te.l)&&(Re=xe(te.s),Te=xe(te.l),de=h(te.h,Re,Te),Ie=!0,Ue="hsl"),te.hasOwnProperty("a")&&(se=te.a)),se=j(se),{ok:Ie,format:te.format||Ue,r:K(255,G(de.r,0)),g:K(255,G(de.g,0)),b:K(255,G(de.b,0)),a:se}}function m(te,de,se){return{r:I(te,255)*255,g:I(de,255)*255,b:I(se,255)*255}}function p(te,de,se){te=I(te,255),de=I(de,255),se=I(se,255);var Re=G(te,de,se),Le=K(te,de,se),Te,Ie,Ue=(Re+Le)/2;if(Re==Le)Te=Ie=0;else{var We=Re-Le;Ie=Ue>.5?We/(2-Re-Le):We/(Re+Le);switch(Re){case te:Te=(de-se)/We+(de<se?6:0);break;case de:Te=(se-te)/We+2;break;case se:Te=(te-de)/We+4;break}Te/=6}return{h:Te,s:Ie,l:Ue}}function h(te,de,se){var Re,Le,Te;te=I(te,360),de=I(de,100),se=I(se,100);function Ie(Fe,Ne,Me){return Me<0&&(Me+=1),Me>1&&(Me-=1),Me<1/6?Fe+(Ne-Fe)*6*Me:Me<1/2?Ne:Me<2/3?Fe+(Ne-Fe)*(2/3-Me)*6:Fe}if(de===0)Re=Le=Te=se;else{var Ue=se<.5?se*(1+de):se+de-se*de,We=2*se-Ue;Re=Ie(We,Ue,te+1/3),Le=Ie(We,Ue,te),Te=Ie(We,Ue,te-1/3)}return{r:Re*255,g:Le*255,b:Te*255}}function o(te,de,se){te=I(te,255),de=I(de,255),se=I(se,255);var Re=G(te,de,se),Le=K(te,de,se),Te,Ie,Ue=Re,We=Re-Le;if(Ie=Re===0?0:We/Re,Re==Le)Te=0;else{switch(Re){case te:Te=(de-se)/We+(de<se?6:0);break;case de:Te=(se-te)/We+2;break;case se:Te=(te-de)/We+4;break}Te/=6}return{h:Te,s:Ie,v:Ue}}function f(te,de,se){te=I(te,360)*6,de=I(de,100),se=I(se,100);var Re=Z.floor(te),Le=te-Re,Te=se*(1-de),Ie=se*(1-Le*de),Ue=se*(1-(1-Le)*de),We=Re%6,Fe=[se,Ie,Te,Te,Ue,se][We],Ne=[Ue,se,se,Ie,Te,Te][We],Me=[Te,Te,Ue,se,se,Ie][We];return{r:Fe*255,g:Ne*255,b:Me*255}}function l(te,de,se,Re){var Le=[oe(U(te).toString(16)),oe(U(de).toString(16)),oe(U(se).toString(16))];return Re&&Le[0].charAt(0)==Le[0].charAt(1)&&Le[1].charAt(0)==Le[1].charAt(1)&&Le[2].charAt(0)==Le[2].charAt(1)?Le[0].charAt(0)+Le[1].charAt(0)+Le[2].charAt(0):Le.join("")}function r(te,de,se,Re,Le){var Te=[oe(U(te).toString(16)),oe(U(de).toString(16)),oe(U(se).toString(16)),oe(ve(Re))];return Le&&Te[0].charAt(0)==Te[0].charAt(1)&&Te[1].charAt(0)==Te[1].charAt(1)&&Te[2].charAt(0)==Te[2].charAt(1)&&Te[3].charAt(0)==Te[3].charAt(1)?Te[0].charAt(0)+Te[1].charAt(0)+Te[2].charAt(0)+Te[3].charAt(0):Te.join("")}function s(te,de,se,Re){var Le=[oe(ve(Re)),oe(U(te).toString(16)),oe(U(de).toString(16)),oe(U(se).toString(16))];return Le.join("")}O.equals=function(te,de){return!te||!de?!1:O(te).toRgbString()==O(de).toRgbString()},O.random=function(){return O.fromRatio({r:M(),g:M(),b:M()})};function c(te,de){de=de===0?0:de||10;var se=O(te).toHsl();return se.s-=de/100,se.s=b(se.s),O(se)}function L(te,de){de=de===0?0:de||10;var se=O(te).toHsl();return se.s+=de/100,se.s=b(se.s),O(se)}function w(te){return O(te).desaturate(100)}function T(te,de){de=de===0?0:de||10;var se=O(te).toHsl();return se.l+=de/100,se.l=b(se.l),O(se)}function R(te,de){de=de===0?0:de||10;var se=O(te).toRgb();return se.r=G(0,K(255,se.r-U(255*-(de/100)))),se.g=G(0,K(255,se.g-U(255*-(de/100)))),se.b=G(0,K(255,se.b-U(255*-(de/100)))),O(se)}function C(te,de){de=de===0?0:de||10;var se=O(te).toHsl();return se.l-=de/100,se.l=b(se.l),O(se)}function S(te,de){var se=O(te).toHsl(),Re=(se.h+de)%360;return se.h=Re<0?360+Re:Re,O(se)}function x(te){var de=O(te).toHsl();return de.h=(de.h+180)%360,O(de)}function _(te){var de=O(te).toHsl(),se=de.h;return[O(te),O({h:(se+120)%360,s:de.s,l:de.l}),O({h:(se+240)%360,s:de.s,l:de.l})]}function d(te){var de=O(te).toHsl(),se=de.h;return[O(te),O({h:(se+90)%360,s:de.s,l:de.l}),O({h:(se+180)%360,s:de.s,l:de.l}),O({h:(se+270)%360,s:de.s,l:de.l})]}function u(te){var de=O(te).toHsl(),se=de.h;return[O(te),O({h:(se+72)%360,s:de.s,l:de.l}),O({h:(se+216)%360,s:de.s,l:de.l})]}function g(te,de,se){de=de||6,se=se||30;var Re=O(te).toHsl(),Le=360/se,Te=[O(te)];for(Re.h=(Re.h-(Le*de>>1)+720)%360;--de;)Re.h=(Re.h+Le)%360,Te.push(O(Re));return Te}function E(te,de){de=de||6;for(var se=O(te).toHsv(),Re=se.h,Le=se.s,Te=se.v,Ie=[],Ue=1/de;de--;)Ie.push(O({h:Re,s:Le,v:Te})),Te=(Te+Ue)%1;return Ie}O.mix=function(te,de,se){se=se===0?0:se||50;var Re=O(te).toRgb(),Le=O(de).toRgb(),Te=se/100,Ie={r:(Le.r-Re.r)*Te+Re.r,g:(Le.g-Re.g)*Te+Re.g,b:(Le.b-Re.b)*Te+Re.b,a:(Le.a-Re.a)*Te+Re.a};return O(Ie)},O.readability=function(te,de){var se=O(te),Re=O(de);return(Z.max(se.getLuminance(),Re.getLuminance())+.05)/(Z.min(se.getLuminance(),Re.getLuminance())+.05)},O.isReadable=function(te,de,se){var Re=O.readability(te,de),Le,Te;Te=!1,Le=le(se);switch(Le.level+Le.size){case"AAsmall":case"AAAlarge":Te=Re>=4.5;break;case"AAlarge":Te=Re>=3;break;case"AAAsmall":Te=Re>=7;break}return Te},O.mostReadable=function(te,de,se){var Re=null,Le=0,Te,Ie,Ue,We;se=se||{},Ie=se.includeFallbackColors,Ue=se.level,We=se.size;for(var Fe=0;Fe<de.length;Fe++)Te=O.readability(te,de[Fe]),Te>Le&&(Le=Te,Re=O(de[Fe]));return O.isReadable(te,Re,{level:Ue,size:We})||!Ie?Re:(se.includeFallbackColors=!1,O.mostReadable(te,["#fff","#000"],se))};var N=O.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},D=O.hexNames=H(N);function H(te){var de={};for(var se in te)te.hasOwnProperty(se)&&(de[te[se]]=se);return de}function j(te){return te=parseFloat(te),(isNaN(te)||te<0||te>1)&&(te=1),te}function I(te,de){Y(te)&&(te="100%");var se=ie(te);return te=K(de,G(0,parseFloat(te))),se&&(te=parseInt(te*de,10)/100),Z.abs(te-de)<1e-6?1:te%de/parseFloat(de)}function b(te){return K(1,G(0,te))}function W(te){return parseInt(te,16)}function Y(te){return typeof te=="string"&&te.indexOf(".")!=-1&&parseFloat(te)===1}function ie(te){return typeof te=="string"&&te.indexOf("%")!=-1}function oe(te){return te.length==1?"0"+te:""+te}function xe(te){return te<=1&&(te=te*100+"%"),te}function ve(te){return Z.round(parseFloat(te)*255).toString(16)}function we(te){return W(te)/255}var Ce=function(){var te="[-\\+]?\\d+%?",de="[-\\+]?\\d*\\.\\d+%?",se="(?:"+de+")|(?:"+te+")",Re="[\\s|\\(]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")\\s*\\)?",Le="[\\s|\\(]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")\\s*\\)?";return{CSS_UNIT:new RegExp(se),rgb:new RegExp("rgb"+Re),rgba:new RegExp("rgba"+Le),hsl:new RegExp("hsl"+Re),hsla:new RegExp("hsla"+Le),hsv:new RegExp("hsv"+Re),hsva:new RegExp("hsva"+Le),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Se(te){return!!Ce.CSS_UNIT.exec(te)}function fe(te){te=te.replace(P,"").replace($,"").toLowerCase();var de=!1;if(N[te])te=N[te],de=!0;else if(te=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var se;return(se=Ce.rgb.exec(te))?{r:se[1],g:se[2],b:se[3]}:(se=Ce.rgba.exec(te))?{r:se[1],g:se[2],b:se[3],a:se[4]}:(se=Ce.hsl.exec(te))?{h:se[1],s:se[2],l:se[3]}:(se=Ce.hsla.exec(te))?{h:se[1],s:se[2],l:se[3],a:se[4]}:(se=Ce.hsv.exec(te))?{h:se[1],s:se[2],v:se[3]}:(se=Ce.hsva.exec(te))?{h:se[1],s:se[2],v:se[3],a:se[4]}:(se=Ce.hex8.exec(te))?{r:W(se[1]),g:W(se[2]),b:W(se[3]),a:we(se[4]),format:de?"name":"hex8"}:(se=Ce.hex6.exec(te))?{r:W(se[1]),g:W(se[2]),b:W(se[3]),format:de?"name":"hex"}:(se=Ce.hex4.exec(te))?{r:W(se[1]+""+se[1]),g:W(se[2]+""+se[2]),b:W(se[3]+""+se[3]),a:we(se[4]+""+se[4]),format:de?"name":"hex8"}:(se=Ce.hex3.exec(te))?{r:W(se[1]+""+se[1]),g:W(se[2]+""+se[2]),b:W(se[3]+""+se[3]),format:de?"name":"hex"}:!1}function le(te){var de,se;return te=te||{level:"AA",size:"small"},de=(te.level||"AA").toUpperCase(),se=(te.size||"small").toLowerCase(),de!=="AA"&&de!=="AAA"&&(de="AA"),se!=="small"&&se!=="large"&&(se="small"),{level:de,size:se}}_t.exports?_t.exports=O:!(ue=function(){return O}.call(Je,ne,Je,_t),ue!==void 0&&(_t.exports=ue))})(Math)},bT9E:function(_t,Je,ne){"use strict";ne.d(Je,"a",function(){return Z});var ue=ne("VTBJ");function Z(P,$){var B=Object(ue.a)({},P);return Array.isArray($)&&$.forEach(function(U){delete B[U]}),B}},c5Ni:function(_t,Je,ne){},dejd:function(_t,Je,ne){},dmUQ:function(_t,Je,ne){"use strict";var ue=ne("Ff2n"),Z=ne("rePB"),P=ne("1OyB"),$=ne("vuIU"),B=ne("Ji7U"),U=ne("md7G"),K=ne("foSv"),G=ne("q1tI"),M=ne.n(G),O=ne("TSYQ"),v=ne.n(O),m=ne("4IlW");function p(_,d){var u=Object.keys(_);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(_);d&&(g=g.filter(function(E){return Object.getOwnPropertyDescriptor(_,E).enumerable})),u.push.apply(u,g)}return u}function h(_){for(var d=1;d<arguments.length;d++){var u=arguments[d]!=null?arguments[d]:{};d%2?p(Object(u),!0).forEach(function(g){Object(Z.a)(_,g,u[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(_,Object.getOwnPropertyDescriptors(u)):p(Object(u)).forEach(function(g){Object.defineProperty(_,g,Object.getOwnPropertyDescriptor(u,g))})}return _}function o(_){var d=f();return function(){var g=Object(K.a)(_),E;if(d){var N=Object(K.a)(this).constructor;E=Reflect.construct(g,arguments,N)}else E=g.apply(this,arguments);return Object(U.a)(this,E)}}function f(){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(_){return!1}}function l(){}function r(_){_.preventDefault()}var s=function(d){return d.replace(/[^\w.-]+/g,"")},c=200,L=600,w=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,T=function(d){return d!=null},R=function(d,u){return u===d||typeof u=="number"&&typeof d=="number"&&isNaN(u)&&isNaN(d)},C=function(_){Object(B.a)(u,_);var d=o(u);function u(g){var E;Object(P.a)(this,u),E=d.call(this,g),E.onKeyDown=function(H){var j=E.props,I=j.onKeyDown,b=j.onPressEnter;if(H.keyCode===m.a.UP){var W=E.getRatio(H);E.up(H,W,null),E.stop()}else if(H.keyCode===m.a.DOWN){var Y=E.getRatio(H);E.down(H,Y,null),E.stop()}else H.keyCode===m.a.ENTER&&b&&b(H);if(E.recordCursorPosition(),E.lastKeyCode=H.keyCode,I){for(var ie=arguments.length,oe=new Array(ie>1?ie-1:0),xe=1;xe<ie;xe++)oe[xe-1]=arguments[xe];I.apply(void 0,[H].concat(oe))}},E.onKeyUp=function(H){var j=E.props.onKeyUp;if(E.stop(),E.recordCursorPosition(),j){for(var I=arguments.length,b=new Array(I>1?I-1:0),W=1;W<I;W++)b[W-1]=arguments[W];j.apply(void 0,[H].concat(b))}},E.onChange=function(H){var j=E.props.onChange;E.state.focused&&(E.inputting=!0),E.rawInput=E.props.parser(E.getValueFromEvent(H)),E.setState({inputValue:E.rawInput}),j(E.toNumber(E.rawInput))},E.onMouseUp=function(){var H=E.props.onMouseUp;E.recordCursorPosition(),H&&H.apply(void 0,arguments)},E.onFocus=function(){var H;E.setState({focused:!0}),(H=E.props).onFocus.apply(H,arguments)},E.onBlur=function(){var H=E.props.onBlur;E.inputting=!1,E.setState({focused:!1});var j=E.getCurrentValidValue(E.state.inputValue),I=E.setValue(j,l);if(H){var b=E.input.value,W=E.getInputDisplayValue({focus:!1,value:I});E.input.value=W&&Number(W),H.apply(void 0,arguments),E.input.value=b}},E.getRatio=function(H){var j=1;return H.metaKey||H.ctrlKey?j=.1:H.shiftKey&&(j=10),j},E.getFullNum=function(H){return isNaN(H)?H:/e/i.test(String(H))?Number(H).toFixed(18).replace(/\.?0+$/,""):H},E.getPrecision=function(H){if(T(E.props.precision))return E.props.precision;var j=String(H);if(j.indexOf("e-")>=0)return parseInt(j.slice(j.indexOf("e-")+2),10);var I=0;return j.indexOf(".")>=0&&(I=j.length-j.indexOf(".")-1),I},E.getInputDisplayValue=function(H){var j=H||E.state,I=j.focused,b=j.inputValue,W=j.value,Y;I?Y=b:Y=E.toPrecisionAsStep(W),Y==null&&(Y="");var ie=E.formatWrapper(Y);return T(E.props.decimalSeparator)&&(ie=ie.toString().replace(".",E.props.decimalSeparator)),ie},E.recordCursorPosition=function(){try{E.cursorStart=E.input.selectionStart,E.cursorEnd=E.input.selectionEnd,E.currentValue=E.input.value,E.cursorBefore=E.input.value.substring(0,E.cursorStart),E.cursorAfter=E.input.value.substring(E.cursorEnd)}catch(H){}},E.restoreByAfter=function(H){if(H===void 0)return!1;var j=E.input.value,I=j.lastIndexOf(H);if(I===-1)return!1;var b=E.cursorBefore.length;return E.lastKeyCode===m.a.DELETE&&E.cursorBefore.charAt(b-1)===H[0]?(E.fixCaret(b,b),!0):I+H.length===j.length?(E.fixCaret(I,I),!0):!1},E.partRestoreByAfter=function(H){return H===void 0?!1:Array.prototype.some.call(H,function(j,I){var b=H.substring(I);return E.restoreByAfter(b)})},E.isNotCompleteNumber=function(H){return isNaN(H)||H===""||H===null||H&&H.toString().indexOf(".")===H.toString().length-1},E.stop=function(){E.autoStepTimer&&clearTimeout(E.autoStepTimer)},E.down=function(H,j,I){E.pressingUpOrDown=!0,E.step("down",H,j,I)},E.up=function(H,j,I){E.pressingUpOrDown=!0,E.step("up",H,j,I)},E.saveInput=function(H){E.input=H};var N=g.value;N===void 0&&(N=g.defaultValue),E.state={focused:g.autoFocus};var D=E.getValidValue(E.toNumber(N));return E.state=h(h({},E.state),{},{inputValue:E.toPrecisionAsStep(D),value:D}),E}return Object($.a)(u,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(E){var N=this.props,D=N.value,H=N.onChange,j=N.max,I=N.min,b=this.state.focused;if(E){if(!R(E.value,D)||!R(E.max,j)||!R(E.min,I)){var W=b?D:this.getValidValue(D),Y;this.pressingUpOrDown?Y=W:this.inputting?Y=this.rawInput:Y=this.toPrecisionAsStep(W),this.setState({value:W,inputValue:Y})}var ie="value"in this.props?D:this.state.value;"max"in this.props&&E.max!==j&&typeof ie=="number"&&ie>j&&H&&H(j),"min"in this.props&&E.min!==I&&typeof ie=="number"&&ie<I&&H&&H(I)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var oe=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===m.a.BACKSPACE?oe=this.cursorStart-1:this.lastKeyCode===m.a.DELETE&&(oe=this.cursorStart):oe=this.input.value.length,this.fixCaret(oe,oe)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case m.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case m.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(xe){}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(E){var N=E;return N===""?N="":this.isNotCompleteNumber(parseFloat(N))?N=this.state.value:N=this.getValidValue(N),this.toNumber(N)}},{key:"getValueFromEvent",value:function(E){var N=E.target.value.trim().replace(/。/g,".");return T(this.props.decimalSeparator)&&(N=N.replace(this.props.decimalSeparator,".")),N}},{key:"getValidValue",value:function(E){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,H=parseFloat(E);return isNaN(H)?E:(H<N&&(H=N),H>D&&(H=D),H)}},{key:"setValue",value:function(E,N){var D=this.props.precision,H=this.isNotCompleteNumber(parseFloat(E))?null:parseFloat(E),j=this.state.value,I=j===void 0?null:j,b=this.state.inputValue,W=b===void 0?null:b,Y=typeof H=="number"?H.toFixed(D):"".concat(H),ie=H!==I||Y!=="".concat(W);return"value"in this.props?(W=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:W},N)):this.setState({value:H,inputValue:this.toPrecisionAsStep(E)},N),ie&&this.props.onChange(H),H}},{key:"getMaxPrecision",value:function(E){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,D=this.props,H=D.precision,j=D.step;if(T(H))return H;var I=this.getPrecision(N),b=this.getPrecision(j),W=this.getPrecision(E);return E?Math.max(W,I+b):I+b}},{key:"getPrecisionFactor",value:function(E){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,D=this.getMaxPrecision(E,N);return Math.pow(10,D)}},{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(E){return this.props.formatter?this.props.formatter(E):E}},{key:"toPrecisionAsStep",value:function(E){if(this.isNotCompleteNumber(E)||E==="")return E;var N=Math.abs(this.getMaxPrecision(E));return isNaN(N)?E.toString():Number(E).toFixed(N)}},{key:"toNumber",value:function(E){var N=this.props.precision,D=this.state.focused,H=E&&E.length>16&&D;return this.isNotCompleteNumber(E)||H?E:T(N)?Math.round(E*Math.pow(10,N))/Math.pow(10,N):Number(E)}},{key:"upStep",value:function(E,N){var D=this.props.step,H=this.getPrecisionFactor(E,N),j=Math.abs(this.getMaxPrecision(E,N)),I=((H*E+H*D*N)/H).toFixed(j);return this.toNumber(I)}},{key:"downStep",value:function(E,N){var D=this.props.step,H=this.getPrecisionFactor(E,N),j=Math.abs(this.getMaxPrecision(E,N)),I=((H*E-H*D*N)/H).toFixed(j);return this.toNumber(I)}},{key:"step",value:function(E,N){var D=this,H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,j=arguments.length>3?arguments[3]:void 0;this.stop(),N&&(N.persist(),N.preventDefault());var I=this.props;if(I.disabled)return;var b=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(b))return;var W=this["".concat(E,"Step")](b,H),Y=W>I.max||W<I.min;if(W>I.max?W=I.max:W<I.min&&(W=I.min),this.setValue(W,null),this.setState({focused:!0},function(){D.pressingUpOrDown=!1}),Y)return;this.autoStepTimer=setTimeout(function(){D[E](N,H,!0)},j?c:L)}},{key:"fixCaret",value:function(E,N){if(E===void 0||N===void 0||!this.input||!this.input.value)return;try{var D=this.input.selectionStart,H=this.input.selectionEnd;(E!==D||N!==H)&&this.input.setSelectionRange(E,N)}catch(j){}}},{key:"render",value:function(){var E,N=this.props,D=N.prefixCls,H=N.disabled,j=N.readOnly,I=N.useTouch,b=N.autoComplete,W=N.upHandler,Y=N.downHandler,ie=N.className,oe=N.max,xe=N.min,ve=N.style,we=N.title,Ce=N.onMouseEnter,Se=N.onMouseLeave,fe=N.onMouseOver,le=N.onMouseOut,te=N.required,de=N.onClick,se=N.tabIndex,Re=N.type,Le=N.placeholder,Te=N.id,Ie=N.inputMode,Ue=N.pattern,We=N.step,Fe=N.maxLength,Ne=N.autoFocus,Me=N.name,$e=N.onPaste,et=N.onInput,Qe=Object(ue.a)(N,["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"]),Ze=this.state,dt=Ze.value,it=Ze.focused,at=v()(D,(E={},Object(Z.a)(E,ie,!!ie),Object(Z.a)(E,"".concat(D,"-disabled"),H),Object(Z.a)(E,"".concat(D,"-focused"),it),E)),Pe={};Object.keys(Qe).forEach(function(ge){(ge.substr(0,5)==="data-"||ge.substr(0,5)==="aria-"||ge==="role")&&(Pe[ge]=Qe[ge])});var ut=!j&&!H,tt=this.getInputDisplayValue(null),ke=(dt||dt===0)&&(isNaN(dt)||Number(dt)>=oe),Ge=(dt||dt===0)&&(isNaN(dt)||Number(dt)<=xe),Ee=ke||H||j,pe=Ge||H||j,_e=v()("".concat(D,"-handler"),"".concat(D,"-handler-up"),Object(Z.a)({},"".concat(D,"-handler-up-disabled"),Ee)),re=v()("".concat(D,"-handler"),"".concat(D,"-handler-down"),Object(Z.a)({},"".concat(D,"-handler-down-disabled"),pe)),ae=I?{onTouchStart:Ee?l:this.up,onTouchEnd:this.stop}:{onMouseDown:Ee?l:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},he=I?{onTouchStart:pe?l:this.down,onTouchEnd:this.stop}:{onMouseDown:pe?l:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return M.a.createElement("div",{className:at,style:ve,title:we,onMouseEnter:Ce,onMouseLeave:Se,onMouseOver:fe,onMouseOut:le,onFocus:function(){return null},onBlur:function(){return null}},M.a.createElement("div",{className:"".concat(D,"-handler-wrap")},M.a.createElement("span",Object.assign({unselectable:"on"},ae,{role:"button","aria-label":"Increase Value","aria-disabled":Ee,className:_e}),W||M.a.createElement("span",{unselectable:"on",className:"".concat(D,"-handler-up-inner"),onClick:r})),M.a.createElement("span",Object.assign({unselectable:"on"},he,{role:"button","aria-label":"Decrease Value","aria-disabled":pe,className:re}),Y||M.a.createElement("span",{unselectable:"on",className:"".concat(D,"-handler-down-inner"),onClick:r}))),M.a.createElement("div",{className:"".concat(D,"-input-wrap")},M.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":xe,"aria-valuemax":oe,"aria-valuenow":dt,required:te,type:Re,placeholder:Le,onPaste:$e,onClick:de,onMouseUp:this.onMouseUp,className:"".concat(D,"-input"),tabIndex:se,autoComplete:b,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:ut?this.onKeyDown:l,onKeyUp:ut?this.onKeyUp:l,autoFocus:Ne,maxLength:Fe,readOnly:j,disabled:H,max:oe,min:xe,step:We,name:Me,title:we,id:Te,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(tt),pattern:Ue,inputMode:Ie,onInput:et},Pe))))}}]),u}(M.a.Component);C.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:w,min:-w,step:1,style:{},onChange:l,onKeyDown:l,onPressEnter:l,onFocus:l,onBlur:l,parser:s,required:!1,autoComplete:"off"};var S=C,x=Je.a=S},h78n:function(_t,Je,ne){"use strict";ne.d(Je,"a",function(){return E});var ue=ne("q1tI"),Z=ne.n(ue),P=ne("TSYQ"),$=ne.n(P),B={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},U=function(H){var j=H.map(function(){return Object(ue.useRef)()}),I=Object(ue.useRef)();return Object(ue.useEffect)(function(){var b=Date.now(),W=!1;Object.keys(j).forEach(function(Y){var ie=j[Y].current;if(!ie)return;W=!0;var oe=ie.style;oe.transitionDuration=".3s, .3s, .3s, .06s",I.current&&b-I.current<100&&(oe.transitionDuration="0s, 0s")}),W&&(I.current=Date.now())}),[j]};function K(){return K=Object.assign||function(D){for(var H=1;H<arguments.length;H++){var j=arguments[H];for(var I in j)Object.prototype.hasOwnProperty.call(j,I)&&(D[I]=j[I])}return D},K.apply(this,arguments)}function G(D,H){return p(D)||m(D,H)||O(D,H)||M()}function M(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function O(D,H){if(!D)return;if(typeof D=="string")return v(D,H);var j=Object.prototype.toString.call(D).slice(8,-1);if(j==="Object"&&D.constructor&&(j=D.constructor.name),j==="Map"||j==="Set")return Array.from(D);if(j==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(j))return v(D,H)}function v(D,H){(H==null||H>D.length)&&(H=D.length);for(var j=0,I=new Array(H);j<H;j++)I[j]=D[j];return I}function m(D,H){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(D)))return;var j=[],I=!0,b=!1,W=void 0;try{for(var Y=D[Symbol.iterator](),ie;!(I=(ie=Y.next()).done)&&!(j.push(ie.value),H&&j.length===H);I=!0);}catch(oe){b=!0,W=oe}finally{try{!I&&Y.return!=null&&Y.return()}finally{if(b)throw W}}return j}function p(D){if(Array.isArray(D))return D}function h(D,H){if(D==null)return{};var j=o(D,H),I,b;if(Object.getOwnPropertySymbols){var W=Object.getOwnPropertySymbols(D);for(b=0;b<W.length;b++){if(I=W[b],H.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(D,I))continue;j[I]=D[I]}}return j}function o(D,H){if(D==null)return{};var j={},I=Object.keys(D),b,W;for(W=0;W<I.length;W++){if(b=I[W],H.indexOf(b)>=0)continue;j[b]=D[b]}return j}var f=function(H){var j=H.className,I=H.percent,b=H.prefixCls,W=H.strokeColor,Y=H.strokeLinecap,ie=H.strokeWidth,oe=H.style,xe=H.trailColor,ve=H.trailWidth,we=H.transition,Ce=h(H,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Ce.gapPosition;var Se=Array.isArray(I)?I:[I],fe=Array.isArray(W)?W:[W],le=U(Se),te=G(le,1),de=te[0],se=ie/2,Re=100-ie/2,Le="M ".concat(Y==="round"?se:0,",").concat(se,`
L `).concat(Y==="round"?Re:100,",").concat(se),Te="0 0 100 ".concat(ie),Ie=0;return Z.a.createElement("svg",K({className:$()("".concat(b,"-line"),j),viewBox:Te,preserveAspectRatio:"none",style:oe},Ce),Z.a.createElement("path",{className:"".concat(b,"-line-trail"),d:Le,strokeLinecap:Y,stroke:xe,strokeWidth:ve||ie,fillOpacity:"0"}),Se.map(function(Ue,We){var Fe={strokeDasharray:"".concat(Ue,"px, 100px"),strokeDashoffset:"-".concat(Ie,"px"),transition:we||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Ne=fe[We]||fe[fe.length-1];return Ie+=Ue,Z.a.createElement("path",{key:We,className:"".concat(b,"-line-path"),d:Le,strokeLinecap:Y,stroke:Ne,strokeWidth:ie,fillOpacity:"0",ref:de[We],style:Fe})}))};f.defaultProps=B;var l=f;function r(){return r=Object.assign||function(D){for(var H=1;H<arguments.length;H++){var j=arguments[H];for(var I in j)Object.prototype.hasOwnProperty.call(j,I)&&(D[I]=j[I])}return D},r.apply(this,arguments)}function s(D,H){return R(D)||T(D,H)||L(D,H)||c()}function c(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function L(D,H){if(!D)return;if(typeof D=="string")return w(D,H);var j=Object.prototype.toString.call(D).slice(8,-1);if(j==="Object"&&D.constructor&&(j=D.constructor.name),j==="Map"||j==="Set")return Array.from(D);if(j==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(j))return w(D,H)}function w(D,H){(H==null||H>D.length)&&(H=D.length);for(var j=0,I=new Array(H);j<H;j++)I[j]=D[j];return I}function T(D,H){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(D)))return;var j=[],I=!0,b=!1,W=void 0;try{for(var Y=D[Symbol.iterator](),ie;!(I=(ie=Y.next()).done)&&!(j.push(ie.value),H&&j.length===H);I=!0);}catch(oe){b=!0,W=oe}finally{try{!I&&Y.return!=null&&Y.return()}finally{if(b)throw W}}return j}function R(D){if(Array.isArray(D))return D}function C(D,H){if(D==null)return{};var j=S(D,H),I,b;if(Object.getOwnPropertySymbols){var W=Object.getOwnPropertySymbols(D);for(b=0;b<W.length;b++){if(I=W[b],H.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(D,I))continue;j[I]=D[I]}}return j}function S(D,H){if(D==null)return{};var j={},I=Object.keys(D),b,W;for(W=0;W<I.length;W++){if(b=I[W],H.indexOf(b)>=0)continue;j[b]=D[b]}return j}var x=0;function _(D){return+D.replace("%","")}function d(D){return Array.isArray(D)?D:[D]}function u(D,H,j,I){var b=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,W=arguments.length>5?arguments[5]:void 0,Y=50-I/2,ie=0,oe=-Y,xe=0,ve=-2*Y;switch(W){case"left":ie=-Y,oe=0,xe=2*Y,ve=0;break;case"right":ie=Y,oe=0,xe=-2*Y,ve=0;break;case"bottom":oe=Y,ve=2*Y;break;default:}var we="M 50,50 m ".concat(ie,",").concat(oe,`
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(xe,",").concat(-ve,`
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(-xe,",").concat(ve),Ce=Math.PI*2*Y,Se={stroke:j,strokeDasharray:"".concat(H/100*(Ce-b),"px ").concat(Ce,"px"),strokeDashoffset:"-".concat(b/2+D/100*(Ce-b),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:we,pathStyle:Se}}var g=function(H){var j=H.prefixCls,I=H.strokeWidth,b=H.trailWidth,W=H.gapDegree,Y=H.gapPosition,ie=H.trailColor,oe=H.strokeLinecap,xe=H.style,ve=H.className,we=H.strokeColor,Ce=H.percent,Se=C(H,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),fe=Object(ue.useMemo)(function(){return x+=1,x},[]),le=u(0,100,ie,I,W,Y),te=le.pathString,de=le.pathStyle,se=d(Ce),Re=d(we),Le=Re.find(function(Fe){return Object.prototype.toString.call(Fe)==="[object Object]"}),Te=U(se),Ie=s(Te,1),Ue=Ie[0],We=function(){var Ne=0;return se.map(function(Me,$e){var et=Re[$e]||Re[Re.length-1],Qe=Object.prototype.toString.call(et)==="[object Object]"?"url(#".concat(j,"-gradient-").concat(fe,")"):"",Ze=u(Ne,Me,et,I,W,Y);return Ne+=Me,Z.a.createElement("path",{key:$e,className:"".concat(j,"-circle-path"),d:Ze.pathString,stroke:Qe,strokeLinecap:oe,strokeWidth:I,opacity:Me===0?0:1,fillOpacity:"0",style:Ze.pathStyle,ref:Ue[$e]})})};return Z.a.createElement("svg",r({className:$()("".concat(j,"-circle"),ve),viewBox:"0 0 100 100",style:xe},Se),Le&&Z.a.createElement("defs",null,Z.a.createElement("linearGradient",{id:"".concat(j,"-gradient-").concat(fe),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Le).sort(function(Fe,Ne){return _(Fe)-_(Ne)}).map(function(Fe,Ne){return Z.a.createElement("stop",{key:Ne,offset:Fe,stopColor:Le[Fe]})}))),Z.a.createElement("path",{className:"".concat(j,"-circle-trail"),d:te,stroke:ie,strokeLinecap:oe,strokeWidth:b||I,fillOpacity:"0",style:de}),We().reverse())};g.defaultProps=B;var E=g,N={Line:l,Circle:E}},kSUc:function(_t,Je,ne){},"kaH+":function(_t,Je,ne){"use strict";var ue=ne("+L6B"),Z=ne("2/Rp"),P=ne("tJVT"),$=ne("q1tI"),B=ne.n($),U=ne("UZu5"),K=ne.n(U),G=ne("dhSg"),M=ne("rLCj"),O=ne("dF/Y"),v=ne("4i/N");Je.a=function(){var m=Object($.useState)(""),p=Object(P.a)(m,2),h=p[0],o=p[1],f=Object($.useState)(0),l=Object(P.a)(f,2),r=l[0],s=l[1],c=Object($.useRef)("");Object($.useEffect)(function(){var x=G.a.subscribe("preview-image",function(_){o(_),document.body.style.overflow="hidden"});return x},[]),Object($.useEffect)(function(){return document.addEventListener("keydown",L),function(){document.removeEventListener("keydown",L)}},[]),Object($.useEffect)(function(){c.current=h},[h]);function L(x){x.keyCode==27&&c.current&&w()}function w(){document.body.style.overflow="auto",o("")}function T(){s(r+90)}var R=Object($.useRef)(),C=Object($.useRef)(),S=function(_){(_.nativeEvent.target===R.current||_.nativeEvent.target===C.current)&&w()};return B.a.createElement($.Fragment,null,h?B.a.createElement("div",{className:"image-preview-container",ref:R,onClick:S},B.a.createElement("div",{className:"button-group"},B.a.createElement(Z.a,{onClick:T},"\u65CB\u8F6C",B.a.createElement(M.a,null)),B.a.createElement(Z.a,{href:h},"\u4E0B\u8F7D",B.a.createElement(O.a,null)),B.a.createElement(Z.a,{onClick:w},"\u5173\u95ED",B.a.createElement(v.a,null))),B.a.createElement("div",{className:"preview-wrp-group",ref:C},B.a.createElement("img",{className:"image-preview",src:h,alt:"\u9884\u89C8\u5927\u56FE",style:{transform:"rotate(".concat(r,"deg)")}}))):null)}},lZu9:function(_t,Je,ne){(function(ue){ue(ne("VrN/"),ne("1eCo"),ne("8EBN"))})(function(ue){"use strict";ue.defineMode("markdown",function(Z,P){var $=ue.getMode(Z,"text/html"),B=$.name=="null";function U(I){if(ue.findModeByName){var b=ue.findModeByName(I);b&&(I=b.mime||b.mimes[0])}var W=ue.getMode(Z,I);return W.name=="null"?null:W}P.highlightFormatting===void 0&&(P.highlightFormatting=!1),P.maxBlockquoteDepth===void 0&&(P.maxBlockquoteDepth=0),P.taskLists===void 0&&(P.taskLists=!1),P.strikethrough===void 0&&(P.strikethrough=!1),P.emoji===void 0&&(P.emoji=!1),P.fencedCodeBlockHighlighting===void 0&&(P.fencedCodeBlockHighlighting=!0),P.fencedCodeBlockDefaultMode===void 0&&(P.fencedCodeBlockDefaultMode="text/plain"),P.xml===void 0&&(P.xml=!0),P.tokenTypeOverrides===void 0&&(P.tokenTypeOverrides={});var K={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 G in K)K.hasOwnProperty(G)&&P.tokenTypeOverrides[G]&&(K[G]=P.tokenTypeOverrides[G]);var M=/^([*\-_])(?:\s*\1){2,}\s*$/,O=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,v=/^\[(x| )\](?=\s)/i,m=P.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,p=/^ {0,3}(?:\={1,}|-{2,})\s*$/,h=/^[^#!\[\]*_\\<>` "'(~:]+/,o=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,f=/^\s*\[[^\]]+?\]:.*$/,l=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/,r=" ";function s(I,b,W){return b.f=b.inline=W,W(I,b)}function c(I,b,W){return b.f=b.block=W,W(I,b)}function L(I){return!I||!/\S/.test(I.string)}function w(I){if(I.linkTitle=!1,I.linkHref=!1,I.linkText=!1,I.em=!1,I.strong=!1,I.strikethrough=!1,I.quote=0,I.indentedCode=!1,I.f==R){var b=B;if(!b){var W=ue.innerMode($,I.htmlState);b=W.mode.name=="xml"&&W.state.tagStart===null&&!W.state.context&&W.state.tokenize.isInText}b&&(I.f=_,I.block=T,I.htmlState=null)}return I.trailingSpace=0,I.trailingSpaceNewLine=!1,I.prevLine=I.thisLine,I.thisLine={stream:null},null}function T(I,b){var W=I.column()===b.indentation,Y=L(b.prevLine.stream),ie=b.indentedCode,oe=b.prevLine.hr,xe=b.list!==!1,ve=(b.listStack[b.listStack.length-1]||0)+3;b.indentedCode=!1;var we=b.indentation;if(b.indentationDiff===null&&(b.indentationDiff=b.indentation,xe)){for(b.list=null;we<b.listStack[b.listStack.length-1];)b.listStack.pop(),b.listStack.length?b.indentation=b.listStack[b.listStack.length-1]:b.list=!1;b.list!==!1&&(b.indentationDiff=we-b.listStack[b.listStack.length-1])}var Ce=!Y&&!oe&&!b.prevLine.header&&(!xe||!ie)&&!b.prevLine.fencedCodeEnd,Se=(b.list===!1||oe||Y)&&b.indentation<=ve&&I.match(M),fe=null;if(b.indentationDiff>=4&&(ie||b.prevLine.fencedCodeEnd||b.prevLine.header||Y))return I.skipToEnd(),b.indentedCode=!0,K.code;if(I.eatSpace())return null;if(W&&b.indentation<=ve&&(fe=I.match(m))&&fe[1].length<=6)return b.quote=0,b.header=fe[1].length,b.thisLine.header=!0,P.highlightFormatting&&(b.formatting="header"),b.f=b.inline,S(b);if(b.indentation<=ve&&I.eat(">"))return b.quote=W?1:b.quote+1,P.highlightFormatting&&(b.formatting="quote"),I.eatSpace(),S(b);if(!Se&&!b.setext&&W&&b.indentation<=ve&&(fe=I.match(O))){var le=fe[1]?"ol":"ul";return b.indentation=we+I.current().length,b.list=!0,b.quote=0,b.listStack.push(b.indentation),b.em=!1,b.strong=!1,b.code=!1,b.strikethrough=!1,P.taskLists&&I.match(v,!1)&&(b.taskList=!0),b.f=b.inline,P.highlightFormatting&&(b.formatting=["list","list-"+le]),S(b)}else{if(W&&b.indentation<=ve&&(fe=I.match(o,!0)))return b.quote=0,b.fencedEndRE=new RegExp(fe[1]+"+ *$"),b.localMode=P.fencedCodeBlockHighlighting&&U(fe[2]||P.fencedCodeBlockDefaultMode),b.localMode&&(b.localState=ue.startState(b.localMode)),b.f=b.block=C,P.highlightFormatting&&(b.formatting="code-block"),b.code=-1,S(b);if(b.setext||(!Ce||!xe)&&!b.quote&&b.list===!1&&!b.code&&!Se&&!f.test(I.string)&&(fe=I.lookAhead(1))&&(fe=fe.match(p)))return b.setext?(b.header=b.setext,b.setext=0,I.skipToEnd(),P.highlightFormatting&&(b.formatting="header")):(b.header=fe[0].charAt(0)=="="?1:2,b.setext=b.header),b.thisLine.header=!0,b.f=b.inline,S(b);if(Se)return I.skipToEnd(),b.hr=!0,b.thisLine.hr=!0,K.hr;if(I.peek()==="[")return s(I,b,N)}return s(I,b,b.inline)}function R(I,b){var W=$.token(I,b.htmlState);if(!B){var Y=ue.innerMode($,b.htmlState);(Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText||b.md_inside&&I.current().indexOf(">")>-1)&&(b.f=_,b.block=T,b.htmlState=null)}return W}function C(I,b){var W=b.listStack[b.listStack.length-1]||0,Y=b.indentation<W,ie=W+3;if(b.fencedEndRE&&b.indentation<=ie&&(Y||I.match(b.fencedEndRE))){P.highlightFormatting&&(b.formatting="code-block");var oe;return Y||(oe=S(b)),b.localMode=b.localState=null,b.block=T,b.f=_,b.fencedEndRE=null,b.code=0,b.thisLine.fencedCodeEnd=!0,Y?c(I,b,b.block):oe}else return b.localMode?b.localMode.token(I,b.localState):(I.skipToEnd(),K.code)}function S(I){var b=[];if(I.formatting){b.push(K.formatting),typeof I.formatting=="string"&&(I.formatting=[I.formatting]);for(var W=0;W<I.formatting.length;W++)b.push(K.formatting+"-"+I.formatting[W]),I.formatting[W]==="header"&&b.push(K.formatting+"-"+I.formatting[W]+"-"+I.header),I.formatting[W]==="quote"&&(!P.maxBlockquoteDepth||P.maxBlockquoteDepth>=I.quote?b.push(K.formatting+"-"+I.formatting[W]+"-"+I.quote):b.push("error"))}if(I.taskOpen)return b.push("meta"),b.length?b.join(" "):null;if(I.taskClosed)return b.push("property"),b.length?b.join(" "):null;if(I.linkHref?b.push(K.linkHref,"url"):(I.strong&&b.push(K.strong),I.em&&b.push(K.em),I.strikethrough&&b.push(K.strikethrough),I.emoji&&b.push(K.emoji),I.linkText&&b.push(K.linkText),I.code&&b.push(K.code),I.image&&b.push(K.image),I.imageAltText&&b.push(K.imageAltText,"link"),I.imageMarker&&b.push(K.imageMarker)),I.header&&b.push(K.header,K.header+"-"+I.header),I.quote&&(b.push(K.quote),!P.maxBlockquoteDepth||P.maxBlockquoteDepth>=I.quote?b.push(K.quote+"-"+I.quote):b.push(K.quote+"-"+P.maxBlockquoteDepth)),I.list!==!1){var Y=(I.listStack.length-1)%3;Y?Y===1?b.push(K.list2):b.push(K.list3):b.push(K.list1)}return I.trailingSpaceNewLine?b.push("trailing-space-new-line"):I.trailingSpace&&b.push("trailing-space-"+(I.trailingSpace%2?"a":"b")),b.length?b.join(" "):null}function x(I,b){return I.match(h,!0)?S(b):void 0}function _(I,b){var W=b.text(I,b);if(typeof W!="undefined")return W;if(b.list)return b.list=null,S(b);if(b.taskList){var Y=I.match(v,!0)[1]===" ";return Y?b.taskOpen=!0:b.taskClosed=!0,P.highlightFormatting&&(b.formatting="task"),b.taskList=!1,S(b)}if(b.taskOpen=!1,b.taskClosed=!1,b.header&&I.match(/^#+$/,!0))return P.highlightFormatting&&(b.formatting="header"),S(b);var ie=I.next();if(b.linkTitle){b.linkTitle=!1;var oe=ie;ie==="("&&(oe=")"),oe=(oe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var xe="^\\s*(?:[^"+oe+"\\\\]+|\\\\\\\\|\\\\.)"+oe;if(I.match(new RegExp(xe),!0))return K.linkHref}if(ie==="`"){var ve=b.formatting;P.highlightFormatting&&(b.formatting="code"),I.eatWhile("`");var we=I.current().length;if(b.code==0&&(!b.quote||we==1))return b.code=we,S(b);if(we==b.code){var Ce=S(b);return b.code=0,Ce}else return b.formatting=ve,S(b)}else if(b.code)return S(b);if(ie==="\\"&&(I.next(),P.highlightFormatting)){var Se=S(b),fe=K.formatting+"-escape";return Se?Se+" "+fe:fe}if(ie==="!"&&I.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return b.imageMarker=!0,b.image=!0,P.highlightFormatting&&(b.formatting="image"),S(b);if(ie==="["&&b.imageMarker&&I.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return b.imageMarker=!1,b.imageAltText=!0,P.highlightFormatting&&(b.formatting="image"),S(b);if(ie==="]"&&b.imageAltText){P.highlightFormatting&&(b.formatting="image");var Se=S(b);return b.imageAltText=!1,b.image=!1,b.inline=b.f=u,Se}if(ie==="["&&!b.image)return b.linkText&&I.match(/^.*?\]/)||(b.linkText=!0,P.highlightFormatting&&(b.formatting="link")),S(b);if(ie==="]"&&b.linkText){P.highlightFormatting&&(b.formatting="link");var Se=S(b);return b.linkText=!1,b.inline=b.f=I.match(/\(.*?\)| ?\[.*?\]/,!1)?u:_,Se}if(ie==="<"&&I.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){b.f=b.inline=d,P.highlightFormatting&&(b.formatting="link");var Se=S(b);return Se?Se+=" ":Se="",Se+K.linkInline}if(ie==="<"&&I.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){b.f=b.inline=d,P.highlightFormatting&&(b.formatting="link");var Se=S(b);return Se?Se+=" ":Se="",Se+K.linkEmail}if(P.xml&&ie==="<"&&I.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var le=I.string.indexOf(">",I.pos);if(le!=-1){var te=I.string.substring(I.start,le);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(te)&&(b.md_inside=!0)}return I.backUp(1),b.htmlState=ue.startState($),c(I,b,R)}if(P.xml&&ie==="<"&&I.match(/^\/\w*?>/))return b.md_inside=!1,"tag";if(ie==="*"||ie==="_"){for(var de=1,se=I.pos==1?" ":I.string.charAt(I.pos-2);de<3&&I.eat(ie);)de++;var Re=I.peek()||" ",Le=!/\s/.test(Re)&&(!l.test(Re)||/\s/.test(se)||l.test(se)),Te=!/\s/.test(se)&&(!l.test(se)||/\s/.test(Re)||l.test(Re)),Ie=null,Ue=null;if(de%2&&(!b.em&&Le&&(ie==="*"||!Te||l.test(se))?Ie=!0:b.em==ie&&Te&&(ie==="*"||!Le||l.test(Re))&&(Ie=!1)),de>1&&(!b.strong&&Le&&(ie==="*"||!Te||l.test(se))?Ue=!0:b.strong==ie&&Te&&(ie==="*"||!Le||l.test(Re))&&(Ue=!1)),Ue!=null||Ie!=null){P.highlightFormatting&&(b.formatting=Ie==null?"strong":Ue==null?"em":"strong em"),Ie===!0&&(b.em=ie),Ue===!0&&(b.strong=ie);var Ce=S(b);return Ie===!1&&(b.em=!1),Ue===!1&&(b.strong=!1),Ce}}else if(ie===" "&&(I.eat("*")||I.eat("_"))){if(I.peek()===" ")return S(b);I.backUp(1)}if(P.strikethrough){if(ie==="~"&&I.eatWhile(ie)){if(b.strikethrough){P.highlightFormatting&&(b.formatting="strikethrough");var Ce=S(b);return b.strikethrough=!1,Ce}else if(I.match(/^[^\s]/,!1))return b.strikethrough=!0,P.highlightFormatting&&(b.formatting="strikethrough"),S(b)}else if(ie===" "&&I.match(/^~~/,!0)){if(I.peek()===" ")return S(b);I.backUp(2)}}if(P.emoji&&ie===":"&&I.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){b.emoji=!0,P.highlightFormatting&&(b.formatting="emoji");var We=S(b);return b.emoji=!1,We}return ie===" "&&(I.match(/^ +$/,!1)?b.trailingSpace++:b.trailingSpace&&(b.trailingSpaceNewLine=!0)),S(b)}function d(I,b){var W=I.next();if(W===">"){b.f=b.inline=_,P.highlightFormatting&&(b.formatting="link");var Y=S(b);return Y?Y+=" ":Y="",Y+K.linkInline}return I.match(/^[^>]+/,!0),K.linkInline}function u(I,b){if(I.eatSpace())return null;var W=I.next();return W==="("||W==="["?(b.f=b.inline=E(W==="("?")":"]"),P.highlightFormatting&&(b.formatting="link-string"),b.linkHref=!0,S(b)):"error"}var g={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function E(I){return function(b,W){var Y=b.next();if(Y===I){W.f=W.inline=_,P.highlightFormatting&&(W.formatting="link-string");var ie=S(W);return W.linkHref=!1,ie}return b.match(g[I]),W.linkHref=!0,S(W)}}function N(I,b){return I.match(/^([^\]\\]|\\.)*\]:/,!1)?(b.f=D,I.next(),P.highlightFormatting&&(b.formatting="link"),b.linkText=!0,S(b)):s(I,b,_)}function D(I,b){if(I.match(/^\]:/,!0)){b.f=b.inline=H,P.highlightFormatting&&(b.formatting="link");var W=S(b);return b.linkText=!1,W}return I.match(/^([^\]\\]|\\.)+/,!0),K.linkText}function H(I,b){return I.eatSpace()?null:(I.match(/^[^\s]+/,!0),I.peek()===void 0?b.linkTitle=!0:I.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),b.f=b.inline=_,K.linkHref+" url")}var j={startState:function(){return{f:T,prevLine:{stream:null},thisLine:{stream:null},block:T,htmlState:null,indentation:0,inline:_,text:x,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(I){return{f:I.f,prevLine:I.prevLine,thisLine:I.thisLine,block:I.block,htmlState:I.htmlState&&ue.copyState($,I.htmlState),indentation:I.indentation,localMode:I.localMode,localState:I.localMode?ue.copyState(I.localMode,I.localState):null,inline:I.inline,text:I.text,formatting:!1,linkText:I.linkText,linkTitle:I.linkTitle,linkHref:I.linkHref,code:I.code,em:I.em,strong:I.strong,strikethrough:I.strikethrough,emoji:I.emoji,header:I.header,setext:I.setext,hr:I.hr,taskList:I.taskList,list:I.list,listStack:I.listStack.slice(0),quote:I.quote,indentedCode:I.indentedCode,trailingSpace:I.trailingSpace,trailingSpaceNewLine:I.trailingSpaceNewLine,md_inside:I.md_inside,fencedEndRE:I.fencedEndRE}},token:function(I,b){if(b.formatting=!1,I!=b.thisLine.stream){if(b.header=0,b.hr=!1,I.match(/^\s*$/,!0))return w(b),null;if(b.prevLine=b.thisLine,b.thisLine={stream:I},b.taskList=!1,b.trailingSpace=0,b.trailingSpaceNewLine=!1,!b.localState&&(b.f=b.block,b.f!=R)){var W=I.match(/^\s*/,!0)[0].replace(/\t/g,r).length;if(b.indentation=W,b.indentationDiff=null,W>0)return null}}return b.f(I,b)},innerMode:function(I){return I.block==R?{state:I.htmlState,mode:$}:I.localState?{state:I.localState,mode:I.localMode}:{state:I,mode:j}},indent:function(I,b,W){return I.block==R&&$.indent?$.indent(I.htmlState,b,W):I.localState&&I.localMode.indent?I.localMode.indent(I.localState,b,W):ue.Pass},blankLine:w,getType:S,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return j},"xml"),ue.defineMIME("text/markdown","markdown"),ue.defineMIME("text/x-markdown","markdown")})},osHv:function(_t,Je,ne){(function(ue){ue(ne("VrN/"))})(function(ue){"use strict";var Z=ue.Pos;function P(l,r){return l.line-r.line||l.ch-r.ch}var $="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",B=$+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",U=new RegExp("<(/?)(["+$+"]["+B+"]*)","g");function K(l,r,s,c){this.line=r,this.ch=s,this.cm=l,this.text=l.getLine(r),this.min=c?Math.max(c.from,l.firstLine()):l.firstLine(),this.max=c?Math.min(c.to-1,l.lastLine()):l.lastLine()}function G(l,r){var s=l.cm.getTokenTypeAt(Z(l.line,r));return s&&/\btag\b/.test(s)}function M(l){return l.line>=l.max?void 0:(l.ch=0,l.text=l.cm.getLine(++l.line),!0)}function O(l){return l.line<=l.min?void 0:(l.text=l.cm.getLine(--l.line),l.ch=l.text.length,!0)}function v(l){for(;;){var r=l.text.indexOf(">",l.ch);if(r==-1){if(M(l))continue;return}if(!G(l,r+1)){l.ch=r+1;continue}var s=l.text.lastIndexOf("/",r),c=s>-1&&!/\S/.test(l.text.slice(s+1,r));return l.ch=r+1,c?"selfClose":"regular"}}function m(l){for(;;){var r=l.ch?l.text.lastIndexOf("<",l.ch-1):-1;if(r==-1){if(O(l))continue;return}if(!G(l,r+1)){l.ch=r;continue}U.lastIndex=r,l.ch=r;var s=U.exec(l.text);if(s&&s.index==r)return s}}function p(l){for(;;){U.lastIndex=l.ch;var r=U.exec(l.text);if(!r){if(M(l))continue;return}if(!G(l,r.index+1)){l.ch=r.index+1;continue}return l.ch=r.index+r[0].length,r}}function h(l){for(;;){var r=l.ch?l.text.lastIndexOf(">",l.ch-1):-1;if(r==-1){if(O(l))continue;return}if(!G(l,r+1)){l.ch=r;continue}var s=l.text.lastIndexOf("/",r),c=s>-1&&!/\S/.test(l.text.slice(s+1,r));return l.ch=r+1,c?"selfClose":"regular"}}function o(l,r){for(var s=[];;){var c=p(l),L,w=l.line,T=l.ch-(c?c[0].length:0);if(!c||!(L=v(l)))return;if(L=="selfClose")continue;if(c[1]){for(var R=s.length-1;R>=0;--R)if(s[R]==c[2]){s.length=R;break}if(R<0&&(!r||r==c[2]))return{tag:c[2],from:Z(w,T),to:Z(l.line,l.ch)}}else s.push(c[2])}}function f(l,r){for(var s=[];;){var c=h(l);if(!c)return;if(c=="selfClose"){m(l);continue}var L=l.line,w=l.ch,T=m(l);if(!T)return;if(T[1])s.push(T[2]);else{for(var R=s.length-1;R>=0;--R)if(s[R]==T[2]){s.length=R;break}if(R<0&&(!r||r==T[2]))return{tag:T[2],from:Z(l.line,l.ch),to:Z(L,w)}}}}ue.registerHelper("fold","xml",function(l,r){for(var s=new K(l,r.line,0);;){var c=p(s);if(!c||s.line!=r.line)return;var L=v(s);if(!L)return;if(!c[1]&&L!="selfClose"){var w=Z(s.line,s.ch),T=o(s,c[2]);return T&&P(T.from,w)>0?{from:w,to:T.from}:null}}}),ue.findMatchingTag=function(l,r,s){var c=new K(l,r.line,r.ch,s);if(c.text.indexOf(">")==-1&&c.text.indexOf("<")==-1)return;var L=v(c),w=L&&Z(c.line,c.ch),T=L&&m(c);if(!L||!T||P(c,r)>0)return;var R={from:Z(c.line,c.ch),to:w,tag:T[2]};return L=="selfClose"?{open:R,close:null,at:"open"}:T[1]?{open:f(c,T[2]),close:R,at:"close"}:(c=new K(l,w.line,w.ch,s),{open:R,close:o(c,T[2]),at:"open"})},ue.findEnclosingTag=function(l,r,s,c){for(var L=new K(l,r.line,r.ch,s);;){var w=f(L,c);if(!w)break;var T=new K(l,r.line,r.ch,s),R=o(T,w.tag);if(R)return{open:w,close:R}}},ue.scanForClosingTag=function(l,r,s,c){var L=new K(l,r.line,r.ch,c?{from:0,to:c}:null);return o(L,s)}})},p5ED:function(_t,Je,ne){"use strict";var ue=ne("+L6B"),Z=ne("2/Rp"),P=ne("5Dmo"),$=ne("3S7+"),B=ne("k1fw"),U=ne("tJVT"),K=ne("q1tI"),G=ne.n(K),M=ne("vHTk"),O=ne.n(M),v=ne("yEEn"),m=ne("ZW9T"),p=ne("1vsH");Je.a=function(h){var o=h.name,f=h.data,l=h.theme,r=h.type,s=h.filename,c=h.monacoEditor,L=h.className,w=h.style,T=h.close,R=h.onClose,C=h.hasMask,S=Object(K.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),x=Object(U.a)(S,2),_=x[0],d=x[1],u=Object(K.useState)(""),g=Object(U.a)(u,2),E=g[0],N=g[1],D,H=1024*1024,j=10*H,I=Object(K.useRef)();r==="office"&&(D=Object(p.T)(f).filesize,D>j&&(r="other")),s&&(c.filename=s),Object(K.useEffect)(function(){var Y,ie,oe=(Y=document.cookie)===null||Y===void 0||((ie=Y.replace(/\s/g,""))===null||ie===void 0)?void 0:ie.split(";");oe==null||oe.map(function(xe){var ve=xe.split("=");ve[0]==="_educoder_session"&&N(ve[1])})},[]);var b=function(){if(f.startsWith("http")||f.startsWith("/")){W();return}Object(p.z)(s||"educoder",f,s)},W=function(){Object(p.x)(s||o,f)};return console.log("data:",f,"fileanme:",s," name:",o),G.a.createElement("div",{style:Object(B.a)({},w||{}),className:"".concat(C&&O.a.bgBlack," ").concat(r?O.a.wrp:"hide")},T&&G.a.createElement("div",{className:O.a.close,ref:I},G.a.createElement($.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return I.current}},G.a.createElement("span",{onClick:W},G.a.createElement("i",{className:"icon-quxiaozhiding"}))),G.a.createElement($.a,{title:"\u5173\u95ED",getPopupContainer:function(){return I.current}},G.a.createElement("span",{className:"",onClick:R},G.a.createElement("i",{className:"icon-guanbi1"})))),G.a.createElement("div",{className:"".concat(O.a[L]," ").concat(L," ").concat(O.a.monaco," ").concat(r==="txt"?"show":"hide")},r==="txt"&&G.a.createElement(m.b,c)),r==="audio"&&G.a.createElement("audio",{src:"".concat(f!=null&&f.startsWith("/")||(f==null?void 0:f.indexOf("https://"))>-1?f:"data:audio/mp3;base64,").concat(f),autoPlay:!0}),r==="video"&&G.a.createElement(G.a.Fragment,null,f!=null&&f.startsWith("/")?G.a.createElement("video",{controls:!0,src:"".concat(f),autoPlay:!0}):G.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(f),autoPlay:!0})),r==="html"&&G.a.createElement("iframe",{src:f+"&disposition=inline"}),r==="pdf"&&G.a.createElement("embed",{className:O.a.embed,src:f}),r==="image"&&G.a.createElement(G.a.Fragment,null,G.a.createElement("img",{src:"".concat(f!=null&&f.startsWith("/")||(f==null?void 0:f.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(f)})),r==="other"&&G.a.createElement("div",null,G.a.createElement(Z.a,{type:"primary",size:"large",onClick:b},G.a.createElement(v.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(r==="download"||r==="office")&&G.a.createElement(Z.a,{type:"primary",size:"large",onClick:b},G.a.createElement(v.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(_t,Je,ne){},psGv:function(_t,Je,ne){var ue,Z;(function(){var P;(function(){"use strict";var K=[,,function(v){function m(o){this.__parent=o,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}m.prototype.clone_empty=function(){var o=new m(this.__parent);return o.set_indent(this.__indent_count,this.__alignment_count),o},m.prototype.item=function(o){return o<0?this.__items[this.__items.length+o]:this.__items[o]},m.prototype.has_match=function(o){for(var f=this.__items.length-1;f>=0;f--)if(this.__items[f].match(o))return!0;return!1},m.prototype.set_indent=function(o,f){this.is_empty()&&(this.__indent_count=o||0,this.__alignment_count=f||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},m.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},m.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},m.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var o=this.__parent.current_line;return o.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),o.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),o.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,o.__items[0]===" "&&(o.__items.splice(0,1),o.__character_count-=1),!0}return!1},m.prototype.is_empty=function(){return this.__items.length===0},m.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},m.prototype.push=function(o){this.__items.push(o);var f=o.lastIndexOf(`
`);f!==-1?this.__character_count=o.length-f:this.__character_count+=o.length},m.prototype.pop=function(){var o=null;return this.is_empty()||(o=this.__items.pop(),this.__character_count-=o.length),o},m.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},m.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},m.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},m.prototype.toString=function(){var o="";return this.is_empty()?this.__parent.indent_empty_lines&&(o=this.__parent.get_indent_string(this.__indent_count)):(o=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),o+=this.__items.join("")),o};function p(o,f){this.__cache=[""],this.__indent_size=o.indent_size,this.__indent_string=o.indent_char,o.indent_with_tabs||(this.__indent_string=new Array(o.indent_size+1).join(o.indent_char)),f=f||"",o.indent_level>0&&(f=new Array(o.indent_level+1).join(this.__indent_string)),this.__base_string=f,this.__base_string_length=f.length}p.prototype.get_indent_size=function(o,f){var l=this.__base_string_length;return f=f||0,o<0&&(l=0),l+=o*this.__indent_size,l+=f,l},p.prototype.get_indent_string=function(o,f){var l=this.__base_string;return f=f||0,o<0&&(o=0,l=""),f+=o*this.__indent_size,this.__ensure_cache(f),l+=this.__cache[f],l},p.prototype.__ensure_cache=function(o){for(;o>=this.__cache.length;)this.__add_column()},p.prototype.__add_column=function(){var o=this.__cache.length,f=0,l="";this.__indent_size&&o>=this.__indent_size&&(f=Math.floor(o/this.__indent_size),o-=f*this.__indent_size,l=new Array(f+1).join(this.__indent_string)),o&&(l+=new Array(o+1).join(" ")),this.__cache.push(l)};function h(o,f){this.__indent_cache=new p(o,f),this.raw=!1,this._end_with_newline=o.end_with_newline,this.indent_size=o.indent_size,this.wrap_line_length=o.wrap_line_length,this.indent_empty_lines=o.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new m(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}h.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},h.prototype.get_line_number=function(){return this.__lines.length},h.prototype.get_indent_string=function(o,f){return this.__indent_cache.get_indent_string(o,f)},h.prototype.get_indent_size=function(o,f){return this.__indent_cache.get_indent_size(o,f)},h.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},h.prototype.add_new_line=function(o){return this.is_empty()||!o&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},h.prototype.get_code=function(o){this.trim(!0);var f=this.current_line.pop();f&&(f[f.length-1]===`
`&&(f=f.replace(/\n+$/g,"")),this.current_line.push(f)),this._end_with_newline&&this.__add_outputline();var l=this.__lines.join(`
`);return o!==`
`&&(l=l.replace(/[\n]/g,o)),l},h.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},h.prototype.set_indent=function(o,f){return o=o||0,f=f||0,this.next_line.set_indent(o,f),this.__lines.length>1?(this.current_line.set_indent(o,f),!0):(this.current_line.set_indent(),!1)},h.prototype.add_raw_token=function(o){for(var f=0;f<o.newlines;f++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(o.whitespace_before),this.current_line.push(o.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},h.prototype.add_token=function(o){this.__add_space_before_token(),this.current_line.push(o),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},h.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},h.prototype.remove_indent=function(o){for(var f=this.__lines.length;o<f;)this.__lines[o]._remove_indent(),o++;this.current_line._remove_wrap_indent()},h.prototype.trim=function(o){for(o=o===void 0?!1:o,this.current_line.trim();o&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},h.prototype.just_added_newline=function(){return this.current_line.is_empty()},h.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},h.prototype.ensure_empty_line_above=function(o,f){for(var l=this.__lines.length-2;l>=0;){var r=this.__lines[l];if(r.is_empty())break;if(r.item(0).indexOf(o)!==0&&r.item(-1)!==f){this.__lines.splice(l+1,0,new m(this)),this.previous_line=this.__lines[this.__lines.length-2];break}l--}},v.exports.Output=h},function(v){function m(p,h,o,f){this.type=p,this.text=h,this.comments_before=null,this.newlines=o||0,this.whitespace_before=f||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}v.exports.Token=m},,,function(v){function m(o,f){this.raw_options=p(o,f),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}m.prototype._get_array=function(o,f){var l=this.raw_options[o],r=f||[];return typeof l=="object"?l!==null&&typeof l.concat=="function"&&(r=l.concat()):typeof l=="string"&&(r=l.split(/[^a-zA-Z0-9_\/\-]+/)),r},m.prototype._get_boolean=function(o,f){var l=this.raw_options[o],r=l===void 0?!!f:!!l;return r},m.prototype._get_characters=function(o,f){var l=this.raw_options[o],r=f||"";return typeof l=="string"&&(r=l.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),r},m.prototype._get_number=function(o,f){var l=this.raw_options[o];f=parseInt(f,10),isNaN(f)&&(f=0);var r=parseInt(l,10);return isNaN(r)&&(r=f),r},m.prototype._get_selection=function(o,f,l){var r=this._get_selection_list(o,f,l);if(r.length!==1)throw new Error("Invalid Option Value: The option '"+o+`' can only be one of the following values:
`+f+`
You passed in: '`+this.raw_options[o]+"'");return r[0]},m.prototype._get_selection_list=function(o,f,l){if(!f||f.length===0)throw new Error("Selection list cannot be empty.");if(l=l||[f[0]],!this._is_valid_selection(l,f))throw new Error("Invalid Default Value!");var r=this._get_array(o,l);if(!this._is_valid_selection(r,f))throw new Error("Invalid Option Value: The option '"+o+`' can contain only the following values:
`+f+`
You passed in: '`+this.raw_options[o]+"'");return r},m.prototype._is_valid_selection=function(o,f){return o.length&&f.length&&!o.some(function(l){return f.indexOf(l)===-1})};function p(o,f){var l={};o=h(o);var r;for(r in o)r!==f&&(l[r]=o[r]);if(f&&o[f])for(r in o[f])l[r]=o[f][r];return l}function h(o){var f={},l;for(l in o){var r=l.replace(/-/g,"_");f[r]=o[l]}return f}v.exports.Options=m,v.exports.normalizeOpts=h,v.exports.mergeOpts=p},,function(v){var m=RegExp.prototype.hasOwnProperty("sticky");function p(h){this.__input=h||"",this.__input_length=this.__input.length,this.__position=0}p.prototype.restart=function(){this.__position=0},p.prototype.back=function(){this.__position>0&&(this.__position-=1)},p.prototype.hasNext=function(){return this.__position<this.__input_length},p.prototype.next=function(){var h=null;return this.hasNext()&&(h=this.__input.charAt(this.__position),this.__position+=1),h},p.prototype.peek=function(h){var o=null;return h=h||0,h+=this.__position,h>=0&&h<this.__input_length&&(o=this.__input.charAt(h)),o},p.prototype.__match=function(h,o){h.lastIndex=o;var f=h.exec(this.__input);return f&&!(m&&h.sticky)&&(f.index!==o&&(f=null)),f},p.prototype.test=function(h,o){return o=o||0,o+=this.__position,o>=0&&o<this.__input_length?!!this.__match(h,o):!1},p.prototype.testChar=function(h,o){var f=this.peek(o);return h.lastIndex=0,f!==null&&h.test(f)},p.prototype.match=function(h){var o=this.__match(h,this.__position);return o?this.__position+=o[0].length:o=null,o},p.prototype.read=function(h,o,f){var l="",r;return h&&(r=this.match(h),r&&(l+=r[0])),o&&(r||!h)&&(l+=this.readUntil(o,f)),l},p.prototype.readUntil=function(h,o){var f="",l=this.__position;h.lastIndex=this.__position;var r=h.exec(this.__input);return r?(l=r.index,o&&(l+=r[0].length)):l=this.__input_length,f=this.__input.substring(this.__position,l),this.__position=l,f},p.prototype.readUntilAfter=function(h){return this.readUntil(h,!0)},p.prototype.get_regexp=function(h,o){var f=null,l="g";return o&&m&&(l="y"),typeof h=="string"&&h!==""?f=new RegExp(h,l):h&&(f=new RegExp(h.source,l)),f},p.prototype.get_literal_regexp=function(h){return RegExp(h.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},p.prototype.peekUntilAfter=function(h){var o=this.__position,f=this.readUntilAfter(h);return this.__position=o,f},p.prototype.lookBack=function(h){var o=this.__position-1;return o>=h.length&&this.__input.substring(o-h.length,o).toLowerCase()===h},v.exports.InputScanner=p},function(v,m,p){var h=p(8).InputScanner,o=p(3).Token,f=p(10).TokenStream,l=p(11).WhitespacePattern,r={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},s=function(c,L){this._input=new h(c),this._options=L||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new l(this._input)};s.prototype.tokenize=function(){this._input.restart(),this.__tokens=new f,this._reset();for(var c,L=new o(r.START,""),w=null,T=[],R=new f;L.type!==r.EOF;){for(c=this._get_next_token(L,w);this._is_comment(c);)R.add(c),c=this._get_next_token(L,w);R.isEmpty()||(c.comments_before=R,R=new f),c.parent=w,this._is_opening(c)?(T.push(w),w=c):w&&this._is_closing(c,w)&&(c.opened=w,w.closed=c,w=T.pop(),c.parent=w),c.previous=L,L.next=c,this.__tokens.add(c),L=c}return this.__tokens},s.prototype._is_first_token=function(){return this.__tokens.isEmpty()},s.prototype._reset=function(){},s.prototype._get_next_token=function(c,L){this._readWhitespace();var w=this._input.read(/.+/g);return w?this._create_token(r.RAW,w):this._create_token(r.EOF,"")},s.prototype._is_comment=function(c){return!1},s.prototype._is_opening=function(c){return!1},s.prototype._is_closing=function(c,L){return!1},s.prototype._create_token=function(c,L){var w=new o(c,L,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return w},s.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},v.exports.Tokenizer=s,v.exports.TOKEN=r},function(v){function m(p){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=p}m.prototype.restart=function(){this.__position=0},m.prototype.isEmpty=function(){return this.__tokens_length===0},m.prototype.hasNext=function(){return this.__position<this.__tokens_length},m.prototype.next=function(){var p=null;return this.hasNext()&&(p=this.__tokens[this.__position],this.__position+=1),p},m.prototype.peek=function(p){var h=null;return p=p||0,p+=this.__position,p>=0&&p<this.__tokens_length&&(h=this.__tokens[p]),h},m.prototype.add=function(p){this.__parent_token&&(p.parent=this.__parent_token),this.__tokens.push(p),this.__tokens_length+=1},v.exports.TokenStream=m},function(v,m,p){var h=p(12).Pattern;function o(f,l){h.call(this,f,l),l?this._line_regexp=this._input.get_regexp(l._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}o.prototype=new h,o.prototype.__set_whitespace_patterns=function(f,l){f+="\\t ",l+="\\n\\r",this._match_pattern=this._input.get_regexp("["+f+l+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+l+"]")},o.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var f=this._input.read(this._match_pattern);if(f===" ")this.whitespace_before_token=" ";else if(f){var l=this.__split(this._newline_regexp,f);this.newline_count=l.length-1,this.whitespace_before_token=l[this.newline_count]}return f},o.prototype.matching=function(f,l){var r=this._create();return r.__set_whitespace_patterns(f,l),r._update(),r},o.prototype._create=function(){return new o(this._input,this)},o.prototype.__split=function(f,l){f.lastIndex=0;for(var r=0,s=[],c=f.exec(l);c;)s.push(l.substring(r,c.index)),r=c.index+c[0].length,c=f.exec(l);return r<l.length?s.push(l.substring(r,l.length)):s.push(""),s},v.exports.WhitespacePattern=o},function(v){function m(p,h){this._input=p,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,h&&(this._starting_pattern=this._input.get_regexp(h._starting_pattern,!0),this._match_pattern=this._input.get_regexp(h._match_pattern,!0),this._until_pattern=this._input.get_regexp(h._until_pattern),this._until_after=h._until_after)}m.prototype.read=function(){var p=this._input.read(this._starting_pattern);return(!this._starting_pattern||p)&&(p+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),p},m.prototype.read_match=function(){return this._input.match(this._match_pattern)},m.prototype.until_after=function(p){var h=this._create();return h._until_after=!0,h._until_pattern=this._input.get_regexp(p),h._update(),h},m.prototype.until=function(p){var h=this._create();return h._until_after=!1,h._until_pattern=this._input.get_regexp(p),h._update(),h},m.prototype.starting_with=function(p){var h=this._create();return h._starting_pattern=this._input.get_regexp(p,!0),h._update(),h},m.prototype.matching=function(p){var h=this._create();return h._match_pattern=this._input.get_regexp(p,!0),h._update(),h},m.prototype._create=function(){return new m(this._input,this)},m.prototype._update=function(){},v.exports.Pattern=m},function(v){function m(p,h){p=typeof p=="string"?p:p.source,h=typeof h=="string"?h:h.source,this.__directives_block_pattern=new RegExp(p+/ beautify( \w+[:]\w+)+ /.source+h,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(p+/\sbeautify\signore:end\s/.source+h,"g")}m.prototype.get_directives=function(p){if(!p.match(this.__directives_block_pattern))return null;var h={};this.__directive_pattern.lastIndex=0;for(var o=this.__directive_pattern.exec(p);o;)h[o[1]]=o[2],o=this.__directive_pattern.exec(p);return h},m.prototype.readIgnored=function(p){return p.readUntilAfter(this.__directives_end_ignore_pattern)},v.exports.Directives=m},function(v,m,p){var h=p(12).Pattern,o={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function f(l,r){h.call(this,l,r),this.__template_pattern=null,this._disabled=Object.assign({},o),this._excluded=Object.assign({},o),r&&(this.__template_pattern=this._input.get_regexp(r.__template_pattern),this._excluded=Object.assign(this._excluded,r._excluded),this._disabled=Object.assign(this._disabled,r._disabled));var s=new h(l);this.__patterns={handlebars_comment:s.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:s.starting_with(/{{{/).until_after(/}}}/),handlebars:s.starting_with(/{{/).until_after(/}}/),php:s.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:s.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:s.starting_with(/{%/).until_after(/%}/),django_value:s.starting_with(/{{/).until_after(/}}/),django_comment:s.starting_with(/{#/).until_after(/#}/),smarty:s.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:s.starting_with(/{\*/).until_after(/\*}/),smarty_literal:s.starting_with(/{literal}/).until_after(/{\/literal}/)}}f.prototype=new h,f.prototype._create=function(){return new f(this._input,this)},f.prototype._update=function(){this.__set_templated_pattern()},f.prototype.disable=function(l){var r=this._create();return r._disabled[l]=!0,r._update(),r},f.prototype.read_options=function(l){var r=this._create();for(var s in o)r._disabled[s]=l.templating.indexOf(s)===-1;return r._update(),r},f.prototype.exclude=function(l){var r=this._create();return r._excluded[l]=!0,r._update(),r},f.prototype.read=function(){var l="";this._match_pattern?l=this._input.read(this._starting_pattern):l=this._input.read(this._starting_pattern,this.__template_pattern);for(var r=this._read_template();r;)this._match_pattern?r+=this._input.read(this._match_pattern):r+=this._input.readUntil(this.__template_pattern),l+=r,r=this._read_template();return this._until_after&&(l+=this._input.readUntilAfter(this._until_pattern)),l},f.prototype.__set_templated_pattern=function(){var l=[];this._disabled.php||l.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||l.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||l.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(l.push(this.__patterns.django._starting_pattern.source),l.push(this.__patterns.django_value._starting_pattern.source),l.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||l.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&l.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+l.join("|")+")")},f.prototype._read_template=function(){var l="",r=this._input.peek();if(r==="<"){var s=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&s==="?"&&(l=l||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&s==="%"&&(l=l||this.__patterns.erb.read())}else r==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(l=l||this.__patterns.handlebars_comment.read(),l=l||this.__patterns.handlebars_unescaped.read(),l=l||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(l=l||this.__patterns.django_value.read()),this._excluded.django||(l=l||this.__patterns.django_comment.read(),l=l||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(l=l||this.__patterns.smarty_comment.read(),l=l||this.__patterns.smarty_literal.read(),l=l||this.__patterns.smarty.read()));return l},v.exports.TemplatablePattern=f},,,,function(v,m,p){var h=p(19).Beautifier,o=p(20).Options;function f(l,r,s,c){var L=new h(l,r,s,c);return L.beautify()}v.exports=f,v.exports.defaultOptions=function(){return new o}},function(v,m,p){var h=p(20).Options,o=p(2).Output,f=p(21).Tokenizer,l=p(21).TOKEN,r=/\r\n|[\r\n]/,s=/\r\n|[\r\n]/g,c=function(u,g){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=u.max_preserve_newlines,this.preserve_newlines=u.preserve_newlines,this._output=new o(u,g)};c.prototype.current_line_has_match=function(u){return this._output.current_line.has_match(u)},c.prototype.set_space_before_token=function(u,g){this._output.space_before_token=u,this._output.non_breaking_space=g},c.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},c.prototype.add_raw_token=function(u){this._output.add_raw_token(u)},c.prototype.print_preserved_newlines=function(u){var g=0;u.type!==l.TEXT&&u.previous.type!==l.TEXT&&(g=u.newlines?1:0),this.preserve_newlines&&(g=u.newlines<this.max_preserve_newlines+1?u.newlines:this.max_preserve_newlines+1);for(var E=0;E<g;E++)this.print_newline(E>0);return g!==0},c.prototype.traverse_whitespace=function(u){return u.whitespace_before||u.newlines?(this.print_preserved_newlines(u)||(this._output.space_before_token=!0),!0):!1},c.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},c.prototype.print_newline=function(u){this._output.add_new_line(u)},c.prototype.print_token=function(u){u.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(u.text))},c.prototype.indent=function(){this.indent_level++},c.prototype.get_full_indent=function(u){return u=this.indent_level+(u||0),u<1?"":this._output.get_indent_string(u)};var L=function(u){for(var g=null,E=u.next;E.type!==l.EOF&&u.closed!==E;){if(E.type===l.ATTRIBUTE&&E.text==="type"){E.next&&E.next.type===l.EQUALS&&E.next.next&&E.next.next.type===l.VALUE&&(g=E.next.next.text);break}E=E.next}return g},w=function(u,g){var E=null,N=null;return g.closed?(u==="script"?E="text/javascript":u==="style"&&(E="text/css"),E=L(g)||E,E.search("text/css")>-1?N="css":E.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?N="javascript":E.search(/(text|application|dojo)\/(x-)?(html)/)>-1?N="html":E.search(/test\/null/)>-1&&(N="null"),N):null};function T(u,g){return g.indexOf(u)!==-1}function R(u,g,E){this.parent=u||null,this.tag=g?g.tag_name:"",this.indent_level=E||0,this.parser_token=g||null}function C(u){this._printer=u,this._current_frame=null}C.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},C.prototype.record_tag=function(u){var g=new R(this._current_frame,u,this._printer.indent_level);this._current_frame=g},C.prototype._try_pop_frame=function(u){var g=null;return u&&(g=u.parser_token,this._printer.indent_level=u.indent_level,this._current_frame=u.parent),g},C.prototype._get_frame=function(u,g){for(var E=this._current_frame;E&&!(u.indexOf(E.tag)!==-1);){if(g&&g.indexOf(E.tag)!==-1){E=null;break}E=E.parent}return E},C.prototype.try_pop=function(u,g){var E=this._get_frame([u],g);return this._try_pop_frame(E)},C.prototype.indent_to_tag=function(u){var g=this._get_frame(u);g&&(this._printer.indent_level=g.indent_level)};function S(u,g,E,N){this._source_text=u||"",g=g||{},this._js_beautify=E,this._css_beautify=N,this._tag_stack=null;var D=new h(g,"html");this._options=D,this._is_wrap_attributes_force=this._options.wrap_attributes.substr(0,"force".length)==="force",this._is_wrap_attributes_force_expand_multiline=this._options.wrap_attributes==="force-expand-multiline",this._is_wrap_attributes_force_aligned=this._options.wrap_attributes==="force-aligned",this._is_wrap_attributes_aligned_multiple=this._options.wrap_attributes==="aligned-multiple",this._is_wrap_attributes_preserve=this._options.wrap_attributes.substr(0,"preserve".length)==="preserve",this._is_wrap_attributes_preserve_aligned=this._options.wrap_attributes==="preserve-aligned"}S.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var u=this._source_text,g=this._options.eol;this._options.eol==="auto"&&(g=`
`,u&&r.test(u)&&(g=u.match(r)[0])),u=u.replace(s,`
`);var E=u.match(/^[\t ]*/)[0],N={text:"",type:""},D=new x,H=new c(this._options,E),j=new f(u,this._options).tokenize();this._tag_stack=new C(H);for(var I=null,b=j.next();b.type!==l.EOF;)b.type===l.TAG_OPEN||b.type===l.COMMENT?(I=this._handle_tag_open(H,b,D,N),D=I):b.type===l.ATTRIBUTE||b.type===l.EQUALS||b.type===l.VALUE||b.type===l.TEXT&&!D.tag_complete?I=this._handle_inside_tag(H,b,D,j):b.type===l.TAG_CLOSE?I=this._handle_tag_close(H,b,D):b.type===l.TEXT?I=this._handle_text(H,b,D):H.add_raw_token(b),N=I,b=j.next();var W=H._output.get_code(g);return W},S.prototype._handle_tag_close=function(u,g,E){var N={text:g.text,type:g.type};return u.alignment_size=0,E.tag_complete=!0,u.set_space_before_token(g.newlines||g.whitespace_before!=="",!0),E.is_unformatted?u.add_raw_token(g):(E.tag_start_char==="<"&&(u.set_space_before_token(g.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&E.has_wrapped_attrs&&u.print_newline(!1)),u.print_token(g)),E.indent_content&&!(E.is_unformatted||E.is_content_unformatted)&&(u.indent(),E.indent_content=!1),!E.is_inline_element&&!(E.is_unformatted||E.is_content_unformatted)&&u.set_wrap_point(),N},S.prototype._handle_inside_tag=function(u,g,E,N){var D=E.has_wrapped_attrs,H={text:g.text,type:g.type};if(u.set_space_before_token(g.newlines||g.whitespace_before!=="",!0),E.is_unformatted)u.add_raw_token(g);else if(E.tag_start_char==="{"&&g.type===l.TEXT)u.print_preserved_newlines(g)?(g.newlines=0,u.add_raw_token(g)):u.print_token(g);else{if(g.type===l.ATTRIBUTE?(u.set_space_before_token(!0),E.attr_count+=1):(g.type===l.EQUALS||g.type===l.VALUE&&g.previous.type===l.EQUALS)&&u.set_space_before_token(!1),g.type===l.ATTRIBUTE&&E.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(u.traverse_whitespace(g),D=D||g.newlines!==0),this._is_wrap_attributes_force)){var j=E.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&E.attr_count===1){var I=!0,b=0,W;do{if(W=N.peek(b),W.type===l.ATTRIBUTE){I=!1;break}b+=1}while(b<4&&W.type!==l.EOF&&W.type!==l.TAG_CLOSE);j=!I}j&&(u.print_newline(!1),D=!0)}u.print_token(g),D=D||u.previous_token_wrapped(),E.has_wrapped_attrs=D}return H},S.prototype._handle_text=function(u,g,E){var N={text:g.text,type:"TK_CONTENT"};return E.custom_beautifier_name?this._print_custom_beatifier_text(u,g,E):E.is_unformatted||E.is_content_unformatted?u.add_raw_token(g):(u.traverse_whitespace(g),u.print_token(g)),N},S.prototype._print_custom_beatifier_text=function(u,g,E){var N=this;if(g.text!==""){var D=g.text,H,j=1,I="",b="";E.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?H=this._js_beautify:E.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?H=this._css_beautify:E.custom_beautifier_name==="html"&&(H=function(ve,we){var Ce=new S(ve,we,N._js_beautify,N._css_beautify);return Ce.beautify()}),this._options.indent_scripts==="keep"?j=0:this._options.indent_scripts==="separate"&&(j=-u.indent_level);var W=u.get_full_indent(j);if(D=D.replace(/\n[ \t]*$/,""),E.custom_beautifier_name!=="html"&&D[0]==="<"&&D.match(/^(<!--|<!\[CDATA\[)/)){var Y=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(D);if(!Y){u.add_raw_token(g);return}I=W+Y[1]+`
`,D=Y[4],Y[5]&&(b=W+Y[5]),D=D.replace(/\n[ \t]*$/,""),(Y[2]||Y[3].indexOf(`
`)!==-1)&&(Y=Y[3].match(/[ \t]+$/),Y&&(g.whitespace_before=Y[0]))}if(D)if(H){var ie=function(){this.eol=`
`};ie.prototype=this._options.raw_options;var oe=new ie;D=H(W+D,oe)}else{var xe=g.whitespace_before;xe&&(D=D.replace(new RegExp(`
(`+xe+")?","g"),`
`)),D=W+D.replace(/\n/g,`
`+W)}I&&(D?D=I+D+`
`+b:D=I+b),u.print_newline(!1),D&&(g.text=D,g.whitespace_before="",g.newlines=0,u.add_raw_token(g),u.print_newline(!0))}},S.prototype._handle_tag_open=function(u,g,E,N){var D=this._get_tag_open_token(g);return(E.is_unformatted||E.is_content_unformatted)&&!E.is_empty_element&&g.type===l.TAG_OPEN&&g.text.indexOf("</")===0?(u.add_raw_token(g),D.start_tag_token=this._tag_stack.try_pop(D.tag_name)):(u.traverse_whitespace(g),this._set_tag_position(u,g,D,E,N),D.is_inline_element||u.set_wrap_point(),u.print_token(g)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(D.alignment_size=g.text.length+1),!D.tag_complete&&!D.is_unformatted&&(u.alignment_size=D.alignment_size),D};var x=function(u,g){if(this.parent=u||null,this.text="",this.type="TK_TAG_OPEN",this.tag_name="",this.is_inline_element=!1,this.is_unformatted=!1,this.is_content_unformatted=!1,this.is_empty_element=!1,this.is_start_tag=!1,this.is_end_tag=!1,this.indent_content=!1,this.multiline_content=!1,this.custom_beautifier_name=null,this.start_tag_token=null,this.attr_count=0,this.has_wrapped_attrs=!1,this.alignment_size=0,this.tag_complete=!1,this.tag_start_char="",this.tag_check="",!g)this.tag_complete=!0;else{var E;this.tag_start_char=g.text[0],this.text=g.text,this.tag_start_char==="<"?(E=g.text.match(/^<([^\s>]*)/),this.tag_check=E?E[1]:""):(E=g.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=E?E[1]:"",(g.text.startsWith("{{#>")||g.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&g.next!==null?this.tag_check=g.next.text.split(" ")[0]:this.tag_check=g.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),g.type===l.COMMENT&&(this.tag_complete=!0),this.is_start_tag=this.tag_check.charAt(0)!=="/",this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||g.closed&&g.closed.text==="/>";var N=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(N=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(N)))}};S.prototype._get_tag_open_token=function(u){var g=new x(this._tag_stack.get_parser_token(),u);return g.alignment_size=this._options.wrap_attributes_indent_size,g.is_end_tag=g.is_end_tag||T(g.tag_check,this._options.void_elements),g.is_empty_element=g.tag_complete||g.is_start_tag&&g.is_end_tag,g.is_unformatted=!g.tag_complete&&T(g.tag_check,this._options.unformatted),g.is_content_unformatted=!g.is_empty_element&&T(g.tag_check,this._options.content_unformatted),g.is_inline_element=T(g.tag_name,this._options.inline)||g.tag_name.includes("-")||g.tag_start_char==="{",g},S.prototype._set_tag_position=function(u,g,E,N,D){if(E.is_empty_element||(E.is_end_tag?E.start_tag_token=this._tag_stack.try_pop(E.tag_name):(this._do_optional_end_element(E)&&(E.is_inline_element||u.print_newline(!1)),this._tag_stack.record_tag(E),(E.tag_name==="script"||E.tag_name==="style")&&!(E.is_unformatted||E.is_content_unformatted)&&(E.custom_beautifier_name=w(E.tag_check,g)))),T(E.tag_check,this._options.extra_liners)&&(u.print_newline(!1),u._output.just_added_blankline()||u.print_newline(!0)),E.is_empty_element){if(E.tag_start_char==="{"&&E.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),E.indent_content=!0;var H=u.current_line_has_match(/{{#if/);H||u.print_newline(!1)}E.tag_name==="!--"&&D.type===l.TAG_CLOSE&&N.is_end_tag&&E.text.indexOf(`
`)===-1||(E.is_inline_element||E.is_unformatted||u.print_newline(!1),this._calcluate_parent_multiline(u,E))}else if(E.is_end_tag){var j=!1;j=E.start_tag_token&&E.start_tag_token.multiline_content,j=j||!E.is_inline_element&&!(N.is_inline_element||N.is_unformatted)&&!(D.type===l.TAG_CLOSE&&E.start_tag_token===N)&&D.type!=="TK_CONTENT",(E.is_content_unformatted||E.is_unformatted)&&(j=!1),j&&u.print_newline(!1)}else E.indent_content=!E.custom_beautifier_name,E.tag_start_char==="<"&&(E.tag_name==="html"?E.indent_content=this._options.indent_inner_html:E.tag_name==="head"?E.indent_content=this._options.indent_head_inner_html:E.tag_name==="body"&&(E.indent_content=this._options.indent_body_inner_html)),!(E.is_inline_element||E.is_unformatted)&&(D.type!=="TK_CONTENT"||E.is_content_unformatted)&&u.print_newline(!1),this._calcluate_parent_multiline(u,E)},S.prototype._calcluate_parent_multiline=function(u,g){g.parent&&u._output.just_added_newline()&&!((g.is_inline_element||g.is_unformatted)&&g.parent.is_inline_element)&&(g.parent.multiline_content=!0)};var _=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","nav","ol","p","pre","section","table","ul"],d=["a","audio","del","ins","map","noscript","video"];S.prototype._do_optional_end_element=function(u){var g=null;if(u.is_empty_element||!u.is_start_tag||!u.parent)return;if(u.tag_name==="body")g=g||this._tag_stack.try_pop("head");else if(u.tag_name==="li")g=g||this._tag_stack.try_pop("li",["ol","ul"]);else if(u.tag_name==="dd"||u.tag_name==="dt")g=g||this._tag_stack.try_pop("dt",["dl"]),g=g||this._tag_stack.try_pop("dd",["dl"]);else if(u.parent.tag_name==="p"&&_.indexOf(u.tag_name)!==-1){var E=u.parent.parent;(!E||d.indexOf(E.tag_name)===-1)&&(g=g||this._tag_stack.try_pop("p"))}else u.tag_name==="rp"||u.tag_name==="rt"?(g=g||this._tag_stack.try_pop("rt",["ruby","rtc"]),g=g||this._tag_stack.try_pop("rp",["ruby","rtc"])):u.tag_name==="optgroup"?g=g||this._tag_stack.try_pop("optgroup",["select"]):u.tag_name==="option"?g=g||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):u.tag_name==="colgroup"?g=g||this._tag_stack.try_pop("caption",["table"]):u.tag_name==="thead"?(g=g||this._tag_stack.try_pop("caption",["table"]),g=g||this._tag_stack.try_pop("colgroup",["table"])):u.tag_name==="tbody"||u.tag_name==="tfoot"?(g=g||this._tag_stack.try_pop("caption",["table"]),g=g||this._tag_stack.try_pop("colgroup",["table"]),g=g||this._tag_stack.try_pop("thead",["table"]),g=g||this._tag_stack.try_pop("tbody",["table"])):u.tag_name==="tr"?(g=g||this._tag_stack.try_pop("caption",["table"]),g=g||this._tag_stack.try_pop("colgroup",["table"]),g=g||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(u.tag_name==="th"||u.tag_name==="td")&&(g=g||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),g=g||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return u.parent=this._tag_stack.get_parser_token(),g},v.exports.Beautifier=S},function(v,m,p){var h=p(6).Options;function o(f){h.call(this,f,"html"),this.templating.length===1&&this.templating[0]==="auto"&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}o.prototype=new h,v.exports.Options=o},function(v,m,p){var h=p(9).Tokenizer,o=p(9).TOKEN,f=p(13).Directives,l=p(14).TemplatablePattern,r=p(12).Pattern,s={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:o.START,RAW:o.RAW,EOF:o.EOF},c=new f(/<\!--/,/-->/),L=function(w,T){h.call(this,w,T),this._current_tag_name="";var R=new l(this._input).read_options(this._options),C=new r(this._input);if(this.__patterns={word:R.until(/[\n\r\t <]/),single_quote:R.until_after(/'/),double_quote:R.until_after(/"/),attribute:R.until(/[\n\r\t =>]|\/>/),element_name:R.until(/[\n\r\t >\/]/),handlebars_comment:C.starting_with(/{{!--/).until_after(/--}}/),handlebars:C.starting_with(/{{/).until_after(/}}/),handlebars_open:C.until(/[\n\r\t }]/),handlebars_raw_close:C.until(/}}/),comment:C.starting_with(/<!--/).until_after(/-->/),cdata:C.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:C.starting_with(/<!\[/).until_after(/]>/),processing:C.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter){var S=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=C.matching(S).until_after(S)}};L.prototype=new h,L.prototype._is_comment=function(w){return!1},L.prototype._is_opening=function(w){return w.type===s.TAG_OPEN},L.prototype._is_closing=function(w,T){return w.type===s.TAG_CLOSE&&T&&((w.text===">"||w.text==="/>")&&T.text[0]==="<"||w.text==="}}"&&T.text[0]==="{"&&T.text[1]==="{")},L.prototype._reset=function(){this._current_tag_name=""},L.prototype._get_next_token=function(w,T){var R=null;this._readWhitespace();var C=this._input.peek();return C===null?this._create_token(s.EOF,""):(R=R||this._read_open_handlebars(C,T),R=R||this._read_attribute(C,w,T),R=R||this._read_close(C,T),R=R||this._read_raw_content(C,w,T),R=R||this._read_content_word(C),R=R||this._read_comment_or_cdata(C),R=R||this._read_processing(C),R=R||this._read_open(C,T),R=R||this._create_token(s.UNKNOWN,this._input.next()),R)},L.prototype._read_comment_or_cdata=function(w){var T=null,R=null,C=null;if(w==="<"){var S=this._input.peek(1);S==="!"&&(R=this.__patterns.comment.read(),R?(C=c.get_directives(R),C&&C.ignore==="start"&&(R+=c.readIgnored(this._input))):R=this.__patterns.cdata.read()),R&&(T=this._create_token(s.COMMENT,R),T.directives=C)}return T},L.prototype._read_processing=function(w){var T=null,R=null,C=null;if(w==="<"){var S=this._input.peek(1);(S==="!"||S==="?")&&(R=this.__patterns.conditional_comment.read(),R=R||this.__patterns.processing.read()),R&&(T=this._create_token(s.COMMENT,R),T.directives=C)}return T},L.prototype._read_open=function(w,T){var R=null,C=null;return T||w==="<"&&(R=this._input.next(),this._input.peek()==="/"&&(R+=this._input.next()),R+=this.__patterns.element_name.read(),C=this._create_token(s.TAG_OPEN,R)),C},L.prototype._read_open_handlebars=function(w,T){var R=null,C=null;return T||this._options.indent_handlebars&&w==="{"&&this._input.peek(1)==="{"&&(this._input.peek(2)==="!"?(R=this.__patterns.handlebars_comment.read(),R=R||this.__patterns.handlebars.read(),C=this._create_token(s.COMMENT,R)):(R=this.__patterns.handlebars_open.read(),C=this._create_token(s.TAG_OPEN,R))),C},L.prototype._read_close=function(w,T){var R=null,C=null;return T&&(T.text[0]==="<"&&(w===">"||w==="/"&&this._input.peek(1)===">")?(R=this._input.next(),w==="/"&&(R+=this._input.next()),C=this._create_token(s.TAG_CLOSE,R)):T.text[0]==="{"&&w==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),C=this._create_token(s.TAG_CLOSE,"}}"))),C},L.prototype._read_attribute=function(w,T,R){var C=null,S="";if(R&&R.text[0]==="<")if(w==="=")C=this._create_token(s.EQUALS,this._input.next());else if(w==='"'||w==="'"){var x=this._input.next();w==='"'?x+=this.__patterns.double_quote.read():x+=this.__patterns.single_quote.read(),C=this._create_token(s.VALUE,x)}else S=this.__patterns.attribute.read(),S&&(T.type===s.EQUALS?C=this._create_token(s.VALUE,S):C=this._create_token(s.ATTRIBUTE,S));return C},L.prototype._is_content_unformatted=function(w){return this._options.void_elements.indexOf(w)===-1&&(this._options.content_unformatted.indexOf(w)!==-1||this._options.unformatted.indexOf(w)!==-1)},L.prototype._read_raw_content=function(w,T,R){var C="";if(R&&R.text[0]==="{")C=this.__patterns.handlebars_raw_close.read();else if(T.type===s.TAG_CLOSE&&T.opened.text[0]==="<"&&T.text[0]!=="/"){var S=T.opened.text.substr(1).toLowerCase();if(S==="script"||S==="style"){var x=this._read_comment_or_cdata(w);if(x)return x.type=s.TEXT,x;C=this._input.readUntil(new RegExp("</"+S+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(S)&&(C=this._input.readUntil(new RegExp("</"+S+"[\\n\\r\\t ]*?>","ig")))}return C?this._create_token(s.TEXT,C):null},L.prototype._read_content_word=function(w){var T="";if(this._options.unformatted_content_delimiter&&(w===this._options.unformatted_content_delimiter[0]&&(T=this.__patterns.unformatted_content_delimiter.read())),T||(T=this.__patterns.word.read()),T)return this._create_token(s.TEXT,T)},v.exports.Tokenizer=L,v.exports.TOKEN=s}],G={};function M(v){var m=G[v];if(m!==void 0)return m.exports;var p=G[v]={exports:{}};return K[v](p,p.exports,M),p.exports}var O=M(18);P=O})();var $=P;if(!0)!(ue=[ne,ne("6UM0"),ne("TXwP")],Z=function(K){var G=ne("6UM0"),M=ne("TXwP");return{html_beautify:function(O,v){return $(O,v,G.js_beautify,M.css_beautify)}}}.apply(Je,ue),Z!==void 0&&(_t.exports=Z));else var B,U})()},"rAM+":function(_t,Je,ne){"use strict";ne.d(Je,"a",function(){return Z});var ue=ne("Qw5x");function Z(P,$){var B;if(typeof Symbol=="undefined"||P[Symbol.iterator]==null){if(Array.isArray(P)||(B=Object(ue.a)(P))||$&&P&&typeof P.length=="number"){B&&(P=B);var U=0,K=function(){};return{s:K,n:function(){return U>=P.length?{done:!0}:{done:!1,value:P[U++]}},e:function(m){throw m},f:K}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var G=!0,M=!1,O;return{s:function(){B=P[Symbol.iterator]()},n:function(){var m=B.next();return G=m.done,m},e:function(m){M=!0,O=m},f:function(){try{!G&&B.return!=null&&B.return()}finally{if(M)throw O}}}}},rUJ1:function(_t,Je){const ne=/[&<>"']/,ue=/[&<>"']/g,Z=/[<>"']|&(?!#?\w+;)/,P=/[<>"']|&(?!#?\w+;)/g,$={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},B=C=>$[C];function U(C,S){if(S){if(ne.test(C))return C.replace(ue,B)}else if(Z.test(C))return C.replace(P,B);return C}const K=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function G(C){return C.replace(K,(S,x)=>(x=x.toLowerCase(),x==="colon"?":":x.charAt(0)==="#"?x.charAt(1)==="x"?String.fromCharCode(parseInt(x.substring(2),16)):String.fromCharCode(+x.substring(1)):""))}const M=/(^|[^\[])\^/g;function O(C,S){C=C.source||C,S=S||"";const x={replace:(_,d)=>(d=d.source||d,d=d.replace(M,"$1"),C=C.replace(_,d),x),getRegex:()=>new RegExp(C,S)};return x}const v=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function p(C,S,x){if(C){let _;try{_=decodeURIComponent(G(x)).replace(v,"").toLowerCase()}catch(d){return null}if(_.indexOf("javascript:")===0||_.indexOf("vbscript:")===0||_.indexOf("data:")===0)return null}S&&!m.test(x)&&(x=r(S,x));try{x=encodeURI(x).replace(/%25/g,"%")}catch(_){return null}return x}const h={},o=/^[^:]+:\/*[^/]*$/,f=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function r(C,S){h[" "+C]||(o.test(C)?h[" "+C]=C+"/":h[" "+C]=w(C,"/",!0)),C=h[" "+C];const x=C.indexOf(":")===-1;return S.substring(0,2)==="//"?x?S:C.replace(f,"$1")+S:S.charAt(0)==="/"?x?S:C.replace(l,"$1")+S:C+S}const s={exec:function(){}};function c(C){let S=1,x,_;for(;S<arguments.length;S++){x=arguments[S];for(_ in x)Object.prototype.hasOwnProperty.call(x,_)&&(C[_]=x[_])}return C}function L(C,S){const x=C.replace(/\|/g,(u,g,E)=>{let N=!1,D=g;for(;--D>=0&&E[D]==="\\";)N=!N;return N?"|":" |"}),_=x.split(/ \|/);let d=0;if(_.length>S)_.splice(S);else for(;_.length<S;)_.push("");for(;d<_.length;d++)_[d]=_[d].trim().replace(/\\\|/g,"|");return _}function w(C,S,x){const _=C.length;if(_===0)return"";let d=0;for(;d<_;){const u=C.charAt(_-d-1);if(u===S&&!x)d++;else if(u!==S&&x)d++;else break}return C.substr(0,_-d)}function T(C,S){if(C.indexOf(S[1])===-1)return-1;const x=C.length;let _=0,d=0;for(;d<x;d++)if(C[d]==="\\")d++;else if(C[d]===S[0])_++;else if(C[d]===S[1]&&(_--,_<0))return d;return-1}function R(C){C&&C.sanitize&&!C.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")}_t.exports={escape:U,unescape:G,edit:O,cleanUrl:p,resolveUrl:r,noopTest:s,merge:c,splitCells:L,rtrim:w,findClosingBracket:T,checkSanitizeDeprecation:R}},ulZh:function(_t,Je,ne){typeof window!="undefined"&&function(Z,P){_t.exports=P()}(this,function(){return function(ue){var Z={};function P($){if(Z[$])return Z[$].exports;var B=Z[$]={i:$,l:!1,exports:{}};return ue[$].call(B.exports,B,B.exports,P),B.l=!0,B.exports}return P.m=ue,P.c=Z,P.d=function($,B,U){P.o($,B)||Object.defineProperty($,B,{enumerable:!0,get:U})},P.r=function($){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty($,Symbol.toStringTag,{value:"Module"}),Object.defineProperty($,"__esModule",{value:!0})},P.t=function($,B){if(B&1&&($=P($)),B&8)return $;if(B&4&&typeof $=="object"&&$&&$.__esModule)return $;var U=Object.create(null);if(P.r(U),Object.defineProperty(U,"default",{enumerable:!0,value:$}),B&2&&typeof $!="string")for(var K in $)P.d(U,K,function(G){return $[G]}.bind(null,K));return U},P.n=function($){var B=$&&$.__esModule?function(){return $.default}:function(){return $};return P.d(B,"a",B),B},P.o=function($,B){return Object.prototype.hasOwnProperty.call($,B)},P.p="/dist/",P(P.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ue,Z,P){"use strict";var $=Object.prototype.hasOwnProperty,B="~";function U(){}Object.create&&(U.prototype=Object.create(null),new U().__proto__||(B=!1));function K(v,m,p){this.fn=v,this.context=m,this.once=p||!1}function G(v,m,p,h,o){if(typeof p!="function")throw new TypeError("The listener must be a function");var f=new K(p,h||v,o),l=B?B+m:m;return v._events[l]?v._events[l].fn?v._events[l]=[v._events[l],f]:v._events[l].push(f):(v._events[l]=f,v._eventsCount++),v}function M(v,m){--v._eventsCount===0?v._events=new U:delete v._events[m]}function O(){this._events=new U,this._eventsCount=0}O.prototype.eventNames=function(){var m=[],p,h;if(this._eventsCount===0)return m;for(h in p=this._events)$.call(p,h)&&m.push(B?h.slice(1):h);return Object.getOwnPropertySymbols?m.concat(Object.getOwnPropertySymbols(p)):m},O.prototype.listeners=function(m){var p=B?B+m:m,h=this._events[p];if(!h)return[];if(h.fn)return[h.fn];for(var o=0,f=h.length,l=new Array(f);o<f;o++)l[o]=h[o].fn;return l},O.prototype.listenerCount=function(m){var p=B?B+m:m,h=this._events[p];return h?h.fn?1:h.length:0},O.prototype.emit=function(m,p,h,o,f,l){var r=B?B+m:m;if(!this._events[r])return!1;var s=this._events[r],c=arguments.length,L,w;if(s.fn){s.once&&this.removeListener(m,s.fn,void 0,!0);switch(c){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,p),!0;case 3:return s.fn.call(s.context,p,h),!0;case 4:return s.fn.call(s.context,p,h,o),!0;case 5:return s.fn.call(s.context,p,h,o,f),!0;case 6:return s.fn.call(s.context,p,h,o,f,l),!0}for(w=1,L=new Array(c-1);w<c;w++)L[w-1]=arguments[w];s.fn.apply(s.context,L)}else{var T=s.length,R;for(w=0;w<T;w++){s[w].once&&this.removeListener(m,s[w].fn,void 0,!0);switch(c){case 1:s[w].fn.call(s[w].context);break;case 2:s[w].fn.call(s[w].context,p);break;case 3:s[w].fn.call(s[w].context,p,h);break;case 4:s[w].fn.call(s[w].context,p,h,o);break;default:if(!L)for(R=1,L=new Array(c-1);R<c;R++)L[R-1]=arguments[R];s[w].fn.apply(s[w].context,L)}}}return!0},O.prototype.on=function(m,p,h){return G(this,m,p,h,!1)},O.prototype.once=function(m,p,h){return G(this,m,p,h,!0)},O.prototype.removeListener=function(m,p,h,o){var f=B?B+m:m;if(!this._events[f])return this;if(!p)return M(this,f),this;var l=this._events[f];if(l.fn)l.fn===p&&(!o||l.once)&&(!h||l.context===h)&&M(this,f);else{for(var r=0,s=[],c=l.length;r<c;r++)(l[r].fn!==p||o&&!l[r].once||h&&l[r].context!==h)&&s.push(l[r]);s.length?this._events[f]=s.length===1?s[0]:s:M(this,f)}return this},O.prototype.removeAllListeners=function(m){var p;return m?(p=B?B+m:m,this._events[p]&&M(this,p)):(this._events=new U,this._eventsCount=0),this},O.prototype.off=O.prototype.removeListener,O.prototype.addListener=O.prototype.on,O.prefixed=B,O.EventEmitter=O,ue.exports=O},"./node_modules/url-toolkit/src/url-toolkit.js":function(ue,Z,P){(function($){var B=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,U=/^([^\/?#]*)([^]*)$/,K=/(?:\/|^)\.(?=\/)/g,G=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,M={buildAbsoluteURL:function(O,v,m){if(m=m||{},O=O.trim(),v=v.trim(),!v){if(!m.alwaysNormalize)return O;var p=M.parseURL(O);if(!p)throw new Error("Error trying to parse base URL.");return p.path=M.normalizePath(p.path),M.buildURLFromParts(p)}var h=M.parseURL(v);if(!h)throw new Error("Error trying to parse relative URL.");if(h.scheme)return m.alwaysNormalize?(h.path=M.normalizePath(h.path),M.buildURLFromParts(h)):v;var o=M.parseURL(O);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&o.path[0]!=="/"){var f=U.exec(o.path);o.netLoc=f[1],o.path=f[2]}o.netLoc&&!o.path&&(o.path="/");var l={scheme:o.scheme,netLoc:h.netLoc,path:null,params:h.params,query:h.query,fragment:h.fragment};if(!h.netLoc&&(l.netLoc=o.netLoc,h.path[0]!=="/"))if(!h.path)l.path=o.path,h.params||(l.params=o.params,h.query||(l.query=o.query));else{var r=o.path,s=r.substring(0,r.lastIndexOf("/")+1)+h.path;l.path=M.normalizePath(s)}return l.path===null&&(l.path=m.alwaysNormalize?M.normalizePath(h.path):h.path),M.buildURLFromParts(l)},parseURL:function(O){var v=B.exec(O);return v?{scheme:v[1]||"",netLoc:v[2]||"",path:v[3]||"",params:v[4]||"",query:v[5]||"",fragment:v[6]||""}:null},normalizePath:function(O){for(O=O.split("").reverse().join("").replace(K,"");O.length!==(O=O.replace(G,"")).length;);return O.split("").reverse().join("")},buildURLFromParts:function(O){return O.scheme+O.netLoc+O.path+O.params+O.query+O.fragment}};ue.exports=M})(this)},"./node_modules/webworkify-webpack/index.js":function(ue,Z,P){function $(m){var p={};function h(f){if(p[f])return p[f].exports;var l=p[f]={i:f,l:!1,exports:{}};return m[f].call(l.exports,l,l.exports,h),l.l=!0,l.exports}h.m=m,h.c=p,h.i=function(f){return f},h.d=function(f,l,r){h.o(f,l)||Object.defineProperty(f,l,{configurable:!1,enumerable:!0,get:r})},h.r=function(f){Object.defineProperty(f,"__esModule",{value:!0})},h.n=function(f){var l=f&&f.__esModule?function(){return f.default}:function(){return f};return h.d(l,"a",l),l},h.o=function(f,l){return Object.prototype.hasOwnProperty.call(f,l)},h.p="/",h.oe=function(f){throw console.error(f),f};var o=h(h.s=ENTRY_MODULE);return o.default||o}var B="[\\.|\\-|\\+|\\w|/|@]+",U="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+B+").*?\\)";function K(m){return(m+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function G(m){return!isNaN(1*m)}function M(m,p,h){var o={};o[h]=[];var f=p.toString(),l=f.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!l)return o;for(var r=l[1],s=new RegExp("(\\\\n|\\W)"+K(r)+U,"g"),c;c=s.exec(f);){if(c[3]==="dll-reference")continue;o[h].push(c[3])}for(s=new RegExp("\\("+K(r)+'\\("(dll-reference\\s('+B+'))"\\)\\)'+U,"g");c=s.exec(f);)m[c[2]]||(o[h].push(c[1]),m[c[2]]=P(c[1]).m),o[c[2]]=o[c[2]]||[],o[c[2]].push(c[4]);for(var L=Object.keys(o),w=0;w<L.length;w++)for(var T=0;T<o[L[w]].length;T++)G(o[L[w]][T])&&(o[L[w]][T]=1*o[L[w]][T]);return o}function O(m){var p=Object.keys(m);return p.reduce(function(h,o){return h||m[o].length>0},!1)}function v(m,p){for(var h={main:[p]},o={main:[]},f={main:{}};O(h);)for(var l=Object.keys(h),r=0;r<l.length;r++){var s=l[r],c=h[s],L=c.pop();if(f[s]=f[s]||{},f[s][L]||!m[s][L])continue;f[s][L]=!0,o[s]=o[s]||[],o[s].push(L);for(var w=M(m,m[s][L],s),T=Object.keys(w),R=0;R<T.length;R++)h[T[R]]=h[T[R]]||[],h[T[R]]=h[T[R]].concat(w[T[R]])}return o}ue.exports=function(m,p){p=p||{};var h={main:P.m},o=p.all?{main:Object.keys(h.main)}:v(h,m),f="";Object.keys(o).filter(function(L){return L!=="main"}).forEach(function(L){for(var w=0;o[L][w];)w++;o[L].push(w),h[L][w]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",f=f+"var "+L+" = ("+$.toString().replace("ENTRY_MODULE",JSON.stringify(w))+")({"+o[L].map(function(T){return""+JSON.stringify(T)+": "+h[L][T].toString()}).join(",")+`});
`}),f=f+"new (("+$.toString().replace("ENTRY_MODULE",JSON.stringify(m))+")({"+o.main.map(function(L){return""+JSON.stringify(L)+": "+h.main[L].toString()}).join(",")+"}))(self);";var l=new window.Blob([f],{type:"text/javascript"});if(p.bare)return l;var r=window.URL||window.webkitURL||window.mozURL||window.msURL,s=r.createObjectURL(l),c=new window.Worker(s);return c.objectURL=s,c}},"./src/config.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"hlsDefaultConfig",function(){return R}),P.d(Z,"mergeConfig",function(){return S}),P.d(Z,"enableStreamingMode",function(){return x});var $=P("./src/controller/abr-controller.ts"),B=P("./src/controller/audio-stream-controller.ts"),U=P("./src/controller/audio-track-controller.ts"),K=P("./src/controller/subtitle-stream-controller.ts"),G=P("./src/controller/subtitle-track-controller.ts"),M=P("./src/controller/buffer-controller.ts"),O=P("./src/controller/timeline-controller.ts"),v=P("./src/controller/cap-level-controller.ts"),m=P("./src/controller/fps-controller.ts"),p=P("./src/controller/eme-controller.ts"),h=P("./src/controller/cmcd-controller.ts"),o=P("./src/utils/xhr-loader.ts"),f=P("./src/utils/fetch-loader.ts"),l=P("./src/utils/cues.ts"),r=P("./src/utils/mediakeys-helper.ts"),s=P("./src/utils/logger.ts");function c(){return c=Object.assign||function(_){for(var d=1;d<arguments.length;d++){var u=arguments[d];for(var g in u)Object.prototype.hasOwnProperty.call(u,g)&&(_[g]=u[g])}return _},c.apply(this,arguments)}function L(_,d){var u=Object.keys(_);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(_);d&&(g=g.filter(function(E){return Object.getOwnPropertyDescriptor(_,E).enumerable})),u.push.apply(u,g)}return u}function w(_){for(var d=1;d<arguments.length;d++){var u=arguments[d]!=null?arguments[d]:{};d%2?L(Object(u),!0).forEach(function(g){T(_,g,u[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(_,Object.getOwnPropertyDescriptors(u)):L(Object(u)).forEach(function(g){Object.defineProperty(_,g,Object.getOwnPropertyDescriptor(u,g))})}return _}function T(_,d,u){return d in _?Object.defineProperty(_,d,{value:u,enumerable:!0,configurable:!0,writable:!0}):_[d]=u,_}var R=w(w({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:o.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:$.default,bufferController:M.default,capLevelController:v.default,fpsController:m.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:r.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},C()),{},{subtitleStreamController:K.SubtitleStreamController,subtitleTrackController:G.default,timelineController:O.TimelineController,audioStreamController:B.default,audioTrackController:U.default,emeController:p.default,cmcdController:h.default});function C(){return{cueHandler:l.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 S(_,d){if((d.liveSyncDurationCount||d.liveMaxLatencyDurationCount)&&(d.liveSyncDuration||d.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(d.liveMaxLatencyDurationCount!==void 0&&(d.liveSyncDurationCount===void 0||d.liveMaxLatencyDurationCount<=d.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(d.liveMaxLatencyDuration!==void 0&&(d.liveSyncDuration===void 0||d.liveMaxLatencyDuration<=d.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return c({},_,d)}function x(_){var d=_.loader;if(d!==f.default&&d!==o.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),_.progressive=!1;else{var u=Object(f.fetchSupported)();u&&(_.loader=f.default,_.progressive=!0,_.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ue,Z,P){"use strict";P.r(Z);var $=P("./src/polyfills/number.ts"),B=P("./src/utils/ewma-bandwidth-estimator.ts"),U=P("./src/events.ts"),K=P("./src/utils/buffer-helper.ts"),G=P("./src/errors.ts"),M=P("./src/types/loader.ts"),O=P("./src/utils/logger.ts");function v(h,o){for(var f=0;f<o.length;f++){var l=o[f];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(h,l.key,l)}}function m(h,o,f){return o&&v(h.prototype,o),f&&v(h,f),h}var p=function(){function h(f){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=f;var l=f.config;this.bwEstimator=new B.default(l.abrEwmaSlowVoD,l.abrEwmaFastVoD,l.abrEwmaDefaultEstimate),this.registerListeners()}var o=h.prototype;return o.registerListeners=function(){var l=this.hls;l.on(U.Events.FRAG_LOADING,this.onFragLoading,this),l.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(U.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(U.Events.ERROR,this.onError,this)},o.unregisterListeners=function(){var l=this.hls;l.off(U.Events.FRAG_LOADING,this.onFragLoading,this),l.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(U.Events.FRAG_BUFFERED,this.onFragBuffered,this),l.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(U.Events.ERROR,this.onError,this)},o.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},o.onFragLoading=function(l,r){var s=r.frag;if(s.type===M.PlaylistLevelType.MAIN&&!this.timer){var c;this.fragCurrent=s,this.partCurrent=(c=r.part)!=null?c:null,this.timer=self.setInterval(this.onCheck,100)}},o.onLevelLoaded=function(l,r){var s=this.hls.config;r.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},o._abandonRulesCheck=function(){var l=this.fragCurrent,r=this.partCurrent,s=this.hls,c=s.autoLevelEnabled,L=s.config,w=s.media;if(!l||!w)return;var T=r?r.stats:l.stats,R=r?r.duration:l.duration;if(T.aborted){O.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!c||w.paused||!w.playbackRate||!w.readyState)return;var C=performance.now()-T.loading.start,S=Math.abs(w.playbackRate);if(C<=500*R/S)return;var x=s.levels,_=s.minAutoLevel,d=x[l.level],u=T.total||Math.max(T.loaded,Math.round(R*d.maxBitrate/8)),g=Math.max(1,T.bwEstimate?T.bwEstimate/8:T.loaded*1e3/C),E=(u-T.loaded)/g,N=w.currentTime,D=(K.BufferHelper.bufferInfo(w,N,L.maxBufferHole).end-N)/S;if(D>=2*R/S||E<=D)return;var H=Number.POSITIVE_INFINITY,j;for(j=l.level-1;j>_;j--){var I=x[j].maxBitrate;if(H=R*I/(8*.8*g),H<D)break}if(H>=E)return;var b=this.bwEstimator.getEstimate();O.logger.warn("Fragment "+l.sn+(r?" part "+r.index:"")+" of level "+l.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+j+`
Current BW estimate: `+(Object($.isFiniteNumber)(b)?(b/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+E.toFixed(3)+` s
Estimated load time for the next fragment: `+H.toFixed(3)+` s
Time to underbuffer: `+D.toFixed(3)+" s"),s.nextLoadLevel=j,this.bwEstimator.sample(C,T.loaded),this.clearTimer(),l.loader&&(this.fragCurrent=this.partCurrent=null,l.loader.abort()),s.trigger(U.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:l,part:r,stats:T})},o.onFragLoaded=function(l,r){var s=r.frag,c=r.part;if(s.type===M.PlaylistLevelType.MAIN&&Object($.isFiniteNumber)(s.sn)){var L=c?c.stats:s.stats,w=c?c.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var T=this.hls.levels[s.level],R=(T.loaded?T.loaded.bytes:0)+L.loaded,C=(T.loaded?T.loaded.duration:0)+w;T.loaded={bytes:R,duration:C},T.realBitrate=Math.round(8*R/C)}if(s.bitrateTest){var S={stats:L,frag:s,part:c,id:s.type};this.onFragBuffered(U.Events.FRAG_BUFFERED,S),s.bitrateTest=!1}}},o.onFragBuffered=function(l,r){var s=r.frag,c=r.part,L=c?c.stats:s.stats;if(L.aborted)return;if(s.type!==M.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var w=L.parsing.end-L.loading.start;this.bwEstimator.sample(w,L.loaded),L.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=w/1e3:this.bitrateTestDelay=0},o.onError=function(l,r){switch(r.details){case G.ErrorDetails.FRAG_LOAD_ERROR:case G.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},o.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},o.getNextABRAutoLevel=function(){var l=this.fragCurrent,r=this.partCurrent,s=this.hls,c=s.maxAutoLevel,L=s.config,w=s.minAutoLevel,T=s.media,R=r?r.duration:l?l.duration:0,C=T?T.currentTime:0,S=T&&T.playbackRate!==0?Math.abs(T.playbackRate):1,x=this.bwEstimator?this.bwEstimator.getEstimate():L.abrEwmaDefaultEstimate,_=(K.BufferHelper.bufferInfo(T,C,L.maxBufferHole).end-C)/S,d=this.findBestLevel(x,w,c,_,L.abrBandWidthFactor,L.abrBandWidthUpFactor);if(d>=0)return d;O.logger.trace((_?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var u=R?Math.min(R,L.maxStarvationDelay):L.maxStarvationDelay,g=L.abrBandWidthFactor,E=L.abrBandWidthUpFactor;if(!_){var N=this.bitrateTestDelay;if(N){var D=R?Math.min(R,L.maxLoadingDelay):L.maxLoadingDelay;u=D-N,O.logger.trace("bitrate test took "+Math.round(1e3*N)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*u)+" ms"),g=E=1}}return d=this.findBestLevel(x,w,c,_+u,g,E),Math.max(d,0)},o.findBestLevel=function(l,r,s,c,L,w){for(var T,R=this.fragCurrent,C=this.partCurrent,S=this.lastLoadedFragLevel,x=this.hls.levels,_=x[S],d=!!(_!=null&&(T=_.details)!==null&&T!==void 0&&T.live),u=_==null?void 0:_.codecSet,g=C?C.duration:R?R.duration:0,E=s;E>=r;E--){var N=x[E];if(!N||u&&N.codecSet!==u)continue;var D=N.details,H=(C?D==null?void 0:D.partTarget:D==null?void 0:D.averagetargetduration)||g,j=void 0;E<=S?j=L*l:j=w*l;var I=x[E].maxBitrate,b=I*H/j;if(O.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+E+"/"+Math.round(j)+"/"+I+"/"+H+"/"+c+"/"+b),j>I&&(!b||d&&!this.bitrateTestDelay||b<c))return E}return-1},m(h,[{key:"nextAutoLevel",get:function(){var l=this._nextAutoLevel,r=this.bwEstimator;if(l!==-1&&(!r||!r.canEstimate()))return l;var s=this.getNextABRAutoLevel();return l!==-1&&(s=Math.min(l,s)),s},set:function(l){this._nextAutoLevel=l}}]),h}();Z.default=p},"./src/controller/audio-stream-controller.ts":function(ue,Z,P){"use strict";P.r(Z);var $=P("./src/polyfills/number.ts"),B=P("./src/controller/base-stream-controller.ts"),U=P("./src/events.ts"),K=P("./src/utils/buffer-helper.ts"),G=P("./src/controller/fragment-tracker.ts"),M=P("./src/types/level.ts"),O=P("./src/types/loader.ts"),v=P("./src/loader/fragment.ts"),m=P("./src/demux/chunk-cache.ts"),p=P("./src/demux/transmuxer-interface.ts"),h=P("./src/types/transmuxer.ts"),o=P("./src/controller/fragment-finders.ts"),f=P("./src/utils/discontinuities.ts"),l=P("./src/errors.ts"),r=P("./src/utils/logger.ts");function s(){return s=Object.assign||function(R){for(var C=1;C<arguments.length;C++){var S=arguments[C];for(var x in S)Object.prototype.hasOwnProperty.call(S,x)&&(R[x]=S[x])}return R},s.apply(this,arguments)}function c(R,C){R.prototype=Object.create(C.prototype),R.prototype.constructor=R,L(R,C)}function L(R,C){return L=Object.setPrototypeOf||function(x,_){return x.__proto__=_,x},L(R,C)}var w=100,T=function(R){c(C,R);function C(x,_){var d;return d=R.call(this,x,_,"[audio-stream-controller]")||this,d.videoBuffer=null,d.videoTrackCC=-1,d.waitingVideoCC=-1,d.audioSwitch=!1,d.trackId=-1,d.waitingData=null,d.mainDetails=null,d.bufferFlushed=!1,d._registerListeners(),d}var S=C.prototype;return S.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},S._registerListeners=function(){var _=this.hls;_.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),_.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),_.on(U.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),_.on(U.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),_.on(U.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),_.on(U.Events.ERROR,this.onError,this),_.on(U.Events.BUFFER_RESET,this.onBufferReset,this),_.on(U.Events.BUFFER_CREATED,this.onBufferCreated,this),_.on(U.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),_.on(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),_.on(U.Events.FRAG_BUFFERED,this.onFragBuffered,this)},S._unregisterListeners=function(){var _=this.hls;_.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),_.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),_.off(U.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),_.off(U.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),_.off(U.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),_.off(U.Events.ERROR,this.onError,this),_.off(U.Events.BUFFER_RESET,this.onBufferReset,this),_.off(U.Events.BUFFER_CREATED,this.onBufferCreated,this),_.off(U.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),_.off(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),_.off(U.Events.FRAG_BUFFERED,this.onFragBuffered,this)},S.onInitPtsFound=function(_,d){var u=d.frag,g=d.id,E=d.initPTS;if(g==="main"){var N=u.cc;this.initPTS[u.cc]=E,this.log("InitPTS for cc: "+N+" found from main: "+E),this.videoTrackCC=N,this.state===B.State.WAITING_INIT_PTS&&this.tick()}},S.startLoad=function(_){if(!this.levels){this.startPosition=_,this.state=B.State.STOPPED;return}var d=this.lastCurrentTime;this.stopLoad(),this.setInterval(w),this.fragLoadError=0,d>0&&_===-1?(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),this.state=B.State.IDLE):(this.loadedmetadata=!1,this.state=B.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=_,this.tick()},S.doTick=function(){switch(this.state){case B.State.IDLE:this.doTickIdle();break;case B.State.WAITING_TRACK:{var _,d=this.levels,u=this.trackId,g=d==null||((_=d[u])===null||_===void 0)?void 0:_.details;if(g){if(this.waitForCdnTuneIn(g))break;this.state=B.State.WAITING_INIT_PTS}break}case B.State.FRAG_LOADING_WAITING_RETRY:{var E,N=performance.now(),D=this.retryDate;(!D||N>=D||(E=this.media)!==null&&E!==void 0&&E.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=B.State.IDLE);break}case B.State.WAITING_INIT_PTS:{var H=this.waitingData;if(H){var j=H.frag,I=H.part,b=H.cache,W=H.complete;if(this.initPTS[j.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=B.State.FRAG_LOADING;var Y=b.flush(),ie={frag:j,part:I,payload:Y,networkDetails:null};this._handleFragmentLoadProgress(ie),W&&R.prototype._handleFragmentLoadComplete.call(this,ie)}else if(this.videoTrackCC!==this.waitingVideoCC)r.logger.log("Waiting fragment cc ("+j.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var oe=this.getLoadPosition(),xe=K.BufferHelper.bufferInfo(this.mediaBuffer,oe,this.config.maxBufferHole),ve=Object(o.fragmentWithinToleranceTest)(xe.end,this.config.maxFragLookUpTolerance,j);ve<0&&(r.logger.log("Waiting fragment cc ("+j.cc+") @ "+j.start+" cancelled because another fragment at "+xe.end+" is needed"),this.clearWaitingFragment())}}else this.state=B.State.IDLE}}this.onTickEnd()},S.clearWaitingFragment=function(){var _=this.waitingData;_&&(this.fragmentTracker.removeFragment(_.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=B.State.IDLE)},S.onTickEnd=function(){var _=this.media;if(!_||!_.readyState)return;var d=this.mediaBuffer?this.mediaBuffer:_,u=d.buffered;!this.loadedmetadata&&u.length&&(this.loadedmetadata=!0),this.lastCurrentTime=_.currentTime},S.doTickIdle=function(){var _,d,u=this.hls,g=this.levels,E=this.media,N=this.trackId,D=u.config;if(!g||!g[N])return;if(!E&&(this.startFragRequested||!D.startFragPrefetch))return;var H=g[N],j=H.details;if(!j||j.live&&this.levelLastLoaded!==N||this.waitForCdnTuneIn(j)){this.state=B.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,v.ElementaryStreamTypes.AUDIO,O.PlaylistLevelType.AUDIO));var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,O.PlaylistLevelType.AUDIO);if(I===null)return;var b=I.len,W=this.getMaxBufferLength(),Y=this.audioSwitch;if(b>=W&&!Y)return;if(!Y&&this._streamEnded(I,j)){u.trigger(U.Events.BUFFER_EOS,{type:"audio"}),this.state=B.State.ENDED;return}var ie=j.fragments,oe=ie[0].start,xe=I.end;if(Y){var ve=this.getLoadPosition();xe=ve,j.PTSKnown&&ve<oe&&((I.end>oe||I.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),E.currentTime=oe+.05))}var we=this.getNextFragment(xe,j);if(!we){this.bufferFlushed=!0;return}((_=we.decryptdata)===null||_===void 0?void 0:_.keyFormat)==="identity"&&!((d=we.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(we,j):this.loadFragment(we,j,xe)},S.getMaxBufferLength=function(){var _=R.prototype.getMaxBufferLength.call(this),d=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,O.PlaylistLevelType.MAIN);return d===null?_:Math.max(_,d.len)},S.onMediaDetaching=function(){this.videoBuffer=null,R.prototype.onMediaDetaching.call(this)},S.onAudioTracksUpdated=function(_,d){var u=d.audioTracks;this.resetTransmuxer(),this.levels=u.map(function(g){return new M.Level(g)})},S.onAudioTrackSwitching=function(_,d){var u=!!d.url;this.trackId=d.id;var g=this.fragCurrent;g!=null&&g.loader&&g.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),u?this.setInterval(w):this.resetTransmuxer(),u?(this.audioSwitch=!0,this.state=B.State.IDLE):this.state=B.State.STOPPED,this.tick()},S.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},S.onLevelLoaded=function(_,d){this.mainDetails=d.details},S.onAudioTrackLoaded=function(_,d){var u,g=this.levels,E=d.details,N=d.id;if(!g){this.warn("Audio tracks were reset while loading level "+N);return}this.log("Track "+N+" loaded ["+E.startSN+","+E.endSN+"],duration:"+E.totalduration);var D=g[N],H=0;if(E.live||(u=D.details)!==null&&u!==void 0&&u.live){var j=this.mainDetails;if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed||!j)return;!D.details&&E.hasProgramDateTime&&j.hasProgramDateTime?(Object(f.alignMediaPlaylistByPDT)(E,j),H=E.fragments[0].start):H=this.alignPlaylists(E,D.details)}D.details=E,this.levelLastLoaded=N,!this.startFragRequested&&(this.mainDetails||!E.live)&&this.setStartPosition(D.details,H),this.state===B.State.WAITING_TRACK&&!this.waitForCdnTuneIn(E)&&(this.state=B.State.IDLE),this.tick()},S._handleFragmentLoadProgress=function(_){var d,u=_.frag,g=_.part,E=_.payload,N=this.config,D=this.trackId,H=this.levels;if(!H){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+u.sn+" of level "+u.level+" will not be buffered");return}var j=H[D];console.assert(j,"Audio track is defined on fragment load progress");var I=j.details;console.assert(I,"Audio track details are defined on fragment load progress");var b=N.defaultAudioCodec||j.audioCodec||"mp4a.40.2",W=this.transmuxer;W||(W=this.transmuxer=new p.default(this.hls,O.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Y=this.initPTS[u.cc],ie=(d=u.initSegment)===null||d===void 0?void 0:d.data;if(Y!==void 0){var oe=!1,xe=g?g.index:-1,ve=xe!==-1,we=new h.ChunkMetadata(u.level,u.sn,u.stats.chunkCount,E.byteLength,xe,ve);W.push(E,ie,b,"",u,g,I.totalduration,oe,we,Y)}else{r.logger.log("Unknown video PTS for cc "+u.cc+", waiting for video PTS before demuxing audio frag "+u.sn+" of ["+I.startSN+" ,"+I.endSN+"],track "+D);var Ce=this.waitingData=this.waitingData||{frag:u,part:g,cache:new m.default,complete:!1},Se=Ce.cache;Se.push(new Uint8Array(E)),this.waitingVideoCC=this.videoTrackCC,this.state=B.State.WAITING_INIT_PTS}},S._handleFragmentLoadComplete=function(_){if(this.waitingData){this.waitingData.complete=!0;return}R.prototype._handleFragmentLoadComplete.call(this,_)},S.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},S.onBufferCreated=function(_,d){var u=d.tracks.audio;u&&(this.mediaBuffer=u.buffer),d.tracks.video&&(this.videoBuffer=d.tracks.video.buffer)},S.onFragBuffered=function(_,d){var u=d.frag,g=d.part;if(u.type!==O.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(u)){this.warn("Fragment "+u.sn+(g?" p: "+g.index:"")+" of level "+u.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}u.sn!=="initSegment"&&(this.fragPrevious=u,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(U.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(u,g)},S.onError=function(_,d){switch(d.details){case l.ErrorDetails.FRAG_LOAD_ERROR:case l.ErrorDetails.FRAG_LOAD_TIMEOUT:case l.ErrorDetails.KEY_LOAD_ERROR:case l.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(O.PlaylistLevelType.AUDIO,d);break;case l.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case l.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==B.State.ERROR&&this.state!==B.State.STOPPED&&(this.state=d.fatal?B.State.ERROR:B.State.IDLE,this.warn(d.details+" while loading frag, switching to "+this.state+" state"));break;case l.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="audio"&&(this.state===B.State.PARSING||this.state===B.State.PARSED)){var u=!0,g=this.getFwdBufferInfo(this.mediaBuffer,O.PlaylistLevelType.AUDIO);g&&g.len>.5&&(u=!this.reduceMaxBufferLength(g.len)),u&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,R.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},S.onBufferFlushed=function(_,d){var u=d.type;u===v.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},S._handleTransmuxComplete=function(_){var d,u="audio",g=this.hls,E=_.remuxResult,N=_.chunkMeta,D=this.getCurrentContext(N);if(!D){this.warn("The loading context changed while buffering fragment "+N.sn+" of level "+N.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(N.level);return}var H=D.frag,j=D.part,I=E.audio,b=E.text,W=E.id3,Y=E.initSegment;if(this.fragContextChanged(H))return;if(this.state=B.State.PARSING,this.audioSwitch&&I&&this.completeAudioSwitch(),Y!=null&&Y.tracks&&(this._bufferInitSegment(Y.tracks,H,N),g.trigger(U.Events.FRAG_PARSING_INIT_SEGMENT,{frag:H,id:u,tracks:Y.tracks})),I){var ie=I.startPTS,oe=I.endPTS,xe=I.startDTS,ve=I.endDTS;j&&(j.elementaryStreams[v.ElementaryStreamTypes.AUDIO]={startPTS:ie,endPTS:oe,startDTS:xe,endDTS:ve}),H.setElementaryStreamInfo(v.ElementaryStreamTypes.AUDIO,ie,oe,xe,ve),this.bufferFragmentData(I,H,j,N)}if(W!=null&&(d=W.samples)!==null&&d!==void 0&&d.length){var we=s({frag:H,id:u},W);g.trigger(U.Events.FRAG_PARSING_METADATA,we)}if(b){var Ce=s({frag:H,id:u},b);g.trigger(U.Events.FRAG_PARSING_USERDATA,Ce)}},S._bufferInitSegment=function(_,d,u){if(this.state!==B.State.PARSING)return;_.video&&delete _.video;var g=_.audio;if(!g)return;g.levelCodec=g.codec,g.id="audio",this.log("Init audio buffer, container:"+g.container+", codecs[parsed]=["+g.codec+"]"),this.hls.trigger(U.Events.BUFFER_CODECS,_);var E=g.initSegment;if(E!=null&&E.byteLength){var N={type:"audio",frag:d,part:null,chunkMeta:u,parent:d.type,data:E};this.hls.trigger(U.Events.BUFFER_APPENDING,N)}this.tick()},S.loadFragment=function(_,d,u){var g=this.fragmentTracker.getState(_);this.fragCurrent=_,(this.audioSwitch||g===G.FragmentState.NOT_LOADED||g===G.FragmentState.PARTIAL)&&(_.sn==="initSegment"?this._loadInitSegment(_):d.live&&!Object($.isFiniteNumber)(this.initPTS[_.cc])?(this.log("Waiting for video PTS in continuity counter "+_.cc+" of live stream before loading audio fragment "+_.sn+" of level "+this.trackId),this.state=B.State.WAITING_INIT_PTS):(this.startFragRequested=!0,R.prototype.loadFragment.call(this,_,d,u)))},S.completeAudioSwitch=function(){var _=this.hls,d=this.media,u=this.trackId;d&&(this.log("Switching audio track : flushing all audio"),R.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,_.trigger(U.Events.AUDIO_TRACK_SWITCHED,{id:u})},C}(B.default);Z.default=T},"./src/controller/audio-track-controller.ts":function(ue,Z,P){"use strict";P.r(Z);var $=P("./src/events.ts"),B=P("./src/errors.ts"),U=P("./src/controller/base-playlist-controller.ts"),K=P("./src/types/loader.ts");function G(p,h){for(var o=0;o<h.length;o++){var f=h[o];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(p,f.key,f)}}function M(p,h,o){return h&&G(p.prototype,h),o&&G(p,o),p}function O(p,h){p.prototype=Object.create(h.prototype),p.prototype.constructor=p,v(p,h)}function v(p,h){return v=Object.setPrototypeOf||function(f,l){return f.__proto__=l,f},v(p,h)}var m=function(p){O(h,p);function h(f){var l;return l=p.call(this,f,"[audio-track-controller]")||this,l.tracks=[],l.groupId=null,l.tracksInGroup=[],l.trackId=-1,l.trackName="",l.selectDefaultTrack=!0,l.registerListeners(),l}var o=h.prototype;return o.registerListeners=function(){var l=this.hls;l.on($.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.on($.Events.LEVEL_LOADING,this.onLevelLoading,this),l.on($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.on($.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on($.Events.ERROR,this.onError,this)},o.unregisterListeners=function(){var l=this.hls;l.off($.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this),l.off($.Events.LEVEL_LOADING,this.onLevelLoading,this),l.off($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),l.off($.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off($.Events.ERROR,this.onError,this)},o.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,p.prototype.destroy.call(this)},o.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},o.onManifestParsed=function(l,r){this.tracks=r.audioTracks||[]},o.onAudioTrackLoaded=function(l,r){var s=r.id,c=r.details,L=this.tracksInGroup[s];if(!L){this.warn("Invalid audio track id "+s);return}var w=L.details;L.details=r.details,this.log("audioTrack "+s+" loaded ["+c.startSN+"-"+c.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,r,w))},o.onLevelLoading=function(l,r){this.switchLevel(r.level)},o.onLevelSwitching=function(l,r){this.switchLevel(r.level)},o.switchLevel=function(l){var r=this.hls.levels[l];if(!(r!=null&&r.audioGroupIds))return;var s=r.audioGroupIds[r.urlId];if(this.groupId!==s){this.groupId=s;var c=this.tracks.filter(function(w){return!s||w.groupId===s});this.selectDefaultTrack&&!c.some(function(w){return w.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=c;var L={audioTracks:c};this.log("Updating audio tracks, "+c.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger($.Events.AUDIO_TRACKS_UPDATED,L),this.selectInitialTrack()}},o.onError=function(l,r){if(p.prototype.onError.call(this,l,r),r.fatal||!r.context)return;r.context.type===K.PlaylistContextType.AUDIO_TRACK&&r.context.id===this.trackId&&r.context.groupId===this.groupId&&this.retryLoadingOrFail(r)},o.setAudioTrack=function(l){var r=this.tracksInGroup;if(l<0||l>=r.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=r[this.trackId];this.log("Now switching to audio-track index "+l);var c=r[l],L=c.id,w=c.groupId,T=w===void 0?"":w,R=c.name,C=c.type,S=c.url;if(this.trackId=l,this.trackName=R,this.selectDefaultTrack=!1,this.hls.trigger($.Events.AUDIO_TRACK_SWITCHING,{id:L,groupId:T,name:R,type:C,url:S}),c.details&&!c.details.live)return;var x=this.switchParams(c.url,s==null?void 0:s.details);this.loadPlaylist(x)},o.selectInitialTrack=function(){var l=this.tracksInGroup;console.assert(l.length,"Initial audio track should be selected when tracks are known");var r=this.trackName,s=this.findTrackId(r)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger($.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},o.findTrackId=function(l){for(var r=this.tracksInGroup,s=0;s<r.length;s++){var c=r[s];if((!this.selectDefaultTrack||c.default)&&(!l||l===c.name))return c.id}return-1},o.loadPlaylist=function(l){var r=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(r)){var s=r.id,c=r.groupId,L=r.url;if(l)try{L=l.addDirectives(L)}catch(w){this.warn("Could not construct new URL with HLS Delivery Directives: "+w)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger($.Events.AUDIO_TRACK_LOADING,{url:L,id:s,groupId:c,deliveryDirectives:l||null})}},M(h,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(l){this.selectDefaultTrack=!1,this.setAudioTrack(l)}}]),h}(U.default);Z.default=m},"./src/controller/base-playlist-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return M});var $=P("./src/polyfills/number.ts"),B=P("./src/types/level.ts"),U=P("./src/controller/level-helper.ts"),K=P("./src/utils/logger.ts"),G=P("./src/errors.ts"),M=function(){function O(m,p){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=K.logger.log.bind(K.logger,p+":"),this.warn=K.logger.warn.bind(K.logger,p+":"),this.hls=m}var v=O.prototype;return v.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},v.onError=function(p,h){h.fatal&&h.type===G.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},v.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},v.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},v.stopLoad=function(){this.canLoad=!1,this.clearTimer()},v.switchParams=function(p,h){var o=h==null?void 0:h.renditionReports;if(o)for(var f=0;f<o.length;f++){var l=o[f],r=""+l.URI;if(r===p.substr(-r.length)){var s=parseInt(l["LAST-MSN"]),c=parseInt(l["LAST-PART"]);if(h&&this.hls.config.lowLatencyMode){var L=Math.min(h.age-h.partTarget,h.targetduration);c!==void 0&&L>h.partTarget&&(c+=1)}if(Object($.isFiniteNumber)(s))return new B.HlsUrlParameters(s,Object($.isFiniteNumber)(c)?c:void 0,B.HlsSkip.No)}}},v.loadPlaylist=function(p){},v.shouldLoadTrack=function(p){return this.canLoad&&p&&!!p.url&&(!p.details||p.details.live)},v.playlistLoaded=function(p,h,o){var f=this,l=h.details,r=h.stats,s=r.loading.end?Math.max(0,self.performance.now()-r.loading.end):0;if(l.advancedDateTime=Date.now()-s,l.live||o!=null&&o.live){if(l.reloaded(o),o&&this.log("live playlist "+p+" "+(l.advanced?"REFRESHED "+l.lastPartSn+"-"+l.lastPartIndex:"MISSED")),o&&l.fragments.length>0&&Object(U.mergeDetails)(o,l),!this.canLoad||!l.live)return;var c,L=void 0,w=void 0;if(l.canBlockReload&&l.endSN&&l.advanced){var T=this.hls.config.lowLatencyMode,R=l.lastPartSn,C=l.endSN,S=l.lastPartIndex,x=S!==-1,_=R===C,d=T?0:S;x?(L=_?C+1:R,w=_?d:S+1):L=C+1;var u=l.age,g=u+l.ageHeader,E=Math.min(g-l.partTarget,l.targetduration*1.5);if(E>0){if(o&&E>o.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+o.tuneInGoal+" to: "+E+" with playlist age: "+l.age),E=0;else{var N=Math.floor(E/l.targetduration);if(L+=N,w!==void 0){var D=Math.round(E%l.targetduration/l.partTarget);w+=D}this.log("CDN Tune-in age: "+l.ageHeader+"s last advanced "+u.toFixed(2)+"s goal: "+E+" skip sn "+N+" to part "+w)}l.tuneInGoal=E}if(c=this.getDeliveryDirectives(l,h.deliveryDirectives,L,w),T||!_){this.loadPlaylist(c);return}}else c=this.getDeliveryDirectives(l,h.deliveryDirectives,L,w);var H=Object(U.computeReloadInterval)(l,r);L!==void 0&&l.canBlockReload&&(H-=l.partTarget||1),this.log("reload live playlist "+p+" in "+Math.round(H)+" ms"),this.timer=self.setTimeout(function(){return f.loadPlaylist(c)},H)}else this.clearTimer()},v.getDeliveryDirectives=function(p,h,o,f){var l=Object(B.getSkipValue)(p,o);return h!=null&&h.skip&&p.deltaUpdateFailed&&(o=h.msn,f=h.part,l=B.HlsSkip.No),new B.HlsUrlParameters(o,f,l)},v.retryLoadingOrFail=function(p){var h=this,o=this.hls.config,f=this.retryCount<o.levelLoadingMaxRetry;if(f){var l;if(this.retryCount++,p.details.indexOf("LoadTimeOut")>-1&&(l=p.context)!==null&&l!==void 0&&l.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+p.details+'"'),this.loadPlaylist();else{var r=Math.min(Math.pow(2,this.retryCount)*o.levelLoadingRetryDelay,o.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return h.loadPlaylist()},r),this.warn("retry playlist loading #"+this.retryCount+" in "+r+' ms after "'+p.details+'"')}}else this.warn('cannot recover from error "'+p.details+'"'),this.clearTimer(),p.fatal=!0;return f},O}()},"./src/controller/base-stream-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"State",function(){return C}),P.d(Z,"default",function(){return S});var $=P("./src/polyfills/number.ts"),B=P("./src/task-loop.ts"),U=P("./src/controller/fragment-tracker.ts"),K=P("./src/utils/buffer-helper.ts"),G=P("./src/utils/logger.ts"),M=P("./src/events.ts"),O=P("./src/errors.ts"),v=P("./src/types/transmuxer.ts"),m=P("./src/utils/mp4-tools.ts"),p=P("./src/utils/discontinuities.ts"),h=P("./src/controller/fragment-finders.ts"),o=P("./src/controller/level-helper.ts"),f=P("./src/loader/fragment-loader.ts"),l=P("./src/crypt/decrypter.ts"),r=P("./src/utils/time-ranges.ts"),s=P("./src/types/loader.ts");function c(x,_){for(var d=0;d<_.length;d++){var u=_[d];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(x,u.key,u)}}function L(x,_,d){return _&&c(x.prototype,_),d&&c(x,d),x}function w(x){if(x===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x}function T(x,_){x.prototype=Object.create(_.prototype),x.prototype.constructor=x,R(x,_)}function R(x,_){return R=Object.setPrototypeOf||function(u,g){return u.__proto__=g,u},R(x,_)}var C={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},S=function(x){T(_,x);function _(u,g,E){var N;return N=x.call(this)||this,N.hls=void 0,N.fragPrevious=null,N.fragCurrent=null,N.fragmentTracker=void 0,N.transmuxer=null,N._state=C.STOPPED,N.media=void 0,N.mediaBuffer=void 0,N.config=void 0,N.bitrateTest=!1,N.lastCurrentTime=0,N.nextLoadPosition=0,N.startPosition=0,N.loadedmetadata=!1,N.fragLoadError=0,N.retryDate=0,N.levels=null,N.fragmentLoader=void 0,N.levelLastLoaded=null,N.startFragRequested=!1,N.decrypter=void 0,N.initPTS=[],N.onvseeking=null,N.onvended=null,N.logPrefix="",N.log=void 0,N.warn=void 0,N.logPrefix=E,N.log=G.logger.log.bind(G.logger,E+":"),N.warn=G.logger.warn.bind(G.logger,E+":"),N.hls=u,N.fragmentLoader=new f.default(u.config),N.fragmentTracker=g,N.config=u.config,N.decrypter=new l.default(u,u.config),u.on(M.Events.KEY_LOADED,N.onKeyLoaded,w(N)),N}var d=_.prototype;return d.doTick=function(){this.onTickEnd()},d.onTickEnd=function(){},d.startLoad=function(g){},d.stopLoad=function(){this.fragmentLoader.abort();var g=this.fragCurrent;g&&this.fragmentTracker.removeFragment(g),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=C.STOPPED},d._streamEnded=function(g,E){var N=this.fragCurrent,D=this.fragmentTracker;if(!E.live&&N&&N.sn===E.endSN&&!g.nextStart){var H=D.getState(N);return H===U.FragmentState.PARTIAL||H===U.FragmentState.OK}return!1},d.onMediaAttached=function(g,E){var N=this.media=this.mediaBuffer=E.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),N.addEventListener("seeking",this.onvseeking),N.addEventListener("ended",this.onvended);var D=this.config;this.levels&&D.autoStartLoad&&this.state===C.STOPPED&&this.startLoad(D.startPosition)},d.onMediaDetaching=function(){var g=this.media;g!=null&&g.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),g&&(g.removeEventListener("seeking",this.onvseeking),g.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},d.onMediaSeeking=function(){var g=this.config,E=this.fragCurrent,N=this.media,D=this.mediaBuffer,H=this.state,j=N?N.currentTime:0,I=K.BufferHelper.bufferInfo(D||N,j,g.maxBufferHole);if(this.log("media seeking to "+(Object($.isFiniteNumber)(j)?j.toFixed(3):j)+", state: "+H),H===C.ENDED)this.resetLoadingState();else if(E&&!I.len){var b=g.maxFragLookUpTolerance,W=E.start-b,Y=E.start+E.duration+b,ie=j>Y;(j<W||ie)&&(ie&&E.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),E.loader.abort()),this.resetLoadingState())}N&&(this.lastCurrentTime=j),!this.loadedmetadata&&!I.len&&(this.nextLoadPosition=this.startPosition=j),this.tickImmediate()},d.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},d.onKeyLoaded=function(g,E){if(this.state!==C.KEY_LOADING||E.frag!==this.fragCurrent||!this.levels)return;this.state=C.IDLE;var N=this.levels[E.frag.level].details;N&&this.loadFragment(E.frag,N,E.frag.start)},d.onHandlerDestroying=function(){this.stopLoad(),x.prototype.onHandlerDestroying.call(this)},d.onHandlerDestroyed=function(){this.state=C.STOPPED,this.hls.off(M.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,x.prototype.onHandlerDestroyed.call(this)},d.loadKey=function(g,E){this.log("Loading key for "+g.sn+" of ["+E.startSN+"-"+E.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level),this.state=C.KEY_LOADING,this.fragCurrent=g,this.hls.trigger(M.Events.KEY_LOADING,{frag:g})},d.loadFragment=function(g,E,N){this._loadFragForPlayback(g,E,N)},d._loadFragForPlayback=function(g,E,N){var D=this,H=function(I){if(D.fragContextChanged(g)){D.warn("Fragment "+g.sn+(I.part?" p: "+I.part.index:"")+" of level "+g.level+" was dropped during download."),D.fragmentTracker.removeFragment(g);return}g.stats.chunkCount++,D._handleFragmentLoadProgress(I)};this._doFragLoad(g,E,N,H).then(function(j){if(!j)return;D.fragLoadError=0;var I=D.state;if(D.fragContextChanged(g)){(I===C.FRAG_LOADING||I===C.BACKTRACKING||!D.fragCurrent&&I===C.PARSING)&&(D.fragmentTracker.removeFragment(g),D.state=C.IDLE);return}if("payload"in j&&(D.log("Loaded fragment "+g.sn+" of level "+g.level),D.hls.trigger(M.Events.FRAG_LOADED,j),D.state===C.BACKTRACKING)){D.fragmentTracker.backtrack(g,j),D.resetFragmentLoading(g);return}D._handleFragmentLoadComplete(j)}).catch(function(j){D.warn(j),D.resetFragmentLoading(g)})},d.flushMainBuffer=function(g,E,N){if(N===void 0&&(N=null),!(g-E))return;var D={startOffset:g,endOffset:E,type:N};this.fragLoadError=0,this.hls.trigger(M.Events.BUFFER_FLUSHING,D)},d._loadInitSegment=function(g){var E=this;this._doFragLoad(g).then(function(N){if(!N||E.fragContextChanged(g)||!E.levels)throw new Error("init load aborted");return N}).then(function(N){var D=E.hls,H=N.payload,j=g.decryptdata;if(H&&H.byteLength>0&&j&&j.key&&j.iv&&j.method==="AES-128"){var I=self.performance.now();return E.decrypter.webCryptoDecrypt(new Uint8Array(H),j.key.buffer,j.iv.buffer).then(function(b){var W=self.performance.now();return D.trigger(M.Events.FRAG_DECRYPTED,{frag:g,payload:b,stats:{tstart:I,tdecrypt:W}}),N.payload=b,N})}return N}).then(function(N){var D=E.fragCurrent,H=E.hls,j=E.levels;if(!j)throw new Error("init load aborted, missing levels");var I=j[g.level].details;console.assert(I,"Level details are defined when init segment is loaded");var b=g.stats;E.state=C.IDLE,E.fragLoadError=0,g.data=new Uint8Array(N.payload),b.parsing.start=b.buffering.start=self.performance.now(),b.parsing.end=b.buffering.end=self.performance.now(),N.frag===D&&H.trigger(M.Events.FRAG_BUFFERED,{stats:b,frag:D,part:null,id:g.type}),E.tick()}).catch(function(N){E.warn(N),E.resetFragmentLoading(g)})},d.fragContextChanged=function(g){var E=this.fragCurrent;return!g||!E||g.level!==E.level||g.sn!==E.sn||g.urlId!==E.urlId},d.fragBufferedComplete=function(g,E){var N=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+g.type+" sn: "+g.sn+(E?" part: "+E.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level+" "+r.default.toString(K.BufferHelper.getBuffered(N))),this.state=C.IDLE,this.tick()},d._handleFragmentLoadComplete=function(g){var E=this.transmuxer;if(!E)return;var N=g.frag,D=g.part,H=g.partsLoaded,j=!H||H.length===0||H.some(function(b){return!b}),I=new v.ChunkMetadata(N.level,N.sn,N.stats.chunkCount+1,0,D?D.index:-1,!j);E.flush(I)},d._handleFragmentLoadProgress=function(g){},d._doFragLoad=function(g,E,N,D){var H=this;if(N===void 0&&(N=null),!this.levels)throw new Error("frag load aborted, missing levels");if(N=Math.max(g.start,N||0),this.config.lowLatencyMode&&E){var j=E.partList;if(j&&D){N>g.end&&E.fragmentHint&&(g=E.fragmentHint);var I=this.getNextPart(j,g,N);if(I>-1){var b=j[I];return this.log("Loading part sn: "+g.sn+" p: "+b.index+" cc: "+g.cc+" of playlist ["+E.startSN+"-"+E.endSN+"] parts [0-"+I+"-"+(j.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(N.toFixed(3))),this.nextLoadPosition=b.start+b.duration,this.state=C.FRAG_LOADING,this.hls.trigger(M.Events.FRAG_LOADING,{frag:g,part:j[I],targetBufferTime:N}),this.doFragPartsLoad(g,j,I,D).catch(function(W){return H.handleFragLoadError(W)})}else if(!g.url||this.loadedEndOfParts(j,N))return Promise.resolve(null)}}return this.log("Loading fragment "+g.sn+" cc: "+g.cc+" "+(E?"of ["+E.startSN+"-"+E.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(N.toFixed(3))),Object($.isFiniteNumber)(g.sn)&&!this.bitrateTest&&(this.nextLoadPosition=g.start+g.duration),this.state=C.FRAG_LOADING,this.hls.trigger(M.Events.FRAG_LOADING,{frag:g,targetBufferTime:N}),this.fragmentLoader.load(g,D).catch(function(W){return H.handleFragLoadError(W)})},d.doFragPartsLoad=function(g,E,N,D){var H=this;return new Promise(function(j,I){var b=[],W=function Y(ie){var oe=E[ie];H.fragmentLoader.loadPart(g,oe,D).then(function(xe){b[oe.index]=xe;var ve=xe.part;H.hls.trigger(M.Events.FRAG_LOADED,xe);var we=E[ie+1];if(we&&we.fragment===g)Y(ie+1);else return j({frag:g,part:ve,partsLoaded:b})}).catch(I)};W(N)})},d.handleFragLoadError=function(g){var E=g.data;return E&&E.details===O.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(E.frag,E.part):this.hls.trigger(M.Events.ERROR,E),null},d._handleTransmuxerFlush=function(g){var E=this.getCurrentContext(g);if(!E||this.state!==C.PARSING){this.fragCurrent||(this.state=C.IDLE);return}var N=E.frag,D=E.part,H=E.level,j=self.performance.now();N.stats.parsing.end=j,D&&(D.stats.parsing.end=j),this.updateLevelTiming(N,D,H,g.partial)},d.getCurrentContext=function(g){var E=this.levels,N=g.level,D=g.sn,H=g.part;if(!E||!E[N])return this.warn("Levels object was unset while buffering fragment "+D+" of level "+N+". The current chunk will not be buffered."),null;var j=E[N],I=H>-1?Object(o.getPartWith)(j,D,H):null,b=I?I.fragment:Object(o.getFragmentWithSN)(j,D,this.fragCurrent);return b?{frag:b,part:I,level:j}:null},d.bufferFragmentData=function(g,E,N,D){if(!g||this.state!==C.PARSING)return;var H=g.data1,j=g.data2,I=H;if(H&&j&&(I=Object(m.appendUint8Array)(H,j)),!I||!I.length)return;var b={type:g.type,frag:E,part:N,chunkMeta:D,parent:E.type,data:I};this.hls.trigger(M.Events.BUFFER_APPENDING,b),g.dropped&&g.independent&&!N&&this.flushBufferGap(E)},d.flushBufferGap=function(g){var E=this.media;if(!E)return;if(!K.BufferHelper.isBuffered(E,E.currentTime)){this.flushMainBuffer(0,g.start);return}var N=E.currentTime,D=K.BufferHelper.bufferInfo(E,N,0),H=g.duration,j=Math.min(this.config.maxFragLookUpTolerance*2,H*.25),I=Math.max(Math.min(g.start-j,D.end-j),N+j);g.start-I>j&&this.flushMainBuffer(I,g.start)},d.getFwdBufferInfo=function(g,E){var N=this.config,D=this.getLoadPosition();if(!Object($.isFiniteNumber)(D))return null;var H=K.BufferHelper.bufferInfo(g,D,N.maxBufferHole);if(H.len===0&&H.nextStart!==void 0){var j=this.fragmentTracker.getBufferedFrag(D,E);if(j&&H.nextStart<j.end)return K.BufferHelper.bufferInfo(g,D,Math.max(H.nextStart,N.maxBufferHole))}return H},d.getMaxBufferLength=function(g){var E=this.config,N;return g?N=Math.max(8*E.maxBufferSize/g,E.maxBufferLength):N=E.maxBufferLength,Math.min(N,E.maxMaxBufferLength)},d.reduceMaxBufferLength=function(g){var E=this.config,N=g||E.maxBufferLength;return E.maxMaxBufferLength>=N?(E.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+E.maxMaxBufferLength+"s"),!0):!1},d.getNextFragment=function(g,E){var N,D,H=E.fragments,j=H.length;if(!j)return null;var I=this.config,b=H[0].start,W;if(E.live){var Y=I.initialLiveManifestSize;if(j<Y)return this.warn("Not enough fragments to start playback (have: "+j+", need: "+Y+")"),null;!E.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(W=this.getInitialLiveFragment(E,H),this.startPosition=W?this.hls.liveSyncPosition||W.start:g)}else g<=b&&(W=H[0]);if(!W){var ie=I.lowLatencyMode?E.partEnd:E.fragmentEnd;W=this.getFragmentAtPosition(g,ie,E)}return(N=W)!==null&&N!==void 0&&N.initSegment&&!((D=W)!==null&&D!==void 0&&D.initSegment.data)&&!this.bitrateTest&&(W=W.initSegment),W},d.getNextPart=function(g,E,N){for(var D=-1,H=!1,j=!0,I=0,b=g.length;I<b;I++){var W=g[I];if(j=j&&!W.independent,D>-1&&N<W.start)break;var Y=W.loaded;!Y&&(H||W.independent||j)&&W.fragment===E&&(D=I),H=Y}return D},d.loadedEndOfParts=function(g,E){var N=g[g.length-1];return N&&E>N.start&&N.loaded},d.getInitialLiveFragment=function(g,E){var N=this.fragPrevious,D=null;if(N){if(g.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+N.programDateTime),D=Object(h.findFragmentByPDT)(E,N.endProgramDateTime,this.config.maxFragLookUpTolerance)),!D){var H=N.sn+1;if(H>=g.startSN&&H<=g.endSN){var j=E[H-g.startSN];N.cc===j.cc&&(D=j,this.log("Live playlist, switching playlist, load frag with next SN: "+D.sn))}D||(D=Object(h.findFragWithCC)(E,N.cc),D&&this.log("Live playlist, switching playlist, load frag with same CC: "+D.sn))}}else{var I=this.hls.liveSyncPosition;I!==null&&(D=this.getFragmentAtPosition(I,this.bitrateTest?g.fragmentEnd:g.edge,g))}return D},d.getFragmentAtPosition=function(g,E,N){var D=this.config,H=this.fragPrevious,j=N.fragments,I=N.endSN,b=N.fragmentHint,W=D.maxFragLookUpTolerance,Y=!!(D.lowLatencyMode&&N.partList&&b);Y&&b&&!this.bitrateTest&&(j=j.concat(b),I=b.sn);var ie;if(g<E){var oe=g>E-W?0:W;ie=Object(h.findFragmentByPTS)(H,j,g,oe)}else ie=j[j.length-1];if(ie){var xe=ie.sn-N.startSN,ve=H&&ie.level===H.level,we=j[xe+1],Ce=this.fragmentTracker.getState(ie);if(Ce===U.FragmentState.BACKTRACKED){ie=null;for(var Se=xe;j[Se]&&this.fragmentTracker.getState(j[Se])===U.FragmentState.BACKTRACKED;)H?ie=j[Se--]:ie=j[--Se];ie||(ie=we)}else H&&ie.sn===H.sn&&!Y&&(ve&&(ie.sn<I&&this.fragmentTracker.getState(we)!==U.FragmentState.OK?(this.log("SN "+ie.sn+" just loaded, load next one: "+we.sn),ie=we):ie=null))}return ie},d.synchronizeToLiveEdge=function(g){var E=this.config,N=this.media;if(!N)return;var D=this.hls.liveSyncPosition,H=N.currentTime,j=g.fragments[0].start,I=g.edge,b=H>=j-E.maxFragLookUpTolerance&&H<=I;if(D!==null&&N.duration>D&&(H<D||!b)){var W=E.liveMaxLatencyDuration!==void 0?E.liveMaxLatencyDuration:E.liveMaxLatencyDurationCount*g.targetduration;(!b&&N.readyState<4||H<I-W)&&(this.loadedmetadata||(this.nextLoadPosition=D),N.readyState&&(this.warn("Playback: "+H.toFixed(3)+" is located too far from the end of live sliding playlist: "+I+", reset currentTime to : "+D.toFixed(3)),N.currentTime=D))}},d.alignPlaylists=function(g,E){var N=this.levels,D=this.levelLastLoaded,H=this.fragPrevious,j=D!==null?N[D]:null,I=g.fragments.length;if(!I)return this.warn("No fragments in live playlist"),0;var b=g.fragments[0].start,W=!E,Y=g.alignedSliding&&Object($.isFiniteNumber)(b);if(W||!Y&&!b){Object(p.alignStream)(H,j,g);var ie=g.fragments[0].start;return this.log("Live playlist sliding: "+ie.toFixed(2)+" start-sn: "+(E?E.startSN:"na")+"->"+g.startSN+" prev-sn: "+(H?H.sn:"na")+" fragments: "+I),ie}return b},d.waitForCdnTuneIn=function(g){var E=3;return g.live&&g.canBlockReload&&g.tuneInGoal>Math.max(g.partHoldBack,g.partTarget*E)},d.setStartPosition=function(g,E){var N=this.startPosition;if(N<E&&(N=-1),N===-1||this.lastCurrentTime===-1){var D=g.startTimeOffset;Object($.isFiniteNumber)(D)?(N=E+D,D<0&&(N+=g.totalduration),N=Math.min(Math.max(E,N),E+g.totalduration),this.log("Start time offset "+D+" found in playlist, adjust startPosition to "+N),this.startPosition=N):g.live?N=this.hls.liveSyncPosition||E:this.startPosition=N=0,this.lastCurrentTime=N}this.nextLoadPosition=N},d.getLoadPosition=function(){var g=this.media,E=0;return this.loadedmetadata&&g?E=g.currentTime:this.nextLoadPosition&&(E=this.nextLoadPosition),E},d.handleFragLoadAborted=function(g,E){this.transmuxer&&g.sn!=="initSegment"&&g.stats.aborted&&(this.warn("Fragment "+g.sn+(E?" part"+E.index:"")+" of level "+g.level+" was aborted"),this.resetFragmentLoading(g))},d.resetFragmentLoading=function(g){(!this.fragCurrent||!this.fragContextChanged(g))&&(this.state=C.IDLE)},d.onFragmentOrKeyLoadError=function(g,E){if(E.fatal)return;var N=E.frag;if(!N||N.type!==g)return;var D=this.fragCurrent;console.assert(D&&N.sn===D.sn&&N.level===D.level&&N.urlId===D.urlId,"Frag load error must match current frag to retry");var H=this.config;if(this.fragLoadError+1<=H.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(N.level))return;var j=Math.min(Math.pow(2,this.fragLoadError)*H.fragLoadingRetryDelay,H.fragLoadingMaxRetryTimeout);this.warn("Fragment "+N.sn+" of "+g+" "+N.level+" failed to load, retrying in "+j+"ms"),this.retryDate=self.performance.now()+j,this.fragLoadError++,this.state=C.FRAG_LOADING_WAITING_RETRY}else E.levelRetry?(g===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=C.IDLE):(G.logger.error(E.details+" reaches max retry, redispatch as fatal ..."),E.fatal=!0,this.hls.stopLoad(),this.state=C.ERROR)},d.afterBufferFlushed=function(g,E,N){if(!g)return;var D=K.BufferHelper.getBuffered(g);this.fragmentTracker.detectEvictedFragments(E,D,N),this.state===C.ENDED&&this.resetLoadingState()},d.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=C.IDLE},d.resetLiveStartWhenNotLoaded=function(g){if(!this.loadedmetadata){this.startFragRequested=!1;var E=this.levels?this.levels[g].details:null;if(E!=null&&E.live)return this.startPosition=-1,this.setStartPosition(E,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},d.updateLevelTiming=function(g,E,N,D){var H=this,j=N.details;console.assert(!!j,"level.details must be defined");var I=Object.keys(g.elementaryStreams).reduce(function(b,W){var Y=g.elementaryStreams[W];if(Y){var ie=Y.endPTS-Y.startPTS;if(ie<=0)return H.warn("Could not parse fragment "+g.sn+" "+W+" duration reliably ("+ie+") resetting transmuxer to fallback to playlist timing"),H.resetTransmuxer(),b||!1;var oe=D?0:Object(o.updateFragPTSDTS)(j,g,Y.startPTS,Y.endPTS,Y.startDTS,Y.endDTS);return H.hls.trigger(M.Events.LEVEL_PTS_UPDATED,{details:j,level:N,drift:oe,type:W,frag:g,start:Y.startPTS,end:Y.endPTS}),!0}return b},!1);I?(this.state=C.PARSED,this.hls.trigger(M.Events.FRAG_PARSED,{frag:g,part:E})):this.resetLoadingState()},d.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},L(_,[{key:"state",get:function(){return this._state},set:function(g){var E=this._state;E!==g&&(this._state=g,this.log(E+"->"+g))}}]),_}(B.default)},"./src/controller/buffer-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return h});var $=P("./src/polyfills/number.ts"),B=P("./src/events.ts"),U=P("./src/utils/logger.ts"),K=P("./src/errors.ts"),G=P("./src/utils/buffer-helper.ts"),M=P("./src/utils/mediasource-helper.ts"),O=P("./src/loader/fragment.ts"),v=P("./src/controller/buffer-operation-queue.ts"),m=Object(M.getMediaSource)(),p=/([ha]vc.)(?:\.[^.,]+)+/,h=function(){function o(l){var r=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 s=r.hls,c=r.media,L=r.mediaSource;U.logger.log("[buffer-controller]: Media source opened"),c&&(r.updateMediaElementDuration(),s.trigger(B.Events.MEDIA_ATTACHED,{media:c})),L&&L.removeEventListener("sourceopen",r._onMediaSourceOpen),r.checkPendingTracks()},this._onMediaSourceClose=function(){U.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){U.logger.log("[buffer-controller]: Media source ended")},this.hls=l,this._initSourceBuffer(),this.registerListeners()}var f=o.prototype;return f.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},f.destroy=function(){this.unregisterListeners(),this.details=null},f.registerListeners=function(){var r=this.hls;r.on(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),r.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.on(B.Events.BUFFER_RESET,this.onBufferReset,this),r.on(B.Events.BUFFER_APPENDING,this.onBufferAppending,this),r.on(B.Events.BUFFER_CODECS,this.onBufferCodecs,this),r.on(B.Events.BUFFER_EOS,this.onBufferEos,this),r.on(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),r.on(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),r.on(B.Events.FRAG_PARSED,this.onFragParsed,this),r.on(B.Events.FRAG_CHANGED,this.onFragChanged,this)},f.unregisterListeners=function(){var r=this.hls;r.off(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),r.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.off(B.Events.BUFFER_RESET,this.onBufferReset,this),r.off(B.Events.BUFFER_APPENDING,this.onBufferAppending,this),r.off(B.Events.BUFFER_CODECS,this.onBufferCodecs,this),r.off(B.Events.BUFFER_EOS,this.onBufferEos,this),r.off(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),r.off(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),r.off(B.Events.FRAG_PARSED,this.onFragParsed,this),r.off(B.Events.FRAG_CHANGED,this.onFragChanged,this)},f._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new v.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},f.onManifestParsed=function(r,s){var c=2;(s.audio&&!s.video||!s.altAudio)&&(c=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=c,this.details=null,U.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},f.onMediaAttaching=function(r,s){var c=this.media=s.media;if(c&&m){var L=this.mediaSource=new m;L.addEventListener("sourceopen",this._onMediaSourceOpen),L.addEventListener("sourceended",this._onMediaSourceEnded),L.addEventListener("sourceclose",this._onMediaSourceClose),c.src=self.URL.createObjectURL(L),this._objectUrl=c.src}},f.onMediaDetaching=function(){var r=this.media,s=this.mediaSource,c=this._objectUrl;if(s){if(U.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(L){U.logger.warn("[buffer-controller]: onMediaDetaching: "+L.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),r&&(c&&self.URL.revokeObjectURL(c),r.src===c?(r.removeAttribute("src"),r.load()):U.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(B.Events.MEDIA_DETACHED,void 0)},f.onBufferReset=function(){var r=this;this.getSourceBufferTypes().forEach(function(s){var c=r.sourceBuffer[s];try{c&&(r.removeBufferListeners(s),r.mediaSource&&r.mediaSource.removeSourceBuffer(c),r.sourceBuffer[s]=void 0)}catch(L){U.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",L)}}),this._initSourceBuffer()},f.onBufferCodecs=function(r,s){var c=this,L=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(w){if(L){var T=c.tracks[w];if(T&&typeof T.buffer.changeType=="function"){var R=s[w],C=R.codec,S=R.levelCodec,x=R.container,_=(T.levelCodec||T.codec).replace(p,"$1"),d=(S||C).replace(p,"$1");if(_!==d){var u=x+";codecs="+(S||C);c.appendChangeType(w,u)}}}else c.pendingTracks[w]=s[w]}),L)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},f.appendChangeType=function(r,s){var c=this,L=this.operationQueue,w={execute:function(){var R=c.sourceBuffer[r];R&&(U.logger.log("[buffer-controller]: changing "+r+" sourceBuffer type to "+s),R.changeType(s)),L.shiftAndExecuteNext(r)},onStart:function(){},onComplete:function(){},onError:function(R){U.logger.warn("[buffer-controller]: Failed to change "+r+" SourceBuffer type",R)}};L.append(w,r)},f.onBufferAppending=function(r,s){var c=this,L=this.hls,w=this.operationQueue,T=this.tracks,R=s.data,C=s.type,S=s.frag,x=s.part,_=s.chunkMeta,d=_.buffering[C],u=self.performance.now();d.start=u;var g=S.stats.buffering,E=x?x.stats.buffering:null;g.start===0&&(g.start=u),E&&E.start===0&&(E.start=u);var N=T.audio,D=C==="audio"&&_.id===1&&(N==null?void 0:N.container)==="audio/mpeg",H={execute:function(){if(d.executeStart=self.performance.now(),D){var I=c.sourceBuffer[C];if(I){var b=S.start-I.timestampOffset;Math.abs(b)>=.1&&(U.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+S.start+" (delta: "+b+") sn: "+S.sn+")"),I.timestampOffset=S.start)}}c.appendExecutor(R,C)},onStart:function(){},onComplete:function(){var I=self.performance.now();d.executeEnd=d.end=I,g.first===0&&(g.first=I),E&&E.first===0&&(E.first=I);var b=c.sourceBuffer,W={};for(var Y in b)W[Y]=G.BufferHelper.getBuffered(b[Y]);c.appendError=0,c.hls.trigger(B.Events.BUFFER_APPENDED,{type:C,frag:S,part:x,chunkMeta:_,parent:S.type,timeRanges:W})},onError:function(I){U.logger.error("[buffer-controller]: Error encountered while trying to append to the "+C+" SourceBuffer",I);var b={type:K.ErrorTypes.MEDIA_ERROR,parent:S.type,details:K.ErrorDetails.BUFFER_APPEND_ERROR,err:I,fatal:!1};I.code===DOMException.QUOTA_EXCEEDED_ERR?b.details=K.ErrorDetails.BUFFER_FULL_ERROR:(c.appendError++,b.details=K.ErrorDetails.BUFFER_APPEND_ERROR,c.appendError>L.config.appendErrorMaxRetry&&(U.logger.error("[buffer-controller]: Failed "+L.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),b.fatal=!0)),L.trigger(B.Events.ERROR,b)}};w.append(H,C)},f.onBufferFlushing=function(r,s){var c=this,L=this.operationQueue,w=function(R){return{execute:c.removeExecutor.bind(c,R,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){c.hls.trigger(B.Events.BUFFER_FLUSHED,{type:R})},onError:function(S){U.logger.warn("[buffer-controller]: Failed to remove from "+R+" SourceBuffer",S)}}};s.type?L.append(w(s.type),s.type):this.getSourceBufferTypes().forEach(function(T){L.append(w(T),T)})},f.onFragParsed=function(r,s){var c=this,L=s.frag,w=s.part,T=[],R=w?w.elementaryStreams:L.elementaryStreams;R[O.ElementaryStreamTypes.AUDIOVIDEO]?T.push("audiovideo"):(R[O.ElementaryStreamTypes.AUDIO]&&T.push("audio"),R[O.ElementaryStreamTypes.VIDEO]&&T.push("video"));var C=function(){var x=self.performance.now();L.stats.buffering.end=x,w&&(w.stats.buffering.end=x);var _=w?w.stats:L.stats;c.hls.trigger(B.Events.FRAG_BUFFERED,{frag:L,part:w,stats:_,id:L.type})};T.length===0&&U.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+L.type+" level: "+L.level+" sn: "+L.sn),this.blockBuffers(C,T)},f.onFragChanged=function(r,s){this.flushBackBuffer()},f.onBufferEos=function(r,s){var c=this,L=this.getSourceBufferTypes().reduce(function(w,T){var R=c.sourceBuffer[T];return(!s.type||s.type===T)&&(R&&!R.ended&&(R.ended=!0,U.logger.log("[buffer-controller]: "+T+" sourceBuffer now EOS"))),w&&!!(!R||R.ended)},!0);L&&this.blockBuffers(function(){var w=c.mediaSource;if(!w||w.readyState!=="open")return;w.endOfStream()})},f.onLevelUpdated=function(r,s){var c=s.details;if(!c.fragments.length)return;this.details=c,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},f.flushBackBuffer=function(){var r=this.hls,s=this.details,c=this.media,L=this.sourceBuffer;if(!c||s===null)return;var w=this.getSourceBufferTypes();if(!w.length)return;var T=s.live&&r.config.liveBackBufferLength!==null?r.config.liveBackBufferLength:r.config.backBufferLength;if(!Object($.isFiniteNumber)(T)||T<0)return;var R=c.currentTime,C=s.levelTargetDuration,S=Math.max(T,C),x=Math.floor(R/C)*C-S;w.forEach(function(_){var d=L[_];if(d){var u=G.BufferHelper.getBuffered(d);u.length>0&&x>u.start(0)&&(r.trigger(B.Events.BACK_BUFFER_REACHED,{bufferEnd:x}),s.live&&r.trigger(B.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:x}),r.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:x,type:_}))}})},f.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var r=this.details,s=this.hls,c=this.media,L=this.mediaSource,w=r.fragments[0].start+r.totalduration,T=c.duration,R=Object($.isFiniteNumber)(L.duration)?L.duration:0;r.live&&s.config.liveDurationInfinity?(U.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),L.duration=Infinity,this.updateSeekableRange(r)):(w>R&&w>T||!Object($.isFiniteNumber)(T))&&(U.logger.log("[buffer-controller]: Updating Media Source duration to "+w.toFixed(3)),L.duration=w)},f.updateSeekableRange=function(r){var s=this.mediaSource,c=r.fragments,L=c.length;if(L&&r.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var w=Math.max(0,c[0].start),T=Math.max(w,w+r.totalduration);s.setLiveSeekableRange(w,T)}},f.checkPendingTracks=function(){var r=this.bufferCodecEventsExpected,s=this.operationQueue,c=this.pendingTracks,L=Object.keys(c).length;if(L&&!r||L===2){this.createSourceBuffers(c),this.pendingTracks={};var w=this.getSourceBufferTypes();if(w.length===0){this.hls.trigger(B.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}w.forEach(function(T){s.executeNext(T)})}},f.createSourceBuffers=function(r){var s=this.sourceBuffer,c=this.mediaSource;if(!c)throw Error("createSourceBuffers called when mediaSource was null");var L=0;for(var w in r)if(!s[w]){var T=r[w];if(!T)throw Error("source buffer exists for track "+w+", however track does not");var R=T.levelCodec||T.codec,C=T.container+";codecs="+R;U.logger.log("[buffer-controller]: creating sourceBuffer("+C+")");try{var S=s[w]=c.addSourceBuffer(C),x=w;this.addBufferListener(x,"updatestart",this._onSBUpdateStart),this.addBufferListener(x,"updateend",this._onSBUpdateEnd),this.addBufferListener(x,"error",this._onSBUpdateError),this.tracks[w]={buffer:S,codec:R,container:T.container,levelCodec:T.levelCodec,id:T.id},L++}catch(_){U.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+_.message),this.hls.trigger(B.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:_,mimeType:C})}}L&&this.hls.trigger(B.Events.BUFFER_CREATED,{tracks:this.tracks})},f._onSBUpdateStart=function(r){var s=this.operationQueue,c=s.current(r);c.onStart()},f._onSBUpdateEnd=function(r){var s=this.operationQueue,c=s.current(r);c.onComplete(),s.shiftAndExecuteNext(r)},f._onSBUpdateError=function(r,s){U.logger.error("[buffer-controller]: "+r+" SourceBuffer error",s),this.hls.trigger(B.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var c=this.operationQueue.current(r);c&&c.onError(s)},f.removeExecutor=function(r,s,c){var L=this.media,w=this.mediaSource,T=this.operationQueue,R=this.sourceBuffer,C=R[r];if(!L||!w||!C){U.logger.warn("[buffer-controller]: Attempting to remove from the "+r+" SourceBuffer, but it does not exist"),T.shiftAndExecuteNext(r);return}var S=Object($.isFiniteNumber)(L.duration)?L.duration:Infinity,x=Object($.isFiniteNumber)(w.duration)?w.duration:Infinity,_=Math.max(0,s),d=Math.min(c,S,x);d>_?(U.logger.log("[buffer-controller]: Removing ["+_+","+d+"] from the "+r+" SourceBuffer"),console.assert(!C.updating,r+" sourceBuffer must not be updating"),C.remove(_,d)):T.shiftAndExecuteNext(r)},f.appendExecutor=function(r,s){var c=this.operationQueue,L=this.sourceBuffer,w=L[s];if(!w){U.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),c.shiftAndExecuteNext(s);return}w.ended=!1,console.assert(!w.updating,s+" sourceBuffer must not be updating"),w.appendBuffer(r)},f.blockBuffers=function(r,s){var c=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){U.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(r);return}var L=this.operationQueue,w=s.map(function(T){return L.appendBlocker(T)});Promise.all(w).then(function(){r(),s.forEach(function(T){var R=c.sourceBuffer[T];(!R||!R.updating)&&L.shiftAndExecuteNext(T)})})},f.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},f.addBufferListener=function(r,s,c){var L=this.sourceBuffer[r];if(!L)return;var w=c.bind(this,r);this.listeners[r].push({event:s,listener:w}),L.addEventListener(s,w)},f.removeBufferListeners=function(r){var s=this.sourceBuffer[r];if(!s)return;this.listeners[r].forEach(function(c){s.removeEventListener(c.event,c.listener)})},o}()},"./src/controller/buffer-operation-queue.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return B});var $=P("./src/utils/logger.ts"),B=function(){function U(G){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=G}var K=U.prototype;return K.append=function(M,O){var v=this.queues[O];v.push(M),v.length===1&&this.buffers[O]&&this.executeNext(O)},K.insertAbort=function(M,O){var v=this.queues[O];v.unshift(M),this.executeNext(O)},K.appendBlocker=function(M){var O,v=new Promise(function(p){O=p}),m={execute:O,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(m,M),v},K.executeNext=function(M){var O=this.buffers,v=this.queues,m=O[M],p=v[M];if(p.length){var h=p[0];try{h.execute()}catch(o){$.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),h.onError(o),(!m||!m.updating)&&(p.shift(),this.executeNext(M))}}},K.shiftAndExecuteNext=function(M){this.queues[M].shift(),this.executeNext(M)},K.current=function(M){return this.queues[M][0]},U}()},"./src/controller/cap-level-controller.ts":function(ue,Z,P){"use strict";P.r(Z);var $=P("./src/events.ts");function B(G,M){for(var O=0;O<M.length;O++){var v=M[O];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(G,v.key,v)}}function U(G,M,O){return M&&B(G.prototype,M),O&&B(G,O),G}var K=function(){function G(O){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=O,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var M=G.prototype;return M.setStreamController=function(v){this.streamController=v},M.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},M.registerListeners=function(){var v=this.hls;v.on($.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),v.on($.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),v.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this),v.on($.Events.BUFFER_CODECS,this.onBufferCodecs,this),v.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},M.unregisterListener=function(){var v=this.hls;v.off($.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),v.off($.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),v.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this),v.off($.Events.BUFFER_CODECS,this.onBufferCodecs,this),v.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},M.onFpsDropLevelCapping=function(v,m){G.isLevelAllowed(m.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(m.droppedLevel)},M.onMediaAttaching=function(v,m){this.media=m.media instanceof HTMLVideoElement?m.media:null},M.onManifestParsed=function(v,m){var p=this.hls;this.restrictedLevels=[],this.firstLevel=m.firstLevel,p.config.capLevelToPlayerSize&&m.video&&this.startCapping()},M.onBufferCodecs=function(v,m){var p=this.hls;p.config.capLevelToPlayerSize&&m.video&&this.startCapping()},M.onMediaDetaching=function(){this.stopCapping()},M.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var v=this.hls.levels;if(v.length){var m=this.hls;m.autoLevelCapping=this.getMaxLevel(v.length-1),m.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=m.autoLevelCapping}}},M.getMaxLevel=function(v){var m=this,p=this.hls.levels;if(!p.length)return-1;var h=p.filter(function(o,f){return G.isLevelAllowed(f,m.restrictedLevels)&&f<=v});return this.clientRect=null,G.getMaxLevelByMediaSize(h,this.mediaWidth,this.mediaHeight)},M.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()},M.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},M.getDimensions=function(){if(this.clientRect)return this.clientRect;var v=this.media,m={width:0,height:0};if(v){var p=v.getBoundingClientRect();m.width=p.width,m.height=p.height,!m.width&&!m.height&&(m.width=p.right-p.left||v.width||0,m.height=p.bottom-p.top||v.height||0)}return this.clientRect=m,m},G.isLevelAllowed=function(v,m){return m===void 0&&(m=[]),m.indexOf(v)===-1},G.getMaxLevelByMediaSize=function(v,m,p){if(!v||!v.length)return-1;for(var h=function(s,c){return c?s.width!==c.width||s.height!==c.height:!0},o=v.length-1,f=0;f<v.length;f+=1){var l=v[f];if((l.width>=m||l.height>=p)&&h(l,v[f+1])){o=f;break}}return o},U(G,[{key:"mediaWidth",get:function(){return this.getDimensions().width*G.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*G.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var v=1;try{v=self.devicePixelRatio}catch(m){}return v}}]),G}();Z.default=K},"./src/controller/cmcd-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return h});var $=P("./src/events.ts"),B=P("./src/types/cmcd.ts"),U=P("./src/utils/buffer-helper.ts"),K=P("./src/utils/logger.ts");function G(o,f){for(var l=0;l<f.length;l++){var r=f[l];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(o,r.key,r)}}function M(o,f,l){return f&&G(o.prototype,f),l&&G(o,l),o}function O(o,f){var l=typeof Symbol!="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(l)return(l=l.call(o)).next.bind(l);if(Array.isArray(o)||(l=v(o))||f&&o&&typeof o.length=="number"){l&&(o=l);var r=0;return function(){return r>=o.length?{done:!0}:{done:!1,value:o[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v(o,f){if(!o)return;if(typeof o=="string")return m(o,f);var l=Object.prototype.toString.call(o).slice(8,-1);if(l==="Object"&&o.constructor&&(l=o.constructor.name),l==="Map"||l==="Set")return Array.from(o);if(l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return m(o,f)}function m(o,f){(f==null||f>o.length)&&(f=o.length);for(var l=0,r=new Array(f);l<f;l++)r[l]=o[l];return r}function p(){return p=Object.assign||function(o){for(var f=1;f<arguments.length;f++){var l=arguments[f];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(o[r]=l[r])}return o},p.apply(this,arguments)}var h=function(){function o(l){var r=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(){r.initialized&&(r.starved=!0),r.buffering=!0},this.onPlaying=function(){r.initialized||(r.initialized=!0),r.buffering=!1},this.applyPlaylistData=function(L){try{r.apply(L,{ot:B.CMCDObjectType.MANIFEST,su:!r.initialized})}catch(w){K.logger.warn("Could not generate manifest CMCD data.",w)}},this.applyFragmentData=function(L){try{var w=L.frag,T=r.hls.levels[w.level],R=r.getObjectType(w),C={d:w.duration*1e3,ot:R};(R===B.CMCDObjectType.VIDEO||R===B.CMCDObjectType.AUDIO||R==B.CMCDObjectType.MUXED)&&(C.br=T.bitrate/1e3,C.tb=r.getTopBandwidth(R),C.bl=r.getBufferLength(R)),r.apply(L,C)}catch(S){K.logger.warn("Could not generate segment CMCD data.",S)}},this.hls=l;var s=this.config=l.config,c=s.cmcd;c!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=c.sessionId||o.uuid(),this.cid=c.contentId,this.useHeaders=c.useHeaders===!0,this.registerListeners())}var f=o.prototype;return f.registerListeners=function(){var r=this.hls;r.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.on($.Events.MEDIA_DETACHED,this.onMediaDetached,this),r.on($.Events.BUFFER_CREATED,this.onBufferCreated,this)},f.unregisterListeners=function(){var r=this.hls;r.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.off($.Events.MEDIA_DETACHED,this.onMediaDetached,this),r.off($.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},f.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},f.onMediaAttached=function(r,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},f.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},f.onBufferCreated=function(r,s){var c,L;this.audioBuffer=(c=s.tracks.audio)===null||c===void 0?void 0:c.buffer,this.videoBuffer=(L=s.tracks.video)===null||L===void 0?void 0:L.buffer},f.createData=function(){var r;return{v:B.CMCDVersion,sf:B.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(r=this.media)===null||r===void 0?void 0:r.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},f.apply=function(r,s){s===void 0&&(s={}),p(s,this.createData());var c=s.ot===B.CMCDObjectType.INIT||s.ot===B.CMCDObjectType.VIDEO||s.ot===B.CMCDObjectType.MUXED;if(this.starved&&c&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var L=o.toHeaders(s);if(!Object.keys(L).length)return;r.headers||(r.headers={}),p(r.headers,L)}else{var w=o.toQuery(s);if(!w)return;r.url=o.appendQueryToUri(r.url,w)}},f.getObjectType=function(r){var s=r.type;return s==="subtitle"?B.CMCDObjectType.TIMED_TEXT:r.sn==="initSegment"?B.CMCDObjectType.INIT:s==="audio"?B.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?B.CMCDObjectType.VIDEO:B.CMCDObjectType.MUXED:void 0},f.getTopBandwidth=function(r){for(var s=0,c=r===B.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,L=O(c),w;!(w=L()).done;){var T=w.value;T.bitrate>s&&(s=T.bitrate)}return s>0?s:NaN},f.getBufferLength=function(r){var s=this.hls.media,c=r===B.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!c||!s)return NaN;var L=U.BufferHelper.bufferInfo(c,s.currentTime,this.config.maxBufferHole);return L.len*1e3},f.createPlaylistLoader=function(){var r=this.config.pLoader,s=this.applyPlaylistData,c=r||this.config.loader;return function(){function L(T){this.loader=void 0,this.loader=new c(T)}var w=L.prototype;return w.destroy=function(){this.loader.destroy()},w.abort=function(){this.loader.abort()},w.load=function(R,C,S){s(R),this.loader.load(R,C,S)},M(L,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),L}()},f.createFragmentLoader=function(){var r=this.config.fLoader,s=this.applyFragmentData,c=r||this.config.loader;return function(){function L(T){this.loader=void 0,this.loader=new c(T)}var w=L.prototype;return w.destroy=function(){this.loader.destroy()},w.abort=function(){this.loader.abort()},w.load=function(R,C,S){s(R),this.loader.load(R,C,S)},M(L,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),L}()},o.uuid=function(){var r=URL.createObjectURL(new Blob),s=r.toString();return URL.revokeObjectURL(r),s.substr(s.lastIndexOf("/")+1)},o.serialize=function(r){for(var s=[],c=function(D){return!Number.isNaN(D)&&D!=null&&D!==""&&D!==!1},L=function(D){return Math.round(D)},w=function(D){return L(D/100)*100},T=function(D){return encodeURIComponent(D)},R={br:L,d:L,bl:w,dl:w,mtp:w,nor:T,rtp:w,tb:L},C=Object.keys(r||{}).sort(),S=O(C),x;!(x=S()).done;){var _=x.value,d=r[_];if(!c(d))continue;if(_==="v"&&d===1)continue;if(_=="pr"&&d===1)continue;var u=R[_];u&&(d=u(d));var g=typeof d,E=void 0;_==="ot"||_==="sf"||_==="st"?E=_+"="+d:g==="boolean"?E=_:g==="number"?E=_+"="+d:E=_+"="+JSON.stringify(d),s.push(E)}return s.join(",")},o.toHeaders=function(r){for(var s=Object.keys(r),c={},L=["Object","Request","Session","Status"],w=[{},{},{},{}],T={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},R=0,C=s;R<C.length;R++){var S=C[R],x=T[S]!=null?T[S]:1;w[x][S]=r[S]}for(var _=0;_<w.length;_++){var d=o.serialize(w[_]);d&&(c["CMCD-"+L[_]]=d)}return c},o.toQuery=function(r){return"CMCD="+encodeURIComponent(o.serialize(r))},o.appendQueryToUri=function(r,s){if(!s)return r;var c=r.includes("?")?"&":"?";return""+r+c+s},o}()},"./src/controller/eme-controller.ts":function(ue,Z,P){"use strict";P.r(Z);var $=P("./src/events.ts"),B=P("./src/errors.ts"),U=P("./src/utils/logger.ts"),K=P("./src/utils/mediakeys-helper.ts");function G(h,o){for(var f=0;f<o.length;f++){var l=o[f];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(h,l.key,l)}}function M(h,o,f){return o&&G(h.prototype,o),f&&G(h,f),h}var O=3,v=function(o,f,l){var r={audioCapabilities:[],videoCapabilities:[]};return o.forEach(function(s){r.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:l.audioRobustness||""})}),f.forEach(function(s){r.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:l.videoRobustness||""})}),[r]},m=function(o,f,l,r){switch(o){case K.KeySystems.WIDEVINE:return v(f,l,r);default:throw new Error("Unknown key-system: "+o)}},p=function(){function h(f){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=f,this._config=f.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 o=h.prototype;return o.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},o._registerListeners=function(){this.hls.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on($.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this)},o._unregisterListeners=function(){this.hls.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off($.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this)},o.getLicenseServerUrl=function(l){switch(l){case K.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+l+'"')},o._attemptKeySystemAccess=function(l,r,s){var c=this,L=m(l,r,s,this._drmSystemOptions);U.logger.log("Requesting encrypted media key-system access");var w=this.requestMediaKeySystemAccess(l,L);this.mediaKeysPromise=w.then(function(T){return c._onMediaKeySystemAccessObtained(l,T)}),w.catch(function(T){U.logger.error('Failed to obtain key-system "'+l+'" access:',T)})},o._onMediaKeySystemAccessObtained=function(l,r){var s=this;U.logger.log('Access for key-system "'+l+'" obtained');var c={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:r,mediaKeySystemDomain:l};this._mediaKeysList.push(c);var L=Promise.resolve().then(function(){return r.createMediaKeys()}).then(function(w){return c.mediaKeys=w,U.logger.log('Media-keys created for key-system "'+l+'"'),s._onMediaKeysCreated(),w});return L.catch(function(w){U.logger.error("Failed to create media-keys:",w)}),L},o._onMediaKeysCreated=function(){var l=this;this._mediaKeysList.forEach(function(r){r.mediaKeysSession||(r.mediaKeysSession=r.mediaKeys.createSession(),l._onNewMediaKeySession(r.mediaKeysSession))})},o._onNewMediaKeySession=function(l){var r=this;U.logger.log("New key-system session "+l.sessionId),l.addEventListener("message",function(s){r._onKeySessionMessage(l,s.message)},!1)},o._onKeySessionMessage=function(l,r){U.logger.log("Got EME message event, creating license request"),this._requestLicense(r,function(s){U.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),l.update(s)})},o.onMediaEncrypted=function(l){var r=this;if(U.logger.log('Media is encrypted using "'+l.initDataType+'" init data type'),!this.mediaKeysPromise){U.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger($.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(L){if(!r._media)return;r._attemptSetMediaKeys(L),r._generateRequestWithPreferredKeySession(l.initDataType,l.initData)};this.mediaKeysPromise.then(s).catch(s)},o._attemptSetMediaKeys=function(l){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var r=this._mediaKeysList[0];if(!r||!r.mediaKeys){U.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger($.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}U.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(r.mediaKeys),this._hasSetMediaKeys=!0}},o._generateRequestWithPreferredKeySession=function(l,r){var s=this,c=this._mediaKeysList[0];if(!c){U.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger($.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(c.mediaKeysSessionInitialized){U.logger.warn("Key-Session already initialized but requested again");return}var L=c.mediaKeysSession;if(!L){U.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger($.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!r){U.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger($.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}U.logger.log('Generating key-session request for "'+l+'" init data type'),c.mediaKeysSessionInitialized=!0,L.generateRequest(l,r).then(function(){U.logger.debug("Key-session generation succeeded")}).catch(function(w){U.logger.error("Error generating key-session request:",w),s.hls.trigger($.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},o._createLicenseXhr=function(l,r,s){var c=new XMLHttpRequest;c.responseType="arraybuffer",c.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,c,l,r,s);var L=this._licenseXhrSetup;if(L)try{L.call(this.hls,c,l),L=void 0}catch(w){U.logger.error(w)}try{c.readyState||c.open("POST",l,!0),L&&L.call(this.hls,c,l)}catch(w){throw new Error("issue setting up KeySystem license XHR "+w)}return c},o._onLicenseRequestReadyStageChange=function(l,r,s,c){switch(l.readyState){case 4:if(l.status===200){this._requestLicenseFailureCount=0,U.logger.log("License request succeeded");var L=l.response,w=this._licenseResponseCallback;if(w)try{L=w.call(this.hls,l,r)}catch(R){U.logger.error(R)}c(L)}else{if(U.logger.error("License Request XHR failed ("+r+"). Status: "+l.status+" ("+l.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>O){this.hls.trigger($.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var T=O-this._requestLicenseFailureCount+1;U.logger.warn("Retrying license request, "+T+" attempts left"),this._requestLicense(s,c)}break}},o._generateLicenseRequestChallenge=function(l,r){switch(l.mediaKeySystemDomain){case K.KeySystems.WIDEVINE:return r}throw new Error("unsupported key-system: "+l.mediaKeySystemDomain)},o._requestLicense=function(l,r){U.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){U.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger($.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var c=this.getLicenseServerUrl(s.mediaKeySystemDomain),L=this._createLicenseXhr(c,l,r);U.logger.log("Sending license request to URL: "+c);var w=this._generateLicenseRequestChallenge(s,l);L.send(w)}catch(T){U.logger.error("Failure requesting DRM license: "+T),this.hls.trigger($.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},o.onMediaAttached=function(l,r){if(!this._emeEnabled)return;var s=r.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},o.onMediaDetached=function(){var l=this._media,r=this._mediaKeysList;if(!l)return;l.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(r.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return l.setMediaKeys(null)}).catch(function(){})},o.onManifestParsed=function(l,r){if(!this._emeEnabled)return;var s=r.levels.map(function(L){return L.audioCodec}).filter(function(L){return!!L}),c=r.levels.map(function(L){return L.videoCodec}).filter(function(L){return!!L});this._attemptKeySystemAccess(K.KeySystems.WIDEVINE,s,c)},M(h,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),h}();Z.default=p},"./src/controller/fps-controller.ts":function(ue,Z,P){"use strict";P.r(Z);var $=P("./src/events.ts"),B=P("./src/utils/logger.ts"),U=function(){function K(M){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=M,this.registerListeners()}var G=K.prototype;return G.setStreamController=function(O){this.streamController=O},G.registerListeners=function(){this.hls.on($.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},G.unregisterListeners=function(){this.hls.off($.Events.MEDIA_ATTACHING,this.onMediaAttaching)},G.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},G.onMediaAttaching=function(O,v){var m=this.hls.config;if(m.capLevelOnFPSDrop){var p=v.media instanceof self.HTMLVideoElement?v.media:null;this.media=p,p&&typeof p.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),m.fpsDroppedMonitoringPeriod)}},G.checkFPS=function(O,v,m){var p=performance.now();if(v){if(this.lastTime){var h=p-this.lastTime,o=m-this.lastDroppedFrames,f=v-this.lastDecodedFrames,l=1e3*o/h,r=this.hls;if(r.trigger($.Events.FPS_DROP,{currentDropped:o,currentDecoded:f,totalDroppedFrames:m}),l>0&&o>r.config.fpsDroppedMonitoringThreshold*f){var s=r.currentLevel;B.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(r.autoLevelCapping===-1||r.autoLevelCapping>=s)&&(s=s-1,r.trigger($.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:r.currentLevel}),r.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=p,this.lastDroppedFrames=m,this.lastDecodedFrames=v}},G.checkFPSInterval=function(){var O=this.media;if(O)if(this.isVideoPlaybackQualityAvailable){var v=O.getVideoPlaybackQuality();this.checkFPS(O,v.totalVideoFrames,v.droppedVideoFrames)}else this.checkFPS(O,O.webkitDecodedFrameCount,O.webkitDroppedFrameCount)},K}();Z.default=U},"./src/controller/fragment-finders.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"findFragmentByPDT",function(){return U}),P.d(Z,"findFragmentByPTS",function(){return K}),P.d(Z,"fragmentWithinToleranceTest",function(){return G}),P.d(Z,"pdtWithinToleranceTest",function(){return M}),P.d(Z,"findFragWithCC",function(){return O});var $=P("./src/polyfills/number.ts"),B=P("./src/utils/binary-search.ts");function U(v,m,p){if(m===null||!Array.isArray(v)||!v.length||!Object($.isFiniteNumber)(m))return null;var h=v[0].programDateTime;if(m<(h||0))return null;var o=v[v.length-1].endProgramDateTime;if(m>=(o||0))return null;p=p||0;for(var f=0;f<v.length;++f){var l=v[f];if(M(m,p,l))return l}return null}function K(v,m,p,h){p===void 0&&(p=0),h===void 0&&(h=0);var o=null;if(v?o=m[v.sn-m[0].sn+1]||null:p===0&&m[0].start===0&&(o=m[0]),o&&G(p,h,o)===0)return o;var f=B.default.search(m,G.bind(null,p,h));return f||o}function G(v,m,p){v===void 0&&(v=0),m===void 0&&(m=0);var h=Math.min(m,p.duration+(p.deltaPTS?p.deltaPTS:0));return p.start+p.duration-h<=v?1:p.start-h>v&&p.start?-1:0}function M(v,m,p){var h=Math.min(m,p.duration+(p.deltaPTS?p.deltaPTS:0))*1e3,o=p.endProgramDateTime||0;return o-h>v}function O(v,m){return B.default.search(v,function(p){return p.cc<m?1:p.cc>m?-1:0})}},"./src/controller/fragment-tracker.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"FragmentState",function(){return U}),P.d(Z,"FragmentTracker",function(){return K});var $=P("./src/events.ts"),B=P("./src/types/loader.ts"),U;(function(O){O.NOT_LOADED="NOT_LOADED",O.BACKTRACKED="BACKTRACKED",O.APPENDING="APPENDING",O.PARTIAL="PARTIAL",O.OK="OK"})(U||(U={}));var K=function(){function O(m){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=m,this._registerListeners()}var v=O.prototype;return v._registerListeners=function(){var p=this.hls;p.on($.Events.BUFFER_APPENDED,this.onBufferAppended,this),p.on($.Events.FRAG_BUFFERED,this.onFragBuffered,this),p.on($.Events.FRAG_LOADED,this.onFragLoaded,this)},v._unregisterListeners=function(){var p=this.hls;p.off($.Events.BUFFER_APPENDED,this.onBufferAppended,this),p.off($.Events.FRAG_BUFFERED,this.onFragBuffered,this),p.off($.Events.FRAG_LOADED,this.onFragLoaded,this)},v.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},v.getAppendedFrag=function(p,h){if(h===B.PlaylistLevelType.MAIN){var o=this.activeFragment,f=this.activeParts;if(!o)return null;if(f)for(var l=f.length;l--;){var r=f[l],s=r?r.end:o.appendedPTS;if(r.start<=p&&s!==void 0&&p<=s)return l>9&&(this.activeParts=f.slice(l-9)),r}else if(o.start<=p&&o.appendedPTS!==void 0&&p<=o.appendedPTS)return o}return this.getBufferedFrag(p,h)},v.getBufferedFrag=function(p,h){for(var o=this.fragments,f=Object.keys(o),l=f.length;l--;){var r=o[f[l]];if((r==null?void 0:r.body.type)===h&&r.buffered){var s=r.body;if(s.start<=p&&p<=s.end)return s}}return null},v.detectEvictedFragments=function(p,h,o){var f=this;Object.keys(this.fragments).forEach(function(l){var r=f.fragments[l];if(!r)return;if(!r.buffered){r.body.type===o&&f.removeFragment(r.body);return}var s=r.range[p];if(!s)return;s.time.some(function(c){var L=!f.isTimeBuffered(c.startPTS,c.endPTS,h);return L&&f.removeFragment(r.body),L})})},v.detectPartialFragments=function(p){var h=this,o=this.timeRanges,f=p.frag,l=p.part;if(!o||f.sn==="initSegment")return;var r=M(f),s=this.fragments[r];if(!s)return;Object.keys(o).forEach(function(c){var L=f.elementaryStreams[c];if(!L)return;var w=o[c],T=l!==null||L.partial===!0;s.range[c]=h.getBufferedTimes(f,l,T,w)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},v.fragBuffered=function(p){var h=M(p),o=this.fragments[h];o&&(o.backtrack=o.loaded=null,o.buffered=!0)},v.getBufferedTimes=function(p,h,o,f){for(var l={time:[],partial:o},r=h?h.start:p.start,s=h?h.end:p.end,c=p.minEndPTS||s,L=p.maxStartPTS||r,w=0;w<f.length;w++){var T=f.start(w)-this.bufferPadding,R=f.end(w)+this.bufferPadding;if(L>=T&&c<=R){l.time.push({startPTS:Math.max(r,f.start(w)),endPTS:Math.min(s,f.end(w))});break}else if(r<R&&s>T)l.partial=!0,l.time.push({startPTS:Math.max(r,f.start(w)),endPTS:Math.min(s,f.end(w))});else if(s<=T)break}return l},v.getPartialFragment=function(p){var h=null,o,f,l,r=0,s=this.bufferPadding,c=this.fragments;return Object.keys(c).forEach(function(L){var w=c[L];if(!w)return;G(w)&&(f=w.body.start-s,l=w.body.end+s,p>=f&&p<=l&&(o=Math.min(p-f,l-p),r<=o&&(h=w.body,r=o)))}),h},v.getState=function(p){var h=M(p),o=this.fragments[h];return o?o.buffered?G(o)?U.PARTIAL:U.OK:o.backtrack?U.BACKTRACKED:U.APPENDING:U.NOT_LOADED},v.backtrack=function(p,h){var o=M(p),f=this.fragments[o];if(!f||f.backtrack)return null;var l=f.backtrack=h||f.loaded;return f.loaded=null,l},v.getBacktrackData=function(p){var h=M(p),o=this.fragments[h];if(o){var f,l=o.backtrack;if(l!=null&&(f=l.payload)!==null&&f!==void 0&&f.byteLength)return l;this.removeFragment(p)}return null},v.isTimeBuffered=function(p,h,o){for(var f,l,r=0;r<o.length;r++){if(f=o.start(r)-this.bufferPadding,l=o.end(r)+this.bufferPadding,p>=f&&h<=l)return!0;if(h<=f)return!1}return!1},v.onFragLoaded=function(p,h){var o=h.frag,f=h.part;if(o.sn==="initSegment"||o.bitrateTest||f)return;var l=M(o);this.fragments[l]={body:o,loaded:h,backtrack:null,buffered:!1,range:Object.create(null)}},v.onBufferAppended=function(p,h){var o=this,f=h.frag,l=h.part,r=h.timeRanges;if(f.type===B.PlaylistLevelType.MAIN)if(this.activeFragment=f,l){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(l)}else this.activeParts=null;this.timeRanges=r,Object.keys(r).forEach(function(c){var L=r[c];if(o.detectEvictedFragments(c,L),!l)for(var w=0;w<L.length;w++)f.appendedPTS=Math.max(L.end(w),f.appendedPTS||0)})},v.onFragBuffered=function(p,h){this.detectPartialFragments(h)},v.hasFragment=function(p){var h=M(p);return!!this.fragments[h]},v.removeFragmentsInRange=function(p,h,o){var f=this;Object.keys(this.fragments).forEach(function(l){var r=f.fragments[l];if(!r)return;if(r.buffered){var s=r.body;s.type===o&&s.start<h&&s.end>p&&f.removeFragment(s)}})},v.removeFragment=function(p){var h=M(p);p.stats.loaded=0,p.clearElementaryStreamInfo(),delete this.fragments[h]},v.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},O}();function G(O){var v,m;return O.buffered&&(((v=O.range.video)===null||v===void 0?void 0:v.partial)||((m=O.range.audio)===null||m===void 0?void 0:m.partial))}function M(O){return O.type+"_"+O.level+"_"+O.urlId+"_"+O.sn}},"./src/controller/gap-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"STALL_MINIMUM_DURATION_MS",function(){return G}),P.d(Z,"MAX_START_GAP_JUMP",function(){return M}),P.d(Z,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return O}),P.d(Z,"SKIP_BUFFER_RANGE_START",function(){return v}),P.d(Z,"default",function(){return m});var $=P("./src/utils/buffer-helper.ts"),B=P("./src/errors.ts"),U=P("./src/events.ts"),K=P("./src/utils/logger.ts"),G=250,M=2,O=.1,v=.05,m=function(){function p(o,f,l,r){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=o,this.media=f,this.fragmentTracker=l,this.hls=r}var h=p.prototype;return h.destroy=function(){this.hls=this.fragmentTracker=this.media=null},h.poll=function(f){var l=this.config,r=this.media,s=this.stalled,c=r.currentTime,L=r.seeking,w=this.seeking&&!L,T=!this.seeking&&L;if(this.seeking=L,c!==f){if(this.moved=!0,s!==null){if(this.stallReported){var R=self.performance.now()-s;K.logger.warn("playback not stuck anymore @"+c+", after "+Math.round(R)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((T||w)&&(this.stalled=null),r.paused||r.ended||r.playbackRate===0||!$.BufferHelper.getBuffered(r).length)return;var C=$.BufferHelper.bufferInfo(r,c,0),S=C.len>0,x=C.nextStart||0;if(!S&&!x)return;if(L){var _=C.len>M,d=!x||x-c>M&&!this.fragmentTracker.getPartialFragment(c);if(_||d)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var u,g=Math.max(x,C.start||0)-c,E=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,N=E==null||((u=E.details)===null||u===void 0)?void 0:u.live,D=N?E.details.targetduration*2:M;if(g>0&&g<=D){this._trySkipBufferHole(null);return}}var H=self.performance.now();if(s===null){this.stalled=H;return}var j=H-s;!L&&j>=G&&this._reportStall(C.len);var I=$.BufferHelper.bufferInfo(r,c,l.maxBufferHole);this._tryFixBufferStall(I,j)},h._tryFixBufferStall=function(f,l){var r=this.config,s=this.fragmentTracker,c=this.media,L=c.currentTime,w=s.getPartialFragment(L);if(w){var T=this._trySkipBufferHole(w);if(T)return}f.len>r.maxBufferHole&&l>r.highBufferWatchdogPeriod*1e3&&(K.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},h._reportStall=function(f){var l=this.hls,r=this.media,s=this.stallReported;s||(this.stallReported=!0,K.logger.warn("Playback stalling at @"+r.currentTime+" due to low buffer (buffer="+f+")"),l.trigger(U.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:f}))},h._trySkipBufferHole=function(f){for(var l=this.config,r=this.hls,s=this.media,c=s.currentTime,L=0,w=$.BufferHelper.getBuffered(s),T=0;T<w.length;T++){var R=w.start(T);if(c+l.maxBufferHole>=L&&c<R){var C=Math.max(R+v,s.currentTime+O);return K.logger.warn("skipping hole, adjusting currentTime from "+c+" to "+C),this.moved=!0,this.stalled=null,s.currentTime=C,f&&r.trigger(U.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+c+" to "+C,frag:f}),C}L=w.end(T)}return 0},h._tryNudgeBuffer=function(){var f=this.config,l=this.hls,r=this.media,s=r.currentTime,c=(this.nudgeRetry||0)+1;if(this.nudgeRetry=c,c<f.nudgeMaxRetry){var L=s+c*f.nudgeOffset;K.logger.warn("Nudging 'currentTime' from "+s+" to "+L),r.currentTime=L,l.trigger(U.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else K.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+f.nudgeMaxRetry+" nudges"),l.trigger(U.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},p}()},"./src/controller/id3-track-controller.ts":function(ue,Z,P){"use strict";P.r(Z);var $=P("./src/events.ts"),B=P("./src/utils/texttrack-utils.ts"),U=P("./src/demux/id3.ts"),K=.25,G=function(){function M(v){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=v,this._registerListeners()}var O=M.prototype;return O.destroy=function(){this._unregisterListeners()},O._registerListeners=function(){var m=this.hls;m.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.on($.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),m.on($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},O._unregisterListeners=function(){var m=this.hls;m.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.off($.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),m.off($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},O.onMediaAttached=function(m,p){this.media=p.media},O.onMediaDetaching=function(){if(!this.id3Track)return;Object(B.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},O.getID3Track=function(m){if(!this.media)return;for(var p=0;p<m.length;p++){var h=m[p];if(h.kind==="metadata"&&h.label==="id3")return Object(B.sendAddTrackEvent)(h,this.media),h}return this.media.addTextTrack("metadata","id3")},O.onFragParsingMetadata=function(m,p){if(!this.media)return;var h=p.frag,o=p.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var f=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,l=0;l<o.length;l++){var r=U.getID3Frames(o[l].data);if(r){var s=o[l].pts,c=l<o.length-1?o[l+1].pts:h.end,L=c-s;L<=0&&(c=s+K);for(var w=0;w<r.length;w++){var T=r[w];if(!U.isTimeStampFrame(T)){var R=new f(s,c,"");R.value=T,this.id3Track.addCue(R)}}}}},O.onBufferFlushing=function(m,p){var h=p.startOffset,o=p.endOffset,f=p.type;if(!f||f==="audio"){var l=this.id3Track;l&&Object(B.removeCuesInRange)(l,h,o)}},M}();Z.default=G},"./src/controller/latency-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return M});var $=P("./src/errors.ts"),B=P("./src/events.ts"),U=P("./src/utils/logger.ts");function K(O,v){for(var m=0;m<v.length;m++){var p=v[m];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(O,p.key,p)}}function G(O,v,m){return v&&K(O.prototype,v),m&&K(O,m),O}var M=function(){function O(m){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=m,this.config=m.config,this.registerListeners()}var v=O.prototype;return v.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},v.registerListeners=function(){this.hls.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(B.Events.ERROR,this.onError,this)},v.unregisterListeners=function(){this.hls.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(B.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(B.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(B.Events.ERROR,this.onError)},v.onMediaAttached=function(p,h){this.media=h.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},v.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},v.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},v.onLevelUpdated=function(p,h){var o=h.details;this.levelDetails=o,o.advanced&&this.timeupdate(),!o.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},v.onError=function(p,h){if(h.details!==$.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,U.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},v.timeupdate=function(){var p=this.media,h=this.levelDetails;if(!p||!h)return;this.currentTime=p.currentTime;var o=this.computeLatency();if(o===null)return;this._latency=o;var f=this.config,l=f.lowLatencyMode,r=f.maxLiveSyncPlaybackRate;if(!l||r===1)return;var s=this.targetLatency;if(s===null)return;var c=o-s,L=Math.min(this.maxLatency,s+h.targetduration),w=c<L;if(h.live&&w&&c>.05&&this.forwardBufferLength>1){var T=Math.min(2,Math.max(1,r)),R=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20;p.playbackRate=Math.min(T,Math.max(1,R))}else p.playbackRate!==1&&p.playbackRate!==0&&(p.playbackRate=1)},v.estimateLiveEdge=function(){var p=this.levelDetails;return p===null?null:p.edge+p.age},v.computeLatency=function(){var p=this.estimateLiveEdge();return p===null?null:p-this.currentTime},G(O,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var p=this.config,h=this.levelDetails;return p.liveMaxLatencyDuration!==void 0?p.liveMaxLatencyDuration:h?p.liveMaxLatencyDurationCount*h.targetduration:0}},{key:"targetLatency",get:function(){var p=this.levelDetails;if(p===null)return null;var h=p.holdBack,o=p.partHoldBack,f=p.targetduration,l=this.config,r=l.liveSyncDuration,s=l.liveSyncDurationCount,c=l.lowLatencyMode,L=this.hls.userConfig,w=c&&o||h;(L.liveSyncDuration||L.liveSyncDurationCount||w===0)&&(w=r!==void 0?r:s*f);var T=f,R=1;return w+Math.min(this.stallCount*R,T)}},{key:"liveSyncPosition",get:function(){var p=this.estimateLiveEdge(),h=this.targetLatency,o=this.levelDetails;if(p===null||h===null||o===null)return null;var f=o.edge,l=p-h-this.edgeStalled,r=f-o.totalduration,s=f-(this.config.lowLatencyMode&&o.partTarget||o.targetduration);return Math.min(Math.max(r,l),s)}},{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 h=(this.config.lowLatencyMode&&p.partTarget||p.targetduration)*3;return Math.max(p.age-h,0)}},{key:"forwardBufferLength",get:function(){var p=this.media,h=this.levelDetails;if(!p||!h)return 0;var o=p.buffered.length;return o?p.buffered.end(o-1):h.edge-this.currentTime}}]),O}()},"./src/controller/level-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return l});var $=P("./src/types/level.ts"),B=P("./src/events.ts"),U=P("./src/errors.ts"),K=P("./src/utils/codecs.ts"),G=P("./src/controller/level-helper.ts"),M=P("./src/controller/base-playlist-controller.ts"),O=P("./src/types/loader.ts");function v(){return v=Object.assign||function(r){for(var s=1;s<arguments.length;s++){var c=arguments[s];for(var L in c)Object.prototype.hasOwnProperty.call(c,L)&&(r[L]=c[L])}return r},v.apply(this,arguments)}function m(r,s){for(var c=0;c<s.length;c++){var L=s[c];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(r,L.key,L)}}function p(r,s,c){return s&&m(r.prototype,s),c&&m(r,c),r}function h(r,s){r.prototype=Object.create(s.prototype),r.prototype.constructor=r,o(r,s)}function o(r,s){return o=Object.setPrototypeOf||function(L,w){return L.__proto__=w,L},o(r,s)}var f=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),l=function(r){h(s,r);function s(L){var w;return w=r.call(this,L,"[level-controller]")||this,w._levels=[],w._firstLevel=-1,w._startLevel=void 0,w.currentLevelIndex=-1,w.manualLevelIndex=-1,w.onParsedComplete=void 0,w._registerListeners(),w}var c=s.prototype;return c._registerListeners=function(){var w=this.hls;w.on(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),w.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),w.on(B.Events.FRAG_LOADED,this.onFragLoaded,this),w.on(B.Events.ERROR,this.onError,this)},c._unregisterListeners=function(){var w=this.hls;w.off(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),w.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),w.off(B.Events.FRAG_LOADED,this.onFragLoaded,this),w.off(B.Events.ERROR,this.onError,this)},c.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,r.prototype.destroy.call(this)},c.startLoad=function(){var w=this._levels;w.forEach(function(T){T.loadError=0}),r.prototype.startLoad.call(this)},c.onManifestLoaded=function(w,T){var R=[],C=[],S=[],x,_={},d,u=!1,g=!1,E=!1;if(T.levels.forEach(function(j){var I=j.attrs;u=u||!!(j.width&&j.height),g=g||!!j.videoCodec,E=E||!!j.audioCodec,f&&j.audioCodec&&j.audioCodec.indexOf("mp4a.40.34")!==-1&&(j.audioCodec=void 0);var b=j.bitrate+"-"+j.attrs.RESOLUTION+"-"+j.attrs.CODECS;d=_[b],d?d.url.push(j.url):(d=new $.Level(j),_[b]=d,R.push(d)),I&&(I.AUDIO&&Object(G.addGroupId)(d,"audio",I.AUDIO),I.SUBTITLES&&Object(G.addGroupId)(d,"text",I.SUBTITLES))}),(u||g)&&E&&(R=R.filter(function(j){var I=j.videoCodec,b=j.width,W=j.height;return!!I||!!(b&&W)})),R=R.filter(function(j){var I=j.audioCodec,b=j.videoCodec;return(!I||Object(K.isCodecSupportedInMp4)(I,"audio"))&&(!b||Object(K.isCodecSupportedInMp4)(b,"video"))}),T.audioTracks&&(C=T.audioTracks.filter(function(j){return!j.audioCodec||Object(K.isCodecSupportedInMp4)(j.audioCodec,"audio")}),Object(G.assignTrackIdsByGroup)(C)),T.subtitles&&(S=T.subtitles,Object(G.assignTrackIdsByGroup)(S)),R.length>0){x=R[0].bitrate,R.sort(function(j,I){return j.bitrate-I.bitrate}),this._levels=R;for(var N=0;N<R.length;N++)if(R[N].bitrate===x){this._firstLevel=N,this.log("manifest loaded, "+R.length+" level(s) found, first bitrate: "+x);break}var D=E&&!g,H={levels:R,audioTracks:C,subtitleTracks:S,firstLevel:this._firstLevel,stats:T.stats,audio:E,video:g,altAudio:!D&&C.some(function(j){return!!j.url})};this.hls.trigger(B.Events.MANIFEST_PARSED,H),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(B.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:T.url,reason:"no level with compatible codecs found in manifest"})},c.onError=function(w,T){if(r.prototype.onError.call(this,w,T),T.fatal)return;var R=T.context,C=this._levels[this.currentLevelIndex];if(R&&(R.type===O.PlaylistContextType.AUDIO_TRACK&&C.audioGroupIds&&R.groupId===C.audioGroupIds[C.urlId]||R.type===O.PlaylistContextType.SUBTITLE_TRACK&&C.textGroupIds&&R.groupId===C.textGroupIds[C.urlId])){this.redundantFailover(this.currentLevelIndex);return}var S=!1,x=!0,_;switch(T.details){case U.ErrorDetails.FRAG_LOAD_ERROR:case U.ErrorDetails.FRAG_LOAD_TIMEOUT:case U.ErrorDetails.KEY_LOAD_ERROR:case U.ErrorDetails.KEY_LOAD_TIMEOUT:if(T.frag){var d=this._levels[T.frag.level];d?(d.fragmentError++,d.fragmentError>this.hls.config.fragLoadingMaxRetry&&(_=T.frag.level)):_=T.frag.level}break;case U.ErrorDetails.LEVEL_LOAD_ERROR:case U.ErrorDetails.LEVEL_LOAD_TIMEOUT:R&&(R.deliveryDirectives&&(x=!1),_=R.level),S=!0;break;case U.ErrorDetails.REMUX_ALLOC_ERROR:_=T.level,S=!0;break}_!==void 0&&this.recoverLevel(T,_,S,x)},c.recoverLevel=function(w,T,R,C){var S=w.details,x=this._levels[T];if(x.loadError++,R){var _=this.retryLoadingOrFail(w);if(_)w.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(C){var d=x.url.length;if(d>1&&x.loadError<d)w.levelRetry=!0,this.redundantFailover(T);else if(this.manualLevelIndex===-1){var u=T===0?this._levels.length-1:T-1;this.currentLevelIndex!==u&&this._levels[u].loadError===0&&(this.warn(S+": switch to "+u),w.levelRetry=!0,this.hls.nextAutoLevel=u)}}},c.redundantFailover=function(w){var T=this._levels[w],R=T.url.length;if(R>1){var C=(T.urlId+1)%R;this.warn("Switching to redundant URL-id "+C),this._levels.forEach(function(S){S.urlId=C}),this.level=w}},c.onFragLoaded=function(w,T){var R=T.frag;if(R!==void 0&&R.type===O.PlaylistLevelType.MAIN){var C=this._levels[R.level];C!==void 0&&(C.fragmentError=0,C.loadError=0)}},c.onLevelLoaded=function(w,T){var R,C=T.level,S=T.details,x=this._levels[C];if(!x){var _;this.warn("Invalid level index "+C),(_=T.deliveryDirectives)!==null&&_!==void 0&&_.skip&&(S.deltaUpdateFailed=!0);return}C===this.currentLevelIndex?(x.fragmentError===0&&(x.loadError=0,this.retryCount=0),this.playlistLoaded(C,T,x.details)):(R=T.deliveryDirectives)!==null&&R!==void 0&&R.skip&&(S.deltaUpdateFailed=!0)},c.onAudioTrackSwitched=function(w,T){var R=this.hls.levels[this.currentLevelIndex];if(!R)return;if(R.audioGroupIds){for(var C=-1,S=this.hls.audioTracks[T.id].groupId,x=0;x<R.audioGroupIds.length;x++)if(R.audioGroupIds[x]===S){C=x;break}C!==R.urlId&&(R.urlId=C,this.startLoad())}},c.loadPlaylist=function(w){var T=this.currentLevelIndex,R=this._levels[T];if(this.canLoad&&R&&R.url.length>0){var C=R.urlId,S=R.url[C];if(w)try{S=w.addDirectives(S)}catch(x){this.warn("Could not construct new URL with HLS Delivery Directives: "+x)}this.log("Attempt loading level index "+T+(w?" at sn "+w.msn+" part "+w.part:"")+" with URL-id "+C+" "+S),this.clearTimer(),this.hls.trigger(B.Events.LEVEL_LOADING,{url:S,level:T,id:C,deliveryDirectives:w||null})}},c.removeLevel=function(w,T){var R=function(x,_){return _!==T},C=this._levels.filter(function(S,x){return x!==w?!0:S.url.length>1&&T!==void 0?(S.url=S.url.filter(R),S.audioGroupIds&&(S.audioGroupIds=S.audioGroupIds.filter(R)),S.textGroupIds&&(S.textGroupIds=S.textGroupIds.filter(R)),S.urlId=0,!0):!1}).map(function(S,x){var _=S.details;return _!=null&&_.fragments&&_.fragments.forEach(function(d){d.level=x}),S});this._levels=C,this.hls.trigger(B.Events.LEVELS_UPDATED,{levels:C})},p(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(w){var T,R=this._levels;if(R.length===0)return;if(this.currentLevelIndex===w&&(T=R[w])!==null&&T!==void 0&&T.details)return;if(w<0||w>=R.length){var C=w<0;if(this.hls.trigger(B.Events.ERROR,{type:U.ErrorTypes.OTHER_ERROR,details:U.ErrorDetails.LEVEL_SWITCH_ERROR,level:w,fatal:C,reason:"invalid level idx"}),C)return;w=Math.min(w,R.length-1)}this.clearTimer();var S=this.currentLevelIndex,x=R[S],_=R[w];this.log("switching to level "+w+" from "+S),this.currentLevelIndex=w;var d=v({},_,{level:w,maxBitrate:_.maxBitrate,uri:_.uri,urlId:_.urlId});delete d._urlId,this.hls.trigger(B.Events.LEVEL_SWITCHING,d);var u=_.details;if(!u||u.live){var g=this.switchParams(_.uri,x==null?void 0:x.details);this.loadPlaylist(g)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(w){this.manualLevelIndex=w,this._startLevel===void 0&&(this._startLevel=w),w!==-1&&(this.level=w)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(w){this._firstLevel=w}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var w=this.hls.config.startLevel;return w!==void 0?w:this._firstLevel}else return this._startLevel},set:function(w){this._startLevel=w}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(w){this.level=w,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=w)}}]),s}(M.default)},"./src/controller/level-helper.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"addGroupId",function(){return U}),P.d(Z,"assignTrackIdsByGroup",function(){return K}),P.d(Z,"updatePTS",function(){return G}),P.d(Z,"updateFragPTSDTS",function(){return O}),P.d(Z,"mergeDetails",function(){return v}),P.d(Z,"mapPartIntersection",function(){return m}),P.d(Z,"mapFragmentIntersection",function(){return p}),P.d(Z,"adjustSliding",function(){return h}),P.d(Z,"addSliding",function(){return o}),P.d(Z,"computeReloadInterval",function(){return f}),P.d(Z,"getFragmentWithSN",function(){return l}),P.d(Z,"getPartWith",function(){return r});var $=P("./src/polyfills/number.ts"),B=P("./src/utils/logger.ts");function U(s,c,L){switch(c){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(L);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(L);break}}function K(s){var c={};s.forEach(function(L){var w=L.groupId||"";L.id=c[w]=c[w]||0,c[w]++})}function G(s,c,L){var w=s[c],T=s[L];M(w,T)}function M(s,c){var L=c.startPTS;if(Object($.isFiniteNumber)(L)){var w=0,T;c.sn>s.sn?(w=L-s.start,T=s):(w=s.start-L,T=c),T.duration!==w&&(T.duration=w)}else if(c.sn>s.sn){var R=s.cc===c.cc;R&&s.minEndPTS?c.start=s.start+(s.minEndPTS-s.start):c.start=s.start+s.duration}else c.start=Math.max(s.start-c.duration,0)}function O(s,c,L,w,T,R){var C=w-L;C<=0&&(B.logger.warn("Fragment should have a positive duration",c),w=L+c.duration,R=T+c.duration);var S=L,x=w,_=c.startPTS,d=c.endPTS;if(Object($.isFiniteNumber)(_)){var u=Math.abs(_-L);Object($.isFiniteNumber)(c.deltaPTS)?c.deltaPTS=Math.max(u,c.deltaPTS):c.deltaPTS=u,S=Math.max(L,_),L=Math.min(L,_),T=Math.min(T,c.startDTS),x=Math.min(w,d),w=Math.max(w,d),R=Math.max(R,c.endDTS)}c.duration=w-L;var g=L-c.start;c.appendedPTS=w,c.start=c.startPTS=L,c.maxStartPTS=S,c.startDTS=T,c.endPTS=w,c.minEndPTS=x,c.endDTS=R;var E=c.sn;if(!s||E<s.startSN||E>s.endSN)return 0;var N,D=E-s.startSN,H=s.fragments;for(H[D]=c,N=D;N>0;N--)M(H[N],H[N-1]);for(N=D;N<H.length-1;N++)M(H[N],H[N+1]);return s.fragmentHint&&M(H[H.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,g}function v(s,c){for(var L=null,w=s.fragments,T=w.length-1;T>=0;T--){var R=w[T].initSegment;if(R){L=R;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var C=0,S;if(p(s,c,function(N,D){N.relurl&&(C=N.cc-D.cc),Object($.isFiniteNumber)(N.startPTS)&&Object($.isFiniteNumber)(N.endPTS)&&(D.start=D.startPTS=N.startPTS,D.startDTS=N.startDTS,D.appendedPTS=N.appendedPTS,D.maxStartPTS=N.maxStartPTS,D.endPTS=N.endPTS,D.endDTS=N.endDTS,D.minEndPTS=N.minEndPTS,D.duration=N.endPTS-N.startPTS,D.duration&&(S=D),c.PTSKnown=c.alignedSliding=!0),D.elementaryStreams=N.elementaryStreams,D.loader=N.loader,D.stats=N.stats,D.urlId=N.urlId,N.initSegment&&(D.initSegment=N.initSegment,L=N.initSegment)}),L){var x=c.fragmentHint?c.fragments.concat(c.fragmentHint):c.fragments;x.forEach(function(N){var D;(!N.initSegment||N.initSegment.relurl===((D=L)===null||D===void 0?void 0:D.relurl))&&(N.initSegment=L)})}if(c.skippedSegments&&(c.deltaUpdateFailed=c.fragments.some(function(N){return!N}),c.deltaUpdateFailed)){B.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var _=c.skippedSegments;_--;)c.fragments.shift();c.startSN=c.fragments[0].sn,c.startCC=c.fragments[0].cc}var d=c.fragments;if(C){B.logger.warn("discontinuity sliding from playlist, take drift into account");for(var u=0;u<d.length;u++)d[u].cc+=C}c.skippedSegments&&(c.startCC=c.fragments[0].cc),m(s.partList,c.partList,function(N,D){D.elementaryStreams=N.elementaryStreams,D.stats=N.stats}),S?O(c,S,S.startPTS,S.endPTS,S.startDTS,S.endDTS):h(s,c),d.length&&(c.totalduration=c.edge-d[0].start),c.driftStartTime=s.driftStartTime,c.driftStart=s.driftStart;var g=c.advancedDateTime;if(c.advanced&&g){var E=c.edge;c.driftStart||(c.driftStartTime=g,c.driftStart=E),c.driftEndTime=g,c.driftEnd=E}else c.driftEndTime=s.driftEndTime,c.driftEnd=s.driftEnd,c.advancedDateTime=s.advancedDateTime}function m(s,c,L){if(s&&c)for(var w=0,T=0,R=s.length;T<=R;T++){var C=s[T],S=c[T+w];C&&S&&C.index===S.index&&C.fragment.sn===S.fragment.sn?L(C,S):w--}}function p(s,c,L){for(var w=c.skippedSegments,T=Math.max(s.startSN,c.startSN)-c.startSN,R=(s.fragmentHint?1:0)+(w?c.endSN:Math.min(s.endSN,c.endSN))-c.startSN,C=c.startSN-s.startSN,S=c.fragmentHint?c.fragments.concat(c.fragmentHint):c.fragments,x=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,_=T;_<=R;_++){var d=x[C+_],u=S[_];w&&!u&&_<w&&(u=c.fragments[_]=d),d&&u&&L(d,u)}}function h(s,c){var L=c.startSN+c.skippedSegments-s.startSN,w=s.fragments;if(L<0||L>=w.length)return;o(c,w[L].start)}function o(s,c){if(c){for(var L=s.fragments,w=s.skippedSegments;w<L.length;w++)L[w].start+=c;s.fragmentHint&&(s.fragmentHint.start+=c)}}function f(s,c){var L=1e3*s.levelTargetDuration,w=L/2,T=s.age,R=T>0&&T<L*3,C=c.loading.end-c.loading.start,S,x=s.availabilityDelay;if(s.updated===!1)if(R){var _=333*s.misses;S=Math.max(Math.min(w,C*2),_),s.availabilityDelay=(s.availabilityDelay||0)+S}else S=w;else R?(x=Math.min(x||L/2,T),s.availabilityDelay=x,S=x+L-T):S=L-C;return Math.round(S)}function l(s,c,L){if(!s||!s.details)return null;var w=s.details,T=w.fragments[c-w.startSN];return T||(T=w.fragmentHint,T&&T.sn===c?T:c<w.startSN&&L&&L.sn===c?L:null)}function r(s,c,L){if(!s||!s.details)return null;var w=s.details.partList;if(w)for(var T=w.length;T--;){var R=w[T];if(R.index===L&&R.fragment.sn===c)return R}return null}},"./src/controller/stream-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return w});var $=P("./src/polyfills/number.ts"),B=P("./src/controller/base-stream-controller.ts"),U=P("./src/is-supported.ts"),K=P("./src/events.ts"),G=P("./src/utils/buffer-helper.ts"),M=P("./src/controller/fragment-tracker.ts"),O=P("./src/types/loader.ts"),v=P("./src/loader/fragment.ts"),m=P("./src/demux/transmuxer-interface.ts"),p=P("./src/types/transmuxer.ts"),h=P("./src/controller/gap-controller.ts"),o=P("./src/errors.ts"),f=P("./src/utils/logger.ts");function l(T,R){for(var C=0;C<R.length;C++){var S=R[C];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(T,S.key,S)}}function r(T,R,C){return R&&l(T.prototype,R),C&&l(T,C),T}function s(T,R){T.prototype=Object.create(R.prototype),T.prototype.constructor=T,c(T,R)}function c(T,R){return c=Object.setPrototypeOf||function(S,x){return S.__proto__=x,S},c(T,R)}var L=100,w=function(T){s(R,T);function R(S,x){var _;return _=T.call(this,S,x,"[stream-controller]")||this,_.audioCodecSwap=!1,_.gapController=null,_.level=-1,_._forceStartLoad=!1,_.altAudio=!1,_.audioOnly=!1,_.fragPlaying=null,_.onvplaying=null,_.onvseeked=null,_.fragLastKbps=0,_.stalled=!1,_.couldBacktrack=!1,_.audioCodecSwitch=!1,_.videoBuffer=null,_._registerListeners(),_}var C=R.prototype;return C._registerListeners=function(){var x=this.hls;x.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),x.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),x.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),x.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),x.on(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),x.on(K.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),x.on(K.Events.ERROR,this.onError,this),x.on(K.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),x.on(K.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),x.on(K.Events.BUFFER_CREATED,this.onBufferCreated,this),x.on(K.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),x.on(K.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),x.on(K.Events.FRAG_BUFFERED,this.onFragBuffered,this)},C._unregisterListeners=function(){var x=this.hls;x.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),x.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),x.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),x.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.off(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),x.off(K.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),x.off(K.Events.ERROR,this.onError,this),x.off(K.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),x.off(K.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),x.off(K.Events.BUFFER_CREATED,this.onBufferCreated,this),x.off(K.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),x.off(K.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),x.off(K.Events.FRAG_BUFFERED,this.onFragBuffered,this)},C.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},C.startLoad=function(x){if(this.levels){var _=this.lastCurrentTime,d=this.hls;if(this.stopLoad(),this.setInterval(L),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var u=d.startLevel;u===-1&&(d.config.testBandwidth?(u=0,this.bitrateTest=!0):u=d.nextAutoLevel),this.level=d.nextLoadLevel=u,this.loadedmetadata=!1}_>0&&x===-1&&(this.log("Override startPosition with lastCurrentTime @"+_.toFixed(3)),x=_),this.state=B.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=x,this.tick()}else this._forceStartLoad=!0,this.state=B.State.STOPPED},C.stopLoad=function(){this._forceStartLoad=!1,T.prototype.stopLoad.call(this)},C.doTick=function(){switch(this.state){case B.State.IDLE:this.doTickIdle();break;case B.State.WAITING_LEVEL:{var x,_=this.levels,d=this.level,u=_==null||((x=_[d])===null||x===void 0)?void 0:x.details;if(u&&(!u.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(u))break;this.state=B.State.IDLE;break}break}case B.State.FRAG_LOADING_WAITING_RETRY:{var g,E=self.performance.now(),N=this.retryDate;(!N||E>=N||(g=this.media)!==null&&g!==void 0&&g.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=B.State.IDLE)}break;default:break}this.onTickEnd()},C.onTickEnd=function(){T.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},C.doTickIdle=function(){var x,_,d=this.hls,u=this.levelLastLoaded,g=this.levels,E=this.media,N=d.config,D=d.nextLoadLevel;if(u===null||!E&&(this.startFragRequested||!N.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!g||!g[D])return;var H=g[D];this.level=d.nextLoadLevel=D;var j=H.details;if(!j||this.state===B.State.WAITING_LEVEL||j.live&&this.levelLastLoaded!==D){this.state=B.State.WAITING_LEVEL;return}var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:E,O.PlaylistLevelType.MAIN);if(I===null)return;var b=I.len,W=this.getMaxBufferLength(H.maxBitrate);if(b>=W)return;if(this._streamEnded(I,j)){var Y={};this.altAudio&&(Y.type="video"),this.hls.trigger(K.Events.BUFFER_EOS,Y),this.state=B.State.ENDED;return}var ie=I.end,oe=this.getNextFragment(ie,j);if(this.couldBacktrack&&!this.fragPrevious&&oe&&oe.sn!=="initSegment"){var xe=oe.sn-j.startSN;xe>1&&(oe=j.fragments[xe-1],this.fragmentTracker.removeFragment(oe))}if(oe&&this.fragmentTracker.getState(oe)===M.FragmentState.OK&&this.nextLoadPosition>ie){var ve=this.audioOnly&&!this.altAudio?v.ElementaryStreamTypes.AUDIO:v.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(E,ve,O.PlaylistLevelType.MAIN),oe=this.getNextFragment(this.nextLoadPosition,j)}if(!oe)return;oe.initSegment&&!oe.initSegment.data&&!this.bitrateTest&&(oe=oe.initSegment),((x=oe.decryptdata)===null||x===void 0?void 0:x.keyFormat)==="identity"&&!((_=oe.decryptdata)!==null&&_!==void 0&&_.key)?this.loadKey(oe,j):this.loadFragment(oe,j,ie)},C.loadFragment=function(x,_,d){var u,g=this.fragmentTracker.getState(x);if(this.fragCurrent=x,g===M.FragmentState.BACKTRACKED){var E=this.fragmentTracker.getBacktrackData(x);if(E){this._handleFragmentLoadProgress(E),this._handleFragmentLoadComplete(E);return}else g=M.FragmentState.NOT_LOADED}g===M.FragmentState.NOT_LOADED||g===M.FragmentState.PARTIAL?x.sn==="initSegment"?this._loadInitSegment(x):this.bitrateTest?(x.bitrateTest=!0,this.log("Fragment "+x.sn+" of level "+x.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(x)):(this.startFragRequested=!0,T.prototype.loadFragment.call(this,x,_,d)):g===M.FragmentState.APPENDING?this.reduceMaxBufferLength(x.duration)&&this.fragmentTracker.removeFragment(x):((u=this.media)===null||u===void 0?void 0:u.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},C.getAppendedFrag=function(x){var _=this.fragmentTracker.getAppendedFrag(x,O.PlaylistLevelType.MAIN);return _&&"fragment"in _?_.fragment:_},C.getBufferedFrag=function(x){return this.fragmentTracker.getBufferedFrag(x,O.PlaylistLevelType.MAIN)},C.followingBufferedFrag=function(x){return x?this.getBufferedFrag(x.end+.5):null},C.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},C.nextLevelSwitch=function(){var x=this.levels,_=this.media;if(_!=null&&_.readyState){var d,u=this.getAppendedFrag(_.currentTime);if(u&&u.start>1&&this.flushMainBuffer(0,u.start-1),!_.paused&&x){var g=this.hls.nextLoadLevel,E=x[g],N=this.fragLastKbps;N&&this.fragCurrent?d=this.fragCurrent.duration*E.maxBitrate/(1e3*N)+1:d=0}else d=0;var D=this.getBufferedFrag(_.currentTime+d);if(D){var H=this.followingBufferedFrag(D);if(H){this.abortCurrentFrag();var j=H.maxStartPTS?H.maxStartPTS:H.start,I=H.duration,b=Math.max(D.end,j+Math.min(Math.max(I-this.config.maxFragLookUpTolerance,I*.5),I*.75));this.flushMainBuffer(b,Number.POSITIVE_INFINITY)}}}},C.abortCurrentFrag=function(){var x=this.fragCurrent;this.fragCurrent=null,x!=null&&x.loader&&x.loader.abort(),this.state===B.State.KEY_LOADING&&(this.state=B.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},C.flushMainBuffer=function(x,_){T.prototype.flushMainBuffer.call(this,x,_,this.altAudio?"video":null)},C.onMediaAttached=function(x,_){T.prototype.onMediaAttached.call(this,x,_);var d=_.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),d.addEventListener("playing",this.onvplaying),d.addEventListener("seeked",this.onvseeked),this.gapController=new h.default(this.config,d,this.fragmentTracker,this.hls)},C.onMediaDetaching=function(){var x=this.media;x&&(x.removeEventListener("playing",this.onvplaying),x.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),T.prototype.onMediaDetaching.call(this)},C.onMediaPlaying=function(){this.tick()},C.onMediaSeeked=function(){var x=this.media,_=x?x.currentTime:null;Object($.isFiniteNumber)(_)&&this.log("Media seeked to "+_.toFixed(3)),this.tick()},C.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(K.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},C.onManifestParsed=function(x,_){var d=!1,u=!1,g;_.levels.forEach(function(E){g=E.audioCodec,g&&(g.indexOf("mp4a.40.2")!==-1&&(d=!0),g.indexOf("mp4a.40.5")!==-1&&(u=!0))}),this.audioCodecSwitch=d&&u&&!Object(U.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=_.levels,this.startFragRequested=!1},C.onLevelLoading=function(x,_){var d=this.levels;if(!d||this.state!==B.State.IDLE)return;var u=d[_.level];(!u.details||u.details.live&&this.levelLastLoaded!==_.level||this.waitForCdnTuneIn(u.details))&&(this.state=B.State.WAITING_LEVEL)},C.onLevelLoaded=function(x,_){var d,u=this.levels,g=_.level,E=_.details,N=E.totalduration;if(!u){this.warn("Levels were reset while loading level "+g);return}this.log("Level "+g+" loaded ["+E.startSN+","+E.endSN+"], cc ["+E.startCC+", "+E.endCC+"] duration:"+N);var D=this.fragCurrent;D&&(this.state===B.State.FRAG_LOADING||this.state===B.State.FRAG_LOADING_WAITING_RETRY)&&(D.level!==_.level&&D.loader&&(this.state=B.State.IDLE,D.loader.abort()));var H=u[g],j=0;if(E.live||(d=H.details)!==null&&d!==void 0&&d.live){if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed)return;j=this.alignPlaylists(E,H.details)}if(H.details=E,this.levelLastLoaded=g,this.hls.trigger(K.Events.LEVEL_UPDATED,{details:E,level:g}),this.state===B.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(E))return;this.state=B.State.IDLE}this.startFragRequested?E.live&&this.synchronizeToLiveEdge(E):this.setStartPosition(E,j),this.tick()},C._handleFragmentLoadProgress=function(x){var _,d=x.frag,u=x.part,g=x.payload,E=this.levels;if(!E){this.warn("Levels were reset while fragment load was in progress. Fragment "+d.sn+" of level "+d.level+" will not be buffered");return}var N=E[d.level],D=N.details;if(!D){this.warn("Dropping fragment "+d.sn+" of level "+d.level+" after level details were reset");return}var H=N.videoCodec,j=D.PTSKnown||!D.live,I=(_=d.initSegment)===null||_===void 0?void 0:_.data,b=this._getAudioCodec(N),W=this.transmuxer=this.transmuxer||new m.default(this.hls,O.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Y=u?u.index:-1,ie=Y!==-1,oe=new p.ChunkMetadata(d.level,d.sn,d.stats.chunkCount,g.byteLength,Y,ie),xe=this.initPTS[d.cc];W.push(g,I,b,H,d,u,D.totalduration,j,oe,xe)},C.onAudioTrackSwitching=function(x,_){var d=this.altAudio,u=!!_.url,g=_.id;if(!u){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var E=this.fragCurrent;E!=null&&E.loader&&(this.log("Switching to main audio track, cancel main fragment load"),E.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var N=this.hls;d&&N.trigger(K.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),N.trigger(K.Events.AUDIO_TRACK_SWITCHED,{id:g})}},C.onAudioTrackSwitched=function(x,_){var d=_.id,u=!!this.hls.audioTracks[d].url;if(u){var g=this.videoBuffer;g&&this.mediaBuffer!==g&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=g)}this.altAudio=u,this.tick()},C.onBufferCreated=function(x,_){var d=_.tracks,u,g,E=!1;for(var N in d){var D=d[N];if(D.id==="main"){if(g=N,u=D,N==="video"){var H=d[N];H&&(this.videoBuffer=H.buffer)}}else E=!0}E&&u?(this.log("Alternate track found, use "+g+".buffered to schedule main fragment loading"),this.mediaBuffer=u.buffer):this.mediaBuffer=this.media},C.onFragBuffered=function(x,_){var d=_.frag,u=_.part;if(d&&d.type!==O.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(d)){this.warn("Fragment "+d.sn+(u?" p: "+u.index:"")+" of level "+d.level+" finished buffering, but was aborted. state: "+this.state),this.state===B.State.PARSED&&(this.state=B.State.IDLE);return}var g=u?u.stats:d.stats;this.fragLastKbps=Math.round(8*g.total/(g.buffering.end-g.loading.first)),d.sn!=="initSegment"&&(this.fragPrevious=d),this.fragBufferedComplete(d,u)},C.onError=function(x,_){switch(_.details){case o.ErrorDetails.FRAG_LOAD_ERROR:case o.ErrorDetails.FRAG_LOAD_TIMEOUT:case o.ErrorDetails.KEY_LOAD_ERROR:case o.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(O.PlaylistLevelType.MAIN,_);break;case o.ErrorDetails.LEVEL_LOAD_ERROR:case o.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==B.State.ERROR&&(_.fatal?(this.warn(""+_.details),this.state=B.State.ERROR):!_.levelRetry&&this.state===B.State.WAITING_LEVEL&&(this.state=B.State.IDLE));break;case o.ErrorDetails.BUFFER_FULL_ERROR:if(_.parent==="main"&&(this.state===B.State.PARSING||this.state===B.State.PARSED)){var d=!0,u=this.getFwdBufferInfo(this.media,O.PlaylistLevelType.MAIN);u&&u.len>.5&&(d=!this.reduceMaxBufferLength(u.len)),d&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},C.checkBuffer=function(){var x=this.media,_=this.gapController;if(!x||!_||!x.readyState)return;var d=G.BufferHelper.getBuffered(x);!this.loadedmetadata&&d.length?(this.loadedmetadata=!0,this.seekToStartPos()):_.poll(this.lastCurrentTime),this.lastCurrentTime=x.currentTime},C.onFragLoadEmergencyAborted=function(){this.state=B.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},C.onBufferFlushed=function(x,_){var d=_.type;if(d!==v.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var u=(d===v.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(u,d,O.PlaylistLevelType.MAIN)}},C.onLevelsUpdated=function(x,_){this.levels=_.levels},C.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},C.seekToStartPos=function(){var x=this.media,_=x.currentTime,d=this.startPosition;if(d>=0&&_<d){if(x.seeking){f.logger.log("could not seek to "+d+", already seeking at "+_);return}var u=G.BufferHelper.getBuffered(x),g=u.length?u.start(0):0,E=g-d;E>0&&(E<this.config.maxBufferHole||E<this.config.maxFragLookUpTolerance)&&(f.logger.log("adjusting start position by "+E+" to match buffer start"),d+=E,this.startPosition=d),this.log("seek to target start position "+d+" from current time "+_),x.currentTime=d}},C._getAudioCodec=function(x){var _=this.config.defaultAudioCodec||x.audioCodec;return this.audioCodecSwap&&_&&(this.log("Swapping audio codec"),_.indexOf("mp4a.40.5")!==-1?_="mp4a.40.2":_="mp4a.40.5"),_},C._loadBitrateTestFrag=function(x){var _=this;this._doFragLoad(x).then(function(d){var u=_.hls;if(!d||u.nextLoadLevel||_.fragContextChanged(x))return;_.fragLoadError=0,_.state=B.State.IDLE,_.startFragRequested=!1,_.bitrateTest=!1;var g=x.stats;g.parsing.start=g.parsing.end=g.buffering.start=g.buffering.end=self.performance.now(),u.trigger(K.Events.FRAG_LOADED,d)})},C._handleTransmuxComplete=function(x){var _,d="main",u=this.hls,g=x.remuxResult,E=x.chunkMeta,N=this.getCurrentContext(E);if(!N){this.warn("The loading context changed while buffering fragment "+E.sn+" of level "+E.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(E.level);return}var D=N.frag,H=N.part,j=N.level,I=g.video,b=g.text,W=g.id3,Y=g.initSegment,ie=this.altAudio?void 0:g.audio;if(this.fragContextChanged(D))return;if(this.state=B.State.PARSING,Y){Y.tracks&&(this._bufferInitSegment(j,Y.tracks,D,E),u.trigger(K.Events.FRAG_PARSING_INIT_SEGMENT,{frag:D,id:d,tracks:Y.tracks}));var oe=Y.initPTS,xe=Y.timescale;Object($.isFiniteNumber)(oe)&&(this.initPTS[D.cc]=oe,u.trigger(K.Events.INIT_PTS_FOUND,{frag:D,id:d,initPTS:oe,timescale:xe}))}if(I&&g.independent!==!1){if(j.details){var ve=I.startPTS,we=I.endPTS,Ce=I.startDTS,Se=I.endDTS;if(H)H.elementaryStreams[I.type]={startPTS:ve,endPTS:we,startDTS:Ce,endDTS:Se};else if(I.firstKeyFrame&&I.independent&&(this.couldBacktrack=!0),I.dropped&&I.independent){var fe=this.getLoadPosition()+this.config.maxBufferHole;if(fe<ve){this.backtrack(D);return}D.setElementaryStreamInfo(I.type,D.start,we,D.start,Se,!0)}D.setElementaryStreamInfo(I.type,ve,we,Ce,Se),this.bufferFragmentData(I,D,H,E)}}else if(g.independent===!1){this.backtrack(D);return}if(ie){var le=ie.startPTS,te=ie.endPTS,de=ie.startDTS,se=ie.endDTS;H&&(H.elementaryStreams[v.ElementaryStreamTypes.AUDIO]={startPTS:le,endPTS:te,startDTS:de,endDTS:se}),D.setElementaryStreamInfo(v.ElementaryStreamTypes.AUDIO,le,te,de,se),this.bufferFragmentData(ie,D,H,E)}if(W!=null&&(_=W.samples)!==null&&_!==void 0&&_.length){var Re={frag:D,id:d,samples:W.samples};u.trigger(K.Events.FRAG_PARSING_METADATA,Re)}if(b){var Le={frag:D,id:d,samples:b.samples};u.trigger(K.Events.FRAG_PARSING_USERDATA,Le)}},C._bufferInitSegment=function(x,_,d,u){var g=this;if(this.state!==B.State.PARSING)return;this.audioOnly=!!_.audio&&!_.video,this.altAudio&&!this.audioOnly&&delete _.audio;var E=_.audio,N=_.video,D=_.audiovideo;if(E){var H=x.audioCodec,j=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(H&&(H.indexOf("mp4a.40.5")!==-1?H="mp4a.40.2":H="mp4a.40.5"),E.metadata.channelCount!==1&&j.indexOf("firefox")===-1&&(H="mp4a.40.5")),j.indexOf("android")!==-1&&E.container!=="audio/mpeg"&&(H="mp4a.40.2",this.log("Android: force audio codec to "+H)),x.audioCodec&&x.audioCodec!==H&&this.log('Swapping manifest audio codec "'+x.audioCodec+'" for "'+H+'"'),E.levelCodec=H,E.id="main",this.log("Init audio buffer, container:"+E.container+", codecs[selected/level/parsed]=["+(H||"")+"/"+(x.audioCodec||"")+"/"+E.codec+"]")}N&&(N.levelCodec=x.videoCodec,N.id="main",this.log("Init video buffer, container:"+N.container+", codecs[level/parsed]=["+(x.videoCodec||"")+"/"+N.codec+"]")),D&&this.log("Init audiovideo buffer, container:"+D.container+", codecs[level/parsed]=["+(x.attrs.CODECS||"")+"/"+D.codec+"]"),this.hls.trigger(K.Events.BUFFER_CODECS,_),Object.keys(_).forEach(function(I){var b=_[I],W=b.initSegment;W!=null&&W.byteLength&&g.hls.trigger(K.Events.BUFFER_APPENDING,{type:I,data:W,frag:d,part:null,chunkMeta:u,parent:d.type})}),this.tick()},C.backtrack=function(x){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(x);var _=this.fragmentTracker.backtrack(x);this.fragPrevious=null,this.nextLoadPosition=x.start,_?this.resetFragmentLoading(x):this.state=B.State.BACKTRACKING},C.checkFragmentChanged=function(){var x=this.media,_=null;if(x&&x.readyState>1&&x.seeking===!1){var d=x.currentTime;if(G.BufferHelper.isBuffered(x,d)?_=this.getAppendedFrag(d):G.BufferHelper.isBuffered(x,d+.1)&&(_=this.getAppendedFrag(d+.1)),_){var u=this.fragPlaying,g=_.level;(!u||_.sn!==u.sn||u.level!==g||_.urlId!==u.urlId)&&(this.hls.trigger(K.Events.FRAG_CHANGED,{frag:_}),(!u||u.level!==g)&&this.hls.trigger(K.Events.LEVEL_SWITCHED,{level:g}),this.fragPlaying=_)}}},r(R,[{key:"nextLevel",get:function(){var x=this.nextBufferedFrag;return x?x.level:-1}},{key:"currentLevel",get:function(){var x=this.media;if(x){var _=this.getAppendedFrag(x.currentTime);if(_)return _.level}return-1}},{key:"nextBufferedFrag",get:function(){var x=this.media;if(x){var _=this.getAppendedFrag(x.currentTime);return this.followingBufferedFrag(_)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),R}(B.default)},"./src/controller/subtitle-stream-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"SubtitleStreamController",function(){return s});var $=P("./src/events.ts"),B=P("./src/utils/logger.ts"),U=P("./src/utils/buffer-helper.ts"),K=P("./src/controller/fragment-finders.ts"),G=P("./src/utils/discontinuities.ts"),M=P("./src/controller/level-helper.ts"),O=P("./src/controller/fragment-tracker.ts"),v=P("./src/controller/base-stream-controller.ts"),m=P("./src/types/loader.ts"),p=P("./src/types/level.ts");function h(c,L){for(var w=0;w<L.length;w++){var T=L[w];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(c,T.key,T)}}function o(c,L,w){return L&&h(c.prototype,L),w&&h(c,w),c}function f(c,L){c.prototype=Object.create(L.prototype),c.prototype.constructor=c,l(c,L)}function l(c,L){return l=Object.setPrototypeOf||function(T,R){return T.__proto__=R,T},l(c,L)}var r=500,s=function(c){f(L,c);function L(T,R){var C;return C=c.call(this,T,R,"[subtitle-stream-controller]")||this,C.levels=[],C.currentTrackId=-1,C.tracksBuffered=[],C.mainDetails=null,C._registerListeners(),C}var w=L.prototype;return w.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},w._registerListeners=function(){var R=this.hls;R.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),R.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),R.on($.Events.MANIFEST_LOADING,this.onManifestLoading,this),R.on($.Events.LEVEL_LOADED,this.onLevelLoaded,this),R.on($.Events.ERROR,this.onError,this),R.on($.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),R.on($.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),R.on($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),R.on($.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),R.on($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w._unregisterListeners=function(){var R=this.hls;R.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),R.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),R.off($.Events.MANIFEST_LOADING,this.onManifestLoading,this),R.off($.Events.LEVEL_LOADED,this.onLevelLoaded,this),R.off($.Events.ERROR,this.onError,this),R.off($.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),R.off($.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),R.off($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),R.off($.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),R.off($.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w.startLoad=function(){this.stopLoad(),this.state=v.State.IDLE,this.setInterval(r),this.tick()},w.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},w.onLevelLoaded=function(R,C){this.mainDetails=C.details},w.onSubtitleFragProcessed=function(R,C){var S=C.frag,x=C.success;if(this.fragPrevious=S,this.state=v.State.IDLE,!x)return;var _=this.tracksBuffered[this.currentTrackId];if(!_)return;for(var d,u=S.start,g=0;g<_.length;g++)if(u>=_[g].start&&u<=_[g].end){d=_[g];break}var E=S.start+S.duration;d?d.end=E:(d={start:u,end:E},_.push(d)),this.fragmentTracker.fragBuffered(S)},w.onBufferFlushing=function(R,C){var S=C.startOffset,x=C.endOffset;if(S===0&&x!==Number.POSITIVE_INFINITY){var _=this.currentTrackId,d=this.levels;if(!d.length||!d[_]||!d[_].details)return;var u=d[_].details,g=u.targetduration,E=x-g;if(E<=0)return;C.endOffsetSubtitles=Math.max(0,E),this.tracksBuffered.forEach(function(N){for(var D=0;D<N.length;){if(N[D].end<=E){N.shift();continue}else if(N[D].start<E)N[D].start=E;else break;D++}}),this.fragmentTracker.removeFragmentsInRange(S,E,m.PlaylistLevelType.SUBTITLE)}},w.onError=function(R,C){var S,x=C.frag;if(!x||x.type!==m.PlaylistLevelType.SUBTITLE)return;(S=this.fragCurrent)!==null&&S!==void 0&&S.loader&&this.fragCurrent.loader.abort(),this.state=v.State.IDLE},w.onSubtitleTracksUpdated=function(R,C){var S=this,x=C.subtitleTracks;this.tracksBuffered=[],this.levels=x.map(function(_){return new p.Level(_)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(_){S.tracksBuffered[_.id]=[]}),this.mediaBuffer=null},w.onSubtitleTrackSwitch=function(R,C){if(this.currentTrackId=C.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var S=this.levels[this.currentTrackId];S!=null&&S.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,S&&this.setInterval(r)},w.onSubtitleTrackLoaded=function(R,C){var S,x=C.details,_=C.id,d=this.currentTrackId,u=this.levels;if(!u.length)return;var g=u[d];if(_>=u.length||_!==d||!g)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,x.live||(S=g.details)!==null&&S!==void 0&&S.live){var E=this.mainDetails;if(x.deltaUpdateFailed||!E)return;var N=E.fragments[0];if(!g.details)x.hasProgramDateTime&&E.hasProgramDateTime?Object(G.alignMediaPlaylistByPDT)(x,E):N&&Object(M.addSliding)(x,N.start);else{var D=this.alignPlaylists(x,g.details);D===0&&N&&Object(M.addSliding)(x,N.start)}}if(g.details=x,this.levelLastLoaded=_,this.tick(),x.live&&!this.fragCurrent&&this.media&&this.state===v.State.IDLE){var H=Object(K.findFragmentByPTS)(null,x.fragments,this.media.currentTime,0);H||(this.warn("Subtitle playlist not aligned with playback"),g.details=void 0)}},w._handleFragmentLoadComplete=function(R){var C=R.frag,S=R.payload,x=C.decryptdata,_=this.hls;if(this.fragContextChanged(C))return;if(S&&S.byteLength>0&&x&&x.key&&x.iv&&x.method==="AES-128"){var d=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(S),x.key.buffer,x.iv.buffer).then(function(u){var g=performance.now();_.trigger($.Events.FRAG_DECRYPTED,{frag:C,payload:u,stats:{tstart:d,tdecrypt:g}})})}},w.doTick=function(){if(!this.media){this.state=v.State.IDLE;return}if(this.state===v.State.IDLE){var R,C=this.currentTrackId,S=this.levels;if(!S.length||!S[C]||!S[C].details)return;var x=S[C].details,_=x.targetduration,d=this.config,u=this.media,g=U.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,u.currentTime-_,d.maxBufferHole),E=g.end,N=g.len,D=this.getMaxBufferLength()+_;if(N>D)return;console.assert(x,"Subtitle track details are defined on idle subtitle stream controller tick");var H=x.fragments,j=H.length,I=x.edge,b,W=this.fragPrevious;if(E<I){var Y=d.maxFragLookUpTolerance;W&&x.hasProgramDateTime&&(b=Object(K.findFragmentByPDT)(H,W.endProgramDateTime,Y)),b||(b=Object(K.findFragmentByPTS)(W,H,E,Y),!b&&W&&W.start<H[0].start&&(b=H[0]))}else b=H[j-1];(R=b)!==null&&R!==void 0&&R.encrypted?(B.logger.log("Loading key for "+b.sn),this.state=v.State.KEY_LOADING,this.hls.trigger($.Events.KEY_LOADING,{frag:b})):b&&this.fragmentTracker.getState(b)===O.FragmentState.NOT_LOADED&&this.loadFragment(b,x,E)}},w.loadFragment=function(R,C,S){this.fragCurrent=R,c.prototype.loadFragment.call(this,R,C,S)},o(L,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),L}(v.default)},"./src/controller/subtitle-track-controller.ts":function(ue,Z,P){"use strict";P.r(Z);var $=P("./src/events.ts"),B=P("./src/utils/texttrack-utils.ts"),U=P("./src/controller/base-playlist-controller.ts"),K=P("./src/types/loader.ts");function G(h,o){for(var f=0;f<o.length;f++){var l=o[f];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(h,l.key,l)}}function M(h,o,f){return o&&G(h.prototype,o),f&&G(h,f),h}function O(h,o){h.prototype=Object.create(o.prototype),h.prototype.constructor=h,v(h,o)}function v(h,o){return v=Object.setPrototypeOf||function(l,r){return l.__proto__=r,l},v(h,o)}var m=function(h){O(o,h);function o(l){var r;return r=h.call(this,l,"[subtitle-track-controller]")||this,r.media=null,r.tracks=[],r.groupId=null,r.tracksInGroup=[],r.trackId=-1,r.selectDefaultTrack=!0,r.queuedDefaultTrack=-1,r.trackChangeListener=function(){return r.onTextTracksChanged()},r.asyncPollTrackChange=function(){return r.pollTrackChange(0)},r.useTextTrackPolling=!1,r.subtitlePollingInterval=-1,r.subtitleDisplay=!0,r.registerListeners(),r}var f=o.prototype;return f.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,h.prototype.destroy.call(this)},f.registerListeners=function(){var r=this.hls;r.on($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.on($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.on($.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on($.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.on($.Events.LEVEL_LOADING,this.onLevelLoading,this),r.on($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),r.on($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),r.on($.Events.ERROR,this.onError,this)},f.unregisterListeners=function(){var r=this.hls;r.off($.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.off($.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off($.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off($.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.off($.Events.LEVEL_LOADING,this.onLevelLoading,this),r.off($.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),r.off($.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),r.off($.Events.ERROR,this.onError,this)},f.onMediaAttached=function(r,s){if(this.media=s.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)},f.pollTrackChange=function(r){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,r)},f.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 r=p(this.media.textTracks);r.forEach(function(s){Object(B.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},f.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},f.onManifestParsed=function(r,s){this.tracks=s.subtitleTracks},f.onSubtitleTrackLoaded=function(r,s){var c=s.id,L=s.details,w=this.trackId,T=this.tracksInGroup[w];if(!T){this.warn("Invalid subtitle track id "+c);return}var R=T.details;T.details=s.details,this.log("subtitle track "+c+" loaded ["+L.startSN+"-"+L.endSN+"]"),c===this.trackId&&(this.retryCount=0,this.playlistLoaded(c,s,R))},f.onLevelLoading=function(r,s){this.switchLevel(s.level)},f.onLevelSwitching=function(r,s){this.switchLevel(s.level)},f.switchLevel=function(r){var s=this.hls.levels[r];if(!(s!=null&&s.textGroupIds))return;var c=s.textGroupIds[s.urlId];if(this.groupId!==c){var L=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,w=this.tracks.filter(function(C){return!c||C.groupId===c});this.tracksInGroup=w;var T=this.findTrackId(L==null?void 0:L.name)||this.findTrackId();this.groupId=c;var R={subtitleTracks:w};this.log("Updating subtitle tracks, "+w.length+' track(s) found in "'+c+'" group-id'),this.hls.trigger($.Events.SUBTITLE_TRACKS_UPDATED,R),T!==-1&&this.setSubtitleTrack(T,L)}},f.findTrackId=function(r){for(var s=this.tracksInGroup,c=0;c<s.length;c++){var L=s[c];if((!this.selectDefaultTrack||L.default)&&(!r||r===L.name))return L.id}return-1},f.onError=function(r,s){if(h.prototype.onError.call(this,r,s),s.fatal||!s.context)return;s.context.type===K.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},f.loadPlaylist=function(r){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var c=s.id,L=s.groupId,w=s.url;if(r)try{w=r.addDirectives(w)}catch(T){this.warn("Could not construct new URL with HLS Delivery Directives: "+T)}this.log("Loading subtitle playlist for id "+c),this.hls.trigger($.Events.SUBTITLE_TRACK_LOADING,{url:w,id:c,groupId:L,deliveryDirectives:r||null})}},f.toggleTrackModes=function(r){var s=this,c=this.media,L=this.subtitleDisplay,w=this.trackId;if(!c)return;var T=p(c.textTracks),R=T.filter(function(x){return x.groupId===s.groupId});if(r===-1)[].slice.call(T).forEach(function(x){x.mode="disabled"});else{var C=R[w];C&&(C.mode="disabled")}var S=R[r];S&&(S.mode=L?"showing":"hidden")},f.setSubtitleTrack=function(r,s){var c,L=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=r;return}if(this.trackId!==r&&this.toggleTrackModes(r),this.trackId===r&&(r===-1||(c=L[r])!==null&&c!==void 0&&c.details)||r<-1||r>=L.length)return;this.clearTimer();var w=L[r];if(this.log("Switching to subtitle track "+r),this.trackId=r,w){var T=w.id,R=w.groupId,C=R===void 0?"":R,S=w.name,x=w.type,_=w.url;this.hls.trigger($.Events.SUBTITLE_TRACK_SWITCH,{id:T,groupId:C,name:S,type:x,url:_});var d=this.switchParams(w.url,s==null?void 0:s.details);this.loadPlaylist(d)}else this.hls.trigger($.Events.SUBTITLE_TRACK_SWITCH,{id:r})},f.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var r=-1,s=p(this.media.textTracks),c=0;c<s.length;c++)if(s[c].mode==="hidden")r=c;else if(s[c].mode==="showing"){r=c;break}this.subtitleTrack!==r&&(this.subtitleTrack=r)},M(o,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(r){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(r,s)}}]),o}(U.default);function p(h){for(var o=[],f=0;f<h.length;f++){var l=h[f];l.kind==="subtitles"&&l.label&&o.push(h[f])}return o}Z.default=m},"./src/controller/timeline-controller.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"TimelineController",function(){return p});var $=P("./src/polyfills/number.ts"),B=P("./src/events.ts"),U=P("./src/utils/cea-608-parser.ts"),K=P("./src/utils/output-filter.ts"),G=P("./src/utils/webvtt-parser.ts"),M=P("./src/utils/texttrack-utils.ts"),O=P("./src/utils/imsc1-ttml-parser.ts"),v=P("./src/types/loader.ts"),m=P("./src/utils/logger.ts"),p=function(){function l(s){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=f(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var c=new K.default(this,"textTrack1"),L=new K.default(this,"textTrack2"),w=new K.default(this,"textTrack3"),T=new K.default(this,"textTrack4");this.cea608Parser1=new U.default(1,c,L),this.cea608Parser2=new U.default(3,w,T)}s.on(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(B.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(B.Events.FRAG_LOADING,this.onFragLoading,this),s.on(B.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(B.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(B.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(B.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(B.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var r=l.prototype;return r.destroy=function(){var c=this.hls;c.off(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),c.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),c.off(B.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),c.off(B.Events.FRAG_LOADING,this.onFragLoading,this),c.off(B.Events.FRAG_LOADED,this.onFragLoaded,this),c.off(B.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),c.off(B.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),c.off(B.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),c.off(B.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),c.off(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},r.addCues=function(c,L,w,T,R){for(var C=!1,S=R.length;S--;){var x=R[S],_=o(x[0],x[1],L,w);if(_>=0&&(x[0]=Math.min(x[0],L),x[1]=Math.max(x[1],w),C=!0,_/(w-L)>.5))return}if(C||R.push([L,w]),this.config.renderTextTracksNatively){var d=this.captionsTracks[c];this.Cues.newCue(d,L,w,T)}else{var u=this.Cues.newCue(null,L,w,T);this.hls.trigger(B.Events.CUES_PARSED,{type:"captions",cues:u,track:c})}},r.onInitPtsFound=function(c,L){var w=this,T=L.frag,R=L.id,C=L.initPTS,S=L.timescale,x=this.unparsedVttFrags;R==="main"&&(this.initPTS[T.cc]=C,this.timescale[T.cc]=S),x.length&&(this.unparsedVttFrags=[],x.forEach(function(_){w.onFragLoaded(B.Events.FRAG_LOADED,_)}))},r.getExistingTrack=function(c){var L=this.media;if(L)for(var w=0;w<L.textTracks.length;w++){var T=L.textTracks[w];if(T[c])return T}return null},r.createCaptionsTrack=function(c){this.config.renderTextTracksNatively?this.createNativeTrack(c):this.createNonNativeTrack(c)},r.createNativeTrack=function(c){if(this.captionsTracks[c])return;var L=this.captionsProperties,w=this.captionsTracks,T=this.media,R=L[c],C=R.label,S=R.languageCode,x=this.getExistingTrack(c);if(x)w[c]=x,Object(M.clearCurrentCues)(w[c]),Object(M.sendAddTrackEvent)(w[c],T);else{var _=this.createTextTrack("captions",C,S);_&&(_[c]=!0,w[c]=_)}},r.createNonNativeTrack=function(c){if(this.nonNativeCaptionsTracks[c])return;var L=this.captionsProperties[c];if(!L)return;var w=L.label,T={_id:c,label:w,kind:"captions",default:L.media?!!L.media.default:!1,closedCaptions:L.media};this.nonNativeCaptionsTracks[c]=T,this.hls.trigger(B.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[T]})},r.createTextTrack=function(c,L,w){var T=this.media;return T?T.addTextTrack(c,L,w):void 0},r.onMediaAttaching=function(c,L){this.media=L.media,this._cleanTracks()},r.onMediaDetaching=function(){var c=this.captionsTracks;Object.keys(c).forEach(function(L){Object(M.clearCurrentCues)(c[L]),delete c[L]}),this.nonNativeCaptionsTracks={}},r.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=f(),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())},r._cleanTracks=function(){var c=this.media;if(!c)return;var L=c.textTracks;if(L)for(var w=0;w<L.length;w++)Object(M.clearCurrentCues)(L[w])},r.onSubtitleTracksUpdated=function(c,L){var w=this;this.textTracks=[];var T=L.subtitleTracks||[],R=T.some(function(_){return _.textCodec===O.IMSC1_CODEC});if(this.config.enableWebVTT||R&&this.config.enableIMSC1){var C=this.tracks&&T&&this.tracks.length===T.length;if(this.tracks=T||[],this.config.renderTextTracksNatively){var S=this.media?this.media.textTracks:[];this.tracks.forEach(function(_,d){var u;if(d<S.length){for(var g=null,E=0;E<S.length;E++)if(h(S[E],_)){g=S[E];break}g&&(u=g)}u?Object(M.clearCurrentCues)(u):(u=w.createTextTrack("subtitles",_.name,_.lang),u&&(u.mode="disabled")),u&&(u.groupId=_.groupId,w.textTracks.push(u))})}else if(!C&&this.tracks&&this.tracks.length){var x=this.tracks.map(function(_){return{label:_.name,kind:_.type.toLowerCase(),default:_.default,subtitleTrack:_}});this.hls.trigger(B.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:x})}}},r.onManifestLoaded=function(c,L){var w=this;this.config.enableCEA708Captions&&L.captions&&L.captions.forEach(function(T){var R=/(?:CC|SERVICE)([1-4])/.exec(T.instreamId);if(!R)return;var C="textTrack"+R[1],S=w.captionsProperties[C];if(!S)return;S.label=T.name,T.lang&&(S.languageCode=T.lang),S.media=T})},r.onFragLoading=function(c,L){var w=this.cea608Parser1,T=this.cea608Parser2,R=this.lastSn,C=this.lastPartIndex;if(!this.enabled||!(w&&T))return;if(L.frag.type===v.PlaylistLevelType.MAIN){var S,x,_=L.frag.sn,d=(S=L==null||((x=L.part)===null||x===void 0)?void 0:x.index)!=null?S:-1;_===R+1||_===R&&d===C+1||(w.reset(),T.reset()),this.lastSn=_,this.lastPartIndex=d}},r.onFragLoaded=function(c,L){var w=L.frag,T=L.payload,R=this.initPTS,C=this.unparsedVttFrags;if(w.type===v.PlaylistLevelType.SUBTITLE)if(T.byteLength){if(!Object($.isFiniteNumber)(R[w.cc])){C.push(L),R.length&&this.hls.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:w,error:new Error("Missing initial subtitle PTS")});return}var S=w.decryptdata;if(S==null||S.key==null||S.method!=="AES-128"){var x=this.tracks[w.level],_=this.vttCCs;_[w.cc]||(_[w.cc]={start:w.start,prevCC:this.prevCC,new:!0},this.prevCC=w.cc),x&&x.textCodec===O.IMSC1_CODEC?this._parseIMSC1(w,T):this._parseVTTs(w,T,_)}}else this.hls.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:w,error:new Error("Empty subtitle payload")})},r._parseIMSC1=function(c,L){var w=this,T=this.hls;Object(O.parseIMSC1)(L,this.initPTS[c.cc],this.timescale[c.cc],function(R){w._appendCues(R,c.level),T.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:c})},function(R){m.logger.log("Failed to parse IMSC1: "+R),T.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c,error:R})})},r._parseVTTs=function(c,L,w){var T=this,R=this.hls;Object(G.parseWebVTT)(L,this.initPTS[c.cc],this.timescale[c.cc],w,c.cc,c.start,function(C){T._appendCues(C,c.level),R.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:c})},function(C){T._fallbackToIMSC1(c,L),m.logger.log("Failed to parse VTT cue: "+C),R.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c,error:C})})},r._fallbackToIMSC1=function(c,L){var w=this,T=this.tracks[c.level];T.textCodec||Object(O.parseIMSC1)(L,this.initPTS[c.cc],this.timescale[c.cc],function(){T.textCodec=O.IMSC1_CODEC,w._parseIMSC1(c,L)},function(){T.textCodec="wvtt"})},r._appendCues=function(c,L){var w=this.hls;if(this.config.renderTextTracksNatively){var T=this.textTracks[L];if(T.mode==="disabled")return;c.forEach(function(S){return Object(M.addCueToTrack)(T,S)})}else{var R=this.tracks[L],C=R.default?"default":"subtitles"+L;w.trigger(B.Events.CUES_PARSED,{type:"subtitles",cues:c,track:C})}},r.onFragDecrypted=function(c,L){var w=L.frag;if(w.type===v.PlaylistLevelType.SUBTITLE){if(!Object($.isFiniteNumber)(this.initPTS[w.cc])){this.unparsedVttFrags.push(L);return}this.onFragLoaded(B.Events.FRAG_LOADED,L)}},r.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},r.onFragParsingUserdata=function(c,L){var w=this.cea608Parser1,T=this.cea608Parser2;if(!this.enabled||!(w&&T))return;for(var R=0;R<L.samples.length;R++){var C=L.samples[R].bytes;if(C){var S=this.extractCea608Data(C);w.addData(L.samples[R].pts,S[0]),T.addData(L.samples[R].pts,S[1])}}},r.onBufferFlushing=function(c,L){var w=L.startOffset,T=L.endOffset,R=L.endOffsetSubtitles,C=L.type,S=this.media;if(!S||S.currentTime<T)return;if(!C||C==="video"){var x=this.captionsTracks;Object.keys(x).forEach(function(d){return Object(M.removeCuesInRange)(x[d],w,T)})}if(this.config.renderTextTracksNatively&&(w===0&&R!==void 0)){var _=this.textTracks;Object.keys(_).forEach(function(d){return Object(M.removeCuesInRange)(_[d],w,R)})}},r.extractCea608Data=function(c){for(var L=c[0]&31,w=2,T=[[],[]],R=0;R<L;R++){var C=c[w++],S=127&c[w++],x=127&c[w++],_=(4&C)!==0,d=3&C;if(S===0&&x===0)continue;_&&((d===0||d===1)&&(T[d].push(S),T[d].push(x)))}return T},l}();function h(l,r){return l&&l.label===r.name&&!(l.textTrack1||l.textTrack2)}function o(l,r,s,c){return Math.min(r,c)-Math.max(l,s)}function f(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return $});var $=function(){function B(K,G){this.subtle=void 0,this.aesIV=void 0,this.subtle=K,this.aesIV=G}var U=B.prototype;return U.decrypt=function(G,M){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},M,G)},B}()},"./src/crypt/aes-decryptor.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"removePadding",function(){return B}),P.d(Z,"default",function(){return U});var $=P("./src/utils/typed-array.ts");function B(K){var G=K.byteLength,M=G&&new DataView(K.buffer).getUint8(G-1);return M?Object($.sliceUint8)(K,0,G-M):K}var U=function(){function K(){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 G=K.prototype;return G.uint8ArrayToUint32Array_=function(O){for(var v=new DataView(O),m=new Uint32Array(4),p=0;p<4;p++)m[p]=v.getUint32(p*4);return m},G.initTable=function(){var O=this.sBox,v=this.invSBox,m=this.subMix,p=m[0],h=m[1],o=m[2],f=m[3],l=this.invSubMix,r=l[0],s=l[1],c=l[2],L=l[3],w=new Uint32Array(256),T=0,R=0,C=0;for(C=0;C<256;C++)C<128?w[C]=C<<1:w[C]=C<<1^283;for(C=0;C<256;C++){var S=R^R<<1^R<<2^R<<3^R<<4;S=S>>>8^S&255^99,O[T]=S,v[S]=T;var x=w[T],_=w[x],d=w[_],u=w[S]*257^S*16843008;p[T]=u<<24|u>>>8,h[T]=u<<16|u>>>16,o[T]=u<<8|u>>>24,f[T]=u,u=d*16843009^_*65537^x*257^T*16843008,r[S]=u<<24|u>>>8,s[S]=u<<16|u>>>16,c[S]=u<<8|u>>>24,L[S]=u,T?(T=x^w[w[w[d^x]]],R^=w[w[R]]):T=R=1}},G.expandKey=function(O){for(var v=this.uint8ArrayToUint32Array_(O),m=!0,p=0;p<v.length&&m;)m=v[p]===this.key[p],p++;if(m)return;this.key=v;var h=this.keySize=v.length;if(h!==4&&h!==6&&h!==8)throw new Error("Invalid aes key size="+h);var o=this.ksRows=(h+6+1)*4,f,l,r=this.keySchedule=new Uint32Array(o),s=this.invKeySchedule=new Uint32Array(o),c=this.sBox,L=this.rcon,w=this.invSubMix,T=w[0],R=w[1],C=w[2],S=w[3],x,_;for(f=0;f<o;f++){if(f<h){x=r[f]=v[f];continue}_=x,f%h===0?(_=_<<8|_>>>24,_=c[_>>>24]<<24|c[_>>>16&255]<<16|c[_>>>8&255]<<8|c[_&255],_^=L[f/h|0]<<24):h>6&&f%h===4&&(_=c[_>>>24]<<24|c[_>>>16&255]<<16|c[_>>>8&255]<<8|c[_&255]),r[f]=x=(r[f-h]^_)>>>0}for(l=0;l<o;l++)f=o-l,l&3?_=r[f]:_=r[f-4],l<4||f<=4?s[l]=_:s[l]=T[c[_>>>24]]^R[c[_>>>16&255]]^C[c[_>>>8&255]]^S[c[_&255]],s[l]=s[l]>>>0},G.networkToHostOrderSwap=function(O){return O<<24|(O&65280)<<8|(O&16711680)>>8|O>>>24},G.decrypt=function(O,v,m){for(var p=this.keySize+6,h=this.invKeySchedule,o=this.invSBox,f=this.invSubMix,l=f[0],r=f[1],s=f[2],c=f[3],L=this.uint8ArrayToUint32Array_(m),w=L[0],T=L[1],R=L[2],C=L[3],S=new Int32Array(O),x=new Int32Array(S.length),_,d,u,g,E,N,D,H,j,I,b,W,Y,ie,oe=this.networkToHostOrderSwap;v<S.length;){for(j=oe(S[v]),I=oe(S[v+1]),b=oe(S[v+2]),W=oe(S[v+3]),E=j^h[0],N=W^h[1],D=b^h[2],H=I^h[3],Y=4,ie=1;ie<p;ie++)_=l[E>>>24]^r[N>>16&255]^s[D>>8&255]^c[H&255]^h[Y],d=l[N>>>24]^r[D>>16&255]^s[H>>8&255]^c[E&255]^h[Y+1],u=l[D>>>24]^r[H>>16&255]^s[E>>8&255]^c[N&255]^h[Y+2],g=l[H>>>24]^r[E>>16&255]^s[N>>8&255]^c[D&255]^h[Y+3],E=_,N=d,D=u,H=g,Y=Y+4;_=o[E>>>24]<<24^o[N>>16&255]<<16^o[D>>8&255]<<8^o[H&255]^h[Y],d=o[N>>>24]<<24^o[D>>16&255]<<16^o[H>>8&255]<<8^o[E&255]^h[Y+1],u=o[D>>>24]<<24^o[H>>16&255]<<16^o[E>>8&255]<<8^o[N&255]^h[Y+2],g=o[H>>>24]<<24^o[E>>16&255]<<16^o[N>>8&255]<<8^o[D&255]^h[Y+3],x[v]=oe(_^w),x[v+1]=oe(g^T),x[v+2]=oe(u^R),x[v+3]=oe(d^C),w=j,T=I,R=b,C=W,v=v+4}return x.buffer},K}()},"./src/crypt/decrypter.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return v});var $=P("./src/crypt/aes-crypto.ts"),B=P("./src/crypt/fast-aes-key.ts"),U=P("./src/crypt/aes-decryptor.ts"),K=P("./src/utils/logger.ts"),G=P("./src/utils/mp4-tools.ts"),M=P("./src/utils/typed-array.ts"),O=16,v=function(){function m(h,o,f){var l=f===void 0?{}:f,r=l.removePKCS7Padding,s=r===void 0?!0:r;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=h,this.config=o,this.removePKCS7Padding=s,s)try{var c=self.crypto;c&&(this.subtle=c.subtle||c.webkitSubtle)}catch(L){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var p=m.prototype;return p.destroy=function(){this.observer=null},p.isSync=function(){return this.config.enableSoftwareAES},p.flush=function(){var o=this.currentResult;if(!o){this.reset();return}var f=new Uint8Array(o);return this.reset(),this.removePKCS7Padding?Object(U.removePadding)(f):f},p.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},p.decrypt=function(o,f,l,r){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(o),f,l);var s=this.flush();s&&r(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(o),f,l).then(r)},p.softwareDecrypt=function(o,f,l){var r=this.currentIV,s=this.currentResult,c=this.remainderData;this.logOnce("JS AES decrypt"),c&&(o=Object(G.appendUint8Array)(c,o),this.remainderData=null);var L=this.getValidChunk(o);if(!L.length)return null;r&&(l=r);var w=this.softwareDecrypter;w||(w=this.softwareDecrypter=new U.default),w.expandKey(f);var T=s;return this.currentResult=w.decrypt(L.buffer,0,l),this.currentIV=Object(M.sliceUint8)(L,-16).buffer,T||null},p.webCryptoDecrypt=function(o,f,l){var r=this,s=this.subtle;return(this.key!==f||!this.fastAesKey)&&(this.key=f,this.fastAesKey=new B.default(s,f)),this.fastAesKey.expandKey().then(function(c){if(!s)return Promise.reject(new Error("web crypto not initialized"));var L=new $.default(s,l);return L.decrypt(o.buffer,c)}).catch(function(c){return r.onWebCryptoError(c,o,f,l)})},p.onWebCryptoError=function(o,f,l,r){return K.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",o),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(f,l,r)},p.getValidChunk=function(o){var f=o,l=o.length-o.length%O;return l!==o.length&&(f=Object(M.sliceUint8)(o,0,l),this.remainderData=Object(M.sliceUint8)(o,l)),f},p.logOnce=function(o){if(!this.logEnabled)return;K.logger.log("[decrypter.ts]: "+o),this.logEnabled=!1},m}()},"./src/crypt/fast-aes-key.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return $});var $=function(){function B(K,G){this.subtle=void 0,this.key=void 0,this.subtle=K,this.key=G}var U=B.prototype;return U.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},B}()},"./src/demux/aacdemuxer.ts":function(ue,Z,P){"use strict";P.r(Z);var $=P("./src/demux/base-audio-demuxer.ts"),B=P("./src/demux/adts.ts"),U=P("./src/utils/logger.ts"),K=P("./src/demux/id3.ts");function G(v,m){v.prototype=Object.create(m.prototype),v.prototype.constructor=v,M(v,m)}function M(v,m){return M=Object.setPrototypeOf||function(h,o){return h.__proto__=o,h},M(v,m)}var O=function(v){G(m,v);function m(h,o){var f;return f=v.call(this)||this,f.observer=void 0,f.config=void 0,f.observer=h,f.config=o,f}var p=m.prototype;return p.resetInitSegment=function(o,f,l){v.prototype.resetInitSegment.call(this,o,f,l),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:o,duration:l,inputTimeScale:9e4,dropped:0}},m.probe=function(o){if(!o)return!1;for(var f=K.getID3Data(o,0)||[],l=f.length,r=o.length;l<r;l++)if(B.probe(o,l))return U.logger.log("ADTS sync word found !"),!0;return!1},p.canParse=function(o,f){return B.canParse(o,f)},p.appendFrame=function(o,f,l){B.initTrackConfig(o,this.observer,f,l,o.manifestCodec);var r=B.appendFrame(o,f,l,this.initPTS,this.frameIndex);if(r&&r.missing===0)return r},m}($.default);O.minProbeByteLength=9,Z.default=O},"./src/demux/adts.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"getAudioConfig",function(){return K}),P.d(Z,"isHeaderPattern",function(){return G}),P.d(Z,"getHeaderLength",function(){return M}),P.d(Z,"getFullFrameLength",function(){return O}),P.d(Z,"canGetFrameLength",function(){return v}),P.d(Z,"isHeader",function(){return m}),P.d(Z,"canParse",function(){return p}),P.d(Z,"probe",function(){return h}),P.d(Z,"initTrackConfig",function(){return o}),P.d(Z,"getFrameDuration",function(){return f}),P.d(Z,"parseFrameHeader",function(){return l}),P.d(Z,"appendFrame",function(){return r});var $=P("./src/utils/logger.ts"),B=P("./src/errors.ts"),U=P("./src/events.ts");function K(s,c,L,w){var T,R,C,S,x=navigator.userAgent.toLowerCase(),_=w,d=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];T=((c[L+2]&192)>>>6)+1;var u=(c[L+2]&60)>>>2;if(u>d.length-1){s.trigger(U.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+u});return}return C=(c[L+2]&1)<<2,C|=(c[L+3]&192)>>>6,$.logger.log("manifest codec:"+w+", ADTS type:"+T+", samplingIndex:"+u),/firefox/i.test(x)?u>=6?(T=5,S=new Array(4),R=u-3):(T=2,S=new Array(2),R=u):x.indexOf("android")!==-1?(T=2,S=new Array(2),R=u):(T=5,S=new Array(4),w&&(w.indexOf("mp4a.40.29")!==-1||w.indexOf("mp4a.40.5")!==-1)||!w&&u>=6?R=u-3:((w&&w.indexOf("mp4a.40.2")!==-1&&(u>=6&&C===1||/vivaldi/i.test(x))||!w&&C===1)&&(T=2,S=new Array(2)),R=u)),S[0]=T<<3,S[0]|=(u&14)>>1,S[1]|=(u&1)<<7,S[1]|=C<<3,T===5&&(S[1]|=(R&14)>>1,S[2]=(R&1)<<7,S[2]|=2<<2,S[3]=0),{config:S,samplerate:d[u],channelCount:C,codec:"mp4a.40."+T,manifestCodec:_}}function G(s,c){return s[c]===255&&(s[c+1]&246)===240}function M(s,c){return s[c+1]&1?7:9}function O(s,c){return(s[c+3]&3)<<11|s[c+4]<<3|(s[c+5]&224)>>>5}function v(s,c){return c+5<s.length}function m(s,c){return c+1<s.length&&G(s,c)}function p(s,c){return v(s,c)&&G(s,c)&&O(s,c)<=s.length-c}function h(s,c){if(m(s,c)){var L=M(s,c);if(c+L>=s.length)return!1;var w=O(s,c);if(w<=L)return!1;var T=c+w;return T===s.length||m(s,T)}return!1}function o(s,c,L,w,T){if(!s.samplerate){var R=K(c,L,w,T);if(!R)return;s.config=R.config,s.samplerate=R.samplerate,s.channelCount=R.channelCount,s.codec=R.codec,s.manifestCodec=R.manifestCodec,$.logger.log("parsed codec:"+s.codec+", rate:"+R.samplerate+", channels:"+R.channelCount)}}function f(s){return 1024*9e4/s}function l(s,c,L,w,T){var R=M(s,c),C=O(s,c);if(C-=R,C>0){var S=L+w*T;return{headerLength:R,frameLength:C,stamp:S}}}function r(s,c,L,w,T){var R=f(s.samplerate),C=l(c,L,w,T,R);if(C){var S=C.frameLength,x=C.headerLength,_=C.stamp,d=x+S,u=Math.max(0,L+d-c.length),g;u?(g=new Uint8Array(d-x),g.set(c.subarray(L+x,c.length),0)):g=c.subarray(L+x,L+d);var E={unit:g,pts:_};return u||s.samples.push(E),{sample:E,length:d,missing:u}}}},"./src/demux/base-audio-demuxer.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"initPTSFn",function(){return O});var $=P("./src/polyfills/number.ts"),B=P("./src/demux/id3.ts"),U=P("./src/demux/dummy-demuxed-track.ts"),K=P("./src/utils/mp4-tools.ts"),G=P("./src/utils/typed-array.ts"),M=function(){function v(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var m=v.prototype;return m.resetInitSegment=function(h,o,f){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},m.resetTimeStamp=function(){},m.resetContiguity=function(){},m.canParse=function(h,o){return!1},m.appendFrame=function(h,o,f){},m.demux=function(h,o){this.cachedData&&(h=Object(K.appendUint8Array)(this.cachedData,h),this.cachedData=null);var f=B.getID3Data(h,0),l=f?f.length:0,r,s,c=this._audioTrack,L=this._id3Track,w=f?B.getTimeStamp(f):void 0,T=h.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=O(w,o)),f&&f.length>0&&L.samples.push({pts:this.initPTS,dts:this.initPTS,data:f}),s=this.initPTS;l<T;){if(this.canParse(h,l)){var R=this.appendFrame(c,h,l);R?(this.frameIndex++,s=R.sample.pts,l+=R.length,r=l):l=T}else B.canParse(h,l)?(f=B.getID3Data(h,l),L.samples.push({pts:s,dts:s,data:f}),l+=f.length,r=l):l++;if(l===T&&r!==T){var C=Object(G.sliceUint8)(h,r);this.cachedData?this.cachedData=Object(K.appendUint8Array)(this.cachedData,C):this.cachedData=C}}return{audioTrack:c,avcTrack:Object(U.dummyTrack)(),id3Track:L,textTrack:Object(U.dummyTrack)()}},m.demuxSampleAes=function(h,o,f){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},m.flush=function(h){var o=this.cachedData;return o&&(this.cachedData=null,this.demux(o,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(U.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(U.dummyTrack)()}},m.destroy=function(){},v}(),O=function(m,p){return Object($.isFiniteNumber)(m)?m*90:p*9e4};Z.default=M},"./src/demux/chunk-cache.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return $});var $=function(){function U(){this.chunks=[],this.dataLength=0}var K=U.prototype;return K.push=function(M){this.chunks.push(M),this.dataLength+=M.length},K.flush=function(){var M=this.chunks,O=this.dataLength,v;if(M.length)M.length===1?v=M[0]:v=B(M,O);else return new Uint8Array(0);return this.reset(),v},K.reset=function(){this.chunks.length=0,this.dataLength=0},U}();function B(U,K){for(var G=new Uint8Array(K),M=0,O=0;O<U.length;O++){var v=U[O];G.set(v,M),M+=v.length}return G}},"./src/demux/dummy-demuxed-track.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"dummyTrack",function(){return $});function $(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ue,Z,P){"use strict";P.r(Z);var $=P("./src/utils/logger.ts"),B=function(){function U(G){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=G,this.bytesAvailable=G.byteLength,this.word=0,this.bitsAvailable=0}var K=U.prototype;return K.loadWord=function(){var M=this.data,O=this.bytesAvailable,v=M.byteLength-O,m=new Uint8Array(4),p=Math.min(4,O);if(p===0)throw new Error("no bytes available");m.set(M.subarray(v,v+p)),this.word=new DataView(m.buffer).getUint32(0),this.bitsAvailable=p*8,this.bytesAvailable-=p},K.skipBits=function(M){var O;this.bitsAvailable>M?(this.word<<=M,this.bitsAvailable-=M):(M-=this.bitsAvailable,O=M>>3,M-=O>>3,this.bytesAvailable-=O,this.loadWord(),this.word<<=M,this.bitsAvailable-=M)},K.readBits=function(M){var O=Math.min(this.bitsAvailable,M),v=this.word>>>32-O;return M>32&&$.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=O,this.bitsAvailable>0?this.word<<=O:this.bytesAvailable>0&&this.loadWord(),O=M-O,O>0&&this.bitsAvailable?v<<O|this.readBits(O):v},K.skipLZ=function(){var M;for(M=0;M<this.bitsAvailable;++M)if((this.word&2147483648>>>M)!==0)return this.word<<=M,this.bitsAvailable-=M,M;return this.loadWord(),M+this.skipLZ()},K.skipUEG=function(){this.skipBits(1+this.skipLZ())},K.skipEG=function(){this.skipBits(1+this.skipLZ())},K.readUEG=function(){var M=this.skipLZ();return this.readBits(M+1)-1},K.readEG=function(){var M=this.readUEG();return 1&M?1+M>>>1:-1*(M>>>1)},K.readBoolean=function(){return this.readBits(1)===1},K.readUByte=function(){return this.readBits(8)},K.readUShort=function(){return this.readBits(16)},K.readUInt=function(){return this.readBits(32)},K.skipScalingList=function(M){for(var O=8,v=8,m,p=0;p<M;p++)v!==0&&(m=this.readEG(),v=(O+m+256)%256),O=v===0?O:v},K.readSPS=function(){var M=0,O=0,v=0,m=0,p,h,o,f=this.readUByte.bind(this),l=this.readBits.bind(this),r=this.readUEG.bind(this),s=this.readBoolean.bind(this),c=this.skipBits.bind(this),L=this.skipEG.bind(this),w=this.skipUEG.bind(this),T=this.skipScalingList.bind(this);f();var R=f();if(l(5),c(3),f(),w(),R===100||R===110||R===122||R===244||R===44||R===83||R===86||R===118||R===128){var C=r();if(C===3&&c(1),w(),w(),c(1),s())for(h=C!==3?8:12,o=0;o<h;o++)s()&&(o<6?T(16):T(64))}w();var S=r();if(S===0)r();else if(S===1)for(c(1),L(),L(),p=r(),o=0;o<p;o++)L();w(),c(1);var x=r(),_=r(),d=l(1);d===0&&c(1),c(1),s()&&(M=r(),O=r(),v=r(),m=r());var u=[1,1];if(s()&&s()){var g=f();switch(g){case 1:u=[1,1];break;case 2:u=[12,11];break;case 3:u=[10,11];break;case 4:u=[16,11];break;case 5:u=[40,33];break;case 6:u=[24,11];break;case 7:u=[20,11];break;case 8:u=[32,11];break;case 9:u=[80,33];break;case 10:u=[18,11];break;case 11:u=[15,11];break;case 12:u=[64,33];break;case 13:u=[160,99];break;case 14:u=[4,3];break;case 15:u=[3,2];break;case 16:u=[2,1];break;case 255:{u=[f()<<8|f(),f()<<8|f()];break}}}return{width:Math.ceil((x+1)*16-M*2-O*2),height:(2-d)*(_+1)*16-(d?2:4)*(v+m),pixelRatio:u}},K.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},U}();Z.default=B},"./src/demux/id3.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"isHeader",function(){return $}),P.d(Z,"isFooter",function(){return B}),P.d(Z,"getID3Data",function(){return U}),P.d(Z,"canParse",function(){return G}),P.d(Z,"getTimeStamp",function(){return M}),P.d(Z,"isTimeStampFrame",function(){return O}),P.d(Z,"getID3Frames",function(){return m}),P.d(Z,"decodeFrame",function(){return p}),P.d(Z,"utf8ArrayToStr",function(){return r}),P.d(Z,"testables",function(){return s});var $=function(T,R){return R+10<=T.length&&(T[R]===73&&T[R+1]===68&&T[R+2]===51&&(T[R+3]<255&&T[R+4]<255&&(T[R+6]<128&&T[R+7]<128&&T[R+8]<128&&T[R+9]<128)))},B=function(T,R){return R+10<=T.length&&(T[R]===51&&T[R+1]===68&&T[R+2]===73&&(T[R+3]<255&&T[R+4]<255&&(T[R+6]<128&&T[R+7]<128&&T[R+8]<128&&T[R+9]<128)))},U=function(T,R){for(var C=R,S=0;$(T,R);){S+=10;var x=K(T,R+6);S+=x,B(T,R+10)&&(S+=10),R+=S}return S>0?T.subarray(C,C+S):void 0},K=function(T,R){var C=0;return C=(T[R]&127)<<21,C|=(T[R+1]&127)<<14,C|=(T[R+2]&127)<<7,C|=T[R+3]&127,C},G=function(T,R){return $(T,R)&&K(T,R+6)+10<=T.length-R},M=function(T){for(var R=m(T),C=0;C<R.length;C++){var S=R[C];if(O(S))return l(S)}return},O=function(T){return T&&T.key==="PRIV"&&T.info==="com.apple.streaming.transportStreamTimestamp"},v=function(T){var R=String.fromCharCode(T[0],T[1],T[2],T[3]),C=K(T,4),S=10;return{type:R,size:C,data:T.subarray(S,S+C)}},m=function(T){for(var R=0,C=[];$(T,R);){var S=K(T,R+6);R+=10;for(var x=R+S;R+8<x;){var _=v(T.subarray(R)),d=p(_);d&&C.push(d),R+=_.size+10}B(T,R)&&(R+=10)}return C},p=function(T){return T.type==="PRIV"?h(T):T.type[0]==="W"?f(T):o(T)},h=function(T){if(T.size<2)return;var R=r(T.data,!0),C=new Uint8Array(T.data.subarray(R.length+1));return{key:T.type,info:R,data:C.buffer}},o=function(T){if(T.size<2)return;if(T.type==="TXXX"){var R=1,C=r(T.data.subarray(R),!0);R+=C.length+1;var S=r(T.data.subarray(R));return{key:T.type,info:C,data:S}}var x=r(T.data.subarray(1));return{key:T.type,data:x}},f=function(T){if(T.type==="WXXX"){if(T.size<2)return;var R=1,C=r(T.data.subarray(R),!0);R+=C.length+1;var S=r(T.data.subarray(R));return{key:T.type,info:C,data:S}}var x=r(T.data);return{key:T.type,data:x}},l=function(T){if(T.data.byteLength===8){var R=new Uint8Array(T.data),C=R[3]&1,S=(R[4]<<23)+(R[5]<<15)+(R[6]<<7)+R[7];return S/=45,C&&(S+=4772185884e-2),Math.round(S)}return},r=function(T,R){R===void 0&&(R=!1);var C=L();if(C){var S=C.decode(T);if(R){var x=S.indexOf("\0");return x!==-1?S.substring(0,x):S}return S.replace(/\0/g,"")}for(var _=T.length,d,u,g,E="",N=0;N<_;){if(d=T[N++],d===0&&R)return E;if(d===0||d===3)continue;switch(d>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:E+=String.fromCharCode(d);break;case 12:case 13:u=T[N++],E+=String.fromCharCode((d&31)<<6|u&63);break;case 14:u=T[N++],g=T[N++],E+=String.fromCharCode((d&15)<<12|(u&63)<<6|(g&63)<<0);break;default:}}return E},s={decodeTextFrame:o},c;function L(){return!c&&typeof self.TextDecoder!="undefined"&&(c=new self.TextDecoder("utf-8")),c}},"./src/demux/mp3demuxer.ts":function(ue,Z,P){"use strict";P.r(Z);var $=P("./src/demux/base-audio-demuxer.ts"),B=P("./src/demux/id3.ts"),U=P("./src/utils/logger.ts"),K=P("./src/demux/mpegaudio.ts");function G(v,m){v.prototype=Object.create(m.prototype),v.prototype.constructor=v,M(v,m)}function M(v,m){return M=Object.setPrototypeOf||function(h,o){return h.__proto__=o,h},M(v,m)}var O=function(v){G(m,v);function m(){return v.apply(this,arguments)||this}var p=m.prototype;return p.resetInitSegment=function(o,f,l){v.prototype.resetInitSegment.call(this,o,f,l),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:o,duration:l,inputTimeScale:9e4,dropped:0}},m.probe=function(o){if(!o)return!1;for(var f=B.getID3Data(o,0)||[],l=f.length,r=o.length;l<r;l++)if(K.probe(o,l))return U.logger.log("MPEG Audio sync word found !"),!0;return!1},p.canParse=function(o,f){return K.canParse(o,f)},p.appendFrame=function(o,f,l){return this.initPTS===null?void 0:K.appendFrame(o,f,l,this.initPTS,this.frameIndex)},m}($.default);O.minProbeByteLength=4,Z.default=O},"./src/demux/mp4demuxer.ts":function(ue,Z,P){"use strict";P.r(Z);var $=P("./src/utils/mp4-tools.ts"),B=P("./src/demux/dummy-demuxed-track.ts"),U=function(){function K(M,O){this.remainderData=null,this.config=void 0,this.config=O}var G=K.prototype;return G.resetTimeStamp=function(){},G.resetInitSegment=function(){},G.resetContiguity=function(){},K.probe=function(O){return Object($.findBox)({data:O,start:0,end:Math.min(O.length,16384)},["moof"]).length>0},G.demux=function(O){var v=O,m=Object(B.dummyTrack)();if(this.config.progressive){this.remainderData&&(v=Object($.appendUint8Array)(this.remainderData,O));var p=Object($.segmentValidRange)(v);this.remainderData=p.remainder,m.samples=p.valid||new Uint8Array}else m.samples=v;return{audioTrack:Object(B.dummyTrack)(),avcTrack:m,id3Track:Object(B.dummyTrack)(),textTrack:Object(B.dummyTrack)()}},G.flush=function(){var O=Object(B.dummyTrack)();return O.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(B.dummyTrack)(),avcTrack:O,id3Track:Object(B.dummyTrack)(),textTrack:Object(B.dummyTrack)()}},G.demuxSampleAes=function(O,v,m){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},G.destroy=function(){},K}();U.minProbeByteLength=1024,Z.default=U},"./src/demux/mpegaudio.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"appendFrame",function(){return M}),P.d(Z,"parseHeader",function(){return O}),P.d(Z,"isHeaderPattern",function(){return v}),P.d(Z,"isHeader",function(){return m}),P.d(Z,"canParse",function(){return p}),P.d(Z,"probe",function(){return h});var $=null,B=[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],U=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],K=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],G=[0,1,1,4];function M(o,f,l,r,s){if(l+24>f.length)return;var c=O(f,l);if(c&&l+c.frameLength<=f.length){var L=c.samplesPerFrame*9e4/c.sampleRate,w=r+s*L,T={unit:f.subarray(l,l+c.frameLength),pts:w,dts:w};return o.config=[],o.channelCount=c.channelCount,o.samplerate=c.sampleRate,o.samples.push(T),{sample:T,length:c.frameLength,missing:0}}}function O(o,f){var l=o[f+1]>>3&3,r=o[f+1]>>1&3,s=o[f+2]>>4&15,c=o[f+2]>>2&3;if(l!==1&&s!==0&&s!==15&&c!==3){var L=o[f+2]>>1&1,w=o[f+3]>>6,T=l===3?3-r:r===3?3:4,R=B[T*14+s-1]*1e3,C=l===3?0:l===2?1:2,S=U[C*3+c],x=w===3?1:2,_=K[l][r],d=G[r],u=_*8*d,g=Math.floor(_*R/S+L)*d;if($===null){var E=navigator.userAgent||"",N=E.match(/Chrome\/(\d+)/i);$=N?parseInt(N[1]):0}var D=!!$&&$<=87;return D&&r===2&&R>=224e3&&w===0&&(o[f+3]=o[f+3]|128),{sampleRate:S,channelCount:x,frameLength:g,samplesPerFrame:u}}}function v(o,f){return o[f]===255&&(o[f+1]&224)===224&&(o[f+1]&6)!==0}function m(o,f){return f+1<o.length&&v(o,f)}function p(o,f){var l=4;return v(o,f)&&l<=o.length-f}function h(o,f){if(f+1<o.length&&v(o,f)){var l=4,r=O(o,f),s=l;r!=null&&r.frameLength&&(s=r.frameLength);var c=f+s;return c===o.length||m(o,c)}return!1}},"./src/demux/sample-aes.ts":function(ue,Z,P){"use strict";P.r(Z);var $=P("./src/crypt/decrypter.ts"),B=P("./src/demux/tsdemuxer.ts"),U=function(){function K(M,O,v){this.keyData=void 0,this.decrypter=void 0,this.keyData=v,this.decrypter=new $.default(M,O,{removePKCS7Padding:!1})}var G=K.prototype;return G.decryptBuffer=function(O,v){this.decrypter.decrypt(O,this.keyData.key.buffer,this.keyData.iv.buffer,v)},G.decryptAacSample=function(O,v,m,p){var h=O[v].unit,o=h.subarray(16,h.length-h.length%16),f=o.buffer.slice(o.byteOffset,o.byteOffset+o.length),l=this;this.decryptBuffer(f,function(r){var s=new Uint8Array(r);h.set(s,16),p||l.decryptAacSamples(O,v+1,m)})},G.decryptAacSamples=function(O,v,m){for(;;v++){if(v>=O.length){m();return}if(O[v].unit.length<32)continue;var p=this.decrypter.isSync();if(this.decryptAacSample(O,v,m,p),!p)return}},G.getAvcEncryptedData=function(O){for(var v=Math.floor((O.length-48)/160)*16+16,m=new Int8Array(v),p=0,h=32;h<=O.length-16;h+=160,p+=16)m.set(O.subarray(h,h+16),p);return m},G.getAvcDecryptedUnit=function(O,v){for(var m=new Uint8Array(v),p=0,h=32;h<=O.length-16;h+=160,p+=16)O.set(m.subarray(p,p+16),h);return O},G.decryptAvcSample=function(O,v,m,p,h,o){var f=Object(B.discardEPB)(h.data),l=this.getAvcEncryptedData(f),r=this;this.decryptBuffer(l.buffer,function(s){h.data=r.getAvcDecryptedUnit(f,s),o||r.decryptAvcSamples(O,v,m+1,p)})},G.decryptAvcSamples=function(O,v,m,p){if(O instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;v++,m=0){if(v>=O.length){p();return}for(var h=O[v].units;!(m>=h.length);m++){var o=h[m];if(o.data.length<=48||o.type!==1&&o.type!==5)continue;var f=this.decrypter.isSync();if(this.decryptAvcSample(O,v,m,p,o,f),!f)return}}},K}();Z.default=U},"./src/demux/transmuxer-interface.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return h});var $=P("./node_modules/webworkify-webpack/index.js"),B=P.n($),U=P("./src/events.ts"),K=P("./src/demux/transmuxer.ts"),G=P("./src/utils/logger.ts"),M=P("./src/errors.ts"),O=P("./src/utils/mediasource-helper.ts"),v=P("./node_modules/eventemitter3/index.js"),m=P.n(v),p=Object(O.getMediaSource)()||{isTypeSupported:function(){return!1}},h=function(){function o(l,r,s,c){var L=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=l,this.id=r,this.onTransmuxComplete=s,this.onFlush=c;var w=l.config,T=function(_,d){d=d||{},d.frag=L.frag,d.id=L.id,l.trigger(_,d)};this.observer=new v.EventEmitter,this.observer.on(U.Events.FRAG_DECRYPTED,T),this.observer.on(U.Events.ERROR,T);var R={mp4:p.isTypeSupported("video/mp4"),mpeg:p.isTypeSupported("audio/mpeg"),mp3:p.isTypeSupported('audio/mp4; codecs="mp3"')},C=navigator.vendor;if(w.enableWorker&&typeof Worker!="undefined"){G.logger.log("demuxing in webworker");var S;try{S=this.worker=$("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),S.addEventListener("message",this.onwmsg),S.onerror=function(x){l.trigger(U.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(x.message+" ("+x.filename+":"+x.lineno+")")})},S.postMessage({cmd:"init",typeSupported:R,vendor:C,id:r,config:JSON.stringify(w)})}catch(x){G.logger.warn("Error in worker:",x),G.logger.error("Error while initializing DemuxerWorker, fallback to inline"),S&&self.URL.revokeObjectURL(S.objectURL),this.transmuxer=new K.default(this.observer,R,w,C,r),this.worker=null}}else this.transmuxer=new K.default(this.observer,R,w,C,r)}var f=o.prototype;return f.destroy=function(){var r=this.worker;if(r)r.removeEventListener("message",this.onwmsg),r.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var c=this.observer;c&&c.removeAllListeners(),this.observer=null},f.push=function(r,s,c,L,w,T,R,C,S,x){var _=this;S.transmuxing.start=self.performance.now();var d=this.transmuxer,u=this.worker,g=T?T.start:w.start,E=w.decryptdata,N=this.frag,D=!(N&&w.cc===N.cc),H=!(N&&S.level===N.level),j=N?S.sn-N.sn:-1,I=this.part?S.part-this.part.index:1,b=!H&&(j===1||j===0&&I===1),W=self.performance.now();(H||j||w.stats.parsing.start===0)&&(w.stats.parsing.start=W),T&&(I||!b)&&(T.stats.parsing.start=W);var Y=new K.TransmuxState(D,b,C,H,g);if(!b||D){G.logger.log("[transmuxer-interface, "+w.type+"]: Starting new transmux session for sn: "+S.sn+" p: "+S.part+" level: "+S.level+" id: "+S.id+`
discontinuity: `+D+`
trackSwitch: `+H+`
contiguous: `+b+`
accurateTimeOffset: `+C+`
timeOffset: `+g);var ie=new K.TransmuxConfig(c,L,s,R,x);this.configureTransmuxer(ie)}if(this.frag=w,this.part=T,u)u.postMessage({cmd:"demux",data:r,decryptdata:E,chunkMeta:S,state:Y},r instanceof ArrayBuffer?[r]:[]);else if(d){var oe=d.push(r,E,S,Y);Object(K.isPromise)(oe)?oe.then(function(xe){_.handleTransmuxComplete(xe)}):this.handleTransmuxComplete(oe)}},f.flush=function(r){var s=this;r.transmuxing.start=self.performance.now();var c=this.transmuxer,L=this.worker;if(L)L.postMessage({cmd:"flush",chunkMeta:r});else if(c){var w=c.flush(r);Object(K.isPromise)(w)?w.then(function(T){s.handleFlushResult(T,r)}):this.handleFlushResult(w,r)}},f.handleFlushResult=function(r,s){var c=this;r.forEach(function(L){c.handleTransmuxComplete(L)}),this.onFlush(s)},f.onWorkerMessage=function(r){var s=r.data,c=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,c.trigger(s.event,s.data);break}}},f.configureTransmuxer=function(r){var s=this.worker,c=this.transmuxer;s?s.postMessage({cmd:"configure",config:r}):c&&c.configure(r)},f.handleTransmuxComplete=function(r){r.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(r)},o}()},"./src/demux/transmuxer-worker.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return M});var $=P("./src/demux/transmuxer.ts"),B=P("./src/events.ts"),U=P("./src/utils/logger.ts"),K=P("./node_modules/eventemitter3/index.js"),G=P.n(K);function M(h){var o=new K.EventEmitter,f=function(r,s){h.postMessage({event:r,data:s})};o.on(B.Events.FRAG_DECRYPTED,f),o.on(B.Events.ERROR,f),h.addEventListener("message",function(l){var r=l.data;switch(r.cmd){case"init":{var s=JSON.parse(r.config);h.transmuxer=new $.default(o,r.typeSupported,s,r.vendor,r.id),Object(U.enableLogs)(s.debug),f("init",null);break}case"configure":{h.transmuxer.configure(r.config);break}case"demux":{var c=h.transmuxer.push(r.data,r.decryptdata,r.chunkMeta,r.state);Object($.isPromise)(c)?c.then(function(T){O(h,T)}):O(h,c);break}case"flush":{var L=r.chunkMeta,w=h.transmuxer.flush(L);Object($.isPromise)(w)?w.then(function(T){m(h,T,L)}):m(h,w,L);break}default:break}})}function O(h,o){if(p(o.remuxResult))return;var f=[],l=o.remuxResult,r=l.audio,s=l.video;r&&v(f,r),s&&v(f,s),h.postMessage({event:"transmuxComplete",data:o},f)}function v(h,o){o.data1&&h.push(o.data1.buffer),o.data2&&h.push(o.data2.buffer)}function m(h,o,f){o.forEach(function(l){O(h,l)}),h.postMessage({event:"flush",data:f})}function p(h){return!h.audio&&!h.video&&!h.text&&!h.id3&&!h.initSegment}},"./src/demux/transmuxer.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return s}),P.d(Z,"isPromise",function(){return w}),P.d(Z,"TransmuxConfig",function(){return T}),P.d(Z,"TransmuxState",function(){return R});var $=P("./src/events.ts"),B=P("./src/errors.ts"),U=P("./src/crypt/decrypter.ts"),K=P("./src/demux/aacdemuxer.ts"),G=P("./src/demux/mp4demuxer.ts"),M=P("./src/demux/tsdemuxer.ts"),O=P("./src/demux/mp3demuxer.ts"),v=P("./src/remux/mp4-remuxer.ts"),m=P("./src/remux/passthrough-remuxer.ts"),p=P("./src/demux/chunk-cache.ts"),h=P("./src/utils/mp4-tools.ts"),o=P("./src/utils/logger.ts"),f;try{f=self.performance.now.bind(self.performance)}catch(C){o.logger.debug("Unable to use Performance API on this environment"),f=self.Date.now}var l=[{demux:M.default,remux:v.default},{demux:G.default,remux:m.default},{demux:K.default,remux:v.default},{demux:O.default,remux:v.default}],r=1024;l.forEach(function(C){var S=C.demux;r=Math.max(r,S.minProbeByteLength)});var s=function(){function C(x,_,d,u,g){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new p.default,this.observer=x,this.typeSupported=_,this.config=d,this.vendor=u,this.id=g}var S=C.prototype;return S.configure=function(_){this.transmuxConfig=_,this.decrypter&&this.decrypter.reset()},S.push=function(_,d,u,g){var E=this,N=u.transmuxing;N.executeStart=f();var D=new Uint8Array(_),H=this.cache,j=this.config,I=this.currentTransmuxState,b=this.transmuxConfig;g&&(this.currentTransmuxState=g);var W=c(D,d);if(W&&W.method==="AES-128"){var Y=this.getDecrypter();if(j.enableSoftwareAES){var ie=Y.softwareDecrypt(D,W.key.buffer,W.iv.buffer);if(!ie)return N.executeEnd=f(),L(u);D=new Uint8Array(ie)}else return this.decryptionPromise=Y.webCryptoDecrypt(D,W.key.buffer,W.iv.buffer).then(function(Ie){var Ue=E.push(Ie,null,u);return E.decryptionPromise=null,Ue}),this.decryptionPromise}var oe=g||I,xe=oe.contiguous,ve=oe.discontinuity,we=oe.trackSwitch,Ce=oe.accurateTimeOffset,Se=oe.timeOffset,fe=b.audioCodec,le=b.videoCodec,te=b.defaultInitPts,de=b.duration,se=b.initSegmentData;if((ve||we)&&this.resetInitSegment(se,fe,le,de),ve&&this.resetInitialTimestamp(te),xe||this.resetContiguity(),this.needsProbing(D,ve,we)){if(H.dataLength){var Re=H.flush();D=Object(h.appendUint8Array)(Re,D)}this.configureTransmuxer(D,b)}var Le=this.transmux(D,W,Se,Ce,u),Te=this.currentTransmuxState;return Te.contiguous=!0,Te.discontinuity=!1,Te.trackSwitch=!1,N.executeEnd=f(),Le},S.flush=function(_){var d=this,u=_.transmuxing;u.executeStart=f();var g=this.decrypter,E=this.cache,N=this.currentTransmuxState,D=this.decryptionPromise;if(D)return D.then(function(){return d.flush(_)});var H=[],j=N.timeOffset;if(g){var I=g.flush();I&&H.push(this.push(I,null,_))}var b=E.dataLength;E.reset();var W=this.demuxer,Y=this.remuxer;if(!W||!Y)return b>=r&&this.observer.emit($.Events.ERROR,$.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),u.executeEnd=f(),[L(_)];var ie=W.flush(j);return w(ie)?ie.then(function(oe){return d.flushRemux(H,oe,_),H}):(this.flushRemux(H,ie,_),H)},S.flushRemux=function(_,d,u){var g=d.audioTrack,E=d.avcTrack,N=d.id3Track,D=d.textTrack,H=this.currentTransmuxState,j=H.accurateTimeOffset,I=H.timeOffset;o.logger.log("[transmuxer.ts]: Flushed fragment "+u.sn+(u.part>-1?" p: "+u.part:"")+" of level "+u.level);var b=this.remuxer.remux(g,E,N,D,I,j,!0,this.id);_.push({remuxResult:b,chunkMeta:u}),u.transmuxing.executeEnd=f()},S.resetInitialTimestamp=function(_){var d=this.demuxer,u=this.remuxer;if(!d||!u)return;d.resetTimeStamp(_),u.resetTimeStamp(_)},S.resetContiguity=function(){var _=this.demuxer,d=this.remuxer;if(!_||!d)return;_.resetContiguity(),d.resetNextTimestamp()},S.resetInitSegment=function(_,d,u,g){var E=this.demuxer,N=this.remuxer;if(!E||!N)return;E.resetInitSegment(d,u,g),N.resetInitSegment(_,d,u)},S.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},S.transmux=function(_,d,u,g,E){var N;return d&&d.method==="SAMPLE-AES"?N=this.transmuxSampleAes(_,d,u,g,E):N=this.transmuxUnencrypted(_,u,g,E),N},S.transmuxUnencrypted=function(_,d,u,g){var E=this.demuxer.demux(_,d,!1,!this.config.progressive),N=E.audioTrack,D=E.avcTrack,H=E.id3Track,j=E.textTrack,I=this.remuxer.remux(N,D,H,j,d,u,!1,this.id);return{remuxResult:I,chunkMeta:g}},S.transmuxSampleAes=function(_,d,u,g,E){var N=this;return this.demuxer.demuxSampleAes(_,d,u).then(function(D){var H=N.remuxer.remux(D.audioTrack,D.avcTrack,D.id3Track,D.textTrack,u,g,!1,N.id);return{remuxResult:H,chunkMeta:E}})},S.configureTransmuxer=function(_,d){for(var u=this.config,g=this.observer,E=this.typeSupported,N=this.vendor,D=d.audioCodec,H=d.defaultInitPts,j=d.duration,I=d.initSegmentData,b=d.videoCodec,W,Y=0,ie=l.length;Y<ie;Y++)if(l[Y].demux.probe(_)){W=l[Y];break}W||(o.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),W={demux:G.default,remux:m.default});var oe=this.demuxer,xe=this.remuxer,ve=W.remux,we=W.demux;(!xe||!(xe instanceof ve))&&(this.remuxer=new ve(g,u,E,N)),(!oe||!(oe instanceof we))&&(this.demuxer=new we(g,u,E),this.probe=we.probe),this.resetInitSegment(I,D,b,j),this.resetInitialTimestamp(H)},S.needsProbing=function(_,d,u){return!this.demuxer||!this.remuxer||d||u},S.getDecrypter=function(){var _=this.decrypter;return _||(_=this.decrypter=new U.default(this.observer,this.config)),_},C}();function c(C,S){var x=null;return C.byteLength>0&&S!=null&&S.key!=null&&S.iv!==null&&S.method!=null&&(x=S),x}var L=function(S){return{remuxResult:{},chunkMeta:S}};function w(C){return"then"in C&&C.then instanceof Function}var T=function(S,x,_,d,u){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=S,this.videoCodec=x,this.initSegmentData=_,this.duration=d,this.defaultInitPts=u},R=function(S,x,_,d,u){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=S,this.contiguous=x,this.accurateTimeOffset=_,this.trackSwitch=d,this.timeOffset=u}},"./src/demux/tsdemuxer.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"discardEPB",function(){return L});var $=P("./src/demux/adts.ts"),B=P("./src/demux/mpegaudio.ts"),U=P("./src/demux/exp-golomb.ts"),K=P("./src/demux/id3.ts"),G=P("./src/demux/sample-aes.ts"),M=P("./src/events.ts"),O=P("./src/utils/mp4-tools.ts"),v=P("./src/utils/logger.ts"),m=P("./src/errors.ts"),p={video:1,audio:2,id3:3,text:4},h=function(){function w(R,C,S){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=R,this.config=C,this.typeSupported=S}w.probe=function(C){var S=w.syncOffset(C);return S<0?!1:(S&&v.logger.warn("MPEG2-TS detected but first sync word found @ offset "+S+", junk ahead ?"),!0)},w.syncOffset=function(C){for(var S=Math.min(1e3,C.length-3*188),x=0;x<S;){if(C[x]===71&&C[x+188]===71&&C[x+2*188]===71)return x;x++}return-1},w.createTrack=function(C,S){return{container:C==="video"||C==="audio"?"video/mp2t":void 0,type:C,id:p[C],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:C==="audio"?S:void 0}};var T=w.prototype;return T.resetInitSegment=function(C,S,x){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=w.createTrack("video",x),this._audioTrack=w.createTrack("audio",x),this._id3Track=w.createTrack("id3",x),this._txtTrack=w.createTrack("text",x),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=C,this.videoCodec=S,this._duration=x},T.resetTimeStamp=function(){},T.resetContiguity=function(){var C=this._audioTrack,S=this._avcTrack,x=this._id3Track;C&&(C.pesData=null),S&&(S.pesData=null),x&&(x.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},T.demux=function(C,S,x,_){x===void 0&&(x=!1),_===void 0&&(_=!1),x||(this.sampleAes=null);var d,u=this._avcTrack,g=this._audioTrack,E=this._id3Track,N=u.pid,D=u.pesData,H=g.pid,j=E.pid,I=g.pesData,b=E.pesData,W=!1,Y=this.pmtParsed,ie=this._pmtId,oe=C.length;if(this.remainderData&&(C=Object(O.appendUint8Array)(this.remainderData,C),oe=C.length,this.remainderData=null),oe<188&&!_)return this.remainderData=C,{audioTrack:g,avcTrack:u,id3Track:E,textTrack:this._txtTrack};var xe=Math.max(0,w.syncOffset(C));oe-=(oe+xe)%188,oe<C.byteLength&&!_&&(this.remainderData=new Uint8Array(C.buffer,oe,C.buffer.byteLength-oe));for(var ve=xe;ve<oe;ve+=188)if(C[ve]===71){var we=!!(C[ve+1]&64),Ce=((C[ve+1]&31)<<8)+C[ve+2],Se=(C[ve+3]&48)>>4,fe=void 0;if(Se>1){if(fe=ve+5+C[ve+4],fe===ve+188)continue}else fe=ve+4;switch(Ce){case N:we&&(D&&(d=r(D))&&this.parseAVCPES(d,!1),D={data:[],size:0}),D&&(D.data.push(C.subarray(fe,ve+188)),D.size+=ve+188-fe);break;case H:we&&(I&&(d=r(I))&&(g.isAAC?this.parseAACPES(d):this.parseMPEGPES(d)),I={data:[],size:0}),I&&(I.data.push(C.subarray(fe,ve+188)),I.size+=ve+188-fe);break;case j:we&&(b&&(d=r(b))&&this.parseID3PES(d),b={data:[],size:0}),b&&(b.data.push(C.subarray(fe,ve+188)),b.size+=ve+188-fe);break;case 0:we&&(fe+=C[fe]+1),ie=this._pmtId=f(C,fe);break;case ie:{we&&(fe+=C[fe]+1);var le=l(C,fe,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,x);N=le.avc,N>0&&(u.pid=N),H=le.audio,H>0&&(g.pid=H,g.isAAC=le.isAAC),j=le.id3,j>0&&(E.pid=j),W&&!Y&&(v.logger.log("reparse from beginning"),W=!1,ve=xe-188),Y=this.pmtParsed=!0;break}case 17:case 8191:break;default:W=!0;break}}else this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:m.ErrorTypes.MEDIA_ERROR,details:m.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});u.pesData=D,g.pesData=I,E.pesData=b;var te={audioTrack:g,avcTrack:u,id3Track:E,textTrack:this._txtTrack};return _&&this.extractRemainingSamples(te),te},T.flush=function(){var C=this.remainderData;this.remainderData=null;var S;return C?S=this.demux(C,-1,!1,!0):S={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(S),this.sampleAes?this.decrypt(S,this.sampleAes):S},T.extractRemainingSamples=function(C){var S=C.audioTrack,x=C.avcTrack,_=C.id3Track,d=x.pesData,u=S.pesData,g=_.pesData,E;d&&(E=r(d))?(this.parseAVCPES(E,!0),x.pesData=null):x.pesData=d,u&&(E=r(u))?(S.isAAC?this.parseAACPES(E):this.parseMPEGPES(E),S.pesData=null):(u!=null&&u.size&&v.logger.log("last AAC PES packet truncated,might overlap between fragments"),S.pesData=u),g&&(E=r(g))?(this.parseID3PES(E),_.pesData=null):_.pesData=g},T.demuxSampleAes=function(C,S,x){var _=this.demux(C,x,!0,!this.config.progressive),d=this.sampleAes=new G.default(this.observer,this.config,S);return this.decrypt(_,d)},T.decrypt=function(C,S){return new Promise(function(x){var _=C.audioTrack,d=C.avcTrack;_.samples&&_.isAAC?S.decryptAacSamples(_.samples,0,function(){d.samples?S.decryptAvcSamples(d.samples,0,0,function(){x(C)}):x(C)}):d.samples&&S.decryptAvcSamples(d.samples,0,0,function(){x(C)})})},T.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},T.parseAVCPES=function(C,S){var x=this,_=this._avcTrack,d=this.parseAVCNALu(C.data),u=!1,g=this.avcSample,E,N=!1;C.data=null,g&&d.length&&!_.audFound&&(s(g,_),g=this.avcSample=o(!1,C.pts,C.dts,"")),d.forEach(function(D){switch(D.type){case 1:{E=!0,g||(g=x.avcSample=o(!0,C.pts,C.dts,"")),u&&(g.debug+="NDR "),g.frame=!0;var H=D.data;if(N&&H.length>4){var j=new U.default(H).readSliceType();(j===2||j===4||j===7||j===9)&&(g.key=!0)}break}case 5:E=!0,g||(g=x.avcSample=o(!0,C.pts,C.dts,"")),u&&(g.debug+="IDR "),g.key=!0,g.frame=!0;break;case 6:{E=!0,u&&g&&(g.debug+="SEI ");var I=new U.default(L(D.data));I.readUByte();for(var b=0,W=0,Y=!1,ie=0;!Y&&I.bytesAvailable>1;){b=0;do ie=I.readUByte(),b+=ie;while(ie===255);W=0;do ie=I.readUByte(),W+=ie;while(ie===255);if(b===4&&I.bytesAvailable!==0){Y=!0;var oe=I.readUByte();if(oe===181){var xe=I.readUShort();if(xe===49){var ve=I.readUInt();if(ve===1195456820){var we=I.readUByte();if(we===3){for(var Ce=I.readUByte(),Se=I.readUByte(),fe=31&Ce,le=[Ce,Se],te=0;te<fe;te++)le.push(I.readUByte()),le.push(I.readUByte()),le.push(I.readUByte());c(x._txtTrack.samples,{type:3,pts:C.pts,bytes:le})}}}}}else if(b===5&&I.bytesAvailable!==0){if(Y=!0,W>16){for(var de=[],se=0;se<16;se++)de.push(I.readUByte().toString(16)),(se===3||se===5||se===7||se===9)&&de.push("-");for(var Re=W-16,Le=new Uint8Array(Re),Te=0;Te<Re;Te++)Le[Te]=I.readUByte();c(x._txtTrack.samples,{pts:C.pts,payloadType:b,uuid:de.join(""),userData:Object(K.utf8ArrayToStr)(Le),userDataBytes:Le})}}else if(W<I.bytesAvailable)for(var Ie=0;Ie<W;Ie++)I.readUByte()}break}case 7:if(E=!0,N=!0,u&&g&&(g.debug+="SPS "),!_.sps){var Ue=new U.default(D.data),We=Ue.readSPS();_.width=We.width,_.height=We.height,_.pixelRatio=We.pixelRatio,_.sps=[D.data],_.duration=x._duration;for(var Fe=D.data.subarray(1,4),Ne="avc1.",Me=0;Me<3;Me++){var $e=Fe[Me].toString(16);$e.length<2&&($e="0"+$e),Ne+=$e}_.codec=Ne}break;case 8:E=!0,u&&g&&(g.debug+="PPS "),_.pps||(_.pps=[D.data]);break;case 9:E=!1,_.audFound=!0,g&&s(g,_),g=x.avcSample=o(!1,C.pts,C.dts,u?"AUD ":"");break;case 12:E=!1;break;default:E=!1,g&&(g.debug+="unknown NAL "+D.type+" ");break}if(g&&E){var et=g.units;et.push(D)}}),S&&g&&(s(g,_),this.avcSample=null)},T.getLastNalUnit=function(){var C,S=this.avcSample,x;if(!S||S.units.length===0){var _=this._avcTrack.samples;S=_[_.length-1]}if((C=S)!==null&&C!==void 0&&C.units){var d=S.units;x=d[d.length-1]}return x},T.parseAVCNALu=function(C){var S=C.byteLength,x=this._avcTrack,_=x.naluState||0,d=_,u=[],g=0,E,N,D,H=-1,j=0;for(_===-1&&(H=0,j=C[0]&31,_=0,g=1);g<S;){if(E=C[g++],!_){_=E?0:1;continue}if(_===1){_=E?0:2;continue}if(!E)_=3;else if(E===1){if(H>=0){var I={data:C.subarray(H,g-_-1),type:j};u.push(I)}else{var b=this.getLastNalUnit();if(b&&(d&&g<=4-d&&(b.state&&(b.data=b.data.subarray(0,b.data.byteLength-d))),N=g-_-1,N>0)){var W=new Uint8Array(b.data.byteLength+N);W.set(b.data,0),W.set(C.subarray(0,N),b.data.byteLength),b.data=W,b.state=0}}g<S?(D=C[g]&31,H=g,j=D,_=0):_=-1}else _=0}if(H>=0&&_>=0){var Y={data:C.subarray(H,S),type:j,state:_};u.push(Y)}if(u.length===0){var ie=this.getLastNalUnit();if(ie){var oe=new Uint8Array(ie.data.byteLength+C.byteLength);oe.set(ie.data,0),oe.set(C,ie.data.byteLength),ie.data=oe}}return x.naluState=_,u},T.parseAACPES=function(C){var S=0,x=this._audioTrack,_=this.aacOverFlow,d=C.data;if(_){this.aacOverFlow=null;var u=_.sample.unit.byteLength,g=Math.min(_.missing,u),E=u-g;_.sample.unit.set(d.subarray(0,g),E),x.samples.push(_.sample),S=_.missing}var N,D;for(N=S,D=d.length;N<D-1&&!$.isHeader(d,N);N++);if(N!==S){var H,j;if(N<D-1?(H="AAC PES did not start with ADTS header,offset:"+N,j=!1):(H="no ADTS header found in AAC PES",j=!0),v.logger.warn("parsing error:"+H),this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:m.ErrorTypes.MEDIA_ERROR,details:m.ErrorDetails.FRAG_PARSING_ERROR,fatal:j,reason:H}),j)return}$.initTrackConfig(x,this.observer,d,N,this.audioCodec);var I;if(C.pts!==void 0)I=C.pts;else if(_){var b=$.getFrameDuration(x.samplerate);I=_.sample.pts+b}else{v.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var W=0;N<D;)if($.isHeader(d,N)){if(N+5<D){var Y=$.appendFrame(x,d,N,I,W);if(Y)if(Y.missing)this.aacOverFlow=Y;else{N+=Y.length,W++;continue}}break}else N++},T.parseMPEGPES=function(C){var S=C.data,x=S.length,_=0,d=0,u=C.pts;if(u===void 0){v.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;d<x;)if(B.isHeader(S,d)){var g=B.appendFrame(this._audioTrack,S,d,u,_);if(g)d+=g.length,_++;else break}else d++},T.parseID3PES=function(C){if(C.pts===void 0){v.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(C)},w}();h.minProbeByteLength=188;function o(w,T,R,C){return{key:w,frame:!1,pts:T,dts:R,units:[],debug:C,length:0}}function f(w,T){return(w[T+10]&31)<<8|w[T+11]}function l(w,T,R,C){var S={audio:-1,avc:-1,id3:-1,isAAC:!0},x=(w[T+1]&15)<<8|w[T+2],_=T+3+x-4,d=(w[T+10]&15)<<8|w[T+11];for(T+=12+d;T<_;){var u=(w[T+1]&31)<<8|w[T+2];switch(w[T]){case 207:if(!C){v.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:S.audio===-1&&(S.audio=u);break;case 21:S.id3===-1&&(S.id3=u);break;case 219:if(!C){v.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:S.avc===-1&&(S.avc=u);break;case 3:case 4:R?S.audio===-1&&(S.audio=u,S.isAAC=!1):v.logger.log("MPEG audio found, not supported in this browser");break;case 36:v.logger.warn("Unsupported HEVC stream type found");break;default:break}T+=((w[T+3]&15)<<8|w[T+4])+5}return S}function r(w){var T=0,R,C,S,x,_,d=w.data;if(!w||w.size===0)return null;for(;d[0].length<19&&d.length>1;){var u=new Uint8Array(d[0].length+d[1].length);u.set(d[0]),u.set(d[1],d[0].length),d[0]=u,d.splice(1,1)}R=d[0];var g=(R[0]<<16)+(R[1]<<8)+R[2];if(g===1){if(C=(R[4]<<8)+R[5],C&&C>w.size-6)return null;var E=R[7];E&192&&(x=(R[9]&14)*536870912+(R[10]&255)*4194304+(R[11]&254)*16384+(R[12]&255)*128+(R[13]&254)/2,E&64?(_=(R[14]&14)*536870912+(R[15]&255)*4194304+(R[16]&254)*16384+(R[17]&255)*128+(R[18]&254)/2,x-_>60*9e4&&(v.logger.warn(Math.round((x-_)/9e4)+"s delta between PTS and DTS, align them"),x=_)):_=x),S=R[8];var N=S+9;if(w.size<=N)return null;w.size-=N;for(var D=new Uint8Array(w.size),H=0,j=d.length;H<j;H++){R=d[H];var I=R.byteLength;if(N)if(N>I){N-=I;continue}else R=R.subarray(N),I-=N,N=0;D.set(R,T),T+=I}return C&&(C-=S+3),{data:D,pts:x,dts:_,len:C}}return null}function s(w,T){if(w.units.length&&w.frame){if(w.pts===void 0){var R=T.samples,C=R.length;if(C){var S=R[C-1];w.pts=S.pts,w.dts=S.dts}else{T.dropped++;return}}T.samples.push(w)}w.debug.length&&v.logger.log(w.pts+"/"+w.dts+":"+w.debug)}function c(w,T){var R=w.length;if(R>0){if(T.pts>=w[R-1].pts)w.push(T);else for(var C=R-1;C>=0;C--)if(T.pts<w[C].pts){w.splice(C,0,T);break}}else w.push(T)}function L(w){for(var T=w.byteLength,R=[],C=1;C<T-2;)w[C]===0&&w[C+1]===0&&w[C+2]===3?(R.push(C+2),C+=2):C++;if(R.length===0)return w;var S=T-R.length,x=new Uint8Array(S),_=0;for(C=0;C<S;_++,C++)_===R[0]&&(_++,R.shift()),x[C]=w[_];return x}Z.default=h},"./src/errors.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"ErrorTypes",function(){return $}),P.d(Z,"ErrorDetails",function(){return B});var $;(function(U){U.NETWORK_ERROR="networkError",U.MEDIA_ERROR="mediaError",U.KEY_SYSTEM_ERROR="keySystemError",U.MUX_ERROR="muxError",U.OTHER_ERROR="otherError"})($||($={}));var B;(function(U){U.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",U.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",U.KEY_SYSTEM_NO_SESSION="keySystemNoSession",U.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",U.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",U.MANIFEST_LOAD_ERROR="manifestLoadError",U.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",U.MANIFEST_PARSING_ERROR="manifestParsingError",U.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",U.LEVEL_EMPTY_ERROR="levelEmptyError",U.LEVEL_LOAD_ERROR="levelLoadError",U.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",U.LEVEL_SWITCH_ERROR="levelSwitchError",U.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",U.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",U.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",U.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",U.FRAG_LOAD_ERROR="fragLoadError",U.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",U.FRAG_DECRYPT_ERROR="fragDecryptError",U.FRAG_PARSING_ERROR="fragParsingError",U.REMUX_ALLOC_ERROR="remuxAllocError",U.KEY_LOAD_ERROR="keyLoadError",U.KEY_LOAD_TIMEOUT="keyLoadTimeOut",U.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",U.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",U.BUFFER_APPEND_ERROR="bufferAppendError",U.BUFFER_APPENDING_ERROR="bufferAppendingError",U.BUFFER_STALLED_ERROR="bufferStalledError",U.BUFFER_FULL_ERROR="bufferFullError",U.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",U.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",U.INTERNAL_EXCEPTION="internalException",U.INTERNAL_ABORTED="aborted",U.UNKNOWN="unknown"})(B||(B={}))},"./src/events.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"Events",function(){return $});var $;(function(B){B.MEDIA_ATTACHING="hlsMediaAttaching",B.MEDIA_ATTACHED="hlsMediaAttached",B.MEDIA_DETACHING="hlsMediaDetaching",B.MEDIA_DETACHED="hlsMediaDetached",B.BUFFER_RESET="hlsBufferReset",B.BUFFER_CODECS="hlsBufferCodecs",B.BUFFER_CREATED="hlsBufferCreated",B.BUFFER_APPENDING="hlsBufferAppending",B.BUFFER_APPENDED="hlsBufferAppended",B.BUFFER_EOS="hlsBufferEos",B.BUFFER_FLUSHING="hlsBufferFlushing",B.BUFFER_FLUSHED="hlsBufferFlushed",B.MANIFEST_LOADING="hlsManifestLoading",B.MANIFEST_LOADED="hlsManifestLoaded",B.MANIFEST_PARSED="hlsManifestParsed",B.LEVEL_SWITCHING="hlsLevelSwitching",B.LEVEL_SWITCHED="hlsLevelSwitched",B.LEVEL_LOADING="hlsLevelLoading",B.LEVEL_LOADED="hlsLevelLoaded",B.LEVEL_UPDATED="hlsLevelUpdated",B.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",B.LEVELS_UPDATED="hlsLevelsUpdated",B.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",B.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",B.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",B.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",B.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",B.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",B.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",B.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",B.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",B.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",B.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",B.CUES_PARSED="hlsCuesParsed",B.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",B.INIT_PTS_FOUND="hlsInitPtsFound",B.FRAG_LOADING="hlsFragLoading",B.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",B.FRAG_LOADED="hlsFragLoaded",B.FRAG_DECRYPTED="hlsFragDecrypted",B.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",B.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",B.FRAG_PARSING_METADATA="hlsFragParsingMetadata",B.FRAG_PARSED="hlsFragParsed",B.FRAG_BUFFERED="hlsFragBuffered",B.FRAG_CHANGED="hlsFragChanged",B.FPS_DROP="hlsFpsDrop",B.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",B.ERROR="hlsError",B.DESTROYING="hlsDestroying",B.KEY_LOADING="hlsKeyLoading",B.KEY_LOADED="hlsKeyLoaded",B.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",B.BACK_BUFFER_REACHED="hlsBackBufferReached"})($||($={}))},"./src/hls.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return w});var $=P("./node_modules/url-toolkit/src/url-toolkit.js"),B=P.n($),U=P("./src/loader/playlist-loader.ts"),K=P("./src/loader/key-loader.ts"),G=P("./src/controller/id3-track-controller.ts"),M=P("./src/controller/latency-controller.ts"),O=P("./src/controller/level-controller.ts"),v=P("./src/controller/fragment-tracker.ts"),m=P("./src/controller/stream-controller.ts"),p=P("./src/is-supported.ts"),h=P("./src/utils/logger.ts"),o=P("./src/config.ts"),f=P("./node_modules/eventemitter3/index.js"),l=P.n(f),r=P("./src/events.ts"),s=P("./src/errors.ts");function c(T,R){for(var C=0;C<R.length;C++){var S=R[C];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(T,S.key,S)}}function L(T,R,C){return R&&c(T.prototype,R),C&&c(T,C),T}var w=function(){T.isSupported=function(){return Object(p.isSupported)()};function T(C){C===void 0&&(C={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new f.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 S=this.config=Object(o.mergeConfig)(T.DefaultConfig,C);this.userConfig=C,Object(h.enableLogs)(S.debug),this._autoLevelCapping=-1,S.progressive&&Object(o.enableStreamingMode)(S);var x=S.abrController,_=S.bufferController,d=S.capLevelController,u=S.fpsController,g=this.abrController=new x(this),E=this.bufferController=new _(this),N=this.capLevelController=new d(this),D=new u(this),H=new U.default(this),j=new K.default(this),I=new G.default(this),b=this.levelController=new O.default(this),W=new v.FragmentTracker(this),Y=this.streamController=new m.default(this,W);N.setStreamController(Y),D.setStreamController(Y);var ie=[b,Y];this.networkControllers=ie;var oe=[H,j,g,E,N,D,I,W];this.audioTrackController=this.createController(S.audioTrackController,null,ie),this.createController(S.audioStreamController,W,ie),this.subtitleTrackController=this.createController(S.subtitleTrackController,null,ie),this.createController(S.subtitleStreamController,W,ie),this.createController(S.timelineController,null,oe),this.emeController=this.createController(S.emeController,null,oe),this.cmcdController=this.createController(S.cmcdController,null,oe),this.latencyController=this.createController(M.default,null,oe),this.coreComponents=oe}var R=T.prototype;return R.createController=function(S,x,_){if(S){var d=x?new S(this,x):new S(this);return _&&_.push(d),d}return null},R.on=function(S,x,_){_===void 0&&(_=this),this._emitter.on(S,x,_)},R.once=function(S,x,_){_===void 0&&(_=this),this._emitter.once(S,x,_)},R.removeAllListeners=function(S){this._emitter.removeAllListeners(S)},R.off=function(S,x,_,d){_===void 0&&(_=this),this._emitter.off(S,x,_,d)},R.listeners=function(S){return this._emitter.listeners(S)},R.emit=function(S,x,_){return this._emitter.emit(S,x,_)},R.trigger=function(S,x){if(this.config.debug)return this.emit(S,S,x);try{return this.emit(S,S,x)}catch(_){h.logger.error("An internal error happened while handling event "+S+'. Error message: "'+_.message+'". Here is a stacktrace:',_),this.trigger(r.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:S,error:_})}return!1},R.listenerCount=function(S){return this._emitter.listenerCount(S)},R.destroy=function(){h.logger.log("destroy"),this.trigger(r.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(S){return S.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(S){return S.destroy()}),this.coreComponents.length=0},R.attachMedia=function(S){h.logger.log("attachMedia"),this._media=S,this.trigger(r.Events.MEDIA_ATTACHING,{media:S})},R.detachMedia=function(){h.logger.log("detachMedia"),this.trigger(r.Events.MEDIA_DETACHING,void 0),this._media=null},R.loadSource=function(S){this.stopLoad();var x=this.media,_=this.url,d=this.url=$.buildAbsoluteURL(self.location.href,S,{alwaysNormalize:!0});h.logger.log("loadSource:"+d),x&&_&&_!==d&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(x)),this.trigger(r.Events.MANIFEST_LOADING,{url:S})},R.startLoad=function(S){S===void 0&&(S=-1),h.logger.log("startLoad("+S+")"),this.networkControllers.forEach(function(x){x.startLoad(S)})},R.stopLoad=function(){h.logger.log("stopLoad"),this.networkControllers.forEach(function(S){S.stopLoad()})},R.swapAudioCodec=function(){h.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},R.recoverMediaError=function(){h.logger.log("recoverMediaError");var S=this._media;this.detachMedia(),S&&this.attachMedia(S)},R.removeLevel=function(S,x){x===void 0&&(x=0),this.levelController.removeLevel(S,x)},L(T,[{key:"levels",get:function(){var S=this.levelController.levels;return S||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(S){h.logger.log("set currentLevel:"+S),this.loadLevel=S,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(S){h.logger.log("set nextLevel:"+S),this.levelController.manualLevel=S,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(S){h.logger.log("set loadLevel:"+S),this.levelController.manualLevel=S}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(S){this.levelController.nextLoadLevel=S}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(S){h.logger.log("set firstLevel:"+S),this.levelController.firstLevel=S}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(S){h.logger.log("set startLevel:"+S),S!==-1&&(S=Math.max(S,this.minAutoLevel)),this.levelController.startLevel=S}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(S){var x=!!S;x!==this.config.capLevelToPlayerSize&&(x?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=x)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(S){this._autoLevelCapping!==S&&(h.logger.log("set autoLevelCapping:"+S),this._autoLevelCapping=S)}},{key:"bandwidthEstimate",get:function(){var S=this.abrController.bwEstimator;return S?S.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var S=this.levels,x=this.config.minAutoBitrate;if(!S)return 0;for(var _=S.length,d=0;d<_;d++)if(S[d].maxBitrate>x)return d;return 0}},{key:"maxAutoLevel",get:function(){var S=this.levels,x=this.autoLevelCapping,_;return x===-1&&S&&S.length?_=S.length-1:_=x,_}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(S){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,S)}},{key:"audioTracks",get:function(){var S=this.audioTrackController;return S?S.audioTracks:[]}},{key:"audioTrack",get:function(){var S=this.audioTrackController;return S?S.audioTrack:-1},set:function(S){var x=this.audioTrackController;x&&(x.audioTrack=S)}},{key:"subtitleTracks",get:function(){var S=this.subtitleTrackController;return S?S.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var S=this.subtitleTrackController;return S?S.subtitleTrack:-1},set:function(S){var x=this.subtitleTrackController;x&&(x.subtitleTrack=S)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var S=this.subtitleTrackController;return S?S.subtitleDisplay:!1},set:function(S){var x=this.subtitleTrackController;x&&(x.subtitleDisplay=S)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(S){this.config.lowLatencyMode=S}},{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 r.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return T.defaultConfig?T.defaultConfig:o.hlsDefaultConfig},set:function(S){T.defaultConfig=S}}]),T}();w.defaultConfig=void 0},"./src/is-supported.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"isSupported",function(){return U}),P.d(Z,"changeTypeSupported",function(){return K});var $=P("./src/utils/mediasource-helper.ts");function B(){return self.SourceBuffer||self.WebKitSourceBuffer}function U(){var G=Object($.getMediaSource)();if(!G)return!1;var M=B(),O=G&&typeof G.isTypeSupported=="function"&&G.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),v=!M||M.prototype&&typeof M.prototype.appendBuffer=="function"&&typeof M.prototype.remove=="function";return!!O&&!!v}function K(){var G,M=B();return typeof(M==null||((G=M.prototype)===null||G===void 0)?void 0:G.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return h}),P.d(Z,"LoadError",function(){return f});var $=P("./src/polyfills/number.ts"),B=P("./src/errors.ts");function U(l,r){l.prototype=Object.create(r.prototype),l.prototype.constructor=l,v(l,r)}function K(l){var r=typeof Map=="function"?new Map:void 0;return K=function(c){if(c===null||!O(c))return c;if(typeof c!="function")throw new TypeError("Super expression must either be null or a function");if(typeof r!="undefined"){if(r.has(c))return r.get(c);r.set(c,L)}function L(){return G(c,arguments,m(this).constructor)}return L.prototype=Object.create(c.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),v(L,c)},K(l)}function G(l,r,s){return M()?G=Reflect.construct:G=function(L,w,T){var R=[null];R.push.apply(R,w);var C=Function.bind.apply(L,R),S=new C;return T&&v(S,T.prototype),S},G.apply(null,arguments)}function M(){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(l){return!1}}function O(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function v(l,r){return v=Object.setPrototypeOf||function(c,L){return c.__proto__=L,c},v(l,r)}function m(l){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},m(l)}var p=Math.pow(2,17),h=function(){function l(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var r=l.prototype;return r.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},r.abort=function(){this.loader&&this.loader.abort()},r.load=function(c,L){var w=this,T=c.url;if(!T)return Promise.reject(new f({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,networkDetails:null},"Fragment does not have a "+(T?"part list":"url")));this.abort();var R=this.config,C=R.fLoader,S=R.loader;return new Promise(function(x,_){w.loader&&w.loader.destroy();var d=w.loader=c.loader=C?new C(R):new S(R),u=o(c),g={timeout:R.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:R.fragLoadingMaxRetryTimeout,highWaterMark:p};c.stats=d.stats,d.load(u,g,{onSuccess:function(N,D,H,j){w.resetLoader(c,d),x({frag:c,part:null,payload:N.data,networkDetails:j})},onError:function(N,D,H){w.resetLoader(c,d),_(new f({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,response:N,networkDetails:H}))},onAbort:function(N,D,H){w.resetLoader(c,d),_(new f({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,networkDetails:H}))},onTimeout:function(N,D,H){w.resetLoader(c,d),_(new f({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,networkDetails:H}))},onProgress:function(N,D,H,j){L&&L({frag:c,part:null,payload:H,networkDetails:j})}})})},r.loadPart=function(c,L,w){var T=this;this.abort();var R=this.config,C=R.fLoader,S=R.loader;return new Promise(function(x,_){T.loader&&T.loader.destroy();var d=T.loader=c.loader=C?new C(R):new S(R),u=o(c,L),g={timeout:R.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:R.fragLoadingMaxRetryTimeout,highWaterMark:p};L.stats=d.stats,d.load(u,g,{onSuccess:function(N,D,H,j){T.resetLoader(c,d),T.updateStatsFromPart(c,L);var I={frag:c,part:L,payload:N.data,networkDetails:j};w(I),x(I)},onError:function(N,D,H){T.resetLoader(c,d),_(new f({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,part:L,response:N,networkDetails:H}))},onAbort:function(N,D,H){c.stats.aborted=L.stats.aborted,T.resetLoader(c,d),_(new f({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,part:L,networkDetails:H}))},onTimeout:function(N,D,H){T.resetLoader(c,d),_(new f({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,part:L,networkDetails:H}))}})})},r.updateStatsFromPart=function(c,L){var w=c.stats,T=L.stats,R=T.total;if(w.loaded+=T.loaded,R){var C=Math.round(c.duration/L.duration),S=Math.min(Math.round(w.loaded/R),C),x=C-S,_=x*Math.round(w.loaded/S);w.total=w.loaded+_}else w.total=Math.max(w.loaded,w.total);var d=w.loading,u=T.loading;d.start?d.first+=u.first-u.start:(d.start=u.start,d.first=u.first),d.end=u.end},r.resetLoader=function(c,L){c.loader=null,this.loader===L&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),L.destroy()},l}();function o(l,r){r===void 0&&(r=null);var s=r||l,c={frag:l,part:r,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},L=s.byteRangeStartOffset,w=s.byteRangeEndOffset;return Object($.isFiniteNumber)(L)&&Object($.isFiniteNumber)(w)&&(c.rangeStart=L,c.rangeEnd=w),c}var f=function(l){U(r,l);function r(s){for(var c,L=arguments.length,w=new Array(L>1?L-1:0),T=1;T<L;T++)w[T-1]=arguments[T];return c=l.call.apply(l,[this].concat(w))||this,c.data=void 0,c.data=s,c}return r}(K(Error))},"./src/loader/fragment.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"ElementaryStreamTypes",function(){return h}),P.d(Z,"BaseSegment",function(){return o}),P.d(Z,"Fragment",function(){return f}),P.d(Z,"Part",function(){return l});var $=P("./src/polyfills/number.ts"),B=P("./node_modules/url-toolkit/src/url-toolkit.js"),U=P.n(B),K=P("./src/utils/logger.ts"),G=P("./src/loader/level-key.ts"),M=P("./src/loader/load-stats.ts");function O(r,s){r.prototype=Object.create(s.prototype),r.prototype.constructor=r,v(r,s)}function v(r,s){return v=Object.setPrototypeOf||function(L,w){return L.__proto__=w,L},v(r,s)}function m(r,s){for(var c=0;c<s.length;c++){var L=s[c];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(r,L.key,L)}}function p(r,s,c){return s&&m(r.prototype,s),c&&m(r,c),r}var h;(function(r){r.AUDIO="audio",r.VIDEO="video",r.AUDIOVIDEO="audiovideo"})(h||(h={}));var o=function(){function r(c){var L;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(L={},L[h.AUDIO]=null,L[h.VIDEO]=null,L[h.AUDIOVIDEO]=null,L),this.baseurl=c}var s=r.prototype;return s.setByteRange=function(L,w){var T=L.split("@",2),R=[];T.length===1?R[0]=w?w.byteRangeEndOffset:0:R[0]=parseInt(T[1]),R[1]=parseInt(T[0])+R[0],this._byteRange=R},p(r,[{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(B.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(L){this._url=L}}]),r}(),f=function(r){O(s,r);function s(L,w){var T;return T=r.call(this,w)||this,T._decryptdata=null,T.rawProgramDateTime=null,T.programDateTime=null,T.tagList=[],T.duration=0,T.sn=0,T.levelkey=void 0,T.type=void 0,T.loader=null,T.level=-1,T.cc=0,T.startPTS=void 0,T.endPTS=void 0,T.appendedPTS=void 0,T.startDTS=void 0,T.endDTS=void 0,T.start=0,T.deltaPTS=void 0,T.maxStartPTS=void 0,T.minEndPTS=void 0,T.stats=new M.LoadStats,T.urlId=0,T.data=void 0,T.bitrateTest=!1,T.title=null,T.initSegment=null,T.type=L,T}var c=s.prototype;return c.createInitializationVector=function(w){for(var T=new Uint8Array(16),R=12;R<16;R++)T[R]=w>>8*(15-R)&255;return T},c.setDecryptDataFromLevelKey=function(w,T){var R=w;return(w==null?void 0:w.method)==="AES-128"&&w.uri&&!w.iv&&(R=G.LevelKey.fromURI(w.uri),R.method=w.method,R.iv=this.createInitializationVector(T),R.keyFormat="identity"),R},c.setElementaryStreamInfo=function(w,T,R,C,S,x){x===void 0&&(x=!1);var _=this.elementaryStreams,d=_[w];if(!d){_[w]={startPTS:T,endPTS:R,startDTS:C,endDTS:S,partial:x};return}d.startPTS=Math.min(d.startPTS,T),d.endPTS=Math.max(d.endPTS,R),d.startDTS=Math.min(d.startDTS,C),d.endDTS=Math.max(d.endDTS,S)},c.clearElementaryStreamInfo=function(){var w=this.elementaryStreams;w[h.AUDIO]=null,w[h.VIDEO]=null,w[h.AUDIOVIDEO]=null},p(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var w=this.sn;typeof w!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&K.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),w=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,w)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object($.isFiniteNumber)(this.programDateTime))return null;var w=Object($.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+w*1e3}},{key:"encrypted",get:function(){var w;return!!((w=this.decryptdata)!==null&&w!==void 0&&w.keyFormat&&this.decryptdata.uri)}}]),s}(o),l=function(r){O(s,r);function s(c,L,w,T,R){var C;C=r.call(this,w)||this,C.fragOffset=0,C.duration=0,C.gap=!1,C.independent=!1,C.relurl=void 0,C.fragment=void 0,C.index=void 0,C.stats=new M.LoadStats,C.duration=c.decimalFloatingPoint("DURATION"),C.gap=c.bool("GAP"),C.independent=c.bool("INDEPENDENT"),C.relurl=c.enumeratedString("URI"),C.fragment=L,C.index=T;var S=c.enumeratedString("BYTERANGE");return S&&C.setByteRange(S,R),R&&(C.fragOffset=R.fragOffset+R.duration),C}return p(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var L=this.elementaryStreams;return!!(L.audio||L.video||L.audiovideo)}}]),s}(o)},"./src/loader/key-loader.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return K});var $=P("./src/events.ts"),B=P("./src/errors.ts"),U=P("./src/utils/logger.ts"),K=function(){function G(O){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=O,this._registerListeners()}var M=G.prototype;return M._registerListeners=function(){this.hls.on($.Events.KEY_LOADING,this.onKeyLoading,this)},M._unregisterListeners=function(){this.hls.off($.Events.KEY_LOADING,this.onKeyLoading)},M.destroy=function(){this._unregisterListeners();for(var v in this.loaders){var m=this.loaders[v];m&&m.destroy()}this.loaders={}},M.onKeyLoading=function(v,m){var p=m.frag,h=p.type,o=this.loaders[h];if(!p.decryptdata){U.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var f=p.decryptdata.uri;if(f!==this.decrypturl||this.decryptkey===null){var l=this.hls.config;if(o&&(U.logger.warn("abort previous key loader for type:"+h),o.abort()),!f){U.logger.warn("key uri is falsy");return}var r=l.loader,s=p.loader=this.loaders[h]=new r(l);this.decrypturl=f,this.decryptkey=null;var c={url:f,frag:p,responseType:"arraybuffer"},L={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:0},w={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(c,L,w)}else this.decryptkey&&(p.decryptdata.key=this.decryptkey,this.hls.trigger($.Events.KEY_LOADED,{frag:p}))},M.loadsuccess=function(v,m,p){var h=p.frag;if(!h.decryptdata){U.logger.error("after key load, decryptdata unset");return}this.decryptkey=h.decryptdata.key=new Uint8Array(v.data),h.loader=null,delete this.loaders[h.type],this.hls.trigger($.Events.KEY_LOADED,{frag:h})},M.loaderror=function(v,m){var p=m.frag,h=p.loader;h&&h.abort(),delete this.loaders[p.type],this.hls.trigger($.Events.ERROR,{type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:p,response:v})},M.loadtimeout=function(v,m){var p=m.frag,h=p.loader;h&&h.abort(),delete this.loaders[p.type],this.hls.trigger($.Events.ERROR,{type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:p})},G}()},"./src/loader/level-details.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"LevelDetails",function(){return G});var $=P("./src/polyfills/number.ts");function B(M,O){for(var v=0;v<O.length;v++){var m=O[v];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(M,m.key,m)}}function U(M,O,v){return O&&B(M.prototype,O),v&&B(M,v),M}var K=10,G=function(){function M(v){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=v}var O=M.prototype;return O.reloaded=function(m){if(!m){this.advanced=!0,this.updated=!0;return}var p=this.lastPartSn-m.lastPartSn,h=this.lastPartIndex-m.lastPartIndex;this.updated=this.endSN!==m.endSN||!!h||!!p,this.advanced=this.endSN>m.endSN||p>0||p===0&&h>0,this.updated||this.advanced?this.misses=Math.floor(m.misses*.6):this.misses=m.misses+1,this.availabilityDelay=m.availabilityDelay},U(M,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object($.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||K}},{key:"drift",get:function(){var m=this.driftEndTime-this.driftStartTime;if(m>0){var p=this.driftEnd-this.driftStart;return p*1e3/m}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var m;return(m=this.partList)!==null&&m!==void 0&&m.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var m;return(m=this.fragments)!==null&&m!==void 0&&m.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 m;return(m=this.partList)!==null&&m!==void 0&&m.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var m;return(m=this.partList)!==null&&m!==void 0&&m.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),M}()},"./src/loader/level-key.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"LevelKey",function(){return G});var $=P("./node_modules/url-toolkit/src/url-toolkit.js"),B=P.n($);function U(M,O){for(var v=0;v<O.length;v++){var m=O[v];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(M,m.key,m)}}function K(M,O,v){return O&&U(M.prototype,O),v&&U(M,v),M}var G=function(){M.fromURL=function(v,m){return new M(v,m)},M.fromURI=function(v){return new M(v)};function M(O,v){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,v?this._uri=Object($.buildAbsoluteURL)(O,v,{alwaysNormalize:!0}):this._uri=O}return K(M,[{key:"uri",get:function(){return this._uri}}]),M}()},"./src/loader/load-stats.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"LoadStats",function(){return $});var $=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(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return s});var $=P("./src/polyfills/number.ts"),B=P("./node_modules/url-toolkit/src/url-toolkit.js"),U=P.n(B),K=P("./src/loader/fragment.ts"),G=P("./src/loader/level-details.ts"),M=P("./src/loader/level-key.ts"),O=P("./src/utils/attr-list.ts"),v=P("./src/utils/logger.ts"),m=P("./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,h=/#EXT-X-MEDIA:(.*)/g,o=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),f=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("|")),l=/\.(mp4|m4s|m4v|m4a)$/i;function r(R){var C,S;return l.test((C=(S=B.parseURL(R))===null||S===void 0?void 0:S.path)!=null?C:"")}var s=function(){function R(){}return R.findGroup=function(S,x){for(var _=0;_<S.length;_++){var d=S[_];if(d.id===x)return d}},R.convertAVC1ToAVCOTI=function(S){var x=S.split(".");if(x.length>2){var _=x.shift()+".";return _+=parseInt(x.shift()).toString(16),_+=("000"+parseInt(x.shift()).toString(16)).substr(-4),_}return S},R.resolve=function(S,x){return B.buildAbsoluteURL(x,S,{alwaysNormalize:!0})},R.parseMasterPlaylist=function(S,x){var _=[],d={},u=!1;p.lastIndex=0;for(var g;(g=p.exec(S))!=null;)if(g[1]){var E=new O.AttrList(g[1]),N={attrs:E,bitrate:E.decimalInteger("AVERAGE-BANDWIDTH")||E.decimalInteger("BANDWIDTH"),name:E.NAME,url:R.resolve(g[2],x)},D=E.decimalResolution("RESOLUTION");D&&(N.width=D.width,N.height=D.height),c((E.CODECS||"").split(/[ ,]+/).filter(function(j){return j}),N),N.videoCodec&&N.videoCodec.indexOf("avc1")!==-1&&(N.videoCodec=R.convertAVC1ToAVCOTI(N.videoCodec)),_.push(N)}else if(g[3]){var H=new O.AttrList(g[3]);H["DATA-ID"]&&(u=!0,d[H["DATA-ID"]]=H)}return{levels:_,sessionData:u?d:null}},R.parseMasterPlaylistMedia=function(S,x,_,d){d===void 0&&(d=[]);var u,g=[],E=0;for(h.lastIndex=0;(u=h.exec(S))!==null;){var N=new O.AttrList(u[1]);if(N.TYPE===_){var D={attrs:N,bitrate:0,id:E++,groupId:N["GROUP-ID"],instreamId:N["INSTREAM-ID"],name:N.NAME||N.LANGUAGE||"",type:_,default:N.bool("DEFAULT"),autoselect:N.bool("AUTOSELECT"),forced:N.bool("FORCED"),lang:N.LANGUAGE,url:N.URI?R.resolve(N.URI,x):""};if(d.length){var H=R.findGroup(d,D.groupId)||d[0];L(D,H,"audioCodec"),L(D,H,"textCodec")}g.push(D)}}return g},R.parseLevelPlaylist=function(S,x,_,d,u){var g=new G.LevelDetails(x),E=g.fragments,N=null,D=0,H=0,j=0,I=0,b=null,W=new K.Fragment(d,x),Y,ie,oe,xe=-1,ve=!1;for(o.lastIndex=0,g.m3u8=S;(Y=o.exec(S))!==null;){ve&&(ve=!1,W=new K.Fragment(d,x),W.start=j,W.sn=D,W.cc=I,W.level=_,N&&(W.initSegment=N,W.rawProgramDateTime=N.rawProgramDateTime));var we=Y[1];if(we){W.duration=parseFloat(we);var Ce=(" "+Y[2]).slice(1);W.title=Ce||null,W.tagList.push(Ce?["INF",we,Ce]:["INF",we])}else if(Y[3])Object($.isFiniteNumber)(W.duration)&&(W.start=j,oe&&(W.levelkey=oe),W.sn=D,W.level=_,W.cc=I,W.urlId=u,E.push(W),W.relurl=(" "+Y[3]).slice(1),T(W,b),b=W,j+=W.duration,D++,H=0,ve=!0);else if(Y[4]){var Se=(" "+Y[4]).slice(1);b?W.setByteRange(Se,b):W.setByteRange(Se)}else if(Y[5])W.rawProgramDateTime=(" "+Y[5]).slice(1),W.tagList.push(["PROGRAM-DATE-TIME",W.rawProgramDateTime]),xe===-1&&(xe=E.length);else{if(Y=Y[0].match(f),!Y){v.logger.warn("No matches on slow regex match for level playlist!");continue}for(ie=1;ie<Y.length&&!(typeof Y[ie]!="undefined");ie++);var fe=(" "+Y[ie]).slice(1),le=(" "+Y[ie+1]).slice(1),te=Y[ie+2]?(" "+Y[ie+2]).slice(1):"";switch(fe){case"PLAYLIST-TYPE":g.type=le.toUpperCase();break;case"MEDIA-SEQUENCE":D=g.startSN=parseInt(le);break;case"SKIP":{var de=new O.AttrList(le),se=de.decimalInteger("SKIPPED-SEGMENTS");if(Object($.isFiniteNumber)(se)){g.skippedSegments=se;for(var Re=se;Re--;)E.unshift(null);D+=se}var Le=de.enumeratedString("RECENTLY-REMOVED-DATERANGES");Le&&(g.recentlyRemovedDateranges=Le.split(" "));break}case"TARGETDURATION":g.targetduration=parseFloat(le);break;case"VERSION":g.version=parseInt(le);break;case"EXTM3U":break;case"ENDLIST":g.live=!1;break;case"#":(le||te)&&W.tagList.push(te?[le,te]:[le]);break;case"DIS":I++;case"GAP":W.tagList.push([fe]);break;case"BITRATE":W.tagList.push([fe,le]);break;case"DISCONTINUITY-SEQ":I=parseInt(le);break;case"KEY":{var Te,Ie=new O.AttrList(le),Ue=Ie.enumeratedString("METHOD"),We=Ie.URI,Fe=Ie.hexadecimalInteger("IV"),Ne=Ie.enumeratedString("KEYFORMATVERSIONS"),Me=Ie.enumeratedString("KEYID"),$e=(Te=Ie.enumeratedString("KEYFORMAT"))!=null?Te:"identity",et=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(et.indexOf($e)>-1){v.logger.warn("Keyformat "+$e+" is not supported from the manifest");continue}else if($e!=="identity")continue;Ue&&(oe=M.LevelKey.fromURL(x,We),We&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ue)>=0&&(oe.method=Ue,oe.keyFormat=$e,Me&&(oe.keyID=Me),Ne&&(oe.keyFormatVersions=Ne),oe.iv=Fe));break}case"START":{var Qe=new O.AttrList(le),Ze=Qe.decimalFloatingPoint("TIME-OFFSET");Object($.isFiniteNumber)(Ze)&&(g.startTimeOffset=Ze);break}case"MAP":{var dt=new O.AttrList(le);W.relurl=dt.URI,dt.BYTERANGE&&W.setByteRange(dt.BYTERANGE),W.level=_,W.sn="initSegment",oe&&(W.levelkey=oe),W.initSegment=null,N=W,ve=!0;break}case"SERVER-CONTROL":{var it=new O.AttrList(le);g.canBlockReload=it.bool("CAN-BLOCK-RELOAD"),g.canSkipUntil=it.optionalFloat("CAN-SKIP-UNTIL",0),g.canSkipDateRanges=g.canSkipUntil>0&&it.bool("CAN-SKIP-DATERANGES"),g.partHoldBack=it.optionalFloat("PART-HOLD-BACK",0),g.holdBack=it.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var at=new O.AttrList(le);g.partTarget=at.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Pe=g.partList;Pe||(Pe=g.partList=[]);var ut=H>0?Pe[Pe.length-1]:void 0,tt=H++,ke=new K.Part(new O.AttrList(le),W,x,tt,ut);Pe.push(ke),W.duration+=ke.duration;break}case"PRELOAD-HINT":{var Ge=new O.AttrList(le);g.preloadHint=Ge;break}case"RENDITION-REPORT":{var Ee=new O.AttrList(le);g.renditionReports=g.renditionReports||[],g.renditionReports.push(Ee);break}default:v.logger.warn("line parsed but not handled: "+Y);break}}}b&&!b.relurl?(E.pop(),j-=b.duration,g.partList&&(g.fragmentHint=b)):g.partList&&(T(W,b),W.cc=I,g.fragmentHint=W);var pe=E.length,_e=E[0],re=E[pe-1];if(j+=g.skippedSegments*g.targetduration,j>0&&pe&&re){g.averagetargetduration=j/pe;var ae=re.sn;g.endSN=ae!=="initSegment"?ae:0,_e&&(g.startCC=_e.cc,_e.initSegment||g.fragments.every(function(he){return he.relurl&&r(he.relurl)})&&(v.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),W=new K.Fragment(d,x),W.relurl=re.relurl,W.level=_,W.sn="initSegment",_e.initSegment=W,g.needSidxRanges=!0))}else g.endSN=0,g.startCC=0;return g.fragmentHint&&(j+=g.fragmentHint.duration),g.totalduration=j,g.endCC=I,xe>0&&w(E,xe),g},R}();function c(R,C){["video","audio","text"].forEach(function(S){var x=R.filter(function(d){return Object(m.isCodecType)(d,S)});if(x.length){var _=x.filter(function(d){return d.lastIndexOf("avc1",0)===0||d.lastIndexOf("mp4a",0)===0});C[S+"Codec"]=_.length>0?_[0]:x[0],R=R.filter(function(d){return x.indexOf(d)===-1})}}),C.unknownCodecs=R}function L(R,C,S){var x=C[S];x&&(R[S]=x)}function w(R,C){for(var S=R[C],x=C;x--;){var _=R[x];if(!_)return;_.programDateTime=S.programDateTime-_.duration*1e3,S=_}}function T(R,C){R.rawProgramDateTime?R.programDateTime=Date.parse(R.rawProgramDateTime):C!=null&&C.programDateTime&&(R.programDateTime=C.endProgramDateTime),Object($.isFiniteNumber)(R.programDateTime)||(R.programDateTime=null,R.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ue,Z,P){"use strict";P.r(Z);var $=P("./src/polyfills/number.ts"),B=P("./src/events.ts"),U=P("./src/errors.ts"),K=P("./src/utils/logger.ts"),G=P("./src/utils/mp4-tools.ts"),M=P("./src/loader/m3u8-parser.ts"),O=P("./src/types/loader.ts"),v=P("./src/utils/attr-list.ts");function m(o){var f=o.type;switch(f){case O.PlaylistContextType.AUDIO_TRACK:return O.PlaylistLevelType.AUDIO;case O.PlaylistContextType.SUBTITLE_TRACK:return O.PlaylistLevelType.SUBTITLE;default:return O.PlaylistLevelType.MAIN}}function p(o,f){var l=o.url;return(l===void 0||l.indexOf("data:")===0)&&(l=f.url),l}var h=function(){function o(l){this.hls=void 0,this.loaders=Object.create(null),this.hls=l,this.registerListeners()}var f=o.prototype;return f.registerListeners=function(){var r=this.hls;r.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),r.on(B.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),r.on(B.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},f.unregisterListeners=function(){var r=this.hls;r.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(B.Events.LEVEL_LOADING,this.onLevelLoading,this),r.off(B.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),r.off(B.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},f.createInternalLoader=function(r){var s=this.hls.config,c=s.pLoader,L=s.loader,w=c||L,T=new w(s);return r.loader=T,this.loaders[r.type]=T,T},f.getInternalLoader=function(r){return this.loaders[r.type]},f.resetInternalLoader=function(r){this.loaders[r]&&delete this.loaders[r]},f.destroyInternalLoaders=function(){for(var r in this.loaders){var s=this.loaders[r];s&&s.destroy(),this.resetInternalLoader(r)}},f.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},f.onManifestLoading=function(r,s){var c=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:O.PlaylistContextType.MANIFEST,url:c,deliveryDirectives:null})},f.onLevelLoading=function(r,s){var c=s.id,L=s.level,w=s.url,T=s.deliveryDirectives;this.load({id:c,groupId:null,level:L,responseType:"text",type:O.PlaylistContextType.LEVEL,url:w,deliveryDirectives:T})},f.onAudioTrackLoading=function(r,s){var c=s.id,L=s.groupId,w=s.url,T=s.deliveryDirectives;this.load({id:c,groupId:L,level:null,responseType:"text",type:O.PlaylistContextType.AUDIO_TRACK,url:w,deliveryDirectives:T})},f.onSubtitleTrackLoading=function(r,s){var c=s.id,L=s.groupId,w=s.url,T=s.deliveryDirectives;this.load({id:c,groupId:L,level:null,responseType:"text",type:O.PlaylistContextType.SUBTITLE_TRACK,url:w,deliveryDirectives:T})},f.load=function(r){var s,c=this.hls.config,L=this.getInternalLoader(r);if(L){var w=L.context;if(w&&w.url===r.url){K.logger.trace("[playlist-loader]: playlist request ongoing");return}K.logger.log("[playlist-loader]: aborting previous loader for type: "+r.type),L.abort()}var T,R,C,S;switch(r.type){case O.PlaylistContextType.MANIFEST:T=c.manifestLoadingMaxRetry,R=c.manifestLoadingTimeOut,C=c.manifestLoadingRetryDelay,S=c.manifestLoadingMaxRetryTimeout;break;case O.PlaylistContextType.LEVEL:case O.PlaylistContextType.AUDIO_TRACK:case O.PlaylistContextType.SUBTITLE_TRACK:T=0,R=c.levelLoadingTimeOut;break;default:T=c.levelLoadingMaxRetry,R=c.levelLoadingTimeOut,C=c.levelLoadingRetryDelay,S=c.levelLoadingMaxRetryTimeout;break}if(L=this.createInternalLoader(r),(s=r.deliveryDirectives)!==null&&s!==void 0&&s.part){var x;if(r.type===O.PlaylistContextType.LEVEL&&r.level!==null?x=this.hls.levels[r.level].details:r.type===O.PlaylistContextType.AUDIO_TRACK&&r.id!==null?x=this.hls.audioTracks[r.id].details:r.type===O.PlaylistContextType.SUBTITLE_TRACK&&r.id!==null&&(x=this.hls.subtitleTracks[r.id].details),x){var _=x.partTarget,d=x.targetduration;_&&d&&(R=Math.min(Math.max(_*3,d*.8)*1e3,R))}}var u={timeout:R,maxRetry:T,retryDelay:C,maxRetryDelay:S,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};L.load(r,u,g)},f.loadsuccess=function(r,s,c,L){if(L===void 0&&(L=null),c.isSidxRequest){this.handleSidxRequest(r,c),this.handlePlaylistLoaded(r,s,c,L);return}this.resetInternalLoader(c.type);var w=r.data;if(w.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(r,c,"no EXTM3U delimiter",L);return}s.parsing.start=performance.now(),w.indexOf("#EXTINF:")>0||w.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(r,s,c,L):this.handleMasterPlaylist(r,s,c,L)},f.loaderror=function(r,s,c){c===void 0&&(c=null),this.handleNetworkError(s,c,!1,r)},f.loadtimeout=function(r,s,c){c===void 0&&(c=null),this.handleNetworkError(s,c,!0)},f.handleMasterPlaylist=function(r,s,c,L){var w=this.hls,T=r.data,R=p(r,c),C=M.default.parseMasterPlaylist(T,R),S=C.levels,x=C.sessionData;if(!S.length){this.handleManifestParsingError(r,c,"no level found in manifest",L);return}var _=S.map(function(D){return{id:D.attrs.AUDIO,audioCodec:D.audioCodec}}),d=S.map(function(D){return{id:D.attrs.SUBTITLES,textCodec:D.textCodec}}),u=M.default.parseMasterPlaylistMedia(T,R,"AUDIO",_),g=M.default.parseMasterPlaylistMedia(T,R,"SUBTITLES",d),E=M.default.parseMasterPlaylistMedia(T,R,"CLOSED-CAPTIONS");if(u.length){var N=u.some(function(D){return!D.url});!N&&S[0].audioCodec&&!S[0].attrs.AUDIO&&(K.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),u.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new v.AttrList({}),bitrate:0,url:""}))}w.trigger(B.Events.MANIFEST_LOADED,{levels:S,audioTracks:u,subtitles:g,captions:E,url:R,stats:s,networkDetails:L,sessionData:x})},f.handleTrackOrLevelPlaylist=function(r,s,c,L){var w=this.hls,T=c.id,R=c.level,C=c.type,S=p(r,c),x=Object($.isFiniteNumber)(T)?T:0,_=Object($.isFiniteNumber)(R)?R:x,d=m(c),u=M.default.parseLevelPlaylist(r.data,S,_,d,x);if(!u.fragments.length){w.trigger(B.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:S,reason:"no fragments found in level",level:typeof c.level=="number"?c.level:void 0});return}if(C===O.PlaylistContextType.MANIFEST){var g={attrs:new v.AttrList({}),bitrate:0,details:u,name:"",url:S};w.trigger(B.Events.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:S,stats:s,networkDetails:L,sessionData:null})}if(s.parsing.end=performance.now(),u.needSidxRanges){var E,N=(E=u.fragments[0].initSegment)===null||E===void 0?void 0:E.url;this.load({url:N,isSidxRequest:!0,type:C,level:R,levelDetails:u,id:T,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}c.levelDetails=u,this.handlePlaylistLoaded(r,s,c,L)},f.handleSidxRequest=function(r,s){var c=Object(G.parseSegmentIndex)(new Uint8Array(r.data));if(!c)return;var L=c.references,w=s.levelDetails;L.forEach(function(T,R){var C=T.info,S=w.fragments[R];S.byteRange.length===0&&S.setByteRange(String(1+C.end-C.start)+"@"+String(C.start)),S.initSegment&&S.initSegment.setByteRange(String(c.moovEndOffset)+"@0")})},f.handleManifestParsingError=function(r,s,c,L){this.hls.trigger(B.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===O.PlaylistContextType.MANIFEST,url:r.url,reason:c,response:r,context:s,networkDetails:L})},f.handleNetworkError=function(r,s,c,L){c===void 0&&(c=!1),K.logger.warn("[playlist-loader]: A network "+(c?"timeout":"error")+" occurred while loading "+r.type+" level: "+r.level+" id: "+r.id+' group-id: "'+r.groupId+'"');var w=U.ErrorDetails.UNKNOWN,T=!1,R=this.getInternalLoader(r);switch(r.type){case O.PlaylistContextType.MANIFEST:w=c?U.ErrorDetails.MANIFEST_LOAD_TIMEOUT:U.ErrorDetails.MANIFEST_LOAD_ERROR,T=!0;break;case O.PlaylistContextType.LEVEL:w=c?U.ErrorDetails.LEVEL_LOAD_TIMEOUT:U.ErrorDetails.LEVEL_LOAD_ERROR,T=!1;break;case O.PlaylistContextType.AUDIO_TRACK:w=c?U.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:U.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,T=!1;break;case O.PlaylistContextType.SUBTITLE_TRACK:w=c?U.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:U.ErrorDetails.SUBTITLE_LOAD_ERROR,T=!1;break}R&&this.resetInternalLoader(r.type);var C={type:U.ErrorTypes.NETWORK_ERROR,details:w,fatal:T,url:r.url,loader:R,context:r,networkDetails:s};L&&(C.response=L),this.hls.trigger(B.Events.ERROR,C)},f.handlePlaylistLoaded=function(r,s,c,L){var w=c.type,T=c.level,R=c.id,C=c.groupId,S=c.loader,x=c.levelDetails,_=c.deliveryDirectives;if(!(x!=null&&x.targetduration)){this.handleManifestParsingError(r,c,"invalid target duration",L);return}if(!S)return;x.live&&(S.getCacheAge&&(x.ageHeader=S.getCacheAge()||0),(!S.getCacheAge||isNaN(x.ageHeader))&&(x.ageHeader=0));switch(w){case O.PlaylistContextType.MANIFEST:case O.PlaylistContextType.LEVEL:this.hls.trigger(B.Events.LEVEL_LOADED,{details:x,level:T||0,id:R||0,stats:s,networkDetails:L,deliveryDirectives:_});break;case O.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(B.Events.AUDIO_TRACK_LOADED,{details:x,id:R||0,groupId:C||"",stats:s,networkDetails:L,deliveryDirectives:_});break;case O.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(B.Events.SUBTITLE_TRACK_LOADED,{details:x,id:R||0,groupId:C||"",stats:s,networkDetails:L,deliveryDirectives:_});break}},o}();Z.default=h},"./src/polyfills/number.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"isFiniteNumber",function(){return $}),P.d(Z,"MAX_SAFE_INTEGER",function(){return B});var $=Number.isFinite||function(U){return typeof U=="number"&&isFinite(U)},B=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ue,Z,P){"use strict";P.r(Z);var $=function(){function B(){}return B.getSilentFrame=function(K,G){switch(K){case"mp4a.40.2":if(G===1)return new Uint8Array([0,200,0,128,35,128]);if(G===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(G===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(G===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(G===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(G===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(G===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(G===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(G===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},B}();Z.default=$},"./src/remux/mp4-generator.ts":function(ue,Z,P){"use strict";P.r(Z);var $=Math.pow(2,32)-1,B=function(){function U(){}return U.init=function(){U.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 G;for(G in U.types)U.types.hasOwnProperty(G)&&(U.types[G]=[G.charCodeAt(0),G.charCodeAt(1),G.charCodeAt(2),G.charCodeAt(3)]);var M=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]),O=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]);U.HDLR_TYPES={video:M,audio:O};var v=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),m=new Uint8Array([0,0,0,0,0,0,0,0]);U.STTS=U.STSC=U.STCO=m,U.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),U.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),U.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),U.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var p=new Uint8Array([105,115,111,109]),h=new Uint8Array([97,118,99,49]),o=new Uint8Array([0,0,0,1]);U.FTYP=U.box(U.types.ftyp,p,o,p,h),U.DINF=U.box(U.types.dinf,U.box(U.types.dref,v))},U.box=function(G){for(var M=8,O=arguments.length,v=new Array(O>1?O-1:0),m=1;m<O;m++)v[m-1]=arguments[m];for(var p=v.length,h=p;p--;)M+=v[p].byteLength;var o=new Uint8Array(M);for(o[0]=M>>24&255,o[1]=M>>16&255,o[2]=M>>8&255,o[3]=M&255,o.set(G,4),p=0,M=8;p<h;p++)o.set(v[p],M),M+=v[p].byteLength;return o},U.hdlr=function(G){return U.box(U.types.hdlr,U.HDLR_TYPES[G])},U.mdat=function(G){return U.box(U.types.mdat,G)},U.mdhd=function(G,M){M*=G;var O=Math.floor(M/($+1)),v=Math.floor(M%($+1));return U.box(U.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,G>>24&255,G>>16&255,G>>8&255,G&255,O>>24,O>>16&255,O>>8&255,O&255,v>>24,v>>16&255,v>>8&255,v&255,85,196,0,0]))},U.mdia=function(G){return U.box(U.types.mdia,U.mdhd(G.timescale,G.duration),U.hdlr(G.type),U.minf(G))},U.mfhd=function(G){return U.box(U.types.mfhd,new Uint8Array([0,0,0,0,G>>24,G>>16&255,G>>8&255,G&255]))},U.minf=function(G){return G.type==="audio"?U.box(U.types.minf,U.box(U.types.smhd,U.SMHD),U.DINF,U.stbl(G)):U.box(U.types.minf,U.box(U.types.vmhd,U.VMHD),U.DINF,U.stbl(G))},U.moof=function(G,M,O){return U.box(U.types.moof,U.mfhd(G),U.traf(O,M))},U.moov=function(G){for(var M=G.length,O=[];M--;)O[M]=U.trak(G[M]);return U.box.apply(null,[U.types.moov,U.mvhd(G[0].timescale,G[0].duration)].concat(O).concat(U.mvex(G)))},U.mvex=function(G){for(var M=G.length,O=[];M--;)O[M]=U.trex(G[M]);return U.box.apply(null,[U.types.mvex].concat(O))},U.mvhd=function(G,M){M*=G;var O=Math.floor(M/($+1)),v=Math.floor(M%($+1)),m=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,G>>24&255,G>>16&255,G>>8&255,G&255,O>>24,O>>16&255,O>>8&255,O&255,v>>24,v>>16&255,v>>8&255,v&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return U.box(U.types.mvhd,m)},U.sdtp=function(G){var M=G.samples||[],O=new Uint8Array(4+M.length),v,m;for(v=0;v<M.length;v++)m=M[v].flags,O[v+4]=m.dependsOn<<4|m.isDependedOn<<2|m.hasRedundancy;return U.box(U.types.sdtp,O)},U.stbl=function(G){return U.box(U.types.stbl,U.stsd(G),U.box(U.types.stts,U.STTS),U.box(U.types.stsc,U.STSC),U.box(U.types.stsz,U.STSZ),U.box(U.types.stco,U.STCO))},U.avc1=function(G){var M=[],O=[],v,m,p;for(v=0;v<G.sps.length;v++)m=G.sps[v],p=m.byteLength,M.push(p>>>8&255),M.push(p&255),M=M.concat(Array.prototype.slice.call(m));for(v=0;v<G.pps.length;v++)m=G.pps[v],p=m.byteLength,O.push(p>>>8&255),O.push(p&255),O=O.concat(Array.prototype.slice.call(m));var h=U.box(U.types.avcC,new Uint8Array([1,M[3],M[4],M[5],252|3,224|G.sps.length].concat(M).concat([G.pps.length]).concat(O))),o=G.width,f=G.height,l=G.pixelRatio[0],r=G.pixelRatio[1];return U.box(U.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,o>>8&255,o&255,f>>8&255,f&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]),h,U.box(U.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),U.box(U.types.pasp,new Uint8Array([l>>24,l>>16&255,l>>8&255,l&255,r>>24,r>>16&255,r>>8&255,r&255])))},U.esds=function(G){var M=G.config.length;return new Uint8Array([0,0,0,0,3,23+M,0,1,0,4,15+M,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([M]).concat(G.config).concat([6,1,2]))},U.mp4a=function(G){var M=G.samplerate;return U.box(U.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,G.channelCount,0,16,0,0,0,0,M>>8&255,M&255,0,0]),U.box(U.types.esds,U.esds(G)))},U.mp3=function(G){var M=G.samplerate;return U.box(U.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,G.channelCount,0,16,0,0,0,0,M>>8&255,M&255,0,0]))},U.stsd=function(G){return G.type==="audio"?!G.isAAC&&G.codec==="mp3"?U.box(U.types.stsd,U.STSD,U.mp3(G)):U.box(U.types.stsd,U.STSD,U.mp4a(G)):U.box(U.types.stsd,U.STSD,U.avc1(G))},U.tkhd=function(G){var M=G.id,O=G.duration*G.timescale,v=G.width,m=G.height,p=Math.floor(O/($+1)),h=Math.floor(O%($+1));return U.box(U.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,M&255,0,0,0,0,p>>24,p>>16&255,p>>8&255,p&255,h>>24,h>>16&255,h>>8&255,h&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,v>>8&255,v&255,0,0,m>>8&255,m&255,0,0]))},U.traf=function(G,M){var O=U.sdtp(G),v=G.id,m=Math.floor(M/($+1)),p=Math.floor(M%($+1));return U.box(U.types.traf,U.box(U.types.tfhd,new Uint8Array([0,0,0,0,v>>24,v>>16&255,v>>8&255,v&255])),U.box(U.types.tfdt,new Uint8Array([1,0,0,0,m>>24,m>>16&255,m>>8&255,m&255,p>>24,p>>16&255,p>>8&255,p&255])),U.trun(G,O.length+16+20+8+16+8+8),O)},U.trak=function(G){return G.duration=G.duration||4294967295,U.box(U.types.trak,U.tkhd(G),U.mdia(G))},U.trex=function(G){var M=G.id;return U.box(U.types.trex,new Uint8Array([0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},U.trun=function(G,M){var O=G.samples||[],v=O.length,m=12+16*v,p=new Uint8Array(m),h,o,f,l,r,s;for(M+=8+m,p.set([0,0,15,1,v>>>24&255,v>>>16&255,v>>>8&255,v&255,M>>>24&255,M>>>16&255,M>>>8&255,M&255],0),h=0;h<v;h++)o=O[h],f=o.duration,l=o.size,r=o.flags,s=o.cts,p.set([f>>>24&255,f>>>16&255,f>>>8&255,f&255,l>>>24&255,l>>>16&255,l>>>8&255,l&255,r.isLeading<<2|r.dependsOn,r.isDependedOn<<6|r.hasRedundancy<<4|r.paddingValue<<1|r.isNonSync,r.degradPrio&240<<8,r.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*h);return U.box(U.types.trun,p)},U.initSegment=function(G){U.types||U.init();var M=U.moov(G),O=new Uint8Array(U.FTYP.byteLength+M.byteLength);return O.set(U.FTYP),O.set(M,U.FTYP.byteLength),O},U}();B.types=void 0,B.HDLR_TYPES=void 0,B.STTS=void 0,B.STSC=void 0,B.STCO=void 0,B.STSZ=void 0,B.VMHD=void 0,B.SMHD=void 0,B.STSD=void 0,B.FTYP=void 0,B.DINF=void 0,Z.default=B},"./src/remux/mp4-remuxer.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return s}),P.d(Z,"normalizePts",function(){return c});var $=P("./src/polyfills/number.ts"),B=P("./src/remux/aac-helper.ts"),U=P("./src/remux/mp4-generator.ts"),K=P("./src/events.ts"),G=P("./src/errors.ts"),M=P("./src/utils/logger.ts"),O=P("./src/types/loader.ts"),v=P("./src/utils/timescale-conversion.ts");function m(){return m=Object.assign||function(R){for(var C=1;C<arguments.length;C++){var S=arguments[C];for(var x in S)Object.prototype.hasOwnProperty.call(S,x)&&(R[x]=S[x])}return R},m.apply(this,arguments)}var p=10*1e3,h=1024,o=1152,f=null,l=null,r=!1,s=function(){function R(S,x,_,d){if(d===void 0&&(d=""),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=S,this.config=x,this.typeSupported=_,this.ISGenerated=!1,f===null){var u=navigator.userAgent||"",g=u.match(/Chrome\/(\d+)/i);f=g?parseInt(g[1]):0}if(l===null){var E=navigator.userAgent.match(/Safari\/(\d+)/i);l=E?parseInt(E[1]):0}r=!!f&&f<75||!!l&&l<600}var C=R.prototype;return C.destroy=function(){},C.resetTimeStamp=function(x){M.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=x},C.resetNextTimestamp=function(){M.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},C.resetInitSegment=function(){M.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},C.getVideoStartPts=function(x){var _=!1,d=x.reduce(function(u,g){var E=g.pts-u;return E<-4294967296?(_=!0,c(u,g.pts)):E>0?u:g.pts},x[0].pts);return _&&M.logger.debug("PTS rollover detected"),d},C.remux=function(x,_,d,u,g,E,N,D){var H,j,I,b,W,Y,ie=g,oe=g,xe=x.pid>-1,ve=_.pid>-1,we=_.samples.length,Ce=x.samples.length>0,Se=we>1,fe=(!xe||Ce)&&(!ve||Se)||this.ISGenerated||N;if(fe){this.ISGenerated||(I=this.generateIS(x,_,g));var le=this.isVideoContiguous,te=-1;if(Se&&(te=L(_.samples),!le&&this.config.forceKeyFrameOnDiscontinuity))if(Y=!0,te>0){M.logger.warn("[mp4-remuxer]: Dropped "+te+" out of "+we+" video samples due to a missing keyframe");var de=this.getVideoStartPts(_.samples);_.samples=_.samples.slice(te),_.dropped+=te,oe+=(_.samples[0].pts-de)/(_.timescale||9e4)}else te===-1&&(M.logger.warn("[mp4-remuxer]: No keyframe found out of "+we+" video samples"),Y=!1);if(this.ISGenerated){if(Ce&&Se){var se=this.getVideoStartPts(_.samples),Re=c(x.samples[0].pts,se)-se,Le=Re/_.inputTimeScale;ie+=Math.max(0,Le),oe+=Math.max(0,-Le)}if(Ce){if(x.samplerate||(M.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),I=this.generateIS(x,_,g)),j=this.remuxAudio(x,ie,this.isAudioContiguous,E,ve||Se||D===O.PlaylistLevelType.AUDIO?oe:void 0),Se){var Te=j?j.endPTS-j.startPTS:0;_.inputTimeScale||(M.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),I=this.generateIS(x,_,g)),H=this.remuxVideo(_,oe,le,Te)}}else Se&&(H=this.remuxVideo(_,oe,le,0));H&&(H.firstKeyFrame=te,H.independent=te!==-1)}}return this.ISGenerated&&(d.samples.length&&(W=this.remuxID3(d,g)),u.samples.length&&(b=this.remuxText(u,g))),{audio:j,video:H,initSegment:I,independent:Y,text:b,id3:W}},C.generateIS=function(x,_,d){var u=x.samples,g=_.samples,E=this.typeSupported,N={},D=!Object($.isFiniteNumber)(this._initPTS),H="audio/mp4",j,I,b;if(D&&(j=I=Infinity),x.config&&u.length&&(x.timescale=x.samplerate,x.isAAC||(E.mpeg?(H="audio/mpeg",x.codec=""):E.mp3&&(x.codec="mp3")),N.audio={id:"audio",container:H,codec:x.codec,initSegment:!x.isAAC&&E.mpeg?new Uint8Array(0):U.default.initSegment([x]),metadata:{channelCount:x.channelCount}},D&&(b=x.inputTimeScale,j=I=u[0].pts-Math.round(b*d))),_.sps&&_.pps&&g.length&&(_.timescale=_.inputTimeScale,N.video={id:"main",container:"video/mp4",codec:_.codec,initSegment:U.default.initSegment([_]),metadata:{width:_.width,height:_.height}},D)){b=_.inputTimeScale;var W=this.getVideoStartPts(g),Y=Math.round(b*d);I=Math.min(I,c(g[0].dts,W)-Y),j=Math.min(j,W-Y)}if(Object.keys(N).length)return this.ISGenerated=!0,D&&(this._initPTS=j,this._initDTS=I),{tracks:N,initPTS:j,timescale:b}},C.remuxVideo=function(x,_,d,u){var g=x.inputTimeScale,E=x.samples,N=[],D=E.length,H=this._initPTS,j=this.nextAvcDts,I=8,b,W,Y,ie=Number.POSITIVE_INFINITY,oe=Number.NEGATIVE_INFINITY,xe=0,ve=!1;if(!d||j===null){var we=_*g,Ce=E[0].pts-c(E[0].dts,E[0].pts);j=we-Ce}for(var Se=0;Se<D;Se++){var fe=E[Se];if(fe.pts=c(fe.pts-H,j),fe.dts=c(fe.dts-H,j),fe.dts>fe.pts){var le=9e4*.2;xe=Math.max(Math.min(xe,fe.pts-fe.dts),-1*le)}fe.dts<E[Se>0?Se-1:Se].dts&&(ve=!0)}ve&&E.sort(function(Ot,Rt){var ft=Ot.dts-Rt.dts,It=Ot.pts-Rt.pts;return ft||It}),W=E[0].dts,Y=E[E.length-1].dts;var te=Math.round((Y-W)/(D-1));if(xe<0){if(xe<te*-2){M.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(v.toMsFromMpegTsClock)(-te,!0)+" ms");for(var de=xe,se=0;se<D;se++)E[se].dts=de=Math.max(de,E[se].pts-te),E[se].pts=Math.max(de,E[se].pts)}else{M.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(v.toMsFromMpegTsClock)(xe,!0)+" ms to overcome this issue");for(var Re=0;Re<D;Re++)E[Re].dts=E[Re].dts+xe}W=E[0].dts}if(d){var Le=W-j,Te=Le>te,Ie=Le<-1;if(Te||Ie){Te?M.logger.warn("AVC: "+Object(v.toMsFromMpegTsClock)(Le,!0)+" ms ("+Le+"dts) hole between fragments detected, filling it"):M.logger.warn("AVC: "+Object(v.toMsFromMpegTsClock)(-Le,!0)+" ms ("+Le+"dts) overlapping between fragments detected"),W=j;var Ue=E[0].pts-Le;E[0].dts=W,E[0].pts=Ue,M.logger.log("Video: First PTS/DTS adjusted: "+Object(v.toMsFromMpegTsClock)(Ue,!0)+"/"+Object(v.toMsFromMpegTsClock)(W,!0)+", delta: "+Object(v.toMsFromMpegTsClock)(Le,!0)+" ms")}}r&&(W=Math.max(0,W));for(var We=0,Fe=0,Ne=0;Ne<D;Ne++){for(var Me=E[Ne],$e=Me.units,et=$e.length,Qe=0,Ze=0;Ze<et;Ze++)Qe+=$e[Ze].data.length;Fe+=Qe,We+=et,Me.length=Qe,Me.dts=Math.max(Me.dts,W),Me.pts=Math.max(Me.pts,Me.dts,0),ie=Math.min(Me.pts,ie),oe=Math.max(Me.pts,oe)}Y=E[D-1].dts;var dt=Fe+4*We+8,it;try{it=new Uint8Array(dt)}catch(Ot){this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:G.ErrorTypes.MUX_ERROR,details:G.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:dt,reason:"fail allocating video mdat "+dt});return}var at=new DataView(it.buffer);at.setUint32(0,dt),it.set(U.default.types.mdat,4);for(var Pe=0;Pe<D;Pe++){for(var ut=E[Pe],tt=ut.units,ke=0,Ge=0,Ee=tt.length;Ge<Ee;Ge++){var pe=tt[Ge],_e=pe.data,re=pe.data.byteLength;at.setUint32(I,re),I+=4,it.set(_e,I),I+=re,ke+=4+re}if(Pe<D-1)b=E[Pe+1].dts-ut.dts;else{var ae=this.config,he=ut.dts-E[Pe>0?Pe-1:Pe].dts;if(ae.stretchShortVideoTrack&&this.nextAudioPts!==null){var ge=Math.floor(ae.maxBufferHole*g),be=(u?ie+u*g:this.nextAudioPts)-ut.pts;be>ge?(b=be-he,b<0&&(b=he),M.logger.log("[mp4-remuxer]: It is approximately "+be/90+" ms to the next segment; using duration "+b/90+" ms for the last video frame.")):b=he}else b=he}var De=Math.round(ut.pts-ut.dts);N.push(new w(ut.key,b,ke,De))}if(N.length&&f&&f<70){var je=N[0].flags;je.dependsOn=2,je.isNonSync=0}console.assert(b!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=j=Y+b,this.isVideoContiguous=!0;var lt=U.default.moof(x.sequenceNumber++,W,m({},x,{samples:N})),mt="video",pt={data1:lt,data2:it,startPTS:ie/g,endPTS:(oe+b)/g,startDTS:W/g,endDTS:j/g,type:mt,hasAudio:!1,hasVideo:!0,nb:N.length,dropped:x.dropped};return x.samples=[],x.dropped=0,console.assert(it.length,"MDAT length must not be zero"),pt},C.remuxAudio=function(x,_,d,u,g){var E=x.inputTimeScale,N=x.samplerate?x.samplerate:E,D=E/N,H=x.isAAC?h:o,j=H*D,I=this._initPTS,b=!x.isAAC&&this.typeSupported.mpeg,W=[],Y=x.samples,ie=b?0:8,oe=this.nextAudioPts||-1,xe=_*E;if(this.isAudioContiguous=d=d||Y.length&&oe>0&&(u&&Math.abs(xe-oe)<9e3||Math.abs(c(Y[0].pts-I,xe)-oe)<20*j),Y.forEach(function(_e){_e.pts=c(_e.pts-I,xe)}),!d||oe<0){if(Y=Y.filter(function(_e){return _e.pts>=0}),!Y.length)return;g===0?oe=0:u?oe=Math.max(0,xe):oe=Y[0].pts}if(x.isAAC)for(var ve=g!==void 0,we=this.config.maxAudioFramesDrift,Ce=0,Se=oe;Ce<Y.length;Ce++){var fe=Y[Ce],le=fe.pts,te=le-Se,de=Math.abs(1e3*te/E);if(te<=-we*j&&ve)Ce===0&&(M.logger.warn("Audio frame @ "+(le/E).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*te/E)+" ms."),this.nextAudioPts=oe=Se=le);else if(te>=we*j&&de<p&&ve){var se=Math.round(te/j);Se=le-se*j,Se<0&&(se--,Se+=j),Ce===0&&(this.nextAudioPts=oe=Se),M.logger.warn("[mp4-remuxer]: Injecting "+se+" audio frame @ "+(Se/E).toFixed(3)+"s due to "+Math.round(1e3*te/E)+" ms gap.");for(var Re=0;Re<se;Re++){var Le=Math.max(Se,0),Te=B.default.getSilentFrame(x.manifestCodec||x.codec,x.channelCount);Te||(M.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Te=fe.unit.subarray()),Y.splice(Ce,0,{unit:Te,pts:Le}),Se+=j,Ce++}}fe.pts=Se,Se+=j}for(var Ie=null,Ue=null,We,Fe=0,Ne=Y.length;Ne--;)Fe+=Y[Ne].unit.byteLength;for(var Me=0,$e=Y.length;Me<$e;Me++){var et=Y[Me],Qe=et.unit,Ze=et.pts;if(Ue!==null){var dt=W[Me-1];dt.duration=Math.round((Ze-Ue)/D)}else if(d&&x.isAAC&&(Ze=oe),Ie=Ze,Fe>0){Fe+=ie;try{We=new Uint8Array(Fe)}catch(_e){this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:G.ErrorTypes.MUX_ERROR,details:G.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Fe,reason:"fail allocating audio mdat "+Fe});return}if(!b){var it=new DataView(We.buffer);it.setUint32(0,Fe),We.set(U.default.types.mdat,4)}}else return;We.set(Qe,ie);var at=Qe.byteLength;ie+=at,W.push(new w(!0,H,at,0)),Ue=Ze}var Pe=W.length;if(!Pe)return;var ut=W[W.length-1];this.nextAudioPts=oe=Ue+D*ut.duration;var tt=b?new Uint8Array(0):U.default.moof(x.sequenceNumber++,Ie/D,m({},x,{samples:W}));x.samples=[];var ke=Ie/E,Ge=oe/E,Ee="audio",pe={data1:tt,data2:We,startPTS:ke,endPTS:Ge,startDTS:ke,endDTS:Ge,type:Ee,hasAudio:!0,hasVideo:!1,nb:Pe};return this.isAudioContiguous=!0,console.assert(We.length,"MDAT length must not be zero"),pe},C.remuxEmptyAudio=function(x,_,d,u){var g=x.inputTimeScale,E=x.samplerate?x.samplerate:g,N=g/E,D=this.nextAudioPts,H=(D!==null?D:u.startDTS*g)+this._initDTS,j=u.endDTS*g+this._initDTS,I=N*h,b=Math.ceil((j-H)/I),W=B.default.getSilentFrame(x.manifestCodec||x.codec,x.channelCount);if(M.logger.warn("[mp4-remuxer]: remux empty Audio"),!W){M.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Y=[],ie=0;ie<b;ie++){var oe=H+ie*I;Y.push({unit:W,pts:oe,dts:oe})}return x.samples=Y,this.remuxAudio(x,_,d,!1)},C.remuxID3=function(x,_){var d=x.samples.length;if(!d)return;for(var u=x.inputTimeScale,g=this._initPTS,E=this._initDTS,N=0;N<d;N++){var D=x.samples[N];D.pts=c(D.pts-g,_*u)/u,D.dts=c(D.dts-E,_*u)/u}var H=x.samples;return x.samples=[],{samples:H}},C.remuxText=function(x,_){var d=x.samples.length;if(!d)return;for(var u=x.inputTimeScale,g=this._initPTS,E=0;E<d;E++){var N=x.samples[E];N.pts=c(N.pts-g,_*u)/u}x.samples.sort(function(H,j){return H.pts-j.pts});var D=x.samples;return x.samples=[],{samples:D}},R}();function c(R,C){var S;if(C===null)return R;for(C<R?S=-8589934592:S=8589934592;Math.abs(R-C)>4294967296;)R+=S;return R}function L(R){for(var C=0;C<R.length;C++)if(R[C].key)return C;return-1}var w=function(C,S,x,_){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=S,this.size=x,this.cts=_,this.flags=new T(C)},T=function(C){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=C?2:1,this.isNonSync=C?0:1}},"./src/remux/passthrough-remuxer.ts":function(ue,Z,P){"use strict";P.r(Z);var $=P("./src/polyfills/number.ts"),B=P("./src/utils/mp4-tools.ts"),U=P("./src/loader/fragment.ts"),K=P("./src/utils/logger.ts"),G=function(){function v(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var m=v.prototype;return m.destroy=function(){},m.resetTimeStamp=function(h){this.initPTS=h,this.lastEndDTS=null},m.resetNextTimestamp=function(){this.lastEndDTS=null},m.resetInitSegment=function(h,o,f){this.audioCodec=o,this.videoCodec=f,this.generateInitSegment(h),this.emitInitSegment=!0},m.generateInitSegment=function(h){var o=this.audioCodec,f=this.videoCodec;if(!h||!h.byteLength){this.initTracks=void 0,this.initData=void 0;return}var l=this.initData=Object(B.parseInitSegment)(h);o||(o=O(l.audio,U.ElementaryStreamTypes.AUDIO)),f||(f=O(l.video,U.ElementaryStreamTypes.VIDEO));var r={};l.audio&&l.video?r.audiovideo={container:"video/mp4",codec:o+","+f,initSegment:h,id:"main"}:l.audio?r.audio={container:"audio/mp4",codec:o,initSegment:h,id:"audio"}:l.video?r.video={container:"video/mp4",codec:f,initSegment:h,id:"main"}:K.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=r},m.remux=function(h,o,f,l,r){var s=this.initPTS,c=this.lastEndDTS,L={audio:void 0,video:void 0,text:l,id3:f,initSegment:void 0};Object($.isFiniteNumber)(c)||(c=this.lastEndDTS=r||0);var w=o.samples;if(!w||!w.length)return L;var T={initPTS:void 0,timescale:1},R=this.initData;if((!R||!R.length)&&(this.generateInitSegment(w),R=this.initData),!R||!R.length)return K.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),L;this.emitInitSegment&&(T.tracks=this.initTracks,this.emitInitSegment=!1),Object($.isFiniteNumber)(s)||(this.initPTS=T.initPTS=s=M(R,w,c));var C=Object(B.getDuration)(w,R),S=c,x=C+S;Object(B.offsetStartDTS)(R,w,s),C>0?this.lastEndDTS=x:(K.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var _=!!R.audio,d=!!R.video,u="";_&&(u+="audio"),d&&(u+="video");var g={data1:w,startPTS:S,startDTS:S,endPTS:x,endDTS:x,type:u,hasAudio:_,hasVideo:d,nb:1,dropped:0};return L.audio=g.type==="audio"?g:void 0,L.video=g.type!=="audio"?g:void 0,L.text=l,L.id3=f,L.initSegment=T,L},v}(),M=function(m,p,h){return Object(B.getStartDTS)(m,p)-h};function O(v,m){var p=v==null?void 0:v.codec;return p&&p.length>4?p:p==="hvc1"?"hvc1.1.c.L120.90":p==="av01"?"av01.0.04M.08":p==="avc1"||m===U.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Z.default=G},"./src/task-loop.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return $});var $=function(){function B(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var U=B.prototype;return U.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},U.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},U.onHandlerDestroyed=function(){},U.hasInterval=function(){return!!this._tickInterval},U.hasNextTick=function(){return!!this._tickTimer},U.setInterval=function(G){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,G),!0)},U.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},U.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},U.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},U.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},U.doTick=function(){},B}()},"./src/types/cmcd.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"CMCDVersion",function(){return $}),P.d(Z,"CMCDObjectType",function(){return B}),P.d(Z,"CMCDStreamingFormat",function(){return U}),P.d(Z,"CMCDStreamType",function(){return K});var $=1,B;(function(G){G.MANIFEST="m",G.AUDIO="a",G.VIDEO="v",G.MUXED="av",G.INIT="i",G.CAPTION="c",G.TIMED_TEXT="tt",G.KEY="k",G.OTHER="o"})(B||(B={}));var U;(function(G){G.DASH="d",G.HLS="h",G.SMOOTH="s",G.OTHER="o"})(U||(U={}));var K;(function(G){G.VOD="v",G.LIVE="l"})(K||(K={}))},"./src/types/level.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"HlsSkip",function(){return U}),P.d(Z,"getSkipValue",function(){return K}),P.d(Z,"HlsUrlParameters",function(){return G}),P.d(Z,"Level",function(){return M});function $(O,v){for(var m=0;m<v.length;m++){var p=v[m];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(O,p.key,p)}}function B(O,v,m){return v&&$(O.prototype,v),m&&$(O,m),O}var U;(function(O){O.No="",O.Yes="YES",O.v2="v2"})(U||(U={}));function K(O,v){var m=O.canSkipUntil,p=O.canSkipDateRanges,h=O.endSN,o=v!==void 0?v-h:0;return m&&o<m?p?U.v2:U.Yes:U.No}var G=function(){function O(m,p,h){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=m,this.part=p,this.skip=h}var v=O.prototype;return v.addDirectives=function(p){var h=new self.URL(p);return this.msn!==void 0&&h.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&h.searchParams.set("_HLS_part",this.part.toString()),this.skip&&h.searchParams.set("_HLS_skip",this.skip),h.toString()},O}(),M=function(){function O(v){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[v.url],this.attrs=v.attrs,this.bitrate=v.bitrate,v.details&&(this.details=v.details),this.id=v.id||0,this.name=v.name,this.width=v.width||0,this.height=v.height||0,this.audioCodec=v.audioCodec,this.videoCodec=v.videoCodec,this.unknownCodecs=v.unknownCodecs,this.codecSet=[v.videoCodec,v.audioCodec].filter(function(m){return m}).join(",").replace(/\.[^.,]+/g,"")}return B(O,[{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(m){var p=m%this.url.length;this._urlId!==p&&(this.details=void 0,this._urlId=p)}}]),O}()},"./src/types/loader.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"PlaylistContextType",function(){return $}),P.d(Z,"PlaylistLevelType",function(){return B});var $;(function(U){U.MANIFEST="manifest",U.LEVEL="level",U.AUDIO_TRACK="audioTrack",U.SUBTITLE_TRACK="subtitleTrack"})($||($={}));var B;(function(U){U.MAIN="main",U.AUDIO="audio",U.SUBTITLE="subtitle"})(B||(B={}))},"./src/types/transmuxer.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"ChunkMetadata",function(){return $});var $=function(K,G,M,O,v,m){O===void 0&&(O=0),v===void 0&&(v=-1),m===void 0&&(m=!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=B(),this.buffering={audio:B(),video:B(),audiovideo:B()},this.level=K,this.sn=G,this.id=M,this.size=O,this.part=v,this.partial=m};function B(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"AttrList",function(){return U});var $=/^(\d+)x(\d+)$/,B=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,U=function(){function K(M){typeof M=="string"&&(M=K.parseAttrList(M));for(var O in M)M.hasOwnProperty(O)&&(this[O]=M[O])}var G=K.prototype;return G.decimalInteger=function(O){var v=parseInt(this[O],10);return v>Number.MAX_SAFE_INTEGER?Infinity:v},G.hexadecimalInteger=function(O){if(this[O]){var v=(this[O]||"0x").slice(2);v=(v.length&1?"0":"")+v;for(var m=new Uint8Array(v.length/2),p=0;p<v.length/2;p++)m[p]=parseInt(v.slice(p*2,p*2+2),16);return m}else return null},G.hexadecimalIntegerAsNumber=function(O){var v=parseInt(this[O],16);return v>Number.MAX_SAFE_INTEGER?Infinity:v},G.decimalFloatingPoint=function(O){return parseFloat(this[O])},G.optionalFloat=function(O,v){var m=this[O];return m?parseFloat(m):v},G.enumeratedString=function(O){return this[O]},G.bool=function(O){return this[O]==="YES"},G.decimalResolution=function(O){var v=$.exec(this[O]);return v===null?void 0:{width:parseInt(v[1],10),height:parseInt(v[2],10)}},K.parseAttrList=function(O){var v,m={},p='"';for(B.lastIndex=0;(v=B.exec(O))!==null;){var h=v[2];h.indexOf(p)===0&&h.lastIndexOf(p)===h.length-1&&(h=h.slice(1,-1)),m[v[1]]=h}return m},K}()},"./src/utils/binary-search.ts":function(ue,Z,P){"use strict";P.r(Z);var $={search:function(U,K){for(var G=0,M=U.length-1,O=null,v=null;G<=M;){O=(G+M)/2|0,v=U[O];var m=K(v);if(m>0)G=O+1;else if(m<0)M=O-1;else return v}return null}};Z.default=$},"./src/utils/buffer-helper.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"BufferHelper",function(){return U});var $=P("./src/utils/logger.ts"),B={length:0,start:function(){return 0},end:function(){return 0}},U=function(){function K(){}return K.isBuffered=function(M,O){try{if(M){for(var v=K.getBuffered(M),m=0;m<v.length;m++)if(O>=v.start(m)&&O<=v.end(m))return!0}}catch(p){}return!1},K.bufferInfo=function(M,O,v){try{if(M){var m=K.getBuffered(M),p=[],h;for(h=0;h<m.length;h++)p.push({start:m.start(h),end:m.end(h)});return this.bufferedInfo(p,O,v)}}catch(o){}return{len:0,start:O,end:O,nextStart:void 0}},K.bufferedInfo=function(M,O,v){O=Math.max(0,O),M.sort(function(T,R){var C=T.start-R.start;return C||R.end-T.end});var m=[];if(v)for(var p=0;p<M.length;p++){var h=m.length;if(h){var o=m[h-1].end;M[p].start-o<v?M[p].end>o&&(m[h-1].end=M[p].end):m.push(M[p])}else m.push(M[p])}else m=M;for(var f=0,l,r=O,s=O,c=0;c<m.length;c++){var L=m[c].start,w=m[c].end;if(O+v>=L&&O<w)r=L,s=w,f=s-O;else if(O+v<L){l=L;break}}return{len:f,start:r||0,end:s||0,nextStart:l}},K.getBuffered=function(M){try{return M.buffered}catch(O){return $.logger.log("failed to get media.buffered",O),B}},K}()},"./src/utils/cea-608-parser.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"Row",function(){return s}),P.d(Z,"CaptionScreen",function(){return c});var $=P("./src/utils/logger.ts"),B={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},U=function(x){var _=x;return B.hasOwnProperty(x)&&(_=B[x]),String.fromCharCode(_)},K=15,G=100,M={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},O={17:2,18:4,21:6,22:8,23:10,19:13,20:15},v={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},m={25:2,26:4,29:6,30:8,31:10,27:13,28:15},p=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],h;(function(S){S[S.ERROR=0]="ERROR",S[S.TEXT=1]="TEXT",S[S.WARNING=2]="WARNING",S[S.INFO=2]="INFO",S[S.DEBUG=3]="DEBUG",S[S.DATA=3]="DATA"})(h||(h={}));var o=function(){function S(){this.time=null,this.verboseLevel=h.ERROR}var x=S.prototype;return x.log=function(d,u){this.verboseLevel>=d&&$.logger.log(this.time+" ["+d+"] "+u)},S}(),f=function(x){for(var _=[],d=0;d<x.length;d++)_.push(x[d].toString(16));return _},l=function(){function S(_,d,u,g,E){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=_||"white",this.underline=d||!1,this.italics=u||!1,this.background=g||"black",this.flash=E||!1}var x=S.prototype;return x.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},x.setStyles=function(d){for(var u=["foreground","underline","italics","background","flash"],g=0;g<u.length;g++){var E=u[g];d.hasOwnProperty(E)&&(this[E]=d[E])}},x.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},x.equals=function(d){return this.foreground===d.foreground&&this.underline===d.underline&&this.italics===d.italics&&this.background===d.background&&this.flash===d.flash},x.copy=function(d){this.foreground=d.foreground,this.underline=d.underline,this.italics=d.italics,this.background=d.background,this.flash=d.flash},x.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},S}(),r=function(){function S(_,d,u,g,E,N){this.uchar=void 0,this.penState=void 0,this.uchar=_||" ",this.penState=new l(d,u,g,E,N)}var x=S.prototype;return x.reset=function(){this.uchar=" ",this.penState.reset()},x.setChar=function(d,u){this.uchar=d,this.penState.copy(u)},x.setPenState=function(d){this.penState.copy(d)},x.equals=function(d){return this.uchar===d.uchar&&this.penState.equals(d.penState)},x.copy=function(d){this.uchar=d.uchar,this.penState.copy(d.penState)},x.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},S}(),s=function(){function 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 d=0;d<G;d++)this.chars.push(new r);this.logger=_,this.pos=0,this.currPenState=new l}var x=S.prototype;return x.equals=function(d){for(var u=!0,g=0;g<G;g++)if(!this.chars[g].equals(d.chars[g])){u=!1;break}return u},x.copy=function(d){for(var u=0;u<G;u++)this.chars[u].copy(d.chars[u])},x.isEmpty=function(){for(var d=!0,u=0;u<G;u++)if(!this.chars[u].isEmpty()){d=!1;break}return d},x.setCursor=function(d){this.pos!==d&&(this.pos=d),this.pos<0?(this.logger.log(h.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>G&&(this.logger.log(h.DEBUG,"Too large cursor position "+this.pos),this.pos=G)},x.moveCursor=function(d){var u=this.pos+d;if(d>1)for(var g=this.pos+1;g<u+1;g++)this.chars[g].setPenState(this.currPenState);this.setCursor(u)},x.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},x.insertChar=function(d){d>=144&&this.backSpace();var u=U(d);if(this.pos>=G){this.logger.log(h.ERROR,"Cannot insert "+d.toString(16)+" ("+u+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(u,this.currPenState),this.moveCursor(1)},x.clearFromPos=function(d){var u;for(u=d;u<G;u++)this.chars[u].reset()},x.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},x.clearToEndOfRow=function(){this.clearFromPos(this.pos)},x.getTextString=function(){for(var d=[],u=!0,g=0;g<G;g++){var E=this.chars[g].uchar;E!==" "&&(u=!1),d.push(E)}return u?"":d.join("")},x.setPenStyles=function(d){this.currPenState.setStyles(d);var u=this.chars[this.pos];u.setPenState(this.currPenState)},S}(),c=function(){function 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 d=0;d<K;d++)this.rows.push(new s(_));this.logger=_,this.currRow=K-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var x=S.prototype;return x.reset=function(){for(var d=0;d<K;d++)this.rows[d].clear();this.currRow=K-1},x.equals=function(d){for(var u=!0,g=0;g<K;g++)if(!this.rows[g].equals(d.rows[g])){u=!1;break}return u},x.copy=function(d){for(var u=0;u<K;u++)this.rows[u].copy(d.rows[u])},x.isEmpty=function(){for(var d=!0,u=0;u<K;u++)if(!this.rows[u].isEmpty()){d=!1;break}return d},x.backSpace=function(){var d=this.rows[this.currRow];d.backSpace()},x.clearToEndOfRow=function(){var d=this.rows[this.currRow];d.clearToEndOfRow()},x.insertChar=function(d){var u=this.rows[this.currRow];u.insertChar(d)},x.setPen=function(d){var u=this.rows[this.currRow];u.setPenStyles(d)},x.moveCursor=function(d){var u=this.rows[this.currRow];u.moveCursor(d)},x.setCursor=function(d){this.logger.log(h.INFO,"setCursor: "+d);var u=this.rows[this.currRow];u.setCursor(d)},x.setPAC=function(d){this.logger.log(h.INFO,"pacData = "+JSON.stringify(d));var u=d.row-1;if(this.nrRollUpRows&&u<this.nrRollUpRows-1&&(u=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==u){for(var g=0;g<K;g++)this.rows[g].clear();var E=this.currRow+1-this.nrRollUpRows,N=this.lastOutputScreen;if(N){var D=N.rows[E].cueStartTime,H=this.logger.time;if(D&&H!==null&&D<H)for(var j=0;j<this.nrRollUpRows;j++)this.rows[u-this.nrRollUpRows+j+1].copy(N.rows[E+j])}}this.currRow=u;var I=this.rows[this.currRow];if(d.indent!==null){var b=d.indent,W=Math.max(b-1,0);I.setCursor(d.indent),d.color=I.chars[W].penState.foreground}var Y={foreground:d.color,underline:d.underline,italics:d.italics,background:"black",flash:!1};this.setPen(Y)},x.setBkgData=function(d){this.logger.log(h.INFO,"bkgData = "+JSON.stringify(d)),this.backSpace(),this.setPen(d),this.insertChar(32)},x.setRollUpRows=function(d){this.nrRollUpRows=d},x.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(h.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(h.TEXT,this.getDisplayText());var d=this.currRow+1-this.nrRollUpRows,u=this.rows.splice(d,1)[0];u.clear(),this.rows.splice(this.currRow,0,u),this.logger.log(h.INFO,"Rolling up")},x.getDisplayText=function(d){d=d||!1;for(var u=[],g="",E=-1,N=0;N<K;N++){var D=this.rows[N].getTextString();D&&(E=N+1,d?u.push("Row "+E+": '"+D+"'"):u.push(D.trim()))}return u.length>0&&(d?g="["+u.join(" | ")+"]":g=u.join(`
`)),g},x.getTextAndFormat=function(){return this.rows},S}(),L=function(){function S(_,d,u){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=_,this.outputFilter=d,this.mode=null,this.verbose=0,this.displayedMemory=new c(u),this.nonDisplayedMemory=new c(u),this.lastOutputScreen=new c(u),this.currRollUpRow=this.displayedMemory.rows[K-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=u}var x=S.prototype;return x.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[K-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},x.getHandler=function(){return this.outputFilter},x.setHandler=function(d){this.outputFilter=d},x.setPAC=function(d){this.writeScreen.setPAC(d)},x.setBkgData=function(d){this.writeScreen.setBkgData(d)},x.setMode=function(d){if(d===this.mode)return;this.mode=d,this.logger.log(h.INFO,"MODE="+d),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=d},x.insertChars=function(d){for(var u=0;u<d.length;u++)this.writeScreen.insertChar(d[u]);var g=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(h.INFO,g+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(h.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},x.ccRCL=function(){this.logger.log(h.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},x.ccBS=function(){if(this.logger.log(h.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},x.ccAOF=function(){},x.ccAON=function(){},x.ccDER=function(){this.logger.log(h.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},x.ccRU=function(d){this.logger.log(h.INFO,"RU("+d+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(d)},x.ccFON=function(){this.logger.log(h.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},x.ccRDC=function(){this.logger.log(h.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},x.ccTR=function(){this.logger.log(h.INFO,"TR"),this.setMode("MODE_TEXT")},x.ccRTD=function(){this.logger.log(h.INFO,"RTD"),this.setMode("MODE_TEXT")},x.ccEDM=function(){this.logger.log(h.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},x.ccCR=function(){this.logger.log(h.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},x.ccENM=function(){this.logger.log(h.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},x.ccEOC=function(){if(this.logger.log(h.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var d=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=d,this.writeScreen=this.nonDisplayedMemory,this.logger.log(h.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},x.ccTO=function(d){this.logger.log(h.INFO,"TO("+d+") - Tab Offset"),this.writeScreen.moveCursor(d)},x.ccMIDROW=function(d){var u={flash:!1};if(u.underline=d%2===1,u.italics=d>=46,u.italics)u.foreground="white";else{var g=Math.floor(d/2)-16,E=["white","green","blue","cyan","red","yellow","magenta"];u.foreground=E[g]}this.logger.log(h.INFO,"MIDROW: "+JSON.stringify(u)),this.writeScreen.setPen(u)},x.outputDataUpdate=function(d){d===void 0&&(d=!1);var u=this.logger.time;if(u===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=u:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,u,this.lastOutputScreen),d&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:u),this.lastOutputScreen.copy(this.displayedMemory))},x.cueSplitAtTime=function(d){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,d,this.displayedMemory),this.cueStartTime=d))},S}(),w=function(){function S(_,d,u){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var g=new o;this.channels=[null,new L(_,d,g),new L(_+1,u,g)],this.cmdHistory=C(),this.logger=g}var x=S.prototype;return x.getHandler=function(d){return this.channels[d].getHandler()},x.setHandler=function(d,u){this.channels[d].setHandler(u)},x.addData=function(d,u){var g,E,N,D=!1;this.logger.time=d;for(var H=0;H<u.length;H+=2){if(E=u[H]&127,N=u[H+1]&127,E===0&&N===0)continue;if(this.logger.log(h.DATA,"["+f([u[H],u[H+1]])+"] -> ("+f([E,N])+")"),g=this.parseCmd(E,N),g||(g=this.parseMidrow(E,N)),g||(g=this.parsePAC(E,N)),g||(g=this.parseBackgroundAttributes(E,N)),!g&&(D=this.parseChars(E,N),D)){var j=this.currentChannel;if(j&&j>0){var I=this.channels[j];I.insertChars(D)}else this.logger.log(h.WARNING,"No channel found yet. TEXT-MODE?")}!g&&!D&&this.logger.log(h.WARNING,"Couldn't parse cleaned data "+f([E,N])+" orig: "+f([u[H],u[H+1]]))}},x.parseCmd=function(d,u){var g=this.cmdHistory,E=(d===20||d===28||d===21||d===29)&&u>=32&&u<=47,N=(d===23||d===31)&&u>=33&&u<=35;if(!(E||N))return!1;if(R(d,u,g))return T(null,null,g),this.logger.log(h.DEBUG,"Repeated command ("+f([d,u])+") is dropped"),!0;var D=d===20||d===21||d===23?1:2,H=this.channels[D];return d===20||d===21||d===28||d===29?u===32?H.ccRCL():u===33?H.ccBS():u===34?H.ccAOF():u===35?H.ccAON():u===36?H.ccDER():u===37?H.ccRU(2):u===38?H.ccRU(3):u===39?H.ccRU(4):u===40?H.ccFON():u===41?H.ccRDC():u===42?H.ccTR():u===43?H.ccRTD():u===44?H.ccEDM():u===45?H.ccCR():u===46?H.ccENM():u===47&&H.ccEOC():H.ccTO(u-32),T(d,u,g),this.currentChannel=D,!0},x.parseMidrow=function(d,u){var g=0;if((d===17||d===25)&&u>=32&&u<=47){if(d===17?g=1:g=2,g!==this.currentChannel)return this.logger.log(h.ERROR,"Mismatch channel in midrow parsing"),!1;var E=this.channels[g];return E?(E.ccMIDROW(u),this.logger.log(h.DEBUG,"MIDROW ("+f([d,u])+")"),!0):!1}return!1},x.parsePAC=function(d,u){var g,E=this.cmdHistory,N=(d>=17&&d<=23||d>=25&&d<=31)&&u>=64&&u<=127,D=(d===16||d===24)&&u>=64&&u<=95;if(!(N||D))return!1;if(R(d,u,E))return T(null,null,E),!0;var H=d<=23?1:2;u>=64&&u<=95?g=H===1?M[d]:v[d]:g=H===1?O[d]:m[d];var j=this.channels[H];return j?(j.setPAC(this.interpretPAC(g,u)),T(d,u,E),this.currentChannel=H,!0):!1},x.interpretPAC=function(d,u){var g,E={color:null,italics:!1,indent:null,underline:!1,row:d};return u>95?g=u-96:g=u-64,E.underline=(g&1)===1,g<=13?E.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(g/2)]:g<=15?(E.italics=!0,E.color="white"):E.indent=Math.floor((g-16)/2)*4,E},x.parseChars=function(d,u){var g,E=null,N=null;if(d>=25?(g=2,N=d-8):(g=1,N=d),N>=17&&N<=19){var D;N===17?D=u+80:N===18?D=u+112:D=u+144,this.logger.log(h.INFO,"Special char '"+U(D)+"' in channel "+g),E=[D]}else d>=32&&d<=127&&(E=u===0?[d]:[d,u]);if(E){var H=f(E);this.logger.log(h.DEBUG,"Char codes = "+H.join(",")),T(d,u,this.cmdHistory)}return E},x.parseBackgroundAttributes=function(d,u){var g=(d===16||d===24)&&u>=32&&u<=47,E=(d===23||d===31)&&u>=45&&u<=47;if(!(g||E))return!1;var N,D={};d===16||d===24?(N=Math.floor((u-32)/2),D.background=p[N],u%2===1&&(D.background=D.background+"_semi")):u===45?D.background="transparent":(D.foreground="black",u===47&&(D.underline=!0));var H=d<=23?1:2,j=this.channels[H];return j.setBkgData(D),T(d,u,this.cmdHistory),!0},x.reset=function(){for(var d=0;d<Object.keys(this.channels).length;d++){var u=this.channels[d];u&&u.reset()}this.cmdHistory=C()},x.cueSplitAtTime=function(d){for(var u=0;u<this.channels.length;u++){var g=this.channels[u];g&&g.cueSplitAtTime(d)}},S}();function T(S,x,_){_.a=S,_.b=x}function R(S,x,_){return _.a===S&&_.b===x}function C(){return{a:null,b:null}}Z.default=w},"./src/utils/codecs.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"isCodecType",function(){return B}),P.d(Z,"isCodecSupportedInMp4",function(){return U});var $={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 B(K,G){var M=$[G];return!!M&&M[K.slice(0,4)]===!0}function U(K,G){return MediaSource.isTypeSupported((G||"video")+'/mp4;codecs="'+K+'"')}},"./src/utils/cues.ts":function(ue,Z,P){"use strict";P.r(Z);var $=P("./src/utils/vttparser.ts"),B=P("./src/utils/webvtt-parser.ts"),U=P("./src/utils/texttrack-utils.ts"),K=/\s/,G={newCue:function(O,v,m,p){for(var h=[],o,f,l,r,s,c=self.VTTCue||self.TextTrackCue,L=0;L<p.rows.length;L++)if(o=p.rows[L],l=!0,r=0,s="",!o.isEmpty()){for(var w=0;w<o.chars.length;w++)K.test(o.chars[w].uchar)&&l?r++:(s+=o.chars[w].uchar,l=!1);o.cueStartTime=v,v===m&&(m+=1e-4),r>=16?r--:r++;var T=Object($.fixLineBreaks)(s.trim()),R=Object(B.generateCueId)(v,m,T);(!O||!O.cues||!O.cues.getCueById(R))&&(f=new c(v,m,T),f.id=R,f.line=L+1,f.align="left",f.position=10+Math.min(80,Math.floor(r*8/32)*10),h.push(f))}return O&&h.length&&(h.sort(function(C,S){return C.line==="auto"||S.line==="auto"?0:C.line>8&&S.line>8?S.line-C.line:C.line-S.line}),h.forEach(function(C){return Object(U.addCueToTrack)(O,C)})),h}};Z.default=G},"./src/utils/discontinuities.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"findFirstFragWithCC",function(){return K}),P.d(Z,"shouldAlignOnDiscontinuities",function(){return G}),P.d(Z,"findDiscontinuousReferenceFrag",function(){return M}),P.d(Z,"adjustSlidingStart",function(){return v}),P.d(Z,"alignStream",function(){return m}),P.d(Z,"alignPDT",function(){return h}),P.d(Z,"alignFragmentByPDTDelta",function(){return o}),P.d(Z,"alignMediaPlaylistByPDT",function(){return f});var $=P("./src/polyfills/number.ts"),B=P("./src/utils/logger.ts"),U=P("./src/controller/level-helper.ts");function K(l,r){for(var s=null,c=0,L=l.length;c<L;c++){var w=l[c];if(w&&w.cc===r){s=w;break}}return s}function G(l,r,s){return!!(r.details&&(s.endCC>s.startCC||l&&l.cc<s.startCC))}function M(l,r){var s=l.fragments,c=r.fragments;if(!c.length||!s.length){B.logger.log("No fragments to align");return}var L=K(s,c[0].cc);if(!L||L&&!L.startPTS){B.logger.log("No frag in previous level to align on");return}return L}function O(l,r){if(l){var s=l.start+r;l.start=l.startPTS=s,l.endPTS=s+l.duration}}function v(l,r){for(var s=r.fragments,c=0,L=s.length;c<L;c++)O(s[c],l);r.fragmentHint&&O(r.fragmentHint,l),r.alignedSliding=!0}function m(l,r,s){if(!r)return;p(l,s,r),!s.alignedSliding&&r.details&&h(s,r.details),!s.alignedSliding&&r.details&&!s.skippedSegments&&Object(U.adjustSliding)(r.details,s)}function p(l,r,s){if(G(l,s,r)){var c=M(s.details,r);c&&Object($.isFiniteNumber)(c.start)&&(B.logger.log("Adjusting PTS using last level due to CC increase within current level "+r.url),v(c.start,r))}}function h(l,r){if(!r.fragments.length||!l.hasProgramDateTime||!r.hasProgramDateTime)return;var s=r.fragments[0].programDateTime,c=l.fragments[0].programDateTime,L=(c-s)/1e3+r.fragments[0].start;L&&Object($.isFiniteNumber)(L)&&(B.logger.log("Adjusting PTS using programDateTime delta "+(c-s)+"ms, sliding:"+L.toFixed(3)+" "+l.url+" "),v(L,l))}function o(l,r){var s=l.programDateTime;if(!s)return;var c=(s-r)/1e3;l.start=l.startPTS=c,l.endPTS=c+l.duration}function f(l,r){if(!r.fragments.length||!l.hasProgramDateTime||!r.hasProgramDateTime)return;var s=r.fragments[0].programDateTime,c=r.fragments[0].start,L=s-c*1e3;l.fragments.forEach(function(w){o(w,L)}),l.fragmentHint&&o(l.fragmentHint,L),l.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ue,Z,P){"use strict";P.r(Z);var $=P("./src/utils/ewma.ts"),B=function(){function U(G,M,O){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=O,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new $.default(G),this.fast_=new $.default(M)}var K=U.prototype;return K.update=function(M,O){var v=this.slow_,m=this.fast_;this.slow_.halfLife!==M&&(this.slow_=new $.default(M,v.getEstimate(),v.getTotalWeight())),this.fast_.halfLife!==O&&(this.fast_=new $.default(O,m.getEstimate(),m.getTotalWeight()))},K.sample=function(M,O){M=Math.max(M,this.minDelayMs_);var v=8*O,m=M/1e3,p=v/m;this.fast_.sample(m,p),this.slow_.sample(m,p)},K.canEstimate=function(){var M=this.fast_;return M&&M.getTotalWeight()>=this.minWeight_},K.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},K.destroy=function(){},U}();Z.default=B},"./src/utils/ewma.ts":function(ue,Z,P){"use strict";P.r(Z);var $=function(){function B(K,G,M){G===void 0&&(G=0),M===void 0&&(M=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=K,this.alpha_=K?Math.exp(Math.log(.5)/K):0,this.estimate_=G,this.totalWeight_=M}var U=B.prototype;return U.sample=function(G,M){var O=Math.pow(this.alpha_,G);this.estimate_=M*(1-O)+O*this.estimate_,this.totalWeight_+=G},U.getTotalWeight=function(){return this.totalWeight_},U.getEstimate=function(){if(this.alpha_){var G=1-Math.pow(this.alpha_,this.totalWeight_);if(G)return this.estimate_/G}return this.estimate_},B}();Z.default=$},"./src/utils/fetch-loader.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"fetchSupported",function(){return o});var $=P("./src/polyfills/number.ts"),B=P("./src/loader/load-stats.ts"),U=P("./src/demux/chunk-cache.ts");function K(c,L){c.prototype=Object.create(L.prototype),c.prototype.constructor=c,m(c,L)}function G(c){var L=typeof Map=="function"?new Map:void 0;return G=function(T){if(T===null||!v(T))return T;if(typeof T!="function")throw new TypeError("Super expression must either be null or a function");if(typeof L!="undefined"){if(L.has(T))return L.get(T);L.set(T,R)}function R(){return M(T,arguments,p(this).constructor)}return R.prototype=Object.create(T.prototype,{constructor:{value:R,enumerable:!1,writable:!0,configurable:!0}}),m(R,T)},G(c)}function M(c,L,w){return O()?M=Reflect.construct:M=function(R,C,S){var x=[null];x.push.apply(x,C);var _=Function.bind.apply(R,x),d=new _;return S&&m(d,S.prototype),d},M.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 v(c){return Function.toString.call(c).indexOf("[native code]")!==-1}function m(c,L){return m=Object.setPrototypeOf||function(T,R){return T.__proto__=R,T},m(c,L)}function p(c){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(w){return w.__proto__||Object.getPrototypeOf(w)},p(c)}function h(){return h=Object.assign||function(c){for(var L=1;L<arguments.length;L++){var w=arguments[L];for(var T in w)Object.prototype.hasOwnProperty.call(w,T)&&(c[T]=w[T])}return c},h.apply(this,arguments)}function o(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(c){}return!1}var f=function(){function c(w){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=w.fetchSetup||r,this.controller=new self.AbortController,this.stats=new B.LoadStats}var L=c.prototype;return L.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},L.abortInternal=function(){var T=this.response;(!T||!T.ok)&&(this.stats.aborted=!0,this.controller.abort())},L.abort=function(){var T;this.abortInternal(),(T=this.callbacks)!==null&&T!==void 0&&T.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},L.load=function(T,R,C){var S=this,x=this.stats;if(x.loading.start)throw new Error("Loader can only be used once.");x.loading.start=self.performance.now();var _=l(T,this.controller.signal),d=C.onProgress,u=T.responseType==="arraybuffer",g=u?"byteLength":"length";this.context=T,this.config=R,this.callbacks=C,this.request=this.fetchSetup(T,_),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){S.abortInternal(),C.onTimeout(x,T,S.response)},R.timeout),self.fetch(this.request).then(function(E){if(S.response=S.loader=E,!E.ok){var N=E.status,D=E.statusText;throw new s(D||"fetch, bad network response",N,E)}return x.loading.first=Math.max(self.performance.now(),x.loading.start),x.total=parseInt(E.headers.get("Content-Length")||"0"),d&&Object($.isFiniteNumber)(R.highWaterMark)?S.loadProgressively(E,x,T,R.highWaterMark,d):u?E.arrayBuffer():E.text()}).then(function(E){var N=S.response;self.clearTimeout(S.requestTimeout),x.loading.end=Math.max(self.performance.now(),x.loading.first),x.loaded=x.total=E[g];var D={url:N.url,data:E};d&&!Object($.isFiniteNumber)(R.highWaterMark)&&d(x,T,E,N),C.onSuccess(D,x,T,N)}).catch(function(E){if(self.clearTimeout(S.requestTimeout),x.aborted)return;var N=E.code||0;C.onError({code:N,text:E.message},T,E.details)})},L.getCacheAge=function(){var T=null;if(this.response){var R=this.response.headers.get("age");T=R?parseFloat(R):null}return T},L.loadProgressively=function(T,R,C,S,x){S===void 0&&(S=0);var _=new U.default,d=T.body.getReader(),u=function g(){return d.read().then(function(E){if(E.done)return _.dataLength&&x(R,C,_.flush(),T),Promise.resolve(new ArrayBuffer(0));var N=E.value,D=N.length;return R.loaded+=D,D<S||_.dataLength?(_.push(N),_.dataLength>=S&&x(R,C,_.flush(),T)):x(R,C,N,T),g()}).catch(function(){return Promise.reject()})};return u()},c}();function l(c,L){var w={method:"GET",mode:"cors",credentials:"same-origin",signal:L,headers:new self.Headers(h({},c.headers))};return c.rangeEnd&&w.headers.set("Range","bytes="+c.rangeStart+"-"+String(c.rangeEnd-1)),w}function r(c,L){return new self.Request(c.url,L)}var s=function(c){K(L,c);function L(w,T,R){var C;return C=c.call(this,w)||this,C.code=void 0,C.details=void 0,C.code=T,C.details=R,C}return L}(G(Error));Z.default=f},"./src/utils/imsc1-ttml-parser.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"IMSC1_CODEC",function(){return v}),P.d(Z,"parseIMSC1",function(){return o});var $=P("./src/utils/mp4-tools.ts"),B=P("./src/utils/vttparser.ts"),U=P("./src/utils/vttcue.ts"),K=P("./src/demux/id3.ts"),G=P("./src/utils/timescale-conversion.ts"),M=P("./src/utils/webvtt-parser.ts");function O(){return O=Object.assign||function(S){for(var x=1;x<arguments.length;x++){var _=arguments[x];for(var d in _)Object.prototype.hasOwnProperty.call(_,d)&&(S[d]=_[d])}return S},O.apply(this,arguments)}var v="stpp.ttml.im1t",m=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,p=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,h={left:"start",center:"center",right:"end",start:"start",end:"end"};function o(S,x,_,d,u){var g=Object($.findBox)(new Uint8Array(S),["mdat"]);if(g.length===0){u(new Error("Could not parse IMSC1 mdat"));return}var E=g[0],N=Object(K.utf8ArrayToStr)(new Uint8Array(S,E.start,E.end-E.start)),D=Object(G.toTimescaleFromScale)(x,1,_);try{d(f(N,D))}catch(H){u(H)}}function f(S,x){var _=new DOMParser,d=_.parseFromString(S,"text/xml"),u=d.getElementsByTagName("tt")[0];if(!u)throw new Error("Invalid ttml");var g={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},E=Object.keys(g).reduce(function(I,b){return I[b]=u.getAttribute("ttp:"+b)||g[b],I},{}),N=u.getAttribute("xml:space")!=="preserve",D=r(l(u,"styling","style")),H=r(l(u,"layout","region")),j=l(u,"body","[begin]");return[].map.call(j,function(I){var b=s(I,N);if(!b||!I.hasAttribute("begin"))return null;var W=T(I.getAttribute("begin"),E),Y=T(I.getAttribute("dur"),E),ie=T(I.getAttribute("end"),E);if(W===null)throw w(I);if(ie===null){if(Y===null)throw w(I);ie=W+Y}var oe=new U.default(W-x,ie-x,b);oe.id=Object(M.generateCueId)(oe.startTime,oe.endTime,oe.text);var xe=H[I.getAttribute("region")],ve=D[I.getAttribute("style")];oe.position=10,oe.size=80;var we=c(xe,ve),Ce=we.textAlign;if(Ce){var Se=h[Ce];Se&&(oe.lineAlign=Se),oe.align=Ce}return O(oe,we),oe}).filter(function(I){return I!==null})}function l(S,x,_){var d=S.getElementsByTagName(x)[0];return d?[].slice.call(d.querySelectorAll(_)):[]}function r(S){return S.reduce(function(x,_){var d=_.getAttribute("xml:id");return d&&(x[d]=_),x},{})}function s(S,x){return[].slice.call(S.childNodes).reduce(function(_,d,u){var g;return d.nodeName==="br"&&u?_+`
`:(g=d.childNodes)!==null&&g!==void 0&&g.length?s(d,x):x?_+d.textContent.trim().replace(/\s+/g," "):_+d.textContent},"")}function c(S,x){var _="http://www.w3.org/ns/ttml#styling",d=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return d.reduce(function(u,g){var E=L(x,_,g)||L(S,_,g);return E&&(u[g]=E),u},{})}function L(S,x,_){return S.hasAttributeNS(x,_)?S.getAttributeNS(x,_):null}function w(S){return new Error("Could not parse ttml timestamp "+S)}function T(S,x){if(!S)return null;var _=Object(B.parseTimeStamp)(S);return _===null&&(m.test(S)?_=R(S,x):p.test(S)&&(_=C(S,x))),_}function R(S,x){var _=m.exec(S),d=(_[4]|0)+(_[5]|0)/x.subFrameRate;return(_[1]|0)*3600+(_[2]|0)*60+(_[3]|0)+d/x.frameRate}function C(S,x){var _=p.exec(S),d=Number(_[1]),u=_[2];switch(u){case"h":return d*3600;case"m":return d*60;case"ms":return d*1e3;case"f":return d/x.frameRate;case"t":return d/x.tickRate}return d}},"./src/utils/logger.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"enableLogs",function(){return M}),P.d(Z,"logger",function(){return O});var $=function(){},B={trace:$,debug:$,log:$,warn:$,info:$,error:$},U=B;function K(v){var m=self.console[v];return m?m.bind(self.console,"["+v+"] >"):$}function G(v){for(var m=arguments.length,p=new Array(m>1?m-1:0),h=1;h<m;h++)p[h-1]=arguments[h];p.forEach(function(o){U[o]=v[o]?v[o].bind(v):K(o)})}function M(v){if(self.console&&v===!0||typeof v=="object"){G(v,"debug","log","info","warn","error");try{U.log()}catch(m){U=B}}else U=B}var O=U},"./src/utils/mediakeys-helper.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"KeySystems",function(){return $}),P.d(Z,"requestMediaKeySystemAccess",function(){return B});var $;(function(U){U.WIDEVINE="com.widevine.alpha",U.PLAYREADY="com.microsoft.playready"})($||($={}));var B=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"getMediaSource",function(){return $});function $(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"bin2str",function(){return G}),P.d(Z,"readUint16",function(){return M}),P.d(Z,"readUint32",function(){return O}),P.d(Z,"writeUint32",function(){return v}),P.d(Z,"findBox",function(){return m}),P.d(Z,"parseSegmentIndex",function(){return p}),P.d(Z,"parseInitSegment",function(){return h}),P.d(Z,"getStartDTS",function(){return o}),P.d(Z,"getDuration",function(){return f}),P.d(Z,"computeRawDurationFromSamples",function(){return l}),P.d(Z,"offsetStartDTS",function(){return r}),P.d(Z,"segmentValidRange",function(){return s}),P.d(Z,"appendUint8Array",function(){return c});var $=P("./src/utils/typed-array.ts"),B=P("./src/loader/fragment.ts"),U=Math.pow(2,32)-1,K=[].push;function G(L){return String.fromCharCode.apply(null,L)}function M(L,w){"data"in L&&(w+=L.start,L=L.data);var T=L[w]<<8|L[w+1];return T<0?65536+T:T}function O(L,w){"data"in L&&(w+=L.start,L=L.data);var T=L[w]<<24|L[w+1]<<16|L[w+2]<<8|L[w+3];return T<0?4294967296+T:T}function v(L,w,T){"data"in L&&(w+=L.start,L=L.data),L[w]=T>>24,L[w+1]=T>>16&255,L[w+2]=T>>8&255,L[w+3]=T&255}function m(L,w){var T=[];if(!w.length)return T;var R,C,S;"data"in L?(R=L.data,C=L.start,S=L.end):(R=L,C=0,S=R.byteLength);for(var x=C;x<S;){var _=O(R,x),d=G(R.subarray(x+4,x+8)),u=_>1?x+_:S;if(d===w[0])if(w.length===1)T.push({data:R,start:x+8,end:u});else{var g=m({data:R,start:x+8,end:u},w.slice(1));g.length&&K.apply(T,g)}x=u}return T}function p(L){var w=m(L,["moov"]),T=w[0],R=T?T.end:null,C=m(L,["sidx"]);if(!C||!C[0])return null;var S=[],x=C[0],_=x.data[0],d=_===0?8:16,u=O(x,d);d+=4;var g=0,E=0;_===0?d+=8:d+=16,d+=2;var N=x.end+E,D=M(x,d);d+=2;for(var H=0;H<D;H++){var j=d,I=O(x,j);j+=4;var b=I&2147483647,W=(I&2147483648)>>>31;if(W===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Y=O(x,j);j+=4,S.push({referenceSize:b,subsegmentDuration:Y,info:{duration:Y/u,start:N,end:N+b-1}}),N+=b,j+=4,d=j}return{earliestPresentationTime:g,timescale:u,version:_,referencesCount:D,references:S,moovEndOffset:R}}function h(L){for(var w=[],T=m(L,["moov","trak"]),R=0;R<T.length;R++){var C=T[R],S=m(C,["tkhd"])[0];if(S){var x=S.data[S.start],_=x===0?12:20,d=O(S,_),u=m(C,["mdia","mdhd"])[0];if(u){x=u.data[u.start],_=x===0?12:20;var g=O(u,_),E=m(C,["mdia","hdlr"])[0];if(E){var N=G(E.data.subarray(E.start+8,E.start+12)),D={soun:B.ElementaryStreamTypes.AUDIO,vide:B.ElementaryStreamTypes.VIDEO}[N];if(D){var H=m(C,["mdia","minf","stbl","stsd"])[0],j=void 0;H&&(j=G(H.data.subarray(H.start+12,H.start+16))),w[d]={timescale:g,type:D},w[D]={timescale:g,id:d,codec:j}}}}}}var I=m(L,["moov","mvex","trex"]);return I.forEach(function(b){var W=O(b,4),Y=w[W];Y&&(Y.default={duration:O(b,12),flags:O(b,20)})}),w}function o(L,w){return m(w,["moof","traf"]).reduce(function(T,R){var C=m(R,["tfdt"])[0],S=C.data[C.start],x=m(R,["tfhd"]).reduce(function(_,d){var u=O(d,4),g=L[u];if(g){var E=O(C,4);S===1&&(E*=Math.pow(2,32),E+=O(C,8));var N=g.timescale||9e4,D=E/N;if(isFinite(D)&&(_===null||D<_))return D}return _},null);return x!==null&&isFinite(x)&&(T===null||x<T)?x:T},null)||0}function f(L,w){for(var T=0,R=0,C=0,S=m(L,["moof","traf"]),x=0;x<S.length;x++){var _=S[x],d=m(_,["tfhd"])[0],u=O(d,4),g=w[u];if(!g)continue;var E=g.default,N=O(d,0)|(E==null?void 0:E.flags),D=E==null?void 0:E.duration;N&8&&(N&2?D=O(d,12):D=O(d,8));for(var H=g.timescale||9e4,j=m(_,["trun"]),I=0;I<j.length;I++){if(D){var b=O(j[I],4);T=D*b}else T=l(j[I]);g.type===B.ElementaryStreamTypes.VIDEO?R+=T/H:g.type===B.ElementaryStreamTypes.AUDIO&&(C+=T/H)}}if(R===0&&C===0){var W=p(L);if(W!=null&&W.references)return W.references.reduce(function(Y,ie){return Y+ie.info.duration||0},0)}return R||C}function l(L){var w=O(L,0),T=8;w&1&&(T+=4),w&4&&(T+=4);for(var R=0,C=O(L,4),S=0;S<C;S++){if(w&256){var x=O(L,T);R+=x,T+=4}w&512&&(T+=4),w&1024&&(T+=4),w&2048&&(T+=4)}return R}function r(L,w,T){m(w,["moof","traf"]).forEach(function(R){m(R,["tfhd"]).forEach(function(C){var S=O(C,4),x=L[S];if(!x)return;var _=x.timescale||9e4;m(R,["tfdt"]).forEach(function(d){var u=d.data[d.start],g=O(d,4);if(u===0)v(d,4,g-T*_);else{g*=Math.pow(2,32),g+=O(d,8),g-=T*_,g=Math.max(g,0);var E=Math.floor(g/(U+1)),N=Math.floor(g%(U+1));v(d,4,E),v(d,8,N)}})})})}function s(L){var w={valid:null,remainder:null},T=m(L,["moof"]);if(T){if(T.length<2)return w.remainder=L,w}else return w;var R=T[T.length-1];return w.valid=Object($.sliceUint8)(L,0,R.start-8),w.remainder=Object($.sliceUint8)(L,R.start-8),w}function c(L,w){var T=new Uint8Array(L.length+w.length);return T.set(L),T.set(w,L.length),T}},"./src/utils/output-filter.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return $});var $=function(){function B(K,G){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=K,this.trackName=G}var U=B.prototype;return U.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},U.newCue=function(G,M,O){(this.startTime===null||this.startTime>G)&&(this.startTime=G),this.endTime=M,this.screen=O,this.timelineController.createCaptionsTrack(this.trackName)},U.reset=function(){this.cueRanges=[]},B}()},"./src/utils/texttrack-utils.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"sendAddTrackEvent",function(){return B}),P.d(Z,"addCueToTrack",function(){return U}),P.d(Z,"clearCurrentCues",function(){return K}),P.d(Z,"removeCuesInRange",function(){return G}),P.d(Z,"getCuesInRange",function(){return O});var $=P("./src/utils/logger.ts");function B(v,m){var p;try{p=new Event("addtrack")}catch(h){p=document.createEvent("Event"),p.initEvent("addtrack",!1,!1)}p.track=v,m.dispatchEvent(p)}function U(v,m){var p=v.mode;if(p==="disabled"&&(v.mode="hidden"),v.cues&&!v.cues.getCueById(m.id))try{if(v.addCue(m),!v.cues.getCueById(m.id))throw new Error("addCue is failed for: "+m)}catch(o){$.logger.debug("[texttrack-utils]: "+o);var h=new self.TextTrackCue(m.startTime,m.endTime,m.text);h.id=m.id,v.addCue(h)}p==="disabled"&&(v.mode=p)}function K(v){var m=v.mode;if(m==="disabled"&&(v.mode="hidden"),v.cues)for(var p=v.cues.length;p--;)v.removeCue(v.cues[p]);m==="disabled"&&(v.mode=m)}function G(v,m,p){var h=v.mode;if(h==="disabled"&&(v.mode="hidden"),v.cues&&v.cues.length>0)for(var o=O(v.cues,m,p),f=0;f<o.length;f++)v.removeCue(o[f]);h==="disabled"&&(v.mode=h)}function M(v,m){if(m<v[0].startTime)return 0;var p=v.length-1;if(m>v[p].endTime)return-1;for(var h=0,o=p;h<=o;){var f=Math.floor((o+h)/2);if(m<v[f].startTime)o=f-1;else if(m>v[f].startTime&&h<p)h=f+1;else return f}return v[h].startTime-m<m-v[o].startTime?h:o}function O(v,m,p){var h=[],o=M(v,m);if(o>-1)for(var f=o,l=v.length;f<l;f++){var r=v[f];if(r.startTime>=m&&r.endTime<=p)h.push(r);else if(r.startTime>p)return h}return h}},"./src/utils/time-ranges.ts":function(ue,Z,P){"use strict";P.r(Z);var $={toString:function(U){for(var K="",G=U.length,M=0;M<G;M++)K+="["+U.start(M).toFixed(3)+","+U.end(M).toFixed(3)+"]";return K}};Z.default=$},"./src/utils/timescale-conversion.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"toTimescaleFromBase",function(){return B}),P.d(Z,"toTimescaleFromScale",function(){return U}),P.d(Z,"toMsFromMpegTsClock",function(){return K}),P.d(Z,"toMpegTsClockFromTimescale",function(){return G});var $=9e4;function B(M,O,v,m){v===void 0&&(v=1),m===void 0&&(m=!1);var p=M*O*v;return m?Math.round(p):p}function U(M,O,v,m){return v===void 0&&(v=1),m===void 0&&(m=!1),B(M,O,1/v,m)}function K(M,O){return O===void 0&&(O=!1),B(M,1e3,1/$,O)}function G(M,O){return O===void 0&&(O=1),B(M,$,1/O)}},"./src/utils/typed-array.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"sliceUint8",function(){return $});function $(B,U,K){return Uint8Array.prototype.slice?B.slice(U,K):new Uint8Array(Array.prototype.slice.call(B,U,K))}},"./src/utils/vttcue.ts":function(ue,Z,P){"use strict";P.r(Z),Z.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var $=["","lr","rl"],B=["start","middle","end","left","right"];function U(v,m){if(typeof m!="string")return!1;if(!Array.isArray(v))return!1;var p=m.toLowerCase();return~v.indexOf(p)?p:!1}function K(v){return U($,v)}function G(v){return U(B,v)}function M(v){for(var m=arguments.length,p=new Array(m>1?m-1:0),h=1;h<m;h++)p[h-1]=arguments[h];for(var o=1;o<arguments.length;o++){var f=arguments[o];for(var l in f)v[l]=f[l]}return v}function O(v,m,p){var h=this,o={enumerable:!0};h.hasBeenReset=!1;var f="",l=!1,r=v,s=m,c=p,L=null,w="",T=!0,R="auto",C="start",S=50,x="middle",_=50,d="middle";Object.defineProperty(h,"id",M({},o,{get:function(){return f},set:function(g){f=""+g}})),Object.defineProperty(h,"pauseOnExit",M({},o,{get:function(){return l},set:function(g){l=!!g}})),Object.defineProperty(h,"startTime",M({},o,{get:function(){return r},set:function(g){if(typeof g!="number")throw new TypeError("Start time must be set to a number.");r=g,this.hasBeenReset=!0}})),Object.defineProperty(h,"endTime",M({},o,{get:function(){return s},set:function(g){if(typeof g!="number")throw new TypeError("End time must be set to a number.");s=g,this.hasBeenReset=!0}})),Object.defineProperty(h,"text",M({},o,{get:function(){return c},set:function(g){c=""+g,this.hasBeenReset=!0}})),Object.defineProperty(h,"region",M({},o,{get:function(){return L},set:function(g){L=g,this.hasBeenReset=!0}})),Object.defineProperty(h,"vertical",M({},o,{get:function(){return w},set:function(g){var E=K(g);if(E===!1)throw new SyntaxError("An invalid or illegal string was specified.");w=E,this.hasBeenReset=!0}})),Object.defineProperty(h,"snapToLines",M({},o,{get:function(){return T},set:function(g){T=!!g,this.hasBeenReset=!0}})),Object.defineProperty(h,"line",M({},o,{get:function(){return R},set:function(g){if(typeof g!="number"&&g!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");R=g,this.hasBeenReset=!0}})),Object.defineProperty(h,"lineAlign",M({},o,{get:function(){return C},set:function(g){var E=G(g);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");C=E,this.hasBeenReset=!0}})),Object.defineProperty(h,"position",M({},o,{get:function(){return S},set:function(g){if(g<0||g>100)throw new Error("Position must be between 0 and 100.");S=g,this.hasBeenReset=!0}})),Object.defineProperty(h,"positionAlign",M({},o,{get:function(){return x},set:function(g){var E=G(g);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");x=E,this.hasBeenReset=!0}})),Object.defineProperty(h,"size",M({},o,{get:function(){return _},set:function(g){if(g<0||g>100)throw new Error("Size must be between 0 and 100.");_=g,this.hasBeenReset=!0}})),Object.defineProperty(h,"align",M({},o,{get:function(){return d},set:function(g){var E=G(g);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");d=E,this.hasBeenReset=!0}})),h.displayState=void 0}return O.prototype.getCueAsHTML=function(){var v=self.WebVTT;return v.convertCueToDOMTree(self,this.text)},O}()},"./src/utils/vttparser.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"parseTimeStamp",function(){return U}),P.d(Z,"fixLineBreaks",function(){return m}),P.d(Z,"VTTParser",function(){return p});var $=P("./src/utils/vttcue.ts"),B=function(){function h(){}var o=h.prototype;return o.decode=function(l,r){if(!l)return"";if(typeof l!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(l))},h}();function U(h){function o(l,r,s,c){return(l|0)*3600+(r|0)*60+(s|0)+parseFloat(c||0)}var f=h.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return f?parseFloat(f[2])>59?o(f[2],f[3],0,f[4]):o(f[1],f[2],f[3],f[4]):null}var K=function(){function h(){this.values=Object.create(null)}var o=h.prototype;return o.set=function(l,r){!this.get(l)&&r!==""&&(this.values[l]=r)},o.get=function(l,r,s){return s?this.has(l)?this.values[l]:r[s]:this.has(l)?this.values[l]:r},o.has=function(l){return l in this.values},o.alt=function(l,r,s){for(var c=0;c<s.length;++c)if(r===s[c]){this.set(l,r);break}},o.integer=function(l,r){/^-?\d+$/.test(r)&&this.set(l,parseInt(r,10))},o.percent=function(l,r){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(r)){var s=parseFloat(r);if(s>=0&&s<=100)return this.set(l,s),!0}return!1},h}();function G(h,o,f,l){var r=l?h.split(l):[h];for(var s in r){if(typeof r[s]!="string")continue;var c=r[s].split(f);if(c.length!==2)continue;var L=c[0],w=c[1];o(L,w)}}var M=new $.default(0,0,""),O=M.align==="middle"?"middle":"center";function v(h,o,f){var l=h;function r(){var L=U(h);if(L===null)throw new Error("Malformed timestamp: "+l);return h=h.replace(/^[^\sa-zA-Z-]+/,""),L}function s(L,w){var T=new K;G(L,function(S,x){var _;switch(S){case"region":for(var d=f.length-1;d>=0;d--)if(f[d].id===x){T.set(S,f[d].region);break}break;case"vertical":T.alt(S,x,["rl","lr"]);break;case"line":_=x.split(","),T.integer(S,_[0]),T.percent(S,_[0])&&T.set("snapToLines",!1),T.alt(S,_[0],["auto"]),_.length===2&&T.alt("lineAlign",_[1],["start",O,"end"]);break;case"position":_=x.split(","),T.percent(S,_[0]),_.length===2&&T.alt("positionAlign",_[1],["start",O,"end","line-left","line-right","auto"]);break;case"size":T.percent(S,x);break;case"align":T.alt(S,x,["start",O,"end","left","right"]);break}},/:/,/\s/),w.region=T.get("region",null),w.vertical=T.get("vertical","");var R=T.get("line","auto");R==="auto"&&M.line===-1&&(R=-1),w.line=R,w.lineAlign=T.get("lineAlign","start"),w.snapToLines=T.get("snapToLines",!0),w.size=T.get("size",100),w.align=T.get("align",O);var C=T.get("position","auto");C==="auto"&&M.position===50&&(C=w.align==="start"||w.align==="left"?0:w.align==="end"||w.align==="right"?100:50),w.position=C}function c(){h=h.replace(/^\s+/,"")}if(c(),o.startTime=r(),c(),h.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+l);h=h.substr(3),c(),o.endTime=r(),c(),s(h,o)}function m(h){return h.replace(/<br(?: \/)?>/gi,`
`)}var p=function(){function h(){this.state="INITIAL",this.buffer="",this.decoder=new B,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var o=h.prototype;return o.parse=function(l){var r=this;l&&(r.buffer+=r.decoder.decode(l,{stream:!0}));function s(){var C=r.buffer,S=0;for(C=m(C);S<C.length&&C[S]!=="\r"&&C[S]!==`
`;)++S;var x=C.substr(0,S);return C[S]==="\r"&&++S,C[S]===`
`&&++S,r.buffer=C.substr(S),x}function c(C){G(C,function(S,x){},/:/)}try{var L="";if(r.state==="INITIAL"){if(!/\r\n|\n/.test(r.buffer))return this;L=s();var w=L.match(/^()?WEBVTT([ \t].*)?$/);if(!w||!w[0])throw new Error("Malformed WebVTT signature.");r.state="HEADER"}for(var T=!1;r.buffer;){if(!/\r\n|\n/.test(r.buffer))return this;T?T=!1:L=s();switch(r.state){case"HEADER":/:/.test(L)?c(L):L||(r.state="ID");continue;case"NOTE":L||(r.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(L)){r.state="NOTE";break}if(!L)continue;if(r.cue=new $.default(0,0,""),r.state="CUE",L.indexOf("-->")===-1){r.cue.id=L;continue}case"CUE":if(!r.cue){r.state="BADCUE";continue}try{v(L,r.cue,r.regionList)}catch(C){r.cue=null,r.state="BADCUE";continue}r.state="CUETEXT";continue;case"CUETEXT":{var R=L.indexOf("-->")!==-1;if(!L||R&&(T=!0)){r.oncue&&r.cue&&r.oncue(r.cue),r.cue=null,r.state="ID";continue}if(r.cue===null)continue;r.cue.text&&(r.cue.text+=`
`),r.cue.text+=L}continue;case"BADCUE":L||(r.state="ID")}}}catch(C){r.state==="CUETEXT"&&r.cue&&r.oncue&&r.oncue(r.cue),r.cue=null,r.state=r.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},o.flush=function(){var l=this;try{if((l.cue||l.state==="HEADER")&&(l.buffer+=`
`,l.parse()),l.state==="INITIAL"||l.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(r){l.onparsingerror&&l.onparsingerror(r)}return l.onflush&&l.onflush(),this},h}()},"./src/utils/webvtt-parser.ts":function(ue,Z,P){"use strict";P.r(Z),P.d(Z,"generateCueId",function(){return p}),P.d(Z,"parseWebVTT",function(){return o});var $=P("./src/polyfills/number.ts"),B=P("./src/utils/vttparser.ts"),U=P("./src/demux/id3.ts"),K=P("./src/utils/timescale-conversion.ts"),G=P("./src/remux/mp4-remuxer.ts"),M=/\r\n|\n\r|\n|\r/g,O=function(l,r,s){return s===void 0&&(s=0),l.substr(s,r.length)===r},v=function(l){var r=parseInt(l.substr(-3)),s=parseInt(l.substr(-6,2)),c=parseInt(l.substr(-9,2)),L=l.length>9?parseInt(l.substr(0,l.indexOf(":"))):0;if(!Object($.isFiniteNumber)(r)||!Object($.isFiniteNumber)(s)||!Object($.isFiniteNumber)(c)||!Object($.isFiniteNumber)(L))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+l);return r+=1e3*s,r+=60*1e3*c,r+=60*60*1e3*L,r},m=function(l){for(var r=5381,s=l.length;s;)r=r*33^l.charCodeAt(--s);return(r>>>0).toString()};function p(f,l,r){return m(f.toString())+m(l.toString())+m(r)}var h=function(l,r,s){var c=l[r],L=l[c.prevCC];if(!L||!L.new&&c.new){l.ccOffset=l.presentationOffset=c.start,c.new=!1;return}for(;(w=L)!==null&&w!==void 0&&w.new;){var w;l.ccOffset+=c.start-L.start,c.new=!1,c=L,L=l[c.prevCC]}l.presentationOffset=s};function o(f,l,r,s,c,L,w,T){var R=new B.VTTParser,C=Object(U.utf8ArrayToStr)(new Uint8Array(f)).trim().replace(M,`
`).split(`
`),S=[],x=Object(K.toMpegTsClockFromTimescale)(l,r),_="00:00.000",d=0,u=0,g,E=!0,N=!1;R.oncue=function(D){var H=s[c],j=s.ccOffset,I=(d-x)/9e4;if(H!=null&&H.new&&(u!==void 0?j=s.ccOffset=H.start:h(s,c,I)),I&&(j=I-s.presentationOffset),N){var b=D.endTime-D.startTime,W=Object(G.normalizePts)((D.startTime+j-u)*9e4,L*9e4)/9e4;D.startTime=W,D.endTime=W+b}var Y=D.text.trim();D.text=decodeURIComponent(encodeURIComponent(Y)),D.id||(D.id=p(D.startTime,D.endTime,Y)),D.endTime>0&&S.push(D)},R.onparsingerror=function(D){g=D},R.onflush=function(){if(g){T(g);return}w(S)},C.forEach(function(D){if(E)if(O(D,"X-TIMESTAMP-MAP=")){E=!1,N=!0,D.substr(16).split(",").forEach(function(H){O(H,"LOCAL:")?_=H.substr(6):O(H,"MPEGTS:")&&(d=parseInt(H.substr(7)))});try{u=v(_)/1e3}catch(H){N=!1,g=H}return}else D===""&&(E=!1);R.parse(D+`
`)}),R.flush()}},"./src/utils/xhr-loader.ts":function(ue,Z,P){"use strict";P.r(Z);var $=P("./src/utils/logger.ts"),B=P("./src/loader/load-stats.ts"),U=/^age:\s*[\d.]+\s*$/m,K=function(){function G(O){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=O?O.xhrSetup:null,this.stats=new B.LoadStats,this.retryDelay=0}var M=G.prototype;return M.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},M.abortInternal=function(){var v=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),v&&(v.onreadystatechange=null,v.onprogress=null,v.readyState!==4&&(this.stats.aborted=!0,v.abort()))},M.abort=function(){var v;this.abortInternal(),(v=this.callbacks)!==null&&v!==void 0&&v.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},M.load=function(v,m,p){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=v,this.config=m,this.callbacks=p,this.retryDelay=m.retryDelay,this.loadInternal()},M.loadInternal=function(){var v=this.config,m=this.context;if(!v)return;var p=this.loader=new self.XMLHttpRequest,h=this.stats;h.loading.first=0,h.loaded=0;var o=this.xhrSetup;try{if(o)try{o(p,m.url)}catch(r){p.open("GET",m.url,!0),o(p,m.url)}p.readyState||p.open("GET",m.url,!0);var f=this.context.headers;if(f)for(var l in f)p.setRequestHeader(l,f[l])}catch(r){this.callbacks.onError({code:p.status,text:r.message},m,p);return}m.rangeEnd&&p.setRequestHeader("Range","bytes="+m.rangeStart+"-"+(m.rangeEnd-1)),p.onreadystatechange=this.readystatechange.bind(this),p.onprogress=this.loadprogress.bind(this),p.responseType=m.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),v.timeout),p.send()},M.readystatechange=function(){var v=this.context,m=this.loader,p=this.stats;if(!v||!m)return;var h=m.readyState,o=this.config;if(p.aborted)return;if(h>=2)if(self.clearTimeout(this.requestTimeout),p.loading.first===0&&(p.loading.first=Math.max(self.performance.now(),p.loading.start)),h===4){m.onreadystatechange=null,m.onprogress=null;var f=m.status;if(f>=200&&f<300){p.loading.end=Math.max(self.performance.now(),p.loading.first);var l,r;if(v.responseType==="arraybuffer"?(l=m.response,r=l.byteLength):(l=m.responseText,r=l.length),p.loaded=p.total=r,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(p,v,l,m),!this.callbacks)return;var c={url:m.responseURL,data:l};this.callbacks.onSuccess(c,p,v,m)}else p.retry>=o.maxRetry||f>=400&&f<499?($.logger.error(f+" while loading "+v.url),this.callbacks.onError({code:f,text:m.statusText},v,m)):($.logger.warn(f+" while loading "+v.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,o.maxRetryDelay),p.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),o.timeout)},M.loadtimeout=function(){$.logger.warn("timeout while loading "+this.context.url);var v=this.callbacks;v&&(this.abortInternal(),v.onTimeout(this.stats,this.context,this.loader))},M.loadprogress=function(v){var m=this.stats;m.loaded=v.loaded,v.lengthComputable&&(m.total=v.total)},M.getCacheAge=function(){var v=null;if(this.loader&&U.test(this.loader.getAllResponseHeaders())){var m=this.loader.getResponseHeader("age");v=m?parseFloat(m):null}return v},G}();Z.default=K}}).default})},vHTk:function(_t,Je,ne){_t.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wzkS:function(_t,Je,ne){"use strict";ne.d(Je,"c",function(){return B}),ne.d(Je,"b",function(){return U}),ne.d(Je,"d",function(){return K}),ne.d(Je,"a",function(){return M}),ne.d(Je,"e",function(){return O});var ue=ne("9og8"),Z=ne("WmNS"),P=ne.n(Z),$=ne("ErOA");function B(v){return Object($.c)("libraries/".concat(v,".json"))}function U(){return Object($.c)("library_tags.json")}function K(v){return G.apply(this,arguments)}function G(){return G=Object(ue.a)(P.a.mark(function v(m){var p;return P.a.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,Object($.b)("attachments/".concat(m,".json"));case 2:return p=o.sent,o.abrupt("return",p.status===0);case 4:case"end":return o.stop()}},v)})),G.apply(this,arguments)}function M(v){return Object($.f)("libraries.json",v)}function O(v,m){return Object($.g)("libraries/".concat(v,".json"),m)}},y5JW:function(_t,Je,ne){"use strict";ne.d(Je,"c",function(){return f}),ne.d(Je,"a",function(){return l});var ue=ne("DZo9"),Z=ne("8z0m"),P=ne("+L6B"),$=ne("2/Rp"),B=ne("9og8"),U=ne("miYZ"),K=ne("tsqr"),G=ne("k1fw"),M=ne("oBTY"),O=ne("WmNS"),v=ne.n(O),m=ne("q1tI"),p=ne.n(m),h=ne("m3rI"),o=ne("wzkS"),f="\u3000\u3000";function l(r){var s=["Bytes","KB","MB","GB","TB"];if(r==0)return"0 Byte";var c=parseInt(""+Math.floor(Math.log(r)/Math.log(1024)),10);return(r/Math.pow(1024,c)).toFixed(1)+" "+s[c]}Je.b=function(r){var s=r.value,c=s===void 0?[]:s,L=r.action,w=r.onChange,T=r.className,R=r.maxSize,C=R===void 0?150:R,S=r.title,x=S===void 0?"\u6587\u4EF6\u4E0A\u4F20":S,_=r.accept,d=_===void 0?null:_,u={multiple:!1,fileList:c,accept:d,withCredentials:!0,beforeUpload:function(N){var D=N.size/1024/1024;return!0},action:"".concat(h.a.API_SERVER,"/api/attachments.json"),onChange:function(N){var D,H,j=Object(M.a)(N.fileList);if(j=j.map(function(W){return W.name.indexOf(f)===-1&&(W.name="".concat(W.name).concat(f).concat(l(W.size))),Object(G.a)({},W)}),N.file.status==="done"&&((D=N.file)===null||D===void 0||((H=D.response)===null||H===void 0)?void 0:H.status)===-1){var I,b;K.b.error((I=N.file)===null||I===void 0||((b=I.response)===null||b===void 0)?void 0:b.message),w([]);return}w(j)},onRemove:function(){var E=Object(B.a)(v.a.mark(function D(H){var j,I,b;return v.a.wrap(function(Y){for(;;)switch(Y.prev=Y.next){case 0:if(j=H.size/1024/1024,!(H.status==="uploading")){Y.next=3;break}return Y.abrupt("return",!0);case 3:if(j<C){Y.next=7;break}return Y.abrupt("return",!0);case 7:if(I=H.response?H.response.id:H.uid,!I){Y.next=15;break}return Y.next=11,Object(o.d)(H.response?H.response.id:H.id);case 11:return b=Y.sent,Y.abrupt("return",b);case 15:return Y.abrupt("return",!0);case 16:case"end":return Y.stop()}},D)}));function N(D){return E.apply(this,arguments)}return N}()};function g(E){E.preventDefault(),E.stopPropagation()}return p.a.createElement("div",{className:"single-upload ".concat(T||"")},p.a.createElement(Z.a,u,p.a.createElement($.a,{type:"primary",title:c.length>0?"\u6BCF\u6B21\u53EA\u80FD\u4E0A\u4F20\u4E00\u4E2A\u8D44\u6E90\uFF0C \u5220\u9664\u4E0B\u9762\u8D44\u6E90\u53EF\u91CD\u65B0\u4E0A\u4F20 ":"",disabled:c.length>0,ghost:!0},x),p.a.createElement("span",{onClick:g,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",C,"M)"," ")))}}}]);