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__Shixuns__Edit__body__Lev...

361 lines
984 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[245,7,13],{"+NIl":function(Ft,gt,ie){(function(ae){ae(ie("VrN/"))})(function(ae){"use strict";ae.defineMode("stex",function(X,D){"use strict";function K(O,L){O.cmdState.push(L)}function w(O){return O.cmdState.length>0?O.cmdState[O.cmdState.length-1]:null}function P(O){var L=O.cmdState.pop();L&&L.closeBracket()}function H(O){for(var L=O.cmdState,g=L.length-1;g>=0;g--){var u=L[g];if(u.name=="DEFAULT")continue;return u}return{styleIdentifier:function(){return null}}}function B(O,L,g){return function(){this.name=O,this.bracketNo=0,this.style=L,this.styles=g,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var I={};I.importmodule=B("importmodule","tag",["string","builtin"]),I.documentclass=B("documentclass","tag",["","atom"]),I.usepackage=B("usepackage","tag",["atom"]),I.begin=B("begin","tag",["atom"]),I.end=B("end","tag",["atom"]),I.label=B("label","tag",["atom"]),I.ref=B("ref","tag",["atom"]),I.eqref=B("eqref","tag",["atom"]),I.cite=B("cite","tag",["atom"]),I.bibitem=B("bibitem","tag",["atom"]),I.Bibitem=B("Bibitem","tag",["atom"]),I.RBibitem=B("RBibitem","tag",["atom"]),I.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function _(O,L){O.f=L}function x(O,L){var g;if(O.match(/^\\[a-zA-Z@]+/)){var u=O.current().slice(1);return g=I.hasOwnProperty(u)?I[u]:I.DEFAULT,g=new g,K(L,g),_(L,M),g.style}if(O.match(/^\\[$&%#{}_]/))return"tag";if(O.match(/^\\[,;!\/\\]/))return"tag";if(O.match("\\["))return _(L,function(l,d){return A(l,d,"\\]")}),"keyword";if(O.match("\\("))return _(L,function(l,d){return A(l,d,"\\)")}),"keyword";if(O.match("$$"))return _(L,function(l,d){return A(l,d,"$$")}),"keyword";if(O.match("$"))return _(L,function(l,d){return A(l,d,"$")}),"keyword";var a=O.next();if(a=="%")return O.skipToEnd(),"comment";if(a=="}"||a=="]"){if(g=w(L),g)g.closeBracket(a),_(L,M);else return"error";return"bracket"}else return a=="{"||a=="["?(g=I.DEFAULT,g=new g,K(L,g),"bracket"):/\d/.test(a)?(O.eatWhile(/[\w.%]/),"atom"):(O.eatWhile(/[\w\-_]/),g=H(L),g.name=="begin"&&(g.argument=O.current()),g.styleIdentifier())}function A(O,L,g){if(O.eatSpace())return null;if(g&&O.match(g))return _(L,x),"keyword";if(O.match(/^\\[a-zA-Z@]+/))return"tag";if(O.match(/^[a-zA-Z]+/))return"variable-2";if(O.match(/^\\[$&%#{}_]/))return"tag";if(O.match(/^\\[,;!\/]/))return"tag";if(O.match(/^[\^_&]/))return"tag";if(O.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(O.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var u=O.next();return u=="{"||u=="}"||u=="["||u=="]"||u=="("||u==")"?"bracket":u=="%"?(O.skipToEnd(),"comment"):"error"}function M(O,L){var g=O.peek(),u;return g=="{"||g=="["?(u=w(L),u.openBracket(g),O.eat(g),_(L,x),"bracket"):/[ \t\r]/.test(g)?(O.eat(g),null):(_(L,x),P(L),x(O,L))}return{startState:function(){var O=D.inMathMode?function(L,g){return A(L,g)}:x;return{cmdState:[],f:O}},copyState:function(O){return{cmdState:O.cmdState.slice(),f:O.f}},token:function(O,L){return L.f(O,L)},blankLine:function(O){O.f=x,O.cmdState.length=0},lineComment:"%"}}),ae.defineMIME("text/x-stex","stex"),ae.defineMIME("text/x-latex","stex")})},"19Vz":function(Ft,gt,ie){(function(ae){ae(ie("VrN/"))})(function(ae){ae.defineOption("placeholder","",function(B,I,_){var x=_&&_!=ae.Init;if(I&&!x)B.on("blur",w),B.on("change",P),B.on("swapDoc",P),ae.on(B.getInputField(),"compositionupdate",B.state.placeholderCompose=function(){K(B)}),P(B);else if(!I&&x){B.off("blur",w),B.off("change",P),B.off("swapDoc",P),ae.off(B.getInputField(),"compositionupdate",B.state.placeholderCompose),X(B);var A=B.getWrapperElement();A.className=A.className.replace(" CodeMirror-empty","")}I&&!B.hasFocus()&&w(B)});function X(B){B.state.placeholder&&(B.state.placeholder.parentNode.removeChild(B.state.placeholder),B.state.placeholder=null)}function D(B){X(B);var I=B.state.placeholder=document.createElement("pre");I.style.cssText="height: 0; overflow: visible",I.style.direction=B.getOption("direction"),I.className="CodeMirror-placeholder CodeMirror-line-like";var _=B.getOption("placeholder");typeof _=="string"&&(_=document.createTextNode(_)),I.appendChild(_),B.display.lineSpace.insertBefore(I,B.display.lineSpace.firstChild)}function K(B){setTimeout(function(){var I=!1,_=B.getInputField();_.nodeName=="TEXTAREA"?I=!_.value:B.lineCount()==1&&(I=!/[^\u200b]/.test(_.querySelector(".CodeMirror-line").textContent)),I?D(B):X(B)},20)}function w(B){H(B)&&D(B)}function P(B){var I=B.getWrapperElement(),_=H(B);I.className=I.className.replace(" CodeMirror-empty","")+(_?" CodeMirror-empty":""),_?D(B):X(B)}function H(B){return B.lineCount()===1&&B.getLine(0)===""}})},"1eCo":function(Ft,gt,ie){(function(ae){ae(ie("VrN/"))})(function(ae){"use strict";var X={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},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ae.defineMode("xml",function(K,w){var P=K.indentUnit,H={},B=w.htmlMode?X:D;for(var I in B)H[I]=B[I];for(var I in w)H[I]=w[I];var _,x;function A(o,S){function y(z){return S.tokenize=z,z(o,S)}var T=o.next();if(T=="<")return o.eat("!")?o.eat("[")?o.match("CDATA[")?y(L("atom","]]>")):null:o.match("--")?y(L("comment","-->")):o.match("DOCTYPE",!0,!0)?(o.eatWhile(/[\w\._\-]/),y(g(1))):null:o.eat("?")?(o.eatWhile(/[\w\._\-]/),S.tokenize=L("meta","?>"),"meta"):(_=o.eat("/")?"closeTag":"openTag",S.tokenize=M,"tag bracket");if(T=="&"){var N;return o.eat("#")?o.eat("x")?N=o.eatWhile(/[a-fA-F\d]/)&&o.eat(";"):N=o.eatWhile(/[\d]/)&&o.eat(";"):N=o.eatWhile(/[\w\.\-:]/)&&o.eat(";"),N?"atom":"error"}else return o.eatWhile(/[^&<]/),null}A.isInText=!0;function M(o,S){var y=o.next();if(y==">"||y=="/"&&o.eat(">"))return S.tokenize=A,_=y==">"?"endTag":"selfcloseTag","tag bracket";if(y=="=")return _="equals",null;if(y=="<"){S.tokenize=A,S.state=d,S.tagName=S.tagStart=null;var T=S.tokenize(o,S);return T?T+" tag error":"tag error"}else return/[\'\"]/.test(y)?(S.tokenize=O(y),S.stringStartCol=o.column(),S.tokenize(o,S)):(o.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function O(o){var S=function(y,T){for(;!y.eol();)if(y.next()==o){T.tokenize=M;break}return"string"};return S.isInAttribute=!0,S}function L(o,S){return function(y,T){for(;!y.eol();){if(y.match(S)){T.tokenize=A;break}y.next()}return o}}function g(o){return function(S,y){for(var T;(T=S.next())!=null;){if(T=="<")return y.tokenize=g(o+1),y.tokenize(S,y);if(T==">")if(o==1){y.tokenize=A;break}else return y.tokenize=g(o-1),y.tokenize(S,y)}return"meta"}}function u(o,S,y){this.prev=o.context,this.tagName=S,this.indent=o.indented,this.startOfLine=y,(H.doNotIndent.hasOwnProperty(S)||o.context&&o.context.noIndent)&&(this.noIndent=!0)}function a(o){o.context&&(o.context=o.context.prev)}function l(o,S){for(var y;;){if(!o.context)return;if(y=o.context.tagName,!H.contextGrabbers.hasOwnProperty(y)||!H.contextGrabbers[y].hasOwnProperty(S))return;a(o)}}function d(o,S,y){return o=="openTag"?(y.tagStart=S.column(),E):o=="closeTag"?v:d}function E(o,S,y){return o=="word"?(y.tagName=S.current(),x="tag",b):H.allowMissingTagName&&o=="endTag"?(x="tag bracket",b(o,S,y)):(x="error",E)}function v(o,S,y){if(o=="word"){var T=S.current();return y.context&&y.context.tagName!=T&&H.implicitlyClosed.hasOwnProperty(y.context.tagName)&&a(y),y.context&&y.context.tagName==T||H.matchClosing===!1?(x="tag",m):(x="tag error",k)}else return H.allowMissingTagName&&o=="endTag"?(x="tag bracket",m(o,S,y)):(x="error",k)}function m(o,S,y){return o!="endTag"?(x="error",m):(a(y),d)}function k(o,S,y){return x="error",m(o,S,y)}function b(o,S,y){if(o=="word")return x="attribute",h;if(o=="endTag"||o=="selfcloseTag"){var T=y.tagName,N=y.tagStart;return y.tagName=y.tagStart=null,o=="selfcloseTag"||H.autoSelfClosers.hasOwnProperty(T)?l(y,T):(l(y,T),y.context=new u(y,T,N==y.indented)),d}return x="error",b}function h(o,S,y){return o=="equals"?p:(H.allowMissing||(x="error"),b(o,S,y))}function p(o,S,y){return o=="string"?c:o=="word"&&H.allowUnquoted?(x="string",b):(x="error",b(o,S,y))}function c(o,S,y){return o=="string"?c:b(o,S,y)}return{startState:function(o){var S={tokenize:A,state:d,indented:o||0,tagName:null,tagStart:null,context:null};return o!=null&&(S.baseIndent=o),S},token:function(o,S){if(!S.tagName&&o.sol()&&(S.indented=o.indentation()),o.eatSpace())return null;_=null;var y=S.tokenize(o,S);return(y||_)&&y!="comment"&&(x=null,S.state=S.state(_||y,o,S),x&&(y=x=="error"?y+" error":x)),y},indent:function(o,S,y){var T=o.context;if(o.tokenize.isInAttribute)return o.tagStart==o.indented?o.stringStartCol+1:o.indented+P;if(T&&T.noIndent)return ae.Pass;if(o.tokenize!=M&&o.tokenize!=A)return y?y.match(/^(\s*)/)[0].length:0;if(o.tagName)return H.multilineTagIndentPastTag!==!1?o.tagStart+o.tagName.length+2:o.tagStart+P*(H.multilineTagIndentFactor||1);if(H.alignCDATA&&/<!\[CDATA\[/.test(S))return 0;var N=S&&/^<(\/)?([\w_:\.-]*)/.exec(S);if(N&&N[1])for(;T;)if(T.tagName==N[2]){T=T.prev;break}else if(H.implicitlyClosed.hasOwnProperty(T.tagName))T=T.prev;else break;else if(N)for(;T;){var z=H.contextGrabbers[T.tagName];if(z&&z.hasOwnProperty(N[2]))T=T.prev;else break}for(;T&&T.prev&&!T.startOfLine;)T=T.prev;return T?T.indent+P:o.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:H.htmlMode?"html":"xml",helperType:H.htmlMode?"html":"xml",skipAttribute:function(o){o.state==p&&(o.state=b)},xmlCurrentTag:function(o){return o.tagName?{name:o.tagName,close:o.type=="closeTag"}:null},xmlCurrentContext:function(o){for(var S=[],y=o.context;y;y=y.prev)y.tagName&&S.push(y.tagName);return S.reverse()}}}),ae.defineMIME("text/xml","xml"),ae.defineMIME("application/xml","xml"),ae.mimeModes.hasOwnProperty("text/html")||ae.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"3TLj":function(Ft,gt,ie){Ft.exports={flex_box_center:"flex_box_center____TbjK",flex_space_between:"flex_space_between___2coRZ",flex_box_vertical_center:"flex_box_vertical_center___3NVFE",flex_box_center_end:"flex_box_center_end___3GKhy",flex_box_column:"flex_box_column___2SLfn",bg:"bg___3oKWe",formWrap:"formWrap___2Y1wq"}},"5v/u":function(Ft,gt,ie){"use strict";ie.r(gt);var ae=ie("5NDa"),X=ie("5rEg"),D=ie("2qtc"),K=ie("kLXV"),w=ie("9og8"),P=ie("k1fw"),H=ie("y8nQ"),B=ie("Vl3Y"),I=ie("tJVT"),_=ie("PpiC"),x=ie("Znn+"),A=ie("ZTPi"),M=ie("WmNS"),O=ie.n(M),L=ie("q1tI"),g=ie.n(L),u=ie("9kvl"),a=ie("Ot1p"),l=ie("HBuW"),d=ie("3TLj"),E=ie.n(d),v=ie("xKgJ"),m=ie("UqFu"),k=ie("9ZNV"),b=ie("nuEh"),h=A.a.TabPane,p=function(o){var S,y,T=o.shixunsDetail,N=o.dispatch,z=o.match,Y=o.practiceSetting,ee=Object(_.a)(o,["shixunsDetail","dispatch","match","practiceSetting"]),G=B.a.useForm(),W=Object(I.a)(G,1),te=W[0],ue=Object(L.useState)({}),be=Object(I.a)(ue,2),Oe=be[0],Ke=be[1],_e=T.challengesNew,Ie=Object(L.useRef)(null),Ue=Y.selectQuestionParams,Pe=Y.id,Te=Y.newQuestion,se=Object(L.useState)(!0),He=Object(I.a)(se,2),ht=He[0],it=He[1];Object(L.useEffect)(function(){it(!0),N({type:"shixunsDetail/getChallengesNew",payload:Object(P.a)({},z.params)}),it(!1)},[z.params]);var at=function(){var ot=Object(w.a)(O.a.mark(function et(Ve){var $e,bt,pt;return O.a.wrap(function(st){for(;;)switch(st.prev=st.next){case 0:return $e=Object(P.a)({},Oe),bt=!(!Ve.unity_3d_routes||Ve.unity_3d_routes==""),$e.identifier=z.params.id,$e.st=1,st.next=6,Object(l.b)(Object(P.a)(Object(P.a)({},$e),{},{unity_3d_routes:bt?Ve.unity_3d_routes:null,unity_3d:bt}));case 6:pt=st.sent,pt.status===1&&(u.d.replace("/shixuns/".concat(z.params.id,"/edit/").concat(pt.challenge_id,"/editquestion?tab=2")),setTimeout(function(){N({type:"practiceSetting/setParams",payload:{newQuestion:null}}),N({type:"practiceSetting/setUpdateIndex"})},200));case 8:case"end":return st.stop()}},et)}));return function(Ve){return ot.apply(this,arguments)}}(),ft=function(){rt()},je=function(et){clearTimeout(Ie.current),Ie.current=setTimeout(function(){"subject"in et&&Te&&N({type:"practiceSetting/setParams",payload:{newQuestion:{st:1,name:et==null?void 0:et.subject}}});var Ve=te.getFieldsValue(),$e=Ve.subject,bt=Ve.task_pass;$e!==""||bt!==Object(m.a)(_e.task_pass_default)?N({type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!0}}):N({type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!1}})},500)},Ye=function(et){Ke(Object(P.a)({},te.getFieldsValue())),je(et)},rt=function(){var et,Ve=function(){u.d.push("/shixuns/".concat(Pe,"/challenges")),N({type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!1}})};Y!=null&&(et=Y.sideBar)!==null&&et!==void 0&&et.confirmLeave?K.a.confirm({title:"\u79BB\u5F00\u6B64\u9875\u63D0\u793A",content:"\u7CFB\u7EDF\u53EF\u80FD\u4E0D\u4F1A\u4FDD\u5B58\u60A8\u6240\u505A\u7684\u66F4\u6539\u3002",okText:"\u79BB\u5F00",cancelText:"\u53D6\u6D88",onOk:function(){Ve()}}):Ve()};return g.a.createElement("section",{className:E.a.bg},g.a.createElement(A.a,{activeKey:"1"},g.a.createElement(h,{tab:"\u672C\u5173\u4EFB\u52A1",key:"1"},g.a.createElement(B.a,{form:te,className:E.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:Ye,onFinish:at},g.a.createElement("div",{className:E.a.fieldWrap},g.a.createElement(B.a.Item,{initialValue:"",name:"subject",label:"\u4EFB\u52A1\u540D\u79F0:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EFB\u52A1\u540D\u79F0"}]},g.a.createElement(X.a,{bordered:!1,maxLength:60,suffix:"".concat(((S=Oe.subject)===null||S===void 0?void 0:S.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"}))),g.a.createElement("div",{className:E.a.mdWrap},g.a.createElement(B.a.Item,{name:"task_pass",label:"\u8FC7\u5173\u4EFB\u52A1:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u4E1A\u7684\u7B80\u4ECB"},{max:35e3,message:"\u6700\u5927\u9650\u523635000\u4E2A\u5B57\u7B26"}]},g.a.createElement(a.a,{watch:!0,defaultValue:_e.task_pass_default}))),Object(v.o)()&&g.a.createElement("div",{className:E.a.fieldWrap},g.a.createElement(B.a.Item,{initialValue:"",name:"unity_3d_routes",label:"\u5D4C\u5165\u7B2C\u4E09\u65B9\u5E73\u53F0:"},g.a.createElement(X.a,{bordered:!1,maxLength:60,suffix:"".concat(((y=Oe.unity_3d_routes)===null||y===void 0?void 0:y.length)||0,"/60"),placeholder:"\u8BF7\u8F93\u5165\u7B2C\u4E09\u65B9\u5E73\u53F0\u5730\u5740"}))),g.a.createElement(B.a.Item,{noStyle:!0},g.a.createElement(k.a,{okButtonProps:{htmlType:"submit"},className:"customFixedButton",onCancel:ft}))))),g.a.createElement(b.a,{loading:ht}))};gt.default=Object(u.a)(function(c){var o=c.shixunsDetail,S=c.practiceSetting;return{shixunsDetail:o,practiceSetting:S}})(p)},"7Cbv":function(Ft,gt,ie){"use strict";var ae=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),X=new Uint8Array(16);function D(){if(!ae)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ae(X)}var K=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function w(M){return typeof M=="string"&&K.test(M)}for(var P=w,H=[],B=0;B<256;++B)H.push((B+256).toString(16).substr(1));function I(M){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,L=(H[M[O+0]]+H[M[O+1]]+H[M[O+2]]+H[M[O+3]]+"-"+H[M[O+4]]+H[M[O+5]]+"-"+H[M[O+6]]+H[M[O+7]]+"-"+H[M[O+8]]+H[M[O+9]]+"-"+H[M[O+10]]+H[M[O+11]]+H[M[O+12]]+H[M[O+13]]+H[M[O+14]]+H[M[O+15]]).toLowerCase();if(!P(L))throw TypeError("Stringified UUID is invalid");return L}var _=I;function x(M,O,L){M=M||{};var g=M.random||(M.rng||D)();if(g[6]=g[6]&15|64,g[8]=g[8]&63|128,O){L=L||0;for(var u=0;u<16;++u)O[L+u]=g[u];return O}return _(g)}var A=gt.a=x},"7ahc":function(Ft,gt,ie){"use strict";ie.d(gt,"a",function(){return E});var ae=ie("k1fw"),X=ie("0Owb"),D=ie("+L6B"),K=ie("2/Rp"),w=ie("y8nQ"),P=ie("Vl3Y"),H=ie("tJVT"),B=ie("OaEy"),I=ie("2fM7"),_=ie("q1tI"),x=ie.n(_),A=ie("VrN/"),M=ie.n(A),O=ie("p77/"),L=ie.n(O),g=ie("c5Ni"),u=ie.n(g),a=I.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},d={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};gt.b=function(v){var m=v.callback,k=v.onCancel,b=Object(_.useState)("python"),h=Object(H.a)(b,2),p=h[0],c=h[1];function o(y){c(d[y][1])}function S(y){m(y)}return x.a.createElement(P.a,Object(X.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:S}),x.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},x.a.createElement(I.a,{onChange:o},Object.keys(d).map(function(y){return x.a.createElement(a,{key:y,value:y},d[y][0])}))),x.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},x.a.createElement(E,{mode:p})),x.a.createElement("div",{className:"flex-container flex-end"},x.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),x.a.createElement(K.a,{type:"ghost",onClick:k},"\u53D6\u6D88")))};function E(v){var m=v.value,k=v.onChange,b=v.mode,h=v.options,p=h===void 0?{}:h,c=Object(_.useRef)(),o=Object(_.useState)(),S=Object(H.a)(o,2),y=S[0],T=S[1];return Object(_.useEffect)(function(){if(y){function N(z){var Y=z.getValue();k&&k(Y)}return y.on("change",N),function(){y.off("change",N)}}},[y,k]),Object(_.useEffect)(function(){y&&y.setOption("mode",b)},[y,b]),Object(_.useEffect)(function(){y&&((m!==y.getValue()||m==="")&&setTimeout(function(){y.setValue(m||" ")},300))},[y,m]),Object(_.useEffect)(function(){if(c.current&&!y){var N=M.a.fromTextArea(c.current,Object(ae.a)({mode:b,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},p));T(N)}},[c.current,y]),x.a.createElement("div",{className:"my-codemirror-container"},x.a.createElement("textarea",{ref:c}))}},"7ixt":function(Ft,gt,ie){"use strict";ie.d(gt,"a",function(){return D});var ae={adjustX:1,adjustY:1},X=[0,0],D={left:{points:["cr","cl"],overflow:ae,offset:[-4,0],targetOffset:X},right:{points:["cl","cr"],overflow:ae,offset:[4,0],targetOffset:X},top:{points:["bc","tc"],overflow:ae,offset:[0,-4],targetOffset:X},bottom:{points:["tc","bc"],overflow:ae,offset:[0,4],targetOffset:X},topLeft:{points:["bl","tl"],overflow:ae,offset:[0,-4],targetOffset:X},leftTop:{points:["tr","tl"],overflow:ae,offset:[-4,0],targetOffset:X},topRight:{points:["br","tr"],overflow:ae,offset:[0,-4],targetOffset:X},rightTop:{points:["tl","tr"],overflow:ae,offset:[4,0],targetOffset:X},bottomRight:{points:["tr","br"],overflow:ae,offset:[0,4],targetOffset:X},rightBottom:{points:["bl","br"],overflow:ae,offset:[4,0],targetOffset:X},bottomLeft:{points:["tl","bl"],overflow:ae,offset:[0,4],targetOffset:X},leftBottom:{points:["br","bl"],overflow:ae,offset:[-4,0],targetOffset:X}},K=D},"8EBN":function(Ft,gt,ie){(function(ae){ae(ie("VrN/"))})(function(ae){"use strict";ae.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 X=0;X<ae.modeInfo.length;X++){var D=ae.modeInfo[X];D.mimes&&(D.mime=D.mimes[0])}ae.findModeByMIME=function(K){K=K.toLowerCase();for(var w=0;w<ae.modeInfo.length;w++){var P=ae.modeInfo[w];if(P.mime==K)return P;if(P.mimes){for(var H=0;H<P.mimes.length;H++)if(P.mimes[H]==K)return P}}if(/\+xml$/.test(K))return ae.findModeByMIME("application/xml");if(/\+json$/.test(K))return ae.findModeByMIME("application/json")},ae.findModeByExtension=function(K){K=K.toLowerCase();for(var w=0;w<ae.modeInfo.length;w++){var P=ae.modeInfo[w];if(P.ext){for(var H=0;H<P.ext.length;H++)if(P.ext[H]==K)return P}}},ae.findModeByFileName=function(K){for(var w=0;w<ae.modeInfo.length;w++){var P=ae.modeInfo[w];if(P.file&&P.file.test(K))return P}var H=K.lastIndexOf("."),B=H>-1&&K.substring(H+1,K.length);if(B)return ae.findModeByExtension(B)},ae.findModeByName=function(K){K=K.toLowerCase();for(var w=0;w<ae.modeInfo.length;w++){var P=ae.modeInfo[w];if(P.name.toLowerCase()==K)return P;if(P.alias){for(var H=0;H<P.alias.length;H++)if(P.alias[H].toLowerCase()==K)return P}}}})},"8hTe":function(Ft,gt,ie){Ft.exports={button:"button___1wy9m"}},"9Bee":function(Ft,gt,ie){"use strict";var ae=ie("DYRE"),X=ie("zeV3"),D=ie("+L6B"),K=ie("2/Rp"),w=ie("k1fw"),P=ie("9og8"),H=ie("tJVT"),B=ie("WmNS"),I=ie.n(B),_=ie("q1tI"),x=ie.n(_),A=ie("vg9a"),M=ie("DlQD"),O=ie.n(M),L=ie("rUJ1");function g(j,s){var f=j.match(/^(\s+)(?:```)/);if(f===null)return s;var R=f[1];return s.split(`
`).map(function(Q){var F=Q.match(/^\s+/);if(F===null)return Q;var ve=Object(H.a)(F,1),ze=ve[0];return ze.length>=R.length?Q.slice(R.length):Q}).join(`
`)}var u=[],a=["<ul>"],l=new O.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function E(){u.length=0,a=["<ul>"]}var v={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function m(j,s,f,R){if(s>=j.length||j[s].level<=f)return s;var Q=j[s];R.push("<li><a href='#"+Q.anchor+"'>"+Q.text+"</a>"),s++;var F=[];return s=m(j,s,Q.level,F),F.length>0&&(R.push("<ul>"),F.forEach(function(ve){R.push(ve)}),R.push("</ul>")),R.push("</li>"),s=m(j,s,f,R),s}function k(){return m(u,0,0,a),a.push("</ul>"),a.join("")}var b={heading:function(s){var f=d.exec(s);if(f)return{type:"heading",raw:f[0],depth:f[1].length,text:f[2]}},fences:function(s){var f=this.rules.block.fences.exec(s);if(f){var R=f[0],Q=g(R,f[3]||""),F=f[2]?f[2].trim():f[2];if(["latex","katex","math"].indexOf(F)>=0){var ve=c(),ze=Q;Q=ve,o[ve]={type:"block",expression:ze}}return{type:"code",raw:R,lang:F,text:Q}}}},h=/(?:\${2})([^\n`]+?)(?:\${2})/gi,p=0,c=function(){return"__special_katext_id_".concat(p++,"__")},o={};function S(){return o}function y(){p=0,o={}}function T(j){return j=j.replace(h,function(s,f){var R=c();return o[R]={type:"inline",expression:f},R}),j}var N=l.listitem;l.listitem=function(j){return N(T(j))};var z=l.paragraph;l.paragraph=function(j){return z(T(j))};var Y=l.tablecell;l.tablecell=function(j,s){return Y(T(j),s)},l.code=function(j,s,f){var R=(s||"").match(/\S*/)[0];return R?["latex","katex","math"].indexOf(R)>=0?"<p class='editormd-tex'>".concat(j,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(s,'">').concat(f?j:Object(L.escape)(j,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(f?j:Object(L.escape)(j,!0))+"</code></pre>"},l.heading=function(j,s,f){var R=this.options.headerPrefix+f.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return u.push({anchor:R,level:s,text:j}),"<h"+s+' id="'+R+'">'+j+"</h"+s+">"},O.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),O.a.use({tokenizer:b,renderer:l});var ee=O.a,G=ie("SJMd"),W=ie("ulZh"),te=ie.n(W),ue=ie("m3rI"),be=ie("Oy/b"),Oe=ie("p5ED"),Ke=ie("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 _e=function(j,s){return(_e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,R){f.__proto__=R}||function(f,R){for(var Q in R)Object.prototype.hasOwnProperty.call(R,Q)&&(f[Q]=R[Q])})(j,s)};function Ie(j,s){function f(){this.constructor=j}_e(j,s),j.prototype=s===null?Object.create(s):(f.prototype=s.prototype,new f)}function Ue(j,s,f,R){return new(f||(f=Promise))(function(Q,F){function ve(At){try{lt(R.next(At))}catch(Xe){F(Xe)}}function ze(At){try{lt(R.throw(At))}catch(Xe){F(Xe)}}function lt(At){var Xe;At.done?Q(At.value):(Xe=At.value,Xe instanceof f?Xe:new f(function(Rt){Rt(Xe)})).then(ve,ze)}lt((R=R.apply(j,s||[])).next())})}function Pe(j,s){var f,R,Q,F,ve={label:0,sent:function(){if(1&Q[0])throw Q[1];return Q[1]},trys:[],ops:[]};return F={next:ze(0),throw:ze(1),return:ze(2)},typeof Symbol=="function"&&(F[Symbol.iterator]=function(){return this}),F;function ze(lt){return function(At){return function(Xe){if(f)throw new TypeError("Generator is already executing.");for(;ve;)try{if(f=1,R&&(Q=2&Xe[0]?R.return:Xe[0]?R.throw||((Q=R.return)&&Q.call(R),0):R.next)&&!(Q=Q.call(R,Xe[1])).done)return Q;switch(R=0,Q&&(Xe=[2&Xe[0],Q.value]),Xe[0]){case 0:case 1:Q=Xe;break;case 4:return ve.label++,{value:Xe[1],done:!1};case 5:ve.label++,R=Xe[1],Xe=[0];continue;case 7:Xe=ve.ops.pop(),ve.trys.pop();continue;default:if(!(Q=ve.trys,(Q=Q.length>0&&Q[Q.length-1])||Xe[0]!==6&&Xe[0]!==2)){ve=0;continue}if(Xe[0]===3&&(!Q||Xe[1]>Q[0]&&Xe[1]<Q[3])){ve.label=Xe[1];break}if(Xe[0]===6&&ve.label<Q[1]){ve.label=Q[1],Q=Xe;break}if(Q&&ve.label<Q[2]){ve.label=Q[2],ve.ops.push(Xe);break}Q[2]&&ve.ops.pop(),ve.trys.pop();continue}Xe=s.call(j,ve)}catch(Rt){Xe=[6,Rt],R=0}finally{f=Q=0}if(5&Xe[0])throw Xe[1];return{value:Xe[0]?Xe[1]:void 0,done:!0}}([lt,At])}}}function Te(){for(var j=0,s=0,f=arguments.length;s<f;s++)j+=arguments[s].length;var R=Array(j),Q=0;for(s=0;s<f;s++)for(var F=arguments[s],ve=0,ze=F.length;ve<ze;ve++,Q++)R[Q]=F[ve];return R}var se=function(){function j(){}return j.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},j.setAttributes=function(s,f){for(var R=0,Q=f;R<Q.length;R++){var F=Q[R],ve=F[0],ze=F[1];s.setAttribute(ve,ze)}},j.createRect=function(s,f,R){var Q=document.createElementNS("http://www.w3.org/2000/svg","rect");return Q.setAttribute("width",s.toString()),Q.setAttribute("height",f.toString()),R&&j.setAttributes(Q,R),Q},j.createLine=function(s,f,R,Q,F){var ve=document.createElementNS("http://www.w3.org/2000/svg","line");return ve.setAttribute("x1",s.toString()),ve.setAttribute("y1",f.toString()),ve.setAttribute("x2",R.toString()),ve.setAttribute("y2",Q.toString()),F&&j.setAttributes(ve,F),ve},j.createPolygon=function(s,f){var R=document.createElementNS("http://www.w3.org/2000/svg","polygon");return R.setAttribute("points",s),f&&j.setAttributes(R,f),R},j.createCircle=function(s,f){var R=document.createElementNS("http://www.w3.org/2000/svg","circle");return R.setAttribute("cx",(s/2).toString()),R.setAttribute("cy",(s/2).toString()),R.setAttribute("r",s.toString()),f&&j.setAttributes(R,f),R},j.createEllipse=function(s,f,R){var Q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Q.setAttribute("cx",(s/2).toString()),Q.setAttribute("cy",(f/2).toString()),Q.setAttribute("rx",(s/2).toString()),Q.setAttribute("ry",(f/2).toString()),R&&j.setAttributes(Q,R),Q},j.createGroup=function(s){var f=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&j.setAttributes(f,s),f},j.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},j.createMarker=function(s,f,R,Q,F,ve,ze){var lt=document.createElementNS("http://www.w3.org/2000/svg","marker");return j.setAttributes(lt,[["id",s],["orient",f],["markerWidth",R.toString()],["markerHeight",Q.toString()],["refX",F.toString()],["refY",ve.toString()]]),lt.appendChild(ze),lt},j.createText=function(s){var f=document.createElementNS("http://www.w3.org/2000/svg","text");return f.setAttribute("x","0"),f.setAttribute("y","0"),s&&j.setAttributes(f,s),f},j.createTSpan=function(s,f){var R=document.createElementNS("http://www.w3.org/2000/svg","tspan");return R.textContent=s,f&&j.setAttributes(R,f),R},j.createImage=function(s){var f=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&j.setAttributes(f,s),f},j.createPoint=function(s,f){var R=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return R.x=s,R.y=f,R},j.createPath=function(s,f){var R=document.createElementNS("http://www.w3.org/2000/svg","path");return R.setAttribute("d",s),f&&j.setAttributes(R,f),R},j}(),He=function(){function j(){}return j.addKey=function(s){j.key=s},Object.defineProperty(j,"isLicensed",{get:function(){return!!j.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(j.key)},enumerable:!1,configurable:!0}),j}(),ht=function(){function j(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return j.prototype.rasterize=function(s,f,R){var Q=this;return new Promise(function(F){var ve=R!==void 0?R:document.createElement("canvas");s===null&&(Q.markersOnly=!0,Q.naturalSize=!1);var ze=document.createElementNS("http://www.w3.org/2000/svg","svg");ze.setAttribute("xmlns","http://www.w3.org/2000/svg"),ze.setAttribute("width",f.width.baseVal.valueAsString),ze.setAttribute("height",f.height.baseVal.valueAsString),ze.setAttribute("viewBox","0 0 "+f.viewBox.baseVal.width.toString()+" "+f.viewBox.baseVal.height.toString()),ze.innerHTML=f.innerHTML,Q.naturalSize===!0?(ze.width.baseVal.value=s.naturalWidth,ze.height.baseVal.value=s.naturalHeight):Q.width!==void 0&&Q.height!==void 0&&(ze.width.baseVal.value=Q.width,ze.height.baseVal.value=Q.height),ve.width=ze.width.baseVal.value,ve.height=ze.height.baseVal.value;var lt=ze.outerHTML,At=ve.getContext("2d");Q.markersOnly!==!0&&At.drawImage(s,0,0,ve.width,ve.height);var Xe=window.URL,Rt=new Image(ve.width,ve.height);Rt.setAttribute("crossOrigin","anonymous");var gr=new Blob([lt],{type:"image/svg+xml"}),Dr=Xe.createObjectURL(gr);Rt.onload=function(){At.drawImage(Rt,0,0),Xe.revokeObjectURL(Dr);var Ln=ve.toDataURL(Q.imageType,Q.imageQuality);F(Ln)},Rt.src=Dr})},j}(),it=function(){},at=function(){function j(s){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}return Object.defineProperty(j.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(j.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(j.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),j.prototype.addClass=function(s){return this.styleSheet===void 0&&this.addStyleSheet(),s.name=""+this.classNamePrefix+s.localName,this.classes.push(s),this.styleSheet.sheet.insertRule("."+s.name+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length),s},j.prototype.addRule=function(s){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(s),this.styleSheet.sheet.insertRule(s.selector+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length)},j.prototype.addStyleSheet=function(){var s;this.styleSheet=document.createElement("style"),((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).appendChild(this.styleSheet),this.addRule(new ft("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new ft("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new ft("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new je("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new je("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},j.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},j}(),ft=function(j,s){this.selector=j,this.style=s},je=function(j,s){this.localName=j,this.style=s},Ye=function(){function j(s,f,R,Q,F){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=s,this.displayMode=f,this.markerItems=R,this.uiStyleSettings=Q,this.styles=F,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return j.prototype.show=function(s){var f=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var R=document.createElement("div");R.className=this.toolbarBlockStyleClass.name,R.style.whiteSpace="nowrap",this.uiContainer.appendChild(R),this.addActionButton(R,'<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(R,'<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(R,'<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(R,'<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(R,'<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(R,'<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(R,'<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(R,'<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(F){var ve=document.createElement("div");ve.className=""+f.toolbarButtonStyleClass.name,ve.setAttribute("data-type-name",F.typeName),ve.innerHTML=F.icon,ve.addEventListener("click",function(){f.markerToolbarButtonClicked(ve,F)}),f.buttons.push(ve),f.markerButtons.push(ve)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var 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()},j.prototype.addButtonClickListener=function(s){this.buttonClickListeners.push(s)},j.prototype.removeButtonClickListener=function(s){this.buttonClickListeners.indexOf(s)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(s),1)},j.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},j.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var s=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var f=0;f<this.markerButtons.length;f++)f<s||f===s&&this.markerButtons.length-1===s?this.markerButtonBlock.appendChild(this.markerButtons[f]):(f===s&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[f]))}},j.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")},j.prototype.resetButtonStyles=function(){var s=this;this.buttons.forEach(function(f){f.className=f.className.replace(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name,"").trim(),f.className=f.className.replace(s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:s.toolbarActiveButtonStyleColorsClass.name,"").trim(),f.className+=" "+(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name)})},j.prototype.addActionButton=function(s,f,R){var Q=this,F=document.createElement("div");switch(F.className=""+this.toolbarButtonStyleClass.name,F.innerHTML=f,F.setAttribute("data-action",R),F.addEventListener("click",function(){Q.actionToolbarButtonClicked(F,R)}),R){case"select":F.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":F.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":F.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":F.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":F.style.fill=this.uiStyleSettings.closeButtonColor}s.appendChild(F),this.buttons.push(F)},j.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new je("toolbar",`
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: row;
justify-content: space-between;
height: `+this.uiStyleSettings.toolbarHeight+`px;
box-sizing: content-box;
`+(this.displayMode==="inline"?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
`+(this.displayMode==="inline"?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
overflow: hidden;
`)),this.toolbarStyleColorsClass=this.styles.addClass(new je("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new je("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new je("toolbar-overflow-block",`
position: absolute;
top: `+this.uiStyleSettings.toolbarHeight+`px;
max-width: `+2*this.uiStyleSettings.toolbarHeight+`px;
z-index: 10;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new je("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var s=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new je("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
padding: `+s+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new je("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new je("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new ft("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new ft("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},j.prototype.markerToolbarButtonClicked=function(s,f){this.setActiveButton(s),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(R){return R("marker",f)}),this.markerButtonOverflowBlock.style.display="none"},j.prototype.actionToolbarButtonClicked=function(s,f){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(R){return R("action",f)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},j.prototype.setActiveButton=function(s){this.resetButtonStyles(),s.className=s.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),s.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},j.prototype.setActiveMarkerButton=function(s){var f=this.markerButtons.find(function(R){return R.getAttribute("data-type-name")===s});f&&this.setActiveButton(f)},j.prototype.setCurrentMarker=function(s){var f=this;this.currentMarker=s,this.buttons.filter(function(R){return/delete|notes/.test(R.getAttribute("data-action"))}).forEach(function(R){f.currentMarker===void 0?(R.style.fillOpacity="0.4",R.style.pointerEvents="none"):(R.style.fillOpacity="1",R.style.pointerEvents="all")})},j}(),rt=function(){function j(s,f,R,Q){this.panels=[],this.panelButtons=[],this.markerjsContainer=s,this.displayMode=f,this.uiStyleSettings=R,this.styles=Q,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return j.prototype.addStyles=function(){var s;this.toolboxStyleClass=this.styles.addClass(new je("toolbox",`
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: column;
font-family: sans-serif;
`+(this.displayMode==="popup"?"height:"+2.5*this.uiStyleSettings.toolbarHeight+"px;":"")+`
box-sizing: content-box;
`+(this.displayMode==="popup"?"background-color: "+this.uiStyleSettings.canvasBackgroundColor+";":"")+`
`+(this.displayMode==="inline"?"border-bottom-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
`+(this.displayMode==="inline"?"border-bottom-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
overflow: hidden;
`)),this.toolboxStyleColorsClass=this.styles.addClass(new je("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var f=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new je("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new je("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new je("toolbox-panel-row",`
display: flex;
`+(this.displayMode==="inline"?"position: absolute;":"")+`
`+(this.displayMode==="inline"?"bottom: "+this.uiStyleSettings.toolbarHeight+"px;":"")+`
cursor: default;
height: `+1.5*this.uiStyleSettings.toolbarHeight+`px;
`+(this.displayMode==="inline"?"width: 100%;":"")+`
box-sizing: content-box;
`)),this.toolboxPanelRowStyleColorsClass=this.styles.addClass(new je("toolbox-panel-row_colors",`
background-color: `+((s=this.uiStyleSettings.toolboxBackgroundColor)!==null&&s!==void 0?s:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new je("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*f)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*f)+`px;
padding: `+f+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new je("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new je("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new ft("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new ft("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},j.prototype.show=function(s){var f;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolboxStyleClass.name+" "+((f=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&f!==void 0?f:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},j.prototype.setPanelButtons=function(s){var f,R,Q=this;this.panels=s,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((f=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&f!==void 0?f:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((R=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&R!==void 0?R:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(F){var ve;F.uiStyleSettings=Q.uiStyleSettings;var ze=document.createElement("div");ze.className=Q.toolboxButtonStyleClass.name+" "+((ve=Q.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ve!==void 0?ve:Q.toolboxButtonStyleColorsClass.name),ze.innerHTML=F.icon,ze.title=F.title,ze.addEventListener("click",function(){Q.panelButtonClick(F)}),Q.panelButtons.push(ze),Q.buttonRow.appendChild(ze)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},j.prototype.panelButtonClick=function(s){var f=this,R=-1;if(s!==this.activePanel){R=this.panels.indexOf(s),this.panelRow.innerHTML="";var Q=s.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=s}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){f.displayMode==="inline"?f.panelRow.style.display="none":f.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(F,ve){var ze,lt;F.className=f.toolboxButtonStyleClass.name+" "+(ve===R?""+((ze=f.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&ze!==void 0?ze:f.toolboxActiveButtonStyleColorsClass.name):""+((lt=f.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&lt!==void 0?lt:f.toolboxButtonStyleColorsClass.name))})},j}(),ot=function(j,s){this.title=j,this.icon=s},et=function(j){function s(f,R,Q,F){var ve=j.call(this,f,F||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return ve.colors=[],ve.addTransparent=!1,ve.colorBoxes=[],ve.colors=R,ve.currentColor=Q,ve.setCurrentColor=ve.setCurrentColor.bind(ve),ve.getColorBox=ve.getColorBox.bind(ve),ve}return Ie(s,j),s.prototype.getUi=function(){var f=this,R=document.createElement("div");return R.style.overflow="hidden",R.style.whiteSpace="nowrap",this.colors.forEach(function(Q){var F=f.getColorBox(Q);R.appendChild(F),f.colorBoxes.push(F)}),R},s.prototype.getColorBox=function(f){var R=this,Q=this.uiStyleSettings.toolbarHeight/4,F=this.uiStyleSettings.toolbarHeight-Q,ve=document.createElement("div");ve.style.display="inline-block",ve.style.boxSizing="content-box",ve.style.width=F-2+"px",ve.style.height=F-2+"px",ve.style.padding="1px",ve.style.marginRight="2px",ve.style.marginBottom="2px",ve.style.borderWidth="2px",ve.style.borderStyle="solid",ve.style.borderRadius=(F+2)/2+"px",ve.style.borderColor=f===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ve.addEventListener("click",function(){R.setCurrentColor(f,ve)});var ze=document.createElement("div");return ze.style.display="inline-block",ze.style.width=F-2+"px",ze.style.height=F-2+"px",ze.style.backgroundColor=f,ze.style.borderRadius=F/2+"px",f==="transparent"&&(ze.style.fill=this.uiStyleSettings.toolboxAccentColor,ze.innerHTML=`<svg viewBox="0 0 24 24">
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
</svg>`),ve.appendChild(ze),ve},s.prototype.setCurrentColor=function(f,R){var Q=this;this.currentColor=f,this.colorBoxes.forEach(function(F){F.style.borderColor=F===R?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(f)},s}(ot),Ve=function(){function j(s,f,R){this._state="new",this._isSelected=!1,this._container=s,this._overlayContainer=f,this.globalSettings=R,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(j.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),j.prototype.ownsTarget=function(s){return!1},Object.defineProperty(j.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),j.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},j.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},j.prototype.pointerDown=function(s,f){},j.prototype.dblClick=function(s,f){},j.prototype.manipulate=function(s){},j.prototype.pointerUp=function(s){this.stateChanged()},j.prototype.dispose=function(){},j.prototype.addMarkerVisualToContainer=function(s){this.container.childNodes.length>0?this.container.insertBefore(s,this.container.childNodes[0]):this.container.appendChild(s)},j.prototype.getState=function(){return{typeName:j.typeName,state:this.state,notes:this.notes}},j.prototype.restoreState=function(s){this._state=s.state,this.notes=s.notes},j.prototype.scale=function(s,f){},j.prototype.colorChanged=function(s){this.onColorChanged&&this.onColorChanged(s),this.stateChanged()},j.prototype.fillColorChanged=function(s){this.onFillColorChanged&&this.onFillColorChanged(s),this.stateChanged()},j.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var s=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),s.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(s)&&this.onStateChanged(this)}},j.typeName="MarkerBase",j}(),$e=function(){function j(){this.findGripByVisual=this.findGripByVisual.bind(this)}return j.prototype.findGripByVisual=function(s){return this.topLeft.ownsTarget(s)?this.topLeft:this.topCenter.ownsTarget(s)?this.topCenter:this.topRight.ownsTarget(s)?this.topRight:this.centerLeft.ownsTarget(s)?this.centerLeft:this.centerRight.ownsTarget(s)?this.centerRight:this.bottomLeft.ownsTarget(s)?this.bottomLeft:this.bottomCenter.ownsTarget(s)?this.bottomCenter:this.bottomRight.ownsTarget(s)?this.bottomRight:void 0},j}(),bt=function(){function j(){this.GRIP_SIZE=10,this.visual=se.createGroup(),this.visual.appendChild(se.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(se.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return j.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},j}(),pt=function(){function j(){}return j.toITransformMatrix=function(s){return{a:s.a,b:s.b,c:s.c,d:s.d,e:s.e,f:s.f}},j.toSVGMatrix=function(s,f){return s.a=f.a,s.b=f.b,s.c=f.c,s.d=f.d,s.e=f.e,s.f=f.f,s},j}(),mt=function(j){function s(f,R,Q){var F=j.call(this,f,R,Q)||this;return F.left=0,F.top=0,F.width=0,F.height=0,F.defaultSize={x:50,y:20},F.offsetX=0,F.offsetY=0,F.rotationAngle=0,F.CB_DISTANCE=10,F._suppressMarkerCreateEvent=!1,F.container.transform.baseVal.appendItem(se.createTransform()),F.setupControlBox(),F}return Ie(s,j),Object.defineProperty(s.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"visual",{get:function(){return this._visual},set:function(f){this._visual=f;var R=se.createTransform();this._visual.transform.baseVal.appendItem(R)},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(f){return!!j.prototype.ownsTarget.call(this,f)||!!(this.controlGrips.findGripByVisual(f)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(f))},s.prototype.pointerDown=function(f,R){j.prototype.pointerDown.call(this,f,R),this.state==="new"&&(this.left=f.x,this.top=f.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var Q=this.unrotatePoint(f);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(R),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(R)){this.activeGrip=this.rotatorGrip;var F=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=F.x-this.width/2,this.top=F.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ve=this.container.transform.baseVal.getItem(0);ve.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ve,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},s.prototype.pointerUp=function(f){var R=this.state;j.prototype.pointerUp.call(this,f),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(f),this._state="select",R==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},s.prototype.moveVisual=function(f){this.visual.style.transform="translate("+f.x+"px, "+f.y+"px)"},s.prototype.manipulate=function(f){var R=this.unrotatePoint(f);this.state==="creating"?this.resize(f):this.state==="move"?(this.left=this.manipulationStartLeft+(R.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(R.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(R):this.state==="rotate"&&this.rotate(f)},s.prototype.resize=function(f){var R=this.manipulationStartLeft,Q=this.manipulationStartWidth,F=this.manipulationStartTop,ve=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:R=this.manipulationStartLeft+f.x-this.manipulationStartX,Q=this.manipulationStartWidth+this.manipulationStartLeft-R;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:Q=this.manipulationStartWidth+f.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:F=this.manipulationStartTop+f.y-this.manipulationStartY,ve=this.manipulationStartHeight+this.manipulationStartTop-F;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ve=this.manipulationStartHeight+f.y-this.manipulationStartY}Q>=0?(this.left=R,this.width=Q):(this.left=R+Q,this.width=-Q),ve>=0?(this.top=F,this.height=ve):(this.top=F+ve,this.height=-ve),this.setSize()},s.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},s.prototype.rotate=function(f){if(Math.abs(f.x-this.centerX)>.1){var R=Math.sign(f.x-this.centerX);this.rotationAngle=180*Math.atan((f.y-this.centerY)/(f.x-this.centerX))/Math.PI+90*R,this.applyRotation()}},s.prototype.applyRotation=function(){var f=this.container.transform.baseVal.getItem(0);f.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(f,0)},s.prototype.rotatePoint=function(f){if(this.rotationAngle===0)return f;var R=this.container.getCTM(),Q=se.createPoint(f.x,f.y);return{x:(Q=Q.matrixTransform(R)).x,y:Q.y}},s.prototype.unrotatePoint=function(f){if(this.rotationAngle===0)return f;var R=this.container.getCTM();R=R.inverse();var Q=se.createPoint(f.x,f.y);return{x:(Q=Q.matrixTransform(R)).x,y:Q.y}},s.prototype.select=function(){j.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){j.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=se.createGroup();var f=se.createTransform();f.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(f),this.container.appendChild(this.controlBox),this.controlRect=se.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=se.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 $e,this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){var f=this.controlBox.transform.baseVal.getItem(0);f.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(f,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()},s.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()},s.prototype.createGrip=function(){var f=new bt;return f.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(f.visual),f},s.prototype.positionGrips=function(){var f=this.controlGrips.topLeft.GRIP_SIZE,R=-f/2,Q=R,F=(this.width+this.CB_DISTANCE)/2-f/2,ve=(this.height+this.CB_DISTANCE)/2-f/2,ze=this.height+this.CB_DISTANCE-f/2,lt=this.width+this.CB_DISTANCE-f/2;this.positionGrip(this.controlGrips.topLeft.visual,R,Q),this.positionGrip(this.controlGrips.topCenter.visual,F,Q),this.positionGrip(this.controlGrips.topRight.visual,lt,Q),this.positionGrip(this.controlGrips.centerLeft.visual,R,ve),this.positionGrip(this.controlGrips.centerRight.visual,lt,ve),this.positionGrip(this.controlGrips.bottomLeft.visual,R,ze),this.positionGrip(this.controlGrips.bottomCenter.visual,F,ze),this.positionGrip(this.controlGrips.bottomRight.visual,lt,ze),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,F,Q-3*this.CB_DISTANCE)},s.prototype.positionGrip=function(f,R,Q){var F=f.transform.baseVal.getItem(0);F.setTranslate(R,Q),f.transform.baseVal.replaceItem(F,0)},s.prototype.hideControlBox=function(){this.controlBox.style.display="none"},s.prototype.showControlBox=function(){this.controlBox.style.display=""},s.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:pt.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:pt.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},j.prototype.getState.call(this))},s.prototype.restoreState=function(f){j.prototype.restoreState.call(this,f);var R=f;this.left=R.left,this.top=R.top,this.width=R.width,this.height=R.height,this.rotationAngle=R.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(pt.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,R.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(pt.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,R.containerTransformMatrix))},s.prototype.scale=function(f,R){j.prototype.scale.call(this,f,R);var Q=this.rotatePoint({x:this.left,y:this.top}),F=this.unrotatePoint({x:Q.x*f,y:Q.y*R});this.left=F.x,this.top=F.y,this.width=this.width*f,this.height=this.height*R,this.adjustControlBox()},s}(Ve),st=function(j){function s(f,R,Q){var F=j.call(this,f,R,Q)||this;return F.fillColor="transparent",F.strokeColor="transparent",F.strokeWidth=0,F.strokeDasharray="",F.opacity=1,F.setStrokeColor=F.setStrokeColor.bind(F),F.setFillColor=F.setFillColor.bind(F),F.setStrokeWidth=F.setStrokeWidth.bind(F),F.setStrokeDasharray=F.setStrokeDasharray.bind(F),F.createVisual=F.createVisual.bind(F),F}return Ie(s,j),s.prototype.ownsTarget=function(f){return!(!j.prototype.ownsTarget.call(this,f)&&f!==this.visual)},s.prototype.createVisual=function(){this.visual=se.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)},s.prototype.pointerDown=function(f,R){j.prototype.pointerDown.call(this,f,R),this.state==="new"&&(this.createVisual(),this.moveVisual(f),this._state="creating")},s.prototype.manipulate=function(f){j.prototype.manipulate.call(this,f)},s.prototype.resize=function(f){j.prototype.resize.call(this,f),this.setSize()},s.prototype.setSize=function(){j.prototype.setSize.call(this),se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(f){j.prototype.pointerUp.call(this,f),this.setSize()},s.prototype.setStrokeColor=function(f){this.strokeColor=f,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(f),this.stateChanged()},s.prototype.setFillColor=function(f){this.fillColor=f,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},s.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.visual&&se.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},j.prototype.getState.call(this))},s.prototype.restoreState=function(f){var R=f;this.fillColor=R.fillColor,this.strokeColor=R.strokeColor,this.strokeWidth=R.strokeWidth,this.strokeDasharray=R.strokeDasharray,this.opacity=R.opacity,this.createVisual(),j.prototype.restoreState.call(this,f),this.setSize()},s.prototype.scale=function(f,R){j.prototype.scale.call(this,f,R),this.setSize()},s.title="Rectangle marker",s}(mt),Ot=function(j){function s(f,R,Q,F){var ve=j.call(this,f,F||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ve.widths=[],ve.widthBoxes=[],ve.widths=R,ve.currentWidth=Q,ve.setCurrentWidth=ve.setCurrentWidth.bind(ve),ve}return Ie(s,j),s.prototype.getUi=function(){var f=this,R=document.createElement("div");return R.style.display="flex",R.style.overflow="hidden",R.style.flexGrow="2",this.widths.forEach(function(Q){var F=document.createElement("div");F.style.display="flex",F.style.flexGrow="2",F.style.alignItems="center",F.style.justifyContent="space-between",F.style.padding="5px",F.style.borderWidth="2px",F.style.borderStyle="solid",F.style.borderColor=Q===f.currentWidth?f.uiStyleSettings.toolboxAccentColor:"transparent",F.addEventListener("click",function(){f.setCurrentWidth(Q,F)}),R.appendChild(F);var ve=document.createElement("div");ve.innerText=Q.toString(),ve.style.marginRight="5px",F.appendChild(ve);var ze=document.createElement("div");ze.style.minHeight="20px",ze.style.flexGrow="2",ze.style.display="flex",ze.style.alignItems="center";var lt=document.createElement("hr");lt.style.minWidth="20px",lt.style.border="0px",lt.style.borderTop=Q+"px solid "+f.uiStyleSettings.toolboxColor,lt.style.flexGrow="2",ze.appendChild(lt),F.appendChild(ze),f.widthBoxes.push(F)}),R},s.prototype.setCurrentWidth=function(f,R){var Q=this;this.currentWidth=f,this.widthBoxes.forEach(function(F){F.style.borderColor=F===R?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},s}(ot),xt=function(j){function s(f,R,Q,F){var ve=j.call(this,f,F||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return ve.styles=[],ve.styleBoxes=[],ve.styles=R,ve.currentStyle=Q,ve.setCurrentStyle=ve.setCurrentStyle.bind(ve),ve}return Ie(s,j),s.prototype.getUi=function(){var f=this,R=document.createElement("div");return R.style.display="flex",R.style.overflow="hidden",R.style.flexGrow="2",this.styles.forEach(function(Q){var F=document.createElement("div");F.style.display="flex",F.style.alignItems="center",F.style.justifyContent="space-between",F.style.padding="5px",F.style.borderWidth="2px",F.style.borderStyle="solid",F.style.overflow="hidden",F.style.maxWidth=100/f.styles.length-5+"%",F.style.borderColor=Q===f.currentStyle?f.uiStyleSettings.toolboxAccentColor:"transparent",F.addEventListener("click",function(){f.setCurrentStyle(Q,F)}),R.appendChild(F);var ve=document.createElement("div");ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.overflow="hidden";var ze=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+f.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(Q!==""?'stroke-dasharray="'+Q+'"':"")+` />
</svg>`;ve.innerHTML=ze,F.appendChild(ve),f.styleBoxes.push(F)}),R},s.prototype.setCurrentStyle=function(f,R){var Q=this;this.currentStyle=f,this.styleBoxes.forEach(function(F){F.style.borderColor=F===R?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},s}(ot),vt=function(j){function s(f,R,Q){var F=j.call(this,f,R,Q)||this;return F.strokeColor=Q.defaultColor,F.strokeWidth=Q.defaultStrokeWidth,F.strokeDasharray=Q.defaultStrokeDasharray,F.strokePanel=new et("Line color",Q.defaultColorSet,Q.defaultColor),F.strokePanel.onColorChanged=F.setStrokeColor,F.strokeWidthPanel=new Ot("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),F.strokeWidthPanel.onWidthChanged=F.setStrokeWidth,F.strokeStylePanel=new xt("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),F.strokeStylePanel.onStyleChanged=F.setStrokeDasharray,F}return Ie(s,j),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=j.prototype.getState.call(this);return f.typeName=s.typeName,f},s.typeName="FrameMarker",s.title="Frame marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',s}(st),Ne=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},Lt=function(j){function s(f,R,Q){var F=j.call(this,f,R,Q)||this;return F.x1=0,F.y1=0,F.x2=0,F.y2=0,F.defaultLength=50,F.manipulationStartX=0,F.manipulationStartY=0,F.manipulationStartX1=0,F.manipulationStartY1=0,F.manipulationStartX2=0,F.manipulationStartY2=0,F.setupControlBox(),F}return Ie(s,j),s.prototype.ownsTarget=function(f){return!!j.prototype.ownsTarget.call(this,f)||!(!this.grip1.ownsTarget(f)&&!this.grip2.ownsTarget(f))},s.prototype.pointerDown=function(f,R){j.prototype.pointerDown.call(this,f,R),this.manipulationStartX=f.x,this.manipulationStartY=f.y,this.state==="new"&&(this.x1=f.x,this.y1=f.y,this.x2=f.x,this.y2=f.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(R)?this.activeGrip=this.grip1:this.grip2.ownsTarget(R)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},s.prototype.pointerUp=function(f){var R=this.state;j.prototype.pointerUp.call(this,f),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(f),this._state="select",R==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},s.prototype.adjustVisual=function(){},s.prototype.manipulate=function(f){this.state==="creating"?this.resize(f):this.state==="move"?(this.x1=this.manipulationStartX1+f.x-this.manipulationStartX,this.y1=this.manipulationStartY1+f.y-this.manipulationStartY,this.x2=this.manipulationStartX2+f.x-this.manipulationStartX,this.y2=this.manipulationStartY2+f.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(f)},s.prototype.resize=function(f){switch(this.activeGrip){case this.grip1:this.x1=f.x,this.y1=f.y;break;case this.grip2:case void 0:this.x2=f.x,this.y2=f.y}this.adjustVisual(),this.adjustControlBox()},s.prototype.select=function(){j.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){j.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=se.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){this.positionGrips()},s.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},s.prototype.createGrip=function(){var f=new bt;return f.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(f.visual),f},s.prototype.positionGrips=function(){var f=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-f/2,this.y1-f/2),this.positionGrip(this.grip2.visual,this.x2-f/2,this.y2-f/2)},s.prototype.positionGrip=function(f,R,Q){var F=f.transform.baseVal.getItem(0);F.setTranslate(R,Q),f.transform.baseVal.replaceItem(F,0)},s.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},j.prototype.getState.call(this))},s.prototype.restoreState=function(f){j.prototype.restoreState.call(this,f);var R=f;this.x1=R.x1,this.y1=R.y1,this.x2=R.x2,this.y2=R.y2},s.prototype.scale=function(f,R){j.prototype.scale.call(this,f,R),this.x1=this.x1*f,this.y1=this.y1*R,this.x2=this.x2*f,this.y2=this.y2*R,this.adjustVisual(),this.adjustControlBox()},s}(Ve),Et=function(j){function s(f,R,Q){var F=j.call(this,f,R,Q)||this;return F.strokeColor="transparent",F.strokeWidth=0,F.strokeDasharray="",F.setStrokeColor=F.setStrokeColor.bind(F),F.setStrokeWidth=F.setStrokeWidth.bind(F),F.setStrokeDasharray=F.setStrokeDasharray.bind(F),F.strokeColor=Q.defaultColor,F.strokeWidth=Q.defaultStrokeWidth,F.strokeDasharray=Q.defaultStrokeDasharray,F.strokePanel=new et("Line color",Q.defaultColorSet,Q.defaultColor),F.strokePanel.onColorChanged=F.setStrokeColor,F.strokeWidthPanel=new Ot("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),F.strokeWidthPanel.onWidthChanged=F.setStrokeWidth,F.strokeStylePanel=new xt("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),F.strokeStylePanel.onStyleChanged=F.setStrokeDasharray,F}return Ie(s,j),s.prototype.ownsTarget=function(f){return!(!j.prototype.ownsTarget.call(this,f)&&f!==this.visual&&f!==this.selectorLine&&f!==this.visibleLine)},s.prototype.createVisual=function(){this.visual=se.createGroup(),this.selectorLine=se.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=se.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)},s.prototype.pointerDown=function(f,R){j.prototype.pointerDown.call(this,f,R),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},s.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()),se.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),se.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setStrokeColor=function(f){this.strokeColor=f,this.adjustVisual(),this.colorChanged(f)},s.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.adjustVisual()},s.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},j.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){j.prototype.restoreState.call(this,f);var R=f;this.strokeColor=R.strokeColor,this.strokeWidth=R.strokeWidth,this.strokeDasharray=R.strokeDasharray,this.createVisual(),this.adjustVisual()},s.typeName="LineMarker",s.title="Line marker",s.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',s}(Lt),Fe=function(j){function s(f,R,Q,F){var ve=j.call(this,f,F||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return ve.fonts=[],ve.fontBoxes=[],ve.fonts=R,ve.currentFont=Q,ve.setCurrentFont=ve.setCurrentFont.bind(ve),ve}return Ie(s,j),s.prototype.getUi=function(){var f=this,R=document.createElement("div");return R.style.overflow="hidden",R.style.flexGrow="2",this.fonts.forEach(function(Q){var F=document.createElement("div");F.style.display="inline-block",F.style.alignItems="center",F.style.justifyContent="space-between",F.style.padding="5px",F.style.borderWidth="2px",F.style.borderStyle="solid",F.style.overflow="hidden",F.style.maxWidth=100/f.fonts.length-5+"%",F.style.borderColor=Q===f.currentFont?f.uiStyleSettings.toolboxAccentColor:"transparent",F.addEventListener("click",function(){f.setCurrentFont(Q,F)}),R.appendChild(F);var ve=document.createElement("div");ve.style.display="flex",ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.fontFamily=Q,ve.style.overflow="hidden";var ze=document.createElement("div");ze.style.whiteSpace="nowrap",ze.style.overflow="hidden",ze.style.textOverflow="ellipsis",ze.innerHTML="The quick brown fox jumps over the lazy dog",ve.appendChild(ze),F.appendChild(ve),f.fontBoxes.push(F)}),R},s.prototype.setCurrentFont=function(f,R){var Q=this;this.currentFont=f,this.fontBoxes.forEach(function(F){F.style.borderColor=F===R?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},s}(ot),Ze=function(j){function s(f,R,Q){var F=j.call(this,f,R,Q)||this;return F.color="transparent",F.padding=5,F.DEFAULT_TEXT="your text here",F.text=F.DEFAULT_TEXT,F.isMoved=!1,F.color=Q.defaultColor,F.fontFamily=Q.defaultFontFamily,F.defaultSize={x:100,y:30},F.setColor=F.setColor.bind(F),F.setFont=F.setFont.bind(F),F.renderText=F.renderText.bind(F),F.sizeText=F.sizeText.bind(F),F.textEditDivClicked=F.textEditDivClicked.bind(F),F.showTextEditor=F.showTextEditor.bind(F),F.setSize=F.setSize.bind(F),F.positionTextEditor=F.positionTextEditor.bind(F),F.colorPanel=new et("Color",Q.defaultColorSet,Q.defaultColor),F.colorPanel.onColorChanged=F.setColor,F.fontFamilyPanel=new Fe("Font",Q.defaultFontFamilies,Q.defaultFontFamily),F.fontFamilyPanel.onFontChanged=F.setFont,F}return Ie(s,j),s.prototype.ownsTarget=function(f){if(j.prototype.ownsTarget.call(this,f)||f===this.visual||f===this.textElement||f===this.bgRectangle)return!0;var R=!1;return this.textElement.childNodes.forEach(function(Q){Q===f&&(R=!0)}),R},s.prototype.createVisual=function(){this.visual=se.createGroup(),this.bgRectangle=se.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=se.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(se.createTransform()),this.textElement.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},s.prototype.pointerDown=function(f,R){j.prototype.pointerDown.call(this,f,R),this.isMoved=!1,this.pointerDownPoint=f,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(f),this._state="creating")},s.prototype.renderText=function(){var f=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(R){f.textElement.appendChild(se.createTSpan(R.trim()===""?" ":R.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},s.prototype.getTextScale=function(){var f=this.textElement.getBBox(),R=1;if(f.width>0&&f.height>0){var Q=(1*this.width-this.width*this.padding*2/100)/f.width,F=(1*this.height-this.height*this.padding*2/100)/f.height;R=Math.min(Q,F)}return R},s.prototype.getTextPosition=function(f){var R=this.textElement.getBBox(),Q=0,F=0;return R.width>0&&R.height>0&&(Q=(this.width-R.width*f)/2,F=this.height/2-R.height*f/2),{x:Q,y:F}},s.prototype.sizeText=function(){var f=this.textElement.getBBox(),R=this.getTextScale(),Q=this.getTextPosition(R);Q.y-=f.y*R,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+Q.x+"px, "+Q.y+"px) scale("+R+", "+R+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(Q.x,Q.y),this.textElement.transform.baseVal.getItem(1).setScale(R,R))},s.prototype.manipulate=function(f){j.prototype.manipulate.call(this,f),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(f.x-this.pointerDownPoint.x)>5||Math.abs(f.y-this.pointerDownPoint.y)>5)},s.prototype.resize=function(f){j.prototype.resize.call(this,f),this.isMoved=!0,this.setSize(),this.sizeText()},s.prototype.setSize=function(){j.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},s.prototype.pointerUp=function(f){var R=this.state;R==="creating"&&(this._suppressMarkerCreateEvent=!0),j.prototype.pointerUp.call(this,f),this.setSize(),(R==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},s.prototype.showTextEditor=function(){var f=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(R){R.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var R=Number.parseFloat(f.textEditor.style.fontSize);f.textEditor.clientWidth>=Number.parseInt(f.textEditor.style.maxWidth)&&R>.9;)R-=.1,f.textEditor.style.fontSize=Math.max(R,.9)+"em"}),this.textEditor.addEventListener("keyup",function(R){R.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(R){if(R.clipboardData){var Q=R.clipboardData.getData("text"),F=window.getSelection();if(!F.rangeCount)return!1;F.deleteFromDocument(),F.getRangeAt(0).insertNode(document.createTextNode(Q)),R.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){f.textEditDivClicked(f.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},s.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var f=this.getTextScale(),R=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),Q=this.textElement.getBBox(),F={x:Q.width*f,y:Q.height*f};R.x-=F.x/2,R.y-=F.y/2,this.textEditor.style.top=R.y+"px",this.textEditor.style.left=R.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-R.x+"px",this.textEditor.style.fontSize=Math.max(16*f,12)+"px",this.textElement.style.display="none"}},s.prototype.textEditDivClicked=function(f){this.text=f.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},s.prototype.select=function(){j.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},s.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),j.prototype.deselect.call(this)},s.prototype.dblClick=function(f,R){j.prototype.dblClick.call(this,f,R),this.showTextEditor()},s.prototype.setColor=function(f){this.textElement&&se.setAttributes(this.textElement,[["fill",f]]),this.color=f,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(f)},s.prototype.setFont=function(f){this.textElement&&se.setAttributes(this.textElement,[["font-family",f]]),this.fontFamily=f,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},s.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},s.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},j.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){var R=f;this.color=R.color,this.fontFamily=R.fontFamily,this.padding=R.padding,this.text=R.text,this.createVisual(),j.prototype.restoreState.call(this,f),this.setSize()},s.prototype.scale=function(f,R){j.prototype.scale.call(this,f,R),this.setSize(),this.sizeText(),this.positionTextEditor()},s.typeName="TextMarker",s.title="Text marker",s.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>',s}(mt),we=function(j){function s(f,R,Q){var F=j.call(this,f,R,Q)||this;return F.color="transparent",F.lineWidth=3,F.drawing=!1,F.pixelRatio=1,F.color=Q.defaultColor,F.lineWidth=Q.defaultStrokeWidth,F.pixelRatio=Q.freehandPixelRatio,F.setColor=F.setColor.bind(F),F.addCanvas=F.addCanvas.bind(F),F.finishCreation=F.finishCreation.bind(F),F.setLineWidth=F.setLineWidth.bind(F),F.colorPanel=new et("Color",Q.defaultColorSet,Q.defaultColor),F.colorPanel.onColorChanged=F.setColor,F.lineWidthPanel=new Ot("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),F.lineWidthPanel.onWidthChanged=F.setLineWidth,F}return Ie(s,j),s.prototype.ownsTarget=function(f){return!(!j.prototype.ownsTarget.call(this,f)&&f!==this.visual&&f!==this.drawingImage)},s.prototype.createVisual=function(){this.visual=se.createGroup(),this.drawingImage=se.createImage(),this.visual.appendChild(this.drawingImage);var f=se.createTransform();this.visual.transform.baseVal.appendItem(f),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(f,R){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(f.x,f.y),this.drawing=!0):j.prototype.pointerDown.call(this,f,R)},s.prototype.manipulate=function(f){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(f.x,f.y),this.canvasContext.stroke()):j.prototype.manipulate.call(this,f)},s.prototype.resize=function(f){j.prototype.resize.call(this,f),se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(f){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):j.prototype.pointerUp.call(this,f)},s.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)},s.prototype.select=function(){this.state==="creating"&&this.finishCreation(),j.prototype.select.call(this)},s.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),j.prototype.deselect.call(this)},s.prototype.finishCreation=function(){for(var f=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),R=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],Q=R[0],F=R[1],ve=R[2],ze=R[3],lt=!1,At=0;At<this.canvasElement.height;At++)for(var Xe=0;Xe<this.canvasElement.width;Xe++)f.data[At*this.canvasElement.width*4+4*Xe+3]>0&&(lt=!0,At<F&&(F=At),Xe<Q&&(Q=Xe),At>ze&&(ze=At),Xe>ve&&(ve=Xe));if(lt){this.left=Q/this.pixelRatio,this.top=F/this.pixelRatio,this.width=(ve-Q)/this.pixelRatio,this.height=(ze-F)/this.pixelRatio;var Rt=document.createElement("canvas");Rt.width=ve-Q,Rt.height=ze-F,Rt.getContext("2d").putImageData(this.canvasContext.getImageData(Q,F,ve-Q,ze-F),0,0),this.drawingImgUrl=Rt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},s.prototype.setDrawingImage=function(){se.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},s.prototype.setColor=function(f){this.color=f,this.colorChanged(f)},s.prototype.setLineWidth=function(f){this.lineWidth=f},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=Object.assign({drawingImgUrl:this.drawingImgUrl},j.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){this.createVisual(),j.prototype.restoreState.call(this,f),this.drawingImgUrl=f.drawingImgUrl,this.setDrawingImage()},s.prototype.scale=function(f,R){j.prototype.scale.call(this,f,R),this.setDrawingImage()},s.typeName="FreehandMarker",s.title="Freehand marker",s.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>',s}(mt),ye=function(j){function s(f,R,Q){var F=j.call(this,f,Q||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return F.typeBoxes=[],F.currentType=R,F.setCurrentType=F.setCurrentType.bind(F),F}return Ie(s,j),s.prototype.getUi=function(){var f=this,R=document.createElement("div");R.style.display="flex",R.style.overflow="hidden",R.style.flexGrow="2";for(var Q=function(ze){var lt="both";switch(ze){case 0:lt="both";break;case 1:lt="start";break;case 2:lt="end";break;case 3:lt="none"}var At=document.createElement("div");if(At.style.display="flex",At.style.flexGrow="2",At.style.alignItems="center",At.style.justifyContent="space-between",At.style.padding="5px",At.style.borderWidth="2px",At.style.borderStyle="solid",At.style.borderColor=lt===F.currentType?F.uiStyleSettings.toolboxAccentColor:"transparent",At.addEventListener("click",function(){f.setCurrentType(lt,At)}),R.appendChild(At),lt==="both"||lt==="start"){var Xe=document.createElement("div");Xe.style.display="flex",Xe.style.alignItems="center",Xe.style.minHeight="20px",Xe.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="`+(F.uiStyleSettings!==void 0?F.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Xe.style.marginLeft="5px",At.appendChild(Xe)}var Rt=document.createElement("div");Rt.style.display="flex",Rt.style.alignItems="center",Rt.style.minHeight="20px",Rt.style.flexGrow="2";var gr=document.createElement("hr");if(gr.style.minWidth="20px",gr.style.border="0px",gr.style.borderTop="3px solid "+(F.uiStyleSettings!==void 0?F.uiStyleSettings.toolboxColor:"#eeeeee"),gr.style.flexGrow="2",Rt.appendChild(gr),At.appendChild(Rt),lt==="both"||lt==="end"){var Dr=document.createElement("div");Dr.style.display="flex",Dr.style.alignItems="center",Dr.style.minHeight="20px",Dr.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="`+(F.uiStyleSettings!==void 0?F.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Dr.style.marginRight="5px",At.appendChild(Dr)}F.typeBoxes.push(At)},F=this,ve=0;ve<4;ve++)Q(ve);return R},s.prototype.setCurrentType=function(f,R){var Q=this;this.currentType=f,this.typeBoxes.forEach(function(F){F.style.borderColor=F===R?Q.uiStyleSettings!==void 0?Q.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},s}(ot),Ee=function(j){function s(f,R,Q){var F=j.call(this,f,R,Q)||this;return F.arrowType="end",F.arrowBaseHeight=10,F.arrowBaseWidth=10,F.getArrowPoints=F.getArrowPoints.bind(F),F.setArrowType=F.setArrowType.bind(F),F.arrowTypePanel=new ye("Arrow type","end"),F.arrowTypePanel.onArrowTypeChanged=F.setArrowType,F}return Ie(s,j),s.prototype.ownsTarget=function(f){return!(!j.prototype.ownsTarget.call(this,f)&&f!==this.arrow1&&f!==this.arrow2)},s.prototype.getArrowPoints=function(f,R){var Q=this.arrowBaseWidth+2*this.strokeWidth,F=this.arrowBaseHeight+2*this.strokeWidth;return f-Q/2+","+(R+F/2)+" "+f+","+(R-F/2)+" "+(f+Q/2)+","+(R+F/2)},s.prototype.createTips=function(){this.arrow1=se.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=se.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.arrow2)},s.prototype.pointerDown=function(f,R){j.prototype.pointerDown.call(this,f,R),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(j.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",se.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),se.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var f=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),R=this.arrow1.transform.baseVal.getItem(0);R.setRotate(f,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(R,0);var Q=this.arrow2.transform.baseVal.getItem(0);Q.setRotate(f+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(Q,0)}},s.prototype.setArrowType=function(f){this.arrowType=f,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=Object.assign({arrowType:this.arrowType},j.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){j.prototype.restoreState.call(this,f);var R=f;this.arrowType=R.arrowType,this.createTips(),this.adjustVisual()},s.typeName="ArrowMarker",s.title="Arrow marker",s.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',s}(Et),re=function(j){function s(f,R,Q){var F=j.call(this,f,R,Q)||this;return F.fillColor=Q.defaultFillColor,F.strokeWidth=0,F.fillPanel=new et("Color",Q.defaultColorSet,Q.defaultFillColor),F.fillPanel.onColorChanged=F.setFillColor,F}return Ie(s,j),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=j.prototype.getState.call(this);return f.typeName=s.typeName,f},s.typeName="CoverMarker",s.title="Cover marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',s}(st),ne=function(j){function s(f,R,Q,F){var ve=j.call(this,f,F||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return ve.opacities=[],ve.opacityBoxes=[],ve.opacities=R,ve.currentOpacity=Q,ve.setCurrentOpacity=ve.setCurrentOpacity.bind(ve),ve}return Ie(s,j),s.prototype.getUi=function(){var f=this,R=document.createElement("div");return R.style.display="flex",R.style.overflow="hidden",R.style.flexGrow="2",R.style.justifyContent="space-between",this.opacities.forEach(function(Q){var F=document.createElement("div");F.style.display="flex",F.style.alignItems="center",F.style.justifyContent="center",F.style.padding="5px",F.style.borderWidth="2px",F.style.borderStyle="solid",F.style.borderColor=Q===f.currentOpacity?f.uiStyleSettings.toolboxAccentColor:"transparent",F.addEventListener("click",function(){f.setCurrentOpacity(Q,F)}),R.appendChild(F);var ve=document.createElement("div");ve.innerText=100*Q+"%",F.appendChild(ve),f.opacityBoxes.push(F)}),R},s.prototype.setCurrentOpacity=function(f,R){var Q=this;this.currentOpacity=f,this.opacityBoxes.forEach(function(F){F.style.borderColor=F===R?Q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},s}(ot),de=function(j){function s(f,R,Q){var F=j.call(this,f,R,Q)||this;return F.setOpacity=F.setOpacity.bind(F),F.fillColor=Q.defaultHighlightColor,F.strokeWidth=0,F.opacity=Q.defaultHighlightOpacity,F.fillPanel=new et("Color",Q.defaultColorSet,F.fillColor),F.fillPanel.onColorChanged=F.setFillColor,F.opacityPanel=new ne("Opacity",Q.defaultOpacitySteps,F.opacity),F.opacityPanel.onOpacityChanged=F.setOpacity,F}return Ie(s,j),s.prototype.setOpacity=function(f){this.opacity=f,this.visual&&se.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=j.prototype.getState.call(this);return f.typeName=s.typeName,f},s.typeName="HighlightMarker",s.title="Highlight marker",s.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>',s}(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>',Se=function(j){function s(f,R,Q){var F=j.call(this,f,R,Q)||this;return F.bgColor="transparent",F.tipPosition={x:0,y:0},F.tipBase1Position={x:0,y:0},F.tipBase2Position={x:0,y:0},F.tipMoving=!1,F.color=Q.defaultStrokeColor,F.bgColor=Q.defaultFillColor,F.fontFamily=Q.defaultFontFamily,F.defaultSize={x:100,y:30},F.setBgColor=F.setBgColor.bind(F),F.getTipPoints=F.getTipPoints.bind(F),F.positionTip=F.positionTip.bind(F),F.setTipPoints=F.setTipPoints.bind(F),F.colorPanel=new et("Text color",Q.defaultColorSet,F.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>'),F.colorPanel.onColorChanged=F.setColor,F.bgColorPanel=new et("Fill color",Q.defaultColorSet,F.bgColor,ge),F.bgColorPanel.onColorChanged=F.setBgColor,F.fontFamilyPanel=new Fe("Font",Q.defaultFontFamilies,Q.defaultFontFamily),F.fontFamilyPanel.onFontChanged=F.setFont,F.tipGrip=new bt,F.tipGrip.visual.transform.baseVal.appendItem(se.createTransform()),F.controlBox.appendChild(F.tipGrip.visual),F}return Ie(s,j),s.prototype.ownsTarget=function(f){return j.prototype.ownsTarget.call(this,f)||this.tipGrip.ownsTarget(f)||this.tip===f},s.prototype.createTip=function(){se.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=se.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},s.prototype.pointerDown=function(f,R){this.state==="new"&&j.prototype.pointerDown.call(this,f,R),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(R)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):j.prototype.pointerDown.call(this,f,R)},s.prototype.pointerUp=function(f){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,j.prototype.pointerUp.call(this,f);else{var R=this.state==="creating";j.prototype.pointerUp.call(this,f),this.setTipPoints(R),this.positionTip()}},s.prototype.manipulate=function(f){if(this.tipMoving){var R=this.unrotatePoint(f);this.tipPosition={x:R.x-this.manipulationStartLeft,y:R.y-this.manipulationStartTop},this.positionTip()}else j.prototype.manipulate.call(this,f)},s.prototype.setBgColor=function(f){this.bgRectangle&&this.tip&&(se.setAttributes(this.bgRectangle,[["fill",f]]),se.setAttributes(this.tip,[["fill",f]])),this.bgColor=f,this.fillColorChanged(f)},s.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},s.prototype.setTipPoints=function(f){f===void 0&&(f=!1);var R=Math.min(this.height/2,15),Q=this.height/5;f&&(this.tipPosition={x:R+Q/2,y:this.height+20});var F=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?F<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(Q=this.width/5,R=Math.min(this.width/2,15),this.tipBase1Position={x:R,y:0},this.tipBase2Position={x:R+Q,y:0}):(this.tipBase1Position={x:0,y:R},this.tipBase2Position={x:0,y:R+Q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?F<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(Q=this.width/5,R=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-R-Q,y:0},this.tipBase2Position={x:this.width-R,y:0}):(this.tipBase1Position={x:this.width,y:R},this.tipBase2Position={x:this.width,y:R+Q}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?F<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(Q=this.width/5,R=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-R-Q,y:this.height},this.tipBase2Position={x:this.width-R,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-R-Q},this.tipBase2Position={x:this.width,y:this.height-R}):F<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(Q=this.width/5,R=Math.min(this.width/2,15),this.tipBase1Position={x:R,y:this.height},this.tipBase2Position={x:R+Q,y:this.height}):(this.tipBase1Position={x:0,y:this.height-R},this.tipBase2Position={x:0,y:this.height-R-Q})},s.prototype.resize=function(f){j.prototype.resize.call(this,f),this.positionTip()},s.prototype.positionTip=function(){se.setAttributes(this.tip,[["points",this.getTipPoints()]]);var f=this.tipGrip.visual.transform.baseVal.getItem(0);f.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(f,0)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),s.prototype.select=function(){this.positionTip(),j.prototype.select.call(this)},s.prototype.getState=function(){var f=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},j.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){var R=f;this.bgColor=R.bgColor,this.tipPosition=R.tipPosition,j.prototype.restoreState.call(this,f),this.createTip(),this.setTipPoints()},s.prototype.scale=function(f,R){j.prototype.scale.call(this,f,R),this.tipPosition={x:this.tipPosition.x*f,y:this.tipPosition.y*R},this.positionTip()},s.typeName="CalloutMarker",s.title="Callout marker",s.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>',s}(Ze),Re=function(j){function s(f,R,Q){var F=j.call(this,f,R,Q)||this;return F.fillColor="transparent",F.strokeColor="transparent",F.strokeWidth=0,F.strokeDasharray="",F.opacity=1,F.strokeColor=Q.defaultColor,F.strokeWidth=Q.defaultStrokeWidth,F.strokeDasharray=Q.defaultStrokeDasharray,F.fillColor=Q.defaultFillColor,F.setStrokeColor=F.setStrokeColor.bind(F),F.setFillColor=F.setFillColor.bind(F),F.setStrokeWidth=F.setStrokeWidth.bind(F),F.setStrokeDasharray=F.setStrokeDasharray.bind(F),F.setOpacity=F.setOpacity.bind(F),F.createVisual=F.createVisual.bind(F),F.strokePanel=new et("Line color",Te(Q.defaultColorSet,["transparent"]),Q.defaultColor),F.strokePanel.onColorChanged=F.setStrokeColor,F.fillPanel=new et("Fill color",Te(Q.defaultColorSet,["transparent"]),F.fillColor,ge),F.fillPanel.onColorChanged=F.setFillColor,F.strokeWidthPanel=new Ot("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),F.strokeWidthPanel.onWidthChanged=F.setStrokeWidth,F.strokeStylePanel=new xt("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),F.strokeStylePanel.onStyleChanged=F.setStrokeDasharray,F.opacityPanel=new ne("Opacity",Q.defaultOpacitySteps,F.opacity),F.opacityPanel.onOpacityChanged=F.setOpacity,F}return Ie(s,j),s.prototype.ownsTarget=function(f){return!(!j.prototype.ownsTarget.call(this,f)&&f!==this.visual)},s.prototype.createVisual=function(){this.visual=se.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)},s.prototype.pointerDown=function(f,R){j.prototype.pointerDown.call(this,f,R),this.state==="new"&&(this.createVisual(),this.moveVisual(f),this._state="creating")},s.prototype.manipulate=function(f){j.prototype.manipulate.call(this,f)},s.prototype.resize=function(f){j.prototype.resize.call(this,f),this.setSize()},s.prototype.setSize=function(){j.prototype.setSize.call(this),se.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},s.prototype.pointerUp=function(f){j.prototype.pointerUp.call(this,f),this.setSize()},s.prototype.setStrokeColor=function(f){this.strokeColor=f,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(f),this.stateChanged()},s.prototype.setFillColor=function(f){this.fillColor=f,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(f),this.stateChanged()},s.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.visual&&se.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.setOpacity=function(f){this.opacity=f,this.visual&&se.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},j.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){var R=f;this.fillColor=R.fillColor,this.strokeColor=R.strokeColor,this.strokeWidth=R.strokeWidth,this.strokeDasharray=R.strokeDasharray,this.opacity=R.opacity,this.createVisual(),j.prototype.restoreState.call(this,f),this.setSize()},s.prototype.scale=function(f,R){j.prototype.scale.call(this,f,R),this.setSize()},s.typeName="EllipseMarker",s.title="Ellipse marker",s.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>',s}(mt),Ge=function(j){function s(f,R,Q){return j.call(this,f,R,Q)||this}return Ie(s,j),Object.defineProperty(s.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(f){return!(!j.prototype.ownsTarget.call(this,f)&&f!==this.tip1&&f!==this.tip2)},s.prototype.createTips=function(){this.tip1=se.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(se.createTransform()),this.visual.appendChild(this.tip1),this.tip2=se.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(se.createTransform()),this.visual.appendChild(this.tip2)},s.prototype.pointerDown=function(f,R){j.prototype.pointerDown.call(this,f,R),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(j.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(se.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()]]),se.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 f=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),R=this.tip1.transform.baseVal.getItem(0);R.setRotate(f,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(R,0);var Q=this.tip2.transform.baseVal.getItem(0);Q.setRotate(f+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(Q,0)}},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=j.prototype.getState.call(this);return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){j.prototype.restoreState.call(this,f),this.createTips(),this.adjustVisual()},s.typeName="MeasurementMarker",s.title="Measurement marker",s.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>',s}(Et),yt=function(j){function s(f,R,Q){var F=j.call(this,f,R,Q)||this;return F.strokePanel.colors=Q.defaultColorSet,F.fillColor="transparent",F}return Ie(s,j),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=j.prototype.getState.call(this);return f.typeName=s.typeName,f},s.typeName="EllipseFrameMarker",s.title="Ellipse frame marker",s.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>',s}(Re),_t=function(){function j(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(j.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),j.prototype.addUndoStep=function(s){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(s)||(this.undoStack.push(s),JSON.stringify(this.lastRedoStep)!==JSON.stringify(s)&&this.redoStack.splice(0,this.redoStack.length))},j.prototype.replaceLastUndoStep=function(s){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=s)},j.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},j.prototype.undo=function(){if(this.undoStack.length>1){var s=this.undoStack.pop();return s!==void 0&&this.redoStack.push(s),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},j.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},j}(),kt=function(j){function s(f,R,Q){var F=j.call(this,f,R,Q)||this;return F.strokeColor="transparent",F.strokeWidth=0,F.strokeDasharray="",F.curveX=0,F.curveY=0,F.manipulationStartCurveX=0,F.manipulationStartCurveY=0,F.setStrokeColor=F.setStrokeColor.bind(F),F.setStrokeWidth=F.setStrokeWidth.bind(F),F.setStrokeDasharray=F.setStrokeDasharray.bind(F),F.positionGrips=F.positionGrips.bind(F),F.addControlGrips=F.addControlGrips.bind(F),F.adjustVisual=F.adjustVisual.bind(F),F.setupControlBox=F.setupControlBox.bind(F),F.resize=F.resize.bind(F),F.strokeColor=Q.defaultColor,F.strokeWidth=Q.defaultStrokeWidth,F.strokeDasharray=Q.defaultStrokeDasharray,F.strokePanel=new et("Line color",Q.defaultColorSet,Q.defaultColor),F.strokePanel.onColorChanged=F.setStrokeColor,F.strokeWidthPanel=new Ot("Line width",Q.defaultStrokeWidths,Q.defaultStrokeWidth),F.strokeWidthPanel.onWidthChanged=F.setStrokeWidth,F.strokeStylePanel=new xt("Line style",Q.defaultStrokeDasharrays,Q.defaultStrokeDasharray),F.strokeStylePanel.onStyleChanged=F.setStrokeDasharray,F}return Ie(s,j),s.prototype.ownsTarget=function(f){return!(!j.prototype.ownsTarget.call(this,f)&&f!==this.visual&&f!==this.selectorCurve&&f!==this.visibleCurve&&!this.curveGrip.ownsTarget(f))},s.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},s.prototype.createVisual=function(){this.visual=se.createGroup(),this.selectorCurve=se.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=se.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)},s.prototype.pointerDown=function(f,R){j.prototype.pointerDown.call(this,f,R),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=f.x,this.curveY=f.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(R)&&(this.activeGrip=this.curveGrip,this._state="resize")},s.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),se.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),se.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setupControlBox=function(){j.prototype.setupControlBox.call(this),this.curveControlLine1=se.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=se.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)},s.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,j.prototype.addControlGrips.call(this)},s.prototype.positionGrips=function(){j.prototype.positionGrips.call(this);var f=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-f/2,this.curveY-f/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()))},s.prototype.manipulate=function(f){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+f.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+f.y-this.manipulationStartY),j.prototype.manipulate.call(this,f)},s.prototype.resize=function(f){this.activeGrip===this.curveGrip&&(this.curveX=f.x,this.curveY=f.y),j.prototype.resize.call(this,f),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},s.prototype.setStrokeColor=function(f){this.strokeColor=f,this.adjustVisual(),this.colorChanged(f)},s.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.adjustVisual()},s.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.adjustVisual()},s.prototype.scale=function(f,R){this.curveX=this.curveX*f,this.curveY=this.curveY*R,j.prototype.scale.call(this,f,R)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},j.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){j.prototype.restoreState.call(this,f);var R=f;this.strokeColor=R.strokeColor,this.strokeWidth=R.strokeWidth,this.strokeDasharray=R.strokeDasharray,this.curveX=R.curveX,this.curveY=R.curveY,this.createVisual(),this.adjustVisual()},s.typeName="CurveMarker",s.title="Curve marker",s.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>',s}(Lt),Gt=function(){function j(s,f){f===void 0&&(f=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=s,this.cancelable=f}return Object.defineProperty(j.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),j.prototype.preventDefault=function(){this._defaultPrevented=!0},j}(),Kt=function(j){function s(f,R,Q){var F=j.call(this,f,!1)||this;return F.dataUrl=R,F.state=Q,F}return Ie(s,j),s}(Gt),Ct=function(j){function s(f,R,Q){Q===void 0&&(Q=!1);var F=j.call(this,f,Q)||this;return F.marker=R,F}return Ie(s,j),s}(Gt),pr=function(){function j(){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 j.prototype.addEventListener=function(s,f){this[s].push(f)},j.prototype.removeEventListener=function(s,f){var R=this[s].indexOf(f);R>-1&&this[s].splice(R,1)},j}(),rr=function(){function j(s){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Ne,this._isOpen=!1,this.undoRedoManager=new _t,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 pr,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=j.instanceCounter++,this.styles=new at(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=s,this.targetRoot=document.body,this.width=s.clientWidth,this.height=s.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(j.prototype,"ALL_MARKER_TYPES",{get:function(){return[vt,we,Ee,Ze,yt,Re,de,Se,Ge,re,Et,kt]},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[vt,we,Ee,Ze,Re,de,Se]},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"BASIC_MARKER_TYPES",{get:function(){return[vt,we,Ee,Ze,de]},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(s){var f=this;this._availableMarkerTypes.splice(0),s.forEach(function(R){if(typeof R=="string"){var Q=f.ALL_MARKER_TYPES.find(function(F){return F.typeName===R});Q!==void 0&&f._availableMarkerTypes.push(Q)}else f._availableMarkerTypes.push(R)})},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(s){this._zoomLevel=s,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(j.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),j.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),He.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},j.prototype.show=function(){var s=this;this.styles.styleSheetRoot===void 0&&it.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=it.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(f){return f(new Gt(s))})},j.prototype.render=function(){return Ue(this,void 0,void 0,function(){var s;return Pe(this,function(f){switch(f.label){case 0:return this.setCurrentMarker(),(s=new ht).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.markersOnly=this.renderMarkersOnly,s.width=this.renderWidth,s.height=this.renderHeight,[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return f.sent(),[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,f.sent()]}})})},j.prototype.close=function(s){var f=this;if(s===void 0&&(s=!1),this.isOpen){var R=!1;s||this.eventListeners.beforeclose.forEach(function(Q){var F=new Gt(f,!0);Q(F),F.defaultPrevented&&(R=!0)}),R||(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 Gt(f))}),this.detachEvents(),this._isOpen=!1)}},j.prototype.addMarkersToToolbar=function(){for(var s,f=[],R=0;R<arguments.length;R++)f[R]=arguments[R];(s=this._availableMarkerTypes).push.apply(s,f)},j.prototype.addRenderEventListener=function(s){this.addEventListener("render",function(f){s(f.dataUrl,f.state)})},j.prototype.removeRenderEventListener=function(s){},j.prototype.addCloseEventListener=function(s){this.addEventListener("close",function(){s()})},j.prototype.removeCloseEventListener=function(s){},j.prototype.setupResizeObserver=function(){var s=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){s.resize(s.target.clientWidth,s.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return s.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},j.prototype.onPopupTargetResize=function(){var s=1*this.target.clientWidth/this.target.clientHeight,f=this.editorCanvas.clientWidth/s>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*s:this.editorCanvas.clientWidth,R=f<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/s;this.resize(f,R)},j.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},j.prototype.resize=function(s,f){this._isResizing=!0;var R=s/this.imageWidth,Q=f/this.imageHeight;this.imageWidth=Math.round(s),this.imageHeight=Math.round(f),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(R,Q),this._isResizing=!1},j.prototype.scaleMarkers=function(s,f){var R,Q=this;this._currentMarker&&this._currentMarker instanceof Ze?this._currentMarker.scale(s,f):(R=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(F){F!==Q._currentMarker&&F.scale(s,f)}),R!==void 0&&this.setCurrentMarker(R)},j.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"},j.prototype.setTopLeft=function(){var s=this.editingTarget.getBoundingClientRect(),f=this.editorCanvas.getBoundingClientRect();this.left=s.left-f.left,this.top=s.top-f.top},j.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)},j.prototype.addDefs=function(){for(var s,f=[],R=0;R<arguments.length;R++)f[R]=arguments[R];this.defs=se.createDefs(),this.addDefsToImage(),(s=this.defs).append.apply(s,f)},j.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},j.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)},j.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},j.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},j.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)},j.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},j.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)},j.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 s=document.createElement("a");s.href="https://markerjs.com/",s.target="_blank",s.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>',s.title="Powered by marker.js",s.style.display="grid",s.style.alignItems="center",s.style.justifyItems="center",s.style.padding="3px",s.style.width="20px",s.style.height="20px",this.logoUI.appendChild(s),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},j.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")},j.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"},j.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},j.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 s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new Ye(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.settings.displayMode==="popup"&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.settings.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new rt(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},j.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},j.prototype.removeMarker=function(s){this.markerImage.removeChild(s.container),this.markers.indexOf(s)>-1&&this.markers.splice(this.markers.indexOf(s),1),s.dispose()},j.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())},j.prototype.toolbarButtonClicked=function(s,f){if(s==="marker"&&f!==void 0)this.createNewMarker(f);else if(s==="action")switch(f){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()}},j.prototype.deleteSelectedMarker=function(){var s=this;if(this._currentMarker!==void 0){var f=!1;if(this.eventListeners.markerbeforedelete.forEach(function(Q){var F=new Ct(s,s._currentMarker,!0);Q(F),F.defaultPrevented&&(f=!0)}),!f){var R=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 Ct(s,R))})}}},j.prototype.clear=function(){var s=this,f=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ve){var ze=new Ct(s,void 0,!0);ve(ze),ze.defaultPrevented&&(f=!0)}),!f)){this.setCurrentMarker();for(var R=function(ve){var ze=Q.markers[ve];Q.setCurrentMarker(Q.markers[ve]),Q._currentMarker.dispose(),Q.markerImage.removeChild(Q._currentMarker.container),Q.markers.splice(Q.markers.indexOf(Q._currentMarker),1),Q.eventListeners.markerdelete.forEach(function(lt){return lt(new Ct(s,ze))})},Q=this,F=this.markers.length-1;F>=0;F--)R(F);this.addUndoStep()}},Object.defineProperty(j.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),j.prototype.showNotesEditor=function(){var s;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=(s=this._currentMarker.notes)!==null&&s!==void 0?s:"",this.overlayContainer.appendChild(this.notesArea))},j.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)},j.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},j.prototype.addUndoStep=function(){var s=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var f=this.getState(),R=this.undoRedoManager.getLastUndoStep();if(!R||R.width===f.width&&R.height===f.height){var Q=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(f),Q<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(F){return F(new Gt(s))})}else this.undoRedoManager.replaceLastUndoStep(f),this.eventListeners.statechange.forEach(function(F){return F(new Gt(s))})}},j.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},j.prototype.undoStep=function(){var s=this,f=this.undoRedoManager.undo();f!==void 0&&(this.restoreState(f),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(R){return R(new Gt(s))}))},j.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},j.prototype.redoStep=function(){var s=this,f=this.undoRedoManager.redo();f!==void 0&&(this.restoreState(f),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(R){return R(new Gt(s))}))},j.prototype.stepZoom=function(){var s=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=s<this.zoomSteps.length-1?this.zoomSteps[s+1]:this.zoomSteps[0]},j.prototype.panTo=function(s){this.contentDiv.scrollBy({left:this.prevPanPoint.x-s.x,top:this.prevPanPoint.y-s.y}),this.prevPanPoint=s},j.prototype.startRenderAndClose=function(){return Ue(this,void 0,void 0,function(){var s,f,R=this;return Pe(this,function(Q){switch(Q.label){case 0:return[4,this.render()];case 1:return s=Q.sent(),f=this.getState(),this.eventListeners.render.forEach(function(F){return F(new Kt(R,s,f))}),this.close(!0),[2]}})})},j.prototype.getState=function(s){s===!0&&this.setCurrentMarker();var f={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(R){return f.markers.push(R.getState())}),f},j.prototype.restoreState=function(s){var f=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);s.markers.forEach(function(R){var Q=f._availableMarkerTypes.find(function(ve){return ve.typeName===R.typeName});if(Q!==void 0){var F=f.addNewMarker(Q);F.restoreState(R),f.markers.push(F)}}),s.width&&s.height&&(s.width!==this.imageWidth||s.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/s.width,this.imageHeight/s.height),this.eventListeners.restorestate.forEach(function(R){return R(new Gt(f))})},j.prototype.addNewMarker=function(s){var f=se.createGroup();return this.markerImage.appendChild(f),new s(f,this.overlayContainer,this.settings)},j.prototype.createNewMarker=function(s){var f,R=this;(f=typeof s=="string"?this._availableMarkerTypes.find(function(Q){return Q.typeName===s}):s)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(f),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(f.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(Q){return Q(new Ct(R,R._currentMarker))}))},j.prototype.markerCreated=function(s){var f=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(s),this.setCurrentMarker(s),s instanceof we&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(we):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(R){return R(new Ct(f,f._currentMarker))})},j.prototype.colorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=s,this.settings.defaultStrokeColor=s)},j.prototype.fillColorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=s)},j.prototype.markerStateChanged=function(s){var f=this;this.eventListeners.markerchange.forEach(function(R){return R(new Ct(f,s))})},j.prototype.setCurrentMarker=function(s){var f=this;this._currentMarker!==s&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(R){return R(new Ct(f,f._currentMarker))})),this._currentMarker=s,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(R){return R(new Ct(f,f._currentMarker))}))},j.prototype.onPointerDown=function(s){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||s.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var f=this.markers.find(function(R){return R.ownsTarget(s.target)});f!==void 0?(this.setCurrentMarker(f),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:s.clientX,y:s.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(s.clientX,s.clientY))},j.prototype.onDblClick=function(s){if(this._isFocused||this.focus(),this.mode==="select"){var f=this.markers.find(function(R){return R.ownsTarget(s.target)});f!==void 0&&f!==this._currentMarker&&this.setCurrentMarker(f),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target):this.setCurrentMarker()}},j.prototype.onPointerMove=function(s){this.touchPoints!==1&&s.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||s.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(s.clientX,s.clientY)):this.zoomLevel>1&&this.panTo({x:s.clientX,y:s.clientY}))},j.prototype.onPointerUp=function(s){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(s.clientX,s.clientY)),this.isDragging=!1,this.addUndoStep()},j.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},j.prototype.onKeyUp=function(s){this._currentMarker===void 0||this.notesArea!==void 0||s.key!=="Delete"&&s.key!=="Backspace"||this.deleteSelectedMarker()},j.prototype.clientToLocalCoordinates=function(s,f){var R=this.markerImage.getBoundingClientRect();return{x:(s-R.left)/this.zoomLevel,y:(f-R.top)/this.zoomLevel}},j.prototype.onWindowResize=function(){this.positionUI()},j.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"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()},j.prototype.addLicenseKey=function(s){He.addKey(s)},j.prototype.addEventListener=function(s,f){this.eventListeners.addEventListener(s,f)},j.prototype.removeEventListener=function(s,f){this.eventListeners.removeEventListener(s,f)},j.prototype.renderState=function(s){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(s),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(j.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),j.prototype.focus=function(){var s=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(f){return f(new Gt(s))}))},j.prototype.blur=function(){var s=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(f){return f(new Gt(s))}))},j.instanceCounter=0,j}();/* **********************************
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 Ir=function(j,s){return(Ir=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,R){f.__proto__=R}||function(f,R){for(var Q in R)Object.prototype.hasOwnProperty.call(R,Q)&&(f[Q]=R[Q])})(j,s)};function Pr(j,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function f(){this.constructor=j}Ir(j,s),j.prototype=s===null?Object.create(s):(f.prototype=s.prototype,new f)}function Vt(j,s,f,R){return new(f||(f=Promise))(function(Q,F){function ve(At){try{lt(R.next(At))}catch(Xe){F(Xe)}}function ze(At){try{lt(R.throw(At))}catch(Xe){F(Xe)}}function lt(At){var Xe;At.done?Q(At.value):(Xe=At.value,Xe instanceof f?Xe:new f(function(Rt){Rt(Xe)})).then(ve,ze)}lt((R=R.apply(j,s||[])).next())})}function an(j,s){var f,R,Q,F,ve={label:0,sent:function(){if(1&Q[0])throw Q[1];return Q[1]},trys:[],ops:[]};return F={next:ze(0),throw:ze(1),return:ze(2)},typeof Symbol=="function"&&(F[Symbol.iterator]=function(){return this}),F;function ze(lt){return function(At){return function(Xe){if(f)throw new TypeError("Generator is already executing.");for(;ve;)try{if(f=1,R&&(Q=2&Xe[0]?R.return:Xe[0]?R.throw||((Q=R.return)&&Q.call(R),0):R.next)&&!(Q=Q.call(R,Xe[1])).done)return Q;switch(R=0,Q&&(Xe=[2&Xe[0],Q.value]),Xe[0]){case 0:case 1:Q=Xe;break;case 4:return ve.label++,{value:Xe[1],done:!1};case 5:ve.label++,R=Xe[1],Xe=[0];continue;case 7:Xe=ve.ops.pop(),ve.trys.pop();continue;default:if(!(Q=ve.trys,(Q=Q.length>0&&Q[Q.length-1])||Xe[0]!==6&&Xe[0]!==2)){ve=0;continue}if(Xe[0]===3&&(!Q||Xe[1]>Q[0]&&Xe[1]<Q[3])){ve.label=Xe[1];break}if(Xe[0]===6&&ve.label<Q[1]){ve.label=Q[1],Q=Xe;break}if(Q&&ve.label<Q[2]){ve.label=Q[2],ve.ops.push(Xe);break}Q[2]&&ve.ops.pop(),ve.trys.pop();continue}Xe=s.call(j,ve)}catch(Rt){Xe=[6,Rt],R=0}finally{f=Q=0}if(5&Xe[0])throw Xe[1];return{value:Xe[0]?Xe[1]:void 0,done:!0}}([lt,At])}}}var En=function(){function j(){}return j.addKey=function(s){j.key=s},Object.defineProperty(j,"isLicensed",{get:function(){return!!j.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(j.key)},enumerable:!1,configurable:!0}),j}(),It=function(){function j(){}return j.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},j.setAttributes=function(s,f){for(var R=0,Q=f;R<Q.length;R++){var F=Q[R],ve=F[0],ze=F[1];s.setAttribute(ve,ze)}},j.createRect=function(s,f,R){var Q=document.createElementNS("http://www.w3.org/2000/svg","rect");return Q.setAttribute("width",s.toString()),Q.setAttribute("height",f.toString()),R&&j.setAttributes(Q,R),Q},j.createLine=function(s,f,R,Q,F){var ve=document.createElementNS("http://www.w3.org/2000/svg","line");return ve.setAttribute("x1",s.toString()),ve.setAttribute("y1",f.toString()),ve.setAttribute("x2",R.toString()),ve.setAttribute("y2",Q.toString()),F&&j.setAttributes(ve,F),ve},j.createPolygon=function(s,f){var R=document.createElementNS("http://www.w3.org/2000/svg","polygon");return R.setAttribute("points",s),f&&j.setAttributes(R,f),R},j.createCircle=function(s,f){var R=document.createElementNS("http://www.w3.org/2000/svg","circle");return R.setAttribute("cx",(s/2).toString()),R.setAttribute("cy",(s/2).toString()),R.setAttribute("r",s.toString()),f&&j.setAttributes(R,f),R},j.createEllipse=function(s,f,R){var Q=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return Q.setAttribute("cx",(s/2).toString()),Q.setAttribute("cy",(f/2).toString()),Q.setAttribute("rx",(s/2).toString()),Q.setAttribute("ry",(f/2).toString()),R&&j.setAttributes(Q,R),Q},j.createGroup=function(s){var f=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&j.setAttributes(f,s),f},j.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},j.createMarker=function(s,f,R,Q,F,ve,ze){var lt=document.createElementNS("http://www.w3.org/2000/svg","marker");return j.setAttributes(lt,[["id",s],["orient",f],["markerWidth",R.toString()],["markerHeight",Q.toString()],["refX",F.toString()],["refY",ve.toString()]]),lt.appendChild(ze),lt},j.createText=function(s){var f=document.createElementNS("http://www.w3.org/2000/svg","text");return f.setAttribute("x","0"),f.setAttribute("y","0"),s&&j.setAttributes(f,s),f},j.createTSpan=function(s,f){var R=document.createElementNS("http://www.w3.org/2000/svg","tspan");return R.textContent=s,f&&j.setAttributes(R,f),R},j.createImage=function(s){var f=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&j.setAttributes(f,s),f},j.createPoint=function(s,f){var R=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return R.x=s,R.y=f,R},j.createPath=function(s,f){var R=document.createElementNS("http://www.w3.org/2000/svg","path");return R.setAttribute("d",s),f&&j.setAttributes(R,f),R},j.createElement=function(s,f){var R=document.createElementNS("http://www.w3.org/2000/svg",s);return f&&j.setAttributes(R,f),R},j.getHollowRectanglePath=function(s,f,R,Q,F,ve,ze,lt){return"M"+s+","+f+"V"+(f+Q)+"H"+(s+R)+"V"+f+"H"+F+"V"+ve+"H"+(F+ze)+"V"+(ve+lt)+"H"+F+"V"+f+"Z"},j}(),An=function(){function j(s){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}return Object.defineProperty(j.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(j.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(j.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),j.prototype.addClass=function(s){return this.styleSheet===void 0&&this.addStyleSheet(),s.name=""+this.classNamePrefix+s.localName,this.classes.push(s),this.styleSheet.sheet.insertRule("."+s.name+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length),s},j.prototype.addRule=function(s){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(s),this.styleSheet.sheet.insertRule(s.selector+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length)},j.prototype.addStyleSheet=function(){var s;this.styleSheet=document.createElement("style"),((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).appendChild(this.styleSheet),this.addRule(new on("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new on("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new on("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new sn("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new sn("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},j.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},j}(),on=function(j,s){this.selector=j,this.style=s},sn=function(j,s){this.localName=j,this.style=s},Un=function(){function j(){this.blocks=[],this.display=""}return j.prototype.addButtonBlock=function(s){s.className=this.blockClassName,s.buttonClassName=this.buttonClassName,s.buttonColorsClassName=this.buttonColorsClassName,s.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(s)},j.prototype.addElementBlock=function(s){s.className===void 0&&(s.className=this.blockClassName),this.blocks.push(s)},j.prototype.getUI=function(){var s=document.createElement("div");return s.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,s.style.display=this.display,this.blocks.forEach(function(f){return s.appendChild(f.getUI())}),s},j}(),ci=function(){function j(){}return j.prototype.getUI=function(){var s=document.createElement("div");if(s.className=this.className,this.minWidth!==void 0&&(s.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":s.style.justifyContent="flex-start";break;case"center":s.style.justifyContent="center";break;case"end":s.style.justifyContent="flex-end"}return s.style.whiteSpace="nowrap",s},j}(),Qn=function(j){function s(){var f=j!==null&&j.apply(this,arguments)||this;return f.buttons=[],f}return Pr(s,j),s.prototype.addButton=function(f){f.className=this.buttonClassName,f.colorsClassName=this.buttonColorsClassName,f.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(f)},s.prototype.getUI=function(){var f=j.prototype.getUI.call(this);return this.buttons.forEach(function(R){return f.appendChild(R.getUI())}),f},s}(ci),mr=function(){function j(s,f){this._isActive=!1,this._isHidden=!1,this._icon=s,this.title=f,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(j.prototype,"icon",{get:function(){return this._icon},set:function(s){this._icon=s,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isActive",{get:function(){return this._isActive},set:function(s){this._isActive=s,this.adjustClassName()},enumerable:!1,configurable:!0}),j.prototype.getUI=function(){var s=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 s.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},j.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,"")))},j.prototype.hide=function(){this._isHidden=!0},j}(),wt=function(j){function s(){var f=j!==null&&j.apply(this,arguments)||this;return f.elements=[],f}return Pr(s,j),s.prototype.addElement=function(f){this.elements.push(f)},s.prototype.getUI=function(){var f=j.prototype.getUI.call(this);return this.elements.forEach(function(R){return f.appendChild(R)}),f},s}(ci),Vn=function(){function j(s,f){this.horizontal=s,this.vertical=f}return Object.defineProperty(j.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),j.prototype.getVerticalLength=function(s){return s/this.ratio},j.prototype.getHorizontalLength=function(s){return s*this.ratio},j}(),oi=function(){function j(){}return j.getIcon=function(s,f){if(s>0&&f>0){var R=new Vn(s,f),Q=R.ratio>=1?20:R.getHorizontalLength(20),F=R.ratio<1?20:R.getVerticalLength(20),ve=document.createElementNS("http://www.w3.org/2000/svg","svg");ve.setAttribute("xmlns","http://www.w3.org/2000/svg"),ve.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ve);var ze=It.createDefs();ve.appendChild(ze);var lt=It.createElement("clipPath",[["id","text-bg-clip"]]);ze.appendChild(lt);var At=It.createPath(It.getHollowRectanglePath((24-Q)/2,(24-F)/2,Q,F,(24-Q)/2+2,(24-F)/2+2,Q-4,F-4));ve.appendChild(At);var Xe=It.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Xe.appendChild(It.createTSpan(s+":"+f)),ve.appendChild(Xe);var Rt=Xe.getBBox();It.setAttributes(Xe,[["x",((24-Rt.width)/2).toString()],["y",((24-Rt.height)/2-Rt.y).toString()]]);var gr=It.createPath(It.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Rt.width))/2,(24-Math.ceil(Rt.height))/2,Math.ceil(Rt.width),Math.ceil(Rt.height)));return lt.appendChild(gr),It.setAttributes(At,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ve),ve.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},j}(),mn=function(j){function s(f,R,Q){var F=j.call(this,f,R)||this;return F.isDropdownOpen=!1,F.onClick=F.dropdownButtonClicked,F.dropdownButtons=Q,F}return Pr(s,j),s.prototype.setupDropdown=function(){var f=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(R){R.className=f.className,R.colorsClassName=f.colorsClassName,f.dropdownBlock.appendChild(R.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},s.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},s.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},s.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},s.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},s.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},s}(mr),nr=function(){function j(s,f){this.GRIP_SIZE=10,this.color=s,this.fillColor=f,this.visual=It.createGroup(),this.visual.appendChild(It.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(It.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return j.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},j.prototype.setCenter=function(s,f){this.visual.childNodes.forEach(function(R){return It.setAttributes(R,[["cx",s.toString()],["cy",f.toString()]])})},j}(),Bn=function(){function j(s,f,R,Q){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=s,this.canvasHeight=f,this.margin=R,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(j.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(s){this._aspectRatio=s,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.gridContainer&&It.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(s){this._zoomFactor=s,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),j.prototype.open=function(){var s=this;this.cropShadeElement=It.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=It.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var f=0;f<this.numberOfGridLines;f++)this.horizontalGridLines.push(It.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(It.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(R){return s.gridContainer.appendChild(R)}),this.verticalGridLines.forEach(function(R){return s.gridContainer.appendChild(R)}),this.cropRectElement=It.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new nr(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new nr(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new nr(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new nr(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},j.prototype.setCropRectangle=function(s){this.cropRect=s;var f=Object.assign({},this.cropRect);this.zoomFactor!==1&&(f.width=this.cropRect.width*this.zoomFactor,f.height=this.cropRect.height*this.zoomFactor,f.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-f.width/2,f.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-f.height/2),It.setAttributes(this.cropRectElement,[["x",f.x.toString()],["y",f.y.toString()],["width",f.width.toString()],["height",f.height.toString()]]);var R=f.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(F,ve){var ze=f.y+R*(ve+1);It.setAttributes(F,[["x1",""+f.x],["y1",""+ze],["x2",""+(f.x+f.width)],["y2",""+ze]])});var Q=f.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(F,ve){var ze=f.x+Q*(ve+1);It.setAttributes(F,[["x1",""+ze],["y1",""+f.y],["x2",""+ze],["y2",""+(f.y+f.height)]])}),It.setAttributes(this.cropShadeElement,[["d",It.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,f.x,f.y,f.width,f.height)]]),this.topLeftGrip.setCenter(f.x,f.y),this.topRightGrip.setCenter(f.x+f.width,f.y),this.bottomLeftGrip.setCenter(f.x,f.y+f.height),this.bottomRightGrip.setCenter(f.x+f.width,f.y+f.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},j.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)},j.prototype.clientToLocalCoordinates=function(s,f){var R=this.container.getBoundingClientRect();return{x:s-R.left+this.margin,y:f-R.top+this.margin}},j.prototype.onPointerDown=function(s){this.container.setPointerCapture(s.pointerId),this.previousPoint=this.clientToLocalCoordinates(s.clientX,s.clientY),this.cropRectElement===s.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(s.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(s.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(s.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(s.target)&&(this.activeGrip=this.bottomRightGrip)},j.prototype.onPointerMove=function(s){if(this.isMoving)this.move(this.clientToLocalCoordinates(s.clientX,s.clientY));else if(this.activeGrip){var f=this.clientToLocalCoordinates(s.clientX,s.clientY);this.resize(f)}s.preventDefault()},j.prototype.onPointerUp=function(s){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(s.pointerId)},j.prototype.move=function(s){var f=s.x-this.previousPoint.x,R=s.y-this.previousPoint.y;this.zoomFactor!==1&&(f=-f/this.zoomFactor,R=-R/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+f),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+R),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=s},j.prototype.resize=function(s){var f=Object.assign({},this.cropRect),R=s.x-this.previousPoint.x,Q=s.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:f.x+R<this.margin&&(R=this.margin-f.x),f.x+=R,f.width=this.cropRect.x+this.cropRect.width-f.x;break;case this.bottomRightGrip:case this.topRightGrip:f.width+R>this.canvasWidth*this.zoomFactor&&(R=this.canvasWidth*this.zoomFactor-f.width),f.width+=R}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(f.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(R),f.height=this.aspectRatio.getVerticalLength(f.width)):(f.y+=Q,f.height=this.cropRect.y+this.cropRect.height-f.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?f.height=this.aspectRatio.getVerticalLength(f.width):f.height+=Q}f.width<10&&(f.x=this.cropRect.x,f.width=10),f.height<10&&(f.y=this.cropRect.y,f.height=10),this.previousPoint=s,f.x>=this.margin&&f.y>=this.margin&&f.x-this.margin+f.width<=this.canvasWidth&&f.y-this.margin+f.height<=this.canvasHeight&&(this.cropRect=f,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},j.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var s=this.cropRect.x+this.cropRect.width/2,f=this.cropRect.y+this.cropRect.height/2,R=this.aspectRatio.getHorizontalLength(this.cropRect.height),Q=this.aspectRatio.getVerticalLength(this.cropRect.width);R/this.canvasWidth<Q/this.canvasHeight?this.cropRect.width=R: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=s-this.cropRect.width/2,this.cropRect.y=f-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)}},j.prototype.getRescaledRect=function(s,f,R,Q,F,ve){var ze=R/s,lt=Q/f;return{x:(F.x-ve)*ze+ve,y:(F.y-ve)*lt+ve,width:F.width*ze,height:F.height*lt}},j.prototype.scaleCanvas=function(s,f){var R=this.getRescaledRect(this.canvasWidth,this.canvasHeight,s,f,this.cropRect,this.margin);this.canvasWidth=s,this.canvasHeight=f,this.onCropChange&&this.onCropChange(R),this.setCropRectangle(R)},j}(),Zn=function(){function j(s){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=s,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(j.prototype,"angle",{get:function(){return this._angle},set:function(s){this._angle=s,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),j.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},j.prototype.onPointerDown=function(s){this.controlContainer.setPointerCapture(s.pointerId),this.isDragging=!0,this.previousPoint={x:s.clientX,y:s.clientY}},j.prototype.onPointerMove=function(s){this.isDragging&&(this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.previousPoint.x=s.clientX)},j.prototype.onPointerUp=function(s){this.isDragging&&this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(s.pointerId)},j.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var s=this.angleLabelText.getBBox();It.setAttributes(this.angleLabelElement,[["x",((this.width-s.width)/2).toString()],["y",(this.height/2).toString()]])}},j.prototype.positionScaleShape=function(){if(this.scaleShape){var s=this.scaleShape.transform.baseVal.getItem(0);s.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(s,0)}},j.prototype.getVisual=function(){var s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width",this.width+"px"),s.setAttribute("height",this.height+"px"),s.setAttribute("viewBox","0 0 "+this.width+" "+this.height),s.style.flexShrink="0",document.body.appendChild(s);for(var f="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,R=1;R<=this.width/5+10;R++){var Q=R%5==0?this.height/3:this.height/6;f+="h4v"+-Q+"h1v"+Q}f+="v1H0Z",this.scaleShape=It.createPath(f);var F=It.createTransform();this.scaleShape.transform.baseVal.appendItem(F),s.appendChild(this.scaleShape),this.angleLabelElement=It.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=It.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ve=It.createTSpan("");return ve.innerHTML="&deg;",this.angleLabelElement.appendChild(ve),s.appendChild(this.angleLabelElement),document.body.removeChild(s),s},j}(),hi=function(){function j(){this.naturalSize=!1,this.imageType="image/png"}return j.prototype.rasterize=function(s,f,R,Q,F,ve,ze){var lt=this;return new Promise(function(At){var Xe=document.createElement("canvas");Xe.width=s.width.baseVal.value-2*Q,Xe.height=s.height.baseVal.value-2*Q;var Rt=1,gr=1;lt.naturalSize===!0?(Rt=f.naturalWidth/(s.width.baseVal.value-2*Q)/ve,gr=f.naturalHeight/(s.height.baseVal.value-2*Q)/ze,Xe.width=f.naturalWidth/ve,Xe.height=f.naturalHeight/ze):lt.width!==void 0&&lt.height!==void 0&&(Rt=lt.width/R.width,gr=lt.height/R.height,Xe.width*=Rt,Xe.height*=gr);var Dr=Xe.getContext("2d");Dr.translate(Xe.width/2,Xe.height/2),Dr.rotate(F*Math.PI/180),Dr.scale(ve,ze),Dr.translate(-Xe.width/2,-Xe.height/2),Dr.drawImage(f,0,0,Xe.width,Xe.height);var Ln=document.createElement("canvas");Ln.width=R.width*Rt,Ln.height=R.height*gr,Ln.getContext("2d").putImageData(Dr.getImageData((R.x-Q)*Rt,(R.y-Q)*gr,R.width*Rt,R.height*gr),0,0),At(Ln.toDataURL(lt.imageType,lt.imageQuality))})},j}(),Je=function(){function j(s){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=j.instanceCounter++,this.styles=new An(this.instanceNo),this.target=s,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(j.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(s){this._zoomToCropEnabled=s,s?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"gridLines",{get:function(){return this._gridLines},set:function(s){this._gridLines=s,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(s){this._rotationAngle=s,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"aspectRatio",{get:function(){var s;return(s=this._aspectRatio)!==null&&s!==void 0?s:this.aspectRatios[0]},set:function(s){this._aspectRatio=s},enumerable:!1,configurable:!0}),j.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},j.prototype.show=function(){this.showUI(),this.open()},j.prototype.close=function(s){s===void 0&&(s=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),s||this.closeEventListeners.forEach(function(f){return f()}),this._isOpen=!1)},j.prototype.addRenderEventListener=function(s){this.renderEventListeners.push(s)},j.prototype.removeRenderEventListener=function(s){this.renderEventListeners.indexOf(s)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(s),1)},j.prototype.addCloseEventListener=function(s){this.closeEventListeners.push(s)},j.prototype.removeCloseEventListener=function(s){this.closeEventListeners.indexOf(s)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(s),1)},j.prototype.setupResizeObserver=function(){var s=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){s.resize(s.target.clientWidth,s.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))},j.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var s=1*this.target.clientWidth/this.target.clientHeight,f=this.contentDiv.clientWidth/s>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*s:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,R=f+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/s;this.resize(f,R)}},j.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},j.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",It.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},j.prototype.resize=function(s,f){this.imageWidth=Math.round(s),this.imageHeight=Math.round(f),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()},j.prototype.setEditingTarget=function(){var s=document.createElement("canvas");s.width=this.target.naturalWidth,s.height=this.target.naturalHeight,s.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var f=s.toDataURL();It.setAttributes(this.editingTarget,[["href",f]]),this.setEditingTargetSize()},j.prototype.setTopLeft=function(){var s=this.target.getBoundingClientRect(),f=this.editorCanvas.getBoundingClientRect();this.left=s.left-f.left-this.CANVAS_MARGIN,this.top=s.top-f.top-this.CANVAS_MARGIN},j.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=It.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=It.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=It.createGroup(),this.editingTargetRotationScaleContainer=It.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var s=It.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(s);var f=It.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(f),this.editingTargetContainer=It.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)},j.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},j.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=It.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Bn(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()},j.prototype.zoomToCrop=function(){if(this.cropRect){var s=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,f=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=s+"px "+f+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-s+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-f+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},j.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)},j.prototype.cropRectChanged=function(s){this.cropRect=s,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},j.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},j.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"},j.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},j.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 s=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,f=this.target.offsetTop>s+this.CANVAS_MARGIN?this.target.offsetTop-(s+this.CANVAS_MARGIN):0;this.coverDiv.style.top=f+"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},j.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},j.prototype.addTopToolbar=function(){var s=this;this.topToolbar=new Un,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 f=new Qn;f.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(f);var R=[];this.aspectRatios.forEach(function(gr){var Dr=new mr(oi.getIcon(gr.horizontal,gr.vertical),gr.horizontal===0&&gr.vertical===0?"FREE":gr.horizontal+":"+gr.vertical);Dr.onClick=function(){return s.ratioButtonClicked(gr)},R.push(Dr)}),this.aspectRatioButton=new mn(oi.getIcon(0,0),"Aspect ratio",R),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,f.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var Q=new mr('<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(){s.isGridVisible=!s.isGridVisible,Q.isActive=s.isGridVisible},f.addButton(Q);var F=new mr('<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(F.isActive=this.zoomToCropEnabled,F.onClick=function(){s.zoomToCropEnabled=!s.zoomToCropEnabled,F.isActive=s.zoomToCropEnabled},f.addButton(F),!En.isLicensed){var ve=new wt;this.topToolbar.addElementBlock(ve);var ze=document.createElement("div");ze.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var lt=document.createElement("a");lt.style.color="currentColor",lt.href="https://markerjs.com/products/cropro",lt.target="_blank",lt.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>',ze.appendChild(lt),ve.addElement(ze)}var At=new Qn;At.minWidth=3*this.toolbarHeight+"px",At.contentAlign="end",this.topToolbar.addButtonBlock(At);var Xe=new mr('<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");Xe.onClick=this.startRenderAndClose,At.addButton(Xe),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Xe.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Rt=new mr('<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");Rt.onClick=this.close,At.addButton(Rt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Rt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},j.prototype.addBottomToolbar=function(){var s=this;this.bottomToolbar=new Un,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 f=new Qn;f.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(f);var R=new mr('<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");R.onClick=this.rotateLeftButtonClicked,f.addButton(R);var Q=new mr('<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,f.addButton(Q);var F=new wt;F.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(F),this.straightener=new Zn("Straighten"),this.straightener.className=this.toolbarStraightenerStyleClass.name,this.straightener.colorsClassName=this.styles.settings.toolbarStraightenerColorsClassName?this.styles.settings.toolbarStraightenerColorsClassName:this.toolbarStraightenerStyleColorsClass.name,this.straightener.onAngleChange=function(At){s.rotateBy(At),s.straightener.angle=s.rotationAngle},F.addElement(this.straightener.getUI());var ve=new Qn;ve.minWidth=2*this.toolbarHeight+"px",ve.contentAlign="end",this.bottomToolbar.addButtonBlock(ve);var ze=new mr('<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");ze.onClick=this.flipHorizontallyButtonClicked,ve.addButton(ze);var lt=new mr('<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");lt.onClick=this.flipVerticallyButtonClicked,ve.addButton(lt)},j.prototype.ratioButtonClicked=function(s){this.aspectRatio=s,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},j.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=oi.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},j.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Vn(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},j.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},j.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},j.prototype.restoreState=function(s){if(s){var f=this.cropLayer.getRescaledRect(s.width,s.height,this.imageWidth,this.imageHeight,s.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(f),this.cropRectChanged(f),this.flippedHorizontally=s.flippedHorizontally,this.flippedVertically=s.flippedVertically,this.applyFlip(),this.rotationAngle=s.rotationAngle,this.applyRotation()}},j.prototype.clientToLocalCoordinates=function(s,f){var R=this.cropImage.getBoundingClientRect();return{x:s-R.left,y:f-R.top}},j.prototype.onWindowResize=function(){this.positionUI()},j.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var s=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=s+"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()},j.prototype.rotateLeftButtonClicked=function(){var s=this.rotationAngle-90;this.rotationAngle%90!=0&&(s+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(s)},j.prototype.rotateRightButtonClicked=function(){var s=this.rotationAngle+90;this.rotationAngle%90!=0&&(s-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(s)},j.prototype.rotateTo=function(s){s=(s=s>180?s-360:s)<=-180?s+360:s,this.rotationAngle=s,this.applyRotation()},j.prototype.rotateBy=function(s){this.rotateTo((this.rotationAngle+s)%360)},j.prototype.applyRotation=function(){var s=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var f=this.editingTargetRotationContainer.transform.baseVal.getItem(0);f.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(f,0);var R=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/R.width,this.imageHeight/R.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=s},j.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},j.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},j.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},j.prototype.startRenderAndClose=function(){return Vt(this,void 0,void 0,function(){var s,f;return an(this,function(R){switch(R.label){case 0:return[4,this.render()];case 1:return s=R.sent(),f=this.getState(),this.renderEventListeners.forEach(function(Q){return Q(s,f)}),this.close(!0),[2]}})})},j.prototype.render=function(){return Vt(this,void 0,void 0,function(){var s;return an(this,function(f){switch(f.label){case 0:return(s=new hi).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.width=this.renderWidth,s.height=this.renderHeight,this.unzoomFromCrop(),It.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,s.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 f.sent(),[4,s.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,f.sent()]}})})},j.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new sn("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 sn("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new sn("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var s=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new sn("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*s)+`px;
height: `+(this.toolbarHeight-2*s)+`px;
padding: `+s+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new sn("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new sn("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new on("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new on("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new sn("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 sn("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new sn("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 sn("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*s)+`px;
padding: `+s+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new sn("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},j.instanceCounter=0,j}(),jt=ie("8hTe"),si=ie.n(jt),fi=/<pre[^>]*>/g;function Si(j){var s=document.createElement("div");return s.innerHTML=j,s.childNodes.length===0?"":s.childNodes[0].nodeValue}var li=gt.a=function(j){var s=j.value,f=s===void 0?"":s,R=j.edit,Q=R===void 0?!1:R,F=j.className,ve=j.showTextOnly,ze=j.showLines,lt=j.replaces,At=j.zoomImg,Xe=j.hasMask,Rt=j.style,gr=Rt===void 0?{}:Rt,Dr=j.stylesPrev,Ln=Dr===void 0?{}:Dr,gn=String(f),ln=Object(_.useRef)(),Jn=Object(_.useRef)(),Pi=Object(_.useState)(""),Qr=Object(H.a)(Pi,2),Fn=Qr[0],pi=Qr[1],ui=Object(_.useState)("office"),Sn=Object(H.a)(ui,2),Ii=Sn[0],Ci=Sn[1],Gi=function(){var vr=new Je(Jn.current);vr.displayMode="popup",vr.addRenderEventListener(function(){var Kr=Object(P.a)(I.a.mark(function qt(zr){var Sr;return I.a.wrap(function(tn){for(;;)switch(tn.prev=tn.next){case 0:return ln.current.style.display="none",tn.next=3,Object(Ke.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:zr}});case 3:Sr=tn.sent,Sr!=null&&Sr.id&&lt(Jn.current.getAttribute("src").replace(ue.a.API_SERVER,""),"/api/attachments/".concat(Sr==null?void 0:Sr.id,"?type=").concat(Sr.content_type));case 5:case"end":return tn.stop()}},qt)}));return function(qt){return Kr.apply(this,arguments)}}()),vr.show()},Vi=function(){var vr=new rr(Jn.current);vr.settings.displayMode="popup",vr.addEventListener("render",function(){var Kr=Object(P.a)(I.a.mark(function qt(zr){var Sr;return I.a.wrap(function(tn){for(;;)switch(tn.prev=tn.next){case 0:if(ln.current.style.display="none",!Jn.current){tn.next=6;break}return tn.next=4,Object(Ke.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:zr.dataUrl}});case 4:Sr=tn.sent,Sr!=null&&Sr.id&&lt(Jn.current.getAttribute("src").replace(ue.a.API_SERVER,""),"/api/attachments/".concat(Sr==null?void 0:Sr.id,"?type=").concat(Sr.content_type));case 6:case"end":return tn.stop()}},qt)}));return function(qt){return Kr.apply(this,arguments)}}()),vr.show(),window.markerArea=vr},qn=Object(_.useMemo)(function(){ln.current&&(ln.current.style.zIndex=-1);try{var Fr=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,vr=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Kr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;gn=gn.replace(Fr,"("+ue.a.API_SERVER+"/api/attachments/").replace(vr,'"'+ue.a.API_SERVER+"/api/attachments/").replace(Kr,'"'+ue.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(ei){}var qt=ee(gn),zr=S();if(gn.match(/\[TOC\]/)&&(qt=qt.replace("<p>[TOC]</p>",k()),E()),qt=qt.replace(/(__special_katext_id_\d+__)/g,function(ei,tn){var vn=zr[tn],Xi=vn.type,Ti=vn.expression;return Object(be.renderToString)(Si(Ti)||"",{displayMode:Xi==="block",throwOnError:!1,output:"html"})}),qt=qt.replace(/▁/g,"\u2581\u2581\u2581"),y(),ve){var Sr=document.createElement("div");return Sr.innerHTML=qt,Sr.innerText}return setTimeout(function(){return oa()},500),qt},[gn]),en=Object(_.useRef)();v.WebkitLineClamp=ze,ze&&(gr=Object(w.a)(Object(w.a)({},gr),v));function mi(Fr){var vr=Fr.target;if(vr.tagName.toUpperCase()==="IMG"){if(At){var Kr=vr.getAttribute("src");pi(Kr),Ci("image")}}else if(vr.tagName.toUpperCase()==="A"){var qt=vr.getAttribute("href");if(qt.indexOf("office")>-1)Fr.preventDefault(),pi(qt),Ci("office");else if(qt.indexOf("application/pdf")>-1)Fr.preventDefault(),pi(qt),Ci("pdf");else if(qt.indexOf("text/html")>-1)Fr.preventDefault(),pi(qt),Ci("html");else if(qt.startsWith("#")){Fr.preventDefault();var zr=document.getElementById(qt.replace("#",""));zr&&zr.scrollIntoView(!0)}}}var oa=function(){var vr,Kr=(vr=en.current)===null||vr===void 0?void 0:vr.querySelectorAll("video");Kr==null||Kr.forEach(function(qt){if(qt.oncontextmenu=function(){return!1},qt.src.indexOf(".m3u8")>-1&&!qt.canPlayType("application/vnd.apple.mpegurl")){if(te.a.isSupported()){var zr=new te.a;zr.loadSource(qt.src),zr.attachMedia(qt)}}})};Object(_.useEffect)(function(){if(en.current&&qn&&(qn.match(fi)&&window.PR.prettyPrint()),en.current)return en.current.addEventListener("click",mi),function(){en.current.removeEventListener("click",mi),y(),E()}},[qn,en.current,mi]);var Ni=function(vr){if(!Q)return;vr.target.nodeName==="IMG"?(ln.current.style.zIndex=1,ln.current.style.display="flex",ln.current.style.width=vr.target.clientWidth+"px",ln.current.style.height=vr.target.clientHeight+"px",ln.current.style.top=vr.target.offsetTop+"px",ln.current.style.left=vr.target.offsetLeft+"px",Jn.current.src=vr.target.getAttribute("src")):ln.current.style.display="none"};return x.a.createElement("div",{style:{position:"relative"}},x.a.createElement("div",{ref:en,style:Object(w.a)({},gr),className:"".concat(F||""," markdown-body ").concat(si.a.mdBody),onMouseOver:Ni,dangerouslySetInnerHTML:{__html:qn}}),x.a.createElement("div",{ref:ln,className:si.a.button},x.a.createElement(X.a,null,x.a.createElement(K.a,{onClick:function(){return Gi()}},"\u88C1\u526A"),x.a.createElement(K.a,{onClick:function(){return Vi()}},"\u7F16\u8F91"))),x.a.createElement("img",{ref:Jn,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),x.a.createElement(Oe.a,{close:!0,data:Fn,type:Fn!=null&&Fn.length?Ii:"",style:Object(w.a)({},Ln),onClose:function(){return pi("")}}))}},"9VGf":function(Ft,gt,ie){"use strict";ie.d(gt,"a",function(){return D});var ae=ie("q1tI"),X=ie.n(ae);function D(K,w){var P=Object(ae.useRef)();Object(ae.useEffect)(function(){P.current=K}),Object(ae.useEffect)(function(){function H(){P.current()}if(w!==null){var B=setInterval(H,w);return function(){return clearInterval(B)}}},[w])}},"9ZNV":function(Ft,gt,ie){"use strict";ie.d(gt,"a",function(){return _});var ae=ie("0Owb"),X=ie("+L6B"),D=ie("2/Rp"),K=ie("q1tI"),w=ie.n(K),P=ie("UUDw"),H=ie.n(P),B=ie("TSYQ"),I=ie.n(B),_=function(A){var M=A.cancelText,O=M===void 0?"\u53D6\u6D88":M,L=A.okText,g=L===void 0?"\u786E\u5B9A":L,u=A.loading,a=u===void 0?!1:u,l=A.hasOkBtn,d=l===void 0?!0:l,E=A.okButtonProps,v=E===void 0?{}:E,m=A.onCancel,k=m===void 0?function(){}:m,b=A.onOk,h=b===void 0?function(){}:b,p=A.className,c=p===void 0?"":p;return w.a.createElement("div",{className:I()(H.a.buttonFixed,c)},w.a.createElement("div",{className:H.a.buttonWrap},w.a.createElement(D.a,{size:"large",className:"".concat(H.a.button," mr20"),onClick:k},O),d&&w.a.createElement(D.a,Object(ae.a)({size:"large",type:"primary",className:"".concat(H.a.button," mr20"),loading:a,onClick:h},v),g)))}},Bd2K:function(Ft,gt,ie){(function(ae){ae(ie("VrN/"),ie("osHv"))})(function(ae){ae.defineOption("autoCloseTags",!1,function(I,_,x){if(x!=ae.Init&&x&&I.removeKeyMap("autoCloseTags"),!_)return;var A={name:"autoCloseTags"};(typeof _!="object"||_.whenClosing!==!1)&&(A["'/'"]=function(M){return P(M)}),(typeof _!="object"||_.whenOpening!==!1)&&(A["'>'"]=function(M){return K(M)}),I.addKeyMap(A)});var X=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],D=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function K(I){if(I.getOption("disableInput"))return ae.Pass;for(var _=I.listSelections(),x=[],A=I.getOption("autoCloseTags"),M=0;M<_.length;M++){if(!_[M].empty())return ae.Pass;var O=_[M].head,L=I.getTokenAt(O),g=ae.innerMode(I.getMode(),L.state),u=g.state,a=g.mode.xmlCurrentTag&&g.mode.xmlCurrentTag(u),l=a&&a.name;if(!l)return ae.Pass;var d=g.mode.configuration=="html",E=typeof A=="object"&&A.dontCloseTags||d&&X,v=typeof A=="object"&&A.indentTags||d&&D;L.end>O.ch&&(l=l.slice(0,l.length-L.end+O.ch));var m=l.toLowerCase();if(!l||L.type=="string"&&(L.end!=O.ch||!/[\"\']/.test(L.string.charAt(L.string.length-1))||L.string.length==1)||L.type=="tag"&&a.close||L.string.indexOf("/")==O.ch-L.start-1||E&&H(E,m)>-1||B(I,g.mode.xmlCurrentContext&&g.mode.xmlCurrentContext(u)||[],l,O,!0))return ae.Pass;var k=typeof A=="object"&&A.emptyTags;if(k&&H(k,l)>-1){x[M]={text:"/>",newPos:ae.Pos(O.line,O.ch+2)};continue}var b=v&&H(v,m)>-1;x[M]={indent:b,text:">"+(b?`
`:"")+"</"+l+">",newPos:b?ae.Pos(O.line+1,0):ae.Pos(O.line,O.ch+1)}}for(var h=typeof A=="object"&&A.dontIndentOnAutoClose,M=_.length-1;M>=0;M--){var p=x[M];I.replaceRange(p.text,_[M].head,_[M].anchor,"+insert");var c=I.listSelections().slice(0);c[M]={head:p.newPos,anchor:p.newPos},I.setSelections(c),!h&&p.indent&&(I.indentLine(p.newPos.line,null,!0),I.indentLine(p.newPos.line+1,null,!0))}}function w(I,_){for(var x=I.listSelections(),A=[],M=_?"/":"</",O=I.getOption("autoCloseTags"),L=typeof O=="object"&&O.dontIndentOnSlash,g=0;g<x.length;g++){if(!x[g].empty())return ae.Pass;var u=x[g].head,a=I.getTokenAt(u),l=ae.innerMode(I.getMode(),a.state),d=l.state;if(_&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=u.ch-1))return ae.Pass;var E,v=l.mode.name!="xml"&&I.getMode().name=="htmlmixed";if(v&&l.mode.name=="javascript")E=M+"script";else if(v&&l.mode.name=="css")E=M+"style";else{var m=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(d);if(!m||m.length&&B(I,m,m[m.length-1],u))return ae.Pass;E=M+m[m.length-1]}I.getLine(u.line).charAt(a.end)!=">"&&(E+=">"),A[g]=E}if(I.replaceSelections(A),x=I.listSelections(),!L)for(var g=0;g<x.length;g++)(g==x.length-1||x[g].head.line<x[g+1].head.line)&&I.indentLine(x[g].head.line)}function P(I){return I.getOption("disableInput")?ae.Pass:w(I,!0)}ae.commands.closeTag=function(I){return w(I)};function H(I,_){if(I.indexOf)return I.indexOf(_);for(var x=0,A=I.length;x<A;++x)if(I[x]==_)return x;return-1}function B(I,_,x,A,M){if(!ae.scanForClosingTag)return!1;var O=Math.min(I.lastLine()+1,A.line+500),L=ae.scanForClosingTag(I,A,null,O);if(!L||L.tag!=x)return!1;for(var g=M?1:0,u=_.length-1;u>=0&&_[u]==x;u--)++g;A=L.to;for(var u=1;u<g;u++){var a=ae.scanForClosingTag(I,A,null,O);if(!a||a.tag!=x)return!1;A=a.to}return!0}})},BjJ7:function(Ft,gt,ie){"use strict";ie.d(gt,"d",function(){return X}),ie.d(gt,"c",function(){return D}),ie.d(gt,"e",function(){return K}),ie.d(gt,"b",function(){return w}),ie.d(gt,"a",function(){return H});var ae=ie("m3rI");function X(B){var I=!0;if(B.length>0){for(var _=0;_<B.length;_++)if(B[_].compile_success==0||!B[_].compile_success){I=!1;break}}else I=!1;return I}function D(B){for(var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",_=[],x=0;x<B.length;x++){var A=B[x],M=I?"".concat(I,"/").concat(A.name):"".concat(A.name);_.push({title:A.name,isLeaf:!(A.type==="tree"),key:M})}return _}function K(B,I,_){for(var x=0;x<B.length;x++){var A=B[x];if(A.key===I){A.children=_;break}A.children&&K(A.children,I,_)}return B}function w(B,I,_){var x;return function(){var A=this,M=arguments,O=function(){x=null,_||B.apply(A,M)},L=_&&!x;clearTimeout(x),x=setTimeout(O,I),L&&B.apply(A,M)}}var P=!0,H=ae.a.API_SERVER},"C+DQ":function(Ft,gt,ie){},DlQD:function(Ft,gt,ie){(function(ae,X){Ft.exports=X()})(this,function(){"use strict";function ae(we,ye){for(var Ee=0;Ee<ye.length;Ee++){var re=ye[Ee];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(we,re.key,re)}}function X(we,ye,Ee){return ye&&ae(we.prototype,ye),Ee&&ae(we,Ee),we}function D(we,ye){if(!we)return;if(typeof we=="string")return K(we,ye);var Ee=Object.prototype.toString.call(we).slice(8,-1);if(Ee==="Object"&&we.constructor&&(Ee=we.constructor.name),Ee==="Map"||Ee==="Set")return Array.from(we);if(Ee==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Ee))return K(we,ye)}function K(we,ye){(ye==null||ye>we.length)&&(ye=we.length);for(var Ee=0,re=new Array(ye);Ee<ye;Ee++)re[Ee]=we[Ee];return re}function w(we,ye){var Ee;if(typeof Symbol=="undefined"||we[Symbol.iterator]==null){if(Array.isArray(we)||(Ee=D(we))||ye&&we&&typeof we.length=="number"){Ee&&(we=Ee);var re=0;return function(){return re>=we.length?{done:!0}:{done:!1,value:we[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 Ee=we[Symbol.iterator](),Ee.next.bind(Ee)}function P(we,ye){return ye={exports:{}},we(ye,ye.exports),ye.exports}var H=P(function(we){function ye(){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 Ee(re){we.exports.defaults=re}we.exports={defaults:ye(),getDefaults:ye,changeDefaults:Ee}}),B=H.defaults,I=H.getDefaults,_=H.changeDefaults,x=/[&<>"']/,A=/[&<>"']/g,M=/[<>"']|&(?!#?\w+;)/,O=/[<>"']|&(?!#?\w+;)/g,L={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},g=function(ye){return L[ye]};function u(we,ye){if(ye){if(x.test(we))return we.replace(A,g)}else if(M.test(we))return we.replace(O,g);return we}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(we){return we.replace(a,function(ye,Ee){return Ee=Ee.toLowerCase(),Ee==="colon"?":":Ee.charAt(0)==="#"?Ee.charAt(1)==="x"?String.fromCharCode(parseInt(Ee.substring(2),16)):String.fromCharCode(+Ee.substring(1)):""})}var d=/(^|[^\[])\^/g;function E(we,ye){we=we.source||we,ye=ye||"";var Ee={replace:function(ne,de){return de=de.source||de,de=de.replace(d,"$1"),we=we.replace(ne,de),Ee},getRegex:function(){return new RegExp(we,ye)}};return Ee}var v=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function k(we,ye,Ee){if(we){var re;try{re=decodeURIComponent(l(Ee)).replace(v,"").toLowerCase()}catch(ne){return null}if(re.indexOf("javascript:")===0||re.indexOf("vbscript:")===0||re.indexOf("data:")===0)return null}ye&&!m.test(Ee)&&(Ee=o(ye,Ee));try{Ee=encodeURI(Ee).replace(/%25/g,"%")}catch(ne){return null}return Ee}var b={},h=/^[^:]+:\/*[^/]*$/,p=/^([^:]+:)[\s\S]*$/,c=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(we,ye){b[" "+we]||(h.test(we)?b[" "+we]=we+"/":b[" "+we]=N(we,"/",!0)),we=b[" "+we];var Ee=we.indexOf(":")===-1;return ye.substring(0,2)==="//"?Ee?ye:we.replace(p,"$1")+ye:ye.charAt(0)==="/"?Ee?ye:we.replace(c,"$1")+ye:we+ye}var S={exec:function(){}};function y(we){for(var ye=1,Ee,re;ye<arguments.length;ye++){Ee=arguments[ye];for(re in Ee)Object.prototype.hasOwnProperty.call(Ee,re)&&(we[re]=Ee[re])}return we}function T(we,ye){var Ee=we.replace(/\|/g,function(de,ge,Se){for(var Re=!1,Ge=ge;--Ge>=0&&Se[Ge]==="\\";)Re=!Re;return Re?"|":" |"}),re=Ee.split(/ \|/),ne=0;if(re.length>ye)re.splice(ye);else for(;re.length<ye;)re.push("");for(;ne<re.length;ne++)re[ne]=re[ne].trim().replace(/\\\|/g,"|");return re}function N(we,ye,Ee){var re=we.length;if(re===0)return"";for(var ne=0;ne<re;){var de=we.charAt(re-ne-1);if(de===ye&&!Ee)ne++;else if(de!==ye&&Ee)ne++;else break}return we.substr(0,re-ne)}function z(we,ye){if(we.indexOf(ye[1])===-1)return-1;for(var Ee=we.length,re=0,ne=0;ne<Ee;ne++)if(we[ne]==="\\")ne++;else if(we[ne]===ye[0])re++;else if(we[ne]===ye[1]&&(re--,re<0))return ne;return-1}function Y(we){we&&we.sanitize&&!we.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 ee={escape:u,unescape:l,edit:E,cleanUrl:k,resolveUrl:o,noopTest:S,merge:y,splitCells:T,rtrim:N,findClosingBracket:z,checkSanitizeDeprecation:Y},G=H.defaults,W=ee.rtrim,te=ee.splitCells,ue=ee.escape,be=ee.findClosingBracket;function Oe(we,ye,Ee){var re=ye.href,ne=ye.title?ue(ye.title):null,de=we[1].replace(/\\([\[\]])/g,"$1");return we[0].charAt(0)!=="!"?{type:"link",raw:Ee,href:re,title:ne,text:de}:{type:"image",raw:Ee,href:re,title:ne,text:ue(de)}}function Ke(we,ye){var Ee=we.match(/^(\s+)(?:```)/);if(Ee===null)return ye;var re=Ee[1];return ye.split(`
`).map(function(ne){var de=ne.match(/^\s+/);if(de===null)return ne;var ge=de[0];return ge.length>=re.length?ne.slice(re.length):ne}).join(`
`)}var _e=function(){function we(Ee){this.options=Ee||G}var ye=we.prototype;return ye.space=function(re){var ne=this.rules.block.newline.exec(re);if(ne)return ne[0].length>1?{type:"space",raw:ne[0]}:{raw:`
`}},ye.code=function(re,ne){var de=this.rules.block.code.exec(re);if(de){var ge=ne[ne.length-1];if(ge&&ge.type==="paragraph")return{raw:de[0],text:de[0].trimRight()};var Se=de[0].replace(/^ {4}/gm,"");return{type:"code",raw:de[0],codeBlockStyle:"indented",text:this.options.pedantic?Se:W(Se,`
`)}}},ye.fences=function(re){var ne=this.rules.block.fences.exec(re);if(ne){var de=ne[0],ge=Ke(de,ne[3]||"");return{type:"code",raw:de,lang:ne[2]?ne[2].trim():ne[2],text:ge}}},ye.heading=function(re){var ne=this.rules.block.heading.exec(re);if(ne)return{type:"heading",raw:ne[0],depth:ne[1].length,text:ne[2]}},ye.nptable=function(re){var ne=this.rules.block.nptable.exec(re);if(ne){var de={type:"table",header:te(ne[1].replace(/^ *| *\| *$/g,"")),align:ne[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ne[3]?ne[3].replace(/\n$/,"").split(`
`):[],raw:ne[0]};if(de.header.length===de.align.length){var ge=de.align.length,Se;for(Se=0;Se<ge;Se++)/^ *-+: *$/.test(de.align[Se])?de.align[Se]="right":/^ *:-+: *$/.test(de.align[Se])?de.align[Se]="center":/^ *:-+ *$/.test(de.align[Se])?de.align[Se]="left":de.align[Se]=null;for(ge=de.cells.length,Se=0;Se<ge;Se++)de.cells[Se]=te(de.cells[Se],de.header.length);return de}}},ye.hr=function(re){var ne=this.rules.block.hr.exec(re);if(ne)return{type:"hr",raw:ne[0]}},ye.blockquote=function(re){var ne=this.rules.block.blockquote.exec(re);if(ne){var de=ne[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ne[0],text:de}}},ye.list=function(re){var ne=this.rules.block.list.exec(re);if(ne){for(var de=ne[0],ge=ne[2],Se=ge.length>1,Re=ge[ge.length-1]===")",Ge={type:"list",raw:de,ordered:Se,start:Se?+ge.slice(0,-1):"",loose:!1,items:[]},yt=ne[0].match(this.rules.block.item),_t=!1,kt,Gt,Kt,Ct,pr,rr,Ir,Pr=yt.length,Vt=0;Vt<Pr;Vt++)kt=yt[Vt],de=kt,Gt=kt.length,kt=kt.replace(/^ *([*+-]|\d+[.)]) */,""),~kt.indexOf(`
`)&&(Gt-=kt.length,kt=this.options.pedantic?kt.replace(/^ {1,4}/gm,""):kt.replace(new RegExp("^ {1,"+Gt+"}","gm"),"")),Vt!==Pr-1&&(Kt=this.rules.block.bullet.exec(yt[Vt+1])[0],(Se?Kt.length===1||!Re&&Kt[Kt.length-1]===")":Kt.length>1||this.options.smartLists&&Kt!==ge)&&(Ct=yt.slice(Vt+1).join(`
`),Ge.raw=Ge.raw.substring(0,Ge.raw.length-Ct.length),Vt=Pr-1)),pr=_t||/\n\n(?!\s*$)/.test(kt),Vt!==Pr-1&&(_t=kt.charAt(kt.length-1)===`
`,pr||(pr=_t)),pr&&(Ge.loose=!0),rr=/^\[[ xX]\] /.test(kt),Ir=void 0,rr&&(Ir=kt[1]!==" ",kt=kt.replace(/^\[[ xX]\] +/,"")),Ge.items.push({type:"list_item",raw:de,task:rr,checked:Ir,loose:pr,text:kt});return Ge}},ye.html=function(re){var ne=this.rules.block.html.exec(re);if(ne)return{type:this.options.sanitize?"paragraph":"html",raw:ne[0],pre:!this.options.sanitizer&&(ne[1]==="pre"||ne[1]==="script"||ne[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ne[0]):ue(ne[0]):ne[0]}},ye.def=function(re){var ne=this.rules.block.def.exec(re);if(ne){ne[3]&&(ne[3]=ne[3].substring(1,ne[3].length-1));var de=ne[1].toLowerCase().replace(/\s+/g," ");return{tag:de,raw:ne[0],href:ne[2],title:ne[3]}}},ye.table=function(re){var ne=this.rules.block.table.exec(re);if(ne){var de={type:"table",header:te(ne[1].replace(/^ *| *\| *$/g,"")),align:ne[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ne[3]?ne[3].replace(/\n$/,"").split(`
`):[]};if(de.header.length===de.align.length){de.raw=ne[0];var ge=de.align.length,Se;for(Se=0;Se<ge;Se++)/^ *-+: *$/.test(de.align[Se])?de.align[Se]="right":/^ *:-+: *$/.test(de.align[Se])?de.align[Se]="center":/^ *:-+ *$/.test(de.align[Se])?de.align[Se]="left":de.align[Se]=null;for(ge=de.cells.length,Se=0;Se<ge;Se++)de.cells[Se]=te(de.cells[Se].replace(/^ *\| *| *\| *$/g,""),de.header.length);return de}}},ye.lheading=function(re){var ne=this.rules.block.lheading.exec(re);if(ne)return{type:"heading",raw:ne[0],depth:ne[2].charAt(0)==="="?1:2,text:ne[1]}},ye.paragraph=function(re){var ne=this.rules.block.paragraph.exec(re);if(ne)return{type:"paragraph",raw:ne[0],text:ne[1].charAt(ne[1].length-1)===`
`?ne[1].slice(0,-1):ne[1]}},ye.text=function(re,ne){var de=this.rules.block.text.exec(re);if(de){var ge=ne[ne.length-1];return ge&&ge.type==="text"?{raw:de[0],text:de[0]}:{type:"text",raw:de[0],text:de[0]}}},ye.escape=function(re){var ne=this.rules.inline.escape.exec(re);if(ne)return{type:"escape",raw:ne[0],text:ue(ne[1])}},ye.tag=function(re,ne,de){var ge=this.rules.inline.tag.exec(re);if(ge)return!ne&&/^<a /i.test(ge[0])?ne=!0:ne&&/^<\/a>/i.test(ge[0])&&(ne=!1),!de&&/^<(pre|code|kbd|script)(\s|>)/i.test(ge[0])?de=!0:de&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ge[0])&&(de=!1),{type:this.options.sanitize?"text":"html",raw:ge[0],inLink:ne,inRawBlock:de,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ge[0]):ue(ge[0]):ge[0]}},ye.link=function(re){var ne=this.rules.inline.link.exec(re);if(ne){var de=be(ne[2],"()");if(de>-1){var ge=ne[0].indexOf("!")===0?5:4,Se=ge+ne[1].length+de;ne[2]=ne[2].substring(0,de),ne[0]=ne[0].substring(0,Se).trim(),ne[3]=""}var Re=ne[2],Ge="";if(this.options.pedantic){var yt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Re);yt?(Re=yt[1],Ge=yt[3]):Ge=""}else Ge=ne[3]?ne[3].slice(1,-1):"";Re=Re.trim().replace(/^<([\s\S]*)>$/,"$1");var _t=Oe(ne,{href:Re&&Re.replace(this.rules.inline._escapes,"$1"),title:Ge&&Ge.replace(this.rules.inline._escapes,"$1")},ne[0]);return _t}},ye.reflink=function(re,ne){var de;if((de=this.rules.inline.reflink.exec(re))||(de=this.rules.inline.nolink.exec(re))){var ge=(de[2]||de[1]).replace(/\s+/g," ");if(ge=ne[ge.toLowerCase()],!ge||!ge.href){var Se=de[0].charAt(0);return{type:"text",raw:Se,text:Se}}var Re=Oe(de,ge,de[0]);return Re}},ye.strong=function(re,ne,de){de===void 0&&(de="");var ge=this.rules.inline.strong.start.exec(re);if(ge&&(!ge[1]||ge[1]&&(de===""||this.rules.inline.punctuation.exec(de)))){ne=ne.slice(-1*re.length);var Se=ge[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Se.lastIndex=0;for(var Re;(ge=Se.exec(ne))!=null;)if(Re=this.rules.inline.strong.middle.exec(ne.slice(0,ge.index+3)),Re)return{type:"strong",raw:re.slice(0,Re[0].length),text:re.slice(2,Re[0].length-2)}}},ye.em=function(re,ne,de){de===void 0&&(de="");var ge=this.rules.inline.em.start.exec(re);if(ge&&(!ge[1]||ge[1]&&(de===""||this.rules.inline.punctuation.exec(de)))){ne=ne.slice(-1*re.length);var Se=ge[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Se.lastIndex=0;for(var Re;(ge=Se.exec(ne))!=null;)if(Re=this.rules.inline.em.middle.exec(ne.slice(0,ge.index+2)),Re)return{type:"em",raw:re.slice(0,Re[0].length),text:re.slice(1,Re[0].length-1)}}},ye.codespan=function(re){var ne=this.rules.inline.code.exec(re);if(ne){var de=ne[2].replace(/\n/g," "),ge=/[^ ]/.test(de),Se=de.startsWith(" ")&&de.endsWith(" ");return ge&&Se&&(de=de.substring(1,de.length-1)),de=ue(de,!0),{type:"codespan",raw:ne[0],text:de}}},ye.br=function(re){var ne=this.rules.inline.br.exec(re);if(ne)return{type:"br",raw:ne[0]}},ye.del=function(re){var ne=this.rules.inline.del.exec(re);if(ne)return{type:"del",raw:ne[0],text:ne[1]}},ye.autolink=function(re,ne){var de=this.rules.inline.autolink.exec(re);if(de){var ge,Se;return de[2]==="@"?(ge=ue(this.options.mangle?ne(de[1]):de[1]),Se="mailto:"+ge):(ge=ue(de[1]),Se=ge),{type:"link",raw:de[0],text:ge,href:Se,tokens:[{type:"text",raw:ge,text:ge}]}}},ye.url=function(re,ne){var de;if(de=this.rules.inline.url.exec(re)){var ge,Se;if(de[2]==="@")ge=ue(this.options.mangle?ne(de[0]):de[0]),Se="mailto:"+ge;else{var Re;do Re=de[0],de[0]=this.rules.inline._backpedal.exec(de[0])[0];while(Re!==de[0]);ge=ue(de[0]),de[1]==="www."?Se="http://"+ge:Se=ge}return{type:"link",raw:de[0],text:ge,href:Se,tokens:[{type:"text",raw:ge,text:ge}]}}},ye.inlineText=function(re,ne,de){var ge=this.rules.inline.text.exec(re);if(ge){var Se;return ne?Se=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ge[0]):ue(ge[0]):ge[0]:Se=ue(this.options.smartypants?de(ge[0]):ge[0]),{type:"text",raw:ge[0],text:Se}}},we}(),Ie=ee.noopTest,Ue=ee.edit,Pe=ee.merge,Te={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:Ie,table:Ie,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};Te._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,Te._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,Te.def=Ue(Te.def).replace("label",Te._label).replace("title",Te._title).getRegex(),Te.bullet=/(?:[*+-]|\d{1,9}[.)])/,Te.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,Te.item=Ue(Te.item,"gm").replace(/bull/g,Te.bullet).getRegex(),Te.list=Ue(Te.list).replace(/bull/g,Te.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Te.def.source+")").getRegex(),Te._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",Te._comment=/<!--(?!-?>)[\s\S]*?-->/,Te.html=Ue(Te.html,"i").replace("comment",Te._comment).replace("tag",Te._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Te.paragraph=Ue(Te._paragraph).replace("hr",Te.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",Te._tag).getRegex(),Te.blockquote=Ue(Te.blockquote).replace("paragraph",Te.paragraph).getRegex(),Te.normal=Pe({},Te),Te.gfm=Pe({},Te.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*|$)"}),Te.gfm.nptable=Ue(Te.gfm.nptable).replace("hr",Te.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",Te._tag).getRegex(),Te.gfm.table=Ue(Te.gfm.table).replace("hr",Te.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",Te._tag).getRegex(),Te.pedantic=Pe({},Te.normal,{html:Ue(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Te._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:Ie,paragraph:Ue(Te.normal._paragraph).replace("hr",Te.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",Te.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var se={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ie,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:Ie,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};se._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",se.punctuation=Ue(se.punctuation).replace(/punctuation/g,se._punctuation).getRegex(),se._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",se._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",se.em.start=Ue(se.em.start).replace(/punctuation/g,se._punctuation).getRegex(),se.em.middle=Ue(se.em.middle).replace(/punctuation/g,se._punctuation).replace(/overlapSkip/g,se._overlapSkip).getRegex(),se.em.endAst=Ue(se.em.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.em.endUnd=Ue(se.em.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.start=Ue(se.strong.start).replace(/punctuation/g,se._punctuation).getRegex(),se.strong.middle=Ue(se.strong.middle).replace(/punctuation/g,se._punctuation).replace(/blockSkip/g,se._blockSkip).getRegex(),se.strong.endAst=Ue(se.strong.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.endUnd=Ue(se.strong.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.blockSkip=Ue(se._blockSkip,"g").getRegex(),se.overlapSkip=Ue(se._overlapSkip,"g").getRegex(),se._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,se._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,se._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])?)+(?![-_])/,se.autolink=Ue(se.autolink).replace("scheme",se._scheme).replace("email",se._email).getRegex(),se._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,se.tag=Ue(se.tag).replace("comment",Te._comment).replace("attribute",se._attribute).getRegex(),se._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,se._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,se._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,se.link=Ue(se.link).replace("label",se._label).replace("href",se._href).replace("title",se._title).getRegex(),se.reflink=Ue(se.reflink).replace("label",se._label).getRegex(),se.reflinkSearch=Ue(se.reflinkSearch,"g").replace("reflink",se.reflink).replace("nolink",se.nolink).getRegex(),se.normal=Pe({},se),se.pedantic=Pe({},se.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:Ue(/^!?\[(label)\]\((.*?)\)/).replace("label",se._label).getRegex(),reflink:Ue(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",se._label).getRegex()}),se.gfm=Pe({},se.normal,{escape:Ue(se.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),se.gfm.url=Ue(se.gfm.url,"i").replace("email",se.gfm._extended_email).getRegex(),se.breaks=Pe({},se.gfm,{br:Ue(se.br).replace("{2,}","*").getRegex(),text:Ue(se.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var He={block:Te,inline:se},ht=H.defaults,it=He.block,at=He.inline;function ft(we){return we.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function je(we){var ye="",Ee,re,ne=we.length;for(Ee=0;Ee<ne;Ee++)re=we.charCodeAt(Ee),Math.random()>.5&&(re="x"+re.toString(16)),ye+="&#"+re+";";return ye}var Ye=function(){function we(Ee){this.tokens=[],this.tokens.links=Object.create(null),this.options=Ee||ht,this.options.tokenizer=this.options.tokenizer||new _e,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var re={block:it.normal,inline:at.normal};this.options.pedantic?(re.block=it.pedantic,re.inline=at.pedantic):this.options.gfm&&(re.block=it.gfm,this.options.breaks?re.inline=at.breaks:re.inline=at.gfm),this.tokenizer.rules=re}we.lex=function(re,ne){var de=new we(ne);return de.lex(re)};var ye=we.prototype;return ye.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},ye.blockTokens=function(re,ne,de){ne===void 0&&(ne=[]),de===void 0&&(de=!0),re=re.replace(/^ +$/gm,"");for(var ge,Se,Re,Ge;re;){if(ge=this.tokenizer.space(re)){re=re.substring(ge.raw.length),ge.type&&ne.push(ge);continue}if(ge=this.tokenizer.code(re,ne)){re=re.substring(ge.raw.length),ge.type?ne.push(ge):(Ge=ne[ne.length-1],Ge.raw+=`
`+ge.raw,Ge.text+=`
`+ge.text);continue}if(ge=this.tokenizer.fences(re)){re=re.substring(ge.raw.length),ne.push(ge);continue}if(ge=this.tokenizer.heading(re)){re=re.substring(ge.raw.length),ne.push(ge);continue}if(ge=this.tokenizer.nptable(re)){re=re.substring(ge.raw.length),ne.push(ge);continue}if(ge=this.tokenizer.hr(re)){re=re.substring(ge.raw.length),ne.push(ge);continue}if(ge=this.tokenizer.blockquote(re)){re=re.substring(ge.raw.length),ge.tokens=this.blockTokens(ge.text,[],de),ne.push(ge);continue}if(ge=this.tokenizer.list(re)){for(re=re.substring(ge.raw.length),Re=ge.items.length,Se=0;Se<Re;Se++)ge.items[Se].tokens=this.blockTokens(ge.items[Se].text,[],!1);ne.push(ge);continue}if(ge=this.tokenizer.html(re)){re=re.substring(ge.raw.length),ne.push(ge);continue}if(de&&(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),ne.push(ge);continue}if(ge=this.tokenizer.lheading(re)){re=re.substring(ge.raw.length),ne.push(ge);continue}if(de&&(ge=this.tokenizer.paragraph(re))){re=re.substring(ge.raw.length),ne.push(ge);continue}if(ge=this.tokenizer.text(re,ne)){re=re.substring(ge.raw.length),ge.type?ne.push(ge):(Ge=ne[ne.length-1],Ge.raw+=`
`+ge.raw,Ge.text+=`
`+ge.text);continue}if(re){var yt="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(yt);break}else throw new Error(yt)}}return ne},ye.inline=function(re){var ne,de,ge,Se,Re,Ge,yt=re.length;for(ne=0;ne<yt;ne++){Ge=re[ne];switch(Ge.type){case"paragraph":case"text":case"heading":{Ge.tokens=[],this.inlineTokens(Ge.text,Ge.tokens);break}case"table":{for(Ge.tokens={header:[],cells:[]},Se=Ge.header.length,de=0;de<Se;de++)Ge.tokens.header[de]=[],this.inlineTokens(Ge.header[de],Ge.tokens.header[de]);for(Se=Ge.cells.length,de=0;de<Se;de++)for(Re=Ge.cells[de],Ge.tokens.cells[de]=[],ge=0;ge<Re.length;ge++)Ge.tokens.cells[de][ge]=[],this.inlineTokens(Re[ge],Ge.tokens.cells[de][ge]);break}case"blockquote":{this.inline(Ge.tokens);break}case"list":{for(Se=Ge.items.length,de=0;de<Se;de++)this.inline(Ge.items[de].tokens);break}}}return re},ye.inlineTokens=function(re,ne,de,ge,Se){ne===void 0&&(ne=[]),de===void 0&&(de=!1),ge===void 0&&(ge=!1),Se===void 0&&(Se="");var Re,Ge=re,yt;if(this.tokens.links){var _t=Object.keys(this.tokens.links);if(_t.length>0)for(;(yt=this.tokenizer.rules.inline.reflinkSearch.exec(Ge))!=null;)_t.includes(yt[0].slice(yt[0].lastIndexOf("[")+1,-1))&&(Ge=Ge.slice(0,yt.index)+"["+"a".repeat(yt[0].length-2)+"]"+Ge.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(yt=this.tokenizer.rules.inline.blockSkip.exec(Ge))!=null;)Ge=Ge.slice(0,yt.index)+"["+"a".repeat(yt[0].length-2)+"]"+Ge.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;re;){if(Re=this.tokenizer.escape(re)){re=re.substring(Re.raw.length),ne.push(Re);continue}if(Re=this.tokenizer.tag(re,de,ge)){re=re.substring(Re.raw.length),de=Re.inLink,ge=Re.inRawBlock,ne.push(Re);continue}if(Re=this.tokenizer.link(re)){re=re.substring(Re.raw.length),Re.type==="link"&&(Re.tokens=this.inlineTokens(Re.text,[],!0,ge)),ne.push(Re);continue}if(Re=this.tokenizer.reflink(re,this.tokens.links)){re=re.substring(Re.raw.length),Re.type==="link"&&(Re.tokens=this.inlineTokens(Re.text,[],!0,ge)),ne.push(Re);continue}if(Re=this.tokenizer.strong(re,Ge,Se)){re=re.substring(Re.raw.length),Re.tokens=this.inlineTokens(Re.text,[],de,ge),ne.push(Re);continue}if(Re=this.tokenizer.em(re,Ge,Se)){re=re.substring(Re.raw.length),Re.tokens=this.inlineTokens(Re.text,[],de,ge),ne.push(Re);continue}if(Re=this.tokenizer.codespan(re)){re=re.substring(Re.raw.length),ne.push(Re);continue}if(Re=this.tokenizer.br(re)){re=re.substring(Re.raw.length),ne.push(Re);continue}if(Re=this.tokenizer.del(re)){re=re.substring(Re.raw.length),Re.tokens=this.inlineTokens(Re.text,[],de,ge),ne.push(Re);continue}if(Re=this.tokenizer.autolink(re,je)){re=re.substring(Re.raw.length),ne.push(Re);continue}if(!de&&(Re=this.tokenizer.url(re,je))){re=re.substring(Re.raw.length),ne.push(Re);continue}if(Re=this.tokenizer.inlineText(re,ge,ft)){re=re.substring(Re.raw.length),Se=Re.raw.slice(-1),ne.push(Re);continue}if(re){var kt="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(kt);break}else throw new Error(kt)}}return ne},X(we,null,[{key:"rules",get:function(){return{block:it,inline:at}}}]),we}(),rt=H.defaults,ot=ee.cleanUrl,et=ee.escape,Ve=function(){function we(Ee){this.options=Ee||rt}var ye=we.prototype;return ye.code=function(re,ne,de){var ge=(ne||"").match(/\S*/)[0];if(this.options.highlight){var Se=this.options.highlight(re,ge);Se!=null&&Se!==re&&(de=!0,re=Se)}return ge?'<pre><code class="'+this.options.langPrefix+et(ge,!0)+'">'+(de?re:et(re,!0))+`</code></pre>
`:"<pre><code>"+(de?re:et(re,!0))+`</code></pre>
`},ye.blockquote=function(re){return`<blockquote>
`+re+`</blockquote>
`},ye.html=function(re){return re},ye.heading=function(re,ne,de,ge){return this.options.headerIds?"<h"+ne+' id="'+this.options.headerPrefix+ge.slug(de)+'">'+re+"</h"+ne+`>
`:"<h"+ne+">"+re+"</h"+ne+`>
`},ye.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ye.list=function(re,ne,de){var ge=ne?"ol":"ul",Se=ne&&de!==1?' start="'+de+'"':"";return"<"+ge+Se+`>
`+re+"</"+ge+`>
`},ye.listitem=function(re){return"<li>"+re+`</li>
`},ye.checkbox=function(re){return"<input "+(re?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ye.paragraph=function(re){return"<p>"+re+`</p>
`},ye.table=function(re,ne){return ne&&(ne="<tbody>"+ne+"</tbody>"),`<table>
<thead>
`+re+`</thead>
`+ne+`</table>
`},ye.tablerow=function(re){return`<tr>
`+re+`</tr>
`},ye.tablecell=function(re,ne){var de=ne.header?"th":"td",ge=ne.align?"<"+de+' align="'+ne.align+'">':"<"+de+">";return ge+re+"</"+de+`>
`},ye.strong=function(re){return"<strong>"+re+"</strong>"},ye.em=function(re){return"<em>"+re+"</em>"},ye.codespan=function(re){return"<code>"+re+"</code>"},ye.br=function(){return this.options.xhtml?"<br/>":"<br>"},ye.del=function(re){return"<del>"+re+"</del>"},ye.link=function(re,ne,de){if(re=ot(this.options.sanitize,this.options.baseUrl,re),re===null)return de;var ge='<a href="'+et(re)+'"';return ne&&(ge+=' title="'+ne+'"'),ge+=">"+de+"</a>",ge},ye.image=function(re,ne,de){if(re=ot(this.options.sanitize,this.options.baseUrl,re),re===null)return de;var ge='<img src="'+re+'" alt="'+de+'"';return ne&&(ge+=' title="'+ne+'"'),ge+=this.options.xhtml?"/>":">",ge},ye.text=function(re){return re},we}(),$e=function(){function we(){}var ye=we.prototype;return ye.strong=function(re){return re},ye.em=function(re){return re},ye.codespan=function(re){return re},ye.del=function(re){return re},ye.html=function(re){return re},ye.text=function(re){return re},ye.link=function(re,ne,de){return""+de},ye.image=function(re,ne,de){return""+de},ye.br=function(){return""},we}(),bt=function(){function we(){this.seen={}}var ye=we.prototype;return ye.slug=function(re){var ne=re.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ne)){var de=ne;do this.seen[de]++,ne=de+"-"+this.seen[de];while(this.seen.hasOwnProperty(ne))}return this.seen[ne]=0,ne},we}(),pt=H.defaults,mt=ee.unescape,st=function(){function we(Ee){this.options=Ee||pt,this.options.renderer=this.options.renderer||new Ve,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new $e,this.slugger=new bt}we.parse=function(re,ne){var de=new we(ne);return de.parse(re)};var ye=we.prototype;return ye.parse=function(re,ne){ne===void 0&&(ne=!0);var de="",ge,Se,Re,Ge,yt,_t,kt,Gt,Kt,Ct,pr,rr,Ir,Pr,Vt,an,En,It,An=re.length;for(ge=0;ge<An;ge++){Ct=re[ge];switch(Ct.type){case"space":continue;case"hr":{de+=this.renderer.hr();continue}case"heading":{de+=this.renderer.heading(this.parseInline(Ct.tokens),Ct.depth,mt(this.parseInline(Ct.tokens,this.textRenderer)),this.slugger);continue}case"code":{de+=this.renderer.code(Ct.text,Ct.lang,Ct.escaped);continue}case"table":{for(Gt="",kt="",Ge=Ct.header.length,Se=0;Se<Ge;Se++)kt+=this.renderer.tablecell(this.parseInline(Ct.tokens.header[Se]),{header:!0,align:Ct.align[Se]});for(Gt+=this.renderer.tablerow(kt),Kt="",Ge=Ct.cells.length,Se=0;Se<Ge;Se++){for(_t=Ct.tokens.cells[Se],kt="",yt=_t.length,Re=0;Re<yt;Re++)kt+=this.renderer.tablecell(this.parseInline(_t[Re]),{header:!1,align:Ct.align[Re]});Kt+=this.renderer.tablerow(kt)}de+=this.renderer.table(Gt,Kt);continue}case"blockquote":{Kt=this.parse(Ct.tokens),de+=this.renderer.blockquote(Kt);continue}case"list":{for(pr=Ct.ordered,rr=Ct.start,Ir=Ct.loose,Ge=Ct.items.length,Kt="",Se=0;Se<Ge;Se++)Vt=Ct.items[Se],an=Vt.checked,En=Vt.task,Pr="",Vt.task&&(It=this.renderer.checkbox(an),Ir?Vt.tokens.length>0&&Vt.tokens[0].type==="text"?(Vt.tokens[0].text=It+" "+Vt.tokens[0].text,Vt.tokens[0].tokens&&Vt.tokens[0].tokens.length>0&&Vt.tokens[0].tokens[0].type==="text"&&(Vt.tokens[0].tokens[0].text=It+" "+Vt.tokens[0].tokens[0].text)):Vt.tokens.unshift({type:"text",text:It}):Pr+=It),Pr+=this.parse(Vt.tokens,Ir),Kt+=this.renderer.listitem(Pr,En,an);de+=this.renderer.list(Kt,pr,rr);continue}case"html":{de+=this.renderer.html(Ct.text);continue}case"paragraph":{de+=this.renderer.paragraph(this.parseInline(Ct.tokens));continue}case"text":{for(Kt=Ct.tokens?this.parseInline(Ct.tokens):Ct.text;ge+1<An&&re[ge+1].type==="text";)Ct=re[++ge],Kt+=`
`+(Ct.tokens?this.parseInline(Ct.tokens):Ct.text);de+=ne?this.renderer.paragraph(Kt):Kt;continue}default:{var on='Token with "'+Ct.type+'" type was not found.';if(this.options.silent){console.error(on);return}else throw new Error(on)}}}return de},ye.parseInline=function(re,ne){ne=ne||this.renderer;var de="",ge,Se,Re=re.length;for(ge=0;ge<Re;ge++){Se=re[ge];switch(Se.type){case"escape":{de+=ne.text(Se.text);break}case"html":{de+=ne.html(Se.text);break}case"link":{de+=ne.link(Se.href,Se.title,this.parseInline(Se.tokens,ne));break}case"image":{de+=ne.image(Se.href,Se.title,Se.text);break}case"strong":{de+=ne.strong(this.parseInline(Se.tokens,ne));break}case"em":{de+=ne.em(this.parseInline(Se.tokens,ne));break}case"codespan":{de+=ne.codespan(Se.text);break}case"br":{de+=ne.br();break}case"del":{de+=ne.del(this.parseInline(Se.tokens,ne));break}case"text":{de+=ne.text(Se.text);break}default:{var Ge='Token with "'+Se.type+'" type was not found.';if(this.options.silent){console.error(Ge);return}else throw new Error(Ge)}}}return de},we}(),Ot=ee.merge,xt=ee.checkSanitizeDeprecation,vt=ee.escape,Ne=H.getDefaults,Lt=H.changeDefaults,Et=H.defaults;function Fe(we,ye,Ee){if(typeof we=="undefined"||we===null)throw new Error("marked(): input parameter is undefined or null");if(typeof we!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(we)+", string expected");if(typeof ye=="function"&&(Ee=ye,ye=null),ye=Ot({},Fe.defaults,ye||{}),xt(ye),Ee){var re=ye.highlight,ne;try{ne=Ye.lex(we,ye)}catch(Re){return Ee(Re)}var de=function(Ge){var yt;if(!Ge)try{yt=st.parse(ne,ye)}catch(_t){Ge=_t}return ye.highlight=re,Ge?Ee(Ge):Ee(null,yt)};if(!re||re.length<3)return de();if(delete ye.highlight,!ne.length)return de();var ge=0;Fe.walkTokens(ne,function(Re){Re.type==="code"&&(ge++,setTimeout(function(){re(Re.text,Re.lang,function(Ge,yt){if(Ge)return de(Ge);yt!=null&&yt!==Re.text&&(Re.text=yt,Re.escaped=!0),ge--,ge===0&&de()})},0))}),ge===0&&de();return}try{var Se=Ye.lex(we,ye);return ye.walkTokens&&Fe.walkTokens(Se,ye.walkTokens),st.parse(Se,ye)}catch(Re){if(Re.message+=`
Please report this to https://github.com/markedjs/marked.`,ye.silent)return"<p>An error occurred:</p><pre>"+vt(Re.message+"",!0)+"</pre>";throw Re}}Fe.options=Fe.setOptions=function(we){return Ot(Fe.defaults,we),Lt(Fe.defaults),Fe},Fe.getDefaults=Ne,Fe.defaults=Et,Fe.use=function(we){var ye=Ot({},we);if(we.renderer&&function(){var re=Fe.defaults.renderer||new Ve,ne=function(Se){var Re=re[Se];re[Se]=function(){for(var Ge=arguments.length,yt=new Array(Ge),_t=0;_t<Ge;_t++)yt[_t]=arguments[_t];var kt=we.renderer[Se].apply(re,yt);return kt===!1&&(kt=Re.apply(re,yt)),kt}};for(var de in we.renderer)ne(de);ye.renderer=re}(),we.tokenizer&&function(){var re=Fe.defaults.tokenizer||new _e,ne=function(Se){var Re=re[Se];re[Se]=function(){for(var Ge=arguments.length,yt=new Array(Ge),_t=0;_t<Ge;_t++)yt[_t]=arguments[_t];var kt=we.tokenizer[Se].apply(re,yt);return kt===!1&&(kt=Re.apply(re,yt)),kt}};for(var de in we.tokenizer)ne(de);ye.tokenizer=re}(),we.walkTokens){var Ee=Fe.defaults.walkTokens;ye.walkTokens=function(re){we.walkTokens(re),Ee&&Ee(re)}}Fe.setOptions(ye)},Fe.walkTokens=function(we,ye){for(var Ee=w(we),re;!(re=Ee()).done;){var ne=re.value;ye(ne);switch(ne.type){case"table":{for(var de=w(ne.tokens.header),ge;!(ge=de()).done;){var Se=ge.value;Fe.walkTokens(Se,ye)}for(var Re=w(ne.tokens.cells),Ge;!(Ge=Re()).done;)for(var yt=Ge.value,_t=w(yt),kt;!(kt=_t()).done;){var Gt=kt.value;Fe.walkTokens(Gt,ye)}break}case"list":{Fe.walkTokens(ne.items,ye);break}default:ne.tokens&&Fe.walkTokens(ne.tokens,ye)}}},Fe.Parser=st,Fe.parser=st.parse,Fe.Renderer=Ve,Fe.TextRenderer=$e,Fe.Lexer=Ye,Fe.lexer=Ye.lex,Fe.Tokenizer=_e,Fe.Slugger=bt,Fe.parse=Fe;var Ze=Fe;return Ze})},ELLl:function(Ft,gt,ie){(function(ae){ae(ie("VrN/"))})(function(ae){var X={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=ae.Pos;ae.defineOption("autoCloseBrackets",!1,function(L,g,u){u&&u!=ae.Init&&(L.removeKeyMap(w),L.state.closeBrackets=null),g&&(P(K(g,"pairs")),L.state.closeBrackets=g,L.addKeyMap(w))});function K(L,g){return g=="pairs"&&typeof L=="string"?L:typeof L=="object"&&L[g]!=null?L[g]:X[g]}var w={Backspace:I,Enter:_};function P(L){for(var g=0;g<L.length;g++){var u=L.charAt(g),a="'"+u+"'";w[a]||(w[a]=H(u))}}P(X.pairs+"`");function H(L){return function(g){return A(g,L)}}function B(L){var g=L.state.closeBrackets;if(!g||g.override)return g;var u=L.getModeAt(L.getCursor());return u.closeBrackets||g}function I(L){var g=B(L);if(!g||L.getOption("disableInput"))return ae.Pass;for(var u=K(g,"pairs"),a=L.listSelections(),l=0;l<a.length;l++){if(!a[l].empty())return ae.Pass;var d=M(L,a[l].head);if(!d||u.indexOf(d)%2!=0)return ae.Pass}for(var l=a.length-1;l>=0;l--){var E=a[l].head;L.replaceRange("",D(E.line,E.ch-1),D(E.line,E.ch+1),"+delete")}}function _(L){var g=B(L),u=g&&K(g,"explode");if(!u||L.getOption("disableInput"))return ae.Pass;for(var a=L.listSelections(),l=0;l<a.length;l++){if(!a[l].empty())return ae.Pass;var d=M(L,a[l].head);if(!d||u.indexOf(d)%2!=0)return ae.Pass}L.operation(function(){var E=L.lineSeparator()||`
`;L.replaceSelection(E+E,null),L.execCommand("goCharLeft"),a=L.listSelections();for(var v=0;v<a.length;v++){var m=a[v].head.line;L.indentLine(m,null,!0),L.indentLine(m+1,null,!0)}})}function x(L){var g=ae.cmpPos(L.anchor,L.head)>0;return{anchor:new D(L.anchor.line,L.anchor.ch+(g?-1:1)),head:new D(L.head.line,L.head.ch+(g?1:-1))}}function A(L,g){var u=B(L);if(!u||L.getOption("disableInput"))return ae.Pass;var a=K(u,"pairs"),l=a.indexOf(g);if(l==-1)return ae.Pass;for(var d=K(u,"closeBefore"),E=K(u,"triples"),v=a.charAt(l+1)==g,m=L.listSelections(),k=l%2==0,b,h=0;h<m.length;h++){var p=m[h],c=p.head,o,S=L.getRange(c,D(c.line,c.ch+1));if(k&&!p.empty())o="surround";else if((v||!k)&&S==g)v&&O(L,c)?o="both":E.indexOf(g)>=0&&L.getRange(c,D(c.line,c.ch+3))==g+g+g?o="skipThree":o="skip";else if(v&&c.ch>1&&E.indexOf(g)>=0&&L.getRange(D(c.line,c.ch-2),c)==g+g){if(c.ch>2&&/\bstring/.test(L.getTokenTypeAt(D(c.line,c.ch-2))))return ae.Pass;o="addFour"}else if(v){var y=c.ch==0?" ":L.getRange(D(c.line,c.ch-1),c);if(!ae.isWordChar(S)&&y!=g&&!ae.isWordChar(y))o="both";else return ae.Pass}else if(k&&(S.length===0||/\s/.test(S)||d.indexOf(S)>-1))o="both";else return ae.Pass;if(!b)b=o;else if(b!=o)return ae.Pass}var T=l%2?a.charAt(l-1):g,N=l%2?g:a.charAt(l+1);L.operation(function(){if(b=="skip")L.execCommand("goCharRight");else if(b=="skipThree")for(var z=0;z<3;z++)L.execCommand("goCharRight");else if(b=="surround"){for(var Y=L.getSelections(),z=0;z<Y.length;z++)Y[z]=T+Y[z]+N;L.replaceSelections(Y,"around"),Y=L.listSelections().slice();for(var z=0;z<Y.length;z++)Y[z]=x(Y[z]);L.setSelections(Y)}else b=="both"?(L.replaceSelection(T+N,null),L.triggerElectric(T+N),L.execCommand("goCharLeft")):b=="addFour"&&(L.replaceSelection(T+T+T+T,"before"),L.execCommand("goCharRight"))})}function M(L,g){var u=L.getRange(D(g.line,g.ch-1),D(g.line,g.ch+1));return u.length==2?u:null}function O(L,g){var u=L.getTokenAt(D(g.line,g.ch+1));return/\bstring/.test(u.type)&&u.start==g.ch&&(g.ch==0||!/\bstring/.test(L.getTokenTypeAt(g)))}})},F8wB:function(Ft,gt,ie){Ft.exports={loading:"loading___1SIOG"}},Gytx:function(Ft,gt){Ft.exports=function(ae,X,D,K){var w=D?D.call(K,ae,X):void 0;if(w!==void 0)return!!w;if(ae===X)return!0;if(typeof ae!="object"||!ae||typeof X!="object"||!X)return!1;var P=Object.keys(ae),H=Object.keys(X);if(P.length!==H.length)return!1;for(var B=Object.prototype.hasOwnProperty.bind(X),I=0;I<P.length;I++){var _=P[I];if(!B(_))return!1;var x=ae[_],A=X[_];if(w=D?D.call(K,x,A,_):void 0,w===!1||w===void 0&&x!==A)return!1}return!0}},HmJG:function(Ft,gt,ie){},I8Z2:function(Ft,gt,ie){"use strict";ie.d(gt,"a",function(){return K}),ie.d(gt,"b",function(){return M}),ie.d(gt,"c",function(){return L});var ae=ie("q1tI"),X=function(){var g=function(u,a){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,d){l.__proto__=d}||function(l,d){for(var E in d)d.hasOwnProperty(E)&&(l[E]=d[E])},g(u,a)};return function(u,a){g(u,a);function l(){this.constructor=u}u.prototype=a===null?Object.create(a):(l.prototype=a.prototype,new l)}}(),D=ae.createContext(null),K=function(g){X(u,g);function u(){return g!==null&&g.apply(this,arguments)||this}return u.prototype.render=function(){return ae.createElement(D.Provider,{value:this.props.store},this.props.children)},u}(ae.Component),w=ie("Gytx"),P=ie.n(w),H=ie("2mql"),B=ie.n(H),I=function(){var g=function(u,a){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,d){l.__proto__=d}||function(l,d){for(var E in d)d.hasOwnProperty(E)&&(l[E]=d[E])},g(u,a)};return function(u,a){g(u,a);function l(){this.constructor=u}u.prototype=a===null?Object.create(a):(l.prototype=a.prototype,new l)}}(),_=function(){return _=Object.assign||function(g){for(var u,a=1,l=arguments.length;a<l;a++){u=arguments[a];for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&(g[d]=u[d])}return g},_.apply(this,arguments)};function x(g){return g.displayName||g.name||"Component"}var A=function(){return{}};function M(g,u){u===void 0&&(u={});var a=!!g,l=g||A;return function(E){var v=function(k){I(b,k);function b(h,p){var c=k.call(this,h,p)||this;return c.unsubscribe=null,c.handleChange=function(){if(!c.unsubscribe)return;var o=l(c.store.getState(),c.props);c.setState({subscribed:o})},c.store=c.context,c.state={subscribed:l(c.store.getState(),h),store:c.store,props:h},c}return b.getDerivedStateFromProps=function(h,p){return g&&g.length===2&&h!==p.props?{subscribed:l(p.store.getState(),h),props:h}:{props:h}},b.prototype.componentDidMount=function(){this.trySubscribe()},b.prototype.componentWillUnmount=function(){this.tryUnsubscribe()},b.prototype.shouldComponentUpdate=function(h,p){return!P()(this.props,h)||!P()(this.state.subscribed,p.subscribed)},b.prototype.trySubscribe=function(){a&&(this.unsubscribe=this.store.subscribe(this.handleChange),this.handleChange())},b.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)},b.prototype.render=function(){var h=_(_(_({},this.props),this.state.subscribed),{store:this.store});return ae.createElement(E,_({},h,{ref:this.props.miniStoreForwardedRef}))},b.displayName="Connect("+x(E)+")",b.contextType=D,b}(ae.Component);if(u.forwardRef){var m=ae.forwardRef(function(k,b){return ae.createElement(v,_({},k,{miniStoreForwardedRef:b}))});return B()(m,E)}return B()(v,E)}}var O=function(){return O=Object.assign||function(g){for(var u,a=1,l=arguments.length;a<l;a++){u=arguments[a];for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&(g[d]=u[d])}return g},O.apply(this,arguments)};function L(g){var u=g,a=[];function l(v){u=O(O({},u),v);for(var m=0;m<a.length;m++)a[m]()}function d(){return u}function E(v){return a.push(v),function(){var k=a.indexOf(v);a.splice(k,1)}}return{setState:l,getState:d,subscribe:E}}},LdHM:function(Ft,gt,ie){"use strict";ie.d(gt,"b",function(){return d}),ie.d(gt,"a",function(){return v});var ae=ie("1OyB"),X=ie("vuIU"),D=ie("Ji7U"),K=ie("LK+K"),w=ie("q1tI"),P=ie("rePB"),H=ie("Ff2n"),B=ie("ODXe"),I=ie("4IlW"),_=ie("bX4T"),x=ie("YrtM"),A=ie("TSYQ"),M=ie.n(A),O=ie("+nKL"),L=ie("8OUc"),g=function(te,ue){var be=te.prefixCls,Oe=te.id,Ke=te.flattenOptions,_e=te.childrenAsData,Ie=te.values,Ue=te.searchValue,Pe=te.multiple,Te=te.defaultActiveFirstOption,se=te.height,He=te.itemHeight,ht=te.notFoundContent,it=te.open,at=te.menuItemSelectedIcon,ft=te.virtual,je=te.onSelect,Ye=te.onToggleOpen,rt=te.onActiveValue,ot=te.onScroll,et=te.onMouseEnter,Ve="".concat(be,"-item"),$e=Object(x.a)(function(){return Ke},[it,Ke],function(Ze,we){return we[0]&&Ze[1]!==we[1]}),bt=w.useRef(null),pt=function(we){we.preventDefault()},mt=function(we){bt.current&&bt.current.scrollTo({index:we})},st=function(we){for(var ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,Ee=$e.length,re=0;re<Ee;re+=1){var ne=(we+re*ye+Ee)%Ee,de=$e[ne],ge=de.group,Se=de.data;if(!ge&&!Se.disabled)return ne}return-1},Ot=w.useState(function(){return st(0)}),xt=Object(B.a)(Ot,2),vt=xt[0],Ne=xt[1],Lt=function(we){Ne(we);var ye=$e[we];if(!ye){rt(null,-1);return}rt(ye.data.value,we)};w.useEffect(function(){Lt(Te!==!1?st(0):-1)},[$e.length,Ue]),w.useEffect(function(){var Ze=setTimeout(function(){if(!Pe&&it&&Ie.size===1){var we=Array.from(Ie)[0],ye=$e.findIndex(function(Ee){var re=Ee.data;return re.value===we});Lt(ye),mt(ye)}});return function(){return clearTimeout(Ze)}},[it]);var Et=function(we){we!==void 0&&je(we,{selected:!Ie.has(we)}),Pe||Ye(!1)};if(w.useImperativeHandle(ue,function(){return{onKeyDown:function(we){var ye=we.which;switch(ye){case I.a.UP:case I.a.DOWN:{var Ee=0;if(ye===I.a.UP?Ee=-1:ye===I.a.DOWN&&(Ee=1),Ee!==0){var re=st(vt+Ee,Ee);mt(re),Lt(re)}break}case I.a.ENTER:{var ne=$e[vt];ne&&!ne.data.disabled?Et(ne.data.value):Et(void 0),it&&we.preventDefault();break}case I.a.ESC:Ye(!1)}},onKeyUp:function(){},scrollTo:function(we){mt(we)}}}),$e.length===0)return w.createElement("div",{role:"listbox",id:"".concat(Oe,"_list"),className:"".concat(Ve,"-empty"),onMouseDown:pt},ht);function Fe(Ze){var we=$e[Ze];if(!we)return null;var ye=we.data||{},Ee=ye.value,re=ye.label,ne=ye.children,de=Object(_.a)(ye,!0),ge=_e?ne:re;return we?w.createElement("div",Object.assign({"aria-label":typeof ge=="string"?ge:null},de,{key:Ze,role:"option",id:"".concat(Oe,"_list_").concat(Ze),"aria-selected":Ie.has(Ee)}),Ee):null}return w.createElement(w.Fragment,null,w.createElement("div",{role:"listbox",id:"".concat(Oe,"_list"),style:{height:0,width:0,overflow:"hidden"}},Fe(vt-1),Fe(vt),Fe(vt+1)),w.createElement(O.a,{itemKey:"key",ref:bt,data:$e,height:se,itemHeight:He,fullHeight:!1,onMouseDown:pt,onScroll:ot,virtual:ft,onMouseEnter:et},function(Ze,we){var ye,Ee=Ze.group,re=Ze.groupOption,ne=Ze.data,de=ne.label,ge=ne.key;if(Ee)return w.createElement("div",{className:M()(Ve,"".concat(Ve,"-group"))},de!==void 0?de:ge);var Se=ne.disabled,Re=ne.value,Ge=ne.title,yt=ne.children,_t=ne.style,kt=ne.className,Gt=Object(H.a)(ne,["disabled","value","title","children","style","className"]),Kt=Ie.has(Re),Ct="".concat(Ve,"-option"),pr=M()(Ve,Ct,kt,(ye={},Object(P.a)(ye,"".concat(Ct,"-grouped"),re),Object(P.a)(ye,"".concat(Ct,"-active"),vt===we&&!Se),Object(P.a)(ye,"".concat(Ct,"-disabled"),Se),Object(P.a)(ye,"".concat(Ct,"-selected"),Kt),ye)),rr=_e?yt:de,Ir=!at||typeof at=="function"||Kt;return w.createElement("div",Object.assign({},Gt,{"aria-selected":Kt,className:pr,title:Ge,onMouseMove:function(){if(vt===we||Se)return;Lt(we)},onClick:function(){Se||Et(Re)},style:_t}),w.createElement("div",{className:"".concat(Ct,"-content")},rr||Re),w.isValidElement(at)||Kt,Ir&&w.createElement(L.a,{className:"".concat(Ve,"-option-state"),customizeIcon:at,customizeIconProps:{isSelected:Kt}},Kt?"\u2713":null))}))},u=w.forwardRef(g);u.displayName="OptionList";var a=u,l=function(){return null};l.isSelectOption=!0;var d=l,E=function(){return null};E.isSelectOptGroup=!0;var v=E,m=ie("VTBJ"),k=ie("Zm9Q");function b(W){var te=W.key,ue=W.props,be=ue.children,Oe=ue.value,Ke=Object(H.a)(ue,["children","value"]);return Object(m.a)({key:te,value:Oe!==void 0?Oe:te,children:be},Ke)}function h(W){var te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(k.a)(W).map(function(ue,be){if(!w.isValidElement(ue)||!ue.type)return null;var Oe=ue.type.isSelectOptGroup,Ke=ue.key,_e=ue.props,Ie=_e.children,Ue=Object(H.a)(_e,["children"]);return te||!Oe?b(ue):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(Ke===null?be:Ke,"__"),label:Ke},Ue),{},{options:h(Ie)})}).filter(function(ue){return ue})}var p=ie("2Qr1"),c=ie("qNPg"),o=ie("U8pU"),S=ie("Kwbf"),y=ie("WKfj");function T(W){var te=W.mode,ue=W.options,be=W.children,Oe=W.backfill,Ke=W.allowClear,_e=W.placeholder,Ie=W.getInputElement,Ue=W.showSearch,Pe=W.onSearch,Te=W.defaultOpen,se=W.autoFocus,He=W.labelInValue,ht=W.value,it=W.inputValue,at=W.optionLabelProp,ft=te==="multiple"||te==="tags",je=Ue!==void 0?Ue:ft||te==="combobox",Ye=ue||h(be);if(Object(S.a)(te!=="tags"||Ye.every(function(Ve){return!Ve.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),te==="tags"||te==="combobox"){var rt=Ye.some(function(Ve){return Ve.options?Ve.options.some(function($e){return typeof("value"in $e?$e.value:$e.key)=="number"}):typeof("value"in Ve?Ve.value:Ve.key)=="number"});Object(S.a)(!rt,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(S.a)(te!=="combobox"||!at,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(S.a)(te==="combobox"||!Oe,"`backfill` only works with `combobox` mode."),Object(S.a)(te==="combobox"||!Ie,"`getInputElement` only work with `combobox` mode."),Object(S.b)(te!=="combobox"||!Ie||!Ke||!_e,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Pe&&!je&&te!=="combobox"&&te!=="tags"&&Object(S.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(S.b)(!Te||se,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ht!=null){var ot=Object(y.d)(ht);Object(S.a)(!He||ot.every(function(Ve){return Object(o.a)(Ve)==="object"&&("key"in Ve||"value"in Ve)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(S.a)(!ft||Array.isArray(ht),"`value` should be array when `mode` is `multiple` or `tags`")}if(be){var et=null;Object(k.a)(be).some(function(Ve){if(!w.isValidElement(Ve)||!Ve.type)return!1;var $e=Ve.type;if($e.isSelectOption)return!1;if($e.isSelectOptGroup){var bt=Object(k.a)(Ve.props.children).every(function(pt){return!w.isValidElement(pt)||!Ve.type||pt.type.isSelectOption?!0:(et=pt.type,!1)});return!bt}return et=$e,!0}),et&&Object(S.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(et.displayName||et.name||et,"`.")),Object(S.a)(it===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var N=T,z=Object(c.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:h,flattenOptions:p.d,getLabeledValue:p.e,filterOptions:p.b,isValueDisabled:p.g,findValueOption:p.c,warningProps:N,fillOptionsWithMissingValue:p.a}),Y=function(W){Object(D.a)(ue,W);var te=Object(K.a)(ue);function ue(){var be;return Object(ae.a)(this,ue),be=te.apply(this,arguments),be.selectRef=w.createRef(),be.focus=function(){be.selectRef.current.focus()},be.blur=function(){be.selectRef.current.blur()},be}return Object(X.a)(ue,[{key:"render",value:function(){return w.createElement(z,Object.assign({ref:this.selectRef},this.props))}}]),ue}(w.Component);Y.Option=d,Y.OptGroup=v;var ee=Y,G=gt.c=ee},M8RZ:function(Ft,gt,ie){"use strict";ie.d(gt,"a",function(){return I});var ae=ie("fWQN"),X=ie("mtLc"),D=ie("yKVA"),K=ie("879j"),w=ie("q1tI"),P=ie.n(w),H=ie("i8i4"),B=ie.n(H),I=function(_){Object(D.a)(A,_);var x=Object(K.a)(A);function A(M){var O;Object(ae.a)(this,A),O=x.call(this,M);var L=window.document;return O.node=L.createElement("div"),L.body.appendChild(O.node),O}return Object(X.a)(A,[{key:"render",value:function(){var O=this.props.children;return Object(H.createPortal)(O,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),A}(P.a.Component)},OLES:function(Ft,gt,ie){"use strict";var ae=ie("U8pU"),X=ie("VTBJ"),D=ie("Ff2n"),K=ie("q1tI"),w=ie("uciX"),P=ie("7ixt"),H=function(M){var O=M.overlay,L=M.prefixCls,g=M.id,u=M.overlayInnerStyle;return K.createElement("div",{className:"".concat(L,"-inner"),id:g,role:"tooltip",style:u},typeof O=="function"?O():O)},B=H,I=function(M,O){var L=M.overlayClassName,g=M.trigger,u=g===void 0?["hover"]:g,a=M.mouseEnterDelay,l=a===void 0?0:a,d=M.mouseLeaveDelay,E=d===void 0?.1:d,v=M.overlayStyle,m=M.prefixCls,k=m===void 0?"rc-tooltip":m,b=M.children,h=M.onVisibleChange,p=M.afterVisibleChange,c=M.transitionName,o=M.animation,S=M.placement,y=S===void 0?"right":S,T=M.align,N=T===void 0?{}:T,z=M.destroyTooltipOnHide,Y=z===void 0?!1:z,ee=M.defaultVisible,G=M.getTooltipContainer,W=M.overlayInnerStyle,te=Object(D.a)(M,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),ue=Object(K.useRef)(null);Object(K.useImperativeHandle)(O,function(){return ue.current});var be=Object(X.a)({},te);"visible"in M&&(be.popupVisible=M.visible);var Oe=function(){var Pe=M.arrowContent,Te=Pe===void 0?null:Pe,se=M.overlay,He=M.id;return[K.createElement("div",{className:"".concat(k,"-arrow"),key:"arrow"},Te),K.createElement(B,{key:"content",prefixCls:k,id:He,overlay:se,overlayInnerStyle:W})]},Ke=!1,_e=!1;if(typeof Y=="boolean")Ke=Y;else if(Y&&Object(ae.a)(Y)==="object"){var Ie=Y.keepParent;Ke=Ie===!0,_e=Ie===!1}return K.createElement(w.a,Object.assign({popupClassName:L,prefixCls:k,popup:Oe,action:u,builtinPlacements:P.a,popupPlacement:y,ref:ue,popupAlign:N,getPopupContainer:G,onPopupVisibleChange:h,afterPopupVisibleChange:p,popupTransitionName:c,popupAnimation:o,defaultPopupVisible:ee,destroyPopupOnHide:Ke,autoDestroy:_e,mouseLeaveDelay:E,popupStyle:v,mouseEnterDelay:l},be),b)},_=Object(K.forwardRef)(I),x=gt.a=_},Ot1p:function(Ft,gt,ie){"use strict";var ae=ie("2qtc"),X=ie("kLXV"),D=ie("rAM+"),K=ie("miYZ"),w=ie("tsqr"),P=ie("9og8"),H=ie("tJVT"),B=ie("jrin"),I=ie("WmNS"),_=ie.n(I),x=ie("q1tI"),A=ie.n(x),M=ie("VrN/"),O=ie.n(M),L=ie("bdgK"),g=ie("p77/"),u=ie("Bd2K"),a=ie("ELLl"),l=ie("19Vz"),d=ie("lZu9"),E=ie("+NIl"),v=ie("kSUc"),m=ie("9Bee"),k=function(Se){var Re=Se.value,Ge=Re===void 0?"":Re,yt=Se.className,_t=Se.showTextOnly,kt=Se.showLines,Gt=Se.style,Kt=Gt===void 0?{}:Gt,Ct=Object(x.useMemo)(function(){return""},[Ge]);return A.a.createElement(A.a.Fragment,null,A.a.createElement("div",{dangerouslySetInnerHTML:{__html:Ct}}))},b=ie("0Owb"),h=ie("dejd"),p=ie("C+DQ"),c=ie("1vsH"),o=ie("m3rI"),S=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function y(Se){var Re=Se.onActionCallback,Ge=Se.title,yt=Se.icon,_t=Se.actionName,kt=Se.className,Gt=kt===void 0?"":kt,Kt=Se.children;function Ct(){Re(_t)}return A.a.createElement("a",{title:Ge,className:Gt,onClick:Ct},A.a.createElement("i",{className:"md-iconfont ".concat(yt)}),Kt)}var T=function(Se){var Re=Se.watch,Ge=Se.showNullButton,yt=Se.onActionCallback,_t=Se.fullScreen,kt=Se.insertTemp,Gt=Se.hidetoolBar,Kt=Se.uuid,Ct=Se.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(c.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(c.F)("_educoder_session"),"&key=").concat(Kt,"&api=").concat(encodeURIComponent(o.a.PROXY_SERVER)));var pr=[].concat(S,[{title:"".concat(Re?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Re?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return A.a.createElement("ul",{className:"markdown-toolbar-container"},!Gt&&pr.map(function(rr,Ir){return A.a.createElement("li",{key:Ir},rr.actionName?A.a.createElement(y,Object(b.a)({},rr,{onActionCallback:yt})):A.a.createElement("span",{className:"v-line"}))}),Ge?A.a.createElement("li",null,A.a.createElement(y,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:yt},A.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,kt&&A.a.createElement("li",null,A.a.createElement(y,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(kt),onActionCallback:yt},A.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),A.a.createElement("li",{className:"btn-full-screen"},A.a.createElement(y,{icon:"".concat(_t?"icon-shrink":"icon-enlarge"),title:_t?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:yt})))},N=ie("M8RZ"),z=ie("+L6B"),Y=ie("2/Rp"),ee=ie("y8nQ"),G=ie("Vl3Y"),W=ie("5NDa"),te=ie("5rEg"),ue={labelCol:{span:4},wrapperCol:{span:20}},be=function(Se){var Re=Se.callback,Ge=Se.onCancel;function yt(_t){Re(_t)}return A.a.createElement(G.a,Object(b.a)({},ue,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:yt}),A.a.createElement(G.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},A.a.createElement(te.a,null)),A.a.createElement(G.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},A.a.createElement(te.a,null)),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(Y.a,{type:"ghost",onClick:Ge},"\u53D6\u6D88")))},Oe=ie("7ahc"),Ke=ie("HmJG"),_e=ie("BjJ7"),Ie=G.a.useForm,Ue={width:280,marginRight:10},Pe={labelCol:{span:5},wrapperCol:{span:19}},Te=function(Se){var Re=Se.callback,Ge=Se.onCancel,yt=Ie(),_t=Object(H.a)(yt,1),kt=_t[0];function Gt(pr){Re(pr)}function Kt(pr,rr){if(pr.status===-1){w.b.error(pr.message);return}kt.setFieldsValue({src:"/api/attachments/".concat(pr.id),type:rr.type})}function Ct(pr){var rr=pr.target.files[0];He(rr,Kt)}return A.a.createElement(G.a,Object(b.a)({form:kt},Pe,{className:"upload-image-panel",onFinish:Gt}),A.a.createElement(G.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},A.a.createElement("div",{className:"flex-container"},A.a.createElement(G.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},A.a.createElement(te.a,{style:Ue})),A.a.createElement(se,{onFileChange:Ct}))),A.a.createElement(G.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},A.a.createElement(te.a,{style:{width:264}})),A.a.createElement(G.a.Item,{style:{textAlign:"right"}},A.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(Y.a,{type:"ghost",onClick:Ge},"\u53D6\u6D88")))};function se(Se){var Re=Se.onFileChange;return A.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",A.a.createElement("input",{type:"file",onChange:Re}))}function He(Se,Re){if(!Se)throw new String("\u6CA1\u6709\u6587\u4EF6");var Ge=new FormData;Ge.append("editormd-image-file",Se),Ge.append("file_param_name","editormd-image-file"),Ge.append("byxhr","true");var yt=new window.XMLHttpRequest;yt.withCredentials=!0,yt.addEventListener("load",function(_t){Re(JSON.parse(_t.target.responseText),Se)},!1),yt.addEventListener("error",function(_t){console.error(_t)},!1),yt.open("POST","".concat(_e.a,"/api/attachments.json")),yt.send(Ge)}var ht=ie("giR+"),it=ie("fyUT"),at=ie("7Kak"),ft=ie("9yH6"),je=ft.a.Group,Ye={margin:"0 8px"},rt=function(Se){var Re=Se.callback,Ge=Se.onCancel;function yt(_t){Re(_t)}return A.a.createElement(G.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:yt},A.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},A.a.createElement("span",{style:Ye},"\u5355\u5143\u683C\u6570\uFF1A"),A.a.createElement("span",{style:Ye},"\u884C\u6570"),A.a.createElement(G.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},A.a.createElement(it.a,null)),A.a.createElement("span",{style:Ye},"\u5217\u6570"),A.a.createElement(G.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},A.a.createElement(it.a,null))),A.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},A.a.createElement("span",{style:Ye},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),A.a.createElement(G.a.Item,{name:"align"},A.a.createElement(je,null,A.a.createElement(ft.a,{value:"default"},A.a.createElement("i",{className:"fa fa-align-justify"})),A.a.createElement(ft.a,{value:"left"},A.a.createElement("i",{className:"fa fa-align-left"})),A.a.createElement(ft.a,{value:"center"},A.a.createElement("i",{className:"fa fa-align-center"})),A.a.createElement(ft.a,{value:"right"},A.a.createElement("i",{className:"fa fa-align-right"}))))),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(Y.a,{type:"ghost",onClick:Ge},"\u53D6\u6D88")))},ot=ie("ErOA"),et=ie("7Cbv"),Ve="link",$e="upload-image",bt="code-block",pt="add-table",mt="------------",st={default:mt,left:":".concat(mt),center:":".concat(mt,":"),right:"".concat(mt,":")},Ot=ie("9VGf"),xt,vt;function Ne(){}var Lt=0,Et=1e4,Fe="\u2581",Ze=`
**\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 we(Se){return/^\d+$/.test(Se)?"".concat(Se,"px"):Se}var ye=navigator.platform.toUpperCase().indexOf("MAC")>=0,Ee=ye?"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"],ne=(xt={},Object(B.a)(xt,Ee+"-B","bold"),Object(B.a)(xt,Ee+"-I","italic"),xt),de=(vt={},Object(B.a)(vt,Ve,"\u6DFB\u52A0\u94FE\u63A5"),Object(B.a)(vt,bt,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(B.a)(vt,$e,"\u6DFB\u52A0\u6587\u4EF6"),Object(B.a)(vt,pt,"\u6DFB\u52A0\u8868\u683C"),vt),ge=gt.a=function(Se){var Re=Se.defaultValue,Ge=Re===void 0?"":Re,yt=Se.onChange,_t=Se.width,kt=_t===void 0?"100%":_t,Gt=Se.height,Kt=Gt===void 0?400:Gt,Ct=Se.miniToolbar,pr=Ct===void 0?!1:Ct,rr=Se.isFocus,Ir=rr===void 0?!1:rr,Pr=Se.watch,Vt=Se.insertTemp,an=Se.mode,En=an===void 0?"markdown":an,It=Se.id,An=It===void 0?"markdown-editor-id":It,on=Se.showResizeBar,sn=on===void 0?!1:on,Un=Se.noStorage,ci=Un===void 0?!1:Un,Qn=Se.showNullButton,mr=Qn===void 0?!1:Qn,wt=Se.hidetoolBar,Vn=wt===void 0?!1:wt,oi=Se.fullScreen,mn=oi===void 0?!1:oi,nr=Se.onBlur,Bn=Se.onCMBeforeChange,Zn=Se.onFullScreen,hi=Se.className,Je=hi===void 0?"":hi,jt=Se.disablePaste,si=jt===void 0?!1:jt,fi=Se.placeholder,Si=fi===void 0?"":fi,li=Se.values,j=li===void 0?"":li,s=Object(x.useState)(null),f=Object(H.a)(s,2),R=f[0],Q=f[1],F=Object(x.useState)(Ge),ve=Object(H.a)(F,2),ze=ve[0],lt=ve[1],At=Object(x.useState)(Pr),Xe=Object(H.a)(At,2),Rt=Xe[0],gr=Xe[1],Dr=Object(x.useState)(mn),Ln=Object(H.a)(Dr,2),gn=Ln[0],ln=Ln[1],Jn=Object(x.useState)(""),Pi=Object(H.a)(Jn,2),Qr=Pi[0],Fn=Pi[1],pi=Object(x.useState)(0),ui=Object(H.a)(pi,2),Sn=ui[0],Ii=ui[1],Ci=Object(x.useState)(Kt),Gi=Object(H.a)(Ci,2),Vi=Gi[0],qn=Gi[1],en=Object(x.useState)(!1),mi=Object(H.a)(en,2),oa=mi[0],Ni=mi[1],Fr=Object(x.useRef)(Object(et.a)()),vr=Object(x.useRef)(!1),Kr=Object(x.useRef)(),qt=Object(x.useRef)(),zr=Object(x.useRef)(),Sr=Object(x.useRef)(),ei=Object(x.useRef)(),tn=function(){var Mt=Object(P.a)(_.a.mark(function zt(){var Pt,er;return _.a.wrap(function(Cr){for(;;)switch(Cr.prev=Cr.next){case 0:return Cr.next=2,Object(ot.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Fr.current}});case 2:er=Cr.sent,er!=null&&(Pt=er.attachments)!==null&&Pt!==void 0&&Pt.length&&(console.log("cm:",R,qt),er.attachments.map(function(ur){ur.content_type.indexOf("image")>-1?R.replaceSelection("![,](/api/attachments/".concat(ur.id,"?type=").concat(ur.content_type,")")):ur.content_type.indexOf("video")>-1?R.replaceSelection('<video width="100%" controls src="'.concat(o.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):ur.content_type.indexOf("pdf")>-1?R.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(ur.id,"?type=").concat(ur.content_type,'&disposition=inline" target="_blank">').concat(ur.name,"</a>")):R.replaceSelection("[".concat(ur.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(ur.id,"?type=").concat(ur.content_type,")"))}));case 4:case"end":return Cr.stop()}},zt)}));return function(){return Mt.apply(this,arguments)}}();Object(x.useEffect)(function(){lt(j),R==null||R.setValue(j)},[j]),Object(x.useEffect)(function(){Zn==null||Zn(gn)},[gn]),Object(x.useEffect)(function(){if(qt.current){var Mt=O.a.fromTextArea(qt.current,{mode:En,lineNumbers:!pr,lineWrapping:!0,value:Ge,autoCloseTags:!0,autoCloseBrackets:!0});Ir&&Mt.focus();function zt(Pt,er){if(si){er.preventDefault();return}var hr=er.clipboardData;if(hr){var Cr=hr.types.toString(),ur=hr.items;if(Cr==="Files"||hr.types.indexOf("Files")>-1){if(er.preventDefault(),En=="stex")return;try{var Vr,Mn=ur[1];((Vr=ur[0])===null||Vr===void 0?void 0:Vr.kind)==="file"&&(Mn=ur[0]);var ir=Mn.getAsFile(),gi=ir.name.split(".").pop();He(ir,function(br){if(br.id){var Cn,yn,Yn;(ir==null||((Cn=ir.type)===null||Cn===void 0)?void 0:Cn.indexOf("image"))>-1?Mt.replaceSelection("![,](/api/attachments/".concat(br.id,"?type=").concat(br.content_type,")")):(ir==null||((yn=ir.type)===null||yn===void 0)?void 0:yn.indexOf("video"))>-1?Mt.replaceSelection('<video width="100%" controls src="'.concat(o.a.API_SERVER,"/api/attachments/").concat(br.id,'"></video>')):(ir==null||((Yn=ir.type)===null||Yn===void 0)?void 0:Yn.indexOf("pdf"))>-1?Mt.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(br.id,"?type=").concat(ir.type,'&disposition=inline" target="_blank">').concat(ir.name,"</a>")):re.includes(gi)?Mt.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(br.id,'?type=office&disposition=inline" target="_blank">').concat(ir.name,"</a>")):Mt.replaceSelection("[".concat(ir.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(br.id,"?type=").concat(br.content_type,")"))}else(br==null?void 0:br.status)===401&&(document.location.href="/user/login")})}catch(br){w.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return Mt.on("paste",zt),Mt.on("dragleave",function(Pt,er){zr.current.classList.remove("mouse-hover-md")}),Mt.on("dragover",function(Pt,er){zr.current.classList.add("mouse-hover-md")}),Mt.on("drop",function(Pt,er){zr.current.classList.add("mouse-hover-md");var hr;if(hr=er.dataTransfer.files,hr.length>0){er.preventDefault(),er.stopPropagation();for(var Cr=function(Mn){var ir=hr[Mn],gi=ir.name.split(".").pop();He(ir,function(br){if(br.id){var Cn,yn,Yn;(ir==null||((Cn=ir.type)===null||Cn===void 0)?void 0:Cn.indexOf("image"))>-1?Mt.replaceSelection("![,](/api/attachments/".concat(br.id,"?type=").concat(br.content_type,")")):(ir==null||((yn=ir.type)===null||yn===void 0)?void 0:yn.indexOf("video"))>-1?Mt.replaceSelection('<video width="100%" controls src="'.concat(o.a.API_SERVER,"/api/attachments/").concat(br.id,'"></video>')):(ir==null||((Yn=ir.type)===null||Yn===void 0)?void 0:Yn.indexOf("pdf"))>-1?Mt.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(br.id,"?type=").concat(ir.type,'&disposition=inline" target="_blank">').concat(ir.name,"</a>")):re.includes(gi)?Mt.replaceSelection('<a href="'.concat(o.a.API_SERVER,"/api/attachments/").concat(br.id,'?type=office&disposition=inline" target="_blank">').concat(ir.name,"</a>")):Mt.replaceSelection("[".concat(ir.name,"](").concat(o.a.API_SERVER,"/api/attachments/").concat(br.id,"?type=").concat(br.content_type,")"))}else(br==null?void 0:br.status)===401&&(document.location.href="/user/login")})},ur=0;ur<hr.length;ur++)Cr(ur)}}),Q(Mt),function(){Mt.off("paste",zt)}}},[]);var vn=Object(x.useCallback)(function(){if(zr.current)try{}catch(Mt){console.log(Mt,"---- to set md editor body height")}},[Vi,zr,gn]);Object(x.useEffect)(function(){function Mt(){var Pt=new L.default(function(er){var hr=Object(D.a)(er),Cr;try{for(hr.s();!(Cr=hr.n()).done;){var ur=Cr.value;(ur.target.offsetHeight>0||ur.target.offsetWidth>0)&&(vn(),R.setSize("100%","100%"),R.refresh())}}catch(Vr){hr.e(Vr)}finally{hr.f()}});return Pt.observe(qt.current.parentElement),Pt}if(R){var zt=Mt();return function(){zt.unobserve(qt.current.parentElement)}}},[R,vn]),Object(x.useEffect)(function(){if(R){for(var Mt=[],zt=function(){var ur=er[Pt];hr=Object(H.a)(ur,2);var Vr=hr[0],Mn=hr[1],ir=Object(B.a)({},Vr,function(){Xi(Mn)});Mt.push(ir),R.addKeyMap(ir)},Pt=0,er=Object.entries(ne);Pt<er.length;Pt++){var hr;zt()}return Kr.current=setInterval(function(){vr.current&&tn()},4e3),function(){clearInterval(Kr.current);var Cr=Object(D.a)(Mt),ur;try{for(Cr.s();!(ur=Cr.n()).done;){var Vr=ur.value;R.removeKeyMap(Vr)}}catch(Mn){Cr.e(Mn)}finally{Cr.f()}}}},[R]),Object(x.useEffect)(function(){mn!==gn&&ln(mn)},[mn]),Object(Ot.a)(function(){if(!ci&&Sn>0){var Mt=new Date().getTime(),zt=window.sessionStorage.getItem(An);Mt>=Sn+Et&&(!zt||zt!==ze)&&(window.sessionStorage.setItem(An,ze),Ni(!0))}},Et),Object(x.useEffect)(function(){gr(Pr)},[R,Pr]),Object(x.useEffect)(function(){R&&(Ir&&R.focus())},[R,Ir]),Object(x.useEffect)(function(){if(Rt&&R){var Mt=R.getScrollerElement();function zt(Pt){var er=Pt.target;if(ei.current){var hr=er.scrollTop/er.scrollHeight;ei.current.scrollTop=ei.current.scrollHeight*hr}}return Mt.addEventListener("scroll",zt),function(){Mt.removeEventListener("scroll",zt)}}},[R,Rt]),Object(x.useEffect)(function(){if(R&&Bn){function Mt(zt,Pt){Bn(zt,Pt)}return R.on("beforeChange",Mt),function(){R.off("beforeChange",Mt)}}},[R,Bn]),Object(x.useEffect)(function(){if(R&&nr){function Mt(){nr(R.getValue())}return R.on("blur",Mt),function(){R.off("blur",Mt)}}},[R,nr]),Object(x.useEffect)(function(){if(R){function Mt(zt){var Pt=zt.getValue();lt(Pt),Ii(new Date().getTime()),zt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),yt&&yt(Pt)}return R.on("change",Mt),function(){R.off("change",Mt)}}},[R,yt]),Object(x.useEffect)(function(){R&&(Ge==null?(R.setValue(""),lt("")):Ge!==R.getValue()&&(R.setValue(Ge),lt(Ge),R.setCursor(R.lineCount(),0)))},[R,Ge]);var Xi=Object(x.useCallback)(function(Mt){var zt=R.getCursor(),Pt=R.getSelection(),er=Pt.split(`
`);switch(Mt){case"bold":return R.replaceSelection("**"+Pt+"**"),Pt===""&&R.setCursor(zt.line,zt.ch+2),R.focus();case"italic":return R.replaceSelection("*"+Pt+"*"),Pt===""&&R.setCursor(zt.line,zt.ch+1),R.focus();case"code":return R.replaceSelection("`"+Pt+"`"),Pt===""&&R.setCursor(zt.line,zt.ch+1),R.focus();case"inline-latex":return R.replaceSelection("`$$"+Pt+"$$`"),Pt===""&&R.setCursor(zt.line,zt.ch+3),R.focus();case"latex":return R.replaceSelection("```latex\n"+Pt+"\n```"),R.setCursor(zt.line+1,Pt.length+1),R.focus();case"line-break":return R.replaceSelection(`<br/>
`),R.focus();case"list-ul":return Pt===""?R.replaceSelection("- "+Pt):R.replaceSelection(er.map(function(hr){return hr===""?"":"- ".concat(hr)}).join(`
`)),R.focus();case"list-ol":return Pt===""?R.replaceSelection("1. "+Pt):R.replaceSelection(er.map(function(hr,Cr){return hr===""?"":"".concat(Cr+1,". ").concat(hr)}).join(`
`)),R.focus();case"add-null-ch":return Pt===""&&R.setCursor(zt.line,zt.ch+1),R.replaceSelection(Fe),R.focus();case"inster-template-1":return Pt===""&&R.setCursor(zt.line,zt.ch),R.replaceSelection(Ze),R.focus();case"eraser":return R.setValue(""),R.focus();case"trigger-watch":return gr(!Rt),R.focus();case"trigger-full-screen":return ln(!gn),R.focus();case Ve:Fn(Ve);return;case bt:Fn(bt);return;case $e:Fn($e);return;case pt:Fn(pt);return;default:throw new Error}},[R,Rt,gn]),Ti=Object(x.useCallback)(function(Mt){Fn("");switch(Qr){case Ve:var zt=Mt.title,Pt=Mt.link;return R.replaceSelection("[".concat(zt,"](").concat(Pt,")")),R.focus();case bt:var er=Mt.language,hr=Mt.content;return R.replaceSelection(["```"+er,hr,"```"].join(`
`)),R.focus();case $e:var Cr=Mt.src,ur=Mt.alt;return ur?R.replaceSelection("![ ".concat(ur," ]( ").concat(Cr,' "').concat(ur,'" )')):R.replaceSelection("![,](".concat(Cr,")")),R.focus();case pt:for(var Vr=Mt.row,Mn=Mt.col,ir=Mt.align,gi=`
`,br=0;br<Vr;br++){for(var Cn=[],yn=[],Yn=0;Yn<Mn;Yn++)br===1&&yn.push(st[ir]),Cn.push(" ");br===1&&(gi+="| ".concat(yn.join(" | "),` |
`)),gi+="| ".concat(Cn.join(Mn===1?"":" | "),` |
`)}return R.replaceSelection(gi+`
`),R.focus();default:throw new Error}},[R,Qr]),wi=Object(x.useMemo)(function(){switch(Qr){case Ve:return A.a.createElement(be,{callback:Ti,onCancel:jn});case bt:return A.a.createElement(Oe.b,{callback:Ti,onCancel:jn});case $e:return A.a.createElement(Te,{callback:Ti,onCancel:jn});case pt:return A.a.createElement(rt,{callback:Ti,onCancel:jn});default:return null}},[Qr]);function jn(){Fn("")}Object(x.useEffect)(function(){if(Sr.current){var Mt=Sr.current,zt=!1,Pt=0;function er(ur){zt=!0,Pt=ur.pageY}function hr(){zt=!1}function Cr(ur){if(zt){var Vr=ur.pageY-Pt;Vr<0&&(Vr=0),Vr>300&&(Vr=300);var Mn=Kt+Vr+"px";qn(Mn)}}return Mt.addEventListener("mousedown",er),document.addEventListener("mousemove",Cr),document.addEventListener("mouseup",hr),function(){Mt.removeEventListener("mousedown",er),document.removeEventListener("mousemove",Cr),document.removeEventListener("mouseup",hr)}}},[R,Sr]),Object(x.useEffect)(function(){qn(Kt)},[Kt]);var Wn=we(kt),sa=we(Vi),Xn={width:Wn,height:sa},la=Object(x.useMemo)(function(){if(Sn){var Mt=new Date(Sn),zt=Mt.getHours(),Pt=Mt.getMinutes(),er=Mt.getSeconds();return zt=zt<10?"0"+zt:zt,Pt=Pt<10?"0"+Pt:Pt,er=er<10?"0"+er:er,"".concat(zt,":").concat(Pt,":").concat(er)}return 0},[Sn]);function ua(){window.sessionStorage.removeItem(An),Ni(!1),Ii(0)}function Ui(){Ni(!1),Ii(0),R.setValue(window.sessionStorage.getItem(An))}function Ba(Mt,zt){var Pt=R.getValue();Pt=Pt.replace(Mt,zt),lt(Pt),R==null||R.setValue(Pt)}return A.a.createElement(x.Fragment,null,A.a.createElement("div",{className:"markdown-editor-wrapper",ref:zr},A.a.createElement("div",{className:"markdown-editor-container ".concat(Je," ").concat(Rt?"on-preview":""," ").concat(pr?"mini":""," ").concat(gn?"full-screen":""),style:Xn},A.a.createElement(T,{insertTemp:Vt,watch:Rt,fullScreen:gn,showNullButton:mr,onActionCallback:Xi,hidetoolBar:Vn,uuid:Fr.current,setOpenPhones:function(){vr.current=!0}}),A.a.createElement("div",{className:"markdown-editor-body"},A.a.createElement("div",{className:"codemirror-container"},A.a.createElement("textarea",{ref:qt,placeholder:Si})),Rt?A.a.createElement("div",{ref:ei,className:"preview-container"},En==="stex"&&A.a.createElement(k,{value:ze}),En!=="stex"&&A.a.createElement(m.a,{edit:!0,value:ze,replaces:Ba})):null))),sn?A.a.createElement("a",{ref:Sr,className:"editor-resize"}):null,A.a.createElement(N.a,null,de[Qr]?A.a.createElement(X.a,{centered:!0,title:de[Qr],visible:!0,onCancel:jn,footer:null,className:"markdown-popup-form"},wi):null))}},SJMd:function(Ft,gt){/**
* @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 ie,ae,X,D=!1,K,w;window.PR_SHOULD_USE_CONTINUATION=!0;var P,H;(function(){var B=window,I=["break,continue,do,else,for,if,return,while"],_=[I,"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"],x=[_,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],A=[x,"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"],M=[x,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],O=[x,"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"],L="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",g=[x,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],u="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",a=[I,"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"],l=[I,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],d=[I,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],E=[A,O,M,g,u,a,l,d],v=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,m="str",k="kwd",b="com",h="typ",p="lit",c="pun",o="pln",S="tag",y="dec",T="src",N="atn",z="atv",Y="nocode",ee="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function G(je){for(var Ye=0,rt=!1,ot=!1,et=0,Ve=je.length;et<Ve;++et){var $e=je[et];if($e.ignoreCase)ot=!0;else if(/[a-z]/i.test($e.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){rt=!0,ot=!1;break}}var bt={b:8,t:9,n:10,v:11,f:12,r:13};function pt(vt){var Ne=vt.charCodeAt(0);if(Ne!==92)return Ne;var Lt=vt.charAt(1);return Ne=bt[Lt],Ne||("0"<=Lt&&Lt<="7"?parseInt(vt.substring(1),8):Lt==="u"||Lt==="x"?parseInt(vt.substring(2),16):vt.charCodeAt(1))}function mt(vt){if(vt<32)return(vt<16?"\\x0":"\\x")+vt.toString(16);var Ne=String.fromCharCode(vt);return Ne==="\\"||Ne==="-"||Ne==="]"||Ne==="^"?"\\"+Ne:Ne}function st(vt){var Ne=vt.substring(1,vt.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")),Lt=[],Et=Ne[0]==="^",Fe=["["];Et&&Fe.push("^");for(var Ze=Et?1:0,we=Ne.length;Ze<we;++Ze){var ye=Ne[Ze];if(/\\[bdsw]/i.test(ye))Fe.push(ye);else{var Ee=pt(ye),re;Ze+2<we&&Ne[Ze+1]==="-"?(re=pt(Ne[Ze+2]),Ze+=2):re=Ee,Lt.push([Ee,re]),re<65||Ee>122||(re<65||Ee>90||Lt.push([Math.max(65,Ee)|32,Math.min(re,90)|32]),re<97||Ee>122||Lt.push([Math.max(97,Ee)&~32,Math.min(re,122)&~32]))}}Lt.sort(function(Se,Re){return Se[0]-Re[0]||Re[1]-Se[1]});for(var ne=[],de=[],Ze=0;Ze<Lt.length;++Ze){var ge=Lt[Ze];ge[0]<=de[1]+1?de[1]=Math.max(de[1],ge[1]):ne.push(de=ge)}for(var Ze=0;Ze<ne.length;++Ze){var ge=ne[Ze];Fe.push(mt(ge[0])),ge[1]>ge[0]&&(ge[1]+1>ge[0]&&Fe.push("-"),Fe.push(mt(ge[1])))}return Fe.push("]"),Fe.join("")}function Ot(vt){for(var Ne=vt.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")),Lt=Ne.length,Et=[],Fe=0,Ze=0;Fe<Lt;++Fe){var we=Ne[Fe];if(we==="(")++Ze;else if(we.charAt(0)==="\\"){var ye=+we.substring(1);ye&&(ye<=Ze?Et[ye]=-1:Ne[Fe]=mt(ye))}}for(var Fe=1;Fe<Et.length;++Fe)Et[Fe]===-1&&(Et[Fe]=++Ye);for(var Fe=0,Ze=0;Fe<Lt;++Fe){var we=Ne[Fe];if(we==="(")++Ze,Et[Ze]||(Ne[Fe]="(?:");else if(we.charAt(0)==="\\"){var ye=+we.substring(1);ye&&ye<=Ze&&(Ne[Fe]="\\"+Et[ye])}}for(var Fe=0;Fe<Lt;++Fe)Ne[Fe]==="^"&&Ne[Fe+1]!=="^"&&(Ne[Fe]="");if(vt.ignoreCase&&rt)for(var Fe=0;Fe<Lt;++Fe){var we=Ne[Fe],Ee=we.charAt(0);we.length>=2&&Ee==="["?Ne[Fe]=st(we):Ee!=="\\"&&(Ne[Fe]=we.replace(/[a-zA-Z]/g,function(de){var ge=de.charCodeAt(0);return"["+String.fromCharCode(ge&~32,ge|32)+"]"}))}return Ne.join("")}for(var xt=[],et=0,Ve=je.length;et<Ve;++et){var $e=je[et];if($e.global||$e.multiline)throw new Error(""+$e);xt.push("(?:"+Ot($e)+")")}return new RegExp(xt.join("|"),ot?"gi":"g")}function W(je,Ye){var rt=/(?:^|\s)nocode(?:\s|$)/,ot=[],et=0,Ve=[],$e=0;function bt(pt){var mt=pt.nodeType;if(mt==1){if(rt.test(pt.className))return;for(var st=pt.firstChild;st;st=st.nextSibling)bt(st);var Ot=pt.nodeName.toLowerCase();(Ot==="br"||Ot==="li")&&(ot[$e]=`
`,Ve[$e<<1]=et++,Ve[$e++<<1|1]=pt)}else if(mt==3||mt==4){var xt=pt.nodeValue;xt.length&&(Ye?xt=xt.replace(/\r\n?/g,`
`):xt=xt.replace(/[ \t\r\n]+/g," "),ot[$e]=xt,Ve[$e<<1]=et,et+=xt.length,Ve[$e++<<1|1]=pt)}}return bt(je),{sourceCode:ot.join("").replace(/\n$/,""),spans:Ve}}function te(je,Ye,rt,ot,et){if(!rt)return;var Ve={sourceNode:je,pre:1,langExtension:null,numberLines:null,sourceCode:rt,spans:null,basePos:Ye,decorations:null};ot(Ve),et.push.apply(et,Ve.decorations)}var ue=/\S/;function be(je){for(var Ye=void 0,rt=je.firstChild;rt;rt=rt.nextSibling){var ot=rt.nodeType;Ye=ot===1?Ye?je:rt:ot===3&&ue.test(rt.nodeValue)?je:Ye}return Ye===je?void 0:Ye}function Oe(je,Ye){var rt={},ot;(function(){for(var $e=je.concat(Ye),bt=[],pt={},mt=0,st=$e.length;mt<st;++mt){var Ot=$e[mt],xt=Ot[3];if(xt)for(var vt=xt.length;--vt>=0;)rt[xt.charAt(vt)]=Ot;var Ne=Ot[1],Lt=""+Ne;pt.hasOwnProperty(Lt)||(bt.push(Ne),pt[Lt]=null)}bt.push(/[\0-\uffff]/),ot=G(bt)})();var et=Ye.length,Ve=function($e){for(var bt=$e.sourceCode,pt=$e.basePos,mt=$e.sourceNode,st=[pt,o],Ot=0,xt=bt.match(ot)||[],vt={},Ne=0,Lt=xt.length;Ne<Lt;++Ne){var Et=xt[Ne],Fe=vt[Et],Ze=void 0,we;if(typeof Fe=="string")we=!1;else{var ye=rt[Et.charAt(0)];if(ye)Ze=Et.match(ye[1]),Fe=ye[0];else{for(var Ee=0;Ee<et;++Ee)if(ye=Ye[Ee],Ze=Et.match(ye[1]),Ze){Fe=ye[0];break}Ze||(Fe=o)}we=Fe.length>=5&&Fe.substring(0,5)==="lang-",we&&!(Ze&&typeof Ze[1]=="string")&&(we=!1,Fe=T),we||(vt[Et]=Fe)}var re=Ot;if(Ot+=Et.length,!we)st.push(pt+re,Fe);else{var ne=Ze[1],de=Et.indexOf(ne),ge=de+ne.length;Ze[2]&&(ge=Et.length-Ze[2].length,de=ge-ne.length);var Se=Fe.substring(5);te(mt,pt+re,Et.substring(0,de),Ve,st),te(mt,pt+re+de,ne,se(Se,ne),st),te(mt,pt+re+ge,Et.substring(ge),Ve,st)}}$e.decorations=st};return Ve}function Ke(je){var Ye=[],rt=[];je.tripleQuotedStrings?Ye.push([m,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):je.multiLineStrings?Ye.push([m,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Ye.push([m,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),je.verbatimStrings&&rt.push([m,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var ot=je.hashComments;ot&&(je.cStyleComments?(ot>1?Ye.push([b,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Ye.push([b,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),rt.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Ye.push([b,/^#[^\r\n]*/,null,"#"])),je.cStyleComments&&(rt.push([b,/^\/\/[^\r\n]*/,null]),rt.push([b,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var et=je.regexLiterals;if(et){var Ve=et>1?"":`
\r`,$e=Ve?".":"[\\S\\s]",bt="/(?=[^/*"+Ve+"])(?:[^/\\x5B\\x5C"+Ve+"]|\\x5C"+$e+"|\\x5B(?:[^\\x5C\\x5D"+Ve+"]|\\x5C"+$e+")*(?:\\x5D|$))+/";rt.push(["lang-regex",RegExp("^"+ee+"("+bt+")")])}var pt=je.types;pt&&rt.push([h,pt]);var mt=(""+je.keywords).replace(/^ | $/g,"");mt.length&&rt.push([k,new RegExp("^(?:"+mt.replace(/[\s,]+/g,"|")+")\\b"),null]),Ye.push([o,/^\s+/,null,` \r
\xA0`]);var st="^.[^\\s\\w.$@'\"`/\\\\]*";return je.regexLiterals&&(st+="(?!s*/)"),rt.push([p,/^@[a-z_$][a-z_$@0-9]*/i,null],[h,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[o,/^[a-z_$][a-z_$@0-9]*/i,null],[p,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[o,/^\\[\s\S]?/,null],[c,new RegExp(st),null]),Oe(Ye,rt)}var _e=Ke({keywords:E,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ie(je,Ye,rt){for(var ot=/(?:^|\s)nocode(?:\s|$)/,et=/\r\n?|\n/,Ve=je.ownerDocument,$e=Ve.createElement("li");je.firstChild;)$e.appendChild(je.firstChild);var bt=[$e];function pt(Ne){var Lt=Ne.nodeType;if(Lt==1&&!ot.test(Ne.className))if(Ne.nodeName==="br")mt(Ne),Ne.parentNode&&Ne.parentNode.removeChild(Ne);else for(var Et=Ne.firstChild;Et;Et=Et.nextSibling)pt(Et);else if((Lt==3||Lt==4)&&rt){var Fe=Ne.nodeValue,Ze=Fe.match(et);if(Ze){var we=Fe.substring(0,Ze.index);Ne.nodeValue=we;var ye=Fe.substring(Ze.index+Ze[0].length);if(ye){var Ee=Ne.parentNode;Ee.insertBefore(Ve.createTextNode(ye),Ne.nextSibling)}mt(Ne),we||Ne.parentNode.removeChild(Ne)}}}function mt(Ne){for(;!Ne.nextSibling;)if(Ne=Ne.parentNode,!Ne)return;function Lt(Ze,we){var ye=we?Ze.cloneNode(!1):Ze,Ee=Ze.parentNode;if(Ee){var re=Lt(Ee,1),ne=Ze.nextSibling;re.appendChild(ye);for(var de=ne;de;de=ne)ne=de.nextSibling,re.appendChild(de)}return ye}for(var Et=Lt(Ne.nextSibling,0),Fe;(Fe=Et.parentNode)&&Fe.nodeType===1;)Et=Fe;bt.push(Et)}for(var st=0;st<bt.length;++st)pt(bt[st]);Ye===(Ye|0)&&bt[0].setAttribute("value",Ye);var Ot=Ve.createElement("ol");Ot.className="linenums";for(var xt=Math.max(0,Ye-1|0)||0,st=0,vt=bt.length;st<vt;++st)$e=bt[st],$e.className="L"+(st+xt)%10,$e.firstChild||$e.appendChild(Ve.createTextNode("\xA0")),Ot.appendChild($e);je.appendChild(Ot)}function Ue(je){var Ye=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Ye=Ye&&+Ye[1]<=8;var rt=/\n/g,ot=je.sourceCode,et=ot.length,Ve=0,$e=je.spans,bt=$e.length,pt=0,mt=je.decorations,st=mt.length,Ot=0;mt[st]=et;var xt,vt;for(vt=xt=0;vt<st;)mt[vt]!==mt[vt+2]?(mt[xt++]=mt[vt++],mt[xt++]=mt[vt++]):vt+=2;for(st=xt,vt=xt=0;vt<st;){for(var Ne=mt[vt],Lt=mt[vt+1],Et=vt+2;Et+2<=st&&mt[Et+1]===Lt;)Et+=2;mt[xt++]=Ne,mt[xt++]=Lt,vt=Et}st=mt.length=xt;var Fe=je.sourceNode,Ze="";Fe&&(Ze=Fe.style.display,Fe.style.display="none");try{for(var we=null;pt<bt;){var ye=$e[pt],Ee=$e[pt+2]||et,re=mt[Ot+2]||et,Et=Math.min(Ee,re),ne=$e[pt+1],de;if(ne.nodeType!==1&&(de=ot.substring(Ve,Et))){Ye&&(de=de.replace(rt,"\r")),ne.nodeValue=de;var ge=ne.ownerDocument,Se=ge.createElement("span");Se.className=mt[Ot+1];var Re=ne.parentNode;Re.replaceChild(Se,ne),Se.appendChild(ne),Ve<Ee&&($e[pt+1]=ne=ge.createTextNode(ot.substring(Et,Ee)),Re.insertBefore(ne,Se.nextSibling))}Ve=Et,Ve>=Ee&&(pt+=2),Ve>=re&&(Ot+=2)}}finally{Fe&&(Fe.style.display=Ze)}}var Pe={};function Te(je,Ye){for(var rt=Ye.length;--rt>=0;){var ot=Ye[rt];Pe.hasOwnProperty(ot)?B.console&&console.warn("cannot override language handler %s",ot):Pe[ot]=je}}function se(je,Ye){return je&&Pe.hasOwnProperty(je)||(je=/^\s*</.test(Ye)?"default-markup":"default-code"),Pe[je]}Te(_e,["default-code"]),Te(Oe([],[[o,/^[^<?]+/],[y,/^<!\w[^>]*(?:>|$)/],[b,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[c,/^(?:<[%?]|[%?]>)/],["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"]),Te(Oe([[o,/^[\s]+/,null,` \r
`],[z,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[S,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[N,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[c,/^[=<>\/]+/],["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"]),Te(Oe([],[[z,/^[\s\S]+/]]),["uq.val"]),Te(Ke({keywords:A,hashComments:!0,cStyleComments:!0,types:v}),["c","cc","cpp","cxx","cyc","m"]),Te(Ke({keywords:"null,true,false"}),["json"]),Te(Ke({keywords:O,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:v}),["cs"]),Te(Ke({keywords:M,cStyleComments:!0}),["java"]),Te(Ke({keywords:d,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),Te(Ke({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),Te(Ke({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),Te(Ke({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),Te(Ke({keywords:g,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),Te(Ke({keywords:L,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),Te(Oe([],[[m,/^[\s\S]+/]]),["regex"]);function He(je){var Ye=je.langExtension;try{var rt=W(je.sourceNode,je.pre),ot=rt.sourceCode;je.sourceCode=ot,je.spans=rt.spans,je.basePos=0,se(Ye,ot)(je),Ue(je)}catch(et){B.console&&console.log(et&&et.stack||et)}}function ht(je,Ye,rt){var ot=rt||!1,et=Ye||null,Ve=document.createElement("div");Ve.innerHTML="<pre>"+je+"</pre>",Ve=Ve.firstChild,ot&&Ie(Ve,ot,!0);var $e={langExtension:et,numberLines:ot,sourceNode:Ve,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return He($e),Ve.innerHTML}function it(je,Ye){var rt=Ye||document.body,ot=rt.ownerDocument||document;function et(ye){return rt.getElementsByTagName(ye)}for(var Ve=[et("pre"),et("code"),et("xmp")],$e=[],bt=0;bt<Ve.length;++bt)for(var pt=0,mt=Ve[bt].length;pt<mt;++pt)$e.push(Ve[bt][pt]);Ve=null;var st=Date;st.now||(st={now:function(){return+new Date}});var Ot=0,xt=/\blang(?:uage)?-([\w.]+)(?!\S)/,vt=/\bprettyprint\b/,Ne=/\bprettyprinted\b/,Lt=/pre|xmp/i,Et=/^code$/i,Fe=/^(?:pre|code|xmp)$/i,Ze={};function we(){for(var ye=B.PR_SHOULD_USE_CONTINUATION?st.now()+250:Infinity;Ot<$e.length&&st.now()<ye;Ot++){for(var Ee=$e[Ot],re=Ze,ne=Ee;ne=ne.previousSibling;){var de=ne.nodeType,ge=(de===7||de===8)&&ne.nodeValue;if(ge?!/^\??prettify\b/.test(ge):de!==3||/\S/.test(ne.nodeValue))break;if(ge){re={},ge.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Pr,Vt,an){re[Vt]=an});break}}var Se=Ee.className;if((re!==Ze||vt.test(Se))&&!Ne.test(Se)){for(var Re=!1,Ge=Ee.parentNode;Ge;Ge=Ge.parentNode){var yt=Ge.tagName;if(Fe.test(yt)&&Ge.className&&vt.test(Ge.className)){Re=!0;break}}if(!Re){Ee.className+=" prettyprinted";var _t=re.lang;if(!_t){_t=Se.match(xt);var kt;!_t&&(kt=be(Ee))&&Et.test(kt.tagName)&&(_t=kt.className.match(xt)),_t&&(_t=_t[1])}var Gt;if(Lt.test(Ee.tagName))Gt=1;else{var Kt=Ee.currentStyle,Ct=ot.defaultView,pr=Kt?Kt.whiteSpace:Ct&&Ct.getComputedStyle?Ct.getComputedStyle(Ee,null).getPropertyValue("white-space"):0;Gt=pr&&pr.substring(0,3)==="pre"}var rr=re.linenums;(rr=rr==="true"||+rr)||(rr=Se.match(/\blinenums\b(?::(\d+))?/),rr=rr?rr[1]&&rr[1].length?+rr[1]:!0:!1),rr&&Ie(Ee,rr,Gt);var Ir={langExtension:_t,sourceNode:Ee,numberLines:rr,pre:Gt,sourceCode:null,basePos:null,spans:null,decorations:null};He(Ir)}}}Ot<$e.length?B.setTimeout(we,250):typeof je=="function"&&je()}we()}var at=B.PR={createSimpleLexer:Oe,registerLangHandler:Te,sourceDecorator:Ke,PR_ATTRIB_NAME:N,PR_ATTRIB_VALUE:z,PR_COMMENT:b,PR_DECLARATION:y,PR_KEYWORD:k,PR_LITERAL:p,PR_NOCODE:Y,PR_PLAIN:o,PR_PUNCTUATION:c,PR_SOURCE:T,PR_STRING:m,PR_TAG:S,PR_TYPE:h,prettyPrintOne:D?B.prettyPrintOne=ht:P=ht,prettyPrint:H=D?B.prettyPrint=it:H=it},ft=B.define;typeof ft=="function"&&ft.amd&&ft("google-code-prettify",[],function(){return at})})()},UUDw:function(Ft,gt,ie){Ft.exports={buttonFixed:"buttonFixed___2zLVJ",button:"button___-JgFH",buttonWrap:"buttonWrap___aZhhk"}},UqFu:function(Ft,gt,ie){"use strict";ie.d(gt,"a",function(){return ae});var ae=function(D){var K=document.createElement("textarea");return K.value=D,K.value}},"VrN/":function(Ft,gt,ie){(function(ae,X){Ft.exports=X()})(this,function(){"use strict";var ae=navigator.userAgent,X=navigator.platform,D=/gecko\/\d/i.test(ae),K=/MSIE \d/.test(ae),w=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ae),P=/Edge\/(\d+)/.exec(ae),H=K||w||P,B=H&&(K?document.documentMode||6:+(P||w)[1]),I=!P&&/WebKit\//.test(ae),_=I&&/Qt\/\d+\.\d+/.test(ae),x=!P&&/Chrome\//.test(ae),A=/Opera\//.test(ae),M=/Apple Computer/.test(navigator.vendor),O=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ae),L=/PhantomJS/.test(ae),g=!P&&/AppleWebKit/.test(ae)&&/Mobile\/\w+/.test(ae),u=/Android/.test(ae),a=g||u||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ae),l=g||/Mac/.test(X),d=/\bCrOS\b/.test(ae),E=/win/i.test(X),v=A&&ae.match(/Version\/(\d*\.\d*)/);v&&(v=Number(v[1])),v&&v>=15&&(A=!1,I=!0);var m=l&&(_||A&&(v==null||v<12.11)),k=D||H&&B>=9;function b(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var h=function(e,t){var n=e.className,r=b(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function p(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function c(e,t){return p(e).appendChild(t)}function o(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var C=0;C<t.length;++C)i.appendChild(t[C]);return i}function S(e,t,n,r){var i=o(e,t,n,r);return i.setAttribute("role","presentation"),i}var y;document.createRange?y=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:y=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function T(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 z(e,t){var n=e.className;b(t).test(n)||(e.className+=(n?" ":"")+t)}function Y(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!b(n[r]).test(t)&&(t+=" "+n[r]);return t}var ee=function(e){e.select()};g?ee=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:H&&(ee=function(e){try{e.select()}catch(t){}});function G(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function W(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function te(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var C=r||0,U=i||0;;){var V=e.indexOf(" ",C);if(V<0||V>=t)return U+(t-C);U+=V-C,U+=n-U%n,C=V+1}}var ue=function(){this.id=null,this.f=null,this.time=0,this.handler=G(this.onTimeout,this)};ue.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ue.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 be(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var Oe=50,Ke={toString:function(){return"CodeMirror.Pass"}},_e={scroll:!1},Ie={origin:"*mouse"},Ue={origin:"+move"};function Pe(e,t,n){for(var r=0,i=0;;){var C=e.indexOf(" ",r);C==-1&&(C=e.length);var U=C-r;if(C==e.length||i+U>=t)return r+Math.min(U,t-i);if(i+=C-r,i+=n-i%n,r=C+1,i>=t)return r}}var Te=[""];function se(e){for(;Te.length<=e;)Te.push(He(Te)+" ");return Te[e]}function He(e){return e[e.length-1]}function ht(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function it(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function at(){}function ft(e,t){var n;return Object.create?n=Object.create(e):(at.prototype=e,n=new at),t&&W(t,n),n}var je=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Ye(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||je.test(e))}function rt(e,t){return t?t.source.indexOf("\\w")>-1&&Ye(e)?!0:t.test(e):Ye(e)}function ot(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var et=/[\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 Ve(e){return e.charCodeAt(0)>=768&&et.test(e)}function $e(e,t,n){for(;(n<0?t>0:t<e.length)&&Ve(e.charAt(t));)t+=n;return t}function bt(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,C=r<0?Math.ceil(i):Math.floor(i);if(C==t)return e(C)?t:n;e(C)?n=C:t=C+r}}function pt(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,C=0;C<e.length;++C){var U=e[C];(U.from<n&&U.to>t||t==n&&U.to==t)&&(r(Math.max(U.from,t),Math.min(U.to,n),U.level==1?"rtl":"ltr",C),i=!0)}i||r(t,n,"ltr")}var mt=null;function st(e,t,n){var r;mt=null;for(var i=0;i<e.length;++i){var C=e[i];if(C.from<t&&C.to>t)return i;C.to==t&&(C.from!=C.to&&n=="before"?r=i:mt=i),C.from==t&&(C.from!=C.to&&n!="before"?r=i:mt=i)}return r!=null?r:mt}var Ot=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(J){return J<=247?e.charAt(J):1424<=J&&J<=1524?"R":1536<=J&&J<=1785?t.charAt(J-1536):1774<=J&&J<=2220?"r":8192<=J&&J<=8203?"w":J==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,C=/[LRr]/,U=/[Lb1n]/,V=/[1n]/;function $(J,he,me){this.level=J,this.from=he,this.to=me}return function(J,he){var me=he=="ltr"?"L":"R";if(J.length==0||he=="ltr"&&!r.test(J))return!1;for(var Me=J.length,ke=[],We=0;We<Me;++We)ke.push(n(J.charCodeAt(We)));for(var Qe=0,nt=me;Qe<Me;++Qe){var dt=ke[Qe];dt=="m"?ke[Qe]=nt:nt=dt}for(var St=0,ct=me;St<Me;++St){var Tt=ke[St];Tt=="1"&&ct=="r"?ke[St]="n":C.test(Tt)&&(ct=Tt,Tt=="r"&&(ke[St]="R"))}for(var Ht=1,Ut=ke[0];Ht<Me-1;++Ht){var tr=ke[Ht];tr=="+"&&Ut=="1"&&ke[Ht+1]=="1"?ke[Ht]="1":tr==","&&Ut==ke[Ht+1]&&(Ut=="1"||Ut=="n")&&(ke[Ht]=Ut),Ut=tr}for(var Rr=0;Rr<Me;++Rr){var bn=ke[Rr];if(bn==",")ke[Rr]="N";else if(bn=="%"){var Gr=void 0;for(Gr=Rr+1;Gr<Me&&ke[Gr]=="%";++Gr);for(var $n=Rr&&ke[Rr-1]=="!"||Gr<Me&&ke[Gr]=="1"?"1":"N",Kn=Rr;Kn<Gr;++Kn)ke[Kn]=$n;Rr=Gr-1}}for(var rn=0,zn=me;rn<Me;++rn){var wn=ke[rn];zn=="L"&&wn=="1"?ke[rn]="L":C.test(wn)&&(zn=wn)}for(var pn=0;pn<Me;++pn)if(i.test(ke[pn])){var nn=void 0;for(nn=pn+1;nn<Me&&i.test(ke[nn]);++nn);for(var $r=(pn?ke[pn-1]:me)=="L",Gn=(nn<Me?ke[nn]:me)=="L",Na=$r==Gn?$r?"L":"R":me,aa=pn;aa<nn;++aa)ke[aa]=Na;pn=nn-1}for(var Dn=[],Ri,xn=0;xn<Me;)if(U.test(ke[xn])){var ps=xn;for(++xn;xn<Me&&U.test(ke[xn]);++xn);Dn.push(new $(0,ps,xn))}else{var zi=xn,ga=Dn.length,va=he=="rtl"?1:0;for(++xn;xn<Me&&ke[xn]!="L";++xn);for(var Nn=zi;Nn<xn;)if(V.test(ke[Nn])){zi<Nn&&(Dn.splice(ga,0,new $(1,zi,Nn)),ga+=va);var Ua=Nn;for(++Nn;Nn<xn&&V.test(ke[Nn]);++Nn);Dn.splice(ga,0,new $(2,Ua,Nn)),ga+=va,zi=Nn}else++Nn;zi<xn&&Dn.splice(ga,0,new $(1,zi,xn))}return he=="ltr"&&(Dn[0].level==1&&(Ri=J.match(/^\s+/))&&(Dn[0].from=Ri[0].length,Dn.unshift(new $(0,0,Ri[0].length))),He(Dn).level==1&&(Ri=J.match(/\s+$/))&&(He(Dn).to-=Ri[0].length,Dn.push(new $(0,Me-Ri[0].length,Me)))),he=="rtl"?Dn.reverse():Dn}}();function xt(e,t){var n=e.order;return n==null&&(n=e.order=Ot(e.text,t)),n}var vt=[],Ne=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||vt).concat(n)}};function Lt(e,t){return e._handlers&&e._handlers[t]||vt}function Et(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var C=be(i,n);C>-1&&(r[t]=i.slice(0,C).concat(i.slice(C+1)))}}}function Fe(e,t){var n=Lt(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Ze(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Fe(e,n||t.type,e,t),de(t)||t.codemirrorIgnore}function we(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)be(n,t[r])==-1&&n.push(t[r])}function ye(e,t){return Lt(e,t).length>0}function Ee(e){e.prototype.on=function(t,n){Ne(this,t,n)},e.prototype.off=function(t,n){Et(this,t,n)}}function re(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ne(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function de(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ge(e){re(e),ne(e)}function Se(e){return e.target||e.srcElement}function Re(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),l&&e.ctrlKey&&t==1&&(t=3),t}var Ge=function(){if(H&&B<9)return!1;var e=o("div");return"draggable"in e||"dragDrop"in e}(),yt;function _t(e){if(yt==null){var t=o("span","\u200B");c(e,o("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(yt=t.offsetWidth<=1&&t.offsetHeight>2&&!(H&&B<8))}var n=yt?o("span","\u200B"):o("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var kt;function Gt(e){if(kt!=null)return kt;var t=c(e,document.createTextNode("A\u062EA")),n=y(t,0,1).getBoundingClientRect(),r=y(t,1,2).getBoundingClientRect();return p(e),!n||n.left==n.right?!1:kt=r.right-n.right<3}var Kt=`
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
`,t);i==-1&&(i=e.length);var C=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),U=C.indexOf("\r");U!=-1?(n.push(C.slice(0,U)),t+=U+1):(n.push(C),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Ct=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},pr=function(){var e=o("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),rr=null;function Ir(e){if(rr!=null)return rr;var t=c(e,o("span","x")),n=t.getBoundingClientRect(),r=y(t,0,1).getBoundingClientRect();return rr=Math.abs(n.left-r.left)>1}var Pr={},Vt={};function an(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Pr[e]=t}function En(e,t){Vt[e]=t}function It(e){if(typeof e=="string"&&Vt.hasOwnProperty(e))e=Vt[e];else if(e&&typeof e.name=="string"&&Vt.hasOwnProperty(e.name)){var t=Vt[e.name];typeof t=="string"&&(t={name:t}),e=ft(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return It("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return It("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function An(e,t){t=It(t);var n=Pr[t.name];if(!n)return An(e,"text/plain");var r=n(e,t);if(on.hasOwnProperty(t.name)){var i=on[t.name];for(var C in i){if(!i.hasOwnProperty(C))continue;r.hasOwnProperty(C)&&(r["_"+C]=r[C]),r[C]=i[C]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var U in t.modeProps)r[U]=t.modeProps[U];return r}var on={};function sn(e,t){var n=on.hasOwnProperty(e)?on[e]:on[e]={};W(t,n)}function Un(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function ci(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 Qn(e,t,n){return e.startState?e.startState(t,n):!0}var mr=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};mr.prototype.eol=function(){return this.pos>=this.string.length},mr.prototype.sol=function(){return this.pos==this.lineStart},mr.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},mr.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},mr.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},mr.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},mr.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},mr.prototype.skipToEnd=function(){this.pos=this.string.length},mr.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},mr.prototype.backUp=function(e){this.pos-=e},mr.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=te(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?te(this.string,this.lineStart,this.tabSize):0)},mr.prototype.indentation=function(){return te(this.string,null,this.tabSize)-(this.lineStart?te(this.string,this.lineStart,this.tabSize):0)},mr.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(U){return n?U.toLowerCase():U},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var C=this.string.slice(this.pos).match(e);return C&&C.index>0?null:(C&&t!==!1&&(this.pos+=C[0].length),C)}},mr.prototype.current=function(){return this.string.slice(this.start,this.pos)},mr.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},mr.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},mr.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function wt(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],C=i.chunkSize();if(t<C){n=i;break}t-=C}return n.lines[t]}function Vn(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(C){var U=C.text;i==n.line&&(U=U.slice(0,n.ch)),i==t.line&&(U=U.slice(t.ch)),r.push(U),++i}),r}function oi(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function mn(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function nr(e){if(e.parent==null)return null;for(var t=e.parent,n=be(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;!(r.children[i]==t);++i)n+=r.children[i].chunkSize();return n+t.first}function Bn(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],C=i.height;if(t<C){e=i;continue e}t-=C,n+=i.chunkSize()}return n}while(!e.lines);for(var U=0;U<e.lines.length;++U){var V=e.lines[U],$=V.height;if(t<$)break;t-=$}return n+U}function Zn(e,t){return t>=e.first&&t<e.first+e.size}function hi(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Je(e,t,n){if(n===void 0&&(n=null),!(this instanceof Je))return new Je(e,t,n);this.line=e,this.ch=t,this.sticky=n}function jt(e,t){return e.line-t.line||e.ch-t.ch}function si(e,t){return e.sticky==t.sticky&&jt(e,t)==0}function fi(e){return Je(e.line,e.ch)}function Si(e,t){return jt(e,t)<0?t:e}function li(e,t){return jt(e,t)<0?e:t}function j(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function s(e,t){if(t.line<e.first)return Je(e.first,0);var n=e.first+e.size-1;return t.line>n?Je(n,wt(e,n).text.length):f(t,wt(e,t.line).text.length)}function f(e,t){var n=e.ch;return n==null||n>t?Je(e.line,t):n<0?Je(e.line,0):e}function R(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=s(e,t[r]);return n}var Q=function(e,t){this.state=e,this.lookAhead=t},F=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};F.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},F.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}},F.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},F.fromSaved=function(e,t,n){return t instanceof Q?new F(e,Un(e.mode,t.state),n,t.lookAhead):new F(e,Un(e.mode,t),n)},F.prototype.save=function(e){var t=e!==!1?Un(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Q(t,this.maxLookAhead):t};function ve(e,t,n,r){var i=[e.state.modeGen],C={};gn(e,t.text,e.doc.mode,n,function(J,he){return i.push(J,he)},C,r);for(var U=n.state,V=function(J){n.baseTokens=i;var he=e.state.overlays[J],me=1,Me=0;n.state=!0,gn(e,t.text,he.mode,n,function(ke,We){for(var Qe=me;Me<ke;){var nt=i[me];nt>ke&&i.splice(me,1,ke,i[me+1],nt),me+=2,Me=Math.min(ke,nt)}if(!We)return;if(he.opaque)i.splice(Qe,me-Qe,ke,"overlay "+We),me=Qe+2;else for(;Qe<me;Qe+=2){var dt=i[Qe+1];i[Qe+1]=(dt?dt+" ":"")+"overlay "+We}},C),n.state=U,n.baseTokens=null,n.baseTokenPos=1},$=0;$<e.state.overlays.length;++$)V($);return{styles:i,classes:C.bgClass||C.textClass?C:null}}function ze(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=lt(e,nr(t)),i=t.text.length>e.options.maxHighlightLength&&Un(e.doc.mode,r.state),C=ve(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=C.styles,C.classes?t.styleClasses=C.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 lt(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new F(r,!0,t);var C=ln(e,t,n),U=C>r.first&&wt(r,C-1).stateAfter,V=U?F.fromSaved(r,U,C):new F(r,Qn(r.mode),C);return r.iter(C,t,function($){At(e,$.text,V);var J=V.line;$.stateAfter=J==t-1||J%5==0||J>=i.viewFrom&&J<i.viewTo?V.save():null,V.nextLine()}),n&&(r.modeFrontier=V.line),V}function At(e,t,n,r){var i=e.doc.mode,C=new mr(t,e.options.tabSize,n);for(C.start=C.pos=r||0,t==""&&Xe(i,n.state);!C.eol();)Rt(i,C,n.state),C.start=C.pos}function Xe(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=ci(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function Rt(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=ci(e,n).mode);var C=e.token(t,n);if(t.pos>t.start)return C}throw new Error("Mode "+e.name+" failed to advance stream.")}var gr=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Dr(e,t,n,r){var i=e.doc,C=i.mode,U;t=s(i,t);var V=wt(i,t.line),$=lt(e,t.line,n),J=new mr(V.text,e.options.tabSize,$),he;for(r&&(he=[]);(r||J.pos<t.ch)&&!J.eol();)J.start=J.pos,U=Rt(C,J,$.state),r&&he.push(new gr(J,U,Un(i.mode,$.state)));return r?he:new gr(J,U,$.state)}function Ln(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function gn(e,t,n,r,i,C,U){var V=n.flattenSpans;V==null&&(V=e.options.flattenSpans);var $=0,J=null,he=new mr(t,e.options.tabSize,r),me,Me=e.options.addModeClass&&[null];for(t==""&&Ln(Xe(n,r.state),C);!he.eol();){if(he.pos>e.options.maxHighlightLength?(V=!1,U&&At(e,t,r,he.pos),he.pos=t.length,me=null):me=Ln(Rt(n,he,r.state,Me),C),Me){var ke=Me[0].name;ke&&(me="m-"+(me?ke+" "+me:ke))}if(!V||J!=me){for(;$<he.start;)$=Math.min(he.start,$+5e3),i($,J);J=me}he.start=he.pos}for(;$<he.pos;){var We=Math.min(he.pos,$+5e3);i(We,J),$=We}}function ln(e,t,n){for(var r,i,C=e.doc,U=n?-1:t-(e.doc.mode.innerMode?1e3:100),V=t;V>U;--V){if(V<=C.first)return C.first;var $=wt(C,V-1),J=$.stateAfter;if(J&&(!n||V+(J instanceof Q?J.lookAhead:0)<=C.modeFrontier))return V;var he=te($.text,null,e.options.tabSize);(i==null||r>he)&&(i=V-1,r=he)}return i}function Jn(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,r=t-1;r>n;r--){var i=wt(e,r).stateAfter;if(i&&(!(i instanceof Q)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Pi=!1,Qr=!1;function Fn(){Pi=!0}function pi(){Qr=!0}function ui(e,t,n){this.marker=e,this.from=t,this.to=n}function Sn(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Ii(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Ci(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Gi(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var C=e[i],U=C.marker,V=C.from==null||(U.inclusiveLeft?C.from<=t:C.from<t);if(V||C.from==t&&U.type=="bookmark"&&(!n||!C.marker.insertLeft)){var $=C.to==null||(U.inclusiveRight?C.to>=t:C.to>t);(r||(r=[])).push(new ui(U,C.from,$?null:C.to))}}return r}function Vi(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var C=e[i],U=C.marker,V=C.to==null||(U.inclusiveRight?C.to>=t:C.to>t);if(V||C.from==t&&U.type=="bookmark"&&(!n||C.marker.insertLeft)){var $=C.from==null||(U.inclusiveLeft?C.from<=t:C.from<t);(r||(r=[])).push(new ui(U,$?null:C.from-t,C.to==null?null:C.to-t))}}return r}function qn(e,t){if(t.full)return null;var n=Zn(e,t.from.line)&&wt(e,t.from.line).markedSpans,r=Zn(e,t.to.line)&&wt(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,C=t.to.ch,U=jt(t.from,t.to)==0,V=Gi(n,i,U),$=Vi(r,C,U),J=t.text.length==1,he=He(t.text).length+(J?i:0);if(V)for(var me=0;me<V.length;++me){var Me=V[me];if(Me.to==null){var ke=Sn($,Me.marker);ke?J&&(Me.to=ke.to==null?null:ke.to+he):Me.to=i}}if($)for(var We=0;We<$.length;++We){var Qe=$[We];if(Qe.to!=null&&(Qe.to+=he),Qe.from==null){var nt=Sn(V,Qe.marker);nt||(Qe.from=he,J&&(V||(V=[])).push(Qe))}else Qe.from+=he,J&&(V||(V=[])).push(Qe)}V&&(V=en(V)),$&&$!=V&&($=en($));var dt=[V];if(!J){var St=t.text.length-2,ct;if(St>0&&V)for(var Tt=0;Tt<V.length;++Tt)V[Tt].to==null&&(ct||(ct=[])).push(new ui(V[Tt].marker,null,null));for(var Ht=0;Ht<St;++Ht)dt.push(ct);dt.push($)}return dt}function en(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 mi(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(ke){if(ke.markedSpans)for(var We=0;We<ke.markedSpans.length;++We){var Qe=ke.markedSpans[We].marker;Qe.readOnly&&(!r||be(r,Qe)==-1)&&(r||(r=[])).push(Qe)}}),!r)return null;for(var i=[{from:t,to:n}],C=0;C<r.length;++C)for(var U=r[C],V=U.find(0),$=0;$<i.length;++$){var J=i[$];if(jt(J.to,V.from)<0||jt(J.from,V.to)>0)continue;var he=[$,1],me=jt(J.from,V.from),Me=jt(J.to,V.to);(me<0||!U.inclusiveLeft&&!me)&&he.push({from:J.from,to:V.from}),(Me>0||!U.inclusiveRight&&!Me)&&he.push({from:V.to,to:J.to}),i.splice.apply(i,he),$+=he.length-3}return i}function oa(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 Ni(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function Fr(e){return e.inclusiveLeft?-1:0}function vr(e){return e.inclusiveRight?1:0}function Kr(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),C=jt(r.from,i.from)||Fr(e)-Fr(t);if(C)return-C;var U=jt(r.to,i.to)||vr(e)-vr(t);return U||t.id-e.id}function qt(e,t){var n=Qr&&e.markedSpans,r;if(n)for(var i=void 0,C=0;C<n.length;++C)i=n[C],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||Kr(r,i.marker)<0)&&(r=i.marker);return r}function zr(e){return qt(e,!0)}function Sr(e){return qt(e,!1)}function ei(e,t){var n=Qr&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var C=n[i];C.marker.collapsed&&(C.from==null||C.from<t)&&(C.to==null||C.to>t)&&(!r||Kr(r,C.marker)<0)&&(r=C.marker)}return r}function tn(e,t,n,r,i){var C=wt(e,t),U=Qr&&C.markedSpans;if(U)for(var V=0;V<U.length;++V){var $=U[V];if(!$.marker.collapsed)continue;var J=$.marker.find(0),he=jt(J.from,n)||Fr($.marker)-Fr(i),me=jt(J.to,r)||vr($.marker)-vr(i);if(he>=0&&me<=0||he<=0&&me>=0)continue;if(he<=0&&($.marker.inclusiveRight&&i.inclusiveLeft?jt(J.to,n)>=0:jt(J.to,n)>0)||he>=0&&($.marker.inclusiveRight&&i.inclusiveLeft?jt(J.from,r)<=0:jt(J.from,r)<0))return!0}}function vn(e){for(var t;t=zr(e);)e=t.find(-1,!0).line;return e}function Xi(e){for(var t;t=Sr(e);)e=t.find(1,!0).line;return e}function Ti(e){for(var t,n;t=Sr(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function wi(e,t){var n=wt(e,t),r=vn(n);return n==r?t:nr(r)}function jn(e,t){if(t>e.lastLine())return t;var n=wt(e,t),r;if(!Wn(e,n))return t;for(;r=Sr(n);)n=r.find(1,!0).line;return nr(n)+1}function Wn(e,t){var n=Qr&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i){if(r=n[i],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&sa(e,t,r))return!0}}function sa(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return sa(e,r.line,Sn(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,C=0;C<t.markedSpans.length;++C)if(i=t.markedSpans[C],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&sa(e,t,i))return!0}function Xn(e){e=vn(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var C=n.parent;C;n=C,C=n.parent)for(var U=0;U<C.children.length;++U){var V=C.children[U];if(V==n)break;t+=V.height}return t}function la(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=zr(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Sr(r);){var C=n.find(0,!0);t-=r.text.length-C.from.ch,r=C.to.line,t+=r.text.length-C.to.ch}return t}function ua(e){var t=e.display,n=e.doc;t.maxLine=wt(n,n.first),t.maxLineLength=la(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=la(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Ui=function(e,t,n){this.text=e,Ni(this,t),this.height=n?n(this):1};Ui.prototype.lineNo=function(){return nr(this)},Ee(Ui);function Ba(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),oa(e),Ni(e,n);var i=r?r(e):1;i!=e.height&&mn(e,i)}function Mt(e){e.parent=null,oa(e)}var zt={},Pt={};function er(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Pt:zt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function hr(e,t){var n=S("span",null,null,I?"padding-right: .1px":null),r={pre:S("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var C=i?t.rest[i-1]:t.line,U=void 0;r.pos=0,r.addToken=ur,Gt(e.display.measure)&&(U=xt(C,e.doc.direction))&&(r.addToken=Mn(r.addToken,U)),r.map=[];var V=t!=e.display.externalMeasured&&nr(C);gi(C,r,ze(e,C,V)),C.styleClasses&&(C.styleClasses.bgClass&&(r.bgClass=Y(C.styleClasses.bgClass,r.bgClass||"")),C.styleClasses.textClass&&(r.textClass=Y(C.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(_t(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(I){var $=r.content.lastChild;(/\bcm-tab\b/.test($.className)||$.querySelector&&$.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Fe(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=Y(r.pre.className,r.textClass||"")),r}function Cr(e){var t=o("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function ur(e,t,n,r,i,C,U){if(!t)return;var V=e.splitSpaces?Vr(t,e.trailingSpace):t,$=e.cm.state.specialChars,J=!1,he;if(!$.test(t))e.col+=t.length,he=document.createTextNode(V),e.map.push(e.pos,e.pos+t.length,he),H&&B<9&&(J=!0),e.pos+=t.length;else{he=document.createDocumentFragment();for(var me=0;;){$.lastIndex=me;var Me=$.exec(t),ke=Me?Me.index-me:t.length-me;if(ke){var We=document.createTextNode(V.slice(me,me+ke));H&&B<9?he.appendChild(o("span",[We])):he.appendChild(We),e.map.push(e.pos,e.pos+ke,We),e.col+=ke,e.pos+=ke}if(!Me)break;me+=ke+1;var Qe=void 0;if(Me[0]==" "){var nt=e.cm.options.tabSize,dt=nt-e.col%nt;Qe=he.appendChild(o("span",se(dt),"cm-tab")),Qe.setAttribute("role","presentation"),Qe.setAttribute("cm-text"," "),e.col+=dt}else Me[0]=="\r"||Me[0]==`
`?(Qe=he.appendChild(o("span",Me[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Qe.setAttribute("cm-text",Me[0]),e.col+=1):(Qe=e.cm.options.specialCharPlaceholder(Me[0]),Qe.setAttribute("cm-text",Me[0]),H&&B<9?he.appendChild(o("span",[Qe])):he.appendChild(Qe),e.col+=1);e.map.push(e.pos,e.pos+1,Qe),e.pos++}}if(e.trailingSpace=V.charCodeAt(t.length-1)==32,n||r||i||J||C||U){var St=n||"";r&&(St+=r),i&&(St+=i);var ct=o("span",[he],St,C);if(U)for(var Tt in U)U.hasOwnProperty(Tt)&&Tt!="style"&&Tt!="class"&&ct.setAttribute(Tt,U[Tt]);return e.content.appendChild(ct)}e.content.appendChild(he)}function Vr(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var C=e.charAt(i);C==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(C="\xA0"),r+=C,n=C==" "}return r}function Mn(e,t){return function(n,r,i,C,U,V,$){i=i?i+" cm-force-border":"cm-force-border";for(var J=n.pos,he=J+r.length;;){for(var me=void 0,Me=0;Me<t.length&&!(me=t[Me],me.to>J&&me.from<=J);Me++);if(me.to>=he)return e(n,r,i,C,U,V,$);e(n,r.slice(0,me.to-J),i,C,null,V,$),C=null,r=r.slice(me.to-J),J=me.to}}}function ir(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function gi(e,t,n){var r=e.markedSpans,i=e.text,C=0;if(!r){for(var U=1;U<n.length;U+=2)t.addToken(t,i.slice(C,C=n[U]),er(n[U+1],t.cm.options));return}for(var V=i.length,$=0,J=1,he="",me,Me,ke=0,We,Qe,nt,dt,St;;){if(ke==$){We=Qe=nt=Me="",St=null,dt=null,ke=Infinity;for(var ct=[],Tt=void 0,Ht=0;Ht<r.length;++Ht){var Ut=r[Ht],tr=Ut.marker;if(tr.type=="bookmark"&&Ut.from==$&&tr.widgetNode)ct.push(tr);else if(Ut.from<=$&&(Ut.to==null||Ut.to>$||tr.collapsed&&Ut.to==$&&Ut.from==$)){if(Ut.to!=null&&Ut.to!=$&&ke>Ut.to&&(ke=Ut.to,Qe=""),tr.className&&(We+=" "+tr.className),tr.css&&(Me=(Me?Me+";":"")+tr.css),tr.startStyle&&Ut.from==$&&(nt+=" "+tr.startStyle),tr.endStyle&&Ut.to==ke&&(Tt||(Tt=[])).push(tr.endStyle,Ut.to),tr.title&&((St||(St={})).title=tr.title),tr.attributes)for(var Rr in tr.attributes)(St||(St={}))[Rr]=tr.attributes[Rr];tr.collapsed&&(!dt||Kr(dt.marker,tr)<0)&&(dt=Ut)}else Ut.from>$&&ke>Ut.from&&(ke=Ut.from)}if(Tt)for(var bn=0;bn<Tt.length;bn+=2)Tt[bn+1]==ke&&(Qe+=" "+Tt[bn]);if(!dt||dt.from==$)for(var Gr=0;Gr<ct.length;++Gr)ir(t,0,ct[Gr]);if(dt&&(dt.from||0)==$){if(ir(t,(dt.to==null?V+1:dt.to)-$,dt.marker,dt.from==null),dt.to==null)return;dt.to==$&&(dt=!1)}}if($>=V)break;for(var $n=Math.min(V,ke);;){if(he){var Kn=$+he.length;if(!dt){var rn=Kn>$n?he.slice(0,$n-$):he;t.addToken(t,rn,me?me+We:We,nt,$+rn.length==ke?Qe:"",Me,St)}if(Kn>=$n){he=he.slice($n-$),$=$n;break}$=Kn,nt=""}he=i.slice(C,C=n[J++]),me=er(n[J++],t.cm.options)}}}function br(e,t,n){this.line=t,this.rest=Ti(t),this.size=this.rest?nr(He(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Wn(e,t)}function Cn(e,t,n){for(var r=[],i,C=t;C<n;C=i){var U=new br(e.doc,wt(e.doc,C),C);i=C+U.size,r.push(U)}return r}var yn=null;function Yn(e){yn?yn.ops.push(e):e.ownsGroup=yn={ops:[e],delayedCallbacks:[]}}function Fa(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Ko(e,t){var n=e.ownsGroup;if(!n)return;try{Fa(n)}finally{yn=null,t(n)}}var Yi=null;function Xr(e,t){var n=Lt(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;yn?i=yn.delayedCallbacks:Yi?i=Yi:(i=Yi=[],setTimeout(go,0));for(var C=function(V){i.push(function(){return n[V].apply(null,r)})},U=0;U<n.length;++U)C(U)}function go(){var e=Yi;Yi=null;for(var t=0;t<e.length;++t)e[t]()}function vo(e,t,n,r){for(var i=0;i<t.changes.length;i++){var C=t.changes[i];C=="text"?yo(e,t):C=="gutter"?Ha(e,t,n,r):C=="class"?Wa(e,t):C=="widget"&&Go(e,t,r)}t.changes=null}function da(e){return e.node==e.text&&(e.node=o("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),H&&B<8&&(e.node.style.zIndex=2)),e.node}function zo(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=da(t);t.background=r.insertBefore(o("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function ja(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):hr(e,t)}function yo(e,t){var n=t.text.className,r=ja(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,Wa(e,t)):n&&(t.text.className=n)}function Wa(e,t){zo(e,t),t.line.wrapClass?da(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 Ha(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=da(t);t.gutterBackground=o("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var C=t.line.gutterMarkers;if(e.options.lineNumbers||C){var U=da(t),V=t.gutter=o("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(V),U.insertBefore(V,t.text),t.line.gutterClass&&(V.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!C||!C["CodeMirror-linenumbers"])&&(t.lineNumber=V.appendChild(o("div",hi(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),C)for(var $=0;$<e.display.gutterSpecs.length;++$){var J=e.display.gutterSpecs[$].className,he=C.hasOwnProperty(J)&&C[J];he&&V.appendChild(o("div",[he],"CodeMirror-gutter-elt","left: "+r.gutterLeft[J]+"px; width: "+r.gutterWidth[J]+"px"))}}}function Go(e,t,n){t.alignable&&(t.alignable=null);for(var r=b("CodeMirror-linewidget"),i=t.node.firstChild,C=void 0;i;i=C)C=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Ka(e,t,n)}function bo(e,t,n,r){var i=ja(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),Wa(e,t),Ha(e,t,n,r),Ka(e,t,r),t.node}function Ka(e,t,n){if(xo(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)xo(e,t.rest[r],t,n,!1)}function xo(e,t,n,r,i){if(!t.widgets)return;for(var C=da(n),U=0,V=t.widgets;U<V.length;++U){var $=V[U],J=o("div",[$.node],"CodeMirror-linewidget"+($.className?" "+$.className:""));$.handleMouseEvents||J.setAttribute("cm-ignore-events","true"),Vo($,J,n,r),e.display.input.setUneditable(J),i&&$.above?C.insertBefore(J,n.gutter||n.text):C.appendChild(J),Xr($,"redraw")}}function Vo(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function $i(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!T(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;"),c(t.display.measure,o("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function vi(e,t){for(var n=Se(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 za(e){return e.lineSpace.offsetTop}function le(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function xe(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=c(e.measure,o("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Ae(e){return Oe-e.display.nativeBarWidth}function ce(e){return e.display.scroller.clientWidth-Ae(e)-e.display.barWidth}function Z(e){return e.display.scroller.clientHeight-Ae(e)-e.display.barHeight}function oe(e,t,n){var r=e.options.lineWrapping,i=r&&ce(e);if(!t.measure.heights||r&&t.measure.width!=i){var C=t.measure.heights=[];if(r){t.measure.width=i;for(var U=t.text.firstChild.getClientRects(),V=0;V<U.length-1;V++){var $=U[V],J=U[V+1];Math.abs($.bottom-J.bottom)>2&&C.push(($.bottom+J.top)/2-n.top)}}C.push(n.bottom-n.top)}}function q(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(nr(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function fe(e,t){t=vn(t);var n=nr(t),r=e.display.externalMeasured=new br(e.doc,t,n);r.lineN=n;var i=r.built=hr(e,r);return r.text=i.pre,c(e.display.lineMeasure,i.pre),r}function pe(e,t,n,r){return De(e,Ce(e,t),n,r)}function Le(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[_r(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Ce(e,t){var n=nr(t),r=Le(e,n);r&&!r.text?r=null:r&&r.changes&&(vo(e,r,n,jr(e)),e.curOp.forceUpdate=!0),r||(r=fe(e,t));var i=q(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function De(e,t,n,r,i){t.before&&(n=-1);var C=n+(r||""),U;return t.cache.hasOwnProperty(C)?U=t.cache[C]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(oe(e,t.view,t.rect),t.hasHeights=!0),U=ut(e,t,n,r),U.bogus||(t.cache[C]=U)),{left:U.left,right:U.right,top:i?U.rtop:U.top,bottom:i?U.rbottom:U.bottom}}var Be={left:0,right:0,top:0,bottom:0};function tt(e,t,n){for(var r,i,C,U,V,$,J=0;J<e.length;J+=3)if(V=e[J],$=e[J+1],t<V?(i=0,C=1,U="left"):t<$?(i=t-V,C=i+1):(J==e.length-3||t==$&&e[J+3]>t)&&(C=$-V,i=C-1,t>=$&&(U="right")),i!=null){if(r=e[J+2],V==$&&n==(r.insertLeft?"left":"right")&&(U=n),n=="left"&&i==0)for(;J&&e[J-2]==e[J-3]&&e[J-1].insertLeft;)r=e[(J-=3)+2],U="left";if(n=="right"&&i==$-V)for(;J<e.length-3&&e[J+3]==e[J+4]&&!e[J+5].insertLeft;)r=e[(J+=3)+2],U="right";break}return{node:r,start:i,end:C,collapse:U,coverStart:V,coverEnd:$}}function qe(e,t){var n=Be;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var i=e.length-1;i>=0&&!((n=e[i]).left!=n.right);i--);return n}function ut(e,t,n,r){var i=tt(t.map,n,r),C=i.node,U=i.start,V=i.end,$=i.collapse,J;if(C.nodeType==3){for(var he=0;he<4;he++){for(;U&&Ve(t.line.text.charAt(i.coverStart+U));)--U;for(;i.coverStart+V<i.coverEnd&&Ve(t.line.text.charAt(i.coverStart+V));)++V;if(H&&B<9&&U==0&&V==i.coverEnd-i.coverStart?J=C.parentNode.getBoundingClientRect():J=qe(y(C,U,V).getClientRects(),r),J.left||J.right||U==0)break;V=U,U=U-1,$="right"}H&&B<11&&(J=Wt(e.display.measure,J))}else{U>0&&($=r="right");var me;e.options.lineWrapping&&(me=C.getClientRects()).length>1?J=me[r=="right"?me.length-1:0]:J=C.getBoundingClientRect()}if(H&&B<9&&!U&&(!J||!J.left&&!J.right)){var Me=C.parentNode.getClientRects()[0];Me?J={left:Me.left,right:Me.left+un(e.display),top:Me.top,bottom:Me.bottom}:J=Be}for(var ke=J.top-t.rect.top,We=J.bottom-t.rect.top,Qe=(ke+We)/2,nt=t.view.measure.heights,dt=0;dt<nt.length-1&&!(Qe<nt[dt]);dt++);var St=dt?nt[dt-1]:0,ct=nt[dt],Tt={left:($=="right"?J.right:J.left)-t.rect.left,right:($=="left"?J.left:J.right)-t.rect.left,top:St,bottom:ct};return!J.left&&!J.right&&(Tt.bogus=!0),e.options.singleCursorHeightPerLine||(Tt.rtop=ke,Tt.rbottom=We),Tt}function Wt(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Ir(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function Zt(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 Xt(e){e.display.externalMeasure=null,p(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Zt(e.display.view[t])}function Yt(e){Xt(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Jt(){return x&&u?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Qt(){return x&&u?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function $t(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=$i(e.widgets[n]));return t}function dr(e,t,n,r,i){if(!i){var C=$t(t);n.top+=C,n.bottom+=C}if(r=="line")return n;r||(r="local");var U=Xn(t);if(r=="local"?U+=za(e.display):U-=e.display.viewOffset,r=="page"||r=="window"){var V=e.display.lineSpace.getBoundingClientRect();U+=V.top+(r=="window"?0:Qt());var $=V.left+(r=="window"?0:Jt());n.left+=$,n.right+=$}return n.top+=U,n.bottom+=U,n}function ar(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=Jt(),i-=Qt();else if(n=="local"||!n){var C=e.display.sizer.getBoundingClientRect();r+=C.left,i+=C.top}var U=e.display.lineSpace.getBoundingClientRect();return{left:r-U.left,top:i-U.top}}function Nr(e,t,n,r,i){return r||(r=wt(e.doc,t.line)),dr(e,r,pe(e,r,t.ch,i),n)}function or(e,t,n,r,i,C){r=r||wt(e.doc,t.line),i||(i=Ce(e,r));function U(We,Qe){var nt=De(e,i,We,Qe?"right":"left",C);return Qe?nt.left=nt.right:nt.right=nt.left,dr(e,r,nt,n)}var V=xt(r,e.doc.direction),$=t.ch,J=t.sticky;if($>=r.text.length?($=r.text.length,J="before"):$<=0&&($=0,J="after"),!V)return U(J=="before"?$-1:$,J=="before");function he(We,Qe,nt){var dt=V[Qe],St=dt.level==1;return U(nt?We-1:We,St!=nt)}var me=st(V,$,J),Me=mt,ke=he($,me,J=="before");return Me!=null&&(ke.other=he($,Me,J!="before")),ke}function Bt(e,t){var n=0;t=s(e.doc,t),e.options.lineWrapping||(n=un(e.display)*t.ch);var r=wt(e.doc,t.line),i=Xn(r)+za(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Nt(e,t,n,r,i){var C=Je(e,t,n);return C.xRel=i,r&&(C.outside=r),C}function sr(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return Nt(r.first,0,null,-1,-1);var i=Bn(r,n),C=r.first+r.size-1;if(i>C)return Nt(r.first+r.size-1,wt(r,C).text.length,null,1,1);t<0&&(t=0);for(var U=wt(r,i);;){var V=Ur(e,U,i,t,n),$=ei(U,V.ch+(V.xRel>0||V.outside>0?1:0));if(!$)return V;var J=$.find(1);if(J.line==i)return J;U=wt(r,i=J.line)}}function cr(e,t,n,r){r-=$t(t);var i=t.text.length,C=bt(function(U){return De(e,n,U-1).bottom<=r},i,0);return i=bt(function(U){return De(e,n,U).top>r},C,i),{begin:C,end:i}}function Dt(e,t,n,r){n||(n=Ce(e,t));var i=dr(e,t,De(e,n,r),"line").top;return cr(e,t,n,i)}function fr(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ur(e,t,n,r,i){i-=Xn(t);var C=Ce(e,t),U=$t(t),V=0,$=t.text.length,J=!0,he=xt(t,e.doc.direction);if(he){var me=(e.options.lineWrapping?Lr:yr)(e,t,n,C,he,r,i);J=me.level!=1,V=J?me.from:me.to-1,$=J?me.to:me.from-1}var Me=null,ke=null,We=bt(function(Ht){var Ut=De(e,C,Ht);return Ut.top+=U,Ut.bottom+=U,fr(Ut,r,i,!1)?(Ut.top<=i&&Ut.left<=r&&(Me=Ht,ke=Ut),!0):!1},V,$),Qe,nt,dt=!1;if(ke){var St=r-ke.left<ke.right-r,ct=St==J;We=Me+(ct?0:1),nt=ct?"after":"before",Qe=St?ke.left:ke.right}else{!J&&(We==$||We==V)&&We++,nt=We==0?"after":We==t.text.length?"before":De(e,C,We-(J?1:0)).bottom+U<=i==J?"after":"before";var Tt=or(e,Je(n,We,nt),"line",t,C);Qe=Tt.left,dt=i<Tt.top?-1:i>=Tt.bottom?1:0}return We=$e(t.text,We,1),Nt(n,We,nt,dt,r-Qe)}function yr(e,t,n,r,i,C,U){var V=bt(function(me){var Me=i[me],ke=Me.level!=1;return fr(or(e,Je(n,ke?Me.to:Me.from,ke?"before":"after"),"line",t,r),C,U,!0)},0,i.length-1),$=i[V];if(V>0){var J=$.level!=1,he=or(e,Je(n,J?$.from:$.to,J?"after":"before"),"line",t,r);fr(he,C,U,!0)&&he.top>U&&($=i[V-1])}return $}function Lr(e,t,n,r,i,C,U){var V=cr(e,t,r,U),$=V.begin,J=V.end;/\s/.test(t.text.charAt(J-1))&&J--;for(var he=null,me=null,Me=0;Me<i.length;Me++){var ke=i[Me];if(ke.from>=J||ke.to<=$)continue;var We=ke.level!=1,Qe=De(e,r,We?Math.min(J,ke.to)-1:Math.max($,ke.from)).right,nt=Qe<C?C-Qe+1e9:Qe-C;(!he||me>nt)&&(he=ke,me=nt)}return he||(he=i[i.length-1]),he.from<$&&(he={from:$,to:he.to,level:he.level}),he.to>J&&(he={from:he.from,to:J,level:he.level}),he}var wr;function Yr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(wr==null){wr=o("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)wr.appendChild(document.createTextNode("x")),wr.appendChild(o("br"));wr.appendChild(document.createTextNode("x"))}c(e.measure,wr);var n=wr.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),p(e.measure),n||1}function un(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=o("span","xxxxxxxxxx"),n=o("pre",[t],"CodeMirror-line-like");c(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function jr(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,C=t.gutters.firstChild,U=0;C;C=C.nextSibling,++U){var V=e.display.gutterSpecs[U].className;n[V]=C.offsetLeft+C.clientLeft+i,r[V]=C.clientWidth}return{fixedPos:On(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function On(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ti(e){var t=Yr(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/un(e.display)-3);return function(i){if(Wn(e.doc,i))return 0;var C=0;if(i.widgets)for(var U=0;U<i.widgets.length;U++)i.widgets[U].height&&(C+=i.widgets[U].height);return n?C+(Math.ceil(i.text.length/r)||1)*t:C+t}}function _n(e){var t=e.doc,n=ti(e);t.iter(function(r){var i=n(r);i!=r.height&&mn(r,i)})}function dn(e,t,n,r){var i=e.display;if(!n&&Se(t).getAttribute("cm-not-content")=="true")return null;var C,U,V=i.lineSpace.getBoundingClientRect();try{C=t.clientX-V.left,U=t.clientY-V.top}catch(me){return null}var $=sr(e,C,U),J;if(r&&$.xRel>0&&(J=wt(e.doc,$.line).text).length==$.ch){var he=te(J,J.length,e.options.tabSize)-J.length;$=Je($.line,Math.max(0,Math.round((C-xe(e.display).left)/un(e.display))-he))}return $}function _r(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function Or(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Qr&&wi(e.doc,t)<i.viewTo&&Br(e);else if(n<=i.viewFrom)Qr&&jn(e.doc,n+r)>i.viewFrom?Br(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Br(e);else if(t<=i.viewFrom){var C=ri(e,n,n+r,1);C?(i.view=i.view.slice(C.index),i.viewFrom=C.lineN,i.viewTo+=r):Br(e)}else if(n>=i.viewTo){var U=ri(e,t,t,-1);U?(i.view=i.view.slice(0,U.index),i.viewTo=U.lineN):Br(e)}else{var V=ri(e,t,t,-1),$=ri(e,n,n+r,1);V&&$?(i.view=i.view.slice(0,V.index).concat(Cn(e,V.lineN,$.lineN)).concat(i.view.slice($.index)),i.viewTo+=r):Br(e)}var J=i.externalMeasured;J&&(n<J.lineN?J.lineN+=r:t<J.lineN+J.size&&(i.externalMeasured=null))}function Wr(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var C=r.view[_r(e,t)];if(C.node==null)return;var U=C.changes||(C.changes=[]);be(U,n)==-1&&U.push(n)}function Br(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function ri(e,t,n,r){var i=_r(e,t),C,U=e.display.view;if(!Qr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var V=e.display.viewFrom,$=0;$<i;$++)V+=U[$].size;if(V!=t){if(r>0){if(i==U.length-1)return null;C=V+U[i].size-t,i++}else C=V-t;t+=C,n+=C}for(;wi(e.doc,n)!=n;){if(i==(r<0?0:U.length-1))return null;n+=r*U[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Ai(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=Cn(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Cn(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(_r(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(Cn(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,_r(e,n)))),r.viewTo=n}function Li(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function Ar(e){e.display.input.showSelection(e.display.input.prepareSelection())}function di(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),C=r.selection=document.createDocumentFragment(),U=0;U<n.sel.ranges.length;U++){if(!t&&U==n.sel.primIndex)continue;var V=n.sel.ranges[U];if(V.from().line>=e.display.viewTo||V.to().line<e.display.viewFrom)continue;var $=V.empty();($||e.options.showCursorWhenSelecting)&&Oi(e,V.head,i),$||Tr(e,V,C)}return r}function Oi(e,t,n){var r=or(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(o("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var C=n.appendChild(o("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));C.style.display="",C.style.left=r.other.left+"px",C.style.top=r.other.top+"px",C.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Mr(e,t){return e.top-t.top||e.left-t.left}function Tr(e,t,n){var r=e.display,i=e.doc,C=document.createDocumentFragment(),U=xe(e.display),V=U.left,$=Math.max(r.sizerWidth,ce(e)-r.sizer.offsetLeft)-U.right,J=i.direction=="ltr";function he(ct,Tt,Ht,Ut){Tt<0&&(Tt=0),Tt=Math.round(Tt),Ut=Math.round(Ut),C.appendChild(o("div",null,"CodeMirror-selected","position: absolute; left: "+ct+`px;
top: `+Tt+"px; width: "+(Ht==null?$-ct:Ht)+`px;
height: `+(Ut-Tt)+"px"))}function me(ct,Tt,Ht){var Ut=wt(i,ct),tr=Ut.text.length,Rr,bn;function Gr(rn,zn){return Nr(e,Je(ct,rn),"div",Ut,zn)}function $n(rn,zn,wn){var pn=Dt(e,Ut,null,rn),nn=zn=="ltr"==(wn=="after")?"left":"right",$r=wn=="after"?pn.begin:pn.end-(/\s/.test(Ut.text.charAt(pn.end-1))?2:1);return Gr($r,nn)[nn]}var Kn=xt(Ut,i.direction);return pt(Kn,Tt||0,Ht==null?tr:Ht,function(rn,zn,wn,pn){var nn=wn=="ltr",$r=Gr(rn,nn?"left":"right"),Gn=Gr(zn-1,nn?"right":"left"),Na=Tt==null&&rn==0,aa=Ht==null&&zn==tr,Dn=pn==0,Ri=!Kn||pn==Kn.length-1;if(Gn.top-$r.top<=3){var xn=(J?Na:aa)&&Dn,ps=(J?aa:Na)&&Ri,zi=xn?V:(nn?$r:Gn).left,ga=ps?$:(nn?Gn:$r).right;he(zi,$r.top,ga-zi,$r.bottom)}else{var va,Nn,Ua,ms;nn?(va=J&&Na&&Dn?V:$r.left,Nn=J?$:$n(rn,wn,"before"),Ua=J?V:$n(zn,wn,"after"),ms=J&&aa&&Ri?$:Gn.right):(va=J?$n(rn,wn,"before"):V,Nn=!J&&Na&&Dn?$:$r.right,Ua=!J&&aa&&Ri?V:Gn.left,ms=J?$n(zn,wn,"after"):$),he(va,$r.top,Nn-va,$r.bottom),$r.bottom<Gn.top&&he(V,$r.bottom,null,Gn.top),he(Ua,Gn.top,ms-Ua,Gn.bottom)}(!Rr||Mr($r,Rr)<0)&&(Rr=$r),Mr(Gn,Rr)<0&&(Rr=Gn),(!bn||Mr($r,bn)<0)&&(bn=$r),Mr(Gn,bn)<0&&(bn=Gn)}),{start:Rr,end:bn}}var Me=t.from(),ke=t.to();if(Me.line==ke.line)me(Me.line,Me.ch,ke.ch);else{var We=wt(i,Me.line),Qe=wt(i,ke.line),nt=vn(We)==vn(Qe),dt=me(Me.line,Me.ch,nt?We.text.length+1:null).end,St=me(ke.line,nt?0:null,ke.ch).start;nt&&(dt.top<St.top-2?(he(dt.right,dt.top,null,dt.bottom),he(V,St.top,St.left,St.bottom)):he(dt.right,dt.top,St.left-dt.right,dt.bottom)),dt.bottom<St.top&&he(V,dt.bottom,null,St.top)}n.appendChild(C)}function cn(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()||Qi(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function Eo(e){e.state.focused||(e.display.input.focus(),ki(e))}function Ga(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Qi(e))},100)}function ki(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Fe(e,"focus",e,t),e.state.focused=!0,z(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),I&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),cn(e)}function Qi(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Fe(e,"blur",e,t),e.state.focused=!1,h(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function ya(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],C=e.options.lineWrapping,U=void 0,V=0;if(i.hidden)continue;if(H&&B<8){var $=i.node.offsetTop+i.node.offsetHeight;U=$-n,n=$}else{var J=i.node.getBoundingClientRect();U=J.bottom-J.top,!C&&i.text.firstChild&&(V=i.text.firstChild.getBoundingClientRect().right-J.left-1)}var he=i.line.height-U;if((he>.005||he<-.005)&&(mn(i.line,U),Va(i.line),i.rest))for(var me=0;me<i.rest.length;me++)Va(i.rest[me]);if(V>e.display.sizerWidth){var Me=Math.ceil(V/un(e.display));Me>e.display.maxLineLength&&(e.display.maxLineLength=Me,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function Va(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function ba(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-za(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,C=Bn(t,r),U=Bn(t,i);if(n&&n.ensure){var V=n.ensure.from.line,$=n.ensure.to.line;V<C?(C=V,U=Bn(t,Xn(wt(t,V))+e.wrapper.clientHeight)):Math.min($,t.lastLine())>=U&&(C=Bn(t,Xn(wt(t,$))-e.wrapper.clientHeight),U=$)}return{from:C,to:Math.max(U,C+1)}}function Xo(e,t){if(Ze(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!L){var C=o("div","\u200B",null,`position: absolute;
top: `+(t.top-n.viewOffset-za(e.display))+`px;
height: `+(t.bottom-t.top+Ae(e)+n.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(C),C.scrollIntoView(i),e.display.lineSpace.removeChild(C)}}function Yo(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Je(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Je(t.line,t.ch+1,"before"):t);for(var C=0;C<5;C++){var U=!1,V=or(e,t),$=!n||n==t?V:or(e,n);i={left:Math.min(V.left,$.left),top:Math.min(V.top,$.top)-r,right:Math.max(V.left,$.left),bottom:Math.max(V.bottom,$.bottom)+r};var J=Xa(e,i),he=e.doc.scrollTop,me=e.doc.scrollLeft;if(J.scrollTop!=null&&(qi(e,J.scrollTop),Math.abs(e.doc.scrollTop-he)>1&&(U=!0)),J.scrollLeft!=null&&(ni(e,J.scrollLeft),Math.abs(e.doc.scrollLeft-me)>1&&(U=!0)),!U)break}return i}function So(e,t){var n=Xa(e,t);n.scrollTop!=null&&qi(e,n.scrollTop),n.scrollLeft!=null&&ni(e,n.scrollLeft)}function Xa(e,t){var n=e.display,r=Yr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,C=Z(e),U={};t.bottom-t.top>C&&(t.bottom=t.top+C);var V=e.doc.height+le(n),$=t.top<r,J=t.bottom>V-r;if(t.top<i)U.scrollTop=$?0:t.top;else if(t.bottom>i+C){var he=Math.min(t.top,(J?V:t.bottom)-C);he!=i&&(U.scrollTop=he)}var me=e.options.fixedGutter?0:n.gutters.offsetWidth,Me=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-me,ke=ce(e)-n.gutters.offsetWidth,We=t.right-t.left>ke;return We&&(t.right=t.left+ke),t.left<10?U.scrollLeft=0:t.left<Me?U.scrollLeft=Math.max(0,t.left+me-(We?0:10)):t.right>ke+Me-3&&(U.scrollLeft=t.right+(We?0:10)-ke),U}function Ya(e,t){if(t==null)return;xa(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Zi(e){xa(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Ji(e,t,n){(t!=null||n!=null)&&xa(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function $o(e,t){xa(e),e.curOp.scrollToPos=t}function xa(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=Bt(e,t.from),r=Bt(e,t.to);ca(e,n,r,t.margin)}}function ca(e,t,n,r){var i=Xa(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});Ji(e,i.scrollLeft,i.scrollTop)}function qi(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;D||pa(e,{top:t}),ea(e,t,!0),D&&pa(e),fa(e,100)}function ea(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 ni(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,lr(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function Bi(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+le(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Ae(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Di=function(e,t,n){this.cm=n;var r=this.vert=o("div",[o("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=o("div",[o("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),Ne(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Ne(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,H&&B<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Di.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var C=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+C)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},Di.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Di.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Di.prototype.zeroWidthHack=function(){var e=l&&!O?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ue,this.disableVert=new ue},Di.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),C=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);C!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Di.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ha=function(){};ha.prototype.update=function(){return{bottom:0,right:0}},ha.prototype.setScrollLeft=function(){},ha.prototype.setScrollTop=function(){},ha.prototype.clear=function(){};function Fi(e,t){t||(t=Bi(e));var n=e.display.barWidth,r=e.display.barHeight;Ea(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&ya(e),Ea(e,Bi(e)),n=e.display.barWidth,r=e.display.barHeight}function Ea(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var $a={native:Di,null:ha};function Sa(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&h(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new $a[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ne(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"?ni(e,t):qi(e,t)},e),e.display.scrollbars.addClass&&z(e.display.wrapper,e.display.scrollbars.addClass)}var Qa=0;function Mi(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:++Qa},Yn(e.curOp)}function ji(e){var t=e.curOp;t&&Ko(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;Co(n)})}function Co(e){for(var t=e.ops,n=0;n<t.length;n++)Qo(t[n]);for(var r=0;r<t.length;r++)Zo(t[r]);for(var i=0;i<t.length;i++)Jo(t[i]);for(var C=0;C<t.length;C++)Za(t[C]);for(var U=0;U<t.length;U++)qo(t[U])}function Qo(e){var t=e.cm,n=t.display;To(t),e.updateMaxLine&&ua(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 ii(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Zo(e){e.updatedDisplay=e.mustUpdate&&Wi(e.cm,e.update)}function Jo(e){var t=e.cm,n=t.display;e.updatedDisplay&&ya(t),e.barMeasure=Bi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=pe(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+Ae(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-ce(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Za(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&ni(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==N();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Fi(t,e.barMeasure),e.updatedDisplay&&Er(t,e.barMeasure),e.selectionChanged&&cn(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&Eo(e.cm)}function qo(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Ca(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&ea(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&ni(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=Yo(t,s(r,e.scrollToPos.from),s(r,e.scrollToPos.to),e.scrollToPos.margin);Xo(t,i)}var C=e.maybeHiddenMarkers,U=e.maybeUnhiddenMarkers;if(C)for(var V=0;V<C.length;++V)C[V].lines.length||Fe(C[V],"hide");if(U)for(var $=0;$<U.length;++$)U[$].lines.length&&Fe(U[$],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Fe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Rn(e,t){if(e.curOp)return t();Mi(e);try{return t()}finally{ji(e)}}function Zr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Mi(e);try{return t.apply(e,arguments)}finally{ji(e)}}}function Tn(e){return function(){if(this.curOp)return e.apply(this,arguments);Mi(this);try{return e.apply(this,arguments)}finally{ji(this)}}}function Jr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Mi(t);try{return e.apply(this,arguments)}finally{ji(t)}}}function fa(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,G(es,e))}function es(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=lt(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(C){if(r.line>=e.display.viewFrom){var U=C.styles,V=C.text.length>e.options.maxHighlightLength?Un(t.mode,r.state):null,$=ve(e,C,r,!0);V&&(r.state=V),C.styles=$.styles;var J=C.styleClasses,he=$.classes;he?C.styleClasses=he:J&&(C.styleClasses=null);for(var me=!U||U.length!=C.styles.length||J!=he&&(!J||!he||J.bgClass!=he.bgClass||J.textClass!=he.textClass),Me=0;!me&&Me<U.length;++Me)me=U[Me]!=C.styles[Me];me&&i.push(r.line),C.stateAfter=r.save(),r.nextLine()}else C.text.length<=e.options.maxHighlightLength&&At(e,C.text,r),C.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return fa(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&Rn(e,function(){for(var C=0;C<i.length;C++)Wr(e,i[C],"text")})}var ii=function(e,t,n){var r=e.display;this.viewport=t,this.visible=ba(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=ce(e),this.force=n,this.dims=jr(e),this.events=[]};ii.prototype.signal=function(e,t){ye(e,t)&&this.events.push(arguments)},ii.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Fe.apply(null,this.events[e])};function To(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Ae(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Ae(e)+"px",t.scrollbarsClipped=!0)}function wo(e){if(e.hasFocus())return null;var t=N();if(!t||!T(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&T(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function Ao(e){if(!e||!e.activeElt||e.activeElt==N())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&T(document.body,e.anchorNode)&&T(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 Wi(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Br(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&&Li(e)==0)return!1;hn(e)&&(Br(e),t.dims=jr(e));var i=r.first+r.size,C=Math.max(t.visible.from-e.options.viewportMargin,r.first),U=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<C&&C-n.viewFrom<20&&(C=Math.max(r.first,n.viewFrom)),n.viewTo>U&&n.viewTo-U<20&&(U=Math.min(i,n.viewTo)),Qr&&(C=wi(e.doc,C),U=jn(e.doc,U));var V=C!=n.viewFrom||U!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Ai(e,C,U),n.viewOffset=Xn(wt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var $=Li(e);if(!V&&$==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var J=wo(e);return $>4&&(n.lineDiv.style.display="none"),Lo(e,n.updateLineNumbers,t.dims),$>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,Ao(J),p(n.cursorDiv),p(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,V&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,fa(e,400)),n.updateLineNumbers=null,!0}function Ca(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==ce(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+le(e.display)-Z(e),n.top)}),t.visible=ba(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=ba(e.display,e.doc,n));if(!Wi(e,t))break;ya(e);var i=Bi(e);Ar(e),Fi(e,i),Er(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function pa(e,t){var n=new ii(e,t);if(Wi(e,n)){ya(e),Ca(e,n);var r=Bi(e);Ar(e),Fi(e,r),Er(e,r),n.finish()}}function Lo(e,t,n){var r=e.display,i=e.options.lineNumbers,C=r.lineDiv,U=C.firstChild;function V(We){var Qe=We.nextSibling;return I&&l&&e.display.currentWheelTarget==We?We.style.display="none":We.parentNode.removeChild(We),Qe}for(var $=r.view,J=r.viewFrom,he=0;he<$.length;he++){var me=$[he];if(!me.hidden)if(!me.node||me.node.parentNode!=C){var Me=bo(e,me,J,n);C.insertBefore(Me,U)}else{for(;U!=me.node;)U=V(U);var ke=i&&t!=null&&t<=J&&me.lineNumber;me.changes&&(be(me.changes,"gutter")>-1&&(ke=!1),vo(e,me,J,n)),ke&&(p(me.lineNumber),me.lineNumber.appendChild(document.createTextNode(hi(e.options,J)))),U=me.node.nextSibling}J+=me.size}for(;U;)U=V(U)}function Ta(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Er(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+Ae(e)+"px"}function lr(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=On(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,C=r+"px",U=0;U<n.length;U++)if(!n[U].hidden){e.options.fixedGutter&&(n[U].gutter&&(n[U].gutter.style.left=C),n[U].gutterBackground&&(n[U].gutterBackground.style.left=C));var V=n[U].alignable;if(V)for(var $=0;$<V.length;$++)V[$].style.left=C}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function hn(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=hi(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(o("div",[o("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),C=i.firstChild.offsetWidth,U=i.offsetWidth-C;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(C,r.lineGutter.offsetWidth-U)+1,r.lineNumWidth=r.lineNumInnerWidth+U,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Ta(e.display),!0}return!1}function Pn(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var C=e[i],U=null;if(typeof C!="string"&&(U=C.style,C=C.className),C=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:C,style:U})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function ta(e){var t=e.gutters,n=e.gutterSpecs;p(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],C=i.className,U=i.style,V=t.appendChild(o("div",null,"CodeMirror-gutter "+C));U&&(V.style.cssText=U),C=="CodeMirror-linenumbers"&&(e.lineGutter=V,V.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Ta(e)}function yi(e){ta(e.display),Or(e),lr(e)}function ma(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=o("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=o("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=S("div",null,"CodeMirror-code"),i.selectionDiv=o("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=o("div",null,"CodeMirror-cursors"),i.measure=o("div",null,"CodeMirror-measure"),i.lineMeasure=o("div",null,"CodeMirror-measure"),i.lineSpace=S("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var C=S("div",[i.lineSpace],"CodeMirror-lines");i.mover=o("div",[C],null,"position: relative"),i.sizer=o("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=o("div",null,null,"position: absolute; height: "+Oe+"px; width: 1px;"),i.gutters=o("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=o("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=o("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),H&&B<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!I&&!(D&&a)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=Pn(r.gutters,r.lineNumbers),ta(i),n.init(i)}var _i=0,fn=null;H?fn=-.53:D?fn=15:x?fn=-.7:M&&(fn=-1/3);function wa(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 Ja(e){var t=wa(e);return t.x*=fn,t.y*=fn,t}function qa(e,t){var n=wa(t),r=n.x,i=n.y,C=e.display,U=C.scroller,V=U.scrollWidth>U.clientWidth,$=U.scrollHeight>U.clientHeight;if(!(r&&V||i&&$))return;if(i&&l&&I){e:for(var J=t.target,he=C.view;J!=U;J=J.parentNode)for(var me=0;me<he.length;me++)if(he[me].node==J){e.display.currentWheelTarget=J;break e}}if(r&&!D&&!A&&fn!=null){i&&$&&qi(e,Math.max(0,U.scrollTop+i*fn)),ni(e,Math.max(0,U.scrollLeft+r*fn)),(!i||i&&$)&&re(t),C.wheelStartX=null;return}if(i&&fn!=null){var Me=i*fn,ke=e.doc.scrollTop,We=ke+C.wrapper.clientHeight;Me<0?ke=Math.max(0,ke+Me-50):We=Math.min(e.doc.height,We+Me+50),pa(e,{top:ke,bottom:We})}_i<20&&(C.wheelStartX==null?(C.wheelStartX=U.scrollLeft,C.wheelStartY=U.scrollTop,C.wheelDX=r,C.wheelDY=i,setTimeout(function(){if(C.wheelStartX==null)return;var Qe=U.scrollLeft-C.wheelStartX,nt=U.scrollTop-C.wheelStartY,dt=nt&&C.wheelDY&&nt/C.wheelDY||Qe&&C.wheelDX&&Qe/C.wheelDX;if(C.wheelStartX=C.wheelStartY=null,!dt)return;fn=(fn*_i+dt)/(_i+1),++_i},200)):(C.wheelDX+=r,C.wheelDY+=i))}var In=function(e,t){this.ranges=e,this.primIndex=t};In.prototype.primary=function(){return this.ranges[this.primIndex]},In.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!si(n.anchor,r.anchor)||!si(n.head,r.head))return!1}return!0},In.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new xr(fi(this.ranges[t].anchor),fi(this.ranges[t].head));return new In(e,this.primIndex)},In.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},In.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(jt(t,r.from())>=0&&jt(e,r.to())<=0)return n}return-1};var xr=function(e,t){this.anchor=e,this.head=t};xr.prototype.from=function(){return li(this.anchor,this.head)},xr.prototype.to=function(){return Si(this.anchor,this.head)},xr.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function ai(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(Me,ke){return jt(Me.from(),ke.from())}),n=be(t,i);for(var C=1;C<t.length;C++){var U=t[C],V=t[C-1],$=jt(V.to(),U.from());if(r&&!U.empty()?$>0:$>=0){var J=li(V.from(),U.from()),he=Si(V.to(),U.to()),me=V.empty()?U.from()==U.head:V.from()==V.head;C<=n&&--n,t.splice(--C,2,new xr(me?he:J,me?J:he))}}return new In(t,n)}function bi(e,t){return new In([new xr(e,t||e)],0)}function xi(e){return e.text?Je(e.from.line+e.text.length-1,He(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function eo(e,t){if(jt(e,t.from)<0)return e;if(jt(e,t.to)<=0)return xi(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=xi(t).ch-t.to.ch),Je(n,r)}function Aa(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new xr(eo(i.anchor,t),eo(i.head,t)))}return ai(e.cm,n,e.sel.primIndex)}function Oo(e,t,n){return e.line==t.line?Je(n.line,e.ch-t.ch+n.ch):Je(n.line+(e.line-t.line),e.ch)}function ko(e,t,n){for(var r=[],i=Je(e.first,0),C=i,U=0;U<t.length;U++){var V=t[U],$=Oo(V.from,i,C),J=Oo(xi(V),i,C);if(i=V.to,C=J,n=="around"){var he=e.sel.ranges[U],me=jt(he.head,he.anchor)<0;r[U]=new xr(me?J:$,me?$:J)}else r[U]=new xr($,$)}return new In(r,e.sel.primIndex)}function Hi(e){e.doc.mode=An(e.options,e.doc.modeOption),to(e)}function to(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,fa(e,100),e.state.modeGen++,e.curOp&&Or(e)}function gs(e,t){return t.from.ch==0&&t.to.ch==0&&He(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function ts(e,t,n,r){function i(St){return n?n[St]:null}function C(St,ct,Tt){Ba(St,ct,Tt,r),Xr(St,"change",St,t)}function U(St,ct){for(var Tt=[],Ht=St;Ht<ct;++Ht)Tt.push(new Ui(J[Ht],i(Ht),r));return Tt}var V=t.from,$=t.to,J=t.text,he=wt(e,V.line),me=wt(e,$.line),Me=He(J),ke=i(J.length-1),We=$.line-V.line;if(t.full)e.insert(0,U(0,J.length)),e.remove(J.length,e.size-J.length);else if(gs(e,t)){var Qe=U(0,J.length-1);C(me,me.text,ke),We&&e.remove(V.line,We),Qe.length&&e.insert(V.line,Qe)}else if(he==me)if(J.length==1)C(he,he.text.slice(0,V.ch)+Me+he.text.slice($.ch),ke);else{var nt=U(1,J.length-1);nt.push(new Ui(Me+he.text.slice($.ch),ke,r)),C(he,he.text.slice(0,V.ch)+J[0],i(0)),e.insert(V.line+1,nt)}else if(J.length==1)C(he,he.text.slice(0,V.ch)+J[0]+me.text.slice($.ch),i(0)),e.remove(V.line+1,We);else{C(he,he.text.slice(0,V.ch)+J[0],i(0)),C(me,Me+me.text.slice($.ch),ke);var dt=U(1,J.length-1);We>1&&e.remove(V.line+1,We-1),e.insert(V.line+1,dt)}Xr(e,"change",e,t)}function ra(e,t,n){function r(i,C,U){if(i.linked)for(var V=0;V<i.linked.length;++V){var $=i.linked[V];if($.doc==C)continue;var J=U&&$.sharedHist;if(n&&!J)continue;t($.doc,J),r($.doc,i,J)}}r(e,null,!0)}function vs(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,_n(e),Hi(e),ys(e),e.options.lineWrapping||ua(e),e.options.mode=t.modeOption,Or(e)}function ys(e){(e.doc.direction=="rtl"?z:h)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Rn(e,function(){ys(e),Or(e)})}function Do(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 rs(e,t){var n={from:fi(t.from),to:xi(t),text:Vn(e,t.from,t.to)};return Es(e,n,t.from.line,t.to.line+1),ra(e,function(r){return Es(r,n,t.from.line,t.to.line+1)},!0),n}function bs(e){for(;e.length;){var t=He(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return bs(e.done),He(e.done);if(e.done.length&&!He(e.done).ranges)return He(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),He(e.done)}function xs(e,t,n,r){var i=e.history;i.undone.length=0;var C=+new Date,U,V;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>C-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(U=pl(i,i.lastOp==r)))V=He(U.changes),jt(t.from,t.to)==0&&jt(t.from,V.to)==0?V.to=xi(t):U.changes.push(rs(e,t));else{var $=He(i.done);for((!$||!$.ranges)&&Mo(e.sel,i.done),U={changes:[rs(e,t)],generation:i.generation},i.done.push(U);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=C,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,V||Fe(e,"historyAdded")}function ml(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var i=e.history,C=r&&r.origin;n==i.lastSelOp||C&&i.lastSelOrigin==C&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==C||ml(e,C,He(i.done),t))?i.done[i.done.length-1]=t:Mo(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=C,i.lastSelOp=n,r&&r.clearRedo!==!1&&bs(i.undone)}function Mo(e,t){var n=He(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Es(e,t,n,r){var i=t["spans_"+e.id],C=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(U){U.markedSpans&&((i||(i=t["spans_"+e.id]={}))[C]=U.markedSpans),++C})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(vl(n[i]));return r}function Ss(e,t){var n=yl(e,t),r=qn(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var C=n[i],U=r[i];if(C&&U){e:for(var V=0;V<U.length;++V){for(var $=U[V],J=0;J<C.length;++J)if(C[J].marker==$.marker)continue e;C.push($)}}else U&&(n[i]=U)}return n}function La(e,t,n){for(var r=[],i=0;i<e.length;++i){var C=e[i];if(C.ranges){r.push(n?In.prototype.deepCopy.call(C):C);continue}var U=C.changes,V=[];r.push({changes:V});for(var $=0;$<U.length;++$){var J=U[$],he=void 0;if(V.push({from:J.from,to:J.to,text:J.text}),t)for(var me in J)(he=me.match(/^spans_(\d+)$/))&&(be(t,Number(he[1]))>-1&&(He(V)[me]=J[me],delete J[me]))}}return r}function ns(e,t,n,r){if(r){var i=e.anchor;if(n){var C=jt(t,i)<0;C!=jt(n,i)<0?(i=t,t=n):C!=jt(t,n)<0&&(t=n)}return new xr(i,t)}else return new xr(n||t,t)}function _o(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),kn(e,new In([ns(e.sel.primary(),t,n,i)],0),r)}function Cs(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),C=0;C<e.sel.ranges.length;C++)r[C]=ns(e.sel.ranges[C],t[C],null,i);var U=ai(e.cm,r,e.sel.primIndex);kn(e,U,n)}function is(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,kn(e,ai(e.cm,i,e.sel.primIndex),r)}function Ts(e,t,n,r){kn(e,bi(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var C=0;C<i.length;C++)this.ranges[C]=new xr(s(e,i[C].anchor),s(e,i[C].head))},origin:n&&n.origin};return Fe(e,"beforeSelectionChange",e,r),e.cm&&Fe(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?ai(e.cm,r.ranges,r.ranges.length-1):t}function ws(e,t,n){var r=e.history.done,i=He(r);i&&i.ranges?(r[r.length-1]=t,Ro(e,t,n)):kn(e,t,n)}function kn(e,t,n){Ro(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Ro(e,t,n){(ye(e,"beforeSelectionChange")||e.cm&&ye(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(jt(t.primary().head,e.sel.primary().head)<0?-1:1);As(e,Os(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Zi(e.cm)}function As(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,we(e.cm)),Xr(e,"cursorActivity",e)}function Ls(e){As(e,Os(e,e.sel,null,!1))}function Os(e,t,n,r){for(var i,C=0;C<t.ranges.length;C++){var U=t.ranges[C],V=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[C],$=Po(e,U.anchor,V&&V.anchor,n,r),J=Po(e,U.head,V&&V.head,n,r);(i||$!=U.anchor||J!=U.head)&&(i||(i=t.ranges.slice(0,C)),i[C]=new xr($,J))}return i?ai(e.cm,i,t.primIndex):t}function Oa(e,t,n,r,i){var C=wt(e,t.line);if(C.markedSpans)for(var U=0;U<C.markedSpans.length;++U){var V=C.markedSpans[U],$=V.marker,J="selectLeft"in $?!$.selectLeft:$.inclusiveLeft,he="selectRight"in $?!$.selectRight:$.inclusiveRight;if((V.from==null||(J?V.from<=t.ch:V.from<t.ch))&&(V.to==null||(he?V.to>=t.ch:V.to>t.ch))){if(i&&(Fe($,"beforeCursorEnter"),$.explicitlyCleared))if(C.markedSpans){--U;continue}else break;if(!$.atomic)continue;if(n){var me=$.find(r<0?1:-1),Me=void 0;if((r<0?he:J)&&(me=ks(e,me,-r,me&&me.line==t.line?C:null)),me&&me.line==t.line&&(Me=jt(me,n))&&(r<0?Me<0:Me>0))return Oa(e,me,t,r,i)}var ke=$.find(r<0?-1:1);return(r<0?J:he)&&(ke=ks(e,ke,r,ke.line==t.line?C:null)),ke?Oa(e,ke,t,r,i):null}}return t}function Po(e,t,n,r,i){var C=r||1,U=Oa(e,t,n,C,i)||!i&&Oa(e,t,n,C,!0)||Oa(e,t,n,-C,i)||!i&&Oa(e,t,n,-C,!0);return U||(e.cantEdit=!0,Je(e.first,0))}function ks(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?s(e,Je(t.line-1)):null:n>0&&t.ch==(r||wt(e,t.line)).text.length?t.line<e.first+e.size-1?Je(t.line+1,0):null:new Je(t.line,t.ch+n)}function Ds(e){e.setSelection(Je(e.firstLine(),0),Je(e.lastLine()),_e)}function Ms(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,C,U,V){i&&(r.from=s(e,i)),C&&(r.to=s(e,C)),U&&(r.text=U),V!==void 0&&(r.origin=V)}),Fe(e,"beforeChange",e,r),e.cm&&Fe(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function ka(e,t,n){if(e.cm){if(!e.cm.curOp)return Zr(e.cm,ka)(e,t,n);if(e.cm.state.suppressEdits)return}if((ye(e,"beforeChange")||e.cm&&ye(e.cm,"beforeChange"))&&(t=Ms(e,t,!0),!t))return;var r=Pi&&!n&&mi(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)_s(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else _s(e,t)}function _s(e,t){if(t.text.length==1&&t.text[0]==""&&jt(t.from,t.to)==0)return;var n=Aa(e,t);xs(e,t,n,e.cm?e.cm.curOp.id:NaN),ro(e,t,n,qn(e,t));var r=[];ra(e,function(i,C){!C&&be(r,i.history)==-1&&(Ns(i.history,t),r.push(i.history)),ro(i,t,null,qn(i,t))})}function Io(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,C,U=e.sel,V=t=="undo"?i.done:i.undone,$=t=="undo"?i.undone:i.done,J=0;J<V.length&&!(C=V[J],n?C.ranges&&!C.equals(e.sel):!C.ranges);J++);if(J==V.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(C=V.pop(),C.ranges){if(Mo(C,$),n&&!C.equals(e.sel)){kn(e,C,{clearRedo:!1});return}U=C}else if(r){V.push(C);return}else break;var he=[];Mo(U,$),$.push({changes:he,generation:i.generation}),i.generation=C.generation||++i.maxGeneration;for(var me=ye(e,"beforeChange")||e.cm&&ye(e.cm,"beforeChange"),Me=function(Qe){var nt=C.changes[Qe];if(nt.origin=t,me&&!Ms(e,nt,!1))return V.length=0,{};he.push(rs(e,nt));var dt=Qe?Aa(e,nt):He(V);ro(e,nt,dt,Ss(e,nt)),!Qe&&e.cm&&e.cm.scrollIntoView({from:nt.from,to:xi(nt)});var St=[];ra(e,function(ct,Tt){!Tt&&be(St,ct.history)==-1&&(Ns(ct.history,nt),St.push(ct.history)),ro(ct,nt,null,Ss(ct,nt))})},ke=C.changes.length-1;ke>=0;--ke){var We=Me(ke);if(We)return We.v}}function Rs(e,t){if(t==0)return;if(e.first+=t,e.sel=new In(ht(e.sel.ranges,function(i){return new xr(Je(i.anchor.line+t,i.anchor.ch),Je(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){Or(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Wr(e.cm,r,"gutter")}}function ro(e,t,n,r){if(e.cm&&!e.cm.curOp)return Zr(e.cm,ro)(e,t,n,r);if(t.to.line<e.first){Rs(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Rs(e,i),t={from:Je(e.first,0),to:Je(t.to.line+i,t.to.ch),text:[He(t.text)],origin:t.origin}}var C=e.lastLine();t.to.line>C&&(t={from:t.from,to:Je(C,wt(e,C).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Vn(e,t.from,t.to),n||(n=Aa(e,t)),e.cm?xl(e.cm,t,r):ts(e,t,r),Ro(e,n,_e),e.cantEdit&&Po(e,Je(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,n){var r=e.doc,i=e.display,C=t.from,U=t.to,V=!1,$=C.line;e.options.lineWrapping||($=nr(vn(wt(r,C.line))),r.iter($,U.line+1,function(ke){if(ke==i.maxLine)return V=!0,!0})),r.sel.contains(t.from,t.to)>-1&&we(e),ts(r,t,n,ti(e)),e.options.lineWrapping||(r.iter($,C.line+t.text.length,function(ke){var We=la(ke);We>i.maxLineLength&&(i.maxLine=ke,i.maxLineLength=We,i.maxLineChanged=!0,V=!1)}),V&&(e.curOp.updateMaxLine=!0)),Jn(r,C.line),fa(e,400);var J=t.text.length-(U.line-C.line)-1;t.full?Or(e):C.line==U.line&&t.text.length==1&&!gs(e.doc,t)?Wr(e,C.line,"text"):Or(e,C.line,U.line+1,J);var he=ye(e,"changes"),me=ye(e,"change");if(me||he){var Me={from:C,to:U,text:t.text,removed:t.removed,origin:t.origin};me&&Xr(e,"change",e,Me),he&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Me)}e.display.selForContextMenu=null}function Da(e,t,n,r,i){var C;r||(r=n),jt(r,n)<0&&(C=[r,n],n=C[0],r=C[1]),typeof t=="string"&&(t=e.splitLines(t)),ka(e,{from:n,to:r,text:t,origin:i})}function Ps(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Is(e,t,n,r){for(var i=0;i<e.length;++i){var C=e[i],U=!0;if(C.ranges){C.copied||(C=e[i]=C.deepCopy(),C.copied=!0);for(var V=0;V<C.ranges.length;V++)Ps(C.ranges[V].anchor,t,n,r),Ps(C.ranges[V].head,t,n,r);continue}for(var $=0;$<C.changes.length;++$){var J=C.changes[$];if(n<J.from.line)J.from=Je(J.from.line+r,J.from.ch),J.to=Je(J.to.line+r,J.to.ch);else if(t<=J.to.line){U=!1;break}}U||(e.splice(0,i+1),i=0)}}function Ns(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Is(e.done,n,r,i),Is(e.undone,n,r,i)}function no(e,t,n,r){var i=t,C=t;return typeof t=="number"?C=wt(e,j(e,t)):i=nr(t),i==null?null:(r(C,i)&&e.cm&&Wr(e.cm,i,n),C)}function io(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}io.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,Mt(i),Xr(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function ao(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}ao.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var C=Math.min(t,i-e),U=r.height;if(r.removeInner(e,C),this.height-=U-r.height,i==C&&(this.children.splice(n--,1),r.parent=null),(t-=C)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof io))){var V=[];this.collapse(V),this.children=[new io(V)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],C=i.chunkSize();if(e<=C){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var U=i.lines.length%25+25,V=U;V<i.lines.length;){var $=new io(i.lines.slice(V,V+=25));i.height-=$.height,this.children.splice(++r,0,$),$.parent=this}i.lines=i.lines.slice(0,U),this.maybeSpill()}break}e-=C}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new ao(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=be(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new ao(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],C=i.chunkSize();if(e<C){var U=Math.min(t,C-e);if(i.iterN(e,U,n))return!0;if((t-=U)==0)break;e=0}else e-=C}}};var oo=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};oo.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=nr(n);if(r==null||!t)return;for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var C=$i(this);mn(n,Math.max(0,n.height-C)),e&&(Rn(e,function(){Us(e,n,-C),Wr(e,r,"widget")}),Xr(e,"lineWidgetCleared",e,this,r))},oo.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=$i(this)-t;if(!i)return;Wn(this.doc,r)||mn(r,r.height+i),n&&Rn(n,function(){n.curOp.forceUpdate=!0,Us(n,r,i),Xr(n,"lineWidgetChanged",n,e,nr(r))})},Ee(oo);function Us(e,t,n){Xn(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ya(e,n)}function El(e,t,n,r){var i=new oo(e,n,r),C=e.cm;return C&&i.noHScroll&&(C.display.alignWidgets=!0),no(e,t,"widget",function(U){var V=U.widgets||(U.widgets=[]);if(i.insertAt==null?V.push(i):V.splice(Math.min(V.length-1,Math.max(0,i.insertAt)),0,i),i.line=U,C&&!Wn(e,U)){var $=Xn(U)<e.scrollTop;mn(U,U.height+$i(i)),$&&Ya(C,i.height),C.curOp.forceUpdate=!0}return!0}),C&&Xr(C,"lineWidgetAdded",C,i,typeof t=="number"?t:nr(t)),i}var Bs=0,na=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++Bs};na.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Mi(e),ye(this,"clear")){var n=this.find();n&&Xr(this,"clear",n.from,n.to)}for(var r=null,i=null,C=0;C<this.lines.length;++C){var U=this.lines[C],V=Sn(U.markedSpans,this);e&&!this.collapsed?Wr(e,nr(U),"text"):e&&(V.to!=null&&(i=nr(U)),V.from!=null&&(r=nr(U))),U.markedSpans=Ii(U.markedSpans,V),V.from==null&&this.collapsed&&!Wn(this.doc,U)&&e&&mn(U,Yr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var $=0;$<this.lines.length;++$){var J=vn(this.lines[$]),he=la(J);he>e.display.maxLineLength&&(e.display.maxLine=J,e.display.maxLineLength=he,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Or(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ls(e.doc)),e&&Xr(e,"markerCleared",e,this,r,i),t&&ji(e),this.parent&&this.parent.clear()},na.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var C=this.lines[i],U=Sn(C.markedSpans,this);if(U.from!=null&&(n=Je(t?C:nr(C),U.from),e==-1))return n;if(U.to!=null&&(r=Je(t?C:nr(C),U.to),e==1))return r}return n&&{from:n,to:r}},na.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;Rn(r,function(){var i=t.line,C=nr(t.line),U=Le(r,C);if(U&&(Zt(U),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Wn(n.doc,i)&&n.height!=null){var V=n.height;n.height=null;var $=$i(n)-V;$&&mn(i,i.height+$)}Xr(r,"markerChanged",r,e)})},na.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||be(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},na.prototype.detachLine=function(e){if(this.lines.splice(be(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},Ee(na);function Ma(e,t,n,r,i){if(r&&r.shared)return Sl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Zr(e.cm,Ma)(e,t,n,r,i);var C=new na(e,i),U=jt(t,n);if(r&&W(r,C,!1),U>0||U==0&&C.clearWhenEmpty!==!1)return C;if(C.replacedWith&&(C.collapsed=!0,C.widgetNode=S("span",[C.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||C.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(C.widgetNode.insertLeft=!0)),C.collapsed){if(tn(e,t.line,t,n,C)||t.line!=n.line&&tn(e,n.line,t,n,C))throw new Error("Inserting collapsed marker partially overlapping an existing one");pi()}C.addToHistory&&xs(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var V=t.line,$=e.cm,J;if(e.iter(V,n.line+1,function(me){$&&C.collapsed&&!$.options.lineWrapping&&vn(me)==$.display.maxLine&&(J=!0),C.collapsed&&V!=t.line&&mn(me,0),Ci(me,new ui(C,V==t.line?t.ch:null,V==n.line?n.ch:null)),++V}),C.collapsed&&e.iter(t.line,n.line+1,function(me){Wn(e,me)&&mn(me,0)}),C.clearOnEnter&&Ne(C,"beforeCursorEnter",function(){return C.clear()}),C.readOnly&&(Fn(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),C.collapsed&&(C.id=++Bs,C.atomic=!0),$){if(J&&($.curOp.updateMaxLine=!0),C.collapsed)Or($,t.line,n.line+1);else if(C.className||C.startStyle||C.endStyle||C.css||C.attributes||C.title)for(var he=t.line;he<=n.line;he++)Wr($,he,"text");C.atomic&&Ls($.doc),Xr($,"markerAdded",$,C)}return C}var so=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};so.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Xr(this,"clear")},so.prototype.find=function(e,t){return this.primary.find(e,t)},Ee(so);function Sl(e,t,n,r,i){r=W(r),r.shared=!1;var C=[Ma(e,t,n,r,i)],U=C[0],V=r.widgetNode;return ra(e,function($){V&&(r.widgetNode=V.cloneNode(!0)),C.push(Ma($,s($,t),s($,n),r,i));for(var J=0;J<$.linked.length;++J)if($.linked[J].isParent)return;U=He(C)}),new so(C,U)}function Fs(e){return e.findMarks(Je(e.first,0),e.clipPos(Je(e.lastLine())),function(t){return t.parent})}function Cl(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),C=e.clipPos(i.from),U=e.clipPos(i.to);if(jt(C,U)){var V=Ma(e,C,U,r.primary,r.primary.type);r.markers.push(V),V.parent=r}}}function Tl(e){for(var t=function(r){var i=e[r],C=[i.primary.doc];ra(i.primary.doc,function($){return C.push($)});for(var U=0;U<i.markers.length;U++){var V=i.markers[U];be(C,V.doc)==-1&&(V.parent=null,i.markers.splice(U--,1))}},n=0;n<e.length;n++)t(n)}var wl=0,Hn=function(e,t,n,r,i){if(!(this instanceof Hn))return new Hn(e,t,n,r,i);n==null&&(n=0),ao.call(this,[new io([new Ui("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var C=Je(n,0);this.sel=bi(C),this.history=new Do(null),this.id=++wl,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),ts(this,{from:C,to:C,text:e}),kn(this,bi(C),_e)};Hn.prototype=ft(ao.prototype,{constructor:Hn,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=oi(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Jr(function(e){var t=Je(this.first,0),n=this.first+this.size-1;ka(this,{from:t,to:Je(n,wt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Ji(this.cm,0,0),kn(this,bi(t),_e)}),replaceRange:function(e,t,n,r){t=s(this,t),n=n?s(this,n):t,Da(this,e,t,n,r)},getRange:function(e,t,n){var r=Vn(this,s(this,e),s(this,t));return n===!1?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Zn(this,e))return wt(this,e)},getLineNumber:function(e){return nr(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=wt(this,e)),vn(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return s(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:Jr(function(e,t,n){Ts(this,s(this,typeof e=="number"?Je(e,t||0):e),null,n)}),setSelection:Jr(function(e,t,n){Ts(this,s(this,e),s(this,t||e),n)}),extendSelection:Jr(function(e,t,n){_o(this,s(this,e),t&&s(this,t),n)}),extendSelections:Jr(function(e,t){Cs(this,R(this,e),t)}),extendSelectionsBy:Jr(function(e,t){var n=ht(this.sel.ranges,e);Cs(this,R(this,n),t)}),setSelections:Jr(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new xr(s(this,e[i].anchor),s(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),kn(this,ai(this.cm,r,t),n)}),addSelection:Jr(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new xr(s(this,e),s(this,t||e))),kn(this,ai(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var i=Vn(this,t[r].from(),t[r].to());n=n?n.concat(i):i}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=Vn(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:Jr(function(e,t,n){for(var r=[],i=this.sel,C=0;C<i.ranges.length;C++){var U=i.ranges[C];r[C]={from:U.from(),to:U.to(),text:this.splitLines(e[C]),origin:n}}for(var V=t&&t!="end"&&ko(this,r,t),$=r.length-1;$>=0;$--)ka(this,r[$]);V?ws(this,V):this.cm&&Zi(this.cm)}),undo:Jr(function(){Io(this,"undo")}),redo:Jr(function(){Io(this,"redo")}),undoSelection:Jr(function(){Io(this,"undo",!0)}),redoSelection:Jr(function(){Io(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Do(this.history.maxGeneration),ra(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:La(this.history.done),undone:La(this.history.undone)}},setHistory:function(e){var t=this.history=new Do(this.history.maxGeneration);t.done=La(e.done.slice(0),null,!0),t.undone=La(e.undone.slice(0),null,!0)},setGutterMarker:Jr(function(e,t,n){return no(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&ot(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Jr(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&no(t,n,"gutter",function(){return n.gutterMarkers[e]=null,ot(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Zn(this,e))return null;if(t=e,e=wt(this,e),!e)return null}else if(t=nr(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:Jr(function(e,t,n){return no(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(b(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Jr(function(e,t,n){return no(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",C=r[i];if(C)if(n==null)r[i]=null;else{var U=C.match(b(n));if(!U)return!1;var V=U.index+U[0].length;r[i]=C.slice(0,U.index)+(!U.index||V==C.length?"":" ")+C.slice(V)||null}else return!1;return!0})}),addLineWidget:Jr(function(e,t,n){return El(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Ma(this,s(this,e),s(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=s(this,e),Ma(this,e,e,n,"bookmark")},findMarksAt:function(e){e=s(this,e);var t=[],n=wt(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=s(this,e),t=s(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(C){var U=C.markedSpans;if(U)for(var V=0;V<U.length;V++){var $=U[V];!($.to!=null&&i==e.line&&e.ch>=$.to||$.from==null&&i!=e.line||$.from!=null&&i==t.line&&$.from>=t.ch)&&(!n||n($.marker))&&r.push($.marker.parent||$.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var C=i.text.length+r;if(C>e)return t=e,!0;e-=C,++n}),s(this,Je(n,t))},indexFromPos:function(e){e=s(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+n}),t},copy:function(e){var t=new Hn(oi(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new Hn(oi(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Cl(r,Fs(this)),r},unlinkDoc:function(e){if(e instanceof Hr&&(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),Tl(Fs(this));break}if(e.history==this.history){var r=[e.id];ra(e,function(i){return r.push(i.id)},!0),e.history=new Do(null),e.history.done=La(this.history.done,r),e.history.undone=La(this.history.undone,r)}},iterLinkedDocs:function(e){ra(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Kt(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:Jr(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)})}),Hn.prototype.eachLine=Hn.prototype.iter;var js=0;function Al(e){var t=this;if(Ws(t),Ze(t,e)||vi(t.display,e))return;re(e),H&&(js=+new Date);var n=dn(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,C=Array(i),U=0,V=function(){++U==i&&Zr(t,function(){n=s(t.doc,n);var ke={from:n,to:n,text:t.doc.splitLines(C.filter(function(We){return We!=null}).join(t.doc.lineSeparator())),origin:"paste"};ka(t.doc,ke),ws(t.doc,bi(s(t.doc,n),s(t.doc,xi(ke))))})()},$=function(ke,We){if(t.options.allowDropFileTypes&&be(t.options.allowDropFileTypes,ke.type)==-1){V();return}var Qe=new FileReader;Qe.onerror=function(){return V()},Qe.onload=function(){var nt=Qe.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(nt)){V();return}C[We]=nt,V()},Qe.readAsText(ke)},J=0;J<r.length;J++)$(r[J],J);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 he=e.dataTransfer.getData("Text");if(he){var me;if(t.state.draggingText&&!t.state.draggingText.copy&&(me=t.listSelections()),Ro(t.doc,bi(n,n)),me)for(var Me=0;Me<me.length;++Me)Da(t.doc,"",me[Me].anchor,me[Me].head,"drag");t.replaceSelection(he,"around","paste"),t.display.input.focus()}}catch(ke){}}}function Ll(e,t){if(H&&(!e.state.draggingText||+new Date-js<100)){ge(t);return}if(Ze(e,t)||vi(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!M){var n=o("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",A&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),A&&n.parentNode.removeChild(n)}}function Ol(e,t){var n=dn(e,t);if(!n)return;var r=document.createDocumentFragment();Oi(e,n,r),e.display.dragCursor||(e.display.dragCursor=o("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),c(e.display.dragCursor,r)}function Ws(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Hs(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var C=0;C<n.length;C++)e(n[C])})}var Ks=!1;function kl(){if(Ks)return;Dl(),Ks=!0}function Dl(){var e;Ne(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,Hs(Ml)},100))}),Ne(window,"blur",function(){return Hs(Qi)})}function Ml(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var ia={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"},lo=0;lo<10;lo++)ia[lo+48]=ia[lo+96]=String(lo);for(var No=65;No<=90;No++)ia[No]=String.fromCharCode(No);for(var uo=1;uo<=12;uo++)ia[uo+111]=ia[uo+63235]="F"+uo;var Ki={};Ki.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"},Ki.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"},Ki.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"},Ki.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"]},Ki.default=l?Ki.macDefault:Ki.pcDefault;function _l(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,C,U=0;U<t.length-1;U++){var V=t[U];if(/^(cmd|meta|m)$/i.test(V))C=!0;else if(/^a(lt)?$/i.test(V))n=!0;else if(/^(c|ctrl|control)$/i.test(V))r=!0;else if(/^s(hift)?$/i.test(V))i=!0;else throw new Error("Unrecognized modifier name: "+V)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),C&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Rl(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var i=ht(n.split(" "),_l),C=0;C<i.length;C++){var U=void 0,V=void 0;C==i.length-1?(V=i.join(" "),U=r):(V=i.slice(0,C+1).join(" "),U="...");var $=t[V];if(!$)t[V]=U;else if($!=U)throw new Error("Inconsistent bindings for "+V)}delete e[n]}for(var J in t)e[J]=t[J];return e}function _a(e,t,n,r){t=Uo(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return _a(e,t.fallthrough,n,r);for(var C=0;C<t.fallthrough.length;C++){var U=_a(e,t.fallthrough[C],n,r);if(U)return U}}}function zs(e){var t=typeof e=="string"?e:ia[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function Gs(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(m?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(m?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function Vs(e,t){if(A&&e.keyCode==34&&e.char)return!1;var n=ia[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),Gs(n,e,t))}function Uo(e){return typeof e=="string"?Ki[e]:e}function Ra(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var C=t(n[i]);r.length&&jt(C.from,He(r).to)<=0;){var U=r.pop();if(jt(U.from,C.from)<0){C.from=U.from;break}}r.push(C)}Rn(e,function(){for(var V=r.length-1;V>=0;V--)Da(e.doc,"",r[V].from,r[V].to,"+delete");Zi(e)})}function as(e,t,n){var r=$e(e.text,t+n,n);return r<0||r>e.text.length?null:r}function os(e,t,n){var r=as(e,t.ch,n);return r==null?null:new Je(t.line,r,n<0?"after":"before")}function ss(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var C=xt(n,t.doc.direction);if(C){var U=i<0?He(C):C[0],V=i<0==(U.level==1),$=V?"after":"before",J;if(U.level>0||t.doc.direction=="rtl"){var he=Ce(t,n);J=i<0?n.text.length-1:0;var me=De(t,he,J).top;J=bt(function(Me){return De(t,he,Me).top==me},i<0==(U.level==1)?U.from:U.to-1,J),$=="before"&&(J=as(n,J,1))}else J=i<0?U.to:U.from;return new Je(r,J,$)}}return new Je(r,i<0?n.text.length:0,i<0?"before":"after")}function Pl(e,t,n,r){var i=xt(t,e.doc.direction);if(!i)return os(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var C=st(i,n.ch,n.sticky),U=i[C];if(e.doc.direction=="ltr"&&U.level%2==0&&(r>0?U.to>n.ch:U.from<n.ch))return os(t,n,r);var V=function(dt,St){return as(t,dt instanceof Je?dt.ch:dt,St)},$,J=function(dt){return e.options.lineWrapping?($=$||Ce(e,t),Dt(e,t,$,dt)):{begin:0,end:t.text.length}},he=J(n.sticky=="before"?V(n,-1):n.ch);if(e.doc.direction=="rtl"||U.level==1){var me=U.level==1==r<0,Me=V(n,me?1:-1);if(Me!=null&&(me?Me<=U.to&&Me<=he.end:Me>=U.from&&Me>=he.begin)){var ke=me?"before":"after";return new Je(n.line,Me,ke)}}var We=function(dt,St,ct){for(var Tt=function(Rr,bn){return bn?new Je(n.line,V(Rr,1),"before"):new Je(n.line,Rr,"after")};dt>=0&&dt<i.length;dt+=St){var Ht=i[dt],Ut=St>0==(Ht.level!=1),tr=Ut?ct.begin:V(ct.end,-1);if(Ht.from<=tr&&tr<Ht.to)return Tt(tr,Ut);if(tr=Ut?Ht.from:V(Ht.to,-1),ct.begin<=tr&&tr<ct.end)return Tt(tr,Ut)}},Qe=We(C+r,r,he);if(Qe)return Qe;var nt=r>0?he.end:V(he.begin,-1);return nt!=null&&!(r>0&&nt==t.text.length)&&(Qe=We(r>0?0:i.length-1,r,J(nt)),Qe)?Qe:null}var co={selectAll:Ds,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),_e)},killLine:function(e){return Ra(e,function(t){if(t.empty()){var n=wt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Je(t.head.line+1,0)}:{from:t.head,to:Je(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Ra(e,function(t){return{from:Je(t.from().line,0),to:s(e.doc,Je(t.to().line+1,0))}})},delLineLeft:function(e){return Ra(e,function(t){return{from:Je(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Ra(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return Ra(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Je(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Je(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return Xs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return Ys(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},Ue)},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")},Ue)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?Ys(e,t.head):r},Ue)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var C=n[i].from(),U=te(e.getLine(C.line),C.ch,r);t.push(se(r-U%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Rn(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,C=wt(e.doc,i.line).text;if(C){if(i.ch==C.length&&(i=new Je(i.line,i.ch-1)),i.ch>0)i=new Je(i.line,i.ch+1),e.replaceRange(C.charAt(i.ch-1)+C.charAt(i.ch-2),Je(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var U=wt(e.doc,i.line-1).text;U&&(i=new Je(i.line,1),e.replaceRange(C.charAt(0)+e.doc.lineSeparator()+U.charAt(U.length-1),Je(i.line-1,U.length-1),i,"+transpose"))}}n.push(new xr(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return Rn(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);Zi(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Xs(e,t){var n=wt(e.doc,t),r=vn(n);return r!=n&&(t=nr(r)),ss(!0,e,r,t,1)}function Il(e,t){var n=wt(e.doc,t),r=Xi(n);return r!=n&&(t=nr(r)),ss(!0,e,n,t,-1)}function Ys(e,t){var n=Xs(e,t.line),r=wt(e.doc,n.line),i=xt(r,e.doc.direction);if(!i||i[0].level==0){var C=Math.max(n.ch,r.text.search(/\S/)),U=t.line==n.line&&t.ch<=C&&t.ch;return Je(n.line,U?0:C,n.sticky)}return n}function Bo(e,t,n){if(typeof t=="string"&&(t=co[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Ke}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Nl(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=_a(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&_a(t,e.options.extraKeys,n,e)||_a(t,e.options.keyMap,n,e)}var Ul=new ue;function ho(e,t,n,r){var i=e.state.keySeq;if(i){if(zs(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ul.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),$s(e,i+" "+t,n,r))return!0}return $s(e,t,n,r)}function $s(e,t,n,r){var i=Nl(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Xr(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(re(n),cn(e)),!!i}function Qs(e,t){var n=Vs(t,!0);return n?t.shiftKey&&!e.state.keySeq?ho(e,"Shift-"+n,t,function(r){return Bo(e,r,!0)})||ho(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return Bo(e,r)}):ho(e,n,t,function(r){return Bo(e,r)}):!1}function Bl(e,t,n){return ho(e,"'"+n+"'",t,function(r){return Bo(e,r,!0)})}var ls=null;function Zs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=N(),Ze(t,e))return;H&&B<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=Qs(t,e);A&&(ls=r?n:null,!r&&n==88&&!pr&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),D&&!l&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Fl(t)}function Fl(e){var t=e.display.lineDiv;z(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(h(t,"CodeMirror-crosshair"),Et(document,"keyup",n),Et(document,"mouseover",n))}Ne(document,"keyup",n),Ne(document,"mouseover",n)}function Js(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ze(this,e)}function qs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(vi(t.display,e)||Ze(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(A&&n==ls){ls=null,re(e);return}if(A&&(!e.which||e.which<10)&&Qs(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Bl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,us=function(e,t,n){this.time=e,this.pos=t,this.button=n};us.prototype.compare=function(e,t,n){return this.time+jl>e&&jt(t,this.pos)==0&&n==this.button};var fo,po;function Wl(e,t){var n=+new Date;return po&&po.compare(n,e,t)?(fo=po=null,"triple"):fo&&fo.compare(n,e,t)?(po=new us(n,e,t),fo=null,"double"):(fo=new us(n,e,t),po=null,"single")}function el(e){var t=this,n=t.display;if(Ze(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,vi(n,e)){I||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(ds(t,e))return;var r=dn(t,e),i=Re(e),C=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,C,e))return;i==1?r?zl(t,r,C,e):Se(e)==n.scroller&&re(e):i==2?(r&&_o(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(k?t.display.input.onContextMenu(e):Ga(t))}function Hl(e,t,n,r,i){var C="Click";return r=="double"?C="Double"+C:r=="triple"&&(C="Triple"+C),C=(t==1?"Left":t==2?"Middle":"Right")+C,ho(e,Gs(C,i),i,function(U){if(typeof U=="string"&&(U=co[U]),!U)return!1;var V=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),V=U(e,n)!=Ke}finally{e.state.suppressEdits=!1}return V})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var C=d?n.shiftKey&&n.metaKey:n.altKey;i.unit=C?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=l?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(l?n.altKey:n.ctrlKey)),i}function zl(e,t,n,r){H?setTimeout(G(Eo,e),0):e.curOp.focus=N();var i=Kl(e,n,r),C=e.doc.sel,U;e.options.dragDrop&&Ge&&!e.isReadOnly()&&n=="single"&&(U=C.contains(t))>-1&&(jt((U=C.ranges[U]).from(),t)<0||t.xRel>0)&&(jt(U.to(),t)>0||t.xRel<0)?Gl(e,r,t,i):Vl(e,r,t,i)}function Gl(e,t,n,r){var i=e.display,C=!1,U=Zr(e,function(J){I&&(i.scroller.draggable=!1),e.state.draggingText=!1,Et(i.wrapper.ownerDocument,"mouseup",U),Et(i.wrapper.ownerDocument,"mousemove",V),Et(i.scroller,"dragstart",$),Et(i.scroller,"drop",U),C||(re(J),r.addNew||_o(e.doc,n,null,null,r.extend),I&&!M||H&&B==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),V=function(J){C=C||Math.abs(t.clientX-J.clientX)+Math.abs(t.clientY-J.clientY)>=10},$=function(){return C=!0};I&&(i.scroller.draggable=!0),e.state.draggingText=U,U.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Ne(i.wrapper.ownerDocument,"mouseup",U),Ne(i.wrapper.ownerDocument,"mousemove",V),Ne(i.scroller,"dragstart",$),Ne(i.scroller,"drop",U),Ga(e),setTimeout(function(){return i.input.focus()},20)}function tl(e,t,n){if(n=="char")return new xr(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new xr(Je(t.line,0),s(e.doc,Je(t.line+1,0)));var r=n(e,t);return new xr(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,C=e.doc;re(t);var U,V,$=C.sel,J=$.ranges;if(r.addNew&&!r.extend?(V=C.sel.contains(n),V>-1?U=J[V]:U=new xr(n,n)):(U=C.sel.primary(),V=C.sel.primIndex),r.unit=="rectangle")r.addNew||(U=new xr(n,n)),n=dn(e,t,!0,!0),V=-1;else{var he=tl(e,n,r.unit);r.extend?U=ns(U,he.anchor,he.head,r.extend):U=he}r.addNew?V==-1?(V=J.length,kn(C,ai(e,J.concat([U]),V),{scroll:!1,origin:"*mouse"})):J.length>1&&J[V].empty()&&r.unit=="char"&&!r.extend?(kn(C,ai(e,J.slice(0,V).concat(J.slice(V+1)),0),{scroll:!1,origin:"*mouse"}),$=C.sel):is(C,V,U,Ie):(V=0,kn(C,new In([U],0),Ie),$=C.sel);var me=n;function Me(ct){if(jt(me,ct)==0)return;if(me=ct,r.unit=="rectangle"){for(var Tt=[],Ht=e.options.tabSize,Ut=te(wt(C,n.line).text,n.ch,Ht),tr=te(wt(C,ct.line).text,ct.ch,Ht),Rr=Math.min(Ut,tr),bn=Math.max(Ut,tr),Gr=Math.min(n.line,ct.line),$n=Math.min(e.lastLine(),Math.max(n.line,ct.line));Gr<=$n;Gr++){var Kn=wt(C,Gr).text,rn=Pe(Kn,Rr,Ht);Rr==bn?Tt.push(new xr(Je(Gr,rn),Je(Gr,rn))):Kn.length>rn&&Tt.push(new xr(Je(Gr,rn),Je(Gr,Pe(Kn,bn,Ht))))}Tt.length||Tt.push(new xr(n,n)),kn(C,ai(e,$.ranges.slice(0,V).concat(Tt),V),{origin:"*mouse",scroll:!1}),e.scrollIntoView(ct)}else{var zn=U,wn=tl(e,ct,r.unit),pn=zn.anchor,nn;jt(wn.anchor,pn)>0?(nn=wn.head,pn=li(zn.from(),wn.anchor)):(nn=wn.anchor,pn=Si(zn.to(),wn.head));var $r=$.ranges.slice(0);$r[V]=Xl(e,new xr(s(C,pn),nn)),kn(C,ai(e,$r,V),Ie)}}var ke=i.wrapper.getBoundingClientRect(),We=0;function Qe(ct){var Tt=++We,Ht=dn(e,ct,!0,r.unit=="rectangle");if(!Ht)return;if(jt(Ht,me)!=0){e.curOp.focus=N(),Me(Ht);var Ut=ba(i,C);(Ht.line>=Ut.to||Ht.line<Ut.from)&&setTimeout(Zr(e,function(){We==Tt&&Qe(ct)}),150)}else{var tr=ct.clientY<ke.top?-20:ct.clientY>ke.bottom?20:0;tr&&setTimeout(Zr(e,function(){if(We!=Tt)return;i.scroller.scrollTop+=tr,Qe(ct)}),50)}}function nt(ct){e.state.selectingText=!1,We=Infinity,ct&&(re(ct),i.input.focus()),Et(i.wrapper.ownerDocument,"mousemove",dt),Et(i.wrapper.ownerDocument,"mouseup",St),C.history.lastSelOrigin=null}var dt=Zr(e,function(ct){ct.buttons===0||!Re(ct)?nt(ct):Qe(ct)}),St=Zr(e,nt);e.state.selectingText=St,Ne(i.wrapper.ownerDocument,"mousemove",dt),Ne(i.wrapper.ownerDocument,"mouseup",St)}function Xl(e,t){var n=t.anchor,r=t.head,i=wt(e.doc,n.line);if(jt(n,r)==0&&n.sticky==r.sticky)return t;var C=xt(i);if(!C)return t;var U=st(C,n.ch,n.sticky),V=C[U];if(V.from!=n.ch&&V.to!=n.ch)return t;var $=U+(V.from==n.ch==(V.level!=1)?0:1);if($==0||$==C.length)return t;var J;if(r.line!=n.line)J=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var he=st(C,r.ch,r.sticky),me=he-U||(r.ch-n.ch)*(V.level==1?-1:1);he==$-1||he==$?J=me<0:J=me>0}var Me=C[$+(J?-1:0)],ke=J==(Me.level==1),We=ke?Me.from:Me.to,Qe=ke?"after":"before";return n.ch==We&&n.sticky==Qe?t:new xr(new Je(n.line,We,Qe),r)}function rl(e,t,n,r){var i,C;if(t.touches)i=t.touches[0].clientX,C=t.touches[0].clientY;else try{i=t.clientX,C=t.clientY}catch(Me){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&re(t);var U=e.display,V=U.lineDiv.getBoundingClientRect();if(C>V.bottom||!ye(e,n))return de(t);C-=V.top-U.viewOffset;for(var $=0;$<e.display.gutterSpecs.length;++$){var J=U.gutters.childNodes[$];if(J&&J.getBoundingClientRect().right>=i){var he=Bn(e.doc,C),me=e.display.gutterSpecs[$];return Fe(e,n,e,he,me.className,t),de(t)}}}function ds(e,t){return rl(e,t,"gutterClick",!0)}function nl(e,t){if(vi(e.display,t)||Yl(e,t))return;if(Ze(e,t,"contextmenu"))return;k||e.display.input.onContextMenu(t)}function Yl(e,t){return ye(e,"gutterContextMenu")?rl(e,t,"gutterContextMenu",!1):!1}function il(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Yt(e)}var Pa={toString:function(){return"CodeMirror.Init"}},al={},Fo={};function $l(e){var t=e.optionHandlers;function n(r,i,C,U){e.defaults[r]=i,C&&(t[r]=U?function(V,$,J){J!=Pa&&C(V,$,J)}:C)}e.defineOption=n,e.Init=Pa,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Hi(r)},!0),n("indentUnit",2,Hi,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){to(r),Yt(r),Or(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var C=[],U=r.doc.first;r.doc.iter(function($){for(var J=0;;){var he=$.text.indexOf(i,J);if(he==-1)break;J=he+i.length,C.push(Je(U,he))}U++});for(var V=C.length-1;V>=0;V--)Da(r.doc,i,C[V],Je(C[V].line,C[V].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,C){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),C!=Pa&&r.refresh()}),n("specialCharPlaceholder",Cr,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",a?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!E),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){il(r),yi(r)},!0),n("keyMap","default",function(r,i,C){var U=Uo(i),V=C!=Pa&&Uo(C);V&&V.detach&&V.detach(r,U),U.attach&&U.attach(r,V||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Zl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Pn(i,r.options.lineNumbers),yi(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?On(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Fi(r)},!0),n("scrollbarStyle","native",function(r){Sa(r),Fi(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=Pn(r.options.gutters,i),yi(r)},!0),n("firstLineNumber",1,yi,!0),n("lineNumberFormatter",function(r){return r},yi,!0),n("showCursorWhenSelecting",!1,Ar,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Qi(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Ql),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,Ar,!0),n("singleCursorHeightPerLine",!0,Ar,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,to,!0),n("addModeClass",!1,to,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,to,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Ql(e,t,n){var r=n&&n!=Pa;if(!t!=!r){var i=e.display.dragFunctions,C=t?Ne:Et;C(e.display.scroller,"dragstart",i.start),C(e.display.scroller,"dragenter",i.enter),C(e.display.scroller,"dragover",i.over),C(e.display.scroller,"dragleave",i.leave),C(e.display.scroller,"drop",i.drop)}}function Zl(e){e.options.lineWrapping?(z(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(h(e.display.wrapper,"CodeMirror-wrap"),ua(e)),_n(e),Or(e),Yt(e),setTimeout(function(){return Fi(e)},100)}function Hr(e,t){var n=this;if(!(this instanceof Hr))return new Hr(e,t);this.options=t=t?W(t):{},W(al,t,!1);var r=t.value;typeof r=="string"?r=new Hn(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Hr.inputStyles[t.inputStyle](this),C=this.display=new ma(e,r,i,t);C.wrapper.CodeMirror=this,il(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Sa(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 ue,keySeq:null,specialChars:null},t.autofocus&&!a&&C.input.focus(),H&&B<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Jl(this),kl(),Mi(this),this.curOp.forceUpdate=!0,vs(this,r),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&ki(n)},20):Qi(this);for(var U in Fo)Fo.hasOwnProperty(U)&&Fo[U](this,t[U],Pa);hn(this),t.finishInit&&t.finishInit(this);for(var V=0;V<cs.length;++V)cs[V](this);ji(this),I&&t.lineWrapping&&getComputedStyle(C.lineDiv).textRendering=="optimizelegibility"&&(C.lineDiv.style.textRendering="auto")}Hr.defaults=al,Hr.optionHandlers=Fo;function Jl(e){var t=e.display;Ne(t.scroller,"mousedown",Zr(e,el)),H&&B<11?Ne(t.scroller,"dblclick",Zr(e,function($){if(Ze(e,$))return;var J=dn(e,$);if(!J||ds(e,$)||vi(e.display,$))return;re($);var he=e.findWordAt(J);_o(e.doc,he.anchor,he.head)})):Ne(t.scroller,"dblclick",function($){return Ze(e,$)||re($)}),Ne(t.scroller,"contextmenu",function($){return nl(e,$)}),Ne(t.input.getField(),"contextmenu",function($){t.scroller.contains($.target)||nl(e,$)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function C($){if($.touches.length!=1)return!1;var J=$.touches[0];return J.radiusX<=1&&J.radiusY<=1}function U($,J){if(J.left==null)return!0;var he=J.left-$.left,me=J.top-$.top;return he*he+me*me>20*20}Ne(t.scroller,"touchstart",function($){if(!Ze(e,$)&&!C($)&&!ds(e,$)){t.input.ensurePolled(),clearTimeout(n);var J=+new Date;t.activeTouch={start:J,moved:!1,prev:J-r.end<=300?r:null},$.touches.length==1&&(t.activeTouch.left=$.touches[0].pageX,t.activeTouch.top=$.touches[0].pageY)}}),Ne(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ne(t.scroller,"touchend",function($){var J=t.activeTouch;if(J&&!vi(t,$)&&J.left!=null&&!J.moved&&new Date-J.start<300){var he=e.coordsChar(t.activeTouch,"page"),me;!J.prev||U(J,J.prev)?me=new xr(he,he):!J.prev.prev||U(J,J.prev.prev)?me=e.findWordAt(he):me=new xr(Je(he.line,0),s(e.doc,Je(he.line+1,0))),e.setSelection(me.anchor,me.head),e.focus(),re($)}i()}),Ne(t.scroller,"touchcancel",i),Ne(t.scroller,"scroll",function(){t.scroller.clientHeight&&(qi(e,t.scroller.scrollTop),ni(e,t.scroller.scrollLeft,!0),Fe(e,"scroll",e))}),Ne(t.scroller,"mousewheel",function($){return qa(e,$)}),Ne(t.scroller,"DOMMouseScroll",function($){return qa(e,$)}),Ne(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function($){Ze(e,$)||ge($)},over:function($){Ze(e,$)||(Ol(e,$),ge($))},start:function($){return Ll(e,$)},drop:Zr(e,Al),leave:function($){Ze(e,$)||Ws(e)}};var V=t.input.getField();Ne(V,"keyup",function($){return Js.call(e,$)}),Ne(V,"keydown",Zr(e,Zs)),Ne(V,"keypress",Zr(e,qs)),Ne(V,"focus",function($){return ki(e,$)}),Ne(V,"blur",function($){return Qi(e,$)})}var cs=[];Hr.defineInitHook=function(e){return cs.push(e)};function mo(e,t,n,r){var i=e.doc,C;n==null&&(n="add"),n=="smart"&&(i.mode.indent?C=lt(e,t).state:n="prev");var U=e.options.tabSize,V=wt(i,t),$=te(V.text,null,U);V.stateAfter&&(V.stateAfter=null);var J=V.text.match(/^\s*/)[0],he;if(!r&&!/\S/.test(V.text))he=0,n="not";else if(n=="smart"&&(he=i.mode.indent(C,V.text.slice(J.length),V.text),he==Ke||he>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?he=te(wt(i,t-1).text,null,U):he=0:n=="add"?he=$+e.options.indentUnit:n=="subtract"?he=$-e.options.indentUnit:typeof n=="number"&&(he=$+n),he=Math.max(0,he);var me="",Me=0;if(e.options.indentWithTabs)for(var ke=Math.floor(he/U);ke;--ke)Me+=U,me+=" ";if(Me<he&&(me+=se(he-Me)),me!=J)return Da(i,me,Je(t,0),Je(t,J.length),"+input"),V.stateAfter=null,!0;for(var We=0;We<i.sel.ranges.length;We++){var Qe=i.sel.ranges[We];if(Qe.head.line==t&&Qe.head.ch<J.length){var nt=Je(t,J.length);is(i,We,new xr(nt,nt));break}}}var Ei=null;function jo(e){Ei=e}function hs(e,t,n,r,i){var C=e.doc;e.display.shift=!1,r||(r=C.sel);var U=+new Date-200,V=i=="paste"||e.state.pasteIncoming>U,$=Kt(t),J=null;if(V&&r.ranges.length>1)if(Ei&&Ei.text.join(`
`)==t){if(r.ranges.length%Ei.text.length==0){J=[];for(var he=0;he<Ei.text.length;he++)J.push(C.splitLines(Ei.text[he]))}}else $.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(J=ht($,function(dt){return[dt]}));for(var me=e.curOp.updateInput,Me=r.ranges.length-1;Me>=0;Me--){var ke=r.ranges[Me],We=ke.from(),Qe=ke.to();ke.empty()&&(n&&n>0?We=Je(We.line,We.ch-n):e.state.overwrite&&!V?Qe=Je(Qe.line,Math.min(wt(C,Qe.line).text.length,Qe.ch+He($).length)):V&&Ei&&Ei.lineWise&&Ei.text.join(`
`)==$.join(`
`)&&(We=Qe=Je(We.line,0)));var nt={from:We,to:Qe,text:J?J[Me%J.length]:$,origin:i||(V?"paste":e.state.cutIncoming>U?"cut":"+input")};ka(e.doc,nt),Xr(e,"inputRead",e,nt)}t&&!V&&sl(e,t),Zi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=me),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ol(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Rn(t,function(){return hs(t,n,0,null,"paste")}),!0}function sl(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var C=e.getModeAt(i.head),U=!1;if(C.electricChars){for(var V=0;V<C.electricChars.length;V++)if(t.indexOf(C.electricChars.charAt(V))>-1){U=mo(e,i.head.line,"smart");break}}else C.electricInput&&(C.electricInput.test(wt(e.doc,i.head.line).text.slice(0,i.head.ch))&&(U=mo(e,i.head.line,"smart")));U&&Xr(e,"electricInput",e,i.head.line)}}function ll(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,C={anchor:Je(i,0),head:Je(i+1,0)};n.push(C),t.push(e.getRange(C.anchor,C.head))}return{text:t,ranges:n}}function ul(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function dl(){var e=o("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=o("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return I?e.style.width="1000px":e.setAttribute("wrap","off"),g&&(e.style.border="1px solid black"),ul(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,i){var C=this.options,U=C[r];if(C[r]==i&&r!="mode")return;C[r]=i,t.hasOwnProperty(r)&&Zr(this,t[r])(this,i,U),Fe(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](Uo(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,C=0;C<i.length;++C)if(i[C]==r||i[C].name==r)return i.splice(C,1),!0},addOverlay:Tn(function(r,i){var C=r.token?r:e.getMode(this.options,r);if(C.startState)throw new Error("Overlays may not be stateful.");it(this.state.overlays,{mode:C,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(U){return U.priority}),this.state.modeGen++,Or(this)}),removeOverlay:Tn(function(r){for(var i=this.state.overlays,C=0;C<i.length;++C){var U=i[C].modeSpec;if(U==r||typeof r=="string"&&U.name==r){i.splice(C,1),this.state.modeGen++,Or(this);return}}}),indentLine:Tn(function(r,i,C){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Zn(this.doc,r)&&mo(this,r,i,C)}),indentSelection:Tn(function(r){for(var i=this.doc.sel.ranges,C=-1,U=0;U<i.length;U++){var V=i[U];if(V.empty())V.head.line>C&&(mo(this,V.head.line,r,!0),C=V.head.line,U==this.doc.sel.primIndex&&Zi(this));else{var $=V.from(),J=V.to(),he=Math.max(C,$.line);C=Math.min(this.lastLine(),J.line-(J.ch?0:1))+1;for(var me=he;me<C;++me)mo(this,me,r);var Me=this.doc.sel.ranges;$.ch==0&&i.length==Me.length&&Me[U].from().ch>0&&is(this.doc,U,new xr($,Me[U].to()),_e)}}}),getTokenAt:function(r,i){return Dr(this,r,i)},getLineTokens:function(r,i){return Dr(this,Je(r),i,!0)},getTokenTypeAt:function(r){r=s(this.doc,r);var i=ze(this,wt(this.doc,r.line)),C=0,U=(i.length-1)/2,V=r.ch,$;if(V==0)$=i[2];else for(;;){var J=C+U>>1;if((J?i[J*2-1]:0)>=V)U=J;else if(i[J*2+1]<V)C=J+1;else{$=i[J*2+2];break}}var he=$?$.indexOf("overlay "):-1;return he<0?$:he==0?null:$.slice(0,he-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var C=[];if(!n.hasOwnProperty(i))return C;var U=n[i],V=this.getModeAt(r);if(typeof V[i]=="string")U[V[i]]&&C.push(U[V[i]]);else if(V[i])for(var $=0;$<V[i].length;$++){var J=U[V[i][$]];J&&C.push(J)}else V.helperType&&U[V.helperType]?C.push(U[V.helperType]):U[V.name]&&C.push(U[V.name]);for(var he=0;he<U._global.length;he++){var me=U._global[he];me.pred(V,this)&&be(C,me.val)==-1&&C.push(me.val)}return C},getStateAfter:function(r,i){var C=this.doc;return r=j(C,r==null?C.first+C.size-1:r),lt(this,r+1,i).state},cursorCoords:function(r,i){var C,U=this.doc.sel.primary();return r==null?C=U.head:typeof r=="object"?C=s(this.doc,r):C=r?U.from():U.to(),or(this,C,i||"page")},charCoords:function(r,i){return Nr(this,s(this.doc,r),i||"page")},coordsChar:function(r,i){return r=ar(this,r,i||"page"),sr(this,r.left,r.top)},lineAtHeight:function(r,i){return r=ar(this,{top:r,left:0},i||"page").top,Bn(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,C){var U=!1,V;if(typeof r=="number"){var $=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>$&&(r=$,U=!0),V=wt(this.doc,r)}else V=r;return dr(this,V,{top:0,left:0},i||"page",C||U).top+(U?this.doc.height-Xn(V):0)},defaultTextHeight:function(){return Yr(this.display)},defaultCharWidth:function(){return un(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,C,U,V){var $=this.display;r=or(this,s(this.doc,r));var J=r.bottom,he=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),$.sizer.appendChild(i),U=="over")J=r.top;else if(U=="above"||U=="near"){var me=Math.max($.wrapper.clientHeight,this.doc.height),Me=Math.max($.sizer.clientWidth,$.lineSpace.clientWidth);(U=="above"||r.bottom+i.offsetHeight>me)&&r.top>i.offsetHeight?J=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=me&&(J=r.bottom),he+i.offsetWidth>Me&&(he=Me-i.offsetWidth)}i.style.top=J+"px",i.style.left=i.style.right="",V=="right"?(he=$.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(V=="left"?he=0:V=="middle"&&(he=($.sizer.clientWidth-i.offsetWidth)/2),i.style.left=he+"px"),C&&So(this,{left:he,top:J,right:he+i.offsetWidth,bottom:J+i.offsetHeight})},triggerOnKeyDown:Tn(Zs),triggerOnKeyPress:Tn(qs),triggerOnKeyUp:Js,triggerOnMouseDown:Tn(el),execCommand:function(r){if(co.hasOwnProperty(r))return co[r].call(null,this)},triggerElectric:Tn(function(r){sl(this,r)}),findPosH:function(r,i,C,U){var V=1;i<0&&(V=-1,i=-i);for(var $=s(this.doc,r),J=0;J<i&&!($=fs(this.doc,$,V,C,U),$.hitSide);++J);return $},moveH:Tn(function(r,i){var C=this;this.extendSelectionsBy(function(U){return C.display.shift||C.doc.extend||U.empty()?fs(C.doc,U.head,r,i,C.options.rtlMoveVisually):r<0?U.from():U.to()},Ue)}),deleteH:Tn(function(r,i){var C=this.doc.sel,U=this.doc;C.somethingSelected()?U.replaceSelection("",null,"+delete"):Ra(this,function(V){var $=fs(U,V.head,r,i,!1);return r<0?{from:$,to:V.head}:{from:V.head,to:$}})}),findPosV:function(r,i,C,U){var V=1,$=U;i<0&&(V=-1,i=-i);for(var J=s(this.doc,r),he=0;he<i;++he){var me=or(this,J,"div");if($==null?$=me.left:me.left=$,J=cl(this,me,V,C),J.hitSide)break}return J},moveV:Tn(function(r,i){var C=this,U=this.doc,V=[],$=!this.display.shift&&!U.extend&&U.sel.somethingSelected();if(U.extendSelectionsBy(function(he){if($)return r<0?he.from():he.to();var me=or(C,he.head,"div");he.goalColumn!=null&&(me.left=he.goalColumn),V.push(me.left);var Me=cl(C,me,r,i);return i=="page"&&he==U.sel.primary()&&Ya(C,Nr(C,Me,"div").top-me.top),Me},Ue),V.length)for(var J=0;J<U.sel.ranges.length;J++)U.sel.ranges[J].goalColumn=V[J]}),findWordAt:function(r){var i=this.doc,C=wt(i,r.line).text,U=r.ch,V=r.ch;if(C){var $=this.getHelper(r,"wordChars");(r.sticky=="before"||V==C.length)&&U?--U:++V;for(var J=C.charAt(U),he=rt(J,$)?function(me){return rt(me,$)}:/\s/.test(J)?function(me){return/\s/.test(me)}:function(me){return!/\s/.test(me)&&!rt(me)};U>0&&he(C.charAt(U-1));)--U;for(;V<C.length&&he(C.charAt(V));)++V}return new xr(Je(r.line,U),Je(r.line,V))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?z(this.display.cursorDiv,"CodeMirror-overwrite"):h(this.display.cursorDiv,"CodeMirror-overwrite"),Fe(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==N()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Tn(function(r,i){Ji(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Ae(this)-this.display.barHeight,width:r.scrollWidth-Ae(this)-this.display.barWidth,clientHeight:Z(this),clientWidth:ce(this)}},scrollIntoView:Tn(function(r,i){r==null?(r={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof r=="number"?r={from:Je(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?$o(this,r):ca(this,r.from,r.to,r.margin)}),setSize:Tn(function(r,i){var C=this,U=function($){return typeof $=="number"||/^\d+$/.test(String($))?$+"px":$};r!=null&&(this.display.wrapper.style.width=U(r)),i!=null&&(this.display.wrapper.style.height=U(i)),this.options.lineWrapping&&Xt(this);var V=this.display.viewFrom;this.doc.iter(V,this.display.viewTo,function($){if($.widgets){for(var J=0;J<$.widgets.length;J++)if($.widgets[J].noHScroll){Wr(C,V,"widget");break}}++V}),this.curOp.forceUpdate=!0,Fe(this,"refresh",this)}),operation:function(r){return Rn(this,r)},startOperation:function(){return Mi(this)},endOperation:function(){return ji(this)},refresh:Tn(function(){var r=this.display.cachedTextHeight;Or(this),this.curOp.forceUpdate=!0,Yt(this),Ji(this,this.doc.scrollLeft,this.doc.scrollTop),Ta(this.display),(r==null||Math.abs(r-Yr(this.display))>.5||this.options.lineWrapping)&&_n(this),Fe(this,"refresh",this)}),swapDoc:Tn(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),vs(this,r),Yt(this),this.display.input.reset(),Ji(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Xr(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Ee(e),e.registerHelper=function(r,i,C){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=C},e.registerGlobalHelper=function(r,i,C,U){e.registerHelper(r,i,U),n[r]._global.push({pred:C,val:U})}}function fs(e,t,n,r,i){var C=t,U=n,V=wt(e,t.line),$=i&&e.direction=="rtl"?-n:n;function J(){var St=t.line+$;return St<e.first||St>=e.first+e.size?!1:(t=new Je(St,t.ch,t.sticky),V=wt(e,St))}function he(St){var ct;if(r=="codepoint"){var Tt=V.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(Tt)?ct=null:ct=new Je(t.line,Math.max(0,Math.min(V.text.length,t.ch+n*(Tt>=55296&&Tt<56320?2:1))),-n)}else i?ct=Pl(e.cm,V,t,n):ct=os(V,t,n);if(ct==null)if(!St&&J())t=ss(i,e.cm,V,t.line,$);else return!1;else t=ct;return!0}if(r=="char"||r=="codepoint")he();else if(r=="column")he(!0);else if(r=="word"||r=="group")for(var me=null,Me=r=="group",ke=e.cm&&e.cm.getHelper(t,"wordChars"),We=!0;!(n<0&&!he(!We));We=!1){var Qe=V.text.charAt(t.ch)||`
`,nt=rt(Qe,ke)?"w":Me&&Qe==`
`?"n":!Me||/\s/.test(Qe)?null:"p";if(Me&&!We&&!nt&&(nt="s"),me&&me!=nt){n<0&&(n=1,he(),t.sticky="after");break}if(nt&&(me=nt),n>0&&!he(!We))break}var dt=Po(e,t,C,U,!0);return si(C,dt)&&(dt.hitSide=!0),dt}function cl(e,t,n,r){var i=e.doc,C=t.left,U;if(r=="page"){var V=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),$=Math.max(V-.5*Yr(e.display),3);U=(n>0?t.bottom:t.top)+n*$}else r=="line"&&(U=n>0?t.bottom+3:t.top-3);for(var J;!(J=sr(e,C,U),!J.outside);){if(n<0?U<=0:U>=i.height){J.hitSide=!0;break}U+=n*5}return J}var kr=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ue,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};kr.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;ul(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function C(V){for(var $=V.target;$;$=$.parentNode){if($==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test($.className))break}return!1}Ne(i,"paste",function(V){if(!C(V)||Ze(r,V)||ol(V,r))return;B<=11&&setTimeout(Zr(r,function(){return t.updateFromDOM()}),20)}),Ne(i,"compositionstart",function(V){t.composing={data:V.data,done:!1}}),Ne(i,"compositionupdate",function(V){t.composing||(t.composing={data:V.data,done:!1})}),Ne(i,"compositionend",function(V){t.composing&&(V.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ne(i,"touchstart",function(){return n.forceCompositionEnd()}),Ne(i,"input",function(){t.composing||t.readFromDOMSoon()});function U(V){if(!C(V)||Ze(r,V))return;if(r.somethingSelected())jo({lineWise:!1,text:r.getSelections()}),V.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var $=ll(r);jo({lineWise:!0,text:$.text}),V.type=="cut"&&r.operation(function(){r.setSelections($.ranges,0,_e),r.replaceSelection("",null,"cut")})}else return;if(V.clipboardData){V.clipboardData.clearData();var J=Ei.text.join(`
`);if(V.clipboardData.setData("Text",J),V.clipboardData.getData("Text")==J){V.preventDefault();return}}var he=dl(),me=he.firstChild;r.display.lineSpace.insertBefore(he,r.display.lineSpace.firstChild),me.value=Ei.text.join(`
`);var Me=document.activeElement;ee(me),setTimeout(function(){r.display.lineSpace.removeChild(he),Me.focus(),Me==i&&n.showPrimarySelection()},50)}Ne(i,"copy",U),Ne(i,"cut",U)},kr.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},kr.prototype.prepareSelection=function(){var e=di(this.cm,!1);return e.focus=document.activeElement==this.div,e},kr.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},kr.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},kr.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var C=Wo(t,e.anchorNode,e.anchorOffset),U=Wo(t,e.focusNode,e.focusOffset);if(C&&!C.bad&&U&&!U.bad&&jt(li(C,U),r)==0&&jt(Si(C,U),i)==0)return;var V=t.display.view,$=r.line>=t.display.viewFrom&&hl(t,r)||{node:V[0].measure.map[2],offset:0},J=i.line<t.display.viewTo&&hl(t,i);if(!J){var he=V[V.length-1].measure,me=he.maps?he.maps[he.maps.length-1]:he.map;J={node:me[me.length-1],offset:me[me.length-2]-me[me.length-3]}}if(!$||!J){e.removeAllRanges();return}var Me=e.rangeCount&&e.getRangeAt(0),ke;try{ke=y($.node,$.offset,J.offset,J.node)}catch(We){}ke&&(!D&&t.state.focused?(e.collapse($.node,$.offset),ke.collapsed||(e.removeAllRanges(),e.addRange(ke))):(e.removeAllRanges(),e.addRange(ke)),Me&&e.anchorNode==null?e.addRange(Me):D&&this.startGracePeriod()),this.rememberSelection()},kr.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)},kr.prototype.showMultipleSelections=function(e){c(this.cm.display.cursorDiv,e.cursors),c(this.cm.display.selectionDiv,e.selection)},kr.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},kr.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return T(this.div,t)},kr.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},kr.prototype.blur=function(){this.div.blur()},kr.prototype.getField=function(){return this.div},kr.prototype.supportsTouch=function(){return!0},kr.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Rn(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)},kr.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},kr.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(u&&x&&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=Wo(t,e.anchorNode,e.anchorOffset),r=Wo(t,e.focusNode,e.focusOffset);n&&r&&Rn(t,function(){kn(t.doc,bi(n,r),_e),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},kr.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Je(r.line-1,wt(e.doc,r.line-1).length)),i.ch==wt(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Je(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var C,U,V;r.line==t.viewFrom||(C=_r(e,r.line))==0?(U=nr(t.view[0].line),V=t.view[0].node):(U=nr(t.view[C].line),V=t.view[C-1].node.nextSibling);var $=_r(e,i.line),J,he;if($==t.view.length-1?(J=t.viewTo-1,he=t.lineDiv.lastChild):(J=nr(t.view[$+1].line)-1,he=t.view[$+1].node.previousSibling),!V)return!1;for(var me=e.doc.splitLines(tu(e,V,he,U,J)),Me=Vn(e.doc,Je(U,0),Je(J,wt(e.doc,J).text.length));me.length>1&&Me.length>1;)if(He(me)==He(Me))me.pop(),Me.pop(),J--;else if(me[0]==Me[0])me.shift(),Me.shift(),U++;else break;for(var ke=0,We=0,Qe=me[0],nt=Me[0],dt=Math.min(Qe.length,nt.length);ke<dt&&Qe.charCodeAt(ke)==nt.charCodeAt(ke);)++ke;for(var St=He(me),ct=He(Me),Tt=Math.min(St.length-(me.length==1?ke:0),ct.length-(Me.length==1?ke:0));We<Tt&&St.charCodeAt(St.length-We-1)==ct.charCodeAt(ct.length-We-1);)++We;if(me.length==1&&Me.length==1&&U==r.line)for(;ke&&ke>r.ch&&St.charCodeAt(St.length-We-1)==ct.charCodeAt(ct.length-We-1);)ke--,We++;me[me.length-1]=St.slice(0,St.length-We).replace(/^\u200b+/,""),me[0]=me[0].slice(ke).replace(/\u200b+$/,"");var Ht=Je(U,ke),Ut=Je(J,Me.length?He(Me).length-We:0);if(me.length>1||me[0]||jt(Ht,Ut))return Da(e.doc,me,Ht,Ut,"+input"),!0},kr.prototype.ensurePolled=function(){this.forceCompositionEnd()},kr.prototype.reset=function(){this.forceCompositionEnd()},kr.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},kr.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)},kr.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Rn(this.cm,function(){return Or(e.cm)})},kr.prototype.setUneditable=function(e){e.contentEditable="false"},kr.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Zr(this.cm,hs)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},kr.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},kr.prototype.onContextMenu=function(){},kr.prototype.resetPosition=function(){},kr.prototype.needsContentAttribute=!0;function hl(e,t){var n=Le(e,t.line);if(!n||n.hidden)return null;var r=wt(e.doc,t.line),i=q(n,r,t.line),C=xt(r,e.doc.direction),U="left";if(C){var V=st(C,t.ch);U=V%2?"right":"left"}var $=tt(i.map,t.ch,U);return $.offset=$.collapse=="right"?$.end:$.start,$}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Ia(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var C="",U=!1,V=e.doc.lineSeparator(),$=!1;function J(ke){return function(We){return We.id==ke}}function he(){U&&(C+=V,$&&(C+=V),U=$=!1)}function me(ke){ke&&(he(),C+=ke)}function Me(ke){if(ke.nodeType==1){var We=ke.getAttribute("cm-text");if(We){me(We);return}var Qe=ke.getAttribute("cm-marker"),nt;if(Qe){var dt=e.findMarks(Je(r,0),Je(i+1,0),J(+Qe));dt.length&&(nt=dt[0].find(0))&&me(Vn(e.doc,nt.from,nt.to).join(V));return}if(ke.getAttribute("contenteditable")=="false")return;var St=/^(pre|div|p|li|table|br)$/i.test(ke.nodeName);if(!/^br$/i.test(ke.nodeName)&&ke.textContent.length==0)return;St&&he();for(var ct=0;ct<ke.childNodes.length;ct++)Me(ke.childNodes[ct]);/^(pre|p)$/i.test(ke.nodeName)&&($=!0),St&&(U=!0)}else ke.nodeType==3&&me(ke.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Me(t),t==n);)t=t.nextSibling,$=!1;return C}function Wo(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Ia(e.clipPos(Je(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var C=e.display.view[i];if(C.node==r)return ru(C,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!T(r,t))return Ia(Je(nr(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var C=e.rest?He(e.rest):e.line;return Ia(Je(nr(C),C.text.length),i)}var U=t.nodeType==3?t:null,V=t;for(!U&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(U=t.firstChild,n&&(n=U.nodeValue.length));V.parentNode!=r;)V=V.parentNode;var $=e.measure,J=$.maps;function he(nt,dt,St){for(var ct=-1;ct<(J?J.length:0);ct++)for(var Tt=ct<0?$.map:J[ct],Ht=0;Ht<Tt.length;Ht+=3){var Ut=Tt[Ht+2];if(Ut==nt||Ut==dt){var tr=nr(ct<0?e.line:e.rest[ct]),Rr=Tt[Ht]+St;return(St<0||Ut!=nt)&&(Rr=Tt[Ht+(St?1:0)]),Je(tr,Rr)}}}var me=he(U,V,n);if(me)return Ia(me,i);for(var Me=V.nextSibling,ke=U?U.nodeValue.length-n:0;Me;Me=Me.nextSibling){if(me=he(Me,Me.firstChild,0),me)return Ia(Je(me.line,me.ch-ke),i);ke+=Me.textContent.length}for(var We=V.previousSibling,Qe=n;We;We=We.previousSibling){if(me=he(We,We.firstChild,-1),me)return Ia(Je(me.line,me.ch+Qe),i);Qe+=We.textContent.length}}var qr=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ue,this.hasSelection=!1,this.composing=null};qr.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),g&&(i.style.width="0px"),Ne(i,"input",function(){H&&B>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Ne(i,"paste",function(U){if(Ze(r,U)||ol(U,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function C(U){if(Ze(r,U))return;if(r.somethingSelected())jo({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var V=ll(r);jo({lineWise:!0,text:V.text}),U.type=="cut"?r.setSelections(V.ranges,null,_e):(n.prevInput="",i.value=V.text.join(`
`),ee(i))}else return;U.type=="cut"&&(r.state.cutIncoming=+new Date)}Ne(i,"cut",C),Ne(i,"copy",C),Ne(e.scroller,"paste",function(U){if(vi(e,U)||Ze(r,U))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var V=new Event("paste");V.clipboardData=U.clipboardData,i.dispatchEvent(V)}),Ne(e.lineSpace,"selectstart",function(U){vi(e,U)||re(U)}),Ne(i,"compositionstart",function(){var U=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:U,range:r.markText(U,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Ne(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},qr.prototype.createField=function(e){this.wrapper=dl(),this.textarea=this.wrapper.firstChild},qr.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},qr.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=di(e);if(e.options.moveInputWithCursor){var i=or(e,n.sel.primary().head,"div"),C=t.wrapper.getBoundingClientRect(),U=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+U.top-C.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+U.left-C.left))}return r},qr.prototype.showSelection=function(e){var t=this.cm,n=t.display;c(n.cursorDiv,e.cursors),c(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},qr.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&&ee(this.textarea),H&&B>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",H&&B>=9&&(this.hasSelection=null))},qr.prototype.getField=function(){return this.textarea},qr.prototype.supportsTouch=function(){return!1},qr.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||N()!=this.textarea))try{this.textarea.focus()}catch(e){}},qr.prototype.blur=function(){this.textarea.blur()},qr.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},qr.prototype.receivedFocus=function(){this.slowPoll()},qr.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()})},qr.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},qr.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Ct(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(H&&B>=9&&this.hasSelection===i||l&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var C=i.charCodeAt(0);if(C==8203&&!r&&(r="\u200B"),C==8666)return this.reset(),this.cm.execCommand("undo")}for(var U=0,V=Math.min(r.length,i.length);U<V&&r.charCodeAt(U)==i.charCodeAt(U);)++U;return Rn(t,function(){hs(t,i.slice(U),r.length-U,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},qr.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},qr.prototype.onKeyPress=function(){H&&B>=9&&(this.hasSelection=null),this.fastPoll()},qr.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var C=dn(n,e),U=r.scroller.scrollTop;if(!C||A)return;var V=n.options.resetSelectionOnContextMenu;V&&n.doc.sel.contains(C)==-1&&Zr(n,kn)(n.doc,bi(C),_e);var $=i.style.cssText,J=t.wrapper.style.cssText,he=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-he.top-5)+"px; left: "+(e.clientX-he.left-5)+`px;
z-index: 1000; background: `+(H?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var me;I&&(me=window.scrollY),r.input.focus(),I&&window.scrollTo(null,me),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=ke,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function Me(){if(i.selectionStart!=null){var Qe=n.somethingSelected(),nt="\u200B"+(Qe?i.value:"");i.value="\u21DA",i.value=nt,t.prevInput=Qe?"":"\u200B",i.selectionStart=1,i.selectionEnd=nt.length,r.selForContextMenu=n.doc.sel}}function ke(){if(t.contextMenuPending!=ke)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=J,i.style.cssText=$,H&&B<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=U),i.selectionStart!=null){(!H||H&&B<9)&&Me();var Qe=0,nt=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Zr(n,Ds)(n):Qe++<10?r.detectingSelectAll=setTimeout(nt,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(nt,200)}}if(H&&B>=9&&Me(),k){ge(e);var We=function(){Et(window,"mouseup",We),setTimeout(ke,20)};Ne(window,"mouseup",We)}else setTimeout(ke,50)},qr.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},qr.prototype.setUneditable=function(){},qr.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?W(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=N();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=V.getValue()}var i;if(e.form&&(Ne(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var C=e.form;i=C.submit;try{var U=C.submit=function(){r(),C.submit=i,C.submit(),C.submit=U}}catch($){}}t.finishInit=function($){$.save=r,$.getTextArea=function(){return e},$.toTextArea=function(){$.toTextArea=isNaN,r(),e.parentNode.removeChild($.getWrapperElement()),e.style.display="",e.form&&(Et(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var V=Hr(function($){return e.parentNode.insertBefore($,e.nextSibling)},t);return V}function iu(e){e.off=Et,e.on=Ne,e.wheelEventPixels=Ja,e.Doc=Hn,e.splitLines=Kt,e.countColumn=te,e.findColumn=Pe,e.isWordChar=Ye,e.Pass=Ke,e.signal=Fe,e.Line=Ui,e.changeEnd=xi,e.scrollbarModel=$a,e.Pos=Je,e.cmpPos=jt,e.modes=Pr,e.mimeModes=Vt,e.resolveMode=It,e.getMode=An,e.modeExtensions=on,e.extendMode=sn,e.copyState=Un,e.startState=Qn,e.innerMode=ci,e.commands=co,e.keyMap=Ki,e.keyName=Vs,e.isModifierKey=zs,e.lookupKey=_a,e.normalizeKeyMap=Rl,e.StringStream=mr,e.SharedTextMarker=so,e.TextMarker=na,e.LineWidget=oo,e.e_preventDefault=re,e.e_stopPropagation=ne,e.e_stop=ge,e.addClass=z,e.contains=T,e.rmClass=h,e.keyNames=ia}$l(Hr),ql(Hr);var au="iter insert remove copy getEditor constructor".split(" ");for(var Ho in Hn.prototype)Hn.prototype.hasOwnProperty(Ho)&&be(au,Ho)<0&&(Hr.prototype[Ho]=function(e){return function(){return e.apply(this.doc,arguments)}}(Hn.prototype[Ho]));return Ee(Hn),Hr.inputStyles={textarea:qr,contenteditable:kr},Hr.defineMode=function(e){!Hr.defaults.mode&&e!="null"&&(Hr.defaults.mode=e),an.apply(this,arguments)},Hr.defineMIME=En,Hr.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Hr.defineMIME("text/plain","null"),Hr.defineExtension=function(e,t){Hr.prototype[e]=t},Hr.defineDocExtension=function(e,t){Hn.prototype[e]=t},Hr.fromTextArea=nu,iu(Hr),Hr.version="5.58.2",Hr})},Y1PL:function(Ft,gt,ie){"use strict";ie.r(gt),ie.d(gt,"ResizableTextArea",function(){return be});var ae=ie("wx14"),X=ie("1OyB"),D=ie("vuIU"),K=ie("Ji7U"),w=ie("LK+K"),P=ie("q1tI"),H=ie("VTBJ"),B=ie("rePB"),I=ie("Zm9Q"),_=ie("Kwbf"),x=ie("c+Xe"),A=ie("m+aA"),M=ie("bdgK"),O=new Map;function L(_e){_e.forEach(function(Ie){var Ue,Pe=Ie.target;(Ue=O.get(Pe))===null||Ue===void 0||Ue.forEach(function(Te){return Te(Pe)})})}var g=new M.default(L),u=null,a=null;function l(_e,Ie){O.has(_e)||(O.set(_e,new Set),g.observe(_e)),O.get(_e).add(Ie)}function d(_e,Ie){O.has(_e)&&(O.get(_e).delete(Ie),O.get(_e).size||(g.unobserve(_e),O.delete(_e)))}var E=function(_e){Object(K.a)(Ue,_e);var Ie=Object(w.a)(Ue);function Ue(){return Object(X.a)(this,Ue),Ie.apply(this,arguments)}return Object(D.a)(Ue,[{key:"render",value:function(){return this.props.children}}]),Ue}(P.Component),v=P.createContext(null);function m(_e){var Ie=_e.children,Ue=_e.onBatchResize,Pe=P.useRef(0),Te=P.useRef([]),se=P.useContext(v),He=P.useCallback(function(ht,it,at){Pe.current+=1;var ft=Pe.current;Te.current.push({size:ht,element:it,data:at}),Promise.resolve().then(function(){ft===Pe.current&&(Ue==null||Ue(Te.current),Te.current=[])}),se==null||se(ht,it,at)},[Ue,se]);return P.createElement(v.Provider,{value:He},Ie)}function k(_e){var Ie=_e.children,Ue=_e.disabled,Pe=P.useRef(null),Te=P.useRef(null),se=P.useContext(v),He=P.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ht=P.isValidElement(Ie)&&Object(x.c)(Ie),it=ht?Ie.ref:null,at=P.useMemo(function(){return Object(x.a)(it,Pe)},[it,Pe]),ft=P.useRef(_e);ft.current=_e;var je=P.useCallback(function(Ye){var rt=ft.current,ot=rt.onResize,et=rt.data,Ve=Ye.getBoundingClientRect(),$e=Ve.width,bt=Ve.height,pt=Ye.offsetWidth,mt=Ye.offsetHeight,st=Math.floor($e),Ot=Math.floor(bt);if(He.current.width!==st||He.current.height!==Ot||He.current.offsetWidth!==pt||He.current.offsetHeight!==mt){var xt={width:st,height:Ot,offsetWidth:pt,offsetHeight:mt};He.current=xt;var vt=pt===Math.round($e)?$e:pt,Ne=mt===Math.round(bt)?bt:mt,Lt=Object(H.a)(Object(H.a)({},xt),{},{offsetWidth:vt,offsetHeight:Ne});se==null||se(Lt,Ye,et),ot&&Promise.resolve().then(function(){ot(Lt,Ye)})}},[]);return P.useEffect(function(){var Ye=Object(A.a)(Pe.current)||Object(A.a)(Te.current);return Ye&&!Ue&&l(Ye,je),function(){return d(Ye,je)}},[Pe.current,Ue]),P.createElement(E,{ref:Te},ht?P.cloneElement(Ie,{ref:at}):Ie)}var b="rc-observer-key";function h(_e){var Ie=_e.children,Ue=Object(I.a)(Ie);return Ue.map(function(Pe,Te){var se=(Pe==null?void 0:Pe.key)||"".concat(b,"-").concat(Te);return P.createElement(k,Object(ae.a)({},_e,{key:se}),Pe)})}h.Collection=m;var p=h,c=ie("bT9E"),o=ie("TSYQ"),S=ie.n(o),y=`
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important
`,T=["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={},z;function Y(_e){var Ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ue=_e.getAttribute("id")||_e.getAttribute("data-reactid")||_e.getAttribute("name");if(Ie&&N[Ue])return N[Ue];var Pe=window.getComputedStyle(_e),Te=Pe.getPropertyValue("box-sizing")||Pe.getPropertyValue("-moz-box-sizing")||Pe.getPropertyValue("-webkit-box-sizing"),se=parseFloat(Pe.getPropertyValue("padding-bottom"))+parseFloat(Pe.getPropertyValue("padding-top")),He=parseFloat(Pe.getPropertyValue("border-bottom-width"))+parseFloat(Pe.getPropertyValue("border-top-width")),ht=T.map(function(at){return"".concat(at,":").concat(Pe.getPropertyValue(at))}).join(";"),it={sizingStyle:ht,paddingSize:se,borderSize:He,boxSizing:Te};return Ie&&Ue&&(N[Ue]=it),it}function ee(_e){var Ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ue=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Pe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;z||(z=document.createElement("textarea"),z.setAttribute("tab-index","-1"),z.setAttribute("aria-hidden","true"),document.body.appendChild(z)),_e.getAttribute("wrap")?z.setAttribute("wrap",_e.getAttribute("wrap")):z.removeAttribute("wrap");var Te=Y(_e,Ie),se=Te.paddingSize,He=Te.borderSize,ht=Te.boxSizing,it=Te.sizingStyle;z.setAttribute("style","".concat(it,";").concat(y)),z.value=_e.value||_e.placeholder||"";var at=Number.MIN_SAFE_INTEGER,ft=Number.MAX_SAFE_INTEGER,je=z.scrollHeight,Ye;if(ht==="border-box"?je+=He:ht==="content-box"&&(je-=se),Ue!==null||Pe!==null){z.value=" ";var rt=z.scrollHeight-se;Ue!==null&&(at=rt*Ue,ht==="border-box"&&(at=at+se+He),je=Math.max(at,je)),Pe!==null&&(ft=rt*Pe,ht==="border-box"&&(ft=ft+se+He),Ye=je>ft?"":"hidden",je=Math.min(ft,je))}return{height:je,minHeight:at,maxHeight:ft,overflowY:Ye,resize:"none"}}var G=ie("Gytx"),W=ie.n(G),te;(function(_e){_e[_e.NONE=0]="NONE",_e[_e.RESIZING=1]="RESIZING",_e[_e.RESIZED=2]="RESIZED"})(te||(te={}));var ue=function(_e){Object(K.a)(Ue,_e);var Ie=Object(w.a)(Ue);function Ue(Pe){var Te;return Object(X.a)(this,Ue),Te=Ie.call(this,Pe),Te.nextFrameActionId=void 0,Te.resizeFrameId=void 0,Te.textArea=void 0,Te.saveTextArea=function(se){Te.textArea=se},Te.handleResize=function(se){var He=Te.state.resizeStatus,ht=Te.props,it=ht.autoSize,at=ht.onResize;if(He!==te.NONE)return;typeof at=="function"&&at(se),it&&Te.resizeOnNextFrame()},Te.resizeOnNextFrame=function(){cancelAnimationFrame(Te.nextFrameActionId),Te.nextFrameActionId=requestAnimationFrame(Te.resizeTextarea)},Te.resizeTextarea=function(){var se=Te.props.autoSize;if(!se||!Te.textArea)return;var He=se.minRows,ht=se.maxRows,it=ee(Te.textArea,!1,He,ht);Te.setState({textareaStyles:it,resizeStatus:te.RESIZING},function(){cancelAnimationFrame(Te.resizeFrameId),Te.resizeFrameId=requestAnimationFrame(function(){Te.setState({resizeStatus:te.RESIZED},function(){Te.resizeFrameId=requestAnimationFrame(function(){Te.setState({resizeStatus:te.NONE}),Te.fixFirefoxAutoScroll()})})})})},Te.renderTextArea=function(){var se=Te.props,He=se.prefixCls,ht=He===void 0?"rc-textarea":He,it=se.autoSize,at=se.onResize,ft=se.className,je=se.disabled,Ye=Te.state,rt=Ye.textareaStyles,ot=Ye.resizeStatus,et=Object(c.a)(Te.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ve=S()(ht,ft,Object(B.a)({},"".concat(ht,"-disabled"),je));"value"in et&&(et.value=et.value||"");var $e=Object(H.a)(Object(H.a)(Object(H.a)({},Te.props.style),rt),ot===te.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return P.createElement(p,{onResize:Te.handleResize,disabled:!(it||at)},P.createElement("textarea",Object(ae.a)({},et,{className:Ve,style:$e,ref:Te.saveTextArea})))},Te.state={textareaStyles:{},resizeStatus:te.NONE},Te}return Object(D.a)(Ue,[{key:"componentDidUpdate",value:function(Te){(Te.value!==this.props.value||!W()(Te.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 Te=this.textArea.selectionStart,se=this.textArea.selectionEnd;this.textArea.setSelectionRange(Te,se)}}catch(He){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Ue}(P.Component),be=ue,Oe=function(_e){Object(K.a)(Ue,_e);var Ie=Object(w.a)(Ue);function Ue(Pe){var Te;Object(X.a)(this,Ue),Te=Ie.call(this,Pe),Te.resizableTextArea=void 0,Te.focus=function(){Te.resizableTextArea.textArea.focus()},Te.saveTextArea=function(He){Te.resizableTextArea=He},Te.handleChange=function(He){var ht=Te.props.onChange;Te.setValue(He.target.value,function(){Te.resizableTextArea.resizeTextarea()}),ht&&ht(He)},Te.handleKeyDown=function(He){var ht=Te.props,it=ht.onPressEnter,at=ht.onKeyDown;He.keyCode===13&&it&&it(He),at&&at(He)};var se=typeof Pe.value=="undefined"||Pe.value===null?Pe.defaultValue:Pe.value;return Te.state={value:se},Te}return Object(D.a)(Ue,[{key:"setValue",value:function(Te,se){"value"in this.props||this.setState({value:Te},se)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return P.createElement(be,Object(ae.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(Te){return"value"in Te?{value:Te.value}:null}}]),Ue}(P.Component),Ke=gt.default=Oe},ZpRC:function(Ft,gt,ie){"use strict";function ae(x){return typeof x=="object"&&x!=null&&x.nodeType===1}function X(x,A){return(!A||x!=="hidden")&&x!=="visible"&&x!=="clip"}function D(x,A){if(x.clientHeight<x.scrollHeight||x.clientWidth<x.scrollWidth){var M=getComputedStyle(x,null);return X(M.overflowY,A)||X(M.overflowX,A)||function(O){var L=function(g){if(!g.ownerDocument||!g.ownerDocument.defaultView)return null;try{return g.ownerDocument.defaultView.frameElement}catch(u){return null}}(O);return!!L&&(L.clientHeight<O.scrollHeight||L.clientWidth<O.scrollWidth)}(x)}return!1}function K(x,A,M,O,L,g,u,a){return g<x&&u>A||g>x&&u<A?0:g<=x&&a<=M||u>=A&&a>=M?g-x-O:u>A&&a<M||g<x&&a>M?u-A+L:0}var w=function(x,A){var M=window,O=A.scrollMode,L=A.block,g=A.inline,u=A.boundary,a=A.skipOverflowHiddenElements,l=typeof u=="function"?u:function(rt){return rt!==u};if(!ae(x))throw new TypeError("Invalid target");for(var d=document.scrollingElement||document.documentElement,E=[],v=x;ae(v)&&l(v);){if((v=v.parentElement)===d){E.push(v);break}v!=null&&v===document.body&&D(v)&&!D(document.documentElement)||v!=null&&D(v,a)&&E.push(v)}for(var m=M.visualViewport?M.visualViewport.width:innerWidth,k=M.visualViewport?M.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,h=window.scrollY||pageYOffset,p=x.getBoundingClientRect(),c=p.height,o=p.width,S=p.top,y=p.right,T=p.bottom,N=p.left,z=L==="start"||L==="nearest"?S:L==="end"?T:S+c/2,Y=g==="center"?N+o/2:g==="end"?y:N,ee=[],G=0;G<E.length;G++){var W=E[G],te=W.getBoundingClientRect(),ue=te.height,be=te.width,Oe=te.top,Ke=te.right,_e=te.bottom,Ie=te.left;if(O==="if-needed"&&S>=0&&N>=0&&T<=k&&y<=m&&S>=Oe&&T<=_e&&N>=Ie&&y<=Ke)return ee;var Ue=getComputedStyle(W),Pe=parseInt(Ue.borderLeftWidth,10),Te=parseInt(Ue.borderTopWidth,10),se=parseInt(Ue.borderRightWidth,10),He=parseInt(Ue.borderBottomWidth,10),ht=0,it=0,at="offsetWidth"in W?W.offsetWidth-W.clientWidth-Pe-se:0,ft="offsetHeight"in W?W.offsetHeight-W.clientHeight-Te-He:0;if(d===W)ht=L==="start"?z:L==="end"?z-k:L==="nearest"?K(h,h+k,k,Te,He,h+z,h+z+c,c):z-k/2,it=g==="start"?Y:g==="center"?Y-m/2:g==="end"?Y-m:K(b,b+m,m,Pe,se,b+Y,b+Y+o,o),ht=Math.max(0,ht+h),it=Math.max(0,it+b);else{ht=L==="start"?z-Oe-Te:L==="end"?z-_e+He+ft:L==="nearest"?K(Oe,_e,ue,Te,He+ft,z,z+c,c):z-(Oe+ue/2)+ft/2,it=g==="start"?Y-Ie-Pe:g==="center"?Y-(Ie+be/2)+at/2:g==="end"?Y-Ke+se+at:K(Ie,Ke,be,Pe,se+at,Y,Y+o,o);var je=W.scrollLeft,Ye=W.scrollTop;z+=Ye-(ht=Math.max(0,Math.min(Ye+ht,W.scrollHeight-ue+ft))),Y+=je-(it=Math.max(0,Math.min(je+it,W.scrollWidth-be+at)))}ee.push({el:W,top:ht,left:it})}return ee};function P(x){return x===Object(x)&&Object.keys(x).length!==0}function H(x,A){A===void 0&&(A="auto");var M="scrollBehavior"in document.body.style;x.forEach(function(O){var L=O.el,g=O.top,u=O.left;L.scroll&&M?L.scroll({top:g,left:u,behavior:A}):(L.scrollTop=g,L.scrollLeft=u)})}function B(x){return x===!1?{block:"end",inline:"nearest"}:P(x)?x:{block:"start",inline:"nearest"}}function I(x,A){var M=!x.ownerDocument.documentElement.contains(x);if(P(A)&&typeof A.behavior=="function")return A.behavior(M?[]:w(x,A));if(M)return;var O=B(A);return H(w(x,O),O.behavior)}var _=gt.a=I},bT9E:function(Ft,gt,ie){"use strict";ie.d(gt,"a",function(){return X});var ae=ie("VTBJ");function X(D,K){var w=Object(ae.a)({},D);return Array.isArray(K)&&K.forEach(function(P){delete w[P]}),w}},c5Ni:function(Ft,gt,ie){},dejd:function(Ft,gt,ie){},dmUQ:function(Ft,gt,ie){"use strict";var ae=ie("Ff2n"),X=ie("rePB"),D=ie("1OyB"),K=ie("vuIU"),w=ie("Ji7U"),P=ie("md7G"),H=ie("foSv"),B=ie("q1tI"),I=ie.n(B),_=ie("TSYQ"),x=ie.n(_),A=ie("4IlW");function M(c,o){var S=Object.keys(c);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(c);o&&(y=y.filter(function(T){return Object.getOwnPropertyDescriptor(c,T).enumerable})),S.push.apply(S,y)}return S}function O(c){for(var o=1;o<arguments.length;o++){var S=arguments[o]!=null?arguments[o]:{};o%2?M(Object(S),!0).forEach(function(y){Object(X.a)(c,y,S[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(S)):M(Object(S)).forEach(function(y){Object.defineProperty(c,y,Object.getOwnPropertyDescriptor(S,y))})}return c}function L(c){var o=g();return function(){var y=Object(H.a)(c),T;if(o){var N=Object(H.a)(this).constructor;T=Reflect.construct(y,arguments,N)}else T=y.apply(this,arguments);return Object(P.a)(this,T)}}function g(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(c){return!1}}function u(){}function a(c){c.preventDefault()}var l=function(o){return o.replace(/[^\w.-]+/g,"")},d=200,E=600,v=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,m=function(o){return o!=null},k=function(o,S){return S===o||typeof S=="number"&&typeof o=="number"&&isNaN(S)&&isNaN(o)},b=function(c){Object(w.a)(S,c);var o=L(S);function S(y){var T;Object(D.a)(this,S),T=o.call(this,y),T.onKeyDown=function(Y){var ee=T.props,G=ee.onKeyDown,W=ee.onPressEnter;if(Y.keyCode===A.a.UP){var te=T.getRatio(Y);T.up(Y,te,null),T.stop()}else if(Y.keyCode===A.a.DOWN){var ue=T.getRatio(Y);T.down(Y,ue,null),T.stop()}else Y.keyCode===A.a.ENTER&&W&&W(Y);if(T.recordCursorPosition(),T.lastKeyCode=Y.keyCode,G){for(var be=arguments.length,Oe=new Array(be>1?be-1:0),Ke=1;Ke<be;Ke++)Oe[Ke-1]=arguments[Ke];G.apply(void 0,[Y].concat(Oe))}},T.onKeyUp=function(Y){var ee=T.props.onKeyUp;if(T.stop(),T.recordCursorPosition(),ee){for(var G=arguments.length,W=new Array(G>1?G-1:0),te=1;te<G;te++)W[te-1]=arguments[te];ee.apply(void 0,[Y].concat(W))}},T.onChange=function(Y){var ee=T.props.onChange;T.state.focused&&(T.inputting=!0),T.rawInput=T.props.parser(T.getValueFromEvent(Y)),T.setState({inputValue:T.rawInput}),ee(T.toNumber(T.rawInput))},T.onMouseUp=function(){var Y=T.props.onMouseUp;T.recordCursorPosition(),Y&&Y.apply(void 0,arguments)},T.onFocus=function(){var Y;T.setState({focused:!0}),(Y=T.props).onFocus.apply(Y,arguments)},T.onBlur=function(){var Y=T.props.onBlur;T.inputting=!1,T.setState({focused:!1});var ee=T.getCurrentValidValue(T.state.inputValue),G=T.setValue(ee,u);if(Y){var W=T.input.value,te=T.getInputDisplayValue({focus:!1,value:G});T.input.value=te&&Number(te),Y.apply(void 0,arguments),T.input.value=W}},T.getRatio=function(Y){var ee=1;return Y.metaKey||Y.ctrlKey?ee=.1:Y.shiftKey&&(ee=10),ee},T.getFullNum=function(Y){return isNaN(Y)?Y:/e/i.test(String(Y))?Number(Y).toFixed(18).replace(/\.?0+$/,""):Y},T.getPrecision=function(Y){if(m(T.props.precision))return T.props.precision;var ee=String(Y);if(ee.indexOf("e-")>=0)return parseInt(ee.slice(ee.indexOf("e-")+2),10);var G=0;return ee.indexOf(".")>=0&&(G=ee.length-ee.indexOf(".")-1),G},T.getInputDisplayValue=function(Y){var ee=Y||T.state,G=ee.focused,W=ee.inputValue,te=ee.value,ue;G?ue=W:ue=T.toPrecisionAsStep(te),ue==null&&(ue="");var be=T.formatWrapper(ue);return m(T.props.decimalSeparator)&&(be=be.toString().replace(".",T.props.decimalSeparator)),be},T.recordCursorPosition=function(){try{T.cursorStart=T.input.selectionStart,T.cursorEnd=T.input.selectionEnd,T.currentValue=T.input.value,T.cursorBefore=T.input.value.substring(0,T.cursorStart),T.cursorAfter=T.input.value.substring(T.cursorEnd)}catch(Y){}},T.restoreByAfter=function(Y){if(Y===void 0)return!1;var ee=T.input.value,G=ee.lastIndexOf(Y);if(G===-1)return!1;var W=T.cursorBefore.length;return T.lastKeyCode===A.a.DELETE&&T.cursorBefore.charAt(W-1)===Y[0]?(T.fixCaret(W,W),!0):G+Y.length===ee.length?(T.fixCaret(G,G),!0):!1},T.partRestoreByAfter=function(Y){return Y===void 0?!1:Array.prototype.some.call(Y,function(ee,G){var W=Y.substring(G);return T.restoreByAfter(W)})},T.isNotCompleteNumber=function(Y){return isNaN(Y)||Y===""||Y===null||Y&&Y.toString().indexOf(".")===Y.toString().length-1},T.stop=function(){T.autoStepTimer&&clearTimeout(T.autoStepTimer)},T.down=function(Y,ee,G){T.pressingUpOrDown=!0,T.step("down",Y,ee,G)},T.up=function(Y,ee,G){T.pressingUpOrDown=!0,T.step("up",Y,ee,G)},T.saveInput=function(Y){T.input=Y};var N=y.value;N===void 0&&(N=y.defaultValue),T.state={focused:y.autoFocus};var z=T.getValidValue(T.toNumber(N));return T.state=O(O({},T.state),{},{inputValue:T.toPrecisionAsStep(z),value:z}),T}return Object(K.a)(S,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(T){var N=this.props,z=N.value,Y=N.onChange,ee=N.max,G=N.min,W=this.state.focused;if(T){if(!k(T.value,z)||!k(T.max,ee)||!k(T.min,G)){var te=W?z:this.getValidValue(z),ue;this.pressingUpOrDown?ue=te:this.inputting?ue=this.rawInput:ue=this.toPrecisionAsStep(te),this.setState({value:te,inputValue:ue})}var be="value"in this.props?z:this.state.value;"max"in this.props&&T.max!==ee&&typeof be=="number"&&be>ee&&Y&&Y(ee),"min"in this.props&&T.min!==G&&typeof be=="number"&&be<G&&Y&&Y(G)}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===A.a.BACKSPACE?Oe=this.cursorStart-1:this.lastKeyCode===A.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 A.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case A.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ke){}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(T){var N=T;return N===""?N="":this.isNotCompleteNumber(parseFloat(N))?N=this.state.value:N=this.getValidValue(N),this.toNumber(N)}},{key:"getValueFromEvent",value:function(T){var N=T.target.value.trim().replace(/。/g,".");return m(this.props.decimalSeparator)&&(N=N.replace(this.props.decimalSeparator,".")),N}},{key:"getValidValue",value:function(T){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,Y=parseFloat(T);return isNaN(Y)?T:(Y<N&&(Y=N),Y>z&&(Y=z),Y)}},{key:"setValue",value:function(T,N){var z=this.props.precision,Y=this.isNotCompleteNumber(parseFloat(T))?null:parseFloat(T),ee=this.state.value,G=ee===void 0?null:ee,W=this.state.inputValue,te=W===void 0?null:W,ue=typeof Y=="number"?Y.toFixed(z):"".concat(Y),be=Y!==G||ue!=="".concat(te);return"value"in this.props?(te=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:te},N)):this.setState({value:Y,inputValue:this.toPrecisionAsStep(T)},N),be&&this.props.onChange(Y),Y}},{key:"getMaxPrecision",value:function(T){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,z=this.props,Y=z.precision,ee=z.step;if(m(Y))return Y;var G=this.getPrecision(N),W=this.getPrecision(ee),te=this.getPrecision(T);return T?Math.max(te,G+W):G+W}},{key:"getPrecisionFactor",value:function(T){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,z=this.getMaxPrecision(T,N);return Math.pow(10,z)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(T){return this.props.formatter?this.props.formatter(T):T}},{key:"toPrecisionAsStep",value:function(T){if(this.isNotCompleteNumber(T)||T==="")return T;var N=Math.abs(this.getMaxPrecision(T));return isNaN(N)?T.toString():Number(T).toFixed(N)}},{key:"toNumber",value:function(T){var N=this.props.precision,z=this.state.focused,Y=T&&T.length>16&&z;return this.isNotCompleteNumber(T)||Y?T:m(N)?Math.round(T*Math.pow(10,N))/Math.pow(10,N):Number(T)}},{key:"upStep",value:function(T,N){var z=this.props.step,Y=this.getPrecisionFactor(T,N),ee=Math.abs(this.getMaxPrecision(T,N)),G=((Y*T+Y*z*N)/Y).toFixed(ee);return this.toNumber(G)}},{key:"downStep",value:function(T,N){var z=this.props.step,Y=this.getPrecisionFactor(T,N),ee=Math.abs(this.getMaxPrecision(T,N)),G=((Y*T-Y*z*N)/Y).toFixed(ee);return this.toNumber(G)}},{key:"step",value:function(T,N){var z=this,Y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,ee=arguments.length>3?arguments[3]:void 0;this.stop(),N&&(N.persist(),N.preventDefault());var G=this.props;if(G.disabled)return;var W=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(W))return;var te=this["".concat(T,"Step")](W,Y),ue=te>G.max||te<G.min;if(te>G.max?te=G.max:te<G.min&&(te=G.min),this.setValue(te,null),this.setState({focused:!0},function(){z.pressingUpOrDown=!1}),ue)return;this.autoStepTimer=setTimeout(function(){z[T](N,Y,!0)},ee?d:E)}},{key:"fixCaret",value:function(T,N){if(T===void 0||N===void 0||!this.input||!this.input.value)return;try{var z=this.input.selectionStart,Y=this.input.selectionEnd;(T!==z||N!==Y)&&this.input.setSelectionRange(T,N)}catch(ee){}}},{key:"render",value:function(){var T,N=this.props,z=N.prefixCls,Y=N.disabled,ee=N.readOnly,G=N.useTouch,W=N.autoComplete,te=N.upHandler,ue=N.downHandler,be=N.className,Oe=N.max,Ke=N.min,_e=N.style,Ie=N.title,Ue=N.onMouseEnter,Pe=N.onMouseLeave,Te=N.onMouseOver,se=N.onMouseOut,He=N.required,ht=N.onClick,it=N.tabIndex,at=N.type,ft=N.placeholder,je=N.id,Ye=N.inputMode,rt=N.pattern,ot=N.step,et=N.maxLength,Ve=N.autoFocus,$e=N.name,bt=N.onPaste,pt=N.onInput,mt=Object(ae.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"]),st=this.state,Ot=st.value,xt=st.focused,vt=x()(z,(T={},Object(X.a)(T,be,!!be),Object(X.a)(T,"".concat(z,"-disabled"),Y),Object(X.a)(T,"".concat(z,"-focused"),xt),T)),Ne={};Object.keys(mt).forEach(function(ge){(ge.substr(0,5)==="data-"||ge.substr(0,5)==="aria-"||ge==="role")&&(Ne[ge]=mt[ge])});var Lt=!ee&&!Y,Et=this.getInputDisplayValue(null),Fe=(Ot||Ot===0)&&(isNaN(Ot)||Number(Ot)>=Oe),Ze=(Ot||Ot===0)&&(isNaN(Ot)||Number(Ot)<=Ke),we=Fe||Y||ee,ye=Ze||Y||ee,Ee=x()("".concat(z,"-handler"),"".concat(z,"-handler-up"),Object(X.a)({},"".concat(z,"-handler-up-disabled"),we)),re=x()("".concat(z,"-handler"),"".concat(z,"-handler-down"),Object(X.a)({},"".concat(z,"-handler-down-disabled"),ye)),ne=G?{onTouchStart:we?u:this.up,onTouchEnd:this.stop}:{onMouseDown:we?u:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},de=G?{onTouchStart:ye?u:this.down,onTouchEnd:this.stop}:{onMouseDown:ye?u:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return I.a.createElement("div",{className:vt,style:_e,title:Ie,onMouseEnter:Ue,onMouseLeave:Pe,onMouseOver:Te,onMouseOut:se,onFocus:function(){return null},onBlur:function(){return null}},I.a.createElement("div",{className:"".concat(z,"-handler-wrap")},I.a.createElement("span",Object.assign({unselectable:"on"},ne,{role:"button","aria-label":"Increase Value","aria-disabled":we,className:Ee}),te||I.a.createElement("span",{unselectable:"on",className:"".concat(z,"-handler-up-inner"),onClick:a})),I.a.createElement("span",Object.assign({unselectable:"on"},de,{role:"button","aria-label":"Decrease Value","aria-disabled":ye,className:re}),ue||I.a.createElement("span",{unselectable:"on",className:"".concat(z,"-handler-down-inner"),onClick:a}))),I.a.createElement("div",{className:"".concat(z,"-input-wrap")},I.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ke,"aria-valuemax":Oe,"aria-valuenow":Ot,required:He,type:at,placeholder:ft,onPaste:bt,onClick:ht,onMouseUp:this.onMouseUp,className:"".concat(z,"-input"),tabIndex:it,autoComplete:W,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Lt?this.onKeyDown:u,onKeyUp:Lt?this.onKeyUp:u,autoFocus:Ve,maxLength:et,readOnly:ee,disabled:Y,max:Oe,min:Ke,step:ot,name:$e,title:Ie,id:je,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Et),pattern:rt,inputMode:Ye,onInput:pt},Ne))))}}]),S}(I.a.Component);b.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:v,min:-v,step:1,style:{},onChange:u,onKeyDown:u,onPressEnter:u,onFocus:u,onBlur:u,parser:l,required:!1,autoComplete:"off"};var h=b,p=gt.a=h},k3GJ:function(Ft,gt,ie){"use strict";ie.d(gt,"a",function(){return bo});var ae=ie("rePB"),X=ie("ODXe"),D=ie("Ff2n"),K=ie("VTBJ"),w=ie("q1tI"),P=ie("TSYQ"),H=ie.n(P),B=ie("Zm9Q"),I=ie("6cGi"),_=ie("KQm4"),x=ie("xEkU"),A=ie.n(x),M=ie("t23M");function O(le){var xe=Object(w.useRef)(),Ae=Object(w.useRef)(!1);function ce(){for(var Z=arguments.length,oe=new Array(Z),q=0;q<Z;q++)oe[q]=arguments[q];Ae.current||(A.a.cancel(xe.current),xe.current=A()(function(){le.apply(void 0,oe)}))}return Object(w.useEffect)(function(){return function(){Ae.current=!0,A.a.cancel(xe.current)}},[]),ce}function L(le){var xe=Object(w.useRef)([]),Ae=Object(w.useState)({}),ce=Object(X.a)(Ae,2),Z=ce[1],oe=Object(w.useRef)(typeof le=="function"?le():le),q=O(function(){var pe=oe.current;xe.current.forEach(function(Le){pe=Le(pe)}),xe.current=[],oe.current=pe,Z({})});function fe(pe){xe.current.push(pe),q()}return[oe.current,fe]}var g=ie("4IlW");function u(le,xe){var Ae,ce=le.prefixCls,Z=le.id,oe=le.active,q=le.rtl,fe=le.tab,pe=fe.key,Le=fe.tab,Ce=fe.disabled,De=fe.closeIcon,Be=le.tabBarGutter,tt=le.tabPosition,qe=le.closable,ut=le.renderWrapper,Wt=le.removeAriaLabel,Zt=le.editable,Xt=le.onClick,Yt=le.onRemove,Jt=le.onFocus,Qt="".concat(ce,"-tab");w.useEffect(function(){return Yt},[]);var $t={};tt==="top"||tt==="bottom"?$t[q?"marginLeft":"marginRight"]=Be:$t.marginBottom=Be;var dr=Zt&&qe!==!1&&!Ce;function ar(Bt){if(Ce)return;Xt(Bt)}function Nr(Bt){Bt.preventDefault(),Bt.stopPropagation(),Zt.onEdit("remove",{key:pe,event:Bt})}var or=w.createElement("div",{key:pe,ref:xe,className:H()(Qt,(Ae={},Object(ae.a)(Ae,"".concat(Qt,"-with-remove"),dr),Object(ae.a)(Ae,"".concat(Qt,"-active"),oe),Object(ae.a)(Ae,"".concat(Qt,"-disabled"),Ce),Ae)),style:$t,onClick:ar},w.createElement("div",{role:"tab","aria-selected":oe,id:Z&&"".concat(Z,"-tab-").concat(pe),className:"".concat(Qt,"-btn"),"aria-controls":Z&&"".concat(Z,"-panel-").concat(pe),"aria-disabled":Ce,tabIndex:Ce?null:0,onClick:function(Nt){Nt.stopPropagation(),ar(Nt)},onKeyDown:function(Nt){[g.a.SPACE,g.a.ENTER].includes(Nt.which)&&(Nt.preventDefault(),ar(Nt))},onFocus:Jt},Le),dr&&w.createElement("button",{type:"button","aria-label":Wt||"remove",tabIndex:0,className:"".concat(Qt,"-remove"),onClick:function(Nt){Nt.stopPropagation(),Nr(Nt)}},De||Zt.removeIcon||"\xD7"));return ut&&(or=ut(or)),or}var a=w.forwardRef(u),l={width:0,height:0,left:0,top:0};function d(le,xe,Ae){return Object(w.useMemo)(function(){for(var ce,Z=new Map,oe=xe.get((ce=le[0])===null||ce===void 0?void 0:ce.key)||l,q=oe.left+oe.width,fe=0;fe<le.length;fe+=1){var pe=le[fe].key,Le=xe.get(pe);if(!Le){var Ce;Le=xe.get((Ce=le[fe-1])===null||Ce===void 0?void 0:Ce.key)||l}var De=Z.get(pe)||Object(K.a)({},Le);De.right=q-De.left-De.width,Z.set(pe,De)}return Z},[le.map(function(ce){return ce.key}).join("_"),xe,Ae])}var E={width:0,height:0,left:0,top:0,right:0};function v(le,xe,Ae,ce,Z){var oe=Z.tabs,q=Z.tabPosition,fe=Z.rtl,pe,Le,Ce;["top","bottom"].includes(q)?(pe="width",Le=fe?"right":"left",Ce=Math.abs(xe.left)):(pe="height",Le="top",Ce=-xe.top);var De=xe[pe],Be=Ae[pe],tt=ce[pe],qe=De;return Be+tt>De&&(qe=De-tt),Object(w.useMemo)(function(){if(!oe.length)return[0,0];for(var ut=oe.length,Wt=ut,Zt=0;Zt<ut;Zt+=1){var Xt=le.get(oe[Zt].key)||E;if(Xt[Le]+Xt[pe]>Ce+qe){Wt=Zt-1;break}}for(var Yt=0,Jt=ut-1;Jt>=0;Jt-=1){var Qt=le.get(oe[Jt].key)||E;if(Qt[Le]<Ce){Yt=Jt+1;break}}return[Yt,Wt]},[le,Ce,qe,q,oe.map(function(ut){return ut.key}).join("_"),fe])}var m=ie("wx14"),k=ie("1OyB"),b=ie("vuIU"),h=ie("JX7q"),p=ie("Ji7U"),c=ie("LK+K"),o=ie("I8Z2"),S=ie("bT9E"),y=ie("2GS6"),T=ie("Gytx"),N=ie.n(T),z=ie("U8pU"),Y=/iPhone/i,ee=/iPod/i,G=/iPad/i,W=/\bAndroid(?:.+)Mobile\b/i,te=/Android/i,ue=/\bAndroid(?:.+)SD4930UR\b/i,be=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,Oe=/Windows Phone/i,Ke=/\bWindows(?:.+)ARM\b/i,_e=/BlackBerry/i,Ie=/BB10/i,Ue=/Opera Mini/i,Pe=/\b(CriOS|Chrome)(?:.+)Mobile/i,Te=/Mobile(?:.+)Firefox\b/i;function se(le,xe){return le.test(xe)}function He(le){var xe=le||(typeof navigator!="undefined"?navigator.userAgent:""),Ae=(xe||"").split("[FBAN");if(typeof Ae[1]!="undefined"){var ce=Ae,Z=Object(X.a)(ce,1);xe=Z[0]}if(Ae=xe.split("Twitter"),typeof Ae[1]!="undefined"){var oe=Ae,q=Object(X.a)(oe,1);xe=q[0]}var fe={apple:{phone:se(Y,xe)&&!se(Oe,xe),ipod:se(ee,xe),tablet:!se(Y,xe)&&se(G,xe)&&!se(Oe,xe),device:(se(Y,xe)||se(ee,xe)||se(G,xe))&&!se(Oe,xe)},amazon:{phone:se(ue,xe),tablet:!se(ue,xe)&&se(be,xe),device:se(ue,xe)||se(be,xe)},android:{phone:!se(Oe,xe)&&se(ue,xe)||!se(Oe,xe)&&se(W,xe),tablet:!se(Oe,xe)&&!se(ue,xe)&&!se(W,xe)&&(se(be,xe)||se(te,xe)),device:!se(Oe,xe)&&(se(ue,xe)||se(be,xe)||se(W,xe)||se(te,xe))||se(/\bokhttp\b/i,xe)},windows:{phone:se(Oe,xe),tablet:se(Ke,xe),device:se(Oe,xe)||se(Ke,xe)},other:{blackberry:se(_e,xe),blackberry10:se(Ie,xe),opera:se(Ue,xe),firefox:se(Te,xe),chrome:se(Pe,xe),device:se(_e,xe)||se(Ie,xe)||se(Ue,xe)||se(Te,xe)||se(Pe,xe)},any:null,phone:null,tablet:null};return fe.any=fe.apple.device||fe.android.device||fe.windows.device||fe.other.device,fe.phone=fe.apple.phone||fe.android.phone||fe.windows.phone,fe.tablet=fe.apple.tablet||fe.android.tablet||fe.windows.tablet,fe}var ht=Object(K.a)(Object(K.a)({},He()),{},{isMobile:He}),it=ht;function at(){}function ft(le,xe,Ae){var ce=xe||"";return le.key||"".concat(ce,"item_").concat(Ae)}function je(le){return"".concat(le,"-menu-")}function Ye(le,xe){var Ae=-1;w.Children.forEach(le,function(ce){Ae+=1,ce&&ce.type&&ce.type.isMenuItemGroup?w.Children.forEach(ce.props.children,function(Z){Ae+=1,xe(Z,Ae)}):xe(ce,Ae)})}function rt(le,xe,Ae){if(!le||Ae.find)return;w.Children.forEach(le,function(ce){if(ce){var Z=ce.type;if(!Z||!(Z.isSubMenu||Z.isMenuItem||Z.isMenuItemGroup))return;xe.indexOf(ce.key)!==-1?Ae.find=!0:ce.props.children&&rt(ce.props.children,xe,Ae)}})}var ot=["defaultSelectedKeys","selectedKeys","defaultOpenKeys","openKeys","mode","getPopupContainer","onSelect","onDeselect","onDestroy","openTransitionName","openAnimation","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","triggerSubMenuAction","level","selectable","multiple","onOpenChange","visible","focusable","defaultActiveFirst","prefixCls","inlineIndent","parentMenu","title","rootPrefixCls","eventKey","active","onItemHover","onTitleMouseEnter","onTitleMouseLeave","onTitleClick","popupAlign","popupOffset","isOpen","renderMenuItem","manualRef","subMenuKey","disabled","index","isSelected","store","activeKey","builtinPlacements","overflowedIndicator","motion","attribute","value","popupClassName","inlineCollapsed","menu","theme","itemIcon","expandIcon"],et=function(xe){var Ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ce=xe&&typeof xe.getBoundingClientRect=="function"&&xe.getBoundingClientRect().width;if(ce){if(Ae){var Z=getComputedStyle(xe),oe=Z.marginLeft,q=Z.marginRight;ce+=+oe.replace("px","")+ +q.replace("px","")}ce=+ce.toFixed(6)}return ce||0},Ve=function(xe,Ae,ce){xe&&Object(z.a)(xe.style)==="object"&&(xe.style[Ae]=ce)},$e=function(){return it.any},bt=ie("bdgK"),pt=ie("i8i4"),mt=ie.n(pt),st=ie("wgJM"),Ot=ie("l4aY"),xt=ie("m+aA"),vt=ie("c+Xe"),Ne=ie("zT1h"),Lt=ie("QC+M");function Et(le,xe,Ae){return Ae?le[0]===xe[0]:le[0]===xe[0]&&le[1]===xe[1]}function Fe(le,xe,Ae){var ce=le[xe]||{};return Object(K.a)(Object(K.a)({},ce),Ae)}function Ze(le,xe,Ae,ce){for(var Z=Ae.points,oe=Object.keys(le),q=0;q<oe.length;q+=1){var fe=oe[q];if(Et(le[fe].points,Z,ce))return"".concat(xe,"-placement-").concat(fe)}return""}var we=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var le=navigator.userAgent||navigator.vendor||window.opera;return!!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(le)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(le==null?void 0:le.substr(0,4)))},ye=ie("MNnm");function Ee(le,xe){var Ae={};return Ae[le.toLowerCase()]=xe.toLowerCase(),Ae["Webkit".concat(le)]="webkit".concat(xe),Ae["Moz".concat(le)]="moz".concat(xe),Ae["ms".concat(le)]="MS".concat(xe),Ae["O".concat(le)]="o".concat(xe.toLowerCase()),Ae}function re(le,xe){var Ae={animationend:Ee("Animation","AnimationEnd"),transitionend:Ee("Transition","TransitionEnd")};return le&&("AnimationEvent"in xe||delete Ae.animationend.animation,"TransitionEvent"in xe||delete Ae.transitionend.transition),Ae}var ne=re(Object(ye.a)(),typeof window!="undefined"?window:{}),de={};if(Object(ye.a)()){var ge=document.createElement("div");de=ge.style}var Se={};function Re(le){if(Se[le])return Se[le];var xe=ne[le];if(xe)for(var Ae=Object.keys(xe),ce=Ae.length,Z=0;Z<ce;Z+=1){var oe=Ae[Z];if(Object.prototype.hasOwnProperty.call(xe,oe)&&oe in de)return Se[le]=xe[oe],Se[le]}return""}var Ge=Re("animationend"),yt=Re("transitionend"),_t=!!(Ge&&yt),kt=Ge||"animationend",Gt=yt||"transitionend";function Kt(le,xe){if(!le)return null;if(Object(z.a)(le)==="object"){var Ae=xe.replace(/-\w/g,function(ce){return ce[1].toUpperCase()});return le[Ae]}return"".concat(le,"-").concat(xe)}var Ct="none",pr="appear",rr="enter",Ir="leave",Pr="none",Vt="prepare",an="start",En="active",It="end";function An(le){var xe=Object(w.useRef)(!1),Ae=Object(w.useState)(le),ce=Object(X.a)(Ae,2),Z=ce[0],oe=ce[1];function q(fe){xe.current||oe(fe)}return Object(w.useEffect)(function(){return function(){xe.current=!0}},[]),[Z,q]}var on=Object(ye.a)()?w.useLayoutEffect:w.useEffect,sn=on,Un=function(){var le=w.useRef(null);function xe(){st.a.cancel(le.current)}function Ae(ce){var Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;xe();var oe=Object(st.a)(function(){Z<=1?ce({isCanceled:function(){return oe!==le.current}}):Ae(ce,Z-1)});le.current=oe}return w.useEffect(function(){return function(){xe()}},[]),[Ae,xe]},ci=[Vt,an,En,It],Qn=!1,mr=!0;function wt(le){return le===En||le===It}var Vn=function(le,xe){var Ae=w.useState(Pr),ce=Object(X.a)(Ae,2),Z=ce[0],oe=ce[1],q=Un(),fe=Object(X.a)(q,2),pe=fe[0],Le=fe[1];function Ce(){oe(Vt)}return sn(function(){if(Z!==Pr&&Z!==It){var De=ci.indexOf(Z),Be=ci[De+1],tt=xe(Z);tt===Qn?oe(Be):pe(function(qe){function ut(){if(qe.isCanceled())return;oe(Be)}tt===!0?ut():Promise.resolve(tt).then(ut)})}},[le,Z]),w.useEffect(function(){return function(){Le()}},[]),[Ce,Z]},oi=function(le){var xe=Object(w.useRef)(),Ae=Object(w.useRef)(le);Ae.current=le;var ce=w.useCallback(function(q){Ae.current(q)},[]);function Z(q){q&&(q.removeEventListener(Gt,ce),q.removeEventListener(kt,ce))}function oe(q){xe.current&&xe.current!==q&&Z(xe.current),q&&q!==xe.current&&(q.addEventListener(Gt,ce),q.addEventListener(kt,ce),xe.current=q)}return w.useEffect(function(){return function(){Z(xe.current)}},[]),[oe,Z]};function mn(le,xe,Ae,ce){var Z=ce.motionEnter,oe=Z===void 0?!0:Z,q=ce.motionAppear,fe=q===void 0?!0:q,pe=ce.motionLeave,Le=pe===void 0?!0:pe,Ce=ce.motionDeadline,De=ce.motionLeaveImmediately,Be=ce.onAppearPrepare,tt=ce.onEnterPrepare,qe=ce.onLeavePrepare,ut=ce.onAppearStart,Wt=ce.onEnterStart,Zt=ce.onLeaveStart,Xt=ce.onAppearActive,Yt=ce.onEnterActive,Jt=ce.onLeaveActive,Qt=ce.onAppearEnd,$t=ce.onEnterEnd,dr=ce.onLeaveEnd,ar=ce.onVisibleChanged,Nr=An(),or=Object(X.a)(Nr,2),Bt=or[0],Nt=or[1],sr=An(Ct),cr=Object(X.a)(sr,2),Dt=cr[0],fr=cr[1],Ur=An(null),yr=Object(X.a)(Ur,2),Lr=yr[0],wr=yr[1],Yr=Object(w.useRef)(!1),un=Object(w.useRef)(null),jr=Object(w.useRef)(!1),On=Object(w.useRef)(null);function ti(){var Mr=Ae();return Mr||On.current}var _n=Object(w.useRef)(!1);function dn(Mr){var Tr=ti();if(Mr&&!Mr.deadline&&Mr.target!==Tr)return;var cn;Dt===pr&&_n.current?cn=Qt==null?void 0:Qt(Tr,Mr):Dt===rr&&_n.current?cn=$t==null?void 0:$t(Tr,Mr):Dt===Ir&&_n.current&&(cn=dr==null?void 0:dr(Tr,Mr)),cn!==!1&&!jr.current&&(fr(Ct),wr(null))}var _r=oi(dn),Or=Object(X.a)(_r,1),Wr=Or[0],Br=w.useMemo(function(){var Mr,Tr,cn;switch(Dt){case"appear":return Mr={},Object(ae.a)(Mr,Vt,Be),Object(ae.a)(Mr,an,ut),Object(ae.a)(Mr,En,Xt),Mr;case"enter":return Tr={},Object(ae.a)(Tr,Vt,tt),Object(ae.a)(Tr,an,Wt),Object(ae.a)(Tr,En,Yt),Tr;case"leave":return cn={},Object(ae.a)(cn,Vt,qe),Object(ae.a)(cn,an,Zt),Object(ae.a)(cn,En,Jt),cn;default:return{}}},[Dt]),ri=Vn(Dt,function(Mr){if(Mr===Vt){var Tr=Br[Vt];return Tr?Tr(ti()):Qn}if(Ar in Br){var cn;wr(((cn=Br[Ar])===null||cn===void 0?void 0:cn.call(Br,ti(),null))||null)}return Ar===En&&(Wr(ti()),Ce>0&&(clearTimeout(un.current),un.current=setTimeout(function(){dn({deadline:!0})},Ce))),mr}),Ai=Object(X.a)(ri,2),Li=Ai[0],Ar=Ai[1],di=wt(Ar);_n.current=di,sn(function(){Nt(xe);var Mr=Yr.current;if(Yr.current=!0,!le)return;var Tr;!Mr&&xe&&fe&&(Tr=pr),Mr&&xe&&oe&&(Tr=rr),(Mr&&!xe&&Le||!Mr&&De&&!xe&&Le)&&(Tr=Ir),Tr&&(fr(Tr),Li())},[xe]),Object(w.useEffect)(function(){(Dt===pr&&!fe||Dt===rr&&!oe||Dt===Ir&&!Le)&&fr(Ct)},[fe,oe,Le]),Object(w.useEffect)(function(){return function(){clearTimeout(un.current),jr.current=!0}},[]),Object(w.useEffect)(function(){Bt!==void 0&&Dt===Ct&&(ar==null||ar(Bt))},[Bt,Dt]);var Oi=Lr;return Br[Vt]&&Ar===an&&(Oi=Object(K.a)({transition:"none"},Oi)),[Dt,Ar,Oi,Bt!=null?Bt:xe]}var nr=function(le){Object(p.a)(Ae,le);var xe=Object(c.a)(Ae);function Ae(){return Object(k.a)(this,Ae),xe.apply(this,arguments)}return Object(b.a)(Ae,[{key:"render",value:function(){return this.props.children}}]),Ae}(w.Component),Bn=nr;function Zn(le){var xe=le;Object(z.a)(le)==="object"&&(xe=le.transitionSupport);function Ae(Z){return!!(Z.motionName&&xe)}var ce=w.forwardRef(function(Z,oe){var q=Z.visible,fe=q===void 0?!0:q,pe=Z.removeOnLeave,Le=pe===void 0?!0:pe,Ce=Z.forceRender,De=Z.children,Be=Z.motionName,tt=Z.leavedClassName,qe=Z.eventProps,ut=Ae(Z),Wt=Object(w.useRef)(),Zt=Object(w.useRef)();function Xt(){try{return Object(xt.a)(Wt.current||Zt.current)}catch(fr){return null}}var Yt=mn(ut,fe,Xt,Z),Jt=Object(X.a)(Yt,4),Qt=Jt[0],$t=Jt[1],dr=Jt[2],ar=Jt[3],Nr=w.useRef(ar);ar&&(Nr.current=!0);var or=Object(w.useRef)(oe);or.current=oe;var Bt=w.useCallback(function(fr){Wt.current=fr,Object(vt.b)(or.current,fr)},[]),Nt,sr=Object(K.a)(Object(K.a)({},qe),{},{visible:fe});if(!De)Nt=null;else if(Qt===Ct||!Ae(Z))ar?Nt=De(Object(K.a)({},sr),Bt):!Le&&Nr.current?Nt=De(Object(K.a)(Object(K.a)({},sr),{},{className:tt}),Bt):Ce?Nt=De(Object(K.a)(Object(K.a)({},sr),{},{style:{display:"none"}}),Bt):Nt=null;else{var cr,Dt;$t===Vt?Dt="prepare":wt($t)?Dt="active":$t===an&&(Dt="start"),Nt=De(Object(K.a)(Object(K.a)({},sr),{},{className:H()(Kt(Be,Qt),(cr={},Object(ae.a)(cr,Kt(Be,"".concat(Qt,"-").concat(Dt)),Dt),Object(ae.a)(cr,Be,typeof Be=="string"),cr)),style:dr}),Bt)}return w.createElement(Bn,{ref:Zt},Nt)});return ce.displayName="CSSMotion",ce}var hi=Zn(_t),Je="add",jt="keep",si="remove",fi="removed";function Si(le){var xe;return le&&Object(z.a)(le)==="object"&&"key"in le?xe=le:xe={key:le},Object(K.a)(Object(K.a)({},xe),{},{key:String(xe.key)})}function li(){var le=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return le.map(Si)}function j(){var le=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],Ae=[],ce=0,Z=xe.length,oe=li(le),q=li(xe);oe.forEach(function(Le){for(var Ce=!1,De=ce;De<Z;De+=1){var Be=q[De];if(Be.key===Le.key){ce<De&&(Ae=Ae.concat(q.slice(ce,De).map(function(tt){return Object(K.a)(Object(K.a)({},tt),{},{status:Je})})),ce=De),Ae.push(Object(K.a)(Object(K.a)({},Be),{},{status:jt})),ce+=1,Ce=!0;break}}Ce||Ae.push(Object(K.a)(Object(K.a)({},Le),{},{status:si}))}),ce<Z&&(Ae=Ae.concat(q.slice(ce).map(function(Le){return Object(K.a)(Object(K.a)({},Le),{},{status:Je})})));var fe={};Ae.forEach(function(Le){var Ce=Le.key;fe[Ce]=(fe[Ce]||0)+1});var pe=Object.keys(fe).filter(function(Le){return fe[Le]>1});return pe.forEach(function(Le){Ae=Ae.filter(function(Ce){var De=Ce.key,Be=Ce.status;return De!==Le||Be!==si}),Ae.forEach(function(Ce){Ce.key===Le&&(Ce.status=jt)})}),Ae}var s=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function f(le){var xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:hi,Ae=function(ce){Object(p.a)(oe,ce);var Z=Object(c.a)(oe);function oe(){var q;return Object(k.a)(this,oe),q=Z.apply(this,arguments),q.state={keyEntities:[]},q.removeKey=function(fe){q.setState(function(pe){var Le=pe.keyEntities;return{keyEntities:Le.map(function(Ce){return Ce.key!==fe?Ce:Object(K.a)(Object(K.a)({},Ce),{},{status:fi})})}})},q}return Object(b.a)(oe,[{key:"render",value:function(){var fe=this,pe=this.state.keyEntities,Le=this.props,Ce=Le.component,De=Le.children,Be=Le.onVisibleChanged,tt=Object(D.a)(Le,["component","children","onVisibleChanged"]),qe=Ce||w.Fragment,ut={};return s.forEach(function(Wt){ut[Wt]=tt[Wt],delete tt[Wt]}),delete tt.keys,w.createElement(qe,tt,pe.map(function(Wt){var Zt=Wt.status,Xt=Object(D.a)(Wt,["status"]),Yt=Zt===Je||Zt===jt;return w.createElement(xe,Object(m.a)({},ut,{key:Xt.key,visible:Yt,eventProps:Xt,onVisibleChanged:function(Qt){Be==null||Be(Qt,{key:Xt.key}),Qt||fe.removeKey(Xt.key)}}),De)}))}}],[{key:"getDerivedStateFromProps",value:function(fe,pe){var Le=fe.keys,Ce=pe.keyEntities,De=li(Le),Be=j(Ce,De);return{keyEntities:Be.filter(function(tt){var qe=Ce.find(function(ut){var Wt=ut.key;return tt.key===Wt});return!(qe&&qe.status===fi&&tt.status===si)})}}}]),oe}(w.Component);return Ae.defaultProps={component:"div"},Ae}var R=f(_t),Q=hi;function F(le){var xe=le.prefixCls,Ae=le.motion,ce=le.animation,Z=le.transitionName;return Ae||(ce?{motionName:"".concat(xe,"-").concat(ce)}:Z?{motionName:Z}:null)}function ve(le){var xe=le.prefixCls,Ae=le.visible,ce=le.zIndex,Z=le.mask,oe=le.maskMotion,q=le.maskAnimation,fe=le.maskTransitionName;if(!Z)return null;var pe={};return(oe||fe||q)&&(pe=Object(K.a)({motionAppear:!0},F({motion:oe,prefixCls:xe,transitionName:fe,animation:q}))),w.createElement(Q,Object(m.a)({},pe,{visible:Ae,removeOnLeave:!0}),function(Le){var Ce=Le.className;return w.createElement("div",{style:{zIndex:ce},className:H()("".concat(xe,"-mask"),Ce)})})}var ze=ie("9mu1"),lt=ie("o0o1"),At=ie.n(lt),Xe=ie("HaE+"),Rt=["measure","align",null,"motion"],gr=function(le,xe){var Ae=Object(w.useState)(null),ce=Object(X.a)(Ae,2),Z=ce[0],oe=ce[1],q=Object(w.useRef)(),fe=Object(w.useRef)(!1);function pe(De){fe.current||oe(De)}function Le(){st.a.cancel(q.current)}function Ce(De){Le(),q.current=Object(st.a)(function(){pe(function(Be){switch(Z){case"align":return"motion";case"motion":return"stable";default:}return Be}),De==null||De()})}return Object(w.useEffect)(function(){pe("measure")},[le]),Object(w.useEffect)(function(){switch(Z){case"measure":xe();break;default:}Z&&(q.current=Object(st.a)(Object(Xe.a)(At.a.mark(function De(){var Be,tt;return At.a.wrap(function(ut){for(;;)switch(ut.prev=ut.next){case 0:Be=Rt.indexOf(Z),tt=Rt[Be+1],tt&&Be!==-1&&pe(tt);case 3:case"end":return ut.stop()}},De)}))))},[Z]),Object(w.useEffect)(function(){return function(){fe.current=!0,Le()}},[]),[Z,Ce]},Dr=function(le){var xe=w.useState({width:0,height:0}),Ae=Object(X.a)(xe,2),ce=Ae[0],Z=Ae[1];function oe(fe){Z({width:fe.offsetWidth,height:fe.offsetHeight})}var q=w.useMemo(function(){var fe={};if(le){var pe=ce.width,Le=ce.height;le.indexOf("height")!==-1&&Le?fe.height=Le:le.indexOf("minHeight")!==-1&&Le&&(fe.minHeight=Le),le.indexOf("width")!==-1&&pe?fe.width=pe:le.indexOf("minWidth")!==-1&&pe&&(fe.minWidth=pe)}return fe},[le,ce]);return[q,oe]},Ln=w.forwardRef(function(le,xe){var Ae=le.visible,ce=le.prefixCls,Z=le.className,oe=le.style,q=le.children,fe=le.zIndex,pe=le.stretch,Le=le.destroyPopupOnHide,Ce=le.forceRender,De=le.align,Be=le.point,tt=le.getRootDomNode,qe=le.getClassNameFromAlign,ut=le.onAlign,Wt=le.onMouseEnter,Zt=le.onMouseLeave,Xt=le.onMouseDown,Yt=le.onTouchStart,Jt=Object(w.useRef)(),Qt=Object(w.useRef)(),$t=Object(w.useState)(),dr=Object(X.a)($t,2),ar=dr[0],Nr=dr[1],or=Dr(pe),Bt=Object(X.a)(or,2),Nt=Bt[0],sr=Bt[1];function cr(){pe&&sr(tt())}var Dt=gr(Ae,cr),fr=Object(X.a)(Dt,2),Ur=fr[0],yr=fr[1],Lr=Object(w.useRef)();function wr(){return Be||tt}function Yr(){var _r;(_r=Jt.current)===null||_r===void 0||_r.forceAlign()}function un(_r,Or){var Wr=qe(Or);ar!==Wr&&Nr(Wr),Ur==="align"&&(ar!==Wr?Promise.resolve().then(function(){Yr()}):yr(function(){var Br;(Br=Lr.current)===null||Br===void 0||Br.call(Lr)}),ut==null||ut(_r,Or))}var jr=Object(K.a)({},F(le));["onAppearEnd","onEnterEnd","onLeaveEnd"].forEach(function(_r){var Or=jr[_r];jr[_r]=function(Wr,Br){return yr(),Or==null?void 0:Or(Wr,Br)}});function On(){return new Promise(function(_r){Lr.current=_r})}w.useEffect(function(){!jr.motionName&&Ur==="motion"&&yr()},[jr.motionName,Ur]),w.useImperativeHandle(xe,function(){return{forceAlign:Yr,getElement:function(){return Qt.current}}});var ti=Object(K.a)(Object(K.a)({},Nt),{},{zIndex:fe,opacity:Ur==="motion"||Ur==="stable"||!Ae?void 0:0,pointerEvents:Ur==="stable"?void 0:"none"},oe),_n=!0;(De==null?void 0:De.points)&&(Ur==="align"||Ur==="stable")&&(_n=!1);var dn=q;return w.Children.count(q)>1&&(dn=w.createElement("div",{className:"".concat(ce,"-content")},q)),w.createElement(Q,Object(m.a)({visible:Ae,ref:Qt,leavedClassName:"".concat(ce,"-hidden")},jr,{onAppearPrepare:On,onEnterPrepare:On,removeOnLeave:Le,forceRender:Ce}),function(_r,Or){var Wr=_r.className,Br=_r.style,ri=H()(ce,Z,ar,Wr);return w.createElement(ze.a,{target:wr(),key:"popup",ref:Jt,monitorWindowResize:!0,disabled:_n,align:De,onAlign:un},w.createElement("div",{ref:Or,className:ri,onMouseEnter:Wt,onMouseLeave:Zt,onMouseDownCapture:Xt,onTouchStartCapture:Yt,style:Object(K.a)(Object(K.a)({},Br),ti)},dn))})});Ln.displayName="PopupInner";var gn=Ln,ln=w.forwardRef(function(le,xe){var Ae=le.prefixCls,ce=le.visible,Z=le.zIndex,oe=le.children,q=le.mobile;q=q===void 0?{}:q;var fe=q.popupClassName,pe=q.popupStyle,Le=q.popupMotion,Ce=Le===void 0?{}:Le,De=q.popupRender,Be=w.useRef();w.useImperativeHandle(xe,function(){return{forceAlign:function(){},getElement:function(){return Be.current}}});var tt=Object(K.a)({zIndex:Z},pe),qe=oe;return w.Children.count(oe)>1&&(qe=w.createElement("div",{className:"".concat(Ae,"-content")},oe)),De&&(qe=De(qe)),w.createElement(Q,Object(m.a)({visible:ce,ref:Be,removeOnLeave:!0},Ce),function(ut,Wt){var Zt=ut.className,Xt=ut.style,Yt=H()(Ae,fe,Zt);return w.createElement("div",{ref:Wt,className:Yt,style:Object(K.a)(Object(K.a)({},Xt),tt)},qe)})});ln.displayName="MobilePopupInner";var Jn=ln,Pi=["visible","mobile"],Qr=w.forwardRef(function(le,xe){var Ae=le.visible,ce=le.mobile,Z=Object(D.a)(le,Pi),oe=Object(w.useState)(Ae),q=Object(X.a)(oe,2),fe=q[0],pe=q[1],Le=Object(w.useState)(!1),Ce=Object(X.a)(Le,2),De=Ce[0],Be=Ce[1],tt=Object(K.a)(Object(K.a)({},Z),{},{visible:fe});Object(w.useEffect)(function(){pe(Ae),Ae&&ce&&Be(we())},[Ae,ce]);var qe=De?w.createElement(Jn,Object(m.a)({},tt,{mobile:ce,ref:xe})):w.createElement(gn,Object(m.a)({},tt,{ref:xe}));return w.createElement("div",null,w.createElement(ve,tt),qe)});Qr.displayName="Popup";var Fn=Qr,pi=w.createContext(null),ui=pi;function Sn(){}function Ii(){return""}function Ci(le){return le?le.ownerDocument:window.document}var Gi=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];function Vi(le){var xe=function(Ae){Object(p.a)(Z,Ae);var ce=Object(c.a)(Z);function Z(oe){var q;Object(k.a)(this,Z),q=ce.call(this,oe),q.popupRef=w.createRef(),q.triggerRef=w.createRef(),q.attachId=void 0,q.clickOutsideHandler=void 0,q.touchOutsideHandler=void 0,q.contextMenuOutsideHandler1=void 0,q.contextMenuOutsideHandler2=void 0,q.mouseDownTimeout=void 0,q.focusTime=void 0,q.preClickTime=void 0,q.preTouchTime=void 0,q.delayTimer=void 0,q.hasPopupMouseDown=void 0,q.onMouseEnter=function(pe){var Le=q.props.mouseEnterDelay;q.fireEvents("onMouseEnter",pe),q.delaySetPopupVisible(!0,Le,Le?null:pe)},q.onMouseMove=function(pe){q.fireEvents("onMouseMove",pe),q.setPoint(pe)},q.onMouseLeave=function(pe){q.fireEvents("onMouseLeave",pe),q.delaySetPopupVisible(!1,q.props.mouseLeaveDelay)},q.onPopupMouseEnter=function(){q.clearDelayTimer()},q.onPopupMouseLeave=function(pe){var Le;if(pe.relatedTarget&&!pe.relatedTarget.setTimeout&&Object(Ot.a)((Le=q.popupRef.current)===null||Le===void 0?void 0:Le.getElement(),pe.relatedTarget))return;q.delaySetPopupVisible(!1,q.props.mouseLeaveDelay)},q.onFocus=function(pe){q.fireEvents("onFocus",pe),q.clearDelayTimer(),q.isFocusToShow()&&(q.focusTime=Date.now(),q.delaySetPopupVisible(!0,q.props.focusDelay))},q.onMouseDown=function(pe){q.fireEvents("onMouseDown",pe),q.preClickTime=Date.now()},q.onTouchStart=function(pe){q.fireEvents("onTouchStart",pe),q.preTouchTime=Date.now()},q.onBlur=function(pe){q.fireEvents("onBlur",pe),q.clearDelayTimer(),q.isBlurToHide()&&q.delaySetPopupVisible(!1,q.props.blurDelay)},q.onContextMenu=function(pe){pe.preventDefault(),q.fireEvents("onContextMenu",pe),q.setPopupVisible(!0,pe)},q.onContextMenuClose=function(){q.isContextMenuToShow()&&q.close()},q.onClick=function(pe){if(q.fireEvents("onClick",pe),q.focusTime){var Le;if(q.preClickTime&&q.preTouchTime?Le=Math.min(q.preClickTime,q.preTouchTime):q.preClickTime?Le=q.preClickTime:q.preTouchTime&&(Le=q.preTouchTime),Math.abs(Le-q.focusTime)<20)return;q.focusTime=0}q.preClickTime=0,q.preTouchTime=0,q.isClickToShow()&&(q.isClickToHide()||q.isBlurToHide())&&pe&&pe.preventDefault&&pe.preventDefault();var Ce=!q.state.popupVisible;(q.isClickToHide()&&!Ce||Ce&&q.isClickToShow())&&q.setPopupVisible(!q.state.popupVisible,pe)},q.onPopupMouseDown=function(){if(q.hasPopupMouseDown=!0,clearTimeout(q.mouseDownTimeout),q.mouseDownTimeout=window.setTimeout(function(){q.hasPopupMouseDown=!1},0),q.context){var pe;(pe=q.context).onPopupMouseDown.apply(pe,arguments)}},q.onDocumentClick=function(pe){if(q.props.mask&&!q.props.maskClosable)return;var Le=pe.target,Ce=q.getRootDomNode(),De=q.getPopupDomNode();(!Object(Ot.a)(Ce,Le)||q.isContextMenuOnly())&&!Object(Ot.a)(De,Le)&&!q.hasPopupMouseDown&&q.close()},q.getRootDomNode=function(){var pe=q.props.getTriggerDOMNode;if(pe)return pe(q.triggerRef.current);try{var Le=Object(xt.a)(q.triggerRef.current);if(Le)return Le}catch(Ce){}return mt.a.findDOMNode(Object(h.a)(q))},q.getPopupClassNameFromAlign=function(pe){var Le=[],Ce=q.props,De=Ce.popupPlacement,Be=Ce.builtinPlacements,tt=Ce.prefixCls,qe=Ce.alignPoint,ut=Ce.getPopupClassNameFromAlign;return De&&Be&&Le.push(Ze(Be,tt,pe,qe)),ut&&Le.push(ut(pe)),Le.join(" ")},q.getComponent=function(){var pe=q.props,Le=pe.prefixCls,Ce=pe.destroyPopupOnHide,De=pe.popupClassName,Be=pe.onPopupAlign,tt=pe.popupMotion,qe=pe.popupAnimation,ut=pe.popupTransitionName,Wt=pe.popupStyle,Zt=pe.mask,Xt=pe.maskAnimation,Yt=pe.maskTransitionName,Jt=pe.maskMotion,Qt=pe.zIndex,$t=pe.popup,dr=pe.stretch,ar=pe.alignPoint,Nr=pe.mobile,or=pe.forceRender,Bt=q.state,Nt=Bt.popupVisible,sr=Bt.point,cr=q.getPopupAlign(),Dt={};return q.isMouseEnterToShow()&&(Dt.onMouseEnter=q.onPopupMouseEnter),q.isMouseLeaveToHide()&&(Dt.onMouseLeave=q.onPopupMouseLeave),Dt.onMouseDown=q.onPopupMouseDown,Dt.onTouchStart=q.onPopupMouseDown,w.createElement(Fn,Object(m.a)({prefixCls:Le,destroyPopupOnHide:Ce,visible:Nt,point:ar&&sr,className:De,align:cr,onAlign:Be,animation:qe,getClassNameFromAlign:q.getPopupClassNameFromAlign},Dt,{stretch:dr,getRootDomNode:q.getRootDomNode,style:Wt,mask:Zt,zIndex:Qt,transitionName:ut,maskAnimation:Xt,maskTransitionName:Yt,maskMotion:Jt,ref:q.popupRef,motion:tt,mobile:Nr,forceRender:or}),typeof $t=="function"?$t():$t)},q.attachParent=function(pe){st.a.cancel(q.attachId);var Le=q.props,Ce=Le.getPopupContainer,De=Le.getDocument,Be=q.getRootDomNode(),tt;Ce?(Be||Ce.length===0)&&(tt=Ce(Be)):tt=De(q.getRootDomNode()).body,tt?tt.appendChild(pe):q.attachId=Object(st.a)(function(){q.attachParent(pe)})},q.getContainer=function(){var pe=q.props.getDocument,Le=pe(q.getRootDomNode()).createElement("div");return Le.style.position="absolute",Le.style.top="0",Le.style.left="0",Le.style.width="100%",q.attachParent(Le),Le},q.setPoint=function(pe){var Le=q.props.alignPoint;if(!Le||!pe)return;q.setState({point:{pageX:pe.pageX,pageY:pe.pageY}})},q.handlePortalUpdate=function(){q.state.prevPopupVisible!==q.state.popupVisible&&q.props.afterPopupVisibleChange(q.state.popupVisible)},q.triggerContextValue={onPopupMouseDown:q.onPopupMouseDown};var fe;return"popupVisible"in oe?fe=!!oe.popupVisible:fe=!!oe.defaultPopupVisible,q.state={prevPopupVisible:fe,popupVisible:fe},Gi.forEach(function(pe){q["fire".concat(pe)]=function(Le){q.fireEvents(pe,Le)}}),q}return Object(b.a)(Z,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var q=this.props,fe=this.state;if(fe.popupVisible){var pe;!this.clickOutsideHandler&&(this.isClickToHide()||this.isContextMenuToShow())&&(pe=q.getDocument(this.getRootDomNode()),this.clickOutsideHandler=Object(Ne.a)(pe,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(pe=pe||q.getDocument(this.getRootDomNode()),this.touchOutsideHandler=Object(Ne.a)(pe,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(pe=pe||q.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=Object(Ne.a)(pe,"scroll",this.onContextMenuClose)),!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=Object(Ne.a)(window,"blur",this.onContextMenuClose));return}this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),st.a.cancel(this.attachId)}},{key:"getPopupDomNode",value:function(){var q;return((q=this.popupRef.current)===null||q===void 0?void 0:q.getElement())||null}},{key:"getPopupAlign",value:function(){var q=this.props,fe=q.popupPlacement,pe=q.popupAlign,Le=q.builtinPlacements;return fe&&Le?Fe(Le,fe,pe):pe}},{key:"setPopupVisible",value:function(q,fe){var pe=this.props.alignPoint,Le=this.state.popupVisible;this.clearDelayTimer(),Le!==q&&("popupVisible"in this.props||this.setState({popupVisible:q,prevPopupVisible:Le}),this.props.onPopupVisibleChange(q)),pe&&fe&&q&&this.setPoint(fe)}},{key:"delaySetPopupVisible",value:function(q,fe,pe){var Le=this,Ce=fe*1e3;if(this.clearDelayTimer(),Ce){var De=pe?{pageX:pe.pageX,pageY:pe.pageY}:null;this.delayTimer=window.setTimeout(function(){Le.setPopupVisible(q,De),Le.clearDelayTimer()},Ce)}else this.setPopupVisible(q,pe)}},{key:"clearDelayTimer",value:function(){this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null)}},{key:"clearOutsideHandler",value:function(){this.clickOutsideHandler&&(this.clickOutsideHandler.remove(),this.clickOutsideHandler=null),this.contextMenuOutsideHandler1&&(this.contextMenuOutsideHandler1.remove(),this.contextMenuOutsideHandler1=null),this.contextMenuOutsideHandler2&&(this.contextMenuOutsideHandler2.remove(),this.contextMenuOutsideHandler2=null),this.touchOutsideHandler&&(this.touchOutsideHandler.remove(),this.touchOutsideHandler=null)}},{key:"createTwoChains",value:function(q){var fe=this.props.children.props,pe=this.props;return fe[q]&&pe[q]?this["fire".concat(q)]:fe[q]||pe[q]}},{key:"isClickToShow",value:function(){var q=this.props,fe=q.action,pe=q.showAction;return fe.indexOf("click")!==-1||pe.indexOf("click")!==-1}},{key:"isContextMenuOnly",value:function(){var q=this.props.action;return q==="contextMenu"||q.length===1&&q[0]==="contextMenu"}},{key:"isContextMenuToShow",value:function(){var q=this.props,fe=q.action,pe=q.showAction;return fe.indexOf("contextMenu")!==-1||pe.indexOf("contextMenu")!==-1}},{key:"isClickToHide",value:function(){var q=this.props,fe=q.action,pe=q.hideAction;return fe.indexOf("click")!==-1||pe.indexOf("click")!==-1}},{key:"isMouseEnterToShow",value:function(){var q=this.props,fe=q.action,pe=q.showAction;return fe.indexOf("hover")!==-1||pe.indexOf("mouseEnter")!==-1}},{key:"isMouseLeaveToHide",value:function(){var q=this.props,fe=q.action,pe=q.hideAction;return fe.indexOf("hover")!==-1||pe.indexOf("mouseLeave")!==-1}},{key:"isFocusToShow",value:function(){var q=this.props,fe=q.action,pe=q.showAction;return fe.indexOf("focus")!==-1||pe.indexOf("focus")!==-1}},{key:"isBlurToHide",value:function(){var q=this.props,fe=q.action,pe=q.hideAction;return fe.indexOf("focus")!==-1||pe.indexOf("blur")!==-1}},{key:"forcePopupAlign",value:function(){if(this.state.popupVisible){var q;(q=this.popupRef.current)===null||q===void 0||q.forceAlign()}}},{key:"fireEvents",value:function(q,fe){var pe=this.props.children.props[q];pe&&pe(fe);var Le=this.props[q];Le&&Le(fe)}},{key:"close",value:function(){this.setPopupVisible(!1)}},{key:"render",value:function(){var q=this.state.popupVisible,fe=this.props,pe=fe.children,Le=fe.forceRender,Ce=fe.alignPoint,De=fe.className,Be=fe.autoDestroy,tt=w.Children.only(pe),qe={key:"trigger"};this.isContextMenuToShow()?qe.onContextMenu=this.onContextMenu:qe.onContextMenu=this.createTwoChains("onContextMenu"),this.isClickToHide()||this.isClickToShow()?(qe.onClick=this.onClick,qe.onMouseDown=this.onMouseDown,qe.onTouchStart=this.onTouchStart):(qe.onClick=this.createTwoChains("onClick"),qe.onMouseDown=this.createTwoChains("onMouseDown"),qe.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?(qe.onMouseEnter=this.onMouseEnter,Ce&&(qe.onMouseMove=this.onMouseMove)):qe.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?qe.onMouseLeave=this.onMouseLeave:qe.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(qe.onFocus=this.onFocus,qe.onBlur=this.onBlur):(qe.onFocus=this.createTwoChains("onFocus"),qe.onBlur=this.createTwoChains("onBlur"));var ut=H()(tt&&tt.props&&tt.props.className,De);ut&&(qe.className=ut);var Wt=Object(K.a)({},qe);Object(vt.c)(tt)&&(Wt.ref=Object(vt.a)(this.triggerRef,tt.ref));var Zt=w.cloneElement(tt,Wt),Xt;return(q||this.popupRef.current||Le)&&(Xt=w.createElement(le,{key:"portal",getContainer:this.getContainer,didUpdate:this.handlePortalUpdate},this.getComponent())),!q&&Be&&(Xt=null),w.createElement(ui.Provider,{value:this.triggerContextValue},Zt,Xt)}}],[{key:"getDerivedStateFromProps",value:function(q,fe){var pe=q.popupVisible,Le={};return pe!==void 0&&fe.popupVisible!==pe&&(Le.popupVisible=pe,Le.prevPopupVisible=fe.popupVisible),Le}}]),Z}(w.Component);return xe.contextType=ui,xe.defaultProps={prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:Ii,getDocument:Ci,onPopupVisibleChange:Sn,afterPopupVisibleChange:Sn,onPopupAlign:Sn,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[],autoDestroy:!1},xe}var qn=Vi(Lt.a),en={adjustX:1,adjustY:1},mi={topLeft:{points:["bl","tl"],overflow:en,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:en,offset:[0,7]},leftTop:{points:["tr","tl"],overflow:en,offset:[-4,0]},rightTop:{points:["tl","tr"],overflow:en,offset:[4,0]}},oa={topLeft:{points:["bl","tl"],overflow:en,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:en,offset:[0,7]},rightTop:{points:["tr","tl"],overflow:en,offset:[-4,0]},leftTop:{points:["tl","tr"],overflow:en,offset:[4,0]}},Ni=mi,Fr=0,vr={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"},Kr=function(xe,Ae,ce){var Z=je(Ae),oe=xe.getState();xe.setState({defaultActiveFirst:Object(K.a)(Object(K.a)({},oe.defaultActiveFirst),{},Object(ae.a)({},Z,ce))})},qt=function(le){Object(p.a)(Ae,le);var xe=Object(c.a)(Ae);function Ae(ce){var Z;Object(k.a)(this,Ae),Z=xe.call(this,ce),Z.onDestroy=function(Ce){Z.props.onDestroy(Ce)},Z.onKeyDown=function(Ce){var De=Ce.keyCode,Be=Z.menuInstance,tt=Z.props.store,qe=Z.getVisible();if(De===g.a.ENTER)return Z.onTitleClick(Ce),Kr(tt,Z.props.eventKey,!0),!0;if(De===g.a.RIGHT)return qe?Be.onKeyDown(Ce):(Z.triggerOpenChange(!0),Kr(tt,Z.props.eventKey,!0)),!0;if(De===g.a.LEFT){var ut;if(qe)ut=Be.onKeyDown(Ce);else return;return ut||(Z.triggerOpenChange(!1),ut=!0),ut}return qe&&(De===g.a.UP||De===g.a.DOWN)?Be.onKeyDown(Ce):void 0},Z.onOpenChange=function(Ce){Z.props.onOpenChange(Ce)},Z.onPopupVisibleChange=function(Ce){Z.triggerOpenChange(Ce,Ce?"mouseenter":"mouseleave")},Z.onMouseEnter=function(Ce){var De=Z.props,Be=De.eventKey,tt=De.onMouseEnter,qe=De.store;Kr(qe,Z.props.eventKey,!1),tt({key:Be,domEvent:Ce})},Z.onMouseLeave=function(Ce){var De=Z.props,Be=De.parentMenu,tt=De.eventKey,qe=De.onMouseLeave;Be.subMenuInstance=Object(h.a)(Z),qe({key:tt,domEvent:Ce})},Z.onTitleMouseEnter=function(Ce){var De=Z.props,Be=De.eventKey,tt=De.onItemHover,qe=De.onTitleMouseEnter;tt({key:Be,hover:!0}),qe({key:Be,domEvent:Ce})},Z.onTitleMouseLeave=function(Ce){var De=Z.props,Be=De.parentMenu,tt=De.eventKey,qe=De.onItemHover,ut=De.onTitleMouseLeave;Be.subMenuInstance=Object(h.a)(Z),qe({key:tt,hover:!1}),ut({key:tt,domEvent:Ce})},Z.onTitleClick=function(Ce){var De=Object(h.a)(Z),Be=De.props;if(Be.onTitleClick({key:Be.eventKey,domEvent:Ce}),Be.triggerSubMenuAction==="hover")return;Z.triggerOpenChange(!Z.getVisible(),"click"),Kr(Be.store,Z.props.eventKey,!1)},Z.onSubMenuClick=function(Ce){typeof Z.props.onClick=="function"&&Z.props.onClick(Z.addKeyPath(Ce))},Z.onSelect=function(Ce){Z.props.onSelect(Ce)},Z.onDeselect=function(Ce){Z.props.onDeselect(Ce)},Z.getPrefixCls=function(){return"".concat(Z.props.rootPrefixCls,"-submenu")},Z.getActiveClassName=function(){return"".concat(Z.getPrefixCls(),"-active")},Z.getDisabledClassName=function(){return"".concat(Z.getPrefixCls(),"-disabled")},Z.getSelectedClassName=function(){return"".concat(Z.getPrefixCls(),"-selected")},Z.getOpenClassName=function(){return"".concat(Z.props.rootPrefixCls,"-submenu-open")},Z.getVisible=function(){return Z.state.isOpen},Z.getMode=function(){return Z.state.mode},Z.saveMenuInstance=function(Ce){Z.menuInstance=Ce},Z.addKeyPath=function(Ce){return Object(K.a)(Object(K.a)({},Ce),{},{keyPath:(Ce.keyPath||[]).concat(Z.props.eventKey)})},Z.triggerOpenChange=function(Ce,De){var Be=Z.props.eventKey,tt=function(){Z.onOpenChange({key:Be,item:Object(h.a)(Z),trigger:De,open:Ce})};De==="mouseenter"?Z.mouseenterTimeout=setTimeout(function(){tt()},0):tt()},Z.isChildrenSelected=function(){var Ce={find:!1};return rt(Z.props.children,Z.props.selectedKeys,Ce),Ce.find},Z.isInlineMode=function(){return Z.getMode()==="inline"},Z.adjustWidth=function(){if(!Z.subMenuTitle||!Z.menuInstance)return;var Ce=pt.findDOMNode(Z.menuInstance);if(Ce.offsetWidth>=Z.subMenuTitle.offsetWidth)return;Ce.style.minWidth="".concat(Z.subMenuTitle.offsetWidth,"px")},Z.saveSubMenuTitle=function(Ce){Z.subMenuTitle=Ce},Z.getBaseProps=function(){var Ce=Object(h.a)(Z),De=Ce.props,Be=Z.getMode();return{mode:Be==="horizontal"?"vertical":Be,visible:Z.getVisible(),level:De.level+1,inlineIndent:De.inlineIndent,focusable:!1,onClick:Z.onSubMenuClick,onSelect:Z.onSelect,onDeselect:Z.onDeselect,onDestroy:Z.onDestroy,selectedKeys:De.selectedKeys,eventKey:"".concat(De.eventKey,"-menu-"),openKeys:De.openKeys,motion:De.motion,onOpenChange:Z.onOpenChange,subMenuOpenDelay:De.subMenuOpenDelay,parentMenu:Object(h.a)(Z),subMenuCloseDelay:De.subMenuCloseDelay,forceSubMenuRender:De.forceSubMenuRender,triggerSubMenuAction:De.triggerSubMenuAction,builtinPlacements:De.builtinPlacements,defaultActiveFirst:De.store.getState().defaultActiveFirst[je(De.eventKey)],multiple:De.multiple,prefixCls:De.rootPrefixCls,id:Z.internalMenuId,manualRef:Z.saveMenuInstance,itemIcon:De.itemIcon,expandIcon:De.expandIcon,direction:De.direction}},Z.getMotion=function(Ce,De){var Be=Object(h.a)(Z),tt=Be.haveRendered,qe=Z.props,ut=qe.motion,Wt=qe.rootPrefixCls,Zt=Object(K.a)(Object(K.a)({},ut),{},{leavedClassName:"".concat(Wt,"-hidden"),removeOnLeave:!1,motionAppear:tt||!De||Ce!=="inline"});return Zt};var oe=ce.store,q=ce.eventKey,fe=oe.getState(),pe=fe.defaultActiveFirst;Z.isRootMenu=!1;var Le=!1;return pe&&(Le=pe[q]),Kr(oe,q,Le),Z.state={mode:ce.mode,isOpen:ce.isOpen},Z}return Object(b.a)(Ae,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var Z=this,oe=this.props,q=oe.mode,fe=oe.parentMenu,pe=oe.manualRef,Le=oe.isOpen,Ce=function(){Z.setState({mode:q,isOpen:Le})},De=Le!==this.state.isOpen,Be=q!==this.state.mode;if((Be||De)&&(st.a.cancel(this.updateStateRaf),Be?this.updateStateRaf=Object(st.a)(Ce):Ce()),pe&&pe(this),q!=="horizontal"||!(fe==null?void 0:fe.isRootMenu)||!Le)return;this.minWidthTimeout=setTimeout(function(){return Z.adjustWidth()},0)}},{key:"componentWillUnmount",value:function(){var Z=this.props,oe=Z.onDestroy,q=Z.eventKey;oe&&oe(q),this.minWidthTimeout&&clearTimeout(this.minWidthTimeout),this.mouseenterTimeout&&clearTimeout(this.mouseenterTimeout),st.a.cancel(this.updateStateRaf)}},{key:"renderPopupMenu",value:function(Z,oe){var q=this.getBaseProps();return w.createElement(ua,Object(m.a)({},q,{id:this.internalMenuId,className:Z,style:oe}),this.props.children)}},{key:"renderChildren",value:function(){var Z=this,oe=this.getBaseProps(),q=oe.mode,fe=oe.visible,pe=oe.forceSubMenuRender,Le=oe.direction,Ce=this.getMotion(q,fe);if(this.haveRendered=!0,this.haveOpened=this.haveOpened||fe||pe,!this.haveOpened)return w.createElement("div",null);var De=H()("".concat(oe.prefixCls,"-sub"),Object(ae.a)({},"".concat(oe.prefixCls,"-rtl"),Le==="rtl"));return this.isInlineMode()?w.createElement(Q,Object(m.a)({visible:oe.visible,forceRender:pe},Ce),function(Be){var tt=Be.className,qe=Be.style,ut=H()(De,tt);return Z.renderPopupMenu(ut,qe)}):this.renderPopupMenu(De)}},{key:"render",value:function(){var Z,oe,q,fe=Object(K.a)({},this.props),pe=this.getVisible(),Le=this.getPrefixCls(),Ce=this.isInlineMode(),De=this.getMode(),Be=H()(Le,"".concat(Le,"-").concat(De),(Z={},Object(ae.a)(Z,fe.className,!!fe.className),Object(ae.a)(Z,this.getOpenClassName(),pe),Object(ae.a)(Z,this.getActiveClassName(),fe.active||pe&&!Ce),Object(ae.a)(Z,this.getDisabledClassName(),fe.disabled),Object(ae.a)(Z,this.getSelectedClassName(),this.isChildrenSelected()),Z));this.internalMenuId||(fe.eventKey?this.internalMenuId="".concat(fe.eventKey,"$Menu"):(Fr+=1,this.internalMenuId="$__$".concat(Fr,"$Menu")));var tt={},qe={},ut={};fe.disabled||(tt={onMouseLeave:this.onMouseLeave,onMouseEnter:this.onMouseEnter},qe={onClick:this.onTitleClick},ut={onMouseEnter:this.onTitleMouseEnter,onMouseLeave:this.onTitleMouseLeave});var Wt={},Zt=fe.direction,Xt=Zt==="rtl";Ce&&(Xt?Wt.paddingRight=fe.inlineIndent*fe.level:Wt.paddingLeft=fe.inlineIndent*fe.level);var Yt={};this.getVisible()&&(Yt={"aria-owns":this.internalMenuId});var Jt=null;De!=="horizontal"&&(Jt=this.props.expandIcon,typeof this.props.expandIcon=="function"&&(Jt=w.createElement(this.props.expandIcon,Object(K.a)({},this.props))));var Qt=w.createElement("div",Object(m.a)({ref:this.saveSubMenuTitle,style:Wt,className:"".concat(Le,"-title"),role:"button"},ut,qe,{"aria-expanded":pe},Yt,{"aria-haspopup":"true",title:typeof fe.title=="string"?fe.title:void 0}),fe.title,Jt||w.createElement("i",{className:"".concat(Le,"-arrow")})),$t=this.renderChildren(),dr=((oe=fe.parentMenu)===null||oe===void 0?void 0:oe.isRootMenu)?fe.parentMenu.props.getPopupContainer:function(wr){return wr.parentNode},ar=vr[De],Nr=fe.popupOffset?{offset:fe.popupOffset}:{},or=H()((q={},Object(ae.a)(q,fe.popupClassName,fe.popupClassName&&!Ce),Object(ae.a)(q,"".concat(Le,"-rtl"),Xt),q)),Bt=fe.disabled,Nt=fe.triggerSubMenuAction,sr=fe.subMenuOpenDelay,cr=fe.forceSubMenuRender,Dt=fe.subMenuCloseDelay,fr=fe.builtinPlacements;ot.forEach(function(wr){return delete fe[wr]}),delete fe.onClick;var Ur=Xt?Object(K.a)(Object(K.a)({},oa),fr):Object(K.a)(Object(K.a)({},mi),fr);delete fe.direction;var yr=this.getBaseProps(),Lr=Ce?null:this.getMotion(yr.mode,yr.visible);return w.createElement("li",Object(m.a)({},fe,tt,{className:Be,role:"menuitem"}),w.createElement(qn,{prefixCls:Le,popupClassName:H()("".concat(Le,"-popup"),or),getPopupContainer:dr,builtinPlacements:Ur,popupPlacement:ar,popupVisible:Ce?!1:pe,popupAlign:Nr,popup:Ce?null:$t,action:Bt||Ce?[]:[Nt],mouseEnterDelay:sr,mouseLeaveDelay:Dt,onPopupVisibleChange:this.onPopupVisibleChange,forceRender:cr,popupMotion:Lr},Qt),Ce?$t:null)}}]),Ae}(w.Component);qt.defaultProps={onMouseEnter:at,onMouseLeave:at,onTitleMouseEnter:at,onTitleMouseLeave:at,onTitleClick:at,manualRef:at,mode:"vertical",title:""};var zr=Object(o.b)(function(le,xe){var Ae=le.openKeys,ce=le.activeKey,Z=le.selectedKeys,oe=xe.eventKey,q=xe.subMenuKey;return{isOpen:Ae.indexOf(oe)>-1,active:ce[q]===oe,selectedKeys:Z}})(qt);zr.isSubMenu=!0;var Sr=zr,ei="menuitem-overflowed",tn=.5,vn=function(le){Object(p.a)(Ae,le);var xe=Object(c.a)(Ae);function Ae(){var ce;return Object(k.a)(this,Ae),ce=xe.apply(this,arguments),ce.resizeObserver=null,ce.mutationObserver=null,ce.originalTotalWidth=0,ce.overflowedItems=[],ce.menuItemSizes=[],ce.cancelFrameId=null,ce.state={lastVisibleIndex:void 0},ce.childRef=w.createRef(),ce.getMenuItemNodes=function(){var Z=ce.props.prefixCls,oe=ce.childRef.current;return oe?[].slice.call(oe.children).filter(function(q){return q.className.split(" ").indexOf("".concat(Z,"-overflowed-submenu"))<0}):[]},ce.getOverflowedSubMenuItem=function(Z,oe,q){var fe=ce.props,pe=fe.overflowedIndicator,Le=fe.level,Ce=fe.mode,De=fe.prefixCls,Be=fe.theme;if(Le!==1||Ce!=="horizontal")return null;var tt=ce.props.children[0],qe=tt.props,ut=qe.children,Wt=qe.title,Zt=qe.style,Xt=Object(D.a)(qe,["children","title","style"]),Yt=Object(K.a)({},Zt),Jt="".concat(Z,"-overflowed-indicator"),Qt="".concat(Z,"-overflowed-indicator");oe.length===0&&q!==!0?Yt=Object(K.a)(Object(K.a)({},Yt),{},{display:"none"}):q&&(Yt=Object(K.a)(Object(K.a)({},Yt),{},{visibility:"hidden",position:"absolute"}),Jt="".concat(Jt,"-placeholder"),Qt="".concat(Qt,"-placeholder"));var $t=Be?"".concat(De,"-").concat(Be):"",dr={};return ot.forEach(function(ar){Xt[ar]!==void 0&&(dr[ar]=Xt[ar])}),w.createElement(Sr,Object(m.a)({title:pe,className:"".concat(De,"-overflowed-submenu"),popupClassName:$t},dr,{key:Jt,eventKey:Qt,disabled:!1,style:Yt}),oe)},ce.setChildrenWidthAndResize=function(){if(ce.props.mode!=="horizontal")return;var Z=ce.childRef.current;if(!Z)return;var oe=Z.children;if(!oe||oe.length===0)return;var q=Z.children[oe.length-1];Ve(q,"display","inline-block");var fe=ce.getMenuItemNodes(),pe=fe.filter(function(Le){return Le.className.split(" ").indexOf(ei)>=0});pe.forEach(function(Le){Ve(Le,"display","inline-block")}),ce.menuItemSizes=fe.map(function(Le){return et(Le,!0)}),pe.forEach(function(Le){Ve(Le,"display","none")}),ce.overflowedIndicatorWidth=et(Z.children[Z.children.length-1],!0),ce.originalTotalWidth=ce.menuItemSizes.reduce(function(Le,Ce){return Le+Ce},0),ce.handleResize(),Ve(q,"display","none")},ce.handleResize=function(){if(ce.props.mode!=="horizontal")return;var Z=ce.childRef.current;if(!Z)return;var oe=et(Z);ce.overflowedItems=[];var q=0,fe;ce.originalTotalWidth>oe+tn&&(fe=-1,ce.menuItemSizes.forEach(function(pe){q+=pe,q+ce.overflowedIndicatorWidth<=oe&&(fe+=1)})),ce.setState({lastVisibleIndex:fe})},ce}return Object(b.a)(Ae,[{key:"componentDidMount",value:function(){var Z=this;if(this.setChildrenWidthAndResize(),this.props.level===1&&this.props.mode==="horizontal"){var oe=this.childRef.current;if(!oe)return;this.resizeObserver=new bt.default(function(q){q.forEach(function(){var fe=Z.cancelFrameId;cancelAnimationFrame(fe),Z.cancelFrameId=requestAnimationFrame(Z.setChildrenWidthAndResize)})}),[].slice.call(oe.children).concat(oe).forEach(function(q){Z.resizeObserver.observe(q)}),typeof MutationObserver!="undefined"&&(this.mutationObserver=new MutationObserver(function(){Z.resizeObserver.disconnect(),[].slice.call(oe.children).concat(oe).forEach(function(q){Z.resizeObserver.observe(q)}),Z.setChildrenWidthAndResize()}),this.mutationObserver.observe(oe,{attributes:!1,childList:!0,subTree:!1}))}}},{key:"componentWillUnmount",value:function(){this.resizeObserver&&this.resizeObserver.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),cancelAnimationFrame(this.cancelFrameId)}},{key:"renderChildren",value:function(Z){var oe=this,q=this.state.lastVisibleIndex;return(Z||[]).reduce(function(fe,pe,Le){var Ce=pe;if(oe.props.mode==="horizontal"){var De=oe.getOverflowedSubMenuItem(pe.props.eventKey,[]);q!==void 0&&oe.props.className.indexOf("".concat(oe.props.prefixCls,"-root"))!==-1&&(Le>q&&(Ce=w.cloneElement(pe,{style:{display:"none"},eventKey:"".concat(pe.props.eventKey,"-hidden"),className:"".concat(ei)})),Le===q+1&&(oe.overflowedItems=Z.slice(q+1).map(function(tt){return w.cloneElement(tt,{key:tt.props.eventKey,mode:"vertical-left"})}),De=oe.getOverflowedSubMenuItem(pe.props.eventKey,oe.overflowedItems)));var Be=[].concat(Object(_.a)(fe),[De,Ce]);return Le===Z.length-1&&Be.push(oe.getOverflowedSubMenuItem(pe.props.eventKey,[],!0)),Be}return[].concat(Object(_.a)(fe),[Ce])},[])}},{key:"render",value:function(){var Z=this.props,oe=Z.visible,q=Z.prefixCls,fe=Z.overflowedIndicator,pe=Z.mode,Le=Z.level,Ce=Z.tag,De=Z.children,Be=Z.theme,tt=Object(D.a)(Z,["visible","prefixCls","overflowedIndicator","mode","level","tag","children","theme"]),qe=Ce;return w.createElement(qe,Object(m.a)({ref:this.childRef},tt),this.renderChildren(De))}}]),Ae}(w.Component);vn.defaultProps={tag:"div",className:""};var Xi=vn;function Ti(le){return le.length?le.every(function(xe){return!!xe.props.disabled}):!0}function wi(le,xe,Ae){var ce=le.getState();le.setState({activeKey:Object(K.a)(Object(K.a)({},ce.activeKey),{},Object(ae.a)({},xe,Ae))})}function jn(le){return le.eventKey||"0-menu-"}function Wn(le,xe){var Ae=xe,ce=le.children,Z=le.eventKey;if(Ae){var oe;if(Ye(ce,function(q,fe){q&&q.props&&!q.props.disabled&&Ae===ft(q,Z,fe)&&(oe=!0)}),oe)return Ae}return Ae=null,le.defaultActiveFirst&&Ye(ce,function(q,fe){!Ae&&q&&!q.props.disabled&&(Ae=ft(q,Z,fe))}),Ae}function sa(le){if(!le)return;var xe=this.instanceArray.indexOf(le);xe!==-1?this.instanceArray[xe]=le:this.instanceArray.push(le)}var Xn=function(le){Object(p.a)(Ae,le);var xe=Object(c.a)(Ae);function Ae(ce){var Z;return Object(k.a)(this,Ae),Z=xe.call(this,ce),Z.onKeyDown=function(oe,q){var fe=oe.keyCode,pe;if(Z.getFlatInstanceArray().forEach(function(Ce){Ce&&Ce.props.active&&Ce.onKeyDown&&(pe=Ce.onKeyDown(oe))}),pe)return 1;var Le=null;return(fe===g.a.UP||fe===g.a.DOWN)&&(Le=Z.step(fe===g.a.UP?-1:1)),Le?(oe.preventDefault(),wi(Z.props.store,jn(Z.props),Le.props.eventKey),typeof q=="function"&&q(Le),1):void 0},Z.onItemHover=function(oe){var q=oe.key,fe=oe.hover;wi(Z.props.store,jn(Z.props),fe?q:null)},Z.onDeselect=function(oe){Z.props.onDeselect(oe)},Z.onSelect=function(oe){Z.props.onSelect(oe)},Z.onClick=function(oe){Z.props.onClick(oe)},Z.onOpenChange=function(oe){Z.props.onOpenChange(oe)},Z.onDestroy=function(oe){Z.props.onDestroy(oe)},Z.getFlatInstanceArray=function(){return Z.instanceArray},Z.step=function(oe){var q=Z.getFlatInstanceArray(),fe=Z.props.store.getState().activeKey[jn(Z.props)],pe=q.length;if(!pe)return null;oe<0&&(q=q.concat().reverse());var Le=-1;if(q.every(function(tt,qe){return tt&&tt.props.eventKey===fe?(Le=qe,!1):!0}),!Z.props.defaultActiveFirst&&Le!==-1&&Ti(q.slice(Le,pe-1)))return;var Ce=(Le+1)%pe,De=Ce;do{var Be=q[De];if(!Be||Be.props.disabled)De=(De+1)%pe;else return Be}while(De!==Ce);return null},Z.renderCommonMenuItem=function(oe,q,fe){var pe=Z.props.store.getState(),Le=Object(h.a)(Z),Ce=Le.props,De=ft(oe,Ce.eventKey,q),Be=oe.props;if(!Be||typeof oe.type=="string")return oe;var tt=De===pe.activeKey,qe=Object(K.a)(Object(K.a)({mode:Be.mode||Ce.mode,level:Ce.level,inlineIndent:Ce.inlineIndent,renderMenuItem:Z.renderMenuItem,rootPrefixCls:Ce.prefixCls,index:q,parentMenu:Ce.parentMenu,manualRef:Be.disabled?void 0:Object(y.a)(oe.ref,sa.bind(Object(h.a)(Z))),eventKey:De,active:!Be.disabled&&tt,multiple:Ce.multiple,onClick:function(Wt){(Be.onClick||at)(Wt),Z.onClick(Wt)},onItemHover:Z.onItemHover,motion:Ce.motion,subMenuOpenDelay:Ce.subMenuOpenDelay,subMenuCloseDelay:Ce.subMenuCloseDelay,forceSubMenuRender:Ce.forceSubMenuRender,onOpenChange:Z.onOpenChange,onDeselect:Z.onDeselect,onSelect:Z.onSelect,builtinPlacements:Ce.builtinPlacements,itemIcon:Be.itemIcon||Z.props.itemIcon,expandIcon:Be.expandIcon||Z.props.expandIcon},fe),{},{direction:Ce.direction});return(Ce.mode==="inline"||$e())&&(qe.triggerSubMenuAction="click"),w.cloneElement(oe,Object(K.a)(Object(K.a)({},qe),{},{key:De||q}))},Z.renderMenuItem=function(oe,q,fe){if(!oe)return null;var pe=Z.props.store.getState(),Le={openKeys:pe.openKeys,selectedKeys:pe.selectedKeys,triggerSubMenuAction:Z.props.triggerSubMenuAction,subMenuKey:fe};return Z.renderCommonMenuItem(oe,q,Le)},ce.store.setState({activeKey:Object(K.a)(Object(K.a)({},ce.store.getState().activeKey),{},Object(ae.a)({},ce.eventKey,Wn(ce,ce.activeKey)))}),Z.instanceArray=[],Z}return Object(b.a)(Ae,[{key:"componentDidMount",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"shouldComponentUpdate",value:function(Z){return this.props.visible||Z.visible||this.props.className!==Z.className||!N()(this.props.style,Z.style)}},{key:"componentDidUpdate",value:function(Z){var oe=this.props,q="activeKey"in oe?oe.activeKey:oe.store.getState().activeKey[jn(oe)],fe=Wn(oe,q);if(fe!==q)wi(oe.store,jn(oe),fe);else if("activeKey"in Z){var pe=Wn(Z,Z.activeKey);fe!==pe&&wi(oe.store,jn(oe),fe)}}},{key:"render",value:function(){var Z=this,oe=Object(m.a)({},this.props);this.instanceArray=[];var q=H()(oe.prefixCls,oe.className,"".concat(oe.prefixCls,"-").concat(oe.mode)),fe={className:q,role:oe.role||"menu"};oe.id&&(fe.id=oe.id),oe.focusable&&(fe.tabIndex=0,fe.onKeyDown=this.onKeyDown);var pe=oe.prefixCls,Le=oe.eventKey,Ce=oe.visible,De=oe.level,Be=oe.mode,tt=oe.overflowedIndicator,qe=oe.theme;return ot.forEach(function(ut){return delete oe[ut]}),delete oe.onClick,w.createElement(Xi,Object(m.a)({},oe,{prefixCls:pe,mode:Be,tag:"ul",level:De,theme:qe,visible:Ce,overflowedIndicator:tt},fe),Object(B.a)(oe.children).map(function(ut,Wt){return Z.renderMenuItem(ut,Wt,Le||"0-menu-")}))}}]),Ae}(w.Component);Xn.defaultProps={prefixCls:"rc-menu",className:"",mode:"vertical",level:1,inlineIndent:24,visible:!0,focusable:!0,style:{},manualRef:at};var la=Object(o.b)()(Xn),ua=la,Ui=ie("Kwbf");function Ba(le,xe,Ae){var ce=le.prefixCls,Z=le.motion,oe=le.defaultMotions,q=oe===void 0?{}:oe,fe=le.openAnimation,pe=le.openTransitionName,Le=xe.switchingModeFromInline;if(Z)return Z;if(Object(z.a)(fe)==="object"&&fe)Object(Ui.a)(!1,"Object type of `openAnimation` is removed. Please use `motion` instead.");else if(typeof fe=="string")return{motionName:"".concat(ce,"-open-").concat(fe)};if(pe)return{motionName:pe};var Ce=q[Ae];return Ce||(Le?null:q.other)}var Mt=function(le){Object(p.a)(Ae,le);var xe=Object(c.a)(Ae);function Ae(ce){var Z;Object(k.a)(this,Ae),Z=xe.call(this,ce),Z.onSelect=function(fe){var pe=Object(h.a)(Z),Le=pe.props;if(Le.selectable){var Ce=Z.store.getState(),De=Ce.selectedKeys,Be=fe.key;Le.multiple?De=De.concat([Be]):De=[Be],"selectedKeys"in Le||Z.store.setState({selectedKeys:De}),Le.onSelect(Object(K.a)(Object(K.a)({},fe),{},{selectedKeys:De}))}},Z.onClick=function(fe){var pe=Z.getRealMenuMode(),Le=Object(h.a)(Z),Ce=Le.store,De=Le.props.onOpenChange;pe!=="inline"&&!("openKeys"in Z.props)&&(Ce.setState({openKeys:[]}),De([])),Z.props.onClick(fe)},Z.onKeyDown=function(fe,pe){Z.innerMenu.getWrappedInstance().onKeyDown(fe,pe)},Z.onOpenChange=function(fe){var pe=Object(h.a)(Z),Le=pe.props,Ce=Z.store.getState().openKeys.concat(),De=!1,Be=function(qe){var ut=!1;if(qe.open)ut=Ce.indexOf(qe.key)===-1,ut&&Ce.push(qe.key);else{var Wt=Ce.indexOf(qe.key);ut=Wt!==-1,ut&&Ce.splice(Wt,1)}De=De||ut};Array.isArray(fe)?fe.forEach(Be):Be(fe),De&&("openKeys"in Z.props||Z.store.setState({openKeys:Ce}),Le.onOpenChange(Ce))},Z.onDeselect=function(fe){var pe=Object(h.a)(Z),Le=pe.props;if(Le.selectable){var Ce=Z.store.getState().selectedKeys.concat(),De=fe.key,Be=Ce.indexOf(De);Be!==-1&&Ce.splice(Be,1),"selectedKeys"in Le||Z.store.setState({selectedKeys:Ce}),Le.onDeselect(Object(K.a)(Object(K.a)({},fe),{},{selectedKeys:Ce}))}},Z.onMouseEnter=function(fe){Z.restoreModeVerticalFromInline();var pe=Z.props.onMouseEnter;pe&&pe(fe)},Z.onTransitionEnd=function(fe){var pe=fe.propertyName==="width"&&fe.target===fe.currentTarget,Le=fe.target.className,Ce=Object.prototype.toString.call(Le)==="[object SVGAnimatedString]"?Le.animVal:Le,De=fe.propertyName==="font-size"&&Ce.indexOf("anticon")>=0;(pe||De)&&Z.restoreModeVerticalFromInline()},Z.setInnerMenu=function(fe){Z.innerMenu=fe},Z.isRootMenu=!0;var oe=ce.defaultSelectedKeys,q=ce.defaultOpenKeys;return"selectedKeys"in ce&&(oe=ce.selectedKeys||[]),"openKeys"in ce&&(q=ce.openKeys||[]),Z.store=Object(o.c)({selectedKeys:oe,openKeys:q,activeKey:{"0-menu-":Wn(ce,ce.activeKey)}}),Z.state={switchingModeFromInline:!1,prevProps:ce,inlineOpenKeys:[],store:Z.store},Z}return Object(b.a)(Ae,[{key:"componentDidMount",value:function(){this.updateMiniStore(),this.updateMenuDisplay()}},{key:"componentDidUpdate",value:function(Z){var oe=this.props,q=oe.siderCollapsed,fe=oe.inlineCollapsed,pe=oe.onOpenChange;(!Z.inlineCollapsed&&fe||!Z.siderCollapsed&&q)&&pe([]),this.updateMiniStore(),this.updateMenuDisplay()}},{key:"updateMenuDisplay",value:function(){var Z=this.props.collapsedWidth,oe=this.store,q=this.prevOpenKeys,fe=this.getInlineCollapsed()&&(Z===0||Z==="0"||Z==="0px");fe?(this.prevOpenKeys=oe.getState().openKeys.concat(),this.store.setState({openKeys:[]})):q&&(this.store.setState({openKeys:q}),this.prevOpenKeys=null)}},{key:"getRealMenuMode",value:function(){var Z=this.props.mode,oe=this.state.switchingModeFromInline,q=this.getInlineCollapsed();return oe&&q?"inline":q?"vertical":Z}},{key:"getInlineCollapsed",value:function(){var Z=this.props,oe=Z.inlineCollapsed,q=Z.siderCollapsed;return q!==void 0?q:oe}},{key:"restoreModeVerticalFromInline",value:function(){var Z=this.state.switchingModeFromInline;Z&&this.setState({switchingModeFromInline:!1})}},{key:"updateMiniStore",value:function(){"selectedKeys"in this.props&&this.store.setState({selectedKeys:this.props.selectedKeys||[]}),"openKeys"in this.props&&this.store.setState({openKeys:this.props.openKeys||[]})}},{key:"render",value:function(){var Z=Object(K.a)({},Object(S.a)(this.props,["collapsedWidth","siderCollapsed","defaultMotions"])),oe=this.getRealMenuMode();return Z.className+=" ".concat(Z.prefixCls,"-root"),Z.direction==="rtl"&&(Z.className+=" ".concat(Z.prefixCls,"-rtl")),Z=Object(K.a)(Object(K.a)({},Z),{},{mode:oe,onClick:this.onClick,onOpenChange:this.onOpenChange,onDeselect:this.onDeselect,onSelect:this.onSelect,onMouseEnter:this.onMouseEnter,onTransitionEnd:this.onTransitionEnd,parentMenu:this,motion:Ba(this.props,this.state,oe)}),delete Z.openAnimation,delete Z.openTransitionName,w.createElement(o.a,{store:this.store},w.createElement(ua,Object(m.a)({},Z,{ref:this.setInnerMenu}),this.props.children))}}],[{key:"getDerivedStateFromProps",value:function(Z,oe){var q=oe.prevProps,fe=oe.store,pe=fe.getState(),Le={},Ce={prevProps:Z};return q.mode==="inline"&&Z.mode!=="inline"&&(Ce.switchingModeFromInline=!0),"openKeys"in Z?Le.openKeys=Z.openKeys||[]:((Z.inlineCollapsed&&!q.inlineCollapsed||Z.siderCollapsed&&!q.siderCollapsed)&&(Ce.switchingModeFromInline=!0,Ce.inlineOpenKeys=pe.openKeys,Le.openKeys=[]),(!Z.inlineCollapsed&&q.inlineCollapsed||!Z.siderCollapsed&&q.siderCollapsed)&&(Le.openKeys=oe.inlineOpenKeys,Ce.inlineOpenKeys=[])),Object.keys(Le).length&&fe.setState(Le),Ce}}]),Ae}(w.Component);Mt.defaultProps={selectable:!0,onClick:at,onSelect:at,onOpenChange:at,onDeselect:at,defaultSelectedKeys:[],defaultOpenKeys:[],subMenuOpenDelay:.1,subMenuCloseDelay:.1,triggerSubMenuAction:"hover",prefixCls:"rc-menu",className:"",mode:"vertical",style:{},builtinPlacements:{},overflowedIndicator:w.createElement("span",null,"\xB7\xB7\xB7")};var zt=Mt,Pt=function(le){Object(p.a)(Ae,le);var xe=Object(c.a)(Ae);function Ae(){var ce;return Object(k.a)(this,Ae),ce=xe.apply(this,arguments),ce.onKeyDown=function(Z){var oe=Z.keyCode;return oe===g.a.ENTER?(ce.onClick(Z),!0):void 0},ce.onMouseLeave=function(Z){var oe=ce.props,q=oe.eventKey,fe=oe.onItemHover,pe=oe.onMouseLeave;fe({key:q,hover:!1}),pe({key:q,domEvent:Z})},ce.onMouseEnter=function(Z){var oe=ce.props,q=oe.eventKey,fe=oe.onItemHover,pe=oe.onMouseEnter;fe({key:q,hover:!0}),pe({key:q,domEvent:Z})},ce.onClick=function(Z){var oe=ce.props,q=oe.eventKey,fe=oe.multiple,pe=oe.onClick,Le=oe.onSelect,Ce=oe.onDeselect,De=oe.isSelected,Be={key:q,keyPath:[q],item:Object(h.a)(ce),domEvent:Z};pe(Be),fe?De?Ce(Be):Le(Be):De||Le(Be)},ce.saveNode=function(Z){ce.node=Z},ce}return Object(b.a)(Ae,[{key:"componentDidMount",value:function(){this.callRef()}},{key:"componentDidUpdate",value:function(){this.callRef()}},{key:"componentWillUnmount",value:function(){var Z=this.props;Z.onDestroy&&Z.onDestroy(Z.eventKey)}},{key:"getPrefixCls",value:function(){return"".concat(this.props.rootPrefixCls,"-item")}},{key:"getActiveClassName",value:function(){return"".concat(this.getPrefixCls(),"-active")}},{key:"getSelectedClassName",value:function(){return"".concat(this.getPrefixCls(),"-selected")}},{key:"getDisabledClassName",value:function(){return"".concat(this.getPrefixCls(),"-disabled")}},{key:"callRef",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"render",value:function(){var Z,oe=Object(K.a)({},this.props),q=H()(this.getPrefixCls(),oe.className,(Z={},Object(ae.a)(Z,this.getActiveClassName(),!oe.disabled&&oe.active),Object(ae.a)(Z,this.getSelectedClassName(),oe.isSelected),Object(ae.a)(Z,this.getDisabledClassName(),oe.disabled),Z)),fe=Object(K.a)(Object(K.a)({},oe.attribute),{},{title:typeof oe.title=="string"?oe.title:void 0,className:q,role:oe.role||"menuitem","aria-disabled":oe.disabled});oe.role==="option"?fe=Object(K.a)(Object(K.a)({},fe),{},{role:"option","aria-selected":oe.isSelected}):(oe.role===null||oe.role==="none")&&(fe.role="none");var pe={onClick:oe.disabled?null:this.onClick,onMouseLeave:oe.disabled?null:this.onMouseLeave,onMouseEnter:oe.disabled?null:this.onMouseEnter},Le=Object(K.a)({},oe.style);oe.mode==="inline"&&(oe.direction==="rtl"?Le.paddingRight=oe.inlineIndent*oe.level:Le.paddingLeft=oe.inlineIndent*oe.level),ot.forEach(function(De){return delete oe[De]}),delete oe.direction;var Ce=this.props.itemIcon;return typeof this.props.itemIcon=="function"&&(Ce=w.createElement(this.props.itemIcon,this.props)),w.createElement("li",Object(m.a)({},Object(S.a)(oe,["onClick","onMouseEnter","onMouseLeave","onSelect"]),fe,pe,{style:Le,ref:this.saveNode}),oe.children,Ce)}}]),Ae}(w.Component);Pt.isMenuItem=!0,Pt.defaultProps={onSelect:at,onMouseEnter:at,onMouseLeave:at,manualRef:at};var er=Object(o.b)(function(le,xe){var Ae=le.activeKey,ce=le.selectedKeys,Z=xe.eventKey,oe=xe.subMenuKey;return{active:Ae[oe]===Z,isSelected:Array.isArray(ce)?ce.indexOf(Z)!==-1:ce===Z}})(Pt),hr=er,Cr=function(le){Object(p.a)(Ae,le);var xe=Object(c.a)(Ae);function Ae(){var ce;return Object(k.a)(this,Ae),ce=xe.apply(this,arguments),ce.renderInnerMenuItem=function(Z){var oe=ce.props,q=oe.renderMenuItem,fe=oe.index;return q(Z,fe,ce.props.subMenuKey)},ce}return Object(b.a)(Ae,[{key:"render",value:function(){var Z=Object(m.a)({},this.props),oe=Z.className,q=oe===void 0?"":oe,fe=Z.rootPrefixCls,pe="".concat(fe,"-item-group-title"),Le="".concat(fe,"-item-group-list"),Ce=Z.title,De=Z.children;return ot.forEach(function(Be){return delete Z[Be]}),delete Z.direction,w.createElement("li",Object(m.a)({},Z,{onClick:function(tt){return tt.stopPropagation()},className:"".concat(q," ").concat(fe,"-item-group")}),w.createElement("div",{className:pe,title:typeof Ce=="string"?Ce:void 0},Ce),w.createElement("ul",{className:Le},w.Children.map(De,this.renderInnerMenuItem)))}}]),Ae}(w.Component);Cr.isMenuItemGroup=!0,Cr.defaultProps={disabled:!0};var ur=Cr,Vr=function(xe){var Ae=xe.className,ce=xe.rootPrefixCls,Z=xe.style;return w.createElement("li",{className:"".concat(Ae," ").concat(ce,"-item-divider"),style:Z})};Vr.defaultProps={disabled:!0,className:"",style:{}};var Mn=Vr,ir=zt,gi=ie("eDIo");function br(le,xe){var Ae=le.prefixCls,ce=le.editable,Z=le.locale,oe=le.style;return!ce||ce.showAdd===!1?null:w.createElement("button",{ref:xe,type:"button",className:"".concat(Ae,"-nav-add"),style:oe,"aria-label":(Z==null?void 0:Z.addAriaLabel)||"Add tab",onClick:function(fe){ce.onEdit("add",{event:fe})}},ce.addIcon||"+")}var Cn=w.forwardRef(br);function yn(le,xe){var Ae=le.prefixCls,ce=le.id,Z=le.tabs,oe=le.locale,q=le.mobile,fe=le.moreIcon,pe=fe===void 0?"More":fe,Le=le.moreTransitionName,Ce=le.style,De=le.className,Be=le.editable,tt=le.tabBarGutter,qe=le.rtl,ut=le.onTabClick,Wt=Object(w.useState)(!1),Zt=Object(X.a)(Wt,2),Xt=Zt[0],Yt=Zt[1],Jt=Object(w.useState)(null),Qt=Object(X.a)(Jt,2),$t=Qt[0],dr=Qt[1],ar="".concat(ce,"-more-popup"),Nr="".concat(Ae,"-dropdown"),or=$t!==null?"".concat(ar,"-").concat($t):null,Bt=oe==null?void 0:oe.dropdownAriaLabel,Nt=w.createElement(ir,{onClick:function(Lr){var wr=Lr.key,Yr=Lr.domEvent;ut(wr,Yr),Yt(!1)},id:ar,tabIndex:-1,role:"listbox","aria-activedescendant":or,selectedKeys:[$t],"aria-label":Bt!==void 0?Bt:"expanded dropdown"},Z.map(function(yr){return w.createElement(hr,{key:yr.key,id:"".concat(ar,"-").concat(yr.key),role:"option","aria-controls":ce&&"".concat(ce,"-panel-").concat(yr.key),disabled:yr.disabled},yr.tab)}));function sr(yr){for(var Lr=Z.filter(function(On){return!On.disabled}),wr=Lr.findIndex(function(On){return On.key===$t})||0,Yr=Lr.length,un=0;un<Yr;un+=1){wr=(wr+yr+Yr)%Yr;var jr=Lr[wr];if(!jr.disabled){dr(jr.key);return}}}function cr(yr){var Lr=yr.which;if(!Xt){[g.a.DOWN,g.a.SPACE,g.a.ENTER].includes(Lr)&&(Yt(!0),yr.preventDefault());return}switch(Lr){case g.a.UP:sr(-1),yr.preventDefault();break;case g.a.DOWN:sr(1),yr.preventDefault();break;case g.a.ESC:Yt(!1);break;case g.a.SPACE:case g.a.ENTER:$t!==null&&ut($t,yr);break}}Object(w.useEffect)(function(){var yr=document.getElementById(or);yr&&yr.scrollIntoView&&yr.scrollIntoView(!1)},[$t]),Object(w.useEffect)(function(){Xt||dr(null)},[Xt]);var Dt=Object(ae.a)({},qe?"marginLeft":"marginRight",tt);Z.length||(Dt.visibility="hidden",Dt.order=1);var fr=H()(Object(ae.a)({},"".concat(Nr,"-rtl"),qe)),Ur=q?null:w.createElement(gi.a,{prefixCls:Nr,overlay:Nt,trigger:["hover"],visible:Xt,transitionName:Le,onVisibleChange:Yt,overlayClassName:fr,mouseEnterDelay:.1,mouseLeaveDelay:.1},w.createElement("button",{type:"button",className:"".concat(Ae,"-nav-more"),style:Dt,tabIndex:-1,"aria-hidden":"true","aria-haspopup":"listbox","aria-controls":ar,id:"".concat(ce,"-more"),"aria-expanded":Xt,onKeyDown:cr},pe));return w.createElement("div",{className:H()("".concat(Ae,"-nav-operations"),De),style:Ce,ref:xe},Ur,w.createElement(Cn,{prefixCls:Ae,locale:oe,editable:Be}))}var Yn=w.forwardRef(yn),Fa=Object(w.createContext)(null),Ko=.1,Yi=.01,Xr=20,go=Math.pow(.995,Xr);function vo(){var le=navigator.userAgent||navigator.vendor||window.opera;return!!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(le)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(le.substr(0,4)))}function da(le,xe){var Ae=Object(w.useState)(),ce=Object(X.a)(Ae,2),Z=ce[0],oe=ce[1],q=Object(w.useState)(0),fe=Object(X.a)(q,2),pe=fe[0],Le=fe[1],Ce=Object(w.useState)(0),De=Object(X.a)(Ce,2),Be=De[0],tt=De[1],qe=Object(w.useState)(),ut=Object(X.a)(qe,2),Wt=ut[0],Zt=ut[1],Xt=Object(w.useRef)();function Yt(Bt){var Nt=Bt.touches[0],sr=Nt.screenX,cr=Nt.screenY;oe({x:sr,y:cr}),window.clearInterval(Xt.current)}function Jt(Bt){if(!Z)return;Bt.preventDefault();var Nt=Bt.touches[0],sr=Nt.screenX,cr=Nt.screenY;oe({x:sr,y:cr});var Dt=sr-Z.x,fr=cr-Z.y;xe(Dt,fr);var Ur=Date.now();Le(Ur),tt(Ur-pe),Zt({x:Dt,y:fr})}function Qt(){if(!Z)return;if(oe(null),Zt(null),Wt){var Bt=Wt.x/Be,Nt=Wt.y/Be,sr=Math.abs(Bt),cr=Math.abs(Nt);if(Math.max(sr,cr)<Ko)return;var Dt=Bt,fr=Nt;Xt.current=window.setInterval(function(){if(Math.abs(Dt)<Yi&&Math.abs(fr)<Yi){window.clearInterval(Xt.current);return}Dt*=go,fr*=go,xe(Dt*Xr,fr*Xr)},Xr)}}var $t=Object(w.useRef)(0),dr=Object(w.useRef)(!1),ar=Object(w.useRef)();function Nr(Bt){var Nt=Bt.deltaX,sr=Bt.deltaY,cr=0,Dt=Math.abs(Nt),fr=Math.abs(sr);Dt===fr?cr=ar.current==="x"?Nt:sr:Dt>fr?(cr=Nt,ar.current="x"):(cr=sr,ar.current="y");var Ur=Date.now();Ur-$t.current>100&&(dr.current=!1),(xe(-cr,-cr)||dr.current)&&(Bt.preventDefault(),dr.current=!0),$t.current=Ur}var or=Object(w.useRef)(null);or.current={onTouchStart:Yt,onTouchMove:Jt,onTouchEnd:Qt,onWheel:Nr},w.useEffect(function(){function Bt(Dt){or.current.onTouchStart(Dt)}function Nt(Dt){or.current.onTouchMove(Dt)}function sr(Dt){or.current.onTouchEnd(Dt)}function cr(Dt){or.current.onWheel(Dt)}return document.addEventListener("touchmove",Nt,{passive:!1}),document.addEventListener("touchend",sr,{passive:!1}),le.current.addEventListener("touchstart",Bt,{passive:!1}),le.current.addEventListener("wheel",cr),function(){document.removeEventListener("touchmove",Nt),document.removeEventListener("touchend",sr)}},[])}function zo(){var le=Object(w.useRef)(new Map);function xe(ce){return le.current.has(ce)||le.current.set(ce,w.createRef()),le.current.get(ce)}function Ae(ce){le.current.delete(ce)}return[xe,Ae]}function ja(le,xe){var Ae=w.useRef(le),ce=w.useState({}),Z=Object(X.a)(ce,2),oe=Z[1];function q(fe){var pe=typeof fe=="function"?fe(Ae.current):fe;pe!==Ae.current&&xe(pe,Ae.current),Ae.current=pe,oe({})}return[Ae.current,q]}var yo=function(xe){var Ae=xe.position,ce=xe.prefixCls,Z=xe.extra;if(!Z)return null;var oe,q=Z;return Ae==="right"&&(oe=q.right||!q.left&&q||null),Ae==="left"&&(oe=q.left||null),oe?w.createElement("div",{className:"".concat(ce,"-extra-content")},oe):null};function Wa(le,xe){var Ae,ce=w.useContext(Fa),Z=ce.prefixCls,oe=ce.tabs,q=le.className,fe=le.style,pe=le.id,Le=le.animated,Ce=le.activeKey,De=le.rtl,Be=le.extra,tt=le.editable,qe=le.locale,ut=le.tabPosition,Wt=le.tabBarGutter,Zt=le.children,Xt=le.onTabClick,Yt=le.onTabScroll,Jt=Object(w.useRef)(),Qt=Object(w.useRef)(),$t=Object(w.useRef)(),dr=Object(w.useRef)(),ar=zo(),Nr=Object(X.a)(ar,2),or=Nr[0],Bt=Nr[1],Nt=ut==="top"||ut==="bottom",sr=ja(0,function(Er,lr){Nt&&Yt&&Yt({direction:Er>lr?"left":"right"})}),cr=Object(X.a)(sr,2),Dt=cr[0],fr=cr[1],Ur=ja(0,function(Er,lr){!Nt&&Yt&&Yt({direction:Er>lr?"top":"bottom"})}),yr=Object(X.a)(Ur,2),Lr=yr[0],wr=yr[1],Yr=Object(w.useState)(0),un=Object(X.a)(Yr,2),jr=un[0],On=un[1],ti=Object(w.useState)(0),_n=Object(X.a)(ti,2),dn=_n[0],_r=_n[1],Or=Object(w.useState)(0),Wr=Object(X.a)(Or,2),Br=Wr[0],ri=Wr[1],Ai=Object(w.useState)(0),Li=Object(X.a)(Ai,2),Ar=Li[0],di=Li[1],Oi=Object(w.useState)(null),Mr=Object(X.a)(Oi,2),Tr=Mr[0],cn=Mr[1],Eo=Object(w.useState)(null),Ga=Object(X.a)(Eo,2),ki=Ga[0],Qi=Ga[1],ya=Object(w.useState)(0),Va=Object(X.a)(ya,2),ba=Va[0],Xo=Va[1],Yo=Object(w.useState)(0),So=Object(X.a)(Yo,2),Xa=So[0],Ya=So[1],Zi=L(new Map),Ji=Object(X.a)(Zi,2),$o=Ji[0],xa=Ji[1],ca=d(oe,$o,jr),qi="".concat(Z,"-nav-operations-hidden"),ea=0,ni=0;Nt?De?(ea=0,ni=Math.max(0,jr-Tr)):(ea=Math.min(0,Tr-jr),ni=0):(ea=Math.min(0,ki-dn),ni=0);function Bi(Er){return Er<ea?[ea,!1]:Er>ni?[ni,!1]:[Er,!0]}var Di=Object(w.useRef)(),ha=Object(w.useState)(),Fi=Object(X.a)(ha,2),Ea=Fi[0],$a=Fi[1];function Sa(){$a(Date.now())}function Qa(){window.clearTimeout(Di.current)}da(Jt,function(Er,lr){var hn=!1;function Pn(ta,yi){ta(function(ma){var _i=Bi(ma+yi),fn=Object(X.a)(_i,2),wa=fn[0],Ja=fn[1];return hn=Ja,wa})}if(Nt){if(Tr>=jr)return hn;Pn(fr,Er)}else{if(ki>=dn)return hn;Pn(wr,lr)}return Qa(),Sa(),hn}),Object(w.useEffect)(function(){return Qa(),Ea&&(Di.current=window.setTimeout(function(){$a(0)},100)),Qa},[Ea]);function Mi(){var Er=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ce,lr=ca.get(Er);if(!lr)return;if(Nt){var hn=Dt;De?lr.right<Dt?hn=lr.right:lr.right+lr.width>Dt+Tr&&(hn=lr.right+lr.width-Tr):lr.left<-Dt?hn=-lr.left:lr.left+lr.width>-Dt+Tr&&(hn=-(lr.left+lr.width-Tr)),wr(0),fr(Bi(hn)[0])}else{var Pn=Lr;lr.top<-Lr?Pn=-lr.top:lr.top+lr.height>-Lr+ki&&(Pn=-(lr.top+lr.height-ki)),fr(0),wr(Bi(Pn)[0])}}var ji=v(ca,{width:Tr,height:ki,left:Dt,top:Lr},{width:Br,height:Ar},{width:ba,height:Xa},Object(K.a)(Object(K.a)({},le),{},{tabs:oe})),Co=Object(X.a)(ji,2),Qo=Co[0],Zo=Co[1],Jo=oe.map(function(Er){var lr=Er.key;return w.createElement(a,{id:pe,prefixCls:Z,key:lr,rtl:De,tab:Er,closable:Er.closable,editable:tt,active:lr===Ce,tabPosition:ut,tabBarGutter:Wt,renderWrapper:Zt,removeAriaLabel:qe==null?void 0:qe.removeAriaLabel,ref:or(lr),onClick:function(Pn){Xt(lr,Pn)},onRemove:function(){Bt(lr)},onFocus:function(){Mi(lr),Sa(),De||(Jt.current.scrollLeft=0),Jt.current.scrollTop=0}})}),Za=O(function(){var Er,lr,hn,Pn,ta,yi,ma,_i,fn,wa=((Er=Jt.current)===null||Er===void 0?void 0:Er.offsetWidth)||0,Ja=((lr=Jt.current)===null||lr===void 0?void 0:lr.offsetHeight)||0,qa=((hn=dr.current)===null||hn===void 0?void 0:hn.offsetWidth)||0,In=((Pn=dr.current)===null||Pn===void 0?void 0:Pn.offsetHeight)||0,xr=((ta=$t.current)===null||ta===void 0?void 0:ta.offsetWidth)||0,ai=((yi=$t.current)===null||yi===void 0?void 0:yi.offsetHeight)||0;cn(wa),Qi(Ja),Xo(qa),Ya(In);var bi=(((ma=Qt.current)===null||ma===void 0?void 0:ma.offsetWidth)||0)-qa,xi=(((_i=Qt.current)===null||_i===void 0?void 0:_i.offsetHeight)||0)-In;On(bi),_r(xi);var eo=(fn=$t.current)===null||fn===void 0?void 0:fn.className.includes(qi);ri(bi-(eo?0:xr)),di(xi-(eo?0:ai)),xa(function(){var Aa=new Map;return oe.forEach(function(Oo){var ko=Oo.key,Hi=or(ko).current;Hi&&Aa.set(ko,{width:Hi.offsetWidth,height:Hi.offsetHeight,left:Hi.offsetLeft,top:Hi.offsetTop})}),Aa})}),qo=oe.slice(0,Qo),Rn=oe.slice(Zo+1),Zr=[].concat(Object(_.a)(qo),Object(_.a)(Rn)),Tn=Object(w.useState)(),Jr=Object(X.a)(Tn,2),fa=Jr[0],es=Jr[1],ii=ca.get(Ce),To=Object(w.useRef)();function wo(){A.a.cancel(To.current)}Object(w.useEffect)(function(){var Er={};return ii&&(Nt?(De?Er.right=ii.right:Er.left=ii.left,Er.width=ii.width):(Er.top=ii.top,Er.height=ii.height)),wo(),To.current=A()(function(){es(Er)}),wo},[ii,Nt,De]),Object(w.useEffect)(function(){Mi()},[Ce,ii,ca,Nt]),Object(w.useEffect)(function(){Za()},[De,Wt,Ce,oe.map(function(Er){return Er.key}).join("_")]);var Ao=!!Zr.length,Wi="".concat(Z,"-nav-wrap"),Ca,pa,Lo,Ta;return Nt?De?(pa=Dt>0,Ca=Dt+Tr<jr):(Ca=Dt<0,pa=-Dt+Tr<jr):(Lo=Lr<0,Ta=-Lr+ki<dn),w.createElement("div",{ref:xe,role:"tablist",className:H()("".concat(Z,"-nav"),q),style:fe,onKeyDown:function(){Sa()}},w.createElement(yo,{position:"left",extra:Be,prefixCls:Z}),w.createElement(M.a,{onResize:Za},w.createElement("div",{className:H()(Wi,(Ae={},Object(ae.a)(Ae,"".concat(Wi,"-ping-left"),Ca),Object(ae.a)(Ae,"".concat(Wi,"-ping-right"),pa),Object(ae.a)(Ae,"".concat(Wi,"-ping-top"),Lo),Object(ae.a)(Ae,"".concat(Wi,"-ping-bottom"),Ta),Ae)),ref:Jt},w.createElement(M.a,{onResize:Za},w.createElement("div",{ref:Qt,className:"".concat(Z,"-nav-list"),style:{transform:"translate(".concat(Dt,"px, ").concat(Lr,"px)"),transition:Ea?"none":void 0}},Jo,w.createElement(Cn,{ref:dr,prefixCls:Z,locale:qe,editable:tt,style:{visibility:Ao?"hidden":null}}),w.createElement("div",{className:H()("".concat(Z,"-ink-bar"),Object(ae.a)({},"".concat(Z,"-ink-bar-animated"),Le.inkBar)),style:fa}))))),w.createElement(Yn,Object.assign({},le,{ref:$t,prefixCls:Z,tabs:Zr,className:!Ao&&qi})),w.createElement(yo,{position:"right",extra:Be,prefixCls:Z}))}var Ha=w.forwardRef(Wa);function Go(le){var xe=le.id,Ae=le.activeKey,ce=le.animated,Z=le.tabPosition,oe=le.rtl,q=le.destroyInactiveTabPane,fe=w.useContext(Fa),pe=fe.prefixCls,Le=fe.tabs,Ce=ce.tabPane,De=Le.findIndex(function(Be){return Be.key===Ae});return w.createElement("div",{className:H()("".concat(pe,"-content-holder"))},w.createElement("div",{className:H()("".concat(pe,"-content"),"".concat(pe,"-content-").concat(Z),Object(ae.a)({},"".concat(pe,"-content-animated"),Ce)),style:De&&Ce?Object(ae.a)({},oe?"marginRight":"marginLeft","-".concat(De,"00%")):null},Le.map(function(Be){return w.cloneElement(Be.node,{key:Be.key,prefixCls:pe,tabKey:Be.key,id:xe,animated:Ce,active:Be.key===Ae,destroyInactiveTabPane:q})})))}function bo(le){var xe=le.prefixCls,Ae=le.forceRender,ce=le.className,Z=le.style,oe=le.id,q=le.active,fe=le.animated,pe=le.destroyInactiveTabPane,Le=le.tabKey,Ce=le.children,De=w.useState(Ae),Be=Object(X.a)(De,2),tt=Be[0],qe=Be[1];w.useEffect(function(){q?qe(!0):pe&&qe(!1)},[q,pe]);var ut={};return q||(fe?(ut.visibility="hidden",ut.height=0,ut.overflowY="hidden"):ut.display="none"),w.createElement("div",{id:oe&&"".concat(oe,"-panel-").concat(Le),role:"tabpanel",tabIndex:q?0:-1,"aria-labelledby":oe&&"".concat(oe,"-tab-").concat(Le),"aria-hidden":!q,style:Object(K.a)(Object(K.a)({},ut),Z),className:H()("".concat(xe,"-tabpane"),q&&"".concat(xe,"-tabpane-active"),ce)},(q||tt||Ae)&&Ce)}var Ka=0;function xo(le){return Object(B.a)(le).map(function(xe){if(w.isValidElement(xe)){var Ae=xe.key!==void 0?String(xe.key):void 0;return Object(K.a)(Object(K.a)({key:Ae},xe.props),{},{node:xe})}return null}).filter(function(xe){return xe})}function Vo(le,xe){var Ae,ce=le.id,Z=le.prefixCls,oe=Z===void 0?"rc-tabs":Z,q=le.className,fe=le.children,pe=le.direction,Le=le.activeKey,Ce=le.defaultActiveKey,De=le.editable,Be=le.animated,tt=le.tabPosition,qe=tt===void 0?"top":tt,ut=le.tabBarGutter,Wt=le.tabBarStyle,Zt=le.tabBarExtraContent,Xt=le.locale,Yt=le.moreIcon,Jt=le.moreTransitionName,Qt=le.destroyInactiveTabPane,$t=le.renderTabBar,dr=le.onChange,ar=le.onTabClick,Nr=le.onTabScroll,or=Object(D.a)(le,["id","prefixCls","className","children","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","moreIcon","moreTransitionName","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll"]),Bt=xo(fe),Nt=pe==="rtl",sr;Be===!1?sr={inkBar:!1,tabPane:!1}:sr=Object(K.a)({inkBar:!0,tabPane:!1},Be!==!0?Be:null);var cr=Object(w.useState)(!1),Dt=Object(X.a)(cr,2),fr=Dt[0],Ur=Dt[1];Object(w.useEffect)(function(){Ur(vo())},[]);var yr=Object(I.a)(function(){var Ar;return(Ar=Bt[0])===null||Ar===void 0?void 0:Ar.key},{value:Le,defaultValue:Ce}),Lr=Object(X.a)(yr,2),wr=Lr[0],Yr=Lr[1],un=Object(w.useState)(function(){return Bt.findIndex(function(Ar){return Ar.key===wr})}),jr=Object(X.a)(un,2),On=jr[0],ti=jr[1];Object(w.useEffect)(function(){var Ar=Bt.findIndex(function(Oi){return Oi.key===wr});if(Ar===-1){var di;Ar=Math.max(0,Math.min(On,Bt.length-1)),Yr((di=Bt[Ar])===null||di===void 0?void 0:di.key)}ti(Ar)},[Bt.map(function(Ar){return Ar.key}).join("_"),wr,On]);var _n=Object(I.a)(null,{value:ce}),dn=Object(X.a)(_n,2),_r=dn[0],Or=dn[1],Wr=qe;fr&&!["left","right"].includes(qe)&&(Wr="top"),Object(w.useEffect)(function(){ce||(Or("rc-tabs-".concat(Ka)),Ka+=1)},[]);function Br(Ar,di){ar==null||ar(Ar,di),Yr(Ar),dr==null||dr(Ar)}var ri={id:_r,activeKey:wr,animated:sr,tabPosition:Wr,rtl:Nt,mobile:fr},Ai,Li=Object(K.a)(Object(K.a)({},ri),{},{editable:De,locale:Xt,moreIcon:Yt,moreTransitionName:Jt,tabBarGutter:ut,onTabClick:Br,onTabScroll:Nr,extra:Zt,style:Wt,panes:fe});return $t?Ai=$t(Li,Ha):Ai=w.createElement(Ha,Object.assign({},Li)),w.createElement(Fa.Provider,{value:{tabs:Bt,prefixCls:oe}},w.createElement("div",Object.assign({ref:xe,id:ce,className:H()(oe,"".concat(oe,"-").concat(Wr),(Ae={},Object(ae.a)(Ae,"".concat(oe,"-mobile"),fr),Object(ae.a)(Ae,"".concat(oe,"-editable"),De),Object(ae.a)(Ae,"".concat(oe,"-rtl"),Nt),Ae),q)},or),Ai,w.createElement(Go,Object.assign({destroyInactiveTabPane:Qt},ri,{animated:sr}))))}var $i=w.forwardRef(Vo);$i.TabPane=bo;var vi=$i,za=gt.b=vi},kSUc:function(Ft,gt,ie){},lZu9:function(Ft,gt,ie){(function(ae){ae(ie("VrN/"),ie("1eCo"),ie("8EBN"))})(function(ae){"use strict";ae.defineMode("markdown",function(X,D){var K=ae.getMode(X,"text/html"),w=K.name=="null";function P(G){if(ae.findModeByName){var W=ae.findModeByName(G);W&&(G=W.mime||W.mimes[0])}var te=ae.getMode(X,G);return te.name=="null"?null:te}D.highlightFormatting===void 0&&(D.highlightFormatting=!1),D.maxBlockquoteDepth===void 0&&(D.maxBlockquoteDepth=0),D.taskLists===void 0&&(D.taskLists=!1),D.strikethrough===void 0&&(D.strikethrough=!1),D.emoji===void 0&&(D.emoji=!1),D.fencedCodeBlockHighlighting===void 0&&(D.fencedCodeBlockHighlighting=!0),D.fencedCodeBlockDefaultMode===void 0&&(D.fencedCodeBlockDefaultMode="text/plain"),D.xml===void 0&&(D.xml=!0),D.tokenTypeOverrides===void 0&&(D.tokenTypeOverrides={});var H={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 B in H)H.hasOwnProperty(B)&&D.tokenTypeOverrides[B]&&(H[B]=D.tokenTypeOverrides[B]);var I=/^([*\-_])(?:\s*\1){2,}\s*$/,_=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,x=/^\[(x| )\](?=\s)/i,A=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,M=/^ {0,3}(?:\={1,}|-{2,})\s*$/,O=/^[^#!\[\]*_\\<>` "'(~:]+/,L=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,g=/^\s*\[[^\]]+?\]:.*$/,u=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,a=" ";function l(G,W,te){return W.f=W.inline=te,te(G,W)}function d(G,W,te){return W.f=W.block=te,te(G,W)}function E(G){return!G||!/\S/.test(G.string)}function v(G){if(G.linkTitle=!1,G.linkHref=!1,G.linkText=!1,G.em=!1,G.strong=!1,G.strikethrough=!1,G.quote=0,G.indentedCode=!1,G.f==k){var W=w;if(!W){var te=ae.innerMode(K,G.htmlState);W=te.mode.name=="xml"&&te.state.tagStart===null&&!te.state.context&&te.state.tokenize.isInText}W&&(G.f=c,G.block=m,G.htmlState=null)}return G.trailingSpace=0,G.trailingSpaceNewLine=!1,G.prevLine=G.thisLine,G.thisLine={stream:null},null}function m(G,W){var te=G.column()===W.indentation,ue=E(W.prevLine.stream),be=W.indentedCode,Oe=W.prevLine.hr,Ke=W.list!==!1,_e=(W.listStack[W.listStack.length-1]||0)+3;W.indentedCode=!1;var Ie=W.indentation;if(W.indentationDiff===null&&(W.indentationDiff=W.indentation,Ke)){for(W.list=null;Ie<W.listStack[W.listStack.length-1];)W.listStack.pop(),W.listStack.length?W.indentation=W.listStack[W.listStack.length-1]:W.list=!1;W.list!==!1&&(W.indentationDiff=Ie-W.listStack[W.listStack.length-1])}var Ue=!ue&&!Oe&&!W.prevLine.header&&(!Ke||!be)&&!W.prevLine.fencedCodeEnd,Pe=(W.list===!1||Oe||ue)&&W.indentation<=_e&&G.match(I),Te=null;if(W.indentationDiff>=4&&(be||W.prevLine.fencedCodeEnd||W.prevLine.header||ue))return G.skipToEnd(),W.indentedCode=!0,H.code;if(G.eatSpace())return null;if(te&&W.indentation<=_e&&(Te=G.match(A))&&Te[1].length<=6)return W.quote=0,W.header=Te[1].length,W.thisLine.header=!0,D.highlightFormatting&&(W.formatting="header"),W.f=W.inline,h(W);if(W.indentation<=_e&&G.eat(">"))return W.quote=te?1:W.quote+1,D.highlightFormatting&&(W.formatting="quote"),G.eatSpace(),h(W);if(!Pe&&!W.setext&&te&&W.indentation<=_e&&(Te=G.match(_))){var se=Te[1]?"ol":"ul";return W.indentation=Ie+G.current().length,W.list=!0,W.quote=0,W.listStack.push(W.indentation),W.em=!1,W.strong=!1,W.code=!1,W.strikethrough=!1,D.taskLists&&G.match(x,!1)&&(W.taskList=!0),W.f=W.inline,D.highlightFormatting&&(W.formatting=["list","list-"+se]),h(W)}else{if(te&&W.indentation<=_e&&(Te=G.match(L,!0)))return W.quote=0,W.fencedEndRE=new RegExp(Te[1]+"+ *$"),W.localMode=D.fencedCodeBlockHighlighting&&P(Te[2]||D.fencedCodeBlockDefaultMode),W.localMode&&(W.localState=ae.startState(W.localMode)),W.f=W.block=b,D.highlightFormatting&&(W.formatting="code-block"),W.code=-1,h(W);if(W.setext||(!Ue||!Ke)&&!W.quote&&W.list===!1&&!W.code&&!Pe&&!g.test(G.string)&&(Te=G.lookAhead(1))&&(Te=Te.match(M)))return W.setext?(W.header=W.setext,W.setext=0,G.skipToEnd(),D.highlightFormatting&&(W.formatting="header")):(W.header=Te[0].charAt(0)=="="?1:2,W.setext=W.header),W.thisLine.header=!0,W.f=W.inline,h(W);if(Pe)return G.skipToEnd(),W.hr=!0,W.thisLine.hr=!0,H.hr;if(G.peek()==="[")return l(G,W,N)}return l(G,W,W.inline)}function k(G,W){var te=K.token(G,W.htmlState);if(!w){var ue=ae.innerMode(K,W.htmlState);(ue.mode.name=="xml"&&ue.state.tagStart===null&&!ue.state.context&&ue.state.tokenize.isInText||W.md_inside&&G.current().indexOf(">")>-1)&&(W.f=c,W.block=m,W.htmlState=null)}return te}function b(G,W){var te=W.listStack[W.listStack.length-1]||0,ue=W.indentation<te,be=te+3;if(W.fencedEndRE&&W.indentation<=be&&(ue||G.match(W.fencedEndRE))){D.highlightFormatting&&(W.formatting="code-block");var Oe;return ue||(Oe=h(W)),W.localMode=W.localState=null,W.block=m,W.f=c,W.fencedEndRE=null,W.code=0,W.thisLine.fencedCodeEnd=!0,ue?d(G,W,W.block):Oe}else return W.localMode?W.localMode.token(G,W.localState):(G.skipToEnd(),H.code)}function h(G){var W=[];if(G.formatting){W.push(H.formatting),typeof G.formatting=="string"&&(G.formatting=[G.formatting]);for(var te=0;te<G.formatting.length;te++)W.push(H.formatting+"-"+G.formatting[te]),G.formatting[te]==="header"&&W.push(H.formatting+"-"+G.formatting[te]+"-"+G.header),G.formatting[te]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=G.quote?W.push(H.formatting+"-"+G.formatting[te]+"-"+G.quote):W.push("error"))}if(G.taskOpen)return W.push("meta"),W.length?W.join(" "):null;if(G.taskClosed)return W.push("property"),W.length?W.join(" "):null;if(G.linkHref?W.push(H.linkHref,"url"):(G.strong&&W.push(H.strong),G.em&&W.push(H.em),G.strikethrough&&W.push(H.strikethrough),G.emoji&&W.push(H.emoji),G.linkText&&W.push(H.linkText),G.code&&W.push(H.code),G.image&&W.push(H.image),G.imageAltText&&W.push(H.imageAltText,"link"),G.imageMarker&&W.push(H.imageMarker)),G.header&&W.push(H.header,H.header+"-"+G.header),G.quote&&(W.push(H.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=G.quote?W.push(H.quote+"-"+G.quote):W.push(H.quote+"-"+D.maxBlockquoteDepth)),G.list!==!1){var ue=(G.listStack.length-1)%3;ue?ue===1?W.push(H.list2):W.push(H.list3):W.push(H.list1)}return G.trailingSpaceNewLine?W.push("trailing-space-new-line"):G.trailingSpace&&W.push("trailing-space-"+(G.trailingSpace%2?"a":"b")),W.length?W.join(" "):null}function p(G,W){return G.match(O,!0)?h(W):void 0}function c(G,W){var te=W.text(G,W);if(typeof te!="undefined")return te;if(W.list)return W.list=null,h(W);if(W.taskList){var ue=G.match(x,!0)[1]===" ";return ue?W.taskOpen=!0:W.taskClosed=!0,D.highlightFormatting&&(W.formatting="task"),W.taskList=!1,h(W)}if(W.taskOpen=!1,W.taskClosed=!1,W.header&&G.match(/^#+$/,!0))return D.highlightFormatting&&(W.formatting="header"),h(W);var be=G.next();if(W.linkTitle){W.linkTitle=!1;var Oe=be;be==="("&&(Oe=")"),Oe=(Oe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ke="^\\s*(?:[^"+Oe+"\\\\]+|\\\\\\\\|\\\\.)"+Oe;if(G.match(new RegExp(Ke),!0))return H.linkHref}if(be==="`"){var _e=W.formatting;D.highlightFormatting&&(W.formatting="code"),G.eatWhile("`");var Ie=G.current().length;if(W.code==0&&(!W.quote||Ie==1))return W.code=Ie,h(W);if(Ie==W.code){var Ue=h(W);return W.code=0,Ue}else return W.formatting=_e,h(W)}else if(W.code)return h(W);if(be==="\\"&&(G.next(),D.highlightFormatting)){var Pe=h(W),Te=H.formatting+"-escape";return Pe?Pe+" "+Te:Te}if(be==="!"&&G.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return W.imageMarker=!0,W.image=!0,D.highlightFormatting&&(W.formatting="image"),h(W);if(be==="["&&W.imageMarker&&G.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return W.imageMarker=!1,W.imageAltText=!0,D.highlightFormatting&&(W.formatting="image"),h(W);if(be==="]"&&W.imageAltText){D.highlightFormatting&&(W.formatting="image");var Pe=h(W);return W.imageAltText=!1,W.image=!1,W.inline=W.f=S,Pe}if(be==="["&&!W.image)return W.linkText&&G.match(/^.*?\]/)||(W.linkText=!0,D.highlightFormatting&&(W.formatting="link")),h(W);if(be==="]"&&W.linkText){D.highlightFormatting&&(W.formatting="link");var Pe=h(W);return W.linkText=!1,W.inline=W.f=G.match(/\(.*?\)| ?\[.*?\]/,!1)?S:c,Pe}if(be==="<"&&G.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){W.f=W.inline=o,D.highlightFormatting&&(W.formatting="link");var Pe=h(W);return Pe?Pe+=" ":Pe="",Pe+H.linkInline}if(be==="<"&&G.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){W.f=W.inline=o,D.highlightFormatting&&(W.formatting="link");var Pe=h(W);return Pe?Pe+=" ":Pe="",Pe+H.linkEmail}if(D.xml&&be==="<"&&G.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var se=G.string.indexOf(">",G.pos);if(se!=-1){var He=G.string.substring(G.start,se);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(He)&&(W.md_inside=!0)}return G.backUp(1),W.htmlState=ae.startState(K),d(G,W,k)}if(D.xml&&be==="<"&&G.match(/^\/\w*?>/))return W.md_inside=!1,"tag";if(be==="*"||be==="_"){for(var ht=1,it=G.pos==1?" ":G.string.charAt(G.pos-2);ht<3&&G.eat(be);)ht++;var at=G.peek()||" ",ft=!/\s/.test(at)&&(!u.test(at)||/\s/.test(it)||u.test(it)),je=!/\s/.test(it)&&(!u.test(it)||/\s/.test(at)||u.test(at)),Ye=null,rt=null;if(ht%2&&(!W.em&&ft&&(be==="*"||!je||u.test(it))?Ye=!0:W.em==be&&je&&(be==="*"||!ft||u.test(at))&&(Ye=!1)),ht>1&&(!W.strong&&ft&&(be==="*"||!je||u.test(it))?rt=!0:W.strong==be&&je&&(be==="*"||!ft||u.test(at))&&(rt=!1)),rt!=null||Ye!=null){D.highlightFormatting&&(W.formatting=Ye==null?"strong":rt==null?"em":"strong em"),Ye===!0&&(W.em=be),rt===!0&&(W.strong=be);var Ue=h(W);return Ye===!1&&(W.em=!1),rt===!1&&(W.strong=!1),Ue}}else if(be===" "&&(G.eat("*")||G.eat("_"))){if(G.peek()===" ")return h(W);G.backUp(1)}if(D.strikethrough){if(be==="~"&&G.eatWhile(be)){if(W.strikethrough){D.highlightFormatting&&(W.formatting="strikethrough");var Ue=h(W);return W.strikethrough=!1,Ue}else if(G.match(/^[^\s]/,!1))return W.strikethrough=!0,D.highlightFormatting&&(W.formatting="strikethrough"),h(W)}else if(be===" "&&G.match(/^~~/,!0)){if(G.peek()===" ")return h(W);G.backUp(2)}}if(D.emoji&&be===":"&&G.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){W.emoji=!0,D.highlightFormatting&&(W.formatting="emoji");var ot=h(W);return W.emoji=!1,ot}return be===" "&&(G.match(/^ +$/,!1)?W.trailingSpace++:W.trailingSpace&&(W.trailingSpaceNewLine=!0)),h(W)}function o(G,W){var te=G.next();if(te===">"){W.f=W.inline=c,D.highlightFormatting&&(W.formatting="link");var ue=h(W);return ue?ue+=" ":ue="",ue+H.linkInline}return G.match(/^[^>]+/,!0),H.linkInline}function S(G,W){if(G.eatSpace())return null;var te=G.next();return te==="("||te==="["?(W.f=W.inline=T(te==="("?")":"]"),D.highlightFormatting&&(W.formatting="link-string"),W.linkHref=!0,h(W)):"error"}var y={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function T(G){return function(W,te){var ue=W.next();if(ue===G){te.f=te.inline=c,D.highlightFormatting&&(te.formatting="link-string");var be=h(te);return te.linkHref=!1,be}return W.match(y[G]),te.linkHref=!0,h(te)}}function N(G,W){return G.match(/^([^\]\\]|\\.)*\]:/,!1)?(W.f=z,G.next(),D.highlightFormatting&&(W.formatting="link"),W.linkText=!0,h(W)):l(G,W,c)}function z(G,W){if(G.match(/^\]:/,!0)){W.f=W.inline=Y,D.highlightFormatting&&(W.formatting="link");var te=h(W);return W.linkText=!1,te}return G.match(/^([^\]\\]|\\.)+/,!0),H.linkText}function Y(G,W){return G.eatSpace()?null:(G.match(/^[^\s]+/,!0),G.peek()===void 0?W.linkTitle=!0:G.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),W.f=W.inline=c,H.linkHref+" url")}var ee={startState:function(){return{f:m,prevLine:{stream:null},thisLine:{stream:null},block:m,htmlState:null,indentation:0,inline:c,text:p,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(G){return{f:G.f,prevLine:G.prevLine,thisLine:G.thisLine,block:G.block,htmlState:G.htmlState&&ae.copyState(K,G.htmlState),indentation:G.indentation,localMode:G.localMode,localState:G.localMode?ae.copyState(G.localMode,G.localState):null,inline:G.inline,text:G.text,formatting:!1,linkText:G.linkText,linkTitle:G.linkTitle,linkHref:G.linkHref,code:G.code,em:G.em,strong:G.strong,strikethrough:G.strikethrough,emoji:G.emoji,header:G.header,setext:G.setext,hr:G.hr,taskList:G.taskList,list:G.list,listStack:G.listStack.slice(0),quote:G.quote,indentedCode:G.indentedCode,trailingSpace:G.trailingSpace,trailingSpaceNewLine:G.trailingSpaceNewLine,md_inside:G.md_inside,fencedEndRE:G.fencedEndRE}},token:function(G,W){if(W.formatting=!1,G!=W.thisLine.stream){if(W.header=0,W.hr=!1,G.match(/^\s*$/,!0))return v(W),null;if(W.prevLine=W.thisLine,W.thisLine={stream:G},W.taskList=!1,W.trailingSpace=0,W.trailingSpaceNewLine=!1,!W.localState&&(W.f=W.block,W.f!=k)){var te=G.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(W.indentation=te,W.indentationDiff=null,te>0)return null}}return W.f(G,W)},innerMode:function(G){return G.block==k?{state:G.htmlState,mode:K}:G.localState?{state:G.localState,mode:G.localMode}:{state:G,mode:ee}},indent:function(G,W,te){return G.block==k&&K.indent?K.indent(G.htmlState,W,te):G.localState&&G.localMode.indent?G.localMode.indent(G.localState,W,te):ae.Pass},blankLine:v,getType:h,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return ee},"xml"),ae.defineMIME("text/markdown","markdown"),ae.defineMIME("text/x-markdown","markdown")})},nuEh:function(Ft,gt,ie){"use strict";var ae=ie("T2oS"),X=ie("W9HT"),D=ie("q1tI"),K=ie.n(D),w=ie("F8wB"),P=ie.n(w),H=function(I){var _=I.loading;return _?K.a.createElement("div",{className:P.a.loading},K.a.createElement(X.a,null)):K.a.createElement(K.a.Fragment,null)};gt.a=H},osHv:function(Ft,gt,ie){(function(ae){ae(ie("VrN/"))})(function(ae){"use strict";var X=ae.Pos;function D(u,a){return u.line-a.line||u.ch-a.ch}var K="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",w=K+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",P=new RegExp("<(/?)(["+K+"]["+w+"]*)","g");function H(u,a,l,d){this.line=a,this.ch=l,this.cm=u,this.text=u.getLine(a),this.min=d?Math.max(d.from,u.firstLine()):u.firstLine(),this.max=d?Math.min(d.to-1,u.lastLine()):u.lastLine()}function B(u,a){var l=u.cm.getTokenTypeAt(X(u.line,a));return l&&/\btag\b/.test(l)}function I(u){return u.line>=u.max?void 0:(u.ch=0,u.text=u.cm.getLine(++u.line),!0)}function _(u){return u.line<=u.min?void 0:(u.text=u.cm.getLine(--u.line),u.ch=u.text.length,!0)}function x(u){for(;;){var a=u.text.indexOf(">",u.ch);if(a==-1){if(I(u))continue;return}if(!B(u,a+1)){u.ch=a+1;continue}var l=u.text.lastIndexOf("/",a),d=l>-1&&!/\S/.test(u.text.slice(l+1,a));return u.ch=a+1,d?"selfClose":"regular"}}function A(u){for(;;){var a=u.ch?u.text.lastIndexOf("<",u.ch-1):-1;if(a==-1){if(_(u))continue;return}if(!B(u,a+1)){u.ch=a;continue}P.lastIndex=a,u.ch=a;var l=P.exec(u.text);if(l&&l.index==a)return l}}function M(u){for(;;){P.lastIndex=u.ch;var a=P.exec(u.text);if(!a){if(I(u))continue;return}if(!B(u,a.index+1)){u.ch=a.index+1;continue}return u.ch=a.index+a[0].length,a}}function O(u){for(;;){var a=u.ch?u.text.lastIndexOf(">",u.ch-1):-1;if(a==-1){if(_(u))continue;return}if(!B(u,a+1)){u.ch=a;continue}var l=u.text.lastIndexOf("/",a),d=l>-1&&!/\S/.test(u.text.slice(l+1,a));return u.ch=a+1,d?"selfClose":"regular"}}function L(u,a){for(var l=[];;){var d=M(u),E,v=u.line,m=u.ch-(d?d[0].length:0);if(!d||!(E=x(u)))return;if(E=="selfClose")continue;if(d[1]){for(var k=l.length-1;k>=0;--k)if(l[k]==d[2]){l.length=k;break}if(k<0&&(!a||a==d[2]))return{tag:d[2],from:X(v,m),to:X(u.line,u.ch)}}else l.push(d[2])}}function g(u,a){for(var l=[];;){var d=O(u);if(!d)return;if(d=="selfClose"){A(u);continue}var E=u.line,v=u.ch,m=A(u);if(!m)return;if(m[1])l.push(m[2]);else{for(var k=l.length-1;k>=0;--k)if(l[k]==m[2]){l.length=k;break}if(k<0&&(!a||a==m[2]))return{tag:m[2],from:X(u.line,u.ch),to:X(E,v)}}}}ae.registerHelper("fold","xml",function(u,a){for(var l=new H(u,a.line,0);;){var d=M(l);if(!d||l.line!=a.line)return;var E=x(l);if(!E)return;if(!d[1]&&E!="selfClose"){var v=X(l.line,l.ch),m=L(l,d[2]);return m&&D(m.from,v)>0?{from:v,to:m.from}:null}}}),ae.findMatchingTag=function(u,a,l){var d=new H(u,a.line,a.ch,l);if(d.text.indexOf(">")==-1&&d.text.indexOf("<")==-1)return;var E=x(d),v=E&&X(d.line,d.ch),m=E&&A(d);if(!E||!m||D(d,a)>0)return;var k={from:X(d.line,d.ch),to:v,tag:m[2]};return E=="selfClose"?{open:k,close:null,at:"open"}:m[1]?{open:g(d,m[2]),close:k,at:"close"}:(d=new H(u,v.line,v.ch,l),{open:k,close:L(d,m[2]),at:"open"})},ae.findEnclosingTag=function(u,a,l,d){for(var E=new H(u,a.line,a.ch,l);;){var v=g(E,d);if(!v)break;var m=new H(u,a.line,a.ch,l),k=L(m,v.tag);if(k)return{open:v,close:k}}},ae.scanForClosingTag=function(u,a,l,d){var E=new H(u,a.line,a.ch,d?{from:0,to:d}:null);return L(E,l)}})},p5ED:function(Ft,gt,ie){"use strict";var ae=ie("+L6B"),X=ie("2/Rp"),D=ie("5Dmo"),K=ie("3S7+"),w=ie("k1fw"),P=ie("tJVT"),H=ie("q1tI"),B=ie.n(H),I=ie("vHTk"),_=ie.n(I),x=ie("yEEn"),A=ie("ZW9T"),M=ie("1vsH");gt.a=function(O){var L=O.name,g=O.data,u=O.theme,a=O.type,l=O.filename,d=O.monacoEditor,E=O.className,v=O.style,m=O.close,k=O.onClose,b=O.hasMask,h=Object(H.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),p=Object(P.a)(h,2),c=p[0],o=p[1],S=Object(H.useState)(""),y=Object(P.a)(S,2),T=y[0],N=y[1],z,Y=1024*1024,ee=10*Y,G=Object(H.useRef)();a==="office"&&(z=Object(M.T)(g).filesize,z>ee&&(a="other")),l&&(d.filename=l),Object(H.useEffect)(function(){var ue,be,Oe=(ue=document.cookie)===null||ue===void 0||((be=ue.replace(/\s/g,""))===null||be===void 0)?void 0:be.split(";");Oe==null||Oe.map(function(Ke){var _e=Ke.split("=");_e[0]==="_educoder_session"&&N(_e[1])})},[]);var W=function(){if(g.startsWith("http")||g.startsWith("/")){te();return}Object(M.z)(l||"educoder",g,l)},te=function(){Object(M.x)(l||L,g)};return console.log("data:",g,"fileanme:",l," name:",L),B.a.createElement("div",{style:Object(w.a)({},v||{}),className:"".concat(b&&_.a.bgBlack," ").concat(a?_.a.wrp:"hide")},m&&B.a.createElement("div",{className:_.a.close,ref:G},B.a.createElement(K.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return G.current}},B.a.createElement("span",{onClick:te},B.a.createElement("i",{className:"icon-quxiaozhiding"}))),B.a.createElement(K.a,{title:"\u5173\u95ED",getPopupContainer:function(){return G.current}},B.a.createElement("span",{className:"",onClick:k},B.a.createElement("i",{className:"icon-guanbi1"})))),B.a.createElement("div",{className:"".concat(_.a[E]," ").concat(E," ").concat(_.a.monaco," ").concat(a==="txt"?"show":"hide")},a==="txt"&&B.a.createElement(A.b,d)),a==="audio"&&B.a.createElement("audio",{src:"".concat(g!=null&&g.startsWith("/")||(g==null?void 0:g.indexOf("https://"))>-1?g:"data:audio/mp3;base64,").concat(g),autoPlay:!0}),a==="video"&&B.a.createElement(B.a.Fragment,null,g!=null&&g.startsWith("/")?B.a.createElement("video",{controls:!0,src:"".concat(g),autoPlay:!0}):B.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(g),autoPlay:!0})),a==="html"&&B.a.createElement("iframe",{src:g+"&disposition=inline"}),a==="pdf"&&B.a.createElement("embed",{className:_.a.embed,src:g}),a==="image"&&B.a.createElement(B.a.Fragment,null,B.a.createElement("img",{src:"".concat(g!=null&&g.startsWith("/")||(g==null?void 0:g.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(g)})),a==="other"&&B.a.createElement("div",null,B.a.createElement(X.a,{type:"primary",size:"large",onClick:W},B.a.createElement(x.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(a==="download"||a==="office")&&B.a.createElement(X.a,{type:"primary",size:"large",onClick:W},B.a.createElement(x.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(Ft,gt,ie){},rUJ1:function(Ft,gt){const ie=/[&<>"']/,ae=/[&<>"']/g,X=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,K={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},w=b=>K[b];function P(b,h){if(h){if(ie.test(b))return b.replace(ae,w)}else if(X.test(b))return b.replace(D,w);return b}const H=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function B(b){return b.replace(H,(h,p)=>(p=p.toLowerCase(),p==="colon"?":":p.charAt(0)==="#"?p.charAt(1)==="x"?String.fromCharCode(parseInt(p.substring(2),16)):String.fromCharCode(+p.substring(1)):""))}const I=/(^|[^\[])\^/g;function _(b,h){b=b.source||b,h=h||"";const p={replace:(c,o)=>(o=o.source||o,o=o.replace(I,"$1"),b=b.replace(c,o),p),getRegex:()=>new RegExp(b,h)};return p}const x=/[^\w:]/g,A=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function M(b,h,p){if(b){let c;try{c=decodeURIComponent(B(p)).replace(x,"").toLowerCase()}catch(o){return null}if(c.indexOf("javascript:")===0||c.indexOf("vbscript:")===0||c.indexOf("data:")===0)return null}h&&!A.test(p)&&(p=a(h,p));try{p=encodeURI(p).replace(/%25/g,"%")}catch(c){return null}return p}const O={},L=/^[^:]+:\/*[^/]*$/,g=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(b,h){O[" "+b]||(L.test(b)?O[" "+b]=b+"/":O[" "+b]=v(b,"/",!0)),b=O[" "+b];const p=b.indexOf(":")===-1;return h.substring(0,2)==="//"?p?h:b.replace(g,"$1")+h:h.charAt(0)==="/"?p?h:b.replace(u,"$1")+h:b+h}const l={exec:function(){}};function d(b){let h=1,p,c;for(;h<arguments.length;h++){p=arguments[h];for(c in p)Object.prototype.hasOwnProperty.call(p,c)&&(b[c]=p[c])}return b}function E(b,h){const p=b.replace(/\|/g,(S,y,T)=>{let N=!1,z=y;for(;--z>=0&&T[z]==="\\";)N=!N;return N?"|":" |"}),c=p.split(/ \|/);let o=0;if(c.length>h)c.splice(h);else for(;c.length<h;)c.push("");for(;o<c.length;o++)c[o]=c[o].trim().replace(/\\\|/g,"|");return c}function v(b,h,p){const c=b.length;if(c===0)return"";let o=0;for(;o<c;){const S=b.charAt(c-o-1);if(S===h&&!p)o++;else if(S!==h&&p)o++;else break}return b.substr(0,c-o)}function m(b,h){if(b.indexOf(h[1])===-1)return-1;const p=b.length;let c=0,o=0;for(;o<p;o++)if(b[o]==="\\")o++;else if(b[o]===h[0])c++;else if(b[o]===h[1]&&(c--,c<0))return o;return-1}function k(b){b&&b.sanitize&&!b.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}Ft.exports={escape:P,unescape:B,edit:_,cleanUrl:M,resolveUrl:a,noopTest:l,merge:d,splitCells:E,rtrim:v,findClosingBracket:m,checkSanitizeDeprecation:k}},t23M:function(Ft,gt,ie){"use strict";var ae=ie("VTBJ"),X=ie("1OyB"),D=ie("vuIU"),K=ie("Ji7U"),w=ie("LK+K"),P=ie("q1tI"),H=ie.n(P),B=ie("m+aA"),I=ie("Zm9Q"),_=ie("Kwbf"),x=ie("c+Xe"),A=ie("bdgK"),M="rc-observer-key",O=function(L){Object(K.a)(u,L);var g=Object(w.a)(u);function u(){var a;return Object(X.a)(this,u),a=g.apply(this,arguments),a.resizeObserver=null,a.childNode=null,a.currentElement=null,a.state={width:0,height:0,offsetHeight:0,offsetWidth:0},a.onResize=function(l){var d=a.props.onResize,E=l[0].target,v=E.getBoundingClientRect(),m=v.width,k=v.height,b=E.offsetWidth,h=E.offsetHeight,p=Math.floor(m),c=Math.floor(k);if(a.state.width!==p||a.state.height!==c||a.state.offsetWidth!==b||a.state.offsetHeight!==h){var o={width:p,height:c,offsetWidth:b,offsetHeight:h};a.setState(o),d&&Promise.resolve().then(function(){d(Object(ae.a)(Object(ae.a)({},o),{},{offsetWidth:b,offsetHeight:h}))})}},a.setChildNode=function(l){a.childNode=l},a}return Object(D.a)(u,[{key:"componentDidMount",value:function(){this.onComponentUpdated()}},{key:"componentDidUpdate",value:function(){this.onComponentUpdated()}},{key:"componentWillUnmount",value:function(){this.destroyObserver()}},{key:"onComponentUpdated",value:function(){var l=this.props.disabled;if(l){this.destroyObserver();return}var d=Object(B.a)(this.childNode||this),E=d!==this.currentElement;E&&(this.destroyObserver(),this.currentElement=d),!this.resizeObserver&&d&&(this.resizeObserver=new A.default(this.onResize),this.resizeObserver.observe(d))}},{key:"destroyObserver",value:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"render",value:function(){var l=this.props.children,d=Object(I.a)(l);if(d.length>1)Object(_.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(d.length===0)return Object(_.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var E=d[0];if(P.isValidElement(E)&&Object(x.c)(E)){var v=E.ref;d[0]=P.cloneElement(E,{ref:Object(x.a)(v,this.setChildNode)})}return d.length===1?d[0]:d.map(function(m,k){return!P.isValidElement(m)||"key"in m&&m.key!==null?m:P.cloneElement(m,{key:"".concat(M,"-").concat(k)})})}}]),u}(P.Component);O.displayName="ResizeObserver",gt.a=O},ulZh:function(Ft,gt,ie){typeof window!="undefined"&&function(X,D){Ft.exports=D()}(this,function(){return function(ae){var X={};function D(K){if(X[K])return X[K].exports;var w=X[K]={i:K,l:!1,exports:{}};return ae[K].call(w.exports,w,w.exports,D),w.l=!0,w.exports}return D.m=ae,D.c=X,D.d=function(K,w,P){D.o(K,w)||Object.defineProperty(K,w,{enumerable:!0,get:P})},D.r=function(K){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(K,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(K,"__esModule",{value:!0})},D.t=function(K,w){if(w&1&&(K=D(K)),w&8)return K;if(w&4&&typeof K=="object"&&K&&K.__esModule)return K;var P=Object.create(null);if(D.r(P),Object.defineProperty(P,"default",{enumerable:!0,value:K}),w&2&&typeof K!="string")for(var H in K)D.d(P,H,function(B){return K[B]}.bind(null,H));return P},D.n=function(K){var w=K&&K.__esModule?function(){return K.default}:function(){return K};return D.d(w,"a",w),w},D.o=function(K,w){return Object.prototype.hasOwnProperty.call(K,w)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ae,X,D){"use strict";var K=Object.prototype.hasOwnProperty,w="~";function P(){}Object.create&&(P.prototype=Object.create(null),new P().__proto__||(w=!1));function H(x,A,M){this.fn=x,this.context=A,this.once=M||!1}function B(x,A,M,O,L){if(typeof M!="function")throw new TypeError("The listener must be a function");var g=new H(M,O||x,L),u=w?w+A:A;return x._events[u]?x._events[u].fn?x._events[u]=[x._events[u],g]:x._events[u].push(g):(x._events[u]=g,x._eventsCount++),x}function I(x,A){--x._eventsCount===0?x._events=new P:delete x._events[A]}function _(){this._events=new P,this._eventsCount=0}_.prototype.eventNames=function(){var A=[],M,O;if(this._eventsCount===0)return A;for(O in M=this._events)K.call(M,O)&&A.push(w?O.slice(1):O);return Object.getOwnPropertySymbols?A.concat(Object.getOwnPropertySymbols(M)):A},_.prototype.listeners=function(A){var M=w?w+A:A,O=this._events[M];if(!O)return[];if(O.fn)return[O.fn];for(var L=0,g=O.length,u=new Array(g);L<g;L++)u[L]=O[L].fn;return u},_.prototype.listenerCount=function(A){var M=w?w+A:A,O=this._events[M];return O?O.fn?1:O.length:0},_.prototype.emit=function(A,M,O,L,g,u){var a=w?w+A:A;if(!this._events[a])return!1;var l=this._events[a],d=arguments.length,E,v;if(l.fn){l.once&&this.removeListener(A,l.fn,void 0,!0);switch(d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,M),!0;case 3:return l.fn.call(l.context,M,O),!0;case 4:return l.fn.call(l.context,M,O,L),!0;case 5:return l.fn.call(l.context,M,O,L,g),!0;case 6:return l.fn.call(l.context,M,O,L,g,u),!0}for(v=1,E=new Array(d-1);v<d;v++)E[v-1]=arguments[v];l.fn.apply(l.context,E)}else{var m=l.length,k;for(v=0;v<m;v++){l[v].once&&this.removeListener(A,l[v].fn,void 0,!0);switch(d){case 1:l[v].fn.call(l[v].context);break;case 2:l[v].fn.call(l[v].context,M);break;case 3:l[v].fn.call(l[v].context,M,O);break;case 4:l[v].fn.call(l[v].context,M,O,L);break;default:if(!E)for(k=1,E=new Array(d-1);k<d;k++)E[k-1]=arguments[k];l[v].fn.apply(l[v].context,E)}}}return!0},_.prototype.on=function(A,M,O){return B(this,A,M,O,!1)},_.prototype.once=function(A,M,O){return B(this,A,M,O,!0)},_.prototype.removeListener=function(A,M,O,L){var g=w?w+A:A;if(!this._events[g])return this;if(!M)return I(this,g),this;var u=this._events[g];if(u.fn)u.fn===M&&(!L||u.once)&&(!O||u.context===O)&&I(this,g);else{for(var a=0,l=[],d=u.length;a<d;a++)(u[a].fn!==M||L&&!u[a].once||O&&u[a].context!==O)&&l.push(u[a]);l.length?this._events[g]=l.length===1?l[0]:l:I(this,g)}return this},_.prototype.removeAllListeners=function(A){var M;return A?(M=w?w+A:A,this._events[M]&&I(this,M)):(this._events=new P,this._eventsCount=0),this},_.prototype.off=_.prototype.removeListener,_.prototype.addListener=_.prototype.on,_.prefixed=w,_.EventEmitter=_,ae.exports=_},"./node_modules/url-toolkit/src/url-toolkit.js":function(ae,X,D){(function(K){var w=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,P=/^([^\/?#]*)([^]*)$/,H=/(?:\/|^)\.(?=\/)/g,B=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,I={buildAbsoluteURL:function(_,x,A){if(A=A||{},_=_.trim(),x=x.trim(),!x){if(!A.alwaysNormalize)return _;var M=I.parseURL(_);if(!M)throw new Error("Error trying to parse base URL.");return M.path=I.normalizePath(M.path),I.buildURLFromParts(M)}var O=I.parseURL(x);if(!O)throw new Error("Error trying to parse relative URL.");if(O.scheme)return A.alwaysNormalize?(O.path=I.normalizePath(O.path),I.buildURLFromParts(O)):x;var L=I.parseURL(_);if(!L)throw new Error("Error trying to parse base URL.");if(!L.netLoc&&L.path&&L.path[0]!=="/"){var g=P.exec(L.path);L.netLoc=g[1],L.path=g[2]}L.netLoc&&!L.path&&(L.path="/");var u={scheme:L.scheme,netLoc:O.netLoc,path:null,params:O.params,query:O.query,fragment:O.fragment};if(!O.netLoc&&(u.netLoc=L.netLoc,O.path[0]!=="/"))if(!O.path)u.path=L.path,O.params||(u.params=L.params,O.query||(u.query=L.query));else{var a=L.path,l=a.substring(0,a.lastIndexOf("/")+1)+O.path;u.path=I.normalizePath(l)}return u.path===null&&(u.path=A.alwaysNormalize?I.normalizePath(O.path):O.path),I.buildURLFromParts(u)},parseURL:function(_){var x=w.exec(_);return x?{scheme:x[1]||"",netLoc:x[2]||"",path:x[3]||"",params:x[4]||"",query:x[5]||"",fragment:x[6]||""}:null},normalizePath:function(_){for(_=_.split("").reverse().join("").replace(H,"");_.length!==(_=_.replace(B,"")).length;);return _.split("").reverse().join("")},buildURLFromParts:function(_){return _.scheme+_.netLoc+_.path+_.params+_.query+_.fragment}};ae.exports=I})(this)},"./node_modules/webworkify-webpack/index.js":function(ae,X,D){function K(A){var M={};function O(g){if(M[g])return M[g].exports;var u=M[g]={i:g,l:!1,exports:{}};return A[g].call(u.exports,u,u.exports,O),u.l=!0,u.exports}O.m=A,O.c=M,O.i=function(g){return g},O.d=function(g,u,a){O.o(g,u)||Object.defineProperty(g,u,{configurable:!1,enumerable:!0,get:a})},O.r=function(g){Object.defineProperty(g,"__esModule",{value:!0})},O.n=function(g){var u=g&&g.__esModule?function(){return g.default}:function(){return g};return O.d(u,"a",u),u},O.o=function(g,u){return Object.prototype.hasOwnProperty.call(g,u)},O.p="/",O.oe=function(g){throw console.error(g),g};var L=O(O.s=ENTRY_MODULE);return L.default||L}var w="[\\.|\\-|\\+|\\w|/|@]+",P="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+w+").*?\\)";function H(A){return(A+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function B(A){return!isNaN(1*A)}function I(A,M,O){var L={};L[O]=[];var g=M.toString(),u=g.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!u)return L;for(var a=u[1],l=new RegExp("(\\\\n|\\W)"+H(a)+P,"g"),d;d=l.exec(g);){if(d[3]==="dll-reference")continue;L[O].push(d[3])}for(l=new RegExp("\\("+H(a)+'\\("(dll-reference\\s('+w+'))"\\)\\)'+P,"g");d=l.exec(g);)A[d[2]]||(L[O].push(d[1]),A[d[2]]=D(d[1]).m),L[d[2]]=L[d[2]]||[],L[d[2]].push(d[4]);for(var E=Object.keys(L),v=0;v<E.length;v++)for(var m=0;m<L[E[v]].length;m++)B(L[E[v]][m])&&(L[E[v]][m]=1*L[E[v]][m]);return L}function _(A){var M=Object.keys(A);return M.reduce(function(O,L){return O||A[L].length>0},!1)}function x(A,M){for(var O={main:[M]},L={main:[]},g={main:{}};_(O);)for(var u=Object.keys(O),a=0;a<u.length;a++){var l=u[a],d=O[l],E=d.pop();if(g[l]=g[l]||{},g[l][E]||!A[l][E])continue;g[l][E]=!0,L[l]=L[l]||[],L[l].push(E);for(var v=I(A,A[l][E],l),m=Object.keys(v),k=0;k<m.length;k++)O[m[k]]=O[m[k]]||[],O[m[k]]=O[m[k]].concat(v[m[k]])}return L}ae.exports=function(A,M){M=M||{};var O={main:D.m},L=M.all?{main:Object.keys(O.main)}:x(O,A),g="";Object.keys(L).filter(function(E){return E!=="main"}).forEach(function(E){for(var v=0;L[E][v];)v++;L[E].push(v),O[E][v]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",g=g+"var "+E+" = ("+K.toString().replace("ENTRY_MODULE",JSON.stringify(v))+")({"+L[E].map(function(m){return""+JSON.stringify(m)+": "+O[E][m].toString()}).join(",")+`});
`}),g=g+"new (("+K.toString().replace("ENTRY_MODULE",JSON.stringify(A))+")({"+L.main.map(function(E){return""+JSON.stringify(E)+": "+O.main[E].toString()}).join(",")+"}))(self);";var u=new window.Blob([g],{type:"text/javascript"});if(M.bare)return u;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,l=a.createObjectURL(u),d=new window.Worker(l);return d.objectURL=l,d}},"./src/config.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"hlsDefaultConfig",function(){return k}),D.d(X,"mergeConfig",function(){return h}),D.d(X,"enableStreamingMode",function(){return p});var K=D("./src/controller/abr-controller.ts"),w=D("./src/controller/audio-stream-controller.ts"),P=D("./src/controller/audio-track-controller.ts"),H=D("./src/controller/subtitle-stream-controller.ts"),B=D("./src/controller/subtitle-track-controller.ts"),I=D("./src/controller/buffer-controller.ts"),_=D("./src/controller/timeline-controller.ts"),x=D("./src/controller/cap-level-controller.ts"),A=D("./src/controller/fps-controller.ts"),M=D("./src/controller/eme-controller.ts"),O=D("./src/controller/cmcd-controller.ts"),L=D("./src/utils/xhr-loader.ts"),g=D("./src/utils/fetch-loader.ts"),u=D("./src/utils/cues.ts"),a=D("./src/utils/mediakeys-helper.ts"),l=D("./src/utils/logger.ts");function d(){return d=Object.assign||function(c){for(var o=1;o<arguments.length;o++){var S=arguments[o];for(var y in S)Object.prototype.hasOwnProperty.call(S,y)&&(c[y]=S[y])}return c},d.apply(this,arguments)}function E(c,o){var S=Object.keys(c);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(c);o&&(y=y.filter(function(T){return Object.getOwnPropertyDescriptor(c,T).enumerable})),S.push.apply(S,y)}return S}function v(c){for(var o=1;o<arguments.length;o++){var S=arguments[o]!=null?arguments[o]:{};o%2?E(Object(S),!0).forEach(function(y){m(c,y,S[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(S)):E(Object(S)).forEach(function(y){Object.defineProperty(c,y,Object.getOwnPropertyDescriptor(S,y))})}return c}function m(c,o,S){return o in c?Object.defineProperty(c,o,{value:S,enumerable:!0,configurable:!0,writable:!0}):c[o]=S,c}var k=v(v({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:L.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:K.default,bufferController:I.default,capLevelController:x.default,fpsController:A.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:a.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},b()),{},{subtitleStreamController:H.SubtitleStreamController,subtitleTrackController:B.default,timelineController:_.TimelineController,audioStreamController:w.default,audioTrackController:P.default,emeController:M.default,cmcdController:O.default});function b(){return{cueHandler:u.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function h(c,o){if((o.liveSyncDurationCount||o.liveMaxLatencyDurationCount)&&(o.liveSyncDuration||o.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(o.liveMaxLatencyDurationCount!==void 0&&(o.liveSyncDurationCount===void 0||o.liveMaxLatencyDurationCount<=o.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(o.liveMaxLatencyDuration!==void 0&&(o.liveSyncDuration===void 0||o.liveMaxLatencyDuration<=o.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return d({},c,o)}function p(c){var o=c.loader;if(o!==g.default&&o!==L.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),c.progressive=!1;else{var S=Object(g.fetchSupported)();S&&(c.loader=g.default,c.progressive=!0,c.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/polyfills/number.ts"),w=D("./src/utils/ewma-bandwidth-estimator.ts"),P=D("./src/events.ts"),H=D("./src/utils/buffer-helper.ts"),B=D("./src/errors.ts"),I=D("./src/types/loader.ts"),_=D("./src/utils/logger.ts");function x(O,L){for(var g=0;g<L.length;g++){var u=L[g];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(O,u.key,u)}}function A(O,L,g){return L&&x(O.prototype,L),g&&x(O,g),O}var M=function(){function O(g){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=g;var u=g.config;this.bwEstimator=new w.default(u.abrEwmaSlowVoD,u.abrEwmaFastVoD,u.abrEwmaDefaultEstimate),this.registerListeners()}var L=O.prototype;return L.registerListeners=function(){var u=this.hls;u.on(P.Events.FRAG_LOADING,this.onFragLoading,this),u.on(P.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(P.Events.ERROR,this.onError,this)},L.unregisterListeners=function(){var u=this.hls;u.off(P.Events.FRAG_LOADING,this.onFragLoading,this),u.off(P.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(P.Events.ERROR,this.onError,this)},L.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},L.onFragLoading=function(u,a){var l=a.frag;if(l.type===I.PlaylistLevelType.MAIN&&!this.timer){var d;this.fragCurrent=l,this.partCurrent=(d=a.part)!=null?d:null,this.timer=self.setInterval(this.onCheck,100)}},L.onLevelLoaded=function(u,a){var l=this.hls.config;a.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},L._abandonRulesCheck=function(){var u=this.fragCurrent,a=this.partCurrent,l=this.hls,d=l.autoLevelEnabled,E=l.config,v=l.media;if(!u||!v)return;var m=a?a.stats:u.stats,k=a?a.duration:u.duration;if(m.aborted){_.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!d||v.paused||!v.playbackRate||!v.readyState)return;var b=performance.now()-m.loading.start,h=Math.abs(v.playbackRate);if(b<=500*k/h)return;var p=l.levels,c=l.minAutoLevel,o=p[u.level],S=m.total||Math.max(m.loaded,Math.round(k*o.maxBitrate/8)),y=Math.max(1,m.bwEstimate?m.bwEstimate/8:m.loaded*1e3/b),T=(S-m.loaded)/y,N=v.currentTime,z=(H.BufferHelper.bufferInfo(v,N,E.maxBufferHole).end-N)/h;if(z>=2*k/h||T<=z)return;var Y=Number.POSITIVE_INFINITY,ee;for(ee=u.level-1;ee>c;ee--){var G=p[ee].maxBitrate;if(Y=k*G/(8*.8*y),Y<z)break}if(Y>=T)return;var W=this.bwEstimator.getEstimate();_.logger.warn("Fragment "+u.sn+(a?" part "+a.index:"")+" of level "+u.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+ee+`
Current BW estimate: `+(Object(K.isFiniteNumber)(W)?(W/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+T.toFixed(3)+` s
Estimated load time for the next fragment: `+Y.toFixed(3)+` s
Time to underbuffer: `+z.toFixed(3)+" s"),l.nextLoadLevel=ee,this.bwEstimator.sample(b,m.loaded),this.clearTimer(),u.loader&&(this.fragCurrent=this.partCurrent=null,u.loader.abort()),l.trigger(P.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:u,part:a,stats:m})},L.onFragLoaded=function(u,a){var l=a.frag,d=a.part;if(l.type===I.PlaylistLevelType.MAIN&&Object(K.isFiniteNumber)(l.sn)){var E=d?d.stats:l.stats,v=d?d.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var m=this.hls.levels[l.level],k=(m.loaded?m.loaded.bytes:0)+E.loaded,b=(m.loaded?m.loaded.duration:0)+v;m.loaded={bytes:k,duration:b},m.realBitrate=Math.round(8*k/b)}if(l.bitrateTest){var h={stats:E,frag:l,part:d,id:l.type};this.onFragBuffered(P.Events.FRAG_BUFFERED,h),l.bitrateTest=!1}}},L.onFragBuffered=function(u,a){var l=a.frag,d=a.part,E=d?d.stats:l.stats;if(E.aborted)return;if(l.type!==I.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var v=E.parsing.end-E.loading.start;this.bwEstimator.sample(v,E.loaded),E.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=v/1e3:this.bitrateTestDelay=0},L.onError=function(u,a){switch(a.details){case B.ErrorDetails.FRAG_LOAD_ERROR:case B.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},L.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},L.getNextABRAutoLevel=function(){var u=this.fragCurrent,a=this.partCurrent,l=this.hls,d=l.maxAutoLevel,E=l.config,v=l.minAutoLevel,m=l.media,k=a?a.duration:u?u.duration:0,b=m?m.currentTime:0,h=m&&m.playbackRate!==0?Math.abs(m.playbackRate):1,p=this.bwEstimator?this.bwEstimator.getEstimate():E.abrEwmaDefaultEstimate,c=(H.BufferHelper.bufferInfo(m,b,E.maxBufferHole).end-b)/h,o=this.findBestLevel(p,v,d,c,E.abrBandWidthFactor,E.abrBandWidthUpFactor);if(o>=0)return o;_.logger.trace((c?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var S=k?Math.min(k,E.maxStarvationDelay):E.maxStarvationDelay,y=E.abrBandWidthFactor,T=E.abrBandWidthUpFactor;if(!c){var N=this.bitrateTestDelay;if(N){var z=k?Math.min(k,E.maxLoadingDelay):E.maxLoadingDelay;S=z-N,_.logger.trace("bitrate test took "+Math.round(1e3*N)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*S)+" ms"),y=T=1}}return o=this.findBestLevel(p,v,d,c+S,y,T),Math.max(o,0)},L.findBestLevel=function(u,a,l,d,E,v){for(var m,k=this.fragCurrent,b=this.partCurrent,h=this.lastLoadedFragLevel,p=this.hls.levels,c=p[h],o=!!(c!=null&&(m=c.details)!==null&&m!==void 0&&m.live),S=c==null?void 0:c.codecSet,y=b?b.duration:k?k.duration:0,T=l;T>=a;T--){var N=p[T];if(!N||S&&N.codecSet!==S)continue;var z=N.details,Y=(b?z==null?void 0:z.partTarget:z==null?void 0:z.averagetargetduration)||y,ee=void 0;T<=h?ee=E*u:ee=v*u;var G=p[T].maxBitrate,W=G*Y/ee;if(_.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+T+"/"+Math.round(ee)+"/"+G+"/"+Y+"/"+d+"/"+W),ee>G&&(!W||o&&!this.bitrateTestDelay||W<d))return T}return-1},A(O,[{key:"nextAutoLevel",get:function(){var u=this._nextAutoLevel,a=this.bwEstimator;if(u!==-1&&(!a||!a.canEstimate()))return u;var l=this.getNextABRAutoLevel();return u!==-1&&(l=Math.min(u,l)),l},set:function(u){this._nextAutoLevel=u}}]),O}();X.default=M},"./src/controller/audio-stream-controller.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/polyfills/number.ts"),w=D("./src/controller/base-stream-controller.ts"),P=D("./src/events.ts"),H=D("./src/utils/buffer-helper.ts"),B=D("./src/controller/fragment-tracker.ts"),I=D("./src/types/level.ts"),_=D("./src/types/loader.ts"),x=D("./src/loader/fragment.ts"),A=D("./src/demux/chunk-cache.ts"),M=D("./src/demux/transmuxer-interface.ts"),O=D("./src/types/transmuxer.ts"),L=D("./src/controller/fragment-finders.ts"),g=D("./src/utils/discontinuities.ts"),u=D("./src/errors.ts"),a=D("./src/utils/logger.ts");function l(){return l=Object.assign||function(k){for(var b=1;b<arguments.length;b++){var h=arguments[b];for(var p in h)Object.prototype.hasOwnProperty.call(h,p)&&(k[p]=h[p])}return k},l.apply(this,arguments)}function d(k,b){k.prototype=Object.create(b.prototype),k.prototype.constructor=k,E(k,b)}function E(k,b){return E=Object.setPrototypeOf||function(p,c){return p.__proto__=c,p},E(k,b)}var v=100,m=function(k){d(b,k);function b(p,c){var o;return o=k.call(this,p,c,"[audio-stream-controller]")||this,o.videoBuffer=null,o.videoTrackCC=-1,o.waitingVideoCC=-1,o.audioSwitch=!1,o.trackId=-1,o.waitingData=null,o.mainDetails=null,o.bufferFlushed=!1,o._registerListeners(),o}var h=b.prototype;return h.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},h._registerListeners=function(){var c=this.hls;c.on(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),c.on(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),c.on(P.Events.ERROR,this.onError,this),c.on(P.Events.BUFFER_RESET,this.onBufferReset,this),c.on(P.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),c.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h._unregisterListeners=function(){var c=this.hls;c.off(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),c.off(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),c.off(P.Events.ERROR,this.onError,this),c.off(P.Events.BUFFER_RESET,this.onBufferReset,this),c.off(P.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),c.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h.onInitPtsFound=function(c,o){var S=o.frag,y=o.id,T=o.initPTS;if(y==="main"){var N=S.cc;this.initPTS[S.cc]=T,this.log("InitPTS for cc: "+N+" found from main: "+T),this.videoTrackCC=N,this.state===w.State.WAITING_INIT_PTS&&this.tick()}},h.startLoad=function(c){if(!this.levels){this.startPosition=c,this.state=w.State.STOPPED;return}var o=this.lastCurrentTime;this.stopLoad(),this.setInterval(v),this.fragLoadError=0,o>0&&c===-1?(this.log("Override startPosition with lastCurrentTime @"+o.toFixed(3)),this.state=w.State.IDLE):(this.loadedmetadata=!1,this.state=w.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()},h.doTick=function(){switch(this.state){case w.State.IDLE:this.doTickIdle();break;case w.State.WAITING_TRACK:{var c,o=this.levels,S=this.trackId,y=o==null||((c=o[S])===null||c===void 0)?void 0:c.details;if(y){if(this.waitForCdnTuneIn(y))break;this.state=w.State.WAITING_INIT_PTS}break}case w.State.FRAG_LOADING_WAITING_RETRY:{var T,N=performance.now(),z=this.retryDate;(!z||N>=z||(T=this.media)!==null&&T!==void 0&&T.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=w.State.IDLE);break}case w.State.WAITING_INIT_PTS:{var Y=this.waitingData;if(Y){var ee=Y.frag,G=Y.part,W=Y.cache,te=Y.complete;if(this.initPTS[ee.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=w.State.FRAG_LOADING;var ue=W.flush(),be={frag:ee,part:G,payload:ue,networkDetails:null};this._handleFragmentLoadProgress(be),te&&k.prototype._handleFragmentLoadComplete.call(this,be)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+ee.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var Oe=this.getLoadPosition(),Ke=H.BufferHelper.bufferInfo(this.mediaBuffer,Oe,this.config.maxBufferHole),_e=Object(L.fragmentWithinToleranceTest)(Ke.end,this.config.maxFragLookUpTolerance,ee);_e<0&&(a.logger.log("Waiting fragment cc ("+ee.cc+") @ "+ee.start+" cancelled because another fragment at "+Ke.end+" is needed"),this.clearWaitingFragment())}}else this.state=w.State.IDLE}}this.onTickEnd()},h.clearWaitingFragment=function(){var c=this.waitingData;c&&(this.fragmentTracker.removeFragment(c.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=w.State.IDLE)},h.onTickEnd=function(){var c=this.media;if(!c||!c.readyState)return;var o=this.mediaBuffer?this.mediaBuffer:c,S=o.buffered;!this.loadedmetadata&&S.length&&(this.loadedmetadata=!0),this.lastCurrentTime=c.currentTime},h.doTickIdle=function(){var c,o,S=this.hls,y=this.levels,T=this.media,N=this.trackId,z=S.config;if(!y||!y[N])return;if(!T&&(this.startFragRequested||!z.startFragPrefetch))return;var Y=y[N],ee=Y.details;if(!ee||ee.live&&this.levelLastLoaded!==N||this.waitForCdnTuneIn(ee)){this.state=w.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,x.ElementaryStreamTypes.AUDIO,_.PlaylistLevelType.AUDIO));var G=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,_.PlaylistLevelType.AUDIO);if(G===null)return;var W=G.len,te=this.getMaxBufferLength(),ue=this.audioSwitch;if(W>=te&&!ue)return;if(!ue&&this._streamEnded(G,ee)){S.trigger(P.Events.BUFFER_EOS,{type:"audio"}),this.state=w.State.ENDED;return}var be=ee.fragments,Oe=be[0].start,Ke=G.end;if(ue){var _e=this.getLoadPosition();Ke=_e,ee.PTSKnown&&_e<Oe&&((G.end>Oe||G.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),T.currentTime=Oe+.05))}var Ie=this.getNextFragment(Ke,ee);if(!Ie){this.bufferFlushed=!0;return}((c=Ie.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((o=Ie.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(Ie,ee):this.loadFragment(Ie,ee,Ke)},h.getMaxBufferLength=function(){var c=k.prototype.getMaxBufferLength.call(this),o=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,_.PlaylistLevelType.MAIN);return o===null?c:Math.max(c,o.len)},h.onMediaDetaching=function(){this.videoBuffer=null,k.prototype.onMediaDetaching.call(this)},h.onAudioTracksUpdated=function(c,o){var S=o.audioTracks;this.resetTransmuxer(),this.levels=S.map(function(y){return new I.Level(y)})},h.onAudioTrackSwitching=function(c,o){var S=!!o.url;this.trackId=o.id;var y=this.fragCurrent;y!=null&&y.loader&&y.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),S?this.setInterval(v):this.resetTransmuxer(),S?(this.audioSwitch=!0,this.state=w.State.IDLE):this.state=w.State.STOPPED,this.tick()},h.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},h.onLevelLoaded=function(c,o){this.mainDetails=o.details},h.onAudioTrackLoaded=function(c,o){var S,y=this.levels,T=o.details,N=o.id;if(!y){this.warn("Audio tracks were reset while loading level "+N);return}this.log("Track "+N+" loaded ["+T.startSN+","+T.endSN+"],duration:"+T.totalduration);var z=y[N],Y=0;if(T.live||(S=z.details)!==null&&S!==void 0&&S.live){var ee=this.mainDetails;if(T.fragments[0]||(T.deltaUpdateFailed=!0),T.deltaUpdateFailed||!ee)return;!z.details&&T.hasProgramDateTime&&ee.hasProgramDateTime?(Object(g.alignMediaPlaylistByPDT)(T,ee),Y=T.fragments[0].start):Y=this.alignPlaylists(T,z.details)}z.details=T,this.levelLastLoaded=N,!this.startFragRequested&&(this.mainDetails||!T.live)&&this.setStartPosition(z.details,Y),this.state===w.State.WAITING_TRACK&&!this.waitForCdnTuneIn(T)&&(this.state=w.State.IDLE),this.tick()},h._handleFragmentLoadProgress=function(c){var o,S=c.frag,y=c.part,T=c.payload,N=this.config,z=this.trackId,Y=this.levels;if(!Y){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+S.sn+" of level "+S.level+" will not be buffered");return}var ee=Y[z];console.assert(ee,"Audio track is defined on fragment load progress");var G=ee.details;console.assert(G,"Audio track details are defined on fragment load progress");var W=N.defaultAudioCodec||ee.audioCodec||"mp4a.40.2",te=this.transmuxer;te||(te=this.transmuxer=new M.default(this.hls,_.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ue=this.initPTS[S.cc],be=(o=S.initSegment)===null||o===void 0?void 0:o.data;if(ue!==void 0){var Oe=!1,Ke=y?y.index:-1,_e=Ke!==-1,Ie=new O.ChunkMetadata(S.level,S.sn,S.stats.chunkCount,T.byteLength,Ke,_e);te.push(T,be,W,"",S,y,G.totalduration,Oe,Ie,ue)}else{a.logger.log("Unknown video PTS for cc "+S.cc+", waiting for video PTS before demuxing audio frag "+S.sn+" of ["+G.startSN+" ,"+G.endSN+"],track "+z);var Ue=this.waitingData=this.waitingData||{frag:S,part:y,cache:new A.default,complete:!1},Pe=Ue.cache;Pe.push(new Uint8Array(T)),this.waitingVideoCC=this.videoTrackCC,this.state=w.State.WAITING_INIT_PTS}},h._handleFragmentLoadComplete=function(c){if(this.waitingData){this.waitingData.complete=!0;return}k.prototype._handleFragmentLoadComplete.call(this,c)},h.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},h.onBufferCreated=function(c,o){var S=o.tracks.audio;S&&(this.mediaBuffer=S.buffer),o.tracks.video&&(this.videoBuffer=o.tracks.video.buffer)},h.onFragBuffered=function(c,o){var S=o.frag,y=o.part;if(S.type!==_.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(S)){this.warn("Fragment "+S.sn+(y?" p: "+y.index:"")+" of level "+S.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}S.sn!=="initSegment"&&(this.fragPrevious=S,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(S,y)},h.onError=function(c,o){switch(o.details){case u.ErrorDetails.FRAG_LOAD_ERROR:case u.ErrorDetails.FRAG_LOAD_TIMEOUT:case u.ErrorDetails.KEY_LOAD_ERROR:case u.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(_.PlaylistLevelType.AUDIO,o);break;case u.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case u.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==w.State.ERROR&&this.state!==w.State.STOPPED&&(this.state=o.fatal?w.State.ERROR:w.State.IDLE,this.warn(o.details+" while loading frag, switching to "+this.state+" state"));break;case u.ErrorDetails.BUFFER_FULL_ERROR:if(o.parent==="audio"&&(this.state===w.State.PARSING||this.state===w.State.PARSED)){var S=!0,y=this.getFwdBufferInfo(this.mediaBuffer,_.PlaylistLevelType.AUDIO);y&&y.len>.5&&(S=!this.reduceMaxBufferLength(y.len)),S&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,k.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},h.onBufferFlushed=function(c,o){var S=o.type;S===x.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},h._handleTransmuxComplete=function(c){var o,S="audio",y=this.hls,T=c.remuxResult,N=c.chunkMeta,z=this.getCurrentContext(N);if(!z){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 Y=z.frag,ee=z.part,G=T.audio,W=T.text,te=T.id3,ue=T.initSegment;if(this.fragContextChanged(Y))return;if(this.state=w.State.PARSING,this.audioSwitch&&G&&this.completeAudioSwitch(),ue!=null&&ue.tracks&&(this._bufferInitSegment(ue.tracks,Y,N),y.trigger(P.Events.FRAG_PARSING_INIT_SEGMENT,{frag:Y,id:S,tracks:ue.tracks})),G){var be=G.startPTS,Oe=G.endPTS,Ke=G.startDTS,_e=G.endDTS;ee&&(ee.elementaryStreams[x.ElementaryStreamTypes.AUDIO]={startPTS:be,endPTS:Oe,startDTS:Ke,endDTS:_e}),Y.setElementaryStreamInfo(x.ElementaryStreamTypes.AUDIO,be,Oe,Ke,_e),this.bufferFragmentData(G,Y,ee,N)}if(te!=null&&(o=te.samples)!==null&&o!==void 0&&o.length){var Ie=l({frag:Y,id:S},te);y.trigger(P.Events.FRAG_PARSING_METADATA,Ie)}if(W){var Ue=l({frag:Y,id:S},W);y.trigger(P.Events.FRAG_PARSING_USERDATA,Ue)}},h._bufferInitSegment=function(c,o,S){if(this.state!==w.State.PARSING)return;c.video&&delete c.video;var y=c.audio;if(!y)return;y.levelCodec=y.codec,y.id="audio",this.log("Init audio buffer, container:"+y.container+", codecs[parsed]=["+y.codec+"]"),this.hls.trigger(P.Events.BUFFER_CODECS,c);var T=y.initSegment;if(T!=null&&T.byteLength){var N={type:"audio",frag:o,part:null,chunkMeta:S,parent:o.type,data:T};this.hls.trigger(P.Events.BUFFER_APPENDING,N)}this.tick()},h.loadFragment=function(c,o,S){var y=this.fragmentTracker.getState(c);this.fragCurrent=c,(this.audioSwitch||y===B.FragmentState.NOT_LOADED||y===B.FragmentState.PARTIAL)&&(c.sn==="initSegment"?this._loadInitSegment(c):o.live&&!Object(K.isFiniteNumber)(this.initPTS[c.cc])?(this.log("Waiting for video PTS in continuity counter "+c.cc+" of live stream before loading audio fragment "+c.sn+" of level "+this.trackId),this.state=w.State.WAITING_INIT_PTS):(this.startFragRequested=!0,k.prototype.loadFragment.call(this,c,o,S)))},h.completeAudioSwitch=function(){var c=this.hls,o=this.media,S=this.trackId;o&&(this.log("Switching audio track : flushing all audio"),k.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,c.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:S})},b}(w.default);X.default=m},"./src/controller/audio-track-controller.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/events.ts"),w=D("./src/errors.ts"),P=D("./src/controller/base-playlist-controller.ts"),H=D("./src/types/loader.ts");function B(M,O){for(var L=0;L<O.length;L++){var g=O[L];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(M,g.key,g)}}function I(M,O,L){return O&&B(M.prototype,O),L&&B(M,L),M}function _(M,O){M.prototype=Object.create(O.prototype),M.prototype.constructor=M,x(M,O)}function x(M,O){return x=Object.setPrototypeOf||function(g,u){return g.__proto__=u,g},x(M,O)}var A=function(M){_(O,M);function O(g){var u;return u=M.call(this,g,"[audio-track-controller]")||this,u.tracks=[],u.groupId=null,u.tracksInGroup=[],u.trackId=-1,u.trackName="",u.selectDefaultTrack=!0,u.registerListeners(),u}var L=O.prototype;return L.registerListeners=function(){var u=this.hls;u.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),u.on(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.on(K.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(K.Events.ERROR,this.onError,this)},L.unregisterListeners=function(){var u=this.hls;u.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.off(K.Events.LEVEL_LOADING,this.onLevelLoading,this),u.off(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.off(K.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(K.Events.ERROR,this.onError,this)},L.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,M.prototype.destroy.call(this)},L.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},L.onManifestParsed=function(u,a){this.tracks=a.audioTracks||[]},L.onAudioTrackLoaded=function(u,a){var l=a.id,d=a.details,E=this.tracksInGroup[l];if(!E){this.warn("Invalid audio track id "+l);return}var v=E.details;E.details=a.details,this.log("audioTrack "+l+" loaded ["+d.startSN+"-"+d.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,a,v))},L.onLevelLoading=function(u,a){this.switchLevel(a.level)},L.onLevelSwitching=function(u,a){this.switchLevel(a.level)},L.switchLevel=function(u){var a=this.hls.levels[u];if(!(a!=null&&a.audioGroupIds))return;var l=a.audioGroupIds[a.urlId];if(this.groupId!==l){this.groupId=l;var d=this.tracks.filter(function(v){return!l||v.groupId===l});this.selectDefaultTrack&&!d.some(function(v){return v.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=d;var E={audioTracks:d};this.log("Updating audio tracks, "+d.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(K.Events.AUDIO_TRACKS_UPDATED,E),this.selectInitialTrack()}},L.onError=function(u,a){if(M.prototype.onError.call(this,u,a),a.fatal||!a.context)return;a.context.type===H.PlaylistContextType.AUDIO_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},L.setAudioTrack=function(u){var a=this.tracksInGroup;if(u<0||u>=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=a[this.trackId];this.log("Now switching to audio-track index "+u);var d=a[u],E=d.id,v=d.groupId,m=v===void 0?"":v,k=d.name,b=d.type,h=d.url;if(this.trackId=u,this.trackName=k,this.selectDefaultTrack=!1,this.hls.trigger(K.Events.AUDIO_TRACK_SWITCHING,{id:E,groupId:m,name:k,type:b,url:h}),d.details&&!d.details.live)return;var p=this.switchParams(d.url,l==null?void 0:l.details);this.loadPlaylist(p)},L.selectInitialTrack=function(){var u=this.tracksInGroup;console.assert(u.length,"Initial audio track should be selected when tracks are known");var a=this.trackName,l=this.findTrackId(a)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(K.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},L.findTrackId=function(u){for(var a=this.tracksInGroup,l=0;l<a.length;l++){var d=a[l];if((!this.selectDefaultTrack||d.default)&&(!u||u===d.name))return d.id}return-1},L.loadPlaylist=function(u){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var l=a.id,d=a.groupId,E=a.url;if(u)try{E=u.addDirectives(E)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(K.Events.AUDIO_TRACK_LOADING,{url:E,id:l,groupId:d,deliveryDirectives:u||null})}},I(O,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(u){this.selectDefaultTrack=!1,this.setAudioTrack(u)}}]),O}(P.default);X.default=A},"./src/controller/base-playlist-controller.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return I});var K=D("./src/polyfills/number.ts"),w=D("./src/types/level.ts"),P=D("./src/controller/level-helper.ts"),H=D("./src/utils/logger.ts"),B=D("./src/errors.ts"),I=function(){function _(A,M){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=H.logger.log.bind(H.logger,M+":"),this.warn=H.logger.warn.bind(H.logger,M+":"),this.hls=A}var x=_.prototype;return x.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},x.onError=function(M,O){O.fatal&&O.type===B.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},x.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},x.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},x.stopLoad=function(){this.canLoad=!1,this.clearTimer()},x.switchParams=function(M,O){var L=O==null?void 0:O.renditionReports;if(L)for(var g=0;g<L.length;g++){var u=L[g],a=""+u.URI;if(a===M.substr(-a.length)){var l=parseInt(u["LAST-MSN"]),d=parseInt(u["LAST-PART"]);if(O&&this.hls.config.lowLatencyMode){var E=Math.min(O.age-O.partTarget,O.targetduration);d!==void 0&&E>O.partTarget&&(d+=1)}if(Object(K.isFiniteNumber)(l))return new w.HlsUrlParameters(l,Object(K.isFiniteNumber)(d)?d:void 0,w.HlsSkip.No)}}},x.loadPlaylist=function(M){},x.shouldLoadTrack=function(M){return this.canLoad&&M&&!!M.url&&(!M.details||M.details.live)},x.playlistLoaded=function(M,O,L){var g=this,u=O.details,a=O.stats,l=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(u.advancedDateTime=Date.now()-l,u.live||L!=null&&L.live){if(u.reloaded(L),L&&this.log("live playlist "+M+" "+(u.advanced?"REFRESHED "+u.lastPartSn+"-"+u.lastPartIndex:"MISSED")),L&&u.fragments.length>0&&Object(P.mergeDetails)(L,u),!this.canLoad||!u.live)return;var d,E=void 0,v=void 0;if(u.canBlockReload&&u.endSN&&u.advanced){var m=this.hls.config.lowLatencyMode,k=u.lastPartSn,b=u.endSN,h=u.lastPartIndex,p=h!==-1,c=k===b,o=m?0:h;p?(E=c?b+1:k,v=c?o:h+1):E=b+1;var S=u.age,y=S+u.ageHeader,T=Math.min(y-u.partTarget,u.targetduration*1.5);if(T>0){if(L&&T>L.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+L.tuneInGoal+" to: "+T+" with playlist age: "+u.age),T=0;else{var N=Math.floor(T/u.targetduration);if(E+=N,v!==void 0){var z=Math.round(T%u.targetduration/u.partTarget);v+=z}this.log("CDN Tune-in age: "+u.ageHeader+"s last advanced "+S.toFixed(2)+"s goal: "+T+" skip sn "+N+" to part "+v)}u.tuneInGoal=T}if(d=this.getDeliveryDirectives(u,O.deliveryDirectives,E,v),m||!c){this.loadPlaylist(d);return}}else d=this.getDeliveryDirectives(u,O.deliveryDirectives,E,v);var Y=Object(P.computeReloadInterval)(u,a);E!==void 0&&u.canBlockReload&&(Y-=u.partTarget||1),this.log("reload live playlist "+M+" in "+Math.round(Y)+" ms"),this.timer=self.setTimeout(function(){return g.loadPlaylist(d)},Y)}else this.clearTimer()},x.getDeliveryDirectives=function(M,O,L,g){var u=Object(w.getSkipValue)(M,L);return O!=null&&O.skip&&M.deltaUpdateFailed&&(L=O.msn,g=O.part,u=w.HlsSkip.No),new w.HlsUrlParameters(L,g,u)},x.retryLoadingOrFail=function(M){var O=this,L=this.hls.config,g=this.retryCount<L.levelLoadingMaxRetry;if(g){var u;if(this.retryCount++,M.details.indexOf("LoadTimeOut")>-1&&(u=M.context)!==null&&u!==void 0&&u.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+M.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*L.levelLoadingRetryDelay,L.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return O.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+M.details+'"')}}else this.warn('cannot recover from error "'+M.details+'"'),this.clearTimer(),M.fatal=!0;return g},_}()},"./src/controller/base-stream-controller.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"State",function(){return b}),D.d(X,"default",function(){return h});var K=D("./src/polyfills/number.ts"),w=D("./src/task-loop.ts"),P=D("./src/controller/fragment-tracker.ts"),H=D("./src/utils/buffer-helper.ts"),B=D("./src/utils/logger.ts"),I=D("./src/events.ts"),_=D("./src/errors.ts"),x=D("./src/types/transmuxer.ts"),A=D("./src/utils/mp4-tools.ts"),M=D("./src/utils/discontinuities.ts"),O=D("./src/controller/fragment-finders.ts"),L=D("./src/controller/level-helper.ts"),g=D("./src/loader/fragment-loader.ts"),u=D("./src/crypt/decrypter.ts"),a=D("./src/utils/time-ranges.ts"),l=D("./src/types/loader.ts");function d(p,c){for(var o=0;o<c.length;o++){var S=c[o];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(p,S.key,S)}}function E(p,c,o){return c&&d(p.prototype,c),o&&d(p,o),p}function v(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function m(p,c){p.prototype=Object.create(c.prototype),p.prototype.constructor=p,k(p,c)}function k(p,c){return k=Object.setPrototypeOf||function(S,y){return S.__proto__=y,S},k(p,c)}var b={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},h=function(p){m(c,p);function c(S,y,T){var N;return N=p.call(this)||this,N.hls=void 0,N.fragPrevious=null,N.fragCurrent=null,N.fragmentTracker=void 0,N.transmuxer=null,N._state=b.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=T,N.log=B.logger.log.bind(B.logger,T+":"),N.warn=B.logger.warn.bind(B.logger,T+":"),N.hls=S,N.fragmentLoader=new g.default(S.config),N.fragmentTracker=y,N.config=S.config,N.decrypter=new u.default(S,S.config),S.on(I.Events.KEY_LOADED,N.onKeyLoaded,v(N)),N}var o=c.prototype;return o.doTick=function(){this.onTickEnd()},o.onTickEnd=function(){},o.startLoad=function(y){},o.stopLoad=function(){this.fragmentLoader.abort();var y=this.fragCurrent;y&&this.fragmentTracker.removeFragment(y),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=b.STOPPED},o._streamEnded=function(y,T){var N=this.fragCurrent,z=this.fragmentTracker;if(!T.live&&N&&N.sn===T.endSN&&!y.nextStart){var Y=z.getState(N);return Y===P.FragmentState.PARTIAL||Y===P.FragmentState.OK}return!1},o.onMediaAttached=function(y,T){var N=this.media=this.mediaBuffer=T.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),N.addEventListener("seeking",this.onvseeking),N.addEventListener("ended",this.onvended);var z=this.config;this.levels&&z.autoStartLoad&&this.state===b.STOPPED&&this.startLoad(z.startPosition)},o.onMediaDetaching=function(){var y=this.media;y!=null&&y.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),y&&(y.removeEventListener("seeking",this.onvseeking),y.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},o.onMediaSeeking=function(){var y=this.config,T=this.fragCurrent,N=this.media,z=this.mediaBuffer,Y=this.state,ee=N?N.currentTime:0,G=H.BufferHelper.bufferInfo(z||N,ee,y.maxBufferHole);if(this.log("media seeking to "+(Object(K.isFiniteNumber)(ee)?ee.toFixed(3):ee)+", state: "+Y),Y===b.ENDED)this.resetLoadingState();else if(T&&!G.len){var W=y.maxFragLookUpTolerance,te=T.start-W,ue=T.start+T.duration+W,be=ee>ue;(ee<te||be)&&(be&&T.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),T.loader.abort()),this.resetLoadingState())}N&&(this.lastCurrentTime=ee),!this.loadedmetadata&&!G.len&&(this.nextLoadPosition=this.startPosition=ee),this.tickImmediate()},o.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},o.onKeyLoaded=function(y,T){if(this.state!==b.KEY_LOADING||T.frag!==this.fragCurrent||!this.levels)return;this.state=b.IDLE;var N=this.levels[T.frag.level].details;N&&this.loadFragment(T.frag,N,T.frag.start)},o.onHandlerDestroying=function(){this.stopLoad(),p.prototype.onHandlerDestroying.call(this)},o.onHandlerDestroyed=function(){this.state=b.STOPPED,this.hls.off(I.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,p.prototype.onHandlerDestroyed.call(this)},o.loadKey=function(y,T){this.log("Loading key for "+y.sn+" of ["+T.startSN+"-"+T.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level),this.state=b.KEY_LOADING,this.fragCurrent=y,this.hls.trigger(I.Events.KEY_LOADING,{frag:y})},o.loadFragment=function(y,T,N){this._loadFragForPlayback(y,T,N)},o._loadFragForPlayback=function(y,T,N){var z=this,Y=function(G){if(z.fragContextChanged(y)){z.warn("Fragment "+y.sn+(G.part?" p: "+G.part.index:"")+" of level "+y.level+" was dropped during download."),z.fragmentTracker.removeFragment(y);return}y.stats.chunkCount++,z._handleFragmentLoadProgress(G)};this._doFragLoad(y,T,N,Y).then(function(ee){if(!ee)return;z.fragLoadError=0;var G=z.state;if(z.fragContextChanged(y)){(G===b.FRAG_LOADING||G===b.BACKTRACKING||!z.fragCurrent&&G===b.PARSING)&&(z.fragmentTracker.removeFragment(y),z.state=b.IDLE);return}if("payload"in ee&&(z.log("Loaded fragment "+y.sn+" of level "+y.level),z.hls.trigger(I.Events.FRAG_LOADED,ee),z.state===b.BACKTRACKING)){z.fragmentTracker.backtrack(y,ee),z.resetFragmentLoading(y);return}z._handleFragmentLoadComplete(ee)}).catch(function(ee){z.warn(ee),z.resetFragmentLoading(y)})},o.flushMainBuffer=function(y,T,N){if(N===void 0&&(N=null),!(y-T))return;var z={startOffset:y,endOffset:T,type:N};this.fragLoadError=0,this.hls.trigger(I.Events.BUFFER_FLUSHING,z)},o._loadInitSegment=function(y){var T=this;this._doFragLoad(y).then(function(N){if(!N||T.fragContextChanged(y)||!T.levels)throw new Error("init load aborted");return N}).then(function(N){var z=T.hls,Y=N.payload,ee=y.decryptdata;if(Y&&Y.byteLength>0&&ee&&ee.key&&ee.iv&&ee.method==="AES-128"){var G=self.performance.now();return T.decrypter.webCryptoDecrypt(new Uint8Array(Y),ee.key.buffer,ee.iv.buffer).then(function(W){var te=self.performance.now();return z.trigger(I.Events.FRAG_DECRYPTED,{frag:y,payload:W,stats:{tstart:G,tdecrypt:te}}),N.payload=W,N})}return N}).then(function(N){var z=T.fragCurrent,Y=T.hls,ee=T.levels;if(!ee)throw new Error("init load aborted, missing levels");var G=ee[y.level].details;console.assert(G,"Level details are defined when init segment is loaded");var W=y.stats;T.state=b.IDLE,T.fragLoadError=0,y.data=new Uint8Array(N.payload),W.parsing.start=W.buffering.start=self.performance.now(),W.parsing.end=W.buffering.end=self.performance.now(),N.frag===z&&Y.trigger(I.Events.FRAG_BUFFERED,{stats:W,frag:z,part:null,id:y.type}),T.tick()}).catch(function(N){T.warn(N),T.resetFragmentLoading(y)})},o.fragContextChanged=function(y){var T=this.fragCurrent;return!y||!T||y.level!==T.level||y.sn!==T.sn||y.urlId!==T.urlId},o.fragBufferedComplete=function(y,T){var N=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+y.type+" sn: "+y.sn+(T?" part: "+T.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level+" "+a.default.toString(H.BufferHelper.getBuffered(N))),this.state=b.IDLE,this.tick()},o._handleFragmentLoadComplete=function(y){var T=this.transmuxer;if(!T)return;var N=y.frag,z=y.part,Y=y.partsLoaded,ee=!Y||Y.length===0||Y.some(function(W){return!W}),G=new x.ChunkMetadata(N.level,N.sn,N.stats.chunkCount+1,0,z?z.index:-1,!ee);T.flush(G)},o._handleFragmentLoadProgress=function(y){},o._doFragLoad=function(y,T,N,z){var Y=this;if(N===void 0&&(N=null),!this.levels)throw new Error("frag load aborted, missing levels");if(N=Math.max(y.start,N||0),this.config.lowLatencyMode&&T){var ee=T.partList;if(ee&&z){N>y.end&&T.fragmentHint&&(y=T.fragmentHint);var G=this.getNextPart(ee,y,N);if(G>-1){var W=ee[G];return this.log("Loading part sn: "+y.sn+" p: "+W.index+" cc: "+y.cc+" of playlist ["+T.startSN+"-"+T.endSN+"] parts [0-"+G+"-"+(ee.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(N.toFixed(3))),this.nextLoadPosition=W.start+W.duration,this.state=b.FRAG_LOADING,this.hls.trigger(I.Events.FRAG_LOADING,{frag:y,part:ee[G],targetBufferTime:N}),this.doFragPartsLoad(y,ee,G,z).catch(function(te){return Y.handleFragLoadError(te)})}else if(!y.url||this.loadedEndOfParts(ee,N))return Promise.resolve(null)}}return this.log("Loading fragment "+y.sn+" cc: "+y.cc+" "+(T?"of ["+T.startSN+"-"+T.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(N.toFixed(3))),Object(K.isFiniteNumber)(y.sn)&&!this.bitrateTest&&(this.nextLoadPosition=y.start+y.duration),this.state=b.FRAG_LOADING,this.hls.trigger(I.Events.FRAG_LOADING,{frag:y,targetBufferTime:N}),this.fragmentLoader.load(y,z).catch(function(te){return Y.handleFragLoadError(te)})},o.doFragPartsLoad=function(y,T,N,z){var Y=this;return new Promise(function(ee,G){var W=[],te=function ue(be){var Oe=T[be];Y.fragmentLoader.loadPart(y,Oe,z).then(function(Ke){W[Oe.index]=Ke;var _e=Ke.part;Y.hls.trigger(I.Events.FRAG_LOADED,Ke);var Ie=T[be+1];if(Ie&&Ie.fragment===y)ue(be+1);else return ee({frag:y,part:_e,partsLoaded:W})}).catch(G)};te(N)})},o.handleFragLoadError=function(y){var T=y.data;return T&&T.details===_.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(T.frag,T.part):this.hls.trigger(I.Events.ERROR,T),null},o._handleTransmuxerFlush=function(y){var T=this.getCurrentContext(y);if(!T||this.state!==b.PARSING){this.fragCurrent||(this.state=b.IDLE);return}var N=T.frag,z=T.part,Y=T.level,ee=self.performance.now();N.stats.parsing.end=ee,z&&(z.stats.parsing.end=ee),this.updateLevelTiming(N,z,Y,y.partial)},o.getCurrentContext=function(y){var T=this.levels,N=y.level,z=y.sn,Y=y.part;if(!T||!T[N])return this.warn("Levels object was unset while buffering fragment "+z+" of level "+N+". The current chunk will not be buffered."),null;var ee=T[N],G=Y>-1?Object(L.getPartWith)(ee,z,Y):null,W=G?G.fragment:Object(L.getFragmentWithSN)(ee,z,this.fragCurrent);return W?{frag:W,part:G,level:ee}:null},o.bufferFragmentData=function(y,T,N,z){if(!y||this.state!==b.PARSING)return;var Y=y.data1,ee=y.data2,G=Y;if(Y&&ee&&(G=Object(A.appendUint8Array)(Y,ee)),!G||!G.length)return;var W={type:y.type,frag:T,part:N,chunkMeta:z,parent:T.type,data:G};this.hls.trigger(I.Events.BUFFER_APPENDING,W),y.dropped&&y.independent&&!N&&this.flushBufferGap(T)},o.flushBufferGap=function(y){var T=this.media;if(!T)return;if(!H.BufferHelper.isBuffered(T,T.currentTime)){this.flushMainBuffer(0,y.start);return}var N=T.currentTime,z=H.BufferHelper.bufferInfo(T,N,0),Y=y.duration,ee=Math.min(this.config.maxFragLookUpTolerance*2,Y*.25),G=Math.max(Math.min(y.start-ee,z.end-ee),N+ee);y.start-G>ee&&this.flushMainBuffer(G,y.start)},o.getFwdBufferInfo=function(y,T){var N=this.config,z=this.getLoadPosition();if(!Object(K.isFiniteNumber)(z))return null;var Y=H.BufferHelper.bufferInfo(y,z,N.maxBufferHole);if(Y.len===0&&Y.nextStart!==void 0){var ee=this.fragmentTracker.getBufferedFrag(z,T);if(ee&&Y.nextStart<ee.end)return H.BufferHelper.bufferInfo(y,z,Math.max(Y.nextStart,N.maxBufferHole))}return Y},o.getMaxBufferLength=function(y){var T=this.config,N;return y?N=Math.max(8*T.maxBufferSize/y,T.maxBufferLength):N=T.maxBufferLength,Math.min(N,T.maxMaxBufferLength)},o.reduceMaxBufferLength=function(y){var T=this.config,N=y||T.maxBufferLength;return T.maxMaxBufferLength>=N?(T.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+T.maxMaxBufferLength+"s"),!0):!1},o.getNextFragment=function(y,T){var N,z,Y=T.fragments,ee=Y.length;if(!ee)return null;var G=this.config,W=Y[0].start,te;if(T.live){var ue=G.initialLiveManifestSize;if(ee<ue)return this.warn("Not enough fragments to start playback (have: "+ee+", need: "+ue+")"),null;!T.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(te=this.getInitialLiveFragment(T,Y),this.startPosition=te?this.hls.liveSyncPosition||te.start:y)}else y<=W&&(te=Y[0]);if(!te){var be=G.lowLatencyMode?T.partEnd:T.fragmentEnd;te=this.getFragmentAtPosition(y,be,T)}return(N=te)!==null&&N!==void 0&&N.initSegment&&!((z=te)!==null&&z!==void 0&&z.initSegment.data)&&!this.bitrateTest&&(te=te.initSegment),te},o.getNextPart=function(y,T,N){for(var z=-1,Y=!1,ee=!0,G=0,W=y.length;G<W;G++){var te=y[G];if(ee=ee&&!te.independent,z>-1&&N<te.start)break;var ue=te.loaded;!ue&&(Y||te.independent||ee)&&te.fragment===T&&(z=G),Y=ue}return z},o.loadedEndOfParts=function(y,T){var N=y[y.length-1];return N&&T>N.start&&N.loaded},o.getInitialLiveFragment=function(y,T){var N=this.fragPrevious,z=null;if(N){if(y.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+N.programDateTime),z=Object(O.findFragmentByPDT)(T,N.endProgramDateTime,this.config.maxFragLookUpTolerance)),!z){var Y=N.sn+1;if(Y>=y.startSN&&Y<=y.endSN){var ee=T[Y-y.startSN];N.cc===ee.cc&&(z=ee,this.log("Live playlist, switching playlist, load frag with next SN: "+z.sn))}z||(z=Object(O.findFragWithCC)(T,N.cc),z&&this.log("Live playlist, switching playlist, load frag with same CC: "+z.sn))}}else{var G=this.hls.liveSyncPosition;G!==null&&(z=this.getFragmentAtPosition(G,this.bitrateTest?y.fragmentEnd:y.edge,y))}return z},o.getFragmentAtPosition=function(y,T,N){var z=this.config,Y=this.fragPrevious,ee=N.fragments,G=N.endSN,W=N.fragmentHint,te=z.maxFragLookUpTolerance,ue=!!(z.lowLatencyMode&&N.partList&&W);ue&&W&&!this.bitrateTest&&(ee=ee.concat(W),G=W.sn);var be;if(y<T){var Oe=y>T-te?0:te;be=Object(O.findFragmentByPTS)(Y,ee,y,Oe)}else be=ee[ee.length-1];if(be){var Ke=be.sn-N.startSN,_e=Y&&be.level===Y.level,Ie=ee[Ke+1],Ue=this.fragmentTracker.getState(be);if(Ue===P.FragmentState.BACKTRACKED){be=null;for(var Pe=Ke;ee[Pe]&&this.fragmentTracker.getState(ee[Pe])===P.FragmentState.BACKTRACKED;)Y?be=ee[Pe--]:be=ee[--Pe];be||(be=Ie)}else Y&&be.sn===Y.sn&&!ue&&(_e&&(be.sn<G&&this.fragmentTracker.getState(Ie)!==P.FragmentState.OK?(this.log("SN "+be.sn+" just loaded, load next one: "+Ie.sn),be=Ie):be=null))}return be},o.synchronizeToLiveEdge=function(y){var T=this.config,N=this.media;if(!N)return;var z=this.hls.liveSyncPosition,Y=N.currentTime,ee=y.fragments[0].start,G=y.edge,W=Y>=ee-T.maxFragLookUpTolerance&&Y<=G;if(z!==null&&N.duration>z&&(Y<z||!W)){var te=T.liveMaxLatencyDuration!==void 0?T.liveMaxLatencyDuration:T.liveMaxLatencyDurationCount*y.targetduration;(!W&&N.readyState<4||Y<G-te)&&(this.loadedmetadata||(this.nextLoadPosition=z),N.readyState&&(this.warn("Playback: "+Y.toFixed(3)+" is located too far from the end of live sliding playlist: "+G+", reset currentTime to : "+z.toFixed(3)),N.currentTime=z))}},o.alignPlaylists=function(y,T){var N=this.levels,z=this.levelLastLoaded,Y=this.fragPrevious,ee=z!==null?N[z]:null,G=y.fragments.length;if(!G)return this.warn("No fragments in live playlist"),0;var W=y.fragments[0].start,te=!T,ue=y.alignedSliding&&Object(K.isFiniteNumber)(W);if(te||!ue&&!W){Object(M.alignStream)(Y,ee,y);var be=y.fragments[0].start;return this.log("Live playlist sliding: "+be.toFixed(2)+" start-sn: "+(T?T.startSN:"na")+"->"+y.startSN+" prev-sn: "+(Y?Y.sn:"na")+" fragments: "+G),be}return W},o.waitForCdnTuneIn=function(y){var T=3;return y.live&&y.canBlockReload&&y.tuneInGoal>Math.max(y.partHoldBack,y.partTarget*T)},o.setStartPosition=function(y,T){var N=this.startPosition;if(N<T&&(N=-1),N===-1||this.lastCurrentTime===-1){var z=y.startTimeOffset;Object(K.isFiniteNumber)(z)?(N=T+z,z<0&&(N+=y.totalduration),N=Math.min(Math.max(T,N),T+y.totalduration),this.log("Start time offset "+z+" found in playlist, adjust startPosition to "+N),this.startPosition=N):y.live?N=this.hls.liveSyncPosition||T:this.startPosition=N=0,this.lastCurrentTime=N}this.nextLoadPosition=N},o.getLoadPosition=function(){var y=this.media,T=0;return this.loadedmetadata&&y?T=y.currentTime:this.nextLoadPosition&&(T=this.nextLoadPosition),T},o.handleFragLoadAborted=function(y,T){this.transmuxer&&y.sn!=="initSegment"&&y.stats.aborted&&(this.warn("Fragment "+y.sn+(T?" part"+T.index:"")+" of level "+y.level+" was aborted"),this.resetFragmentLoading(y))},o.resetFragmentLoading=function(y){(!this.fragCurrent||!this.fragContextChanged(y))&&(this.state=b.IDLE)},o.onFragmentOrKeyLoadError=function(y,T){if(T.fatal)return;var N=T.frag;if(!N||N.type!==y)return;var z=this.fragCurrent;console.assert(z&&N.sn===z.sn&&N.level===z.level&&N.urlId===z.urlId,"Frag load error must match current frag to retry");var Y=this.config;if(this.fragLoadError+1<=Y.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(N.level))return;var ee=Math.min(Math.pow(2,this.fragLoadError)*Y.fragLoadingRetryDelay,Y.fragLoadingMaxRetryTimeout);this.warn("Fragment "+N.sn+" of "+y+" "+N.level+" failed to load, retrying in "+ee+"ms"),this.retryDate=self.performance.now()+ee,this.fragLoadError++,this.state=b.FRAG_LOADING_WAITING_RETRY}else T.levelRetry?(y===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=b.IDLE):(B.logger.error(T.details+" reaches max retry, redispatch as fatal ..."),T.fatal=!0,this.hls.stopLoad(),this.state=b.ERROR)},o.afterBufferFlushed=function(y,T,N){if(!y)return;var z=H.BufferHelper.getBuffered(y);this.fragmentTracker.detectEvictedFragments(T,z,N),this.state===b.ENDED&&this.resetLoadingState()},o.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=b.IDLE},o.resetLiveStartWhenNotLoaded=function(y){if(!this.loadedmetadata){this.startFragRequested=!1;var T=this.levels?this.levels[y].details:null;if(T!=null&&T.live)return this.startPosition=-1,this.setStartPosition(T,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},o.updateLevelTiming=function(y,T,N,z){var Y=this,ee=N.details;console.assert(!!ee,"level.details must be defined");var G=Object.keys(y.elementaryStreams).reduce(function(W,te){var ue=y.elementaryStreams[te];if(ue){var be=ue.endPTS-ue.startPTS;if(be<=0)return Y.warn("Could not parse fragment "+y.sn+" "+te+" duration reliably ("+be+") resetting transmuxer to fallback to playlist timing"),Y.resetTransmuxer(),W||!1;var Oe=z?0:Object(L.updateFragPTSDTS)(ee,y,ue.startPTS,ue.endPTS,ue.startDTS,ue.endDTS);return Y.hls.trigger(I.Events.LEVEL_PTS_UPDATED,{details:ee,level:N,drift:Oe,type:te,frag:y,start:ue.startPTS,end:ue.endPTS}),!0}return W},!1);G?(this.state=b.PARSED,this.hls.trigger(I.Events.FRAG_PARSED,{frag:y,part:T})):this.resetLoadingState()},o.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},E(c,[{key:"state",get:function(){return this._state},set:function(y){var T=this._state;T!==y&&(this._state=y,this.log(T+"->"+y))}}]),c}(w.default)},"./src/controller/buffer-controller.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return O});var K=D("./src/polyfills/number.ts"),w=D("./src/events.ts"),P=D("./src/utils/logger.ts"),H=D("./src/errors.ts"),B=D("./src/utils/buffer-helper.ts"),I=D("./src/utils/mediasource-helper.ts"),_=D("./src/loader/fragment.ts"),x=D("./src/controller/buffer-operation-queue.ts"),A=Object(I.getMediaSource)(),M=/([ha]vc.)(?:\.[^.,]+)+/,O=function(){function L(u){var a=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var l=a.hls,d=a.media,E=a.mediaSource;P.logger.log("[buffer-controller]: Media source opened"),d&&(a.updateMediaElementDuration(),l.trigger(w.Events.MEDIA_ATTACHED,{media:d})),E&&E.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){P.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){P.logger.log("[buffer-controller]: Media source ended")},this.hls=u,this._initSourceBuffer(),this.registerListeners()}var g=L.prototype;return g.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},g.destroy=function(){this.unregisterListeners(),this.details=null},g.registerListeners=function(){var a=this.hls;a.on(w.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(w.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(w.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(w.Events.BUFFER_RESET,this.onBufferReset,this),a.on(w.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(w.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(w.Events.BUFFER_EOS,this.onBufferEos,this),a.on(w.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(w.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(w.Events.FRAG_PARSED,this.onFragParsed,this),a.on(w.Events.FRAG_CHANGED,this.onFragChanged,this)},g.unregisterListeners=function(){var a=this.hls;a.off(w.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(w.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(w.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(w.Events.BUFFER_RESET,this.onBufferReset,this),a.off(w.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(w.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(w.Events.BUFFER_EOS,this.onBufferEos,this),a.off(w.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(w.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(w.Events.FRAG_PARSED,this.onFragParsed,this),a.off(w.Events.FRAG_CHANGED,this.onFragChanged,this)},g._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new x.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},g.onManifestParsed=function(a,l){var d=2;(l.audio&&!l.video||!l.altAudio)&&(d=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=d,this.details=null,P.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},g.onMediaAttaching=function(a,l){var d=this.media=l.media;if(d&&A){var E=this.mediaSource=new A;E.addEventListener("sourceopen",this._onMediaSourceOpen),E.addEventListener("sourceended",this._onMediaSourceEnded),E.addEventListener("sourceclose",this._onMediaSourceClose),d.src=self.URL.createObjectURL(E),this._objectUrl=d.src}},g.onMediaDetaching=function(){var a=this.media,l=this.mediaSource,d=this._objectUrl;if(l){if(P.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(E){P.logger.warn("[buffer-controller]: onMediaDetaching: "+E.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(d&&self.URL.revokeObjectURL(d),a.src===d?(a.removeAttribute("src"),a.load()):P.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(w.Events.MEDIA_DETACHED,void 0)},g.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(l){var d=a.sourceBuffer[l];try{d&&(a.removeBufferListeners(l),a.mediaSource&&a.mediaSource.removeSourceBuffer(d),a.sourceBuffer[l]=void 0)}catch(E){P.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",E)}}),this._initSourceBuffer()},g.onBufferCodecs=function(a,l){var d=this,E=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(v){if(E){var m=d.tracks[v];if(m&&typeof m.buffer.changeType=="function"){var k=l[v],b=k.codec,h=k.levelCodec,p=k.container,c=(m.levelCodec||m.codec).replace(M,"$1"),o=(h||b).replace(M,"$1");if(c!==o){var S=p+";codecs="+(h||b);d.appendChangeType(v,S)}}}else d.pendingTracks[v]=l[v]}),E)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},g.appendChangeType=function(a,l){var d=this,E=this.operationQueue,v={execute:function(){var k=d.sourceBuffer[a];k&&(P.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+l),k.changeType(l)),E.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(k){P.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",k)}};E.append(v,a)},g.onBufferAppending=function(a,l){var d=this,E=this.hls,v=this.operationQueue,m=this.tracks,k=l.data,b=l.type,h=l.frag,p=l.part,c=l.chunkMeta,o=c.buffering[b],S=self.performance.now();o.start=S;var y=h.stats.buffering,T=p?p.stats.buffering:null;y.start===0&&(y.start=S),T&&T.start===0&&(T.start=S);var N=m.audio,z=b==="audio"&&c.id===1&&(N==null?void 0:N.container)==="audio/mpeg",Y={execute:function(){if(o.executeStart=self.performance.now(),z){var G=d.sourceBuffer[b];if(G){var W=h.start-G.timestampOffset;Math.abs(W)>=.1&&(P.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+h.start+" (delta: "+W+") sn: "+h.sn+")"),G.timestampOffset=h.start)}}d.appendExecutor(k,b)},onStart:function(){},onComplete:function(){var G=self.performance.now();o.executeEnd=o.end=G,y.first===0&&(y.first=G),T&&T.first===0&&(T.first=G);var W=d.sourceBuffer,te={};for(var ue in W)te[ue]=B.BufferHelper.getBuffered(W[ue]);d.appendError=0,d.hls.trigger(w.Events.BUFFER_APPENDED,{type:b,frag:h,part:p,chunkMeta:c,parent:h.type,timeRanges:te})},onError:function(G){P.logger.error("[buffer-controller]: Error encountered while trying to append to the "+b+" SourceBuffer",G);var W={type:H.ErrorTypes.MEDIA_ERROR,parent:h.type,details:H.ErrorDetails.BUFFER_APPEND_ERROR,err:G,fatal:!1};G.code===DOMException.QUOTA_EXCEEDED_ERR?W.details=H.ErrorDetails.BUFFER_FULL_ERROR:(d.appendError++,W.details=H.ErrorDetails.BUFFER_APPEND_ERROR,d.appendError>E.config.appendErrorMaxRetry&&(P.logger.error("[buffer-controller]: Failed "+E.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),W.fatal=!0)),E.trigger(w.Events.ERROR,W)}};v.append(Y,b)},g.onBufferFlushing=function(a,l){var d=this,E=this.operationQueue,v=function(k){return{execute:d.removeExecutor.bind(d,k,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){d.hls.trigger(w.Events.BUFFER_FLUSHED,{type:k})},onError:function(h){P.logger.warn("[buffer-controller]: Failed to remove from "+k+" SourceBuffer",h)}}};l.type?E.append(v(l.type),l.type):this.getSourceBufferTypes().forEach(function(m){E.append(v(m),m)})},g.onFragParsed=function(a,l){var d=this,E=l.frag,v=l.part,m=[],k=v?v.elementaryStreams:E.elementaryStreams;k[_.ElementaryStreamTypes.AUDIOVIDEO]?m.push("audiovideo"):(k[_.ElementaryStreamTypes.AUDIO]&&m.push("audio"),k[_.ElementaryStreamTypes.VIDEO]&&m.push("video"));var b=function(){var p=self.performance.now();E.stats.buffering.end=p,v&&(v.stats.buffering.end=p);var c=v?v.stats:E.stats;d.hls.trigger(w.Events.FRAG_BUFFERED,{frag:E,part:v,stats:c,id:E.type})};m.length===0&&P.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+E.type+" level: "+E.level+" sn: "+E.sn),this.blockBuffers(b,m)},g.onFragChanged=function(a,l){this.flushBackBuffer()},g.onBufferEos=function(a,l){var d=this,E=this.getSourceBufferTypes().reduce(function(v,m){var k=d.sourceBuffer[m];return(!l.type||l.type===m)&&(k&&!k.ended&&(k.ended=!0,P.logger.log("[buffer-controller]: "+m+" sourceBuffer now EOS"))),v&&!!(!k||k.ended)},!0);E&&this.blockBuffers(function(){var v=d.mediaSource;if(!v||v.readyState!=="open")return;v.endOfStream()})},g.onLevelUpdated=function(a,l){var d=l.details;if(!d.fragments.length)return;this.details=d,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},g.flushBackBuffer=function(){var a=this.hls,l=this.details,d=this.media,E=this.sourceBuffer;if(!d||l===null)return;var v=this.getSourceBufferTypes();if(!v.length)return;var m=l.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(K.isFiniteNumber)(m)||m<0)return;var k=d.currentTime,b=l.levelTargetDuration,h=Math.max(m,b),p=Math.floor(k/b)*b-h;v.forEach(function(c){var o=E[c];if(o){var S=B.BufferHelper.getBuffered(o);S.length>0&&p>S.start(0)&&(a.trigger(w.Events.BACK_BUFFER_REACHED,{bufferEnd:p}),l.live&&a.trigger(w.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:p}),a.trigger(w.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:p,type:c}))}})},g.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,l=this.hls,d=this.media,E=this.mediaSource,v=a.fragments[0].start+a.totalduration,m=d.duration,k=Object(K.isFiniteNumber)(E.duration)?E.duration:0;a.live&&l.config.liveDurationInfinity?(P.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),E.duration=Infinity,this.updateSeekableRange(a)):(v>k&&v>m||!Object(K.isFiniteNumber)(m))&&(P.logger.log("[buffer-controller]: Updating Media Source duration to "+v.toFixed(3)),E.duration=v)},g.updateSeekableRange=function(a){var l=this.mediaSource,d=a.fragments,E=d.length;if(E&&a.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var v=Math.max(0,d[0].start),m=Math.max(v,v+a.totalduration);l.setLiveSeekableRange(v,m)}},g.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,l=this.operationQueue,d=this.pendingTracks,E=Object.keys(d).length;if(E&&!a||E===2){this.createSourceBuffers(d),this.pendingTracks={};var v=this.getSourceBufferTypes();if(v.length===0){this.hls.trigger(w.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}v.forEach(function(m){l.executeNext(m)})}},g.createSourceBuffers=function(a){var l=this.sourceBuffer,d=this.mediaSource;if(!d)throw Error("createSourceBuffers called when mediaSource was null");var E=0;for(var v in a)if(!l[v]){var m=a[v];if(!m)throw Error("source buffer exists for track "+v+", however track does not");var k=m.levelCodec||m.codec,b=m.container+";codecs="+k;P.logger.log("[buffer-controller]: creating sourceBuffer("+b+")");try{var h=l[v]=d.addSourceBuffer(b),p=v;this.addBufferListener(p,"updatestart",this._onSBUpdateStart),this.addBufferListener(p,"updateend",this._onSBUpdateEnd),this.addBufferListener(p,"error",this._onSBUpdateError),this.tracks[v]={buffer:h,codec:k,container:m.container,levelCodec:m.levelCodec,id:m.id},E++}catch(c){P.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+c.message),this.hls.trigger(w.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:c,mimeType:b})}}E&&this.hls.trigger(w.Events.BUFFER_CREATED,{tracks:this.tracks})},g._onSBUpdateStart=function(a){var l=this.operationQueue,d=l.current(a);d.onStart()},g._onSBUpdateEnd=function(a){var l=this.operationQueue,d=l.current(a);d.onComplete(),l.shiftAndExecuteNext(a)},g._onSBUpdateError=function(a,l){P.logger.error("[buffer-controller]: "+a+" SourceBuffer error",l),this.hls.trigger(w.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var d=this.operationQueue.current(a);d&&d.onError(l)},g.removeExecutor=function(a,l,d){var E=this.media,v=this.mediaSource,m=this.operationQueue,k=this.sourceBuffer,b=k[a];if(!E||!v||!b){P.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),m.shiftAndExecuteNext(a);return}var h=Object(K.isFiniteNumber)(E.duration)?E.duration:Infinity,p=Object(K.isFiniteNumber)(v.duration)?v.duration:Infinity,c=Math.max(0,l),o=Math.min(d,h,p);o>c?(P.logger.log("[buffer-controller]: Removing ["+c+","+o+"] from the "+a+" SourceBuffer"),console.assert(!b.updating,a+" sourceBuffer must not be updating"),b.remove(c,o)):m.shiftAndExecuteNext(a)},g.appendExecutor=function(a,l){var d=this.operationQueue,E=this.sourceBuffer,v=E[l];if(!v){P.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),d.shiftAndExecuteNext(l);return}v.ended=!1,console.assert(!v.updating,l+" sourceBuffer must not be updating"),v.appendBuffer(a)},g.blockBuffers=function(a,l){var d=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){P.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var E=this.operationQueue,v=l.map(function(m){return E.appendBlocker(m)});Promise.all(v).then(function(){a(),l.forEach(function(m){var k=d.sourceBuffer[m];(!k||!k.updating)&&E.shiftAndExecuteNext(m)})})},g.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},g.addBufferListener=function(a,l,d){var E=this.sourceBuffer[a];if(!E)return;var v=d.bind(this,a);this.listeners[a].push({event:l,listener:v}),E.addEventListener(l,v)},g.removeBufferListeners=function(a){var l=this.sourceBuffer[a];if(!l)return;this.listeners[a].forEach(function(d){l.removeEventListener(d.event,d.listener)})},L}()},"./src/controller/buffer-operation-queue.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return w});var K=D("./src/utils/logger.ts"),w=function(){function P(B){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=B}var H=P.prototype;return H.append=function(I,_){var x=this.queues[_];x.push(I),x.length===1&&this.buffers[_]&&this.executeNext(_)},H.insertAbort=function(I,_){var x=this.queues[_];x.unshift(I),this.executeNext(_)},H.appendBlocker=function(I){var _,x=new Promise(function(M){_=M}),A={execute:_,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(A,I),x},H.executeNext=function(I){var _=this.buffers,x=this.queues,A=_[I],M=x[I];if(M.length){var O=M[0];try{O.execute()}catch(L){K.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),O.onError(L),(!A||!A.updating)&&(M.shift(),this.executeNext(I))}}},H.shiftAndExecuteNext=function(I){this.queues[I].shift(),this.executeNext(I)},H.current=function(I){return this.queues[I][0]},P}()},"./src/controller/cap-level-controller.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/events.ts");function w(B,I){for(var _=0;_<I.length;_++){var x=I[_];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(B,x.key,x)}}function P(B,I,_){return I&&w(B.prototype,I),_&&w(B,_),B}var H=function(){function B(_){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=_,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var I=B.prototype;return I.setStreamController=function(x){this.streamController=x},I.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},I.registerListeners=function(){var x=this.hls;x.on(K.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),x.on(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),x.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.on(K.Events.BUFFER_CODECS,this.onBufferCodecs,this),x.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},I.unregisterListener=function(){var x=this.hls;x.off(K.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),x.off(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),x.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.off(K.Events.BUFFER_CODECS,this.onBufferCodecs,this),x.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},I.onFpsDropLevelCapping=function(x,A){B.isLevelAllowed(A.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(A.droppedLevel)},I.onMediaAttaching=function(x,A){this.media=A.media instanceof HTMLVideoElement?A.media:null},I.onManifestParsed=function(x,A){var M=this.hls;this.restrictedLevels=[],this.firstLevel=A.firstLevel,M.config.capLevelToPlayerSize&&A.video&&this.startCapping()},I.onBufferCodecs=function(x,A){var M=this.hls;M.config.capLevelToPlayerSize&&A.video&&this.startCapping()},I.onMediaDetaching=function(){this.stopCapping()},I.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var x=this.hls.levels;if(x.length){var A=this.hls;A.autoLevelCapping=this.getMaxLevel(x.length-1),A.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=A.autoLevelCapping}}},I.getMaxLevel=function(x){var A=this,M=this.hls.levels;if(!M.length)return-1;var O=M.filter(function(L,g){return B.isLevelAllowed(g,A.restrictedLevels)&&g<=x});return this.clientRect=null,B.getMaxLevelByMediaSize(O,this.mediaWidth,this.mediaHeight)},I.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()},I.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},I.getDimensions=function(){if(this.clientRect)return this.clientRect;var x=this.media,A={width:0,height:0};if(x){var M=x.getBoundingClientRect();A.width=M.width,A.height=M.height,!A.width&&!A.height&&(A.width=M.right-M.left||x.width||0,A.height=M.bottom-M.top||x.height||0)}return this.clientRect=A,A},B.isLevelAllowed=function(x,A){return A===void 0&&(A=[]),A.indexOf(x)===-1},B.getMaxLevelByMediaSize=function(x,A,M){if(!x||!x.length)return-1;for(var O=function(l,d){return d?l.width!==d.width||l.height!==d.height:!0},L=x.length-1,g=0;g<x.length;g+=1){var u=x[g];if((u.width>=A||u.height>=M)&&O(u,x[g+1])){L=g;break}}return L},P(B,[{key:"mediaWidth",get:function(){return this.getDimensions().width*B.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*B.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var x=1;try{x=self.devicePixelRatio}catch(A){}return x}}]),B}();X.default=H},"./src/controller/cmcd-controller.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return O});var K=D("./src/events.ts"),w=D("./src/types/cmcd.ts"),P=D("./src/utils/buffer-helper.ts"),H=D("./src/utils/logger.ts");function B(L,g){for(var u=0;u<g.length;u++){var a=g[u];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(L,a.key,a)}}function I(L,g,u){return g&&B(L.prototype,g),u&&B(L,u),L}function _(L,g){var u=typeof Symbol!="undefined"&&L[Symbol.iterator]||L["@@iterator"];if(u)return(u=u.call(L)).next.bind(u);if(Array.isArray(L)||(u=x(L))||g&&L&&typeof L.length=="number"){u&&(L=u);var a=0;return function(){return a>=L.length?{done:!0}:{done:!1,value:L[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function x(L,g){if(!L)return;if(typeof L=="string")return A(L,g);var u=Object.prototype.toString.call(L).slice(8,-1);if(u==="Object"&&L.constructor&&(u=L.constructor.name),u==="Map"||u==="Set")return Array.from(L);if(u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u))return A(L,g)}function A(L,g){(g==null||g>L.length)&&(g=L.length);for(var u=0,a=new Array(g);u<g;u++)a[u]=L[u];return a}function M(){return M=Object.assign||function(L){for(var g=1;g<arguments.length;g++){var u=arguments[g];for(var a in u)Object.prototype.hasOwnProperty.call(u,a)&&(L[a]=u[a])}return L},M.apply(this,arguments)}var O=function(){function L(u){var a=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){a.initialized&&(a.starved=!0),a.buffering=!0},this.onPlaying=function(){a.initialized||(a.initialized=!0),a.buffering=!1},this.applyPlaylistData=function(E){try{a.apply(E,{ot:w.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(v){H.logger.warn("Could not generate manifest CMCD data.",v)}},this.applyFragmentData=function(E){try{var v=E.frag,m=a.hls.levels[v.level],k=a.getObjectType(v),b={d:v.duration*1e3,ot:k};(k===w.CMCDObjectType.VIDEO||k===w.CMCDObjectType.AUDIO||k==w.CMCDObjectType.MUXED)&&(b.br=m.bitrate/1e3,b.tb=a.getTopBandwidth(k),b.bl=a.getBufferLength(k)),a.apply(E,b)}catch(h){H.logger.warn("Could not generate segment CMCD data.",h)}},this.hls=u;var l=this.config=u.config,d=l.cmcd;d!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=d.sessionId||L.uuid(),this.cid=d.contentId,this.useHeaders=d.useHeaders===!0,this.registerListeners())}var g=L.prototype;return g.registerListeners=function(){var a=this.hls;a.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.on(K.Events.BUFFER_CREATED,this.onBufferCreated,this)},g.unregisterListeners=function(){var a=this.hls;a.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.off(K.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},g.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},g.onMediaAttached=function(a,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},g.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},g.onBufferCreated=function(a,l){var d,E;this.audioBuffer=(d=l.tracks.audio)===null||d===void 0?void 0:d.buffer,this.videoBuffer=(E=l.tracks.video)===null||E===void 0?void 0:E.buffer},g.createData=function(){var a;return{v:w.CMCDVersion,sf:w.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(a=this.media)===null||a===void 0?void 0:a.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},g.apply=function(a,l){l===void 0&&(l={}),M(l,this.createData());var d=l.ot===w.CMCDObjectType.INIT||l.ot===w.CMCDObjectType.VIDEO||l.ot===w.CMCDObjectType.MUXED;if(this.starved&&d&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var E=L.toHeaders(l);if(!Object.keys(E).length)return;a.headers||(a.headers={}),M(a.headers,E)}else{var v=L.toQuery(l);if(!v)return;a.url=L.appendQueryToUri(a.url,v)}},g.getObjectType=function(a){var l=a.type;return l==="subtitle"?w.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?w.CMCDObjectType.INIT:l==="audio"?w.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?w.CMCDObjectType.VIDEO:w.CMCDObjectType.MUXED:void 0},g.getTopBandwidth=function(a){for(var l=0,d=a===w.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,E=_(d),v;!(v=E()).done;){var m=v.value;m.bitrate>l&&(l=m.bitrate)}return l>0?l:NaN},g.getBufferLength=function(a){var l=this.hls.media,d=a===w.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!d||!l)return NaN;var E=P.BufferHelper.bufferInfo(d,l.currentTime,this.config.maxBufferHole);return E.len*1e3},g.createPlaylistLoader=function(){var a=this.config.pLoader,l=this.applyPlaylistData,d=a||this.config.loader;return function(){function E(m){this.loader=void 0,this.loader=new d(m)}var v=E.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(k,b,h){l(k),this.loader.load(k,b,h)},I(E,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),E}()},g.createFragmentLoader=function(){var a=this.config.fLoader,l=this.applyFragmentData,d=a||this.config.loader;return function(){function E(m){this.loader=void 0,this.loader=new d(m)}var v=E.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(k,b,h){l(k),this.loader.load(k,b,h)},I(E,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),E}()},L.uuid=function(){var a=URL.createObjectURL(new Blob),l=a.toString();return URL.revokeObjectURL(a),l.substr(l.lastIndexOf("/")+1)},L.serialize=function(a){for(var l=[],d=function(z){return!Number.isNaN(z)&&z!=null&&z!==""&&z!==!1},E=function(z){return Math.round(z)},v=function(z){return E(z/100)*100},m=function(z){return encodeURIComponent(z)},k={br:E,d:E,bl:v,dl:v,mtp:v,nor:m,rtp:v,tb:E},b=Object.keys(a||{}).sort(),h=_(b),p;!(p=h()).done;){var c=p.value,o=a[c];if(!d(o))continue;if(c==="v"&&o===1)continue;if(c=="pr"&&o===1)continue;var S=k[c];S&&(o=S(o));var y=typeof o,T=void 0;c==="ot"||c==="sf"||c==="st"?T=c+"="+o:y==="boolean"?T=c:y==="number"?T=c+"="+o:T=c+"="+JSON.stringify(o),l.push(T)}return l.join(",")},L.toHeaders=function(a){for(var l=Object.keys(a),d={},E=["Object","Request","Session","Status"],v=[{},{},{},{}],m={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},k=0,b=l;k<b.length;k++){var h=b[k],p=m[h]!=null?m[h]:1;v[p][h]=a[h]}for(var c=0;c<v.length;c++){var o=L.serialize(v[c]);o&&(d["CMCD-"+E[c]]=o)}return d},L.toQuery=function(a){return"CMCD="+encodeURIComponent(L.serialize(a))},L.appendQueryToUri=function(a,l){if(!l)return a;var d=a.includes("?")?"&":"?";return""+a+d+l},L}()},"./src/controller/eme-controller.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/events.ts"),w=D("./src/errors.ts"),P=D("./src/utils/logger.ts"),H=D("./src/utils/mediakeys-helper.ts");function B(O,L){for(var g=0;g<L.length;g++){var u=L[g];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(O,u.key,u)}}function I(O,L,g){return L&&B(O.prototype,L),g&&B(O,g),O}var _=3,x=function(L,g,u){var a={audioCapabilities:[],videoCapabilities:[]};return L.forEach(function(l){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:u.audioRobustness||""})}),g.forEach(function(l){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:u.videoRobustness||""})}),[a]},A=function(L,g,u,a){switch(L){case H.KeySystems.WIDEVINE:return x(g,u,a);default:throw new Error("Unknown key-system: "+L)}},M=function(){function O(g){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=g,this._config=g.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var L=O.prototype;return L.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},L._registerListeners=function(){this.hls.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this)},L._unregisterListeners=function(){this.hls.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this)},L.getLicenseServerUrl=function(u){switch(u){case H.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+u+'"')},L._attemptKeySystemAccess=function(u,a,l){var d=this,E=A(u,a,l,this._drmSystemOptions);P.logger.log("Requesting encrypted media key-system access");var v=this.requestMediaKeySystemAccess(u,E);this.mediaKeysPromise=v.then(function(m){return d._onMediaKeySystemAccessObtained(u,m)}),v.catch(function(m){P.logger.error('Failed to obtain key-system "'+u+'" access:',m)})},L._onMediaKeySystemAccessObtained=function(u,a){var l=this;P.logger.log('Access for key-system "'+u+'" obtained');var d={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:u};this._mediaKeysList.push(d);var E=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(v){return d.mediaKeys=v,P.logger.log('Media-keys created for key-system "'+u+'"'),l._onMediaKeysCreated(),v});return E.catch(function(v){P.logger.error("Failed to create media-keys:",v)}),E},L._onMediaKeysCreated=function(){var u=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),u._onNewMediaKeySession(a.mediaKeysSession))})},L._onNewMediaKeySession=function(u){var a=this;P.logger.log("New key-system session "+u.sessionId),u.addEventListener("message",function(l){a._onKeySessionMessage(u,l.message)},!1)},L._onKeySessionMessage=function(u,a){P.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(l){P.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),u.update(l)})},L.onMediaEncrypted=function(u){var a=this;if(P.logger.log('Media is encrypted using "'+u.initDataType+'" init data type'),!this.mediaKeysPromise){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(K.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(E){if(!a._media)return;a._attemptSetMediaKeys(E),a._generateRequestWithPreferredKeySession(u.initDataType,u.initData)};this.mediaKeysPromise.then(l).catch(l)},L._attemptSetMediaKeys=function(u){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var a=this._mediaKeysList[0];if(!a||!a.mediaKeys){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}P.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(a.mediaKeys),this._hasSetMediaKeys=!0}},L._generateRequestWithPreferredKeySession=function(u,a){var l=this,d=this._mediaKeysList[0];if(!d){P.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(d.mediaKeysSessionInitialized){P.logger.warn("Key-Session already initialized but requested again");return}var E=d.mediaKeysSession;if(!E){P.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(K.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){P.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(K.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}P.logger.log('Generating key-session request for "'+u+'" init data type'),d.mediaKeysSessionInitialized=!0,E.generateRequest(u,a).then(function(){P.logger.debug("Key-session generation succeeded")}).catch(function(v){P.logger.error("Error generating key-session request:",v),l.hls.trigger(K.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},L._createLicenseXhr=function(u,a,l){var d=new XMLHttpRequest;d.responseType="arraybuffer",d.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,d,u,a,l);var E=this._licenseXhrSetup;if(E)try{E.call(this.hls,d,u),E=void 0}catch(v){P.logger.error(v)}try{d.readyState||d.open("POST",u,!0),E&&E.call(this.hls,d,u)}catch(v){throw new Error("issue setting up KeySystem license XHR "+v)}return d},L._onLicenseRequestReadyStageChange=function(u,a,l,d){switch(u.readyState){case 4:if(u.status===200){this._requestLicenseFailureCount=0,P.logger.log("License request succeeded");var E=u.response,v=this._licenseResponseCallback;if(v)try{E=v.call(this.hls,u,a)}catch(k){P.logger.error(k)}d(E)}else{if(P.logger.error("License Request XHR failed ("+a+"). Status: "+u.status+" ("+u.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>_){this.hls.trigger(K.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var m=_-this._requestLicenseFailureCount+1;P.logger.warn("Retrying license request, "+m+" attempts left"),this._requestLicense(l,d)}break}},L._generateLicenseRequestChallenge=function(u,a){switch(u.mediaKeySystemDomain){case H.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+u.mediaKeySystemDomain)},L._requestLicense=function(u,a){P.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){P.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var d=this.getLicenseServerUrl(l.mediaKeySystemDomain),E=this._createLicenseXhr(d,u,a);P.logger.log("Sending license request to URL: "+d);var v=this._generateLicenseRequestChallenge(l,u);E.send(v)}catch(m){P.logger.error("Failure requesting DRM license: "+m),this.hls.trigger(K.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},L.onMediaAttached=function(u,a){if(!this._emeEnabled)return;var l=a.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},L.onMediaDetached=function(){var u=this._media,a=this._mediaKeysList;if(!u)return;u.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return u.setMediaKeys(null)}).catch(function(){})},L.onManifestParsed=function(u,a){if(!this._emeEnabled)return;var l=a.levels.map(function(E){return E.audioCodec}).filter(function(E){return!!E}),d=a.levels.map(function(E){return E.videoCodec}).filter(function(E){return!!E});this._attemptKeySystemAccess(H.KeySystems.WIDEVINE,l,d)},I(O,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),O}();X.default=M},"./src/controller/fps-controller.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/events.ts"),w=D("./src/utils/logger.ts"),P=function(){function H(I){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=I,this.registerListeners()}var B=H.prototype;return B.setStreamController=function(_){this.streamController=_},B.registerListeners=function(){this.hls.on(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},B.unregisterListeners=function(){this.hls.off(K.Events.MEDIA_ATTACHING,this.onMediaAttaching)},B.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},B.onMediaAttaching=function(_,x){var A=this.hls.config;if(A.capLevelOnFPSDrop){var M=x.media instanceof self.HTMLVideoElement?x.media:null;this.media=M,M&&typeof M.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),A.fpsDroppedMonitoringPeriod)}},B.checkFPS=function(_,x,A){var M=performance.now();if(x){if(this.lastTime){var O=M-this.lastTime,L=A-this.lastDroppedFrames,g=x-this.lastDecodedFrames,u=1e3*L/O,a=this.hls;if(a.trigger(K.Events.FPS_DROP,{currentDropped:L,currentDecoded:g,totalDroppedFrames:A}),u>0&&L>a.config.fpsDroppedMonitoringThreshold*g){var l=a.currentLevel;w.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=l)&&(l=l-1,a.trigger(K.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:a.currentLevel}),a.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=M,this.lastDroppedFrames=A,this.lastDecodedFrames=x}},B.checkFPSInterval=function(){var _=this.media;if(_)if(this.isVideoPlaybackQualityAvailable){var x=_.getVideoPlaybackQuality();this.checkFPS(_,x.totalVideoFrames,x.droppedVideoFrames)}else this.checkFPS(_,_.webkitDecodedFrameCount,_.webkitDroppedFrameCount)},H}();X.default=P},"./src/controller/fragment-finders.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"findFragmentByPDT",function(){return P}),D.d(X,"findFragmentByPTS",function(){return H}),D.d(X,"fragmentWithinToleranceTest",function(){return B}),D.d(X,"pdtWithinToleranceTest",function(){return I}),D.d(X,"findFragWithCC",function(){return _});var K=D("./src/polyfills/number.ts"),w=D("./src/utils/binary-search.ts");function P(x,A,M){if(A===null||!Array.isArray(x)||!x.length||!Object(K.isFiniteNumber)(A))return null;var O=x[0].programDateTime;if(A<(O||0))return null;var L=x[x.length-1].endProgramDateTime;if(A>=(L||0))return null;M=M||0;for(var g=0;g<x.length;++g){var u=x[g];if(I(A,M,u))return u}return null}function H(x,A,M,O){M===void 0&&(M=0),O===void 0&&(O=0);var L=null;if(x?L=A[x.sn-A[0].sn+1]||null:M===0&&A[0].start===0&&(L=A[0]),L&&B(M,O,L)===0)return L;var g=w.default.search(A,B.bind(null,M,O));return g||L}function B(x,A,M){x===void 0&&(x=0),A===void 0&&(A=0);var O=Math.min(A,M.duration+(M.deltaPTS?M.deltaPTS:0));return M.start+M.duration-O<=x?1:M.start-O>x&&M.start?-1:0}function I(x,A,M){var O=Math.min(A,M.duration+(M.deltaPTS?M.deltaPTS:0))*1e3,L=M.endProgramDateTime||0;return L-O>x}function _(x,A){return w.default.search(x,function(M){return M.cc<A?1:M.cc>A?-1:0})}},"./src/controller/fragment-tracker.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"FragmentState",function(){return P}),D.d(X,"FragmentTracker",function(){return H});var K=D("./src/events.ts"),w=D("./src/types/loader.ts"),P;(function(_){_.NOT_LOADED="NOT_LOADED",_.BACKTRACKED="BACKTRACKED",_.APPENDING="APPENDING",_.PARTIAL="PARTIAL",_.OK="OK"})(P||(P={}));var H=function(){function _(A){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=A,this._registerListeners()}var x=_.prototype;return x._registerListeners=function(){var M=this.hls;M.on(K.Events.BUFFER_APPENDED,this.onBufferAppended,this),M.on(K.Events.FRAG_BUFFERED,this.onFragBuffered,this),M.on(K.Events.FRAG_LOADED,this.onFragLoaded,this)},x._unregisterListeners=function(){var M=this.hls;M.off(K.Events.BUFFER_APPENDED,this.onBufferAppended,this),M.off(K.Events.FRAG_BUFFERED,this.onFragBuffered,this),M.off(K.Events.FRAG_LOADED,this.onFragLoaded,this)},x.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},x.getAppendedFrag=function(M,O){if(O===w.PlaylistLevelType.MAIN){var L=this.activeFragment,g=this.activeParts;if(!L)return null;if(g)for(var u=g.length;u--;){var a=g[u],l=a?a.end:L.appendedPTS;if(a.start<=M&&l!==void 0&&M<=l)return u>9&&(this.activeParts=g.slice(u-9)),a}else if(L.start<=M&&L.appendedPTS!==void 0&&M<=L.appendedPTS)return L}return this.getBufferedFrag(M,O)},x.getBufferedFrag=function(M,O){for(var L=this.fragments,g=Object.keys(L),u=g.length;u--;){var a=L[g[u]];if((a==null?void 0:a.body.type)===O&&a.buffered){var l=a.body;if(l.start<=M&&M<=l.end)return l}}return null},x.detectEvictedFragments=function(M,O,L){var g=this;Object.keys(this.fragments).forEach(function(u){var a=g.fragments[u];if(!a)return;if(!a.buffered){a.body.type===L&&g.removeFragment(a.body);return}var l=a.range[M];if(!l)return;l.time.some(function(d){var E=!g.isTimeBuffered(d.startPTS,d.endPTS,O);return E&&g.removeFragment(a.body),E})})},x.detectPartialFragments=function(M){var O=this,L=this.timeRanges,g=M.frag,u=M.part;if(!L||g.sn==="initSegment")return;var a=I(g),l=this.fragments[a];if(!l)return;Object.keys(L).forEach(function(d){var E=g.elementaryStreams[d];if(!E)return;var v=L[d],m=u!==null||E.partial===!0;l.range[d]=O.getBufferedTimes(g,u,m,v)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},x.fragBuffered=function(M){var O=I(M),L=this.fragments[O];L&&(L.backtrack=L.loaded=null,L.buffered=!0)},x.getBufferedTimes=function(M,O,L,g){for(var u={time:[],partial:L},a=O?O.start:M.start,l=O?O.end:M.end,d=M.minEndPTS||l,E=M.maxStartPTS||a,v=0;v<g.length;v++){var m=g.start(v)-this.bufferPadding,k=g.end(v)+this.bufferPadding;if(E>=m&&d<=k){u.time.push({startPTS:Math.max(a,g.start(v)),endPTS:Math.min(l,g.end(v))});break}else if(a<k&&l>m)u.partial=!0,u.time.push({startPTS:Math.max(a,g.start(v)),endPTS:Math.min(l,g.end(v))});else if(l<=m)break}return u},x.getPartialFragment=function(M){var O=null,L,g,u,a=0,l=this.bufferPadding,d=this.fragments;return Object.keys(d).forEach(function(E){var v=d[E];if(!v)return;B(v)&&(g=v.body.start-l,u=v.body.end+l,M>=g&&M<=u&&(L=Math.min(M-g,u-M),a<=L&&(O=v.body,a=L)))}),O},x.getState=function(M){var O=I(M),L=this.fragments[O];return L?L.buffered?B(L)?P.PARTIAL:P.OK:L.backtrack?P.BACKTRACKED:P.APPENDING:P.NOT_LOADED},x.backtrack=function(M,O){var L=I(M),g=this.fragments[L];if(!g||g.backtrack)return null;var u=g.backtrack=O||g.loaded;return g.loaded=null,u},x.getBacktrackData=function(M){var O=I(M),L=this.fragments[O];if(L){var g,u=L.backtrack;if(u!=null&&(g=u.payload)!==null&&g!==void 0&&g.byteLength)return u;this.removeFragment(M)}return null},x.isTimeBuffered=function(M,O,L){for(var g,u,a=0;a<L.length;a++){if(g=L.start(a)-this.bufferPadding,u=L.end(a)+this.bufferPadding,M>=g&&O<=u)return!0;if(O<=g)return!1}return!1},x.onFragLoaded=function(M,O){var L=O.frag,g=O.part;if(L.sn==="initSegment"||L.bitrateTest||g)return;var u=I(L);this.fragments[u]={body:L,loaded:O,backtrack:null,buffered:!1,range:Object.create(null)}},x.onBufferAppended=function(M,O){var L=this,g=O.frag,u=O.part,a=O.timeRanges;if(g.type===w.PlaylistLevelType.MAIN)if(this.activeFragment=g,u){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(u)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(d){var E=a[d];if(L.detectEvictedFragments(d,E),!u)for(var v=0;v<E.length;v++)g.appendedPTS=Math.max(E.end(v),g.appendedPTS||0)})},x.onFragBuffered=function(M,O){this.detectPartialFragments(O)},x.hasFragment=function(M){var O=I(M);return!!this.fragments[O]},x.removeFragmentsInRange=function(M,O,L){var g=this;Object.keys(this.fragments).forEach(function(u){var a=g.fragments[u];if(!a)return;if(a.buffered){var l=a.body;l.type===L&&l.start<O&&l.end>M&&g.removeFragment(l)}})},x.removeFragment=function(M){var O=I(M);M.stats.loaded=0,M.clearElementaryStreamInfo(),delete this.fragments[O]},x.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},_}();function B(_){var x,A;return _.buffered&&(((x=_.range.video)===null||x===void 0?void 0:x.partial)||((A=_.range.audio)===null||A===void 0?void 0:A.partial))}function I(_){return _.type+"_"+_.level+"_"+_.urlId+"_"+_.sn}},"./src/controller/gap-controller.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"STALL_MINIMUM_DURATION_MS",function(){return B}),D.d(X,"MAX_START_GAP_JUMP",function(){return I}),D.d(X,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return _}),D.d(X,"SKIP_BUFFER_RANGE_START",function(){return x}),D.d(X,"default",function(){return A});var K=D("./src/utils/buffer-helper.ts"),w=D("./src/errors.ts"),P=D("./src/events.ts"),H=D("./src/utils/logger.ts"),B=250,I=2,_=.1,x=.05,A=function(){function M(L,g,u,a){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=L,this.media=g,this.fragmentTracker=u,this.hls=a}var O=M.prototype;return O.destroy=function(){this.hls=this.fragmentTracker=this.media=null},O.poll=function(g){var u=this.config,a=this.media,l=this.stalled,d=a.currentTime,E=a.seeking,v=this.seeking&&!E,m=!this.seeking&&E;if(this.seeking=E,d!==g){if(this.moved=!0,l!==null){if(this.stallReported){var k=self.performance.now()-l;H.logger.warn("playback not stuck anymore @"+d+", after "+Math.round(k)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((m||v)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!K.BufferHelper.getBuffered(a).length)return;var b=K.BufferHelper.bufferInfo(a,d,0),h=b.len>0,p=b.nextStart||0;if(!h&&!p)return;if(E){var c=b.len>I,o=!p||p-d>I&&!this.fragmentTracker.getPartialFragment(d);if(c||o)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var S,y=Math.max(p,b.start||0)-d,T=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,N=T==null||((S=T.details)===null||S===void 0)?void 0:S.live,z=N?T.details.targetduration*2:I;if(y>0&&y<=z){this._trySkipBufferHole(null);return}}var Y=self.performance.now();if(l===null){this.stalled=Y;return}var ee=Y-l;!E&&ee>=B&&this._reportStall(b.len);var G=K.BufferHelper.bufferInfo(a,d,u.maxBufferHole);this._tryFixBufferStall(G,ee)},O._tryFixBufferStall=function(g,u){var a=this.config,l=this.fragmentTracker,d=this.media,E=d.currentTime,v=l.getPartialFragment(E);if(v){var m=this._trySkipBufferHole(v);if(m)return}g.len>a.maxBufferHole&&u>a.highBufferWatchdogPeriod*1e3&&(H.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},O._reportStall=function(g){var u=this.hls,a=this.media,l=this.stallReported;l||(this.stallReported=!0,H.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+g+")"),u.trigger(P.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:g}))},O._trySkipBufferHole=function(g){for(var u=this.config,a=this.hls,l=this.media,d=l.currentTime,E=0,v=K.BufferHelper.getBuffered(l),m=0;m<v.length;m++){var k=v.start(m);if(d+u.maxBufferHole>=E&&d<k){var b=Math.max(k+x,l.currentTime+_);return H.logger.warn("skipping hole, adjusting currentTime from "+d+" to "+b),this.moved=!0,this.stalled=null,l.currentTime=b,g&&a.trigger(P.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+d+" to "+b,frag:g}),b}E=v.end(m)}return 0},O._tryNudgeBuffer=function(){var g=this.config,u=this.hls,a=this.media,l=a.currentTime,d=(this.nudgeRetry||0)+1;if(this.nudgeRetry=d,d<g.nudgeMaxRetry){var E=l+d*g.nudgeOffset;H.logger.warn("Nudging 'currentTime' from "+l+" to "+E),a.currentTime=E,u.trigger(P.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else H.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+g.nudgeMaxRetry+" nudges"),u.trigger(P.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},M}()},"./src/controller/id3-track-controller.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/events.ts"),w=D("./src/utils/texttrack-utils.ts"),P=D("./src/demux/id3.ts"),H=.25,B=function(){function I(x){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=x,this._registerListeners()}var _=I.prototype;return _.destroy=function(){this._unregisterListeners()},_._registerListeners=function(){var A=this.hls;A.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(K.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.on(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},_._unregisterListeners=function(){var A=this.hls;A.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(K.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.off(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},_.onMediaAttached=function(A,M){this.media=M.media},_.onMediaDetaching=function(){if(!this.id3Track)return;Object(w.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},_.getID3Track=function(A){if(!this.media)return;for(var M=0;M<A.length;M++){var O=A[M];if(O.kind==="metadata"&&O.label==="id3")return Object(w.sendAddTrackEvent)(O,this.media),O}return this.media.addTextTrack("metadata","id3")},_.onFragParsingMetadata=function(A,M){if(!this.media)return;var O=M.frag,L=M.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var g=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,u=0;u<L.length;u++){var a=P.getID3Frames(L[u].data);if(a){var l=L[u].pts,d=u<L.length-1?L[u+1].pts:O.end,E=d-l;E<=0&&(d=l+H);for(var v=0;v<a.length;v++){var m=a[v];if(!P.isTimeStampFrame(m)){var k=new g(l,d,"");k.value=m,this.id3Track.addCue(k)}}}}},_.onBufferFlushing=function(A,M){var O=M.startOffset,L=M.endOffset,g=M.type;if(!g||g==="audio"){var u=this.id3Track;u&&Object(w.removeCuesInRange)(u,O,L)}},I}();X.default=B},"./src/controller/latency-controller.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return I});var K=D("./src/errors.ts"),w=D("./src/events.ts"),P=D("./src/utils/logger.ts");function H(_,x){for(var A=0;A<x.length;A++){var M=x[A];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(_,M.key,M)}}function B(_,x,A){return x&&H(_.prototype,x),A&&H(_,A),_}var I=function(){function _(A){var M=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 M.timeupdate()},this.hls=A,this.config=A.config,this.registerListeners()}var x=_.prototype;return x.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},x.registerListeners=function(){this.hls.on(w.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(w.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(w.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(w.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(w.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){this.hls.off(w.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(w.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(w.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(w.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(w.Events.ERROR,this.onError)},x.onMediaAttached=function(M,O){this.media=O.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},x.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},x.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},x.onLevelUpdated=function(M,O){var L=O.details;this.levelDetails=L,L.advanced&&this.timeupdate(),!L.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},x.onError=function(M,O){if(O.details!==K.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,P.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},x.timeupdate=function(){var M=this.media,O=this.levelDetails;if(!M||!O)return;this.currentTime=M.currentTime;var L=this.computeLatency();if(L===null)return;this._latency=L;var g=this.config,u=g.lowLatencyMode,a=g.maxLiveSyncPlaybackRate;if(!u||a===1)return;var l=this.targetLatency;if(l===null)return;var d=L-l,E=Math.min(this.maxLatency,l+O.targetduration),v=d<E;if(O.live&&v&&d>.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,a)),k=Math.round(2/(1+Math.exp(-.75*d-this.edgeStalled))*20)/20;M.playbackRate=Math.min(m,Math.max(1,k))}else M.playbackRate!==1&&M.playbackRate!==0&&(M.playbackRate=1)},x.estimateLiveEdge=function(){var M=this.levelDetails;return M===null?null:M.edge+M.age},x.computeLatency=function(){var M=this.estimateLiveEdge();return M===null?null:M-this.currentTime},B(_,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var M=this.config,O=this.levelDetails;return M.liveMaxLatencyDuration!==void 0?M.liveMaxLatencyDuration:O?M.liveMaxLatencyDurationCount*O.targetduration:0}},{key:"targetLatency",get:function(){var M=this.levelDetails;if(M===null)return null;var O=M.holdBack,L=M.partHoldBack,g=M.targetduration,u=this.config,a=u.liveSyncDuration,l=u.liveSyncDurationCount,d=u.lowLatencyMode,E=this.hls.userConfig,v=d&&L||O;(E.liveSyncDuration||E.liveSyncDurationCount||v===0)&&(v=a!==void 0?a:l*g);var m=g,k=1;return v+Math.min(this.stallCount*k,m)}},{key:"liveSyncPosition",get:function(){var M=this.estimateLiveEdge(),O=this.targetLatency,L=this.levelDetails;if(M===null||O===null||L===null)return null;var g=L.edge,u=M-O-this.edgeStalled,a=g-L.totalduration,l=g-(this.config.lowLatencyMode&&L.partTarget||L.targetduration);return Math.min(Math.max(a,u),l)}},{key:"drift",get:function(){var M=this.levelDetails;return M===null?1:M.drift}},{key:"edgeStalled",get:function(){var M=this.levelDetails;if(M===null)return 0;var O=(this.config.lowLatencyMode&&M.partTarget||M.targetduration)*3;return Math.max(M.age-O,0)}},{key:"forwardBufferLength",get:function(){var M=this.media,O=this.levelDetails;if(!M||!O)return 0;var L=M.buffered.length;return L?M.buffered.end(L-1):O.edge-this.currentTime}}]),_}()},"./src/controller/level-controller.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return u});var K=D("./src/types/level.ts"),w=D("./src/events.ts"),P=D("./src/errors.ts"),H=D("./src/utils/codecs.ts"),B=D("./src/controller/level-helper.ts"),I=D("./src/controller/base-playlist-controller.ts"),_=D("./src/types/loader.ts");function x(){return x=Object.assign||function(a){for(var l=1;l<arguments.length;l++){var d=arguments[l];for(var E in d)Object.prototype.hasOwnProperty.call(d,E)&&(a[E]=d[E])}return a},x.apply(this,arguments)}function A(a,l){for(var d=0;d<l.length;d++){var E=l[d];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(a,E.key,E)}}function M(a,l,d){return l&&A(a.prototype,l),d&&A(a,d),a}function O(a,l){a.prototype=Object.create(l.prototype),a.prototype.constructor=a,L(a,l)}function L(a,l){return L=Object.setPrototypeOf||function(E,v){return E.__proto__=v,E},L(a,l)}var g=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),u=function(a){O(l,a);function l(E){var v;return v=a.call(this,E,"[level-controller]")||this,v._levels=[],v._firstLevel=-1,v._startLevel=void 0,v.currentLevelIndex=-1,v.manualLevelIndex=-1,v.onParsedComplete=void 0,v._registerListeners(),v}var d=l.prototype;return d._registerListeners=function(){var v=this.hls;v.on(w.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.on(w.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.on(w.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.on(w.Events.FRAG_LOADED,this.onFragLoaded,this),v.on(w.Events.ERROR,this.onError,this)},d._unregisterListeners=function(){var v=this.hls;v.off(w.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.off(w.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.off(w.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.off(w.Events.FRAG_LOADED,this.onFragLoaded,this),v.off(w.Events.ERROR,this.onError,this)},d.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,a.prototype.destroy.call(this)},d.startLoad=function(){var v=this._levels;v.forEach(function(m){m.loadError=0}),a.prototype.startLoad.call(this)},d.onManifestLoaded=function(v,m){var k=[],b=[],h=[],p,c={},o,S=!1,y=!1,T=!1;if(m.levels.forEach(function(ee){var G=ee.attrs;S=S||!!(ee.width&&ee.height),y=y||!!ee.videoCodec,T=T||!!ee.audioCodec,g&&ee.audioCodec&&ee.audioCodec.indexOf("mp4a.40.34")!==-1&&(ee.audioCodec=void 0);var W=ee.bitrate+"-"+ee.attrs.RESOLUTION+"-"+ee.attrs.CODECS;o=c[W],o?o.url.push(ee.url):(o=new K.Level(ee),c[W]=o,k.push(o)),G&&(G.AUDIO&&Object(B.addGroupId)(o,"audio",G.AUDIO),G.SUBTITLES&&Object(B.addGroupId)(o,"text",G.SUBTITLES))}),(S||y)&&T&&(k=k.filter(function(ee){var G=ee.videoCodec,W=ee.width,te=ee.height;return!!G||!!(W&&te)})),k=k.filter(function(ee){var G=ee.audioCodec,W=ee.videoCodec;return(!G||Object(H.isCodecSupportedInMp4)(G,"audio"))&&(!W||Object(H.isCodecSupportedInMp4)(W,"video"))}),m.audioTracks&&(b=m.audioTracks.filter(function(ee){return!ee.audioCodec||Object(H.isCodecSupportedInMp4)(ee.audioCodec,"audio")}),Object(B.assignTrackIdsByGroup)(b)),m.subtitles&&(h=m.subtitles,Object(B.assignTrackIdsByGroup)(h)),k.length>0){p=k[0].bitrate,k.sort(function(ee,G){return ee.bitrate-G.bitrate}),this._levels=k;for(var N=0;N<k.length;N++)if(k[N].bitrate===p){this._firstLevel=N,this.log("manifest loaded, "+k.length+" level(s) found, first bitrate: "+p);break}var z=T&&!y,Y={levels:k,audioTracks:b,subtitleTracks:h,firstLevel:this._firstLevel,stats:m.stats,audio:T,video:y,altAudio:!z&&b.some(function(ee){return!!ee.url})};this.hls.trigger(w.Events.MANIFEST_PARSED,Y),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(w.Events.ERROR,{type:P.ErrorTypes.MEDIA_ERROR,details:P.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:m.url,reason:"no level with compatible codecs found in manifest"})},d.onError=function(v,m){if(a.prototype.onError.call(this,v,m),m.fatal)return;var k=m.context,b=this._levels[this.currentLevelIndex];if(k&&(k.type===_.PlaylistContextType.AUDIO_TRACK&&b.audioGroupIds&&k.groupId===b.audioGroupIds[b.urlId]||k.type===_.PlaylistContextType.SUBTITLE_TRACK&&b.textGroupIds&&k.groupId===b.textGroupIds[b.urlId])){this.redundantFailover(this.currentLevelIndex);return}var h=!1,p=!0,c;switch(m.details){case P.ErrorDetails.FRAG_LOAD_ERROR:case P.ErrorDetails.FRAG_LOAD_TIMEOUT:case P.ErrorDetails.KEY_LOAD_ERROR:case P.ErrorDetails.KEY_LOAD_TIMEOUT:if(m.frag){var o=this._levels[m.frag.level];o?(o.fragmentError++,o.fragmentError>this.hls.config.fragLoadingMaxRetry&&(c=m.frag.level)):c=m.frag.level}break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:k&&(k.deliveryDirectives&&(p=!1),c=k.level),h=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:c=m.level,h=!0;break}c!==void 0&&this.recoverLevel(m,c,h,p)},d.recoverLevel=function(v,m,k,b){var h=v.details,p=this._levels[m];if(p.loadError++,k){var c=this.retryLoadingOrFail(v);if(c)v.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(b){var o=p.url.length;if(o>1&&p.loadError<o)v.levelRetry=!0,this.redundantFailover(m);else if(this.manualLevelIndex===-1){var S=m===0?this._levels.length-1:m-1;this.currentLevelIndex!==S&&this._levels[S].loadError===0&&(this.warn(h+": switch to "+S),v.levelRetry=!0,this.hls.nextAutoLevel=S)}}},d.redundantFailover=function(v){var m=this._levels[v],k=m.url.length;if(k>1){var b=(m.urlId+1)%k;this.warn("Switching to redundant URL-id "+b),this._levels.forEach(function(h){h.urlId=b}),this.level=v}},d.onFragLoaded=function(v,m){var k=m.frag;if(k!==void 0&&k.type===_.PlaylistLevelType.MAIN){var b=this._levels[k.level];b!==void 0&&(b.fragmentError=0,b.loadError=0)}},d.onLevelLoaded=function(v,m){var k,b=m.level,h=m.details,p=this._levels[b];if(!p){var c;this.warn("Invalid level index "+b),(c=m.deliveryDirectives)!==null&&c!==void 0&&c.skip&&(h.deltaUpdateFailed=!0);return}b===this.currentLevelIndex?(p.fragmentError===0&&(p.loadError=0,this.retryCount=0),this.playlistLoaded(b,m,p.details)):(k=m.deliveryDirectives)!==null&&k!==void 0&&k.skip&&(h.deltaUpdateFailed=!0)},d.onAudioTrackSwitched=function(v,m){var k=this.hls.levels[this.currentLevelIndex];if(!k)return;if(k.audioGroupIds){for(var b=-1,h=this.hls.audioTracks[m.id].groupId,p=0;p<k.audioGroupIds.length;p++)if(k.audioGroupIds[p]===h){b=p;break}b!==k.urlId&&(k.urlId=b,this.startLoad())}},d.loadPlaylist=function(v){var m=this.currentLevelIndex,k=this._levels[m];if(this.canLoad&&k&&k.url.length>0){var b=k.urlId,h=k.url[b];if(v)try{h=v.addDirectives(h)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("Attempt loading level index "+m+(v?" at sn "+v.msn+" part "+v.part:"")+" with URL-id "+b+" "+h),this.clearTimer(),this.hls.trigger(w.Events.LEVEL_LOADING,{url:h,level:m,id:b,deliveryDirectives:v||null})}},d.removeLevel=function(v,m){var k=function(p,c){return c!==m},b=this._levels.filter(function(h,p){return p!==v?!0:h.url.length>1&&m!==void 0?(h.url=h.url.filter(k),h.audioGroupIds&&(h.audioGroupIds=h.audioGroupIds.filter(k)),h.textGroupIds&&(h.textGroupIds=h.textGroupIds.filter(k)),h.urlId=0,!0):!1}).map(function(h,p){var c=h.details;return c!=null&&c.fragments&&c.fragments.forEach(function(o){o.level=p}),h});this._levels=b,this.hls.trigger(w.Events.LEVELS_UPDATED,{levels:b})},M(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(v){var m,k=this._levels;if(k.length===0)return;if(this.currentLevelIndex===v&&(m=k[v])!==null&&m!==void 0&&m.details)return;if(v<0||v>=k.length){var b=v<0;if(this.hls.trigger(w.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:v,fatal:b,reason:"invalid level idx"}),b)return;v=Math.min(v,k.length-1)}this.clearTimer();var h=this.currentLevelIndex,p=k[h],c=k[v];this.log("switching to level "+v+" from "+h),this.currentLevelIndex=v;var o=x({},c,{level:v,maxBitrate:c.maxBitrate,uri:c.uri,urlId:c.urlId});delete o._urlId,this.hls.trigger(w.Events.LEVEL_SWITCHING,o);var S=c.details;if(!S||S.live){var y=this.switchParams(c.uri,p==null?void 0:p.details);this.loadPlaylist(y)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(v){this.manualLevelIndex=v,this._startLevel===void 0&&(this._startLevel=v),v!==-1&&(this.level=v)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(v){this._firstLevel=v}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var v=this.hls.config.startLevel;return v!==void 0?v:this._firstLevel}else return this._startLevel},set:function(v){this._startLevel=v}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(v){this.level=v,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=v)}}]),l}(I.default)},"./src/controller/level-helper.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"addGroupId",function(){return P}),D.d(X,"assignTrackIdsByGroup",function(){return H}),D.d(X,"updatePTS",function(){return B}),D.d(X,"updateFragPTSDTS",function(){return _}),D.d(X,"mergeDetails",function(){return x}),D.d(X,"mapPartIntersection",function(){return A}),D.d(X,"mapFragmentIntersection",function(){return M}),D.d(X,"adjustSliding",function(){return O}),D.d(X,"addSliding",function(){return L}),D.d(X,"computeReloadInterval",function(){return g}),D.d(X,"getFragmentWithSN",function(){return u}),D.d(X,"getPartWith",function(){return a});var K=D("./src/polyfills/number.ts"),w=D("./src/utils/logger.ts");function P(l,d,E){switch(d){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(E);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(E);break}}function H(l){var d={};l.forEach(function(E){var v=E.groupId||"";E.id=d[v]=d[v]||0,d[v]++})}function B(l,d,E){var v=l[d],m=l[E];I(v,m)}function I(l,d){var E=d.startPTS;if(Object(K.isFiniteNumber)(E)){var v=0,m;d.sn>l.sn?(v=E-l.start,m=l):(v=l.start-E,m=d),m.duration!==v&&(m.duration=v)}else if(d.sn>l.sn){var k=l.cc===d.cc;k&&l.minEndPTS?d.start=l.start+(l.minEndPTS-l.start):d.start=l.start+l.duration}else d.start=Math.max(l.start-d.duration,0)}function _(l,d,E,v,m,k){var b=v-E;b<=0&&(w.logger.warn("Fragment should have a positive duration",d),v=E+d.duration,k=m+d.duration);var h=E,p=v,c=d.startPTS,o=d.endPTS;if(Object(K.isFiniteNumber)(c)){var S=Math.abs(c-E);Object(K.isFiniteNumber)(d.deltaPTS)?d.deltaPTS=Math.max(S,d.deltaPTS):d.deltaPTS=S,h=Math.max(E,c),E=Math.min(E,c),m=Math.min(m,d.startDTS),p=Math.min(v,o),v=Math.max(v,o),k=Math.max(k,d.endDTS)}d.duration=v-E;var y=E-d.start;d.appendedPTS=v,d.start=d.startPTS=E,d.maxStartPTS=h,d.startDTS=m,d.endPTS=v,d.minEndPTS=p,d.endDTS=k;var T=d.sn;if(!l||T<l.startSN||T>l.endSN)return 0;var N,z=T-l.startSN,Y=l.fragments;for(Y[z]=d,N=z;N>0;N--)I(Y[N],Y[N-1]);for(N=z;N<Y.length-1;N++)I(Y[N],Y[N+1]);return l.fragmentHint&&I(Y[Y.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,y}function x(l,d){for(var E=null,v=l.fragments,m=v.length-1;m>=0;m--){var k=v[m].initSegment;if(k){E=k;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var b=0,h;if(M(l,d,function(N,z){N.relurl&&(b=N.cc-z.cc),Object(K.isFiniteNumber)(N.startPTS)&&Object(K.isFiniteNumber)(N.endPTS)&&(z.start=z.startPTS=N.startPTS,z.startDTS=N.startDTS,z.appendedPTS=N.appendedPTS,z.maxStartPTS=N.maxStartPTS,z.endPTS=N.endPTS,z.endDTS=N.endDTS,z.minEndPTS=N.minEndPTS,z.duration=N.endPTS-N.startPTS,z.duration&&(h=z),d.PTSKnown=d.alignedSliding=!0),z.elementaryStreams=N.elementaryStreams,z.loader=N.loader,z.stats=N.stats,z.urlId=N.urlId,N.initSegment&&(z.initSegment=N.initSegment,E=N.initSegment)}),E){var p=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments;p.forEach(function(N){var z;(!N.initSegment||N.initSegment.relurl===((z=E)===null||z===void 0?void 0:z.relurl))&&(N.initSegment=E)})}if(d.skippedSegments&&(d.deltaUpdateFailed=d.fragments.some(function(N){return!N}),d.deltaUpdateFailed)){w.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var c=d.skippedSegments;c--;)d.fragments.shift();d.startSN=d.fragments[0].sn,d.startCC=d.fragments[0].cc}var o=d.fragments;if(b){w.logger.warn("discontinuity sliding from playlist, take drift into account");for(var S=0;S<o.length;S++)o[S].cc+=b}d.skippedSegments&&(d.startCC=d.fragments[0].cc),A(l.partList,d.partList,function(N,z){z.elementaryStreams=N.elementaryStreams,z.stats=N.stats}),h?_(d,h,h.startPTS,h.endPTS,h.startDTS,h.endDTS):O(l,d),o.length&&(d.totalduration=d.edge-o[0].start),d.driftStartTime=l.driftStartTime,d.driftStart=l.driftStart;var y=d.advancedDateTime;if(d.advanced&&y){var T=d.edge;d.driftStart||(d.driftStartTime=y,d.driftStart=T),d.driftEndTime=y,d.driftEnd=T}else d.driftEndTime=l.driftEndTime,d.driftEnd=l.driftEnd,d.advancedDateTime=l.advancedDateTime}function A(l,d,E){if(l&&d)for(var v=0,m=0,k=l.length;m<=k;m++){var b=l[m],h=d[m+v];b&&h&&b.index===h.index&&b.fragment.sn===h.fragment.sn?E(b,h):v--}}function M(l,d,E){for(var v=d.skippedSegments,m=Math.max(l.startSN,d.startSN)-d.startSN,k=(l.fragmentHint?1:0)+(v?d.endSN:Math.min(l.endSN,d.endSN))-d.startSN,b=d.startSN-l.startSN,h=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments,p=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,c=m;c<=k;c++){var o=p[b+c],S=h[c];v&&!S&&c<v&&(S=d.fragments[c]=o),o&&S&&E(o,S)}}function O(l,d){var E=d.startSN+d.skippedSegments-l.startSN,v=l.fragments;if(E<0||E>=v.length)return;L(d,v[E].start)}function L(l,d){if(d){for(var E=l.fragments,v=l.skippedSegments;v<E.length;v++)E[v].start+=d;l.fragmentHint&&(l.fragmentHint.start+=d)}}function g(l,d){var E=1e3*l.levelTargetDuration,v=E/2,m=l.age,k=m>0&&m<E*3,b=d.loading.end-d.loading.start,h,p=l.availabilityDelay;if(l.updated===!1)if(k){var c=333*l.misses;h=Math.max(Math.min(v,b*2),c),l.availabilityDelay=(l.availabilityDelay||0)+h}else h=v;else k?(p=Math.min(p||E/2,m),l.availabilityDelay=p,h=p+E-m):h=E-b;return Math.round(h)}function u(l,d,E){if(!l||!l.details)return null;var v=l.details,m=v.fragments[d-v.startSN];return m||(m=v.fragmentHint,m&&m.sn===d?m:d<v.startSN&&E&&E.sn===d?E:null)}function a(l,d,E){if(!l||!l.details)return null;var v=l.details.partList;if(v)for(var m=v.length;m--;){var k=v[m];if(k.index===E&&k.fragment.sn===d)return k}return null}},"./src/controller/stream-controller.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return v});var K=D("./src/polyfills/number.ts"),w=D("./src/controller/base-stream-controller.ts"),P=D("./src/is-supported.ts"),H=D("./src/events.ts"),B=D("./src/utils/buffer-helper.ts"),I=D("./src/controller/fragment-tracker.ts"),_=D("./src/types/loader.ts"),x=D("./src/loader/fragment.ts"),A=D("./src/demux/transmuxer-interface.ts"),M=D("./src/types/transmuxer.ts"),O=D("./src/controller/gap-controller.ts"),L=D("./src/errors.ts"),g=D("./src/utils/logger.ts");function u(m,k){for(var b=0;b<k.length;b++){var h=k[b];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(m,h.key,h)}}function a(m,k,b){return k&&u(m.prototype,k),b&&u(m,b),m}function l(m,k){m.prototype=Object.create(k.prototype),m.prototype.constructor=m,d(m,k)}function d(m,k){return d=Object.setPrototypeOf||function(h,p){return h.__proto__=p,h},d(m,k)}var E=100,v=function(m){l(k,m);function k(h,p){var c;return c=m.call(this,h,p,"[stream-controller]")||this,c.audioCodecSwap=!1,c.gapController=null,c.level=-1,c._forceStartLoad=!1,c.altAudio=!1,c.audioOnly=!1,c.fragPlaying=null,c.onvplaying=null,c.onvseeked=null,c.fragLastKbps=0,c.stalled=!1,c.couldBacktrack=!1,c.audioCodecSwitch=!1,c.videoBuffer=null,c._registerListeners(),c}var b=k.prototype;return b._registerListeners=function(){var p=this.hls;p.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),p.on(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(H.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),p.on(H.Events.ERROR,this.onError,this),p.on(H.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),p.on(H.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.on(H.Events.BUFFER_CREATED,this.onBufferCreated,this),p.on(H.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),p.on(H.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),p.on(H.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var p=this.hls;p.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.off(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(H.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),p.off(H.Events.ERROR,this.onError,this),p.off(H.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),p.off(H.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.off(H.Events.BUFFER_CREATED,this.onBufferCreated,this),p.off(H.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),p.off(H.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),p.off(H.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},b.startLoad=function(p){if(this.levels){var c=this.lastCurrentTime,o=this.hls;if(this.stopLoad(),this.setInterval(E),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var S=o.startLevel;S===-1&&(o.config.testBandwidth?(S=0,this.bitrateTest=!0):S=o.nextAutoLevel),this.level=o.nextLoadLevel=S,this.loadedmetadata=!1}c>0&&p===-1&&(this.log("Override startPosition with lastCurrentTime @"+c.toFixed(3)),p=c),this.state=w.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=p,this.tick()}else this._forceStartLoad=!0,this.state=w.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case w.State.IDLE:this.doTickIdle();break;case w.State.WAITING_LEVEL:{var p,c=this.levels,o=this.level,S=c==null||((p=c[o])===null||p===void 0)?void 0:p.details;if(S&&(!S.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(S))break;this.state=w.State.IDLE;break}break}case w.State.FRAG_LOADING_WAITING_RETRY:{var y,T=self.performance.now(),N=this.retryDate;(!N||T>=N||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=w.State.IDLE)}break;default:break}this.onTickEnd()},b.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var p,c,o=this.hls,S=this.levelLastLoaded,y=this.levels,T=this.media,N=o.config,z=o.nextLoadLevel;if(S===null||!T&&(this.startFragRequested||!N.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!y||!y[z])return;var Y=y[z];this.level=o.nextLoadLevel=z;var ee=Y.details;if(!ee||this.state===w.State.WAITING_LEVEL||ee.live&&this.levelLastLoaded!==z){this.state=w.State.WAITING_LEVEL;return}var G=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:T,_.PlaylistLevelType.MAIN);if(G===null)return;var W=G.len,te=this.getMaxBufferLength(Y.maxBitrate);if(W>=te)return;if(this._streamEnded(G,ee)){var ue={};this.altAudio&&(ue.type="video"),this.hls.trigger(H.Events.BUFFER_EOS,ue),this.state=w.State.ENDED;return}var be=G.end,Oe=this.getNextFragment(be,ee);if(this.couldBacktrack&&!this.fragPrevious&&Oe&&Oe.sn!=="initSegment"){var Ke=Oe.sn-ee.startSN;Ke>1&&(Oe=ee.fragments[Ke-1],this.fragmentTracker.removeFragment(Oe))}if(Oe&&this.fragmentTracker.getState(Oe)===I.FragmentState.OK&&this.nextLoadPosition>be){var _e=this.audioOnly&&!this.altAudio?x.ElementaryStreamTypes.AUDIO:x.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(T,_e,_.PlaylistLevelType.MAIN),Oe=this.getNextFragment(this.nextLoadPosition,ee)}if(!Oe)return;Oe.initSegment&&!Oe.initSegment.data&&!this.bitrateTest&&(Oe=Oe.initSegment),((p=Oe.decryptdata)===null||p===void 0?void 0:p.keyFormat)==="identity"&&!((c=Oe.decryptdata)!==null&&c!==void 0&&c.key)?this.loadKey(Oe,ee):this.loadFragment(Oe,ee,be)},b.loadFragment=function(p,c,o){var S,y=this.fragmentTracker.getState(p);if(this.fragCurrent=p,y===I.FragmentState.BACKTRACKED){var T=this.fragmentTracker.getBacktrackData(p);if(T){this._handleFragmentLoadProgress(T),this._handleFragmentLoadComplete(T);return}else y=I.FragmentState.NOT_LOADED}y===I.FragmentState.NOT_LOADED||y===I.FragmentState.PARTIAL?p.sn==="initSegment"?this._loadInitSegment(p):this.bitrateTest?(p.bitrateTest=!0,this.log("Fragment "+p.sn+" of level "+p.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(p)):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,p,c,o)):y===I.FragmentState.APPENDING?this.reduceMaxBufferLength(p.duration)&&this.fragmentTracker.removeFragment(p):((S=this.media)===null||S===void 0?void 0:S.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},b.getAppendedFrag=function(p){var c=this.fragmentTracker.getAppendedFrag(p,_.PlaylistLevelType.MAIN);return c&&"fragment"in c?c.fragment:c},b.getBufferedFrag=function(p){return this.fragmentTracker.getBufferedFrag(p,_.PlaylistLevelType.MAIN)},b.followingBufferedFrag=function(p){return p?this.getBufferedFrag(p.end+.5):null},b.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},b.nextLevelSwitch=function(){var p=this.levels,c=this.media;if(c!=null&&c.readyState){var o,S=this.getAppendedFrag(c.currentTime);if(S&&S.start>1&&this.flushMainBuffer(0,S.start-1),!c.paused&&p){var y=this.hls.nextLoadLevel,T=p[y],N=this.fragLastKbps;N&&this.fragCurrent?o=this.fragCurrent.duration*T.maxBitrate/(1e3*N)+1:o=0}else o=0;var z=this.getBufferedFrag(c.currentTime+o);if(z){var Y=this.followingBufferedFrag(z);if(Y){this.abortCurrentFrag();var ee=Y.maxStartPTS?Y.maxStartPTS:Y.start,G=Y.duration,W=Math.max(z.end,ee+Math.min(Math.max(G-this.config.maxFragLookUpTolerance,G*.5),G*.75));this.flushMainBuffer(W,Number.POSITIVE_INFINITY)}}}},b.abortCurrentFrag=function(){var p=this.fragCurrent;this.fragCurrent=null,p!=null&&p.loader&&p.loader.abort(),this.state===w.State.KEY_LOADING&&(this.state=w.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},b.flushMainBuffer=function(p,c){m.prototype.flushMainBuffer.call(this,p,c,this.altAudio?"video":null)},b.onMediaAttached=function(p,c){m.prototype.onMediaAttached.call(this,p,c);var o=c.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),o.addEventListener("playing",this.onvplaying),o.addEventListener("seeked",this.onvseeked),this.gapController=new O.default(this.config,o,this.fragmentTracker,this.hls)},b.onMediaDetaching=function(){var p=this.media;p&&(p.removeEventListener("playing",this.onvplaying),p.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),m.prototype.onMediaDetaching.call(this)},b.onMediaPlaying=function(){this.tick()},b.onMediaSeeked=function(){var p=this.media,c=p?p.currentTime:null;Object(K.isFiniteNumber)(c)&&this.log("Media seeked to "+c.toFixed(3)),this.tick()},b.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(H.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},b.onManifestParsed=function(p,c){var o=!1,S=!1,y;c.levels.forEach(function(T){y=T.audioCodec,y&&(y.indexOf("mp4a.40.2")!==-1&&(o=!0),y.indexOf("mp4a.40.5")!==-1&&(S=!0))}),this.audioCodecSwitch=o&&S&&!Object(P.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=c.levels,this.startFragRequested=!1},b.onLevelLoading=function(p,c){var o=this.levels;if(!o||this.state!==w.State.IDLE)return;var S=o[c.level];(!S.details||S.details.live&&this.levelLastLoaded!==c.level||this.waitForCdnTuneIn(S.details))&&(this.state=w.State.WAITING_LEVEL)},b.onLevelLoaded=function(p,c){var o,S=this.levels,y=c.level,T=c.details,N=T.totalduration;if(!S){this.warn("Levels were reset while loading level "+y);return}this.log("Level "+y+" loaded ["+T.startSN+","+T.endSN+"], cc ["+T.startCC+", "+T.endCC+"] duration:"+N);var z=this.fragCurrent;z&&(this.state===w.State.FRAG_LOADING||this.state===w.State.FRAG_LOADING_WAITING_RETRY)&&(z.level!==c.level&&z.loader&&(this.state=w.State.IDLE,z.loader.abort()));var Y=S[y],ee=0;if(T.live||(o=Y.details)!==null&&o!==void 0&&o.live){if(T.fragments[0]||(T.deltaUpdateFailed=!0),T.deltaUpdateFailed)return;ee=this.alignPlaylists(T,Y.details)}if(Y.details=T,this.levelLastLoaded=y,this.hls.trigger(H.Events.LEVEL_UPDATED,{details:T,level:y}),this.state===w.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(T))return;this.state=w.State.IDLE}this.startFragRequested?T.live&&this.synchronizeToLiveEdge(T):this.setStartPosition(T,ee),this.tick()},b._handleFragmentLoadProgress=function(p){var c,o=p.frag,S=p.part,y=p.payload,T=this.levels;if(!T){this.warn("Levels were reset while fragment load was in progress. Fragment "+o.sn+" of level "+o.level+" will not be buffered");return}var N=T[o.level],z=N.details;if(!z){this.warn("Dropping fragment "+o.sn+" of level "+o.level+" after level details were reset");return}var Y=N.videoCodec,ee=z.PTSKnown||!z.live,G=(c=o.initSegment)===null||c===void 0?void 0:c.data,W=this._getAudioCodec(N),te=this.transmuxer=this.transmuxer||new A.default(this.hls,_.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ue=S?S.index:-1,be=ue!==-1,Oe=new M.ChunkMetadata(o.level,o.sn,o.stats.chunkCount,y.byteLength,ue,be),Ke=this.initPTS[o.cc];te.push(y,G,W,Y,o,S,z.totalduration,ee,Oe,Ke)},b.onAudioTrackSwitching=function(p,c){var o=this.altAudio,S=!!c.url,y=c.id;if(!S){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var T=this.fragCurrent;T!=null&&T.loader&&(this.log("Switching to main audio track, cancel main fragment load"),T.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var N=this.hls;o&&N.trigger(H.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),N.trigger(H.Events.AUDIO_TRACK_SWITCHED,{id:y})}},b.onAudioTrackSwitched=function(p,c){var o=c.id,S=!!this.hls.audioTracks[o].url;if(S){var y=this.videoBuffer;y&&this.mediaBuffer!==y&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=y)}this.altAudio=S,this.tick()},b.onBufferCreated=function(p,c){var o=c.tracks,S,y,T=!1;for(var N in o){var z=o[N];if(z.id==="main"){if(y=N,S=z,N==="video"){var Y=o[N];Y&&(this.videoBuffer=Y.buffer)}}else T=!0}T&&S?(this.log("Alternate track found, use "+y+".buffered to schedule main fragment loading"),this.mediaBuffer=S.buffer):this.mediaBuffer=this.media},b.onFragBuffered=function(p,c){var o=c.frag,S=c.part;if(o&&o.type!==_.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(o)){this.warn("Fragment "+o.sn+(S?" p: "+S.index:"")+" of level "+o.level+" finished buffering, but was aborted. state: "+this.state),this.state===w.State.PARSED&&(this.state=w.State.IDLE);return}var y=S?S.stats:o.stats;this.fragLastKbps=Math.round(8*y.total/(y.buffering.end-y.loading.first)),o.sn!=="initSegment"&&(this.fragPrevious=o),this.fragBufferedComplete(o,S)},b.onError=function(p,c){switch(c.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(_.PlaylistLevelType.MAIN,c);break;case L.ErrorDetails.LEVEL_LOAD_ERROR:case L.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==w.State.ERROR&&(c.fatal?(this.warn(""+c.details),this.state=w.State.ERROR):!c.levelRetry&&this.state===w.State.WAITING_LEVEL&&(this.state=w.State.IDLE));break;case L.ErrorDetails.BUFFER_FULL_ERROR:if(c.parent==="main"&&(this.state===w.State.PARSING||this.state===w.State.PARSED)){var o=!0,S=this.getFwdBufferInfo(this.media,_.PlaylistLevelType.MAIN);S&&S.len>.5&&(o=!this.reduceMaxBufferLength(S.len)),o&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},b.checkBuffer=function(){var p=this.media,c=this.gapController;if(!p||!c||!p.readyState)return;var o=B.BufferHelper.getBuffered(p);!this.loadedmetadata&&o.length?(this.loadedmetadata=!0,this.seekToStartPos()):c.poll(this.lastCurrentTime),this.lastCurrentTime=p.currentTime},b.onFragLoadEmergencyAborted=function(){this.state=w.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},b.onBufferFlushed=function(p,c){var o=c.type;if(o!==x.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var S=(o===x.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(S,o,_.PlaylistLevelType.MAIN)}},b.onLevelsUpdated=function(p,c){this.levels=c.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var p=this.media,c=p.currentTime,o=this.startPosition;if(o>=0&&c<o){if(p.seeking){g.logger.log("could not seek to "+o+", already seeking at "+c);return}var S=B.BufferHelper.getBuffered(p),y=S.length?S.start(0):0,T=y-o;T>0&&(T<this.config.maxBufferHole||T<this.config.maxFragLookUpTolerance)&&(g.logger.log("adjusting start position by "+T+" to match buffer start"),o+=T,this.startPosition=o),this.log("seek to target start position "+o+" from current time "+c),p.currentTime=o}},b._getAudioCodec=function(p){var c=this.config.defaultAudioCodec||p.audioCodec;return this.audioCodecSwap&&c&&(this.log("Swapping audio codec"),c.indexOf("mp4a.40.5")!==-1?c="mp4a.40.2":c="mp4a.40.5"),c},b._loadBitrateTestFrag=function(p){var c=this;this._doFragLoad(p).then(function(o){var S=c.hls;if(!o||S.nextLoadLevel||c.fragContextChanged(p))return;c.fragLoadError=0,c.state=w.State.IDLE,c.startFragRequested=!1,c.bitrateTest=!1;var y=p.stats;y.parsing.start=y.parsing.end=y.buffering.start=y.buffering.end=self.performance.now(),S.trigger(H.Events.FRAG_LOADED,o)})},b._handleTransmuxComplete=function(p){var c,o="main",S=this.hls,y=p.remuxResult,T=p.chunkMeta,N=this.getCurrentContext(T);if(!N){this.warn("The loading context changed while buffering fragment "+T.sn+" of level "+T.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(T.level);return}var z=N.frag,Y=N.part,ee=N.level,G=y.video,W=y.text,te=y.id3,ue=y.initSegment,be=this.altAudio?void 0:y.audio;if(this.fragContextChanged(z))return;if(this.state=w.State.PARSING,ue){ue.tracks&&(this._bufferInitSegment(ee,ue.tracks,z,T),S.trigger(H.Events.FRAG_PARSING_INIT_SEGMENT,{frag:z,id:o,tracks:ue.tracks}));var Oe=ue.initPTS,Ke=ue.timescale;Object(K.isFiniteNumber)(Oe)&&(this.initPTS[z.cc]=Oe,S.trigger(H.Events.INIT_PTS_FOUND,{frag:z,id:o,initPTS:Oe,timescale:Ke}))}if(G&&y.independent!==!1){if(ee.details){var _e=G.startPTS,Ie=G.endPTS,Ue=G.startDTS,Pe=G.endDTS;if(Y)Y.elementaryStreams[G.type]={startPTS:_e,endPTS:Ie,startDTS:Ue,endDTS:Pe};else if(G.firstKeyFrame&&G.independent&&(this.couldBacktrack=!0),G.dropped&&G.independent){var Te=this.getLoadPosition()+this.config.maxBufferHole;if(Te<_e){this.backtrack(z);return}z.setElementaryStreamInfo(G.type,z.start,Ie,z.start,Pe,!0)}z.setElementaryStreamInfo(G.type,_e,Ie,Ue,Pe),this.bufferFragmentData(G,z,Y,T)}}else if(y.independent===!1){this.backtrack(z);return}if(be){var se=be.startPTS,He=be.endPTS,ht=be.startDTS,it=be.endDTS;Y&&(Y.elementaryStreams[x.ElementaryStreamTypes.AUDIO]={startPTS:se,endPTS:He,startDTS:ht,endDTS:it}),z.setElementaryStreamInfo(x.ElementaryStreamTypes.AUDIO,se,He,ht,it),this.bufferFragmentData(be,z,Y,T)}if(te!=null&&(c=te.samples)!==null&&c!==void 0&&c.length){var at={frag:z,id:o,samples:te.samples};S.trigger(H.Events.FRAG_PARSING_METADATA,at)}if(W){var ft={frag:z,id:o,samples:W.samples};S.trigger(H.Events.FRAG_PARSING_USERDATA,ft)}},b._bufferInitSegment=function(p,c,o,S){var y=this;if(this.state!==w.State.PARSING)return;this.audioOnly=!!c.audio&&!c.video,this.altAudio&&!this.audioOnly&&delete c.audio;var T=c.audio,N=c.video,z=c.audiovideo;if(T){var Y=p.audioCodec,ee=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(Y&&(Y.indexOf("mp4a.40.5")!==-1?Y="mp4a.40.2":Y="mp4a.40.5"),T.metadata.channelCount!==1&&ee.indexOf("firefox")===-1&&(Y="mp4a.40.5")),ee.indexOf("android")!==-1&&T.container!=="audio/mpeg"&&(Y="mp4a.40.2",this.log("Android: force audio codec to "+Y)),p.audioCodec&&p.audioCodec!==Y&&this.log('Swapping manifest audio codec "'+p.audioCodec+'" for "'+Y+'"'),T.levelCodec=Y,T.id="main",this.log("Init audio buffer, container:"+T.container+", codecs[selected/level/parsed]=["+(Y||"")+"/"+(p.audioCodec||"")+"/"+T.codec+"]")}N&&(N.levelCodec=p.videoCodec,N.id="main",this.log("Init video buffer, container:"+N.container+", codecs[level/parsed]=["+(p.videoCodec||"")+"/"+N.codec+"]")),z&&this.log("Init audiovideo buffer, container:"+z.container+", codecs[level/parsed]=["+(p.attrs.CODECS||"")+"/"+z.codec+"]"),this.hls.trigger(H.Events.BUFFER_CODECS,c),Object.keys(c).forEach(function(G){var W=c[G],te=W.initSegment;te!=null&&te.byteLength&&y.hls.trigger(H.Events.BUFFER_APPENDING,{type:G,data:te,frag:o,part:null,chunkMeta:S,parent:o.type})}),this.tick()},b.backtrack=function(p){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(p);var c=this.fragmentTracker.backtrack(p);this.fragPrevious=null,this.nextLoadPosition=p.start,c?this.resetFragmentLoading(p):this.state=w.State.BACKTRACKING},b.checkFragmentChanged=function(){var p=this.media,c=null;if(p&&p.readyState>1&&p.seeking===!1){var o=p.currentTime;if(B.BufferHelper.isBuffered(p,o)?c=this.getAppendedFrag(o):B.BufferHelper.isBuffered(p,o+.1)&&(c=this.getAppendedFrag(o+.1)),c){var S=this.fragPlaying,y=c.level;(!S||c.sn!==S.sn||S.level!==y||c.urlId!==S.urlId)&&(this.hls.trigger(H.Events.FRAG_CHANGED,{frag:c}),(!S||S.level!==y)&&this.hls.trigger(H.Events.LEVEL_SWITCHED,{level:y}),this.fragPlaying=c)}}},a(k,[{key:"nextLevel",get:function(){var p=this.nextBufferedFrag;return p?p.level:-1}},{key:"currentLevel",get:function(){var p=this.media;if(p){var c=this.getAppendedFrag(p.currentTime);if(c)return c.level}return-1}},{key:"nextBufferedFrag",get:function(){var p=this.media;if(p){var c=this.getAppendedFrag(p.currentTime);return this.followingBufferedFrag(c)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),k}(w.default)},"./src/controller/subtitle-stream-controller.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"SubtitleStreamController",function(){return l});var K=D("./src/events.ts"),w=D("./src/utils/logger.ts"),P=D("./src/utils/buffer-helper.ts"),H=D("./src/controller/fragment-finders.ts"),B=D("./src/utils/discontinuities.ts"),I=D("./src/controller/level-helper.ts"),_=D("./src/controller/fragment-tracker.ts"),x=D("./src/controller/base-stream-controller.ts"),A=D("./src/types/loader.ts"),M=D("./src/types/level.ts");function O(d,E){for(var v=0;v<E.length;v++){var m=E[v];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(d,m.key,m)}}function L(d,E,v){return E&&O(d.prototype,E),v&&O(d,v),d}function g(d,E){d.prototype=Object.create(E.prototype),d.prototype.constructor=d,u(d,E)}function u(d,E){return u=Object.setPrototypeOf||function(m,k){return m.__proto__=k,m},u(d,E)}var a=500,l=function(d){g(E,d);function E(m,k){var b;return b=d.call(this,m,k,"[subtitle-stream-controller]")||this,b.levels=[],b.currentTrackId=-1,b.tracksBuffered=[],b.mainDetails=null,b._registerListeners(),b}var v=E.prototype;return v.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},v._registerListeners=function(){var k=this.hls;k.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),k.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),k.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),k.on(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),k.on(K.Events.ERROR,this.onError,this),k.on(K.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),k.on(K.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),k.on(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),k.on(K.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),k.on(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v._unregisterListeners=function(){var k=this.hls;k.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),k.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),k.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),k.off(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),k.off(K.Events.ERROR,this.onError,this),k.off(K.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),k.off(K.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),k.off(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),k.off(K.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),k.off(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v.startLoad=function(){this.stopLoad(),this.state=x.State.IDLE,this.setInterval(a),this.tick()},v.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},v.onLevelLoaded=function(k,b){this.mainDetails=b.details},v.onSubtitleFragProcessed=function(k,b){var h=b.frag,p=b.success;if(this.fragPrevious=h,this.state=x.State.IDLE,!p)return;var c=this.tracksBuffered[this.currentTrackId];if(!c)return;for(var o,S=h.start,y=0;y<c.length;y++)if(S>=c[y].start&&S<=c[y].end){o=c[y];break}var T=h.start+h.duration;o?o.end=T:(o={start:S,end:T},c.push(o)),this.fragmentTracker.fragBuffered(h)},v.onBufferFlushing=function(k,b){var h=b.startOffset,p=b.endOffset;if(h===0&&p!==Number.POSITIVE_INFINITY){var c=this.currentTrackId,o=this.levels;if(!o.length||!o[c]||!o[c].details)return;var S=o[c].details,y=S.targetduration,T=p-y;if(T<=0)return;b.endOffsetSubtitles=Math.max(0,T),this.tracksBuffered.forEach(function(N){for(var z=0;z<N.length;){if(N[z].end<=T){N.shift();continue}else if(N[z].start<T)N[z].start=T;else break;z++}}),this.fragmentTracker.removeFragmentsInRange(h,T,A.PlaylistLevelType.SUBTITLE)}},v.onError=function(k,b){var h,p=b.frag;if(!p||p.type!==A.PlaylistLevelType.SUBTITLE)return;(h=this.fragCurrent)!==null&&h!==void 0&&h.loader&&this.fragCurrent.loader.abort(),this.state=x.State.IDLE},v.onSubtitleTracksUpdated=function(k,b){var h=this,p=b.subtitleTracks;this.tracksBuffered=[],this.levels=p.map(function(c){return new M.Level(c)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(c){h.tracksBuffered[c.id]=[]}),this.mediaBuffer=null},v.onSubtitleTrackSwitch=function(k,b){if(this.currentTrackId=b.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var h=this.levels[this.currentTrackId];h!=null&&h.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,h&&this.setInterval(a)},v.onSubtitleTrackLoaded=function(k,b){var h,p=b.details,c=b.id,o=this.currentTrackId,S=this.levels;if(!S.length)return;var y=S[o];if(c>=S.length||c!==o||!y)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,p.live||(h=y.details)!==null&&h!==void 0&&h.live){var T=this.mainDetails;if(p.deltaUpdateFailed||!T)return;var N=T.fragments[0];if(!y.details)p.hasProgramDateTime&&T.hasProgramDateTime?Object(B.alignMediaPlaylistByPDT)(p,T):N&&Object(I.addSliding)(p,N.start);else{var z=this.alignPlaylists(p,y.details);z===0&&N&&Object(I.addSliding)(p,N.start)}}if(y.details=p,this.levelLastLoaded=c,this.tick(),p.live&&!this.fragCurrent&&this.media&&this.state===x.State.IDLE){var Y=Object(H.findFragmentByPTS)(null,p.fragments,this.media.currentTime,0);Y||(this.warn("Subtitle playlist not aligned with playback"),y.details=void 0)}},v._handleFragmentLoadComplete=function(k){var b=k.frag,h=k.payload,p=b.decryptdata,c=this.hls;if(this.fragContextChanged(b))return;if(h&&h.byteLength>0&&p&&p.key&&p.iv&&p.method==="AES-128"){var o=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(h),p.key.buffer,p.iv.buffer).then(function(S){var y=performance.now();c.trigger(K.Events.FRAG_DECRYPTED,{frag:b,payload:S,stats:{tstart:o,tdecrypt:y}})})}},v.doTick=function(){if(!this.media){this.state=x.State.IDLE;return}if(this.state===x.State.IDLE){var k,b=this.currentTrackId,h=this.levels;if(!h.length||!h[b]||!h[b].details)return;var p=h[b].details,c=p.targetduration,o=this.config,S=this.media,y=P.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,S.currentTime-c,o.maxBufferHole),T=y.end,N=y.len,z=this.getMaxBufferLength()+c;if(N>z)return;console.assert(p,"Subtitle track details are defined on idle subtitle stream controller tick");var Y=p.fragments,ee=Y.length,G=p.edge,W,te=this.fragPrevious;if(T<G){var ue=o.maxFragLookUpTolerance;te&&p.hasProgramDateTime&&(W=Object(H.findFragmentByPDT)(Y,te.endProgramDateTime,ue)),W||(W=Object(H.findFragmentByPTS)(te,Y,T,ue),!W&&te&&te.start<Y[0].start&&(W=Y[0]))}else W=Y[ee-1];(k=W)!==null&&k!==void 0&&k.encrypted?(w.logger.log("Loading key for "+W.sn),this.state=x.State.KEY_LOADING,this.hls.trigger(K.Events.KEY_LOADING,{frag:W})):W&&this.fragmentTracker.getState(W)===_.FragmentState.NOT_LOADED&&this.loadFragment(W,p,T)}},v.loadFragment=function(k,b,h){this.fragCurrent=k,d.prototype.loadFragment.call(this,k,b,h)},L(E,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),E}(x.default)},"./src/controller/subtitle-track-controller.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/events.ts"),w=D("./src/utils/texttrack-utils.ts"),P=D("./src/controller/base-playlist-controller.ts"),H=D("./src/types/loader.ts");function B(O,L){for(var g=0;g<L.length;g++){var u=L[g];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(O,u.key,u)}}function I(O,L,g){return L&&B(O.prototype,L),g&&B(O,g),O}function _(O,L){O.prototype=Object.create(L.prototype),O.prototype.constructor=O,x(O,L)}function x(O,L){return x=Object.setPrototypeOf||function(u,a){return u.__proto__=a,u},x(O,L)}var A=function(O){_(L,O);function L(u){var a;return a=O.call(this,u,"[subtitle-track-controller]")||this,a.media=null,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.selectDefaultTrack=!0,a.queuedDefaultTrack=-1,a.trackChangeListener=function(){return a.onTextTracksChanged()},a.asyncPollTrackChange=function(){return a.pollTrackChange(0)},a.useTextTrackPolling=!1,a.subtitlePollingInterval=-1,a.subtitleDisplay=!0,a.registerListeners(),a}var g=L.prototype;return g.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,O.prototype.destroy.call(this)},g.registerListeners=function(){var a=this.hls;a.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(K.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){var a=this.hls;a.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(K.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(K.Events.ERROR,this.onError,this)},g.onMediaAttached=function(a,l){if(this.media=l.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},g.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},g.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var a=M(this.media.textTracks);a.forEach(function(l){Object(w.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},g.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},g.onManifestParsed=function(a,l){this.tracks=l.subtitleTracks},g.onSubtitleTrackLoaded=function(a,l){var d=l.id,E=l.details,v=this.trackId,m=this.tracksInGroup[v];if(!m){this.warn("Invalid subtitle track id "+d);return}var k=m.details;m.details=l.details,this.log("subtitle track "+d+" loaded ["+E.startSN+"-"+E.endSN+"]"),d===this.trackId&&(this.retryCount=0,this.playlistLoaded(d,l,k))},g.onLevelLoading=function(a,l){this.switchLevel(l.level)},g.onLevelSwitching=function(a,l){this.switchLevel(l.level)},g.switchLevel=function(a){var l=this.hls.levels[a];if(!(l!=null&&l.textGroupIds))return;var d=l.textGroupIds[l.urlId];if(this.groupId!==d){var E=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,v=this.tracks.filter(function(b){return!d||b.groupId===d});this.tracksInGroup=v;var m=this.findTrackId(E==null?void 0:E.name)||this.findTrackId();this.groupId=d;var k={subtitleTracks:v};this.log("Updating subtitle tracks, "+v.length+' track(s) found in "'+d+'" group-id'),this.hls.trigger(K.Events.SUBTITLE_TRACKS_UPDATED,k),m!==-1&&this.setSubtitleTrack(m,E)}},g.findTrackId=function(a){for(var l=this.tracksInGroup,d=0;d<l.length;d++){var E=l[d];if((!this.selectDefaultTrack||E.default)&&(!a||a===E.name))return E.id}return-1},g.onError=function(a,l){if(O.prototype.onError.call(this,a,l),l.fatal||!l.context)return;l.context.type===H.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},g.loadPlaylist=function(a){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var d=l.id,E=l.groupId,v=l.url;if(a)try{v=a.addDirectives(v)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("Loading subtitle playlist for id "+d),this.hls.trigger(K.Events.SUBTITLE_TRACK_LOADING,{url:v,id:d,groupId:E,deliveryDirectives:a||null})}},g.toggleTrackModes=function(a){var l=this,d=this.media,E=this.subtitleDisplay,v=this.trackId;if(!d)return;var m=M(d.textTracks),k=m.filter(function(p){return p.groupId===l.groupId});if(a===-1)[].slice.call(m).forEach(function(p){p.mode="disabled"});else{var b=k[v];b&&(b.mode="disabled")}var h=k[a];h&&(h.mode=E?"showing":"hidden")},g.setSubtitleTrack=function(a,l){var d,E=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(d=E[a])!==null&&d!==void 0&&d.details)||a<-1||a>=E.length)return;this.clearTimer();var v=E[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,v){var m=v.id,k=v.groupId,b=k===void 0?"":k,h=v.name,p=v.type,c=v.url;this.hls.trigger(K.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:b,name:h,type:p,url:c});var o=this.switchParams(v.url,l==null?void 0:l.details);this.loadPlaylist(o)}else this.hls.trigger(K.Events.SUBTITLE_TRACK_SWITCH,{id:a})},g.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,l=M(this.media.textTracks),d=0;d<l.length;d++)if(l[d].mode==="hidden")a=d;else if(l[d].mode==="showing"){a=d;break}this.subtitleTrack!==a&&(this.subtitleTrack=a)},I(L,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1;var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(a,l)}}]),L}(P.default);function M(O){for(var L=[],g=0;g<O.length;g++){var u=O[g];u.kind==="subtitles"&&u.label&&L.push(O[g])}return L}X.default=A},"./src/controller/timeline-controller.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"TimelineController",function(){return M});var K=D("./src/polyfills/number.ts"),w=D("./src/events.ts"),P=D("./src/utils/cea-608-parser.ts"),H=D("./src/utils/output-filter.ts"),B=D("./src/utils/webvtt-parser.ts"),I=D("./src/utils/texttrack-utils.ts"),_=D("./src/utils/imsc1-ttml-parser.ts"),x=D("./src/types/loader.ts"),A=D("./src/utils/logger.ts"),M=function(){function u(l){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=g(),this.captionsProperties=void 0,this.hls=l,this.config=l.config,this.Cues=l.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var d=new H.default(this,"textTrack1"),E=new H.default(this,"textTrack2"),v=new H.default(this,"textTrack3"),m=new H.default(this,"textTrack4");this.cea608Parser1=new P.default(1,d,E),this.cea608Parser2=new P.default(3,v,m)}l.on(w.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(w.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(w.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(w.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(w.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(w.Events.FRAG_LOADING,this.onFragLoading,this),l.on(w.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(w.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(w.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(w.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(w.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(w.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var a=u.prototype;return a.destroy=function(){var d=this.hls;d.off(w.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.off(w.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(w.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(w.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.off(w.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),d.off(w.Events.FRAG_LOADING,this.onFragLoading,this),d.off(w.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(w.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),d.off(w.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),d.off(w.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(w.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),d.off(w.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(d,E,v,m,k){for(var b=!1,h=k.length;h--;){var p=k[h],c=L(p[0],p[1],E,v);if(c>=0&&(p[0]=Math.min(p[0],E),p[1]=Math.max(p[1],v),b=!0,c/(v-E)>.5))return}if(b||k.push([E,v]),this.config.renderTextTracksNatively){var o=this.captionsTracks[d];this.Cues.newCue(o,E,v,m)}else{var S=this.Cues.newCue(null,E,v,m);this.hls.trigger(w.Events.CUES_PARSED,{type:"captions",cues:S,track:d})}},a.onInitPtsFound=function(d,E){var v=this,m=E.frag,k=E.id,b=E.initPTS,h=E.timescale,p=this.unparsedVttFrags;k==="main"&&(this.initPTS[m.cc]=b,this.timescale[m.cc]=h),p.length&&(this.unparsedVttFrags=[],p.forEach(function(c){v.onFragLoaded(w.Events.FRAG_LOADED,c)}))},a.getExistingTrack=function(d){var E=this.media;if(E)for(var v=0;v<E.textTracks.length;v++){var m=E.textTracks[v];if(m[d])return m}return null},a.createCaptionsTrack=function(d){this.config.renderTextTracksNatively?this.createNativeTrack(d):this.createNonNativeTrack(d)},a.createNativeTrack=function(d){if(this.captionsTracks[d])return;var E=this.captionsProperties,v=this.captionsTracks,m=this.media,k=E[d],b=k.label,h=k.languageCode,p=this.getExistingTrack(d);if(p)v[d]=p,Object(I.clearCurrentCues)(v[d]),Object(I.sendAddTrackEvent)(v[d],m);else{var c=this.createTextTrack("captions",b,h);c&&(c[d]=!0,v[d]=c)}},a.createNonNativeTrack=function(d){if(this.nonNativeCaptionsTracks[d])return;var E=this.captionsProperties[d];if(!E)return;var v=E.label,m={_id:d,label:v,kind:"captions",default:E.media?!!E.media.default:!1,closedCaptions:E.media};this.nonNativeCaptionsTracks[d]=m,this.hls.trigger(w.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[m]})},a.createTextTrack=function(d,E,v){var m=this.media;return m?m.addTextTrack(d,E,v):void 0},a.onMediaAttaching=function(d,E){this.media=E.media,this._cleanTracks()},a.onMediaDetaching=function(){var d=this.captionsTracks;Object.keys(d).forEach(function(E){Object(I.clearCurrentCues)(d[E]),delete d[E]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=g(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},a._cleanTracks=function(){var d=this.media;if(!d)return;var E=d.textTracks;if(E)for(var v=0;v<E.length;v++)Object(I.clearCurrentCues)(E[v])},a.onSubtitleTracksUpdated=function(d,E){var v=this;this.textTracks=[];var m=E.subtitleTracks||[],k=m.some(function(c){return c.textCodec===_.IMSC1_CODEC});if(this.config.enableWebVTT||k&&this.config.enableIMSC1){var b=this.tracks&&m&&this.tracks.length===m.length;if(this.tracks=m||[],this.config.renderTextTracksNatively){var h=this.media?this.media.textTracks:[];this.tracks.forEach(function(c,o){var S;if(o<h.length){for(var y=null,T=0;T<h.length;T++)if(O(h[T],c)){y=h[T];break}y&&(S=y)}S?Object(I.clearCurrentCues)(S):(S=v.createTextTrack("subtitles",c.name,c.lang),S&&(S.mode="disabled")),S&&(S.groupId=c.groupId,v.textTracks.push(S))})}else if(!b&&this.tracks&&this.tracks.length){var p=this.tracks.map(function(c){return{label:c.name,kind:c.type.toLowerCase(),default:c.default,subtitleTrack:c}});this.hls.trigger(w.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:p})}}},a.onManifestLoaded=function(d,E){var v=this;this.config.enableCEA708Captions&&E.captions&&E.captions.forEach(function(m){var k=/(?:CC|SERVICE)([1-4])/.exec(m.instreamId);if(!k)return;var b="textTrack"+k[1],h=v.captionsProperties[b];if(!h)return;h.label=m.name,m.lang&&(h.languageCode=m.lang),h.media=m})},a.onFragLoading=function(d,E){var v=this.cea608Parser1,m=this.cea608Parser2,k=this.lastSn,b=this.lastPartIndex;if(!this.enabled||!(v&&m))return;if(E.frag.type===x.PlaylistLevelType.MAIN){var h,p,c=E.frag.sn,o=(h=E==null||((p=E.part)===null||p===void 0)?void 0:p.index)!=null?h:-1;c===k+1||c===k&&o===b+1||(v.reset(),m.reset()),this.lastSn=c,this.lastPartIndex=o}},a.onFragLoaded=function(d,E){var v=E.frag,m=E.payload,k=this.initPTS,b=this.unparsedVttFrags;if(v.type===x.PlaylistLevelType.SUBTITLE)if(m.byteLength){if(!Object(K.isFiniteNumber)(k[v.cc])){b.push(E),k.length&&this.hls.trigger(w.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Missing initial subtitle PTS")});return}var h=v.decryptdata;if(h==null||h.key==null||h.method!=="AES-128"){var p=this.tracks[v.level],c=this.vttCCs;c[v.cc]||(c[v.cc]={start:v.start,prevCC:this.prevCC,new:!0},this.prevCC=v.cc),p&&p.textCodec===_.IMSC1_CODEC?this._parseIMSC1(v,m):this._parseVTTs(v,m,c)}}else this.hls.trigger(w.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(d,E){var v=this,m=this.hls;Object(_.parseIMSC1)(E,this.initPTS[d.cc],this.timescale[d.cc],function(k){v._appendCues(k,d.level),m.trigger(w.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(k){A.logger.log("Failed to parse IMSC1: "+k),m.trigger(w.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:k})})},a._parseVTTs=function(d,E,v){var m=this,k=this.hls;Object(B.parseWebVTT)(E,this.initPTS[d.cc],this.timescale[d.cc],v,d.cc,d.start,function(b){m._appendCues(b,d.level),k.trigger(w.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(b){m._fallbackToIMSC1(d,E),A.logger.log("Failed to parse VTT cue: "+b),k.trigger(w.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:b})})},a._fallbackToIMSC1=function(d,E){var v=this,m=this.tracks[d.level];m.textCodec||Object(_.parseIMSC1)(E,this.initPTS[d.cc],this.timescale[d.cc],function(){m.textCodec=_.IMSC1_CODEC,v._parseIMSC1(d,E)},function(){m.textCodec="wvtt"})},a._appendCues=function(d,E){var v=this.hls;if(this.config.renderTextTracksNatively){var m=this.textTracks[E];if(m.mode==="disabled")return;d.forEach(function(h){return Object(I.addCueToTrack)(m,h)})}else{var k=this.tracks[E],b=k.default?"default":"subtitles"+E;v.trigger(w.Events.CUES_PARSED,{type:"subtitles",cues:d,track:b})}},a.onFragDecrypted=function(d,E){var v=E.frag;if(v.type===x.PlaylistLevelType.SUBTITLE){if(!Object(K.isFiniteNumber)(this.initPTS[v.cc])){this.unparsedVttFrags.push(E);return}this.onFragLoaded(w.Events.FRAG_LOADED,E)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(d,E){var v=this.cea608Parser1,m=this.cea608Parser2;if(!this.enabled||!(v&&m))return;for(var k=0;k<E.samples.length;k++){var b=E.samples[k].bytes;if(b){var h=this.extractCea608Data(b);v.addData(E.samples[k].pts,h[0]),m.addData(E.samples[k].pts,h[1])}}},a.onBufferFlushing=function(d,E){var v=E.startOffset,m=E.endOffset,k=E.endOffsetSubtitles,b=E.type,h=this.media;if(!h||h.currentTime<m)return;if(!b||b==="video"){var p=this.captionsTracks;Object.keys(p).forEach(function(o){return Object(I.removeCuesInRange)(p[o],v,m)})}if(this.config.renderTextTracksNatively&&(v===0&&k!==void 0)){var c=this.textTracks;Object.keys(c).forEach(function(o){return Object(I.removeCuesInRange)(c[o],v,k)})}},a.extractCea608Data=function(d){for(var E=d[0]&31,v=2,m=[[],[]],k=0;k<E;k++){var b=d[v++],h=127&d[v++],p=127&d[v++],c=(4&b)!==0,o=3&b;if(h===0&&p===0)continue;c&&((o===0||o===1)&&(m[o].push(h),m[o].push(p)))}return m},u}();function O(u,a){return u&&u.label===a.name&&!(u.textTrack1||u.textTrack2)}function L(u,a,l,d){return Math.min(a,d)-Math.max(u,l)}function g(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return K});var K=function(){function w(H,B){this.subtle=void 0,this.aesIV=void 0,this.subtle=H,this.aesIV=B}var P=w.prototype;return P.decrypt=function(B,I){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},I,B)},w}()},"./src/crypt/aes-decryptor.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"removePadding",function(){return w}),D.d(X,"default",function(){return P});var K=D("./src/utils/typed-array.ts");function w(H){var B=H.byteLength,I=B&&new DataView(H.buffer).getUint8(B-1);return I?Object(K.sliceUint8)(H,0,B-I):H}var P=function(){function H(){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 B=H.prototype;return B.uint8ArrayToUint32Array_=function(_){for(var x=new DataView(_),A=new Uint32Array(4),M=0;M<4;M++)A[M]=x.getUint32(M*4);return A},B.initTable=function(){var _=this.sBox,x=this.invSBox,A=this.subMix,M=A[0],O=A[1],L=A[2],g=A[3],u=this.invSubMix,a=u[0],l=u[1],d=u[2],E=u[3],v=new Uint32Array(256),m=0,k=0,b=0;for(b=0;b<256;b++)b<128?v[b]=b<<1:v[b]=b<<1^283;for(b=0;b<256;b++){var h=k^k<<1^k<<2^k<<3^k<<4;h=h>>>8^h&255^99,_[m]=h,x[h]=m;var p=v[m],c=v[p],o=v[c],S=v[h]*257^h*16843008;M[m]=S<<24|S>>>8,O[m]=S<<16|S>>>16,L[m]=S<<8|S>>>24,g[m]=S,S=o*16843009^c*65537^p*257^m*16843008,a[h]=S<<24|S>>>8,l[h]=S<<16|S>>>16,d[h]=S<<8|S>>>24,E[h]=S,m?(m=p^v[v[v[o^p]]],k^=v[v[k]]):m=k=1}},B.expandKey=function(_){for(var x=this.uint8ArrayToUint32Array_(_),A=!0,M=0;M<x.length&&A;)A=x[M]===this.key[M],M++;if(A)return;this.key=x;var O=this.keySize=x.length;if(O!==4&&O!==6&&O!==8)throw new Error("Invalid aes key size="+O);var L=this.ksRows=(O+6+1)*4,g,u,a=this.keySchedule=new Uint32Array(L),l=this.invKeySchedule=new Uint32Array(L),d=this.sBox,E=this.rcon,v=this.invSubMix,m=v[0],k=v[1],b=v[2],h=v[3],p,c;for(g=0;g<L;g++){if(g<O){p=a[g]=x[g];continue}c=p,g%O===0?(c=c<<8|c>>>24,c=d[c>>>24]<<24|d[c>>>16&255]<<16|d[c>>>8&255]<<8|d[c&255],c^=E[g/O|0]<<24):O>6&&g%O===4&&(c=d[c>>>24]<<24|d[c>>>16&255]<<16|d[c>>>8&255]<<8|d[c&255]),a[g]=p=(a[g-O]^c)>>>0}for(u=0;u<L;u++)g=L-u,u&3?c=a[g]:c=a[g-4],u<4||g<=4?l[u]=c:l[u]=m[d[c>>>24]]^k[d[c>>>16&255]]^b[d[c>>>8&255]]^h[d[c&255]],l[u]=l[u]>>>0},B.networkToHostOrderSwap=function(_){return _<<24|(_&65280)<<8|(_&16711680)>>8|_>>>24},B.decrypt=function(_,x,A){for(var M=this.keySize+6,O=this.invKeySchedule,L=this.invSBox,g=this.invSubMix,u=g[0],a=g[1],l=g[2],d=g[3],E=this.uint8ArrayToUint32Array_(A),v=E[0],m=E[1],k=E[2],b=E[3],h=new Int32Array(_),p=new Int32Array(h.length),c,o,S,y,T,N,z,Y,ee,G,W,te,ue,be,Oe=this.networkToHostOrderSwap;x<h.length;){for(ee=Oe(h[x]),G=Oe(h[x+1]),W=Oe(h[x+2]),te=Oe(h[x+3]),T=ee^O[0],N=te^O[1],z=W^O[2],Y=G^O[3],ue=4,be=1;be<M;be++)c=u[T>>>24]^a[N>>16&255]^l[z>>8&255]^d[Y&255]^O[ue],o=u[N>>>24]^a[z>>16&255]^l[Y>>8&255]^d[T&255]^O[ue+1],S=u[z>>>24]^a[Y>>16&255]^l[T>>8&255]^d[N&255]^O[ue+2],y=u[Y>>>24]^a[T>>16&255]^l[N>>8&255]^d[z&255]^O[ue+3],T=c,N=o,z=S,Y=y,ue=ue+4;c=L[T>>>24]<<24^L[N>>16&255]<<16^L[z>>8&255]<<8^L[Y&255]^O[ue],o=L[N>>>24]<<24^L[z>>16&255]<<16^L[Y>>8&255]<<8^L[T&255]^O[ue+1],S=L[z>>>24]<<24^L[Y>>16&255]<<16^L[T>>8&255]<<8^L[N&255]^O[ue+2],y=L[Y>>>24]<<24^L[T>>16&255]<<16^L[N>>8&255]<<8^L[z&255]^O[ue+3],p[x]=Oe(c^v),p[x+1]=Oe(y^m),p[x+2]=Oe(S^k),p[x+3]=Oe(o^b),v=ee,m=G,k=W,b=te,x=x+4}return p.buffer},H}()},"./src/crypt/decrypter.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return x});var K=D("./src/crypt/aes-crypto.ts"),w=D("./src/crypt/fast-aes-key.ts"),P=D("./src/crypt/aes-decryptor.ts"),H=D("./src/utils/logger.ts"),B=D("./src/utils/mp4-tools.ts"),I=D("./src/utils/typed-array.ts"),_=16,x=function(){function A(O,L,g){var u=g===void 0?{}:g,a=u.removePKCS7Padding,l=a===void 0?!0:a;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=O,this.config=L,this.removePKCS7Padding=l,l)try{var d=self.crypto;d&&(this.subtle=d.subtle||d.webkitSubtle)}catch(E){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var M=A.prototype;return M.destroy=function(){this.observer=null},M.isSync=function(){return this.config.enableSoftwareAES},M.flush=function(){var L=this.currentResult;if(!L){this.reset();return}var g=new Uint8Array(L);return this.reset(),this.removePKCS7Padding?Object(P.removePadding)(g):g},M.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},M.decrypt=function(L,g,u,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(L),g,u);var l=this.flush();l&&a(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(L),g,u).then(a)},M.softwareDecrypt=function(L,g,u){var a=this.currentIV,l=this.currentResult,d=this.remainderData;this.logOnce("JS AES decrypt"),d&&(L=Object(B.appendUint8Array)(d,L),this.remainderData=null);var E=this.getValidChunk(L);if(!E.length)return null;a&&(u=a);var v=this.softwareDecrypter;v||(v=this.softwareDecrypter=new P.default),v.expandKey(g);var m=l;return this.currentResult=v.decrypt(E.buffer,0,u),this.currentIV=Object(I.sliceUint8)(E,-16).buffer,m||null},M.webCryptoDecrypt=function(L,g,u){var a=this,l=this.subtle;return(this.key!==g||!this.fastAesKey)&&(this.key=g,this.fastAesKey=new w.default(l,g)),this.fastAesKey.expandKey().then(function(d){if(!l)return Promise.reject(new Error("web crypto not initialized"));var E=new K.default(l,u);return E.decrypt(L.buffer,d)}).catch(function(d){return a.onWebCryptoError(d,L,g,u)})},M.onWebCryptoError=function(L,g,u,a){return H.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",L),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(g,u,a)},M.getValidChunk=function(L){var g=L,u=L.length-L.length%_;return u!==L.length&&(g=Object(I.sliceUint8)(L,0,u),this.remainderData=Object(I.sliceUint8)(L,u)),g},M.logOnce=function(L){if(!this.logEnabled)return;H.logger.log("[decrypter.ts]: "+L),this.logEnabled=!1},A}()},"./src/crypt/fast-aes-key.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return K});var K=function(){function w(H,B){this.subtle=void 0,this.key=void 0,this.subtle=H,this.key=B}var P=w.prototype;return P.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},w}()},"./src/demux/aacdemuxer.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/demux/base-audio-demuxer.ts"),w=D("./src/demux/adts.ts"),P=D("./src/utils/logger.ts"),H=D("./src/demux/id3.ts");function B(x,A){x.prototype=Object.create(A.prototype),x.prototype.constructor=x,I(x,A)}function I(x,A){return I=Object.setPrototypeOf||function(O,L){return O.__proto__=L,O},I(x,A)}var _=function(x){B(A,x);function A(O,L){var g;return g=x.call(this)||this,g.observer=void 0,g.config=void 0,g.observer=O,g.config=L,g}var M=A.prototype;return M.resetInitSegment=function(L,g,u){x.prototype.resetInitSegment.call(this,L,g,u),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:L,duration:u,inputTimeScale:9e4,dropped:0}},A.probe=function(L){if(!L)return!1;for(var g=H.getID3Data(L,0)||[],u=g.length,a=L.length;u<a;u++)if(w.probe(L,u))return P.logger.log("ADTS sync word found !"),!0;return!1},M.canParse=function(L,g){return w.canParse(L,g)},M.appendFrame=function(L,g,u){w.initTrackConfig(L,this.observer,g,u,L.manifestCodec);var a=w.appendFrame(L,g,u,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},A}(K.default);_.minProbeByteLength=9,X.default=_},"./src/demux/adts.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"getAudioConfig",function(){return H}),D.d(X,"isHeaderPattern",function(){return B}),D.d(X,"getHeaderLength",function(){return I}),D.d(X,"getFullFrameLength",function(){return _}),D.d(X,"canGetFrameLength",function(){return x}),D.d(X,"isHeader",function(){return A}),D.d(X,"canParse",function(){return M}),D.d(X,"probe",function(){return O}),D.d(X,"initTrackConfig",function(){return L}),D.d(X,"getFrameDuration",function(){return g}),D.d(X,"parseFrameHeader",function(){return u}),D.d(X,"appendFrame",function(){return a});var K=D("./src/utils/logger.ts"),w=D("./src/errors.ts"),P=D("./src/events.ts");function H(l,d,E,v){var m,k,b,h,p=navigator.userAgent.toLowerCase(),c=v,o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];m=((d[E+2]&192)>>>6)+1;var S=(d[E+2]&60)>>>2;if(S>o.length-1){l.trigger(P.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+S});return}return b=(d[E+2]&1)<<2,b|=(d[E+3]&192)>>>6,K.logger.log("manifest codec:"+v+", ADTS type:"+m+", samplingIndex:"+S),/firefox/i.test(p)?S>=6?(m=5,h=new Array(4),k=S-3):(m=2,h=new Array(2),k=S):p.indexOf("android")!==-1?(m=2,h=new Array(2),k=S):(m=5,h=new Array(4),v&&(v.indexOf("mp4a.40.29")!==-1||v.indexOf("mp4a.40.5")!==-1)||!v&&S>=6?k=S-3:((v&&v.indexOf("mp4a.40.2")!==-1&&(S>=6&&b===1||/vivaldi/i.test(p))||!v&&b===1)&&(m=2,h=new Array(2)),k=S)),h[0]=m<<3,h[0]|=(S&14)>>1,h[1]|=(S&1)<<7,h[1]|=b<<3,m===5&&(h[1]|=(k&14)>>1,h[2]=(k&1)<<7,h[2]|=2<<2,h[3]=0),{config:h,samplerate:o[S],channelCount:b,codec:"mp4a.40."+m,manifestCodec:c}}function B(l,d){return l[d]===255&&(l[d+1]&246)===240}function I(l,d){return l[d+1]&1?7:9}function _(l,d){return(l[d+3]&3)<<11|l[d+4]<<3|(l[d+5]&224)>>>5}function x(l,d){return d+5<l.length}function A(l,d){return d+1<l.length&&B(l,d)}function M(l,d){return x(l,d)&&B(l,d)&&_(l,d)<=l.length-d}function O(l,d){if(A(l,d)){var E=I(l,d);if(d+E>=l.length)return!1;var v=_(l,d);if(v<=E)return!1;var m=d+v;return m===l.length||A(l,m)}return!1}function L(l,d,E,v,m){if(!l.samplerate){var k=H(d,E,v,m);if(!k)return;l.config=k.config,l.samplerate=k.samplerate,l.channelCount=k.channelCount,l.codec=k.codec,l.manifestCodec=k.manifestCodec,K.logger.log("parsed codec:"+l.codec+", rate:"+k.samplerate+", channels:"+k.channelCount)}}function g(l){return 1024*9e4/l}function u(l,d,E,v,m){var k=I(l,d),b=_(l,d);if(b-=k,b>0){var h=E+v*m;return{headerLength:k,frameLength:b,stamp:h}}}function a(l,d,E,v,m){var k=g(l.samplerate),b=u(d,E,v,m,k);if(b){var h=b.frameLength,p=b.headerLength,c=b.stamp,o=p+h,S=Math.max(0,E+o-d.length),y;S?(y=new Uint8Array(o-p),y.set(d.subarray(E+p,d.length),0)):y=d.subarray(E+p,E+o);var T={unit:y,pts:c};return S||l.samples.push(T),{sample:T,length:o,missing:S}}}},"./src/demux/base-audio-demuxer.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"initPTSFn",function(){return _});var K=D("./src/polyfills/number.ts"),w=D("./src/demux/id3.ts"),P=D("./src/demux/dummy-demuxed-track.ts"),H=D("./src/utils/mp4-tools.ts"),B=D("./src/utils/typed-array.ts"),I=function(){function x(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var A=x.prototype;return A.resetInitSegment=function(O,L,g){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},A.resetTimeStamp=function(){},A.resetContiguity=function(){},A.canParse=function(O,L){return!1},A.appendFrame=function(O,L,g){},A.demux=function(O,L){this.cachedData&&(O=Object(H.appendUint8Array)(this.cachedData,O),this.cachedData=null);var g=w.getID3Data(O,0),u=g?g.length:0,a,l,d=this._audioTrack,E=this._id3Track,v=g?w.getTimeStamp(g):void 0,m=O.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=_(v,L)),g&&g.length>0&&E.samples.push({pts:this.initPTS,dts:this.initPTS,data:g}),l=this.initPTS;u<m;){if(this.canParse(O,u)){var k=this.appendFrame(d,O,u);k?(this.frameIndex++,l=k.sample.pts,u+=k.length,a=u):u=m}else w.canParse(O,u)?(g=w.getID3Data(O,u),E.samples.push({pts:l,dts:l,data:g}),u+=g.length,a=u):u++;if(u===m&&a!==m){var b=Object(B.sliceUint8)(O,a);this.cachedData?this.cachedData=Object(H.appendUint8Array)(this.cachedData,b):this.cachedData=b}}return{audioTrack:d,avcTrack:Object(P.dummyTrack)(),id3Track:E,textTrack:Object(P.dummyTrack)()}},A.demuxSampleAes=function(O,L,g){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},A.flush=function(O){var L=this.cachedData;return L&&(this.cachedData=null,this.demux(L,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(P.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(P.dummyTrack)()}},A.destroy=function(){},x}(),_=function(A,M){return Object(K.isFiniteNumber)(A)?A*90:M*9e4};X.default=I},"./src/demux/chunk-cache.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return K});var K=function(){function P(){this.chunks=[],this.dataLength=0}var H=P.prototype;return H.push=function(I){this.chunks.push(I),this.dataLength+=I.length},H.flush=function(){var I=this.chunks,_=this.dataLength,x;if(I.length)I.length===1?x=I[0]:x=w(I,_);else return new Uint8Array(0);return this.reset(),x},H.reset=function(){this.chunks.length=0,this.dataLength=0},P}();function w(P,H){for(var B=new Uint8Array(H),I=0,_=0;_<P.length;_++){var x=P[_];B.set(x,I),I+=x.length}return B}},"./src/demux/dummy-demuxed-track.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"dummyTrack",function(){return K});function K(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/utils/logger.ts"),w=function(){function P(B){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=B,this.bytesAvailable=B.byteLength,this.word=0,this.bitsAvailable=0}var H=P.prototype;return H.loadWord=function(){var I=this.data,_=this.bytesAvailable,x=I.byteLength-_,A=new Uint8Array(4),M=Math.min(4,_);if(M===0)throw new Error("no bytes available");A.set(I.subarray(x,x+M)),this.word=new DataView(A.buffer).getUint32(0),this.bitsAvailable=M*8,this.bytesAvailable-=M},H.skipBits=function(I){var _;this.bitsAvailable>I?(this.word<<=I,this.bitsAvailable-=I):(I-=this.bitsAvailable,_=I>>3,I-=_>>3,this.bytesAvailable-=_,this.loadWord(),this.word<<=I,this.bitsAvailable-=I)},H.readBits=function(I){var _=Math.min(this.bitsAvailable,I),x=this.word>>>32-_;return I>32&&K.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=_,this.bitsAvailable>0?this.word<<=_:this.bytesAvailable>0&&this.loadWord(),_=I-_,_>0&&this.bitsAvailable?x<<_|this.readBits(_):x},H.skipLZ=function(){var I;for(I=0;I<this.bitsAvailable;++I)if((this.word&2147483648>>>I)!==0)return this.word<<=I,this.bitsAvailable-=I,I;return this.loadWord(),I+this.skipLZ()},H.skipUEG=function(){this.skipBits(1+this.skipLZ())},H.skipEG=function(){this.skipBits(1+this.skipLZ())},H.readUEG=function(){var I=this.skipLZ();return this.readBits(I+1)-1},H.readEG=function(){var I=this.readUEG();return 1&I?1+I>>>1:-1*(I>>>1)},H.readBoolean=function(){return this.readBits(1)===1},H.readUByte=function(){return this.readBits(8)},H.readUShort=function(){return this.readBits(16)},H.readUInt=function(){return this.readBits(32)},H.skipScalingList=function(I){for(var _=8,x=8,A,M=0;M<I;M++)x!==0&&(A=this.readEG(),x=(_+A+256)%256),_=x===0?_:x},H.readSPS=function(){var I=0,_=0,x=0,A=0,M,O,L,g=this.readUByte.bind(this),u=this.readBits.bind(this),a=this.readUEG.bind(this),l=this.readBoolean.bind(this),d=this.skipBits.bind(this),E=this.skipEG.bind(this),v=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);g();var k=g();if(u(5),d(3),g(),v(),k===100||k===110||k===122||k===244||k===44||k===83||k===86||k===118||k===128){var b=a();if(b===3&&d(1),v(),v(),d(1),l())for(O=b!==3?8:12,L=0;L<O;L++)l()&&(L<6?m(16):m(64))}v();var h=a();if(h===0)a();else if(h===1)for(d(1),E(),E(),M=a(),L=0;L<M;L++)E();v(),d(1);var p=a(),c=a(),o=u(1);o===0&&d(1),d(1),l()&&(I=a(),_=a(),x=a(),A=a());var S=[1,1];if(l()&&l()){var y=g();switch(y){case 1:S=[1,1];break;case 2:S=[12,11];break;case 3:S=[10,11];break;case 4:S=[16,11];break;case 5:S=[40,33];break;case 6:S=[24,11];break;case 7:S=[20,11];break;case 8:S=[32,11];break;case 9:S=[80,33];break;case 10:S=[18,11];break;case 11:S=[15,11];break;case 12:S=[64,33];break;case 13:S=[160,99];break;case 14:S=[4,3];break;case 15:S=[3,2];break;case 16:S=[2,1];break;case 255:{S=[g()<<8|g(),g()<<8|g()];break}}}return{width:Math.ceil((p+1)*16-I*2-_*2),height:(2-o)*(c+1)*16-(o?2:4)*(x+A),pixelRatio:S}},H.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},P}();X.default=w},"./src/demux/id3.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"isHeader",function(){return K}),D.d(X,"isFooter",function(){return w}),D.d(X,"getID3Data",function(){return P}),D.d(X,"canParse",function(){return B}),D.d(X,"getTimeStamp",function(){return I}),D.d(X,"isTimeStampFrame",function(){return _}),D.d(X,"getID3Frames",function(){return A}),D.d(X,"decodeFrame",function(){return M}),D.d(X,"utf8ArrayToStr",function(){return a}),D.d(X,"testables",function(){return l});var K=function(m,k){return k+10<=m.length&&(m[k]===73&&m[k+1]===68&&m[k+2]===51&&(m[k+3]<255&&m[k+4]<255&&(m[k+6]<128&&m[k+7]<128&&m[k+8]<128&&m[k+9]<128)))},w=function(m,k){return k+10<=m.length&&(m[k]===51&&m[k+1]===68&&m[k+2]===73&&(m[k+3]<255&&m[k+4]<255&&(m[k+6]<128&&m[k+7]<128&&m[k+8]<128&&m[k+9]<128)))},P=function(m,k){for(var b=k,h=0;K(m,k);){h+=10;var p=H(m,k+6);h+=p,w(m,k+10)&&(h+=10),k+=h}return h>0?m.subarray(b,b+h):void 0},H=function(m,k){var b=0;return b=(m[k]&127)<<21,b|=(m[k+1]&127)<<14,b|=(m[k+2]&127)<<7,b|=m[k+3]&127,b},B=function(m,k){return K(m,k)&&H(m,k+6)+10<=m.length-k},I=function(m){for(var k=A(m),b=0;b<k.length;b++){var h=k[b];if(_(h))return u(h)}return},_=function(m){return m&&m.key==="PRIV"&&m.info==="com.apple.streaming.transportStreamTimestamp"},x=function(m){var k=String.fromCharCode(m[0],m[1],m[2],m[3]),b=H(m,4),h=10;return{type:k,size:b,data:m.subarray(h,h+b)}},A=function(m){for(var k=0,b=[];K(m,k);){var h=H(m,k+6);k+=10;for(var p=k+h;k+8<p;){var c=x(m.subarray(k)),o=M(c);o&&b.push(o),k+=c.size+10}w(m,k)&&(k+=10)}return b},M=function(m){return m.type==="PRIV"?O(m):m.type[0]==="W"?g(m):L(m)},O=function(m){if(m.size<2)return;var k=a(m.data,!0),b=new Uint8Array(m.data.subarray(k.length+1));return{key:m.type,info:k,data:b.buffer}},L=function(m){if(m.size<2)return;if(m.type==="TXXX"){var k=1,b=a(m.data.subarray(k),!0);k+=b.length+1;var h=a(m.data.subarray(k));return{key:m.type,info:b,data:h}}var p=a(m.data.subarray(1));return{key:m.type,data:p}},g=function(m){if(m.type==="WXXX"){if(m.size<2)return;var k=1,b=a(m.data.subarray(k),!0);k+=b.length+1;var h=a(m.data.subarray(k));return{key:m.type,info:b,data:h}}var p=a(m.data);return{key:m.type,data:p}},u=function(m){if(m.data.byteLength===8){var k=new Uint8Array(m.data),b=k[3]&1,h=(k[4]<<23)+(k[5]<<15)+(k[6]<<7)+k[7];return h/=45,b&&(h+=4772185884e-2),Math.round(h)}return},a=function(m,k){k===void 0&&(k=!1);var b=E();if(b){var h=b.decode(m);if(k){var p=h.indexOf("\0");return p!==-1?h.substring(0,p):h}return h.replace(/\0/g,"")}for(var c=m.length,o,S,y,T="",N=0;N<c;){if(o=m[N++],o===0&&k)return T;if(o===0||o===3)continue;switch(o>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:T+=String.fromCharCode(o);break;case 12:case 13:S=m[N++],T+=String.fromCharCode((o&31)<<6|S&63);break;case 14:S=m[N++],y=m[N++],T+=String.fromCharCode((o&15)<<12|(S&63)<<6|(y&63)<<0);break;default:}}return T},l={decodeTextFrame:L},d;function E(){return!d&&typeof self.TextDecoder!="undefined"&&(d=new self.TextDecoder("utf-8")),d}},"./src/demux/mp3demuxer.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/demux/base-audio-demuxer.ts"),w=D("./src/demux/id3.ts"),P=D("./src/utils/logger.ts"),H=D("./src/demux/mpegaudio.ts");function B(x,A){x.prototype=Object.create(A.prototype),x.prototype.constructor=x,I(x,A)}function I(x,A){return I=Object.setPrototypeOf||function(O,L){return O.__proto__=L,O},I(x,A)}var _=function(x){B(A,x);function A(){return x.apply(this,arguments)||this}var M=A.prototype;return M.resetInitSegment=function(L,g,u){x.prototype.resetInitSegment.call(this,L,g,u),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:L,duration:u,inputTimeScale:9e4,dropped:0}},A.probe=function(L){if(!L)return!1;for(var g=w.getID3Data(L,0)||[],u=g.length,a=L.length;u<a;u++)if(H.probe(L,u))return P.logger.log("MPEG Audio sync word found !"),!0;return!1},M.canParse=function(L,g){return H.canParse(L,g)},M.appendFrame=function(L,g,u){return this.initPTS===null?void 0:H.appendFrame(L,g,u,this.initPTS,this.frameIndex)},A}(K.default);_.minProbeByteLength=4,X.default=_},"./src/demux/mp4demuxer.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/utils/mp4-tools.ts"),w=D("./src/demux/dummy-demuxed-track.ts"),P=function(){function H(I,_){this.remainderData=null,this.config=void 0,this.config=_}var B=H.prototype;return B.resetTimeStamp=function(){},B.resetInitSegment=function(){},B.resetContiguity=function(){},H.probe=function(_){return Object(K.findBox)({data:_,start:0,end:Math.min(_.length,16384)},["moof"]).length>0},B.demux=function(_){var x=_,A=Object(w.dummyTrack)();if(this.config.progressive){this.remainderData&&(x=Object(K.appendUint8Array)(this.remainderData,_));var M=Object(K.segmentValidRange)(x);this.remainderData=M.remainder,A.samples=M.valid||new Uint8Array}else A.samples=x;return{audioTrack:Object(w.dummyTrack)(),avcTrack:A,id3Track:Object(w.dummyTrack)(),textTrack:Object(w.dummyTrack)()}},B.flush=function(){var _=Object(w.dummyTrack)();return _.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(w.dummyTrack)(),avcTrack:_,id3Track:Object(w.dummyTrack)(),textTrack:Object(w.dummyTrack)()}},B.demuxSampleAes=function(_,x,A){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},B.destroy=function(){},H}();P.minProbeByteLength=1024,X.default=P},"./src/demux/mpegaudio.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"appendFrame",function(){return I}),D.d(X,"parseHeader",function(){return _}),D.d(X,"isHeaderPattern",function(){return x}),D.d(X,"isHeader",function(){return A}),D.d(X,"canParse",function(){return M}),D.d(X,"probe",function(){return O});var K=null,w=[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],P=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],H=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],B=[0,1,1,4];function I(L,g,u,a,l){if(u+24>g.length)return;var d=_(g,u);if(d&&u+d.frameLength<=g.length){var E=d.samplesPerFrame*9e4/d.sampleRate,v=a+l*E,m={unit:g.subarray(u,u+d.frameLength),pts:v,dts:v};return L.config=[],L.channelCount=d.channelCount,L.samplerate=d.sampleRate,L.samples.push(m),{sample:m,length:d.frameLength,missing:0}}}function _(L,g){var u=L[g+1]>>3&3,a=L[g+1]>>1&3,l=L[g+2]>>4&15,d=L[g+2]>>2&3;if(u!==1&&l!==0&&l!==15&&d!==3){var E=L[g+2]>>1&1,v=L[g+3]>>6,m=u===3?3-a:a===3?3:4,k=w[m*14+l-1]*1e3,b=u===3?0:u===2?1:2,h=P[b*3+d],p=v===3?1:2,c=H[u][a],o=B[a],S=c*8*o,y=Math.floor(c*k/h+E)*o;if(K===null){var T=navigator.userAgent||"",N=T.match(/Chrome\/(\d+)/i);K=N?parseInt(N[1]):0}var z=!!K&&K<=87;return z&&a===2&&k>=224e3&&v===0&&(L[g+3]=L[g+3]|128),{sampleRate:h,channelCount:p,frameLength:y,samplesPerFrame:S}}}function x(L,g){return L[g]===255&&(L[g+1]&224)===224&&(L[g+1]&6)!==0}function A(L,g){return g+1<L.length&&x(L,g)}function M(L,g){var u=4;return x(L,g)&&u<=L.length-g}function O(L,g){if(g+1<L.length&&x(L,g)){var u=4,a=_(L,g),l=u;a!=null&&a.frameLength&&(l=a.frameLength);var d=g+l;return d===L.length||A(L,d)}return!1}},"./src/demux/sample-aes.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/crypt/decrypter.ts"),w=D("./src/demux/tsdemuxer.ts"),P=function(){function H(I,_,x){this.keyData=void 0,this.decrypter=void 0,this.keyData=x,this.decrypter=new K.default(I,_,{removePKCS7Padding:!1})}var B=H.prototype;return B.decryptBuffer=function(_,x){this.decrypter.decrypt(_,this.keyData.key.buffer,this.keyData.iv.buffer,x)},B.decryptAacSample=function(_,x,A,M){var O=_[x].unit,L=O.subarray(16,O.length-O.length%16),g=L.buffer.slice(L.byteOffset,L.byteOffset+L.length),u=this;this.decryptBuffer(g,function(a){var l=new Uint8Array(a);O.set(l,16),M||u.decryptAacSamples(_,x+1,A)})},B.decryptAacSamples=function(_,x,A){for(;;x++){if(x>=_.length){A();return}if(_[x].unit.length<32)continue;var M=this.decrypter.isSync();if(this.decryptAacSample(_,x,A,M),!M)return}},B.getAvcEncryptedData=function(_){for(var x=Math.floor((_.length-48)/160)*16+16,A=new Int8Array(x),M=0,O=32;O<=_.length-16;O+=160,M+=16)A.set(_.subarray(O,O+16),M);return A},B.getAvcDecryptedUnit=function(_,x){for(var A=new Uint8Array(x),M=0,O=32;O<=_.length-16;O+=160,M+=16)_.set(A.subarray(M,M+16),O);return _},B.decryptAvcSample=function(_,x,A,M,O,L){var g=Object(w.discardEPB)(O.data),u=this.getAvcEncryptedData(g),a=this;this.decryptBuffer(u.buffer,function(l){O.data=a.getAvcDecryptedUnit(g,l),L||a.decryptAvcSamples(_,x,A+1,M)})},B.decryptAvcSamples=function(_,x,A,M){if(_ instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;x++,A=0){if(x>=_.length){M();return}for(var O=_[x].units;!(A>=O.length);A++){var L=O[A];if(L.data.length<=48||L.type!==1&&L.type!==5)continue;var g=this.decrypter.isSync();if(this.decryptAvcSample(_,x,A,M,L,g),!g)return}}},H}();X.default=P},"./src/demux/transmuxer-interface.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return O});var K=D("./node_modules/webworkify-webpack/index.js"),w=D.n(K),P=D("./src/events.ts"),H=D("./src/demux/transmuxer.ts"),B=D("./src/utils/logger.ts"),I=D("./src/errors.ts"),_=D("./src/utils/mediasource-helper.ts"),x=D("./node_modules/eventemitter3/index.js"),A=D.n(x),M=Object(_.getMediaSource)()||{isTypeSupported:function(){return!1}},O=function(){function L(u,a,l,d){var E=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=u,this.id=a,this.onTransmuxComplete=l,this.onFlush=d;var v=u.config,m=function(c,o){o=o||{},o.frag=E.frag,o.id=E.id,u.trigger(c,o)};this.observer=new x.EventEmitter,this.observer.on(P.Events.FRAG_DECRYPTED,m),this.observer.on(P.Events.ERROR,m);var k={mp4:M.isTypeSupported("video/mp4"),mpeg:M.isTypeSupported("audio/mpeg"),mp3:M.isTypeSupported('audio/mp4; codecs="mp3"')},b=navigator.vendor;if(v.enableWorker&&typeof Worker!="undefined"){B.logger.log("demuxing in webworker");var h;try{h=this.worker=K("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),h.addEventListener("message",this.onwmsg),h.onerror=function(p){u.trigger(P.Events.ERROR,{type:I.ErrorTypes.OTHER_ERROR,details:I.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(p.message+" ("+p.filename+":"+p.lineno+")")})},h.postMessage({cmd:"init",typeSupported:k,vendor:b,id:a,config:JSON.stringify(v)})}catch(p){B.logger.warn("Error in worker:",p),B.logger.error("Error while initializing DemuxerWorker, fallback to inline"),h&&self.URL.revokeObjectURL(h.objectURL),this.transmuxer=new H.default(this.observer,k,v,b,a),this.worker=null}}else this.transmuxer=new H.default(this.observer,k,v,b,a)}var g=L.prototype;return g.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var d=this.observer;d&&d.removeAllListeners(),this.observer=null},g.push=function(a,l,d,E,v,m,k,b,h,p){var c=this;h.transmuxing.start=self.performance.now();var o=this.transmuxer,S=this.worker,y=m?m.start:v.start,T=v.decryptdata,N=this.frag,z=!(N&&v.cc===N.cc),Y=!(N&&h.level===N.level),ee=N?h.sn-N.sn:-1,G=this.part?h.part-this.part.index:1,W=!Y&&(ee===1||ee===0&&G===1),te=self.performance.now();(Y||ee||v.stats.parsing.start===0)&&(v.stats.parsing.start=te),m&&(G||!W)&&(m.stats.parsing.start=te);var ue=new H.TransmuxState(z,W,b,Y,y);if(!W||z){B.logger.log("[transmuxer-interface, "+v.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+`
discontinuity: `+z+`
trackSwitch: `+Y+`
contiguous: `+W+`
accurateTimeOffset: `+b+`
timeOffset: `+y);var be=new H.TransmuxConfig(d,E,l,k,p);this.configureTransmuxer(be)}if(this.frag=v,this.part=m,S)S.postMessage({cmd:"demux",data:a,decryptdata:T,chunkMeta:h,state:ue},a instanceof ArrayBuffer?[a]:[]);else if(o){var Oe=o.push(a,T,h,ue);Object(H.isPromise)(Oe)?Oe.then(function(Ke){c.handleTransmuxComplete(Ke)}):this.handleTransmuxComplete(Oe)}},g.flush=function(a){var l=this;a.transmuxing.start=self.performance.now();var d=this.transmuxer,E=this.worker;if(E)E.postMessage({cmd:"flush",chunkMeta:a});else if(d){var v=d.flush(a);Object(H.isPromise)(v)?v.then(function(m){l.handleFlushResult(m,a)}):this.handleFlushResult(v,a)}},g.handleFlushResult=function(a,l){var d=this;a.forEach(function(E){d.handleTransmuxComplete(E)}),this.onFlush(l)},g.onWorkerMessage=function(a){var l=a.data,d=this.hls;switch(l.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(l.data);break}case"flush":{this.onFlush(l.data);break}default:{l.data=l.data||{},l.data.frag=this.frag,l.data.id=this.id,d.trigger(l.event,l.data);break}}},g.configureTransmuxer=function(a){var l=this.worker,d=this.transmuxer;l?l.postMessage({cmd:"configure",config:a}):d&&d.configure(a)},g.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},L}()},"./src/demux/transmuxer-worker.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return I});var K=D("./src/demux/transmuxer.ts"),w=D("./src/events.ts"),P=D("./src/utils/logger.ts"),H=D("./node_modules/eventemitter3/index.js"),B=D.n(H);function I(O){var L=new H.EventEmitter,g=function(a,l){O.postMessage({event:a,data:l})};L.on(w.Events.FRAG_DECRYPTED,g),L.on(w.Events.ERROR,g),O.addEventListener("message",function(u){var a=u.data;switch(a.cmd){case"init":{var l=JSON.parse(a.config);O.transmuxer=new K.default(L,a.typeSupported,l,a.vendor,a.id),Object(P.enableLogs)(l.debug),g("init",null);break}case"configure":{O.transmuxer.configure(a.config);break}case"demux":{var d=O.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(K.isPromise)(d)?d.then(function(m){_(O,m)}):_(O,d);break}case"flush":{var E=a.chunkMeta,v=O.transmuxer.flush(E);Object(K.isPromise)(v)?v.then(function(m){A(O,m,E)}):A(O,v,E);break}default:break}})}function _(O,L){if(M(L.remuxResult))return;var g=[],u=L.remuxResult,a=u.audio,l=u.video;a&&x(g,a),l&&x(g,l),O.postMessage({event:"transmuxComplete",data:L},g)}function x(O,L){L.data1&&O.push(L.data1.buffer),L.data2&&O.push(L.data2.buffer)}function A(O,L,g){L.forEach(function(u){_(O,u)}),O.postMessage({event:"flush",data:g})}function M(O){return!O.audio&&!O.video&&!O.text&&!O.id3&&!O.initSegment}},"./src/demux/transmuxer.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return l}),D.d(X,"isPromise",function(){return v}),D.d(X,"TransmuxConfig",function(){return m}),D.d(X,"TransmuxState",function(){return k});var K=D("./src/events.ts"),w=D("./src/errors.ts"),P=D("./src/crypt/decrypter.ts"),H=D("./src/demux/aacdemuxer.ts"),B=D("./src/demux/mp4demuxer.ts"),I=D("./src/demux/tsdemuxer.ts"),_=D("./src/demux/mp3demuxer.ts"),x=D("./src/remux/mp4-remuxer.ts"),A=D("./src/remux/passthrough-remuxer.ts"),M=D("./src/demux/chunk-cache.ts"),O=D("./src/utils/mp4-tools.ts"),L=D("./src/utils/logger.ts"),g;try{g=self.performance.now.bind(self.performance)}catch(b){L.logger.debug("Unable to use Performance API on this environment"),g=self.Date.now}var u=[{demux:I.default,remux:x.default},{demux:B.default,remux:A.default},{demux:H.default,remux:x.default},{demux:_.default,remux:x.default}],a=1024;u.forEach(function(b){var h=b.demux;a=Math.max(a,h.minProbeByteLength)});var l=function(){function b(p,c,o,S,y){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new M.default,this.observer=p,this.typeSupported=c,this.config=o,this.vendor=S,this.id=y}var h=b.prototype;return h.configure=function(c){this.transmuxConfig=c,this.decrypter&&this.decrypter.reset()},h.push=function(c,o,S,y){var T=this,N=S.transmuxing;N.executeStart=g();var z=new Uint8Array(c),Y=this.cache,ee=this.config,G=this.currentTransmuxState,W=this.transmuxConfig;y&&(this.currentTransmuxState=y);var te=d(z,o);if(te&&te.method==="AES-128"){var ue=this.getDecrypter();if(ee.enableSoftwareAES){var be=ue.softwareDecrypt(z,te.key.buffer,te.iv.buffer);if(!be)return N.executeEnd=g(),E(S);z=new Uint8Array(be)}else return this.decryptionPromise=ue.webCryptoDecrypt(z,te.key.buffer,te.iv.buffer).then(function(Ye){var rt=T.push(Ye,null,S);return T.decryptionPromise=null,rt}),this.decryptionPromise}var Oe=y||G,Ke=Oe.contiguous,_e=Oe.discontinuity,Ie=Oe.trackSwitch,Ue=Oe.accurateTimeOffset,Pe=Oe.timeOffset,Te=W.audioCodec,se=W.videoCodec,He=W.defaultInitPts,ht=W.duration,it=W.initSegmentData;if((_e||Ie)&&this.resetInitSegment(it,Te,se,ht),_e&&this.resetInitialTimestamp(He),Ke||this.resetContiguity(),this.needsProbing(z,_e,Ie)){if(Y.dataLength){var at=Y.flush();z=Object(O.appendUint8Array)(at,z)}this.configureTransmuxer(z,W)}var ft=this.transmux(z,te,Pe,Ue,S),je=this.currentTransmuxState;return je.contiguous=!0,je.discontinuity=!1,je.trackSwitch=!1,N.executeEnd=g(),ft},h.flush=function(c){var o=this,S=c.transmuxing;S.executeStart=g();var y=this.decrypter,T=this.cache,N=this.currentTransmuxState,z=this.decryptionPromise;if(z)return z.then(function(){return o.flush(c)});var Y=[],ee=N.timeOffset;if(y){var G=y.flush();G&&Y.push(this.push(G,null,c))}var W=T.dataLength;T.reset();var te=this.demuxer,ue=this.remuxer;if(!te||!ue)return W>=a&&this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),S.executeEnd=g(),[E(c)];var be=te.flush(ee);return v(be)?be.then(function(Oe){return o.flushRemux(Y,Oe,c),Y}):(this.flushRemux(Y,be,c),Y)},h.flushRemux=function(c,o,S){var y=o.audioTrack,T=o.avcTrack,N=o.id3Track,z=o.textTrack,Y=this.currentTransmuxState,ee=Y.accurateTimeOffset,G=Y.timeOffset;L.logger.log("[transmuxer.ts]: Flushed fragment "+S.sn+(S.part>-1?" p: "+S.part:"")+" of level "+S.level);var W=this.remuxer.remux(y,T,N,z,G,ee,!0,this.id);c.push({remuxResult:W,chunkMeta:S}),S.transmuxing.executeEnd=g()},h.resetInitialTimestamp=function(c){var o=this.demuxer,S=this.remuxer;if(!o||!S)return;o.resetTimeStamp(c),S.resetTimeStamp(c)},h.resetContiguity=function(){var c=this.demuxer,o=this.remuxer;if(!c||!o)return;c.resetContiguity(),o.resetNextTimestamp()},h.resetInitSegment=function(c,o,S,y){var T=this.demuxer,N=this.remuxer;if(!T||!N)return;T.resetInitSegment(o,S,y),N.resetInitSegment(c,o,S)},h.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},h.transmux=function(c,o,S,y,T){var N;return o&&o.method==="SAMPLE-AES"?N=this.transmuxSampleAes(c,o,S,y,T):N=this.transmuxUnencrypted(c,S,y,T),N},h.transmuxUnencrypted=function(c,o,S,y){var T=this.demuxer.demux(c,o,!1,!this.config.progressive),N=T.audioTrack,z=T.avcTrack,Y=T.id3Track,ee=T.textTrack,G=this.remuxer.remux(N,z,Y,ee,o,S,!1,this.id);return{remuxResult:G,chunkMeta:y}},h.transmuxSampleAes=function(c,o,S,y,T){var N=this;return this.demuxer.demuxSampleAes(c,o,S).then(function(z){var Y=N.remuxer.remux(z.audioTrack,z.avcTrack,z.id3Track,z.textTrack,S,y,!1,N.id);return{remuxResult:Y,chunkMeta:T}})},h.configureTransmuxer=function(c,o){for(var S=this.config,y=this.observer,T=this.typeSupported,N=this.vendor,z=o.audioCodec,Y=o.defaultInitPts,ee=o.duration,G=o.initSegmentData,W=o.videoCodec,te,ue=0,be=u.length;ue<be;ue++)if(u[ue].demux.probe(c)){te=u[ue];break}te||(L.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),te={demux:B.default,remux:A.default});var Oe=this.demuxer,Ke=this.remuxer,_e=te.remux,Ie=te.demux;(!Ke||!(Ke instanceof _e))&&(this.remuxer=new _e(y,S,T,N)),(!Oe||!(Oe instanceof Ie))&&(this.demuxer=new Ie(y,S,T),this.probe=Ie.probe),this.resetInitSegment(G,z,W,ee),this.resetInitialTimestamp(Y)},h.needsProbing=function(c,o,S){return!this.demuxer||!this.remuxer||o||S},h.getDecrypter=function(){var c=this.decrypter;return c||(c=this.decrypter=new P.default(this.observer,this.config)),c},b}();function d(b,h){var p=null;return b.byteLength>0&&h!=null&&h.key!=null&&h.iv!==null&&h.method!=null&&(p=h),p}var E=function(h){return{remuxResult:{},chunkMeta:h}};function v(b){return"then"in b&&b.then instanceof Function}var m=function(h,p,c,o,S){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=h,this.videoCodec=p,this.initSegmentData=c,this.duration=o,this.defaultInitPts=S},k=function(h,p,c,o,S){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=h,this.contiguous=p,this.accurateTimeOffset=c,this.trackSwitch=o,this.timeOffset=S}},"./src/demux/tsdemuxer.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"discardEPB",function(){return E});var K=D("./src/demux/adts.ts"),w=D("./src/demux/mpegaudio.ts"),P=D("./src/demux/exp-golomb.ts"),H=D("./src/demux/id3.ts"),B=D("./src/demux/sample-aes.ts"),I=D("./src/events.ts"),_=D("./src/utils/mp4-tools.ts"),x=D("./src/utils/logger.ts"),A=D("./src/errors.ts"),M={video:1,audio:2,id3:3,text:4},O=function(){function v(k,b,h){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=k,this.config=b,this.typeSupported=h}v.probe=function(b){var h=v.syncOffset(b);return h<0?!1:(h&&x.logger.warn("MPEG2-TS detected but first sync word found @ offset "+h+", junk ahead ?"),!0)},v.syncOffset=function(b){for(var h=Math.min(1e3,b.length-3*188),p=0;p<h;){if(b[p]===71&&b[p+188]===71&&b[p+2*188]===71)return p;p++}return-1},v.createTrack=function(b,h){return{container:b==="video"||b==="audio"?"video/mp2t":void 0,type:b,id:M[b],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:b==="audio"?h:void 0}};var m=v.prototype;return m.resetInitSegment=function(b,h,p){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=v.createTrack("video",p),this._audioTrack=v.createTrack("audio",p),this._id3Track=v.createTrack("id3",p),this._txtTrack=v.createTrack("text",p),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=b,this.videoCodec=h,this._duration=p},m.resetTimeStamp=function(){},m.resetContiguity=function(){var b=this._audioTrack,h=this._avcTrack,p=this._id3Track;b&&(b.pesData=null),h&&(h.pesData=null),p&&(p.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},m.demux=function(b,h,p,c){p===void 0&&(p=!1),c===void 0&&(c=!1),p||(this.sampleAes=null);var o,S=this._avcTrack,y=this._audioTrack,T=this._id3Track,N=S.pid,z=S.pesData,Y=y.pid,ee=T.pid,G=y.pesData,W=T.pesData,te=!1,ue=this.pmtParsed,be=this._pmtId,Oe=b.length;if(this.remainderData&&(b=Object(_.appendUint8Array)(this.remainderData,b),Oe=b.length,this.remainderData=null),Oe<188&&!c)return this.remainderData=b,{audioTrack:y,avcTrack:S,id3Track:T,textTrack:this._txtTrack};var Ke=Math.max(0,v.syncOffset(b));Oe-=(Oe+Ke)%188,Oe<b.byteLength&&!c&&(this.remainderData=new Uint8Array(b.buffer,Oe,b.buffer.byteLength-Oe));for(var _e=Ke;_e<Oe;_e+=188)if(b[_e]===71){var Ie=!!(b[_e+1]&64),Ue=((b[_e+1]&31)<<8)+b[_e+2],Pe=(b[_e+3]&48)>>4,Te=void 0;if(Pe>1){if(Te=_e+5+b[_e+4],Te===_e+188)continue}else Te=_e+4;switch(Ue){case N:Ie&&(z&&(o=a(z))&&this.parseAVCPES(o,!1),z={data:[],size:0}),z&&(z.data.push(b.subarray(Te,_e+188)),z.size+=_e+188-Te);break;case Y:Ie&&(G&&(o=a(G))&&(y.isAAC?this.parseAACPES(o):this.parseMPEGPES(o)),G={data:[],size:0}),G&&(G.data.push(b.subarray(Te,_e+188)),G.size+=_e+188-Te);break;case ee:Ie&&(W&&(o=a(W))&&this.parseID3PES(o),W={data:[],size:0}),W&&(W.data.push(b.subarray(Te,_e+188)),W.size+=_e+188-Te);break;case 0:Ie&&(Te+=b[Te]+1),be=this._pmtId=g(b,Te);break;case be:{Ie&&(Te+=b[Te]+1);var se=u(b,Te,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,p);N=se.avc,N>0&&(S.pid=N),Y=se.audio,Y>0&&(y.pid=Y,y.isAAC=se.isAAC),ee=se.id3,ee>0&&(T.pid=ee),te&&!ue&&(x.logger.log("reparse from beginning"),te=!1,_e=Ke-188),ue=this.pmtParsed=!0;break}case 17:case 8191:break;default:te=!0;break}}else this.observer.emit(I.Events.ERROR,I.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});S.pesData=z,y.pesData=G,T.pesData=W;var He={audioTrack:y,avcTrack:S,id3Track:T,textTrack:this._txtTrack};return c&&this.extractRemainingSamples(He),He},m.flush=function(){var b=this.remainderData;this.remainderData=null;var h;return b?h=this.demux(b,-1,!1,!0):h={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(h),this.sampleAes?this.decrypt(h,this.sampleAes):h},m.extractRemainingSamples=function(b){var h=b.audioTrack,p=b.avcTrack,c=b.id3Track,o=p.pesData,S=h.pesData,y=c.pesData,T;o&&(T=a(o))?(this.parseAVCPES(T,!0),p.pesData=null):p.pesData=o,S&&(T=a(S))?(h.isAAC?this.parseAACPES(T):this.parseMPEGPES(T),h.pesData=null):(S!=null&&S.size&&x.logger.log("last AAC PES packet truncated,might overlap between fragments"),h.pesData=S),y&&(T=a(y))?(this.parseID3PES(T),c.pesData=null):c.pesData=y},m.demuxSampleAes=function(b,h,p){var c=this.demux(b,p,!0,!this.config.progressive),o=this.sampleAes=new B.default(this.observer,this.config,h);return this.decrypt(c,o)},m.decrypt=function(b,h){return new Promise(function(p){var c=b.audioTrack,o=b.avcTrack;c.samples&&c.isAAC?h.decryptAacSamples(c.samples,0,function(){o.samples?h.decryptAvcSamples(o.samples,0,0,function(){p(b)}):p(b)}):o.samples&&h.decryptAvcSamples(o.samples,0,0,function(){p(b)})})},m.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},m.parseAVCPES=function(b,h){var p=this,c=this._avcTrack,o=this.parseAVCNALu(b.data),S=!1,y=this.avcSample,T,N=!1;b.data=null,y&&o.length&&!c.audFound&&(l(y,c),y=this.avcSample=L(!1,b.pts,b.dts,"")),o.forEach(function(z){switch(z.type){case 1:{T=!0,y||(y=p.avcSample=L(!0,b.pts,b.dts,"")),S&&(y.debug+="NDR "),y.frame=!0;var Y=z.data;if(N&&Y.length>4){var ee=new P.default(Y).readSliceType();(ee===2||ee===4||ee===7||ee===9)&&(y.key=!0)}break}case 5:T=!0,y||(y=p.avcSample=L(!0,b.pts,b.dts,"")),S&&(y.debug+="IDR "),y.key=!0,y.frame=!0;break;case 6:{T=!0,S&&y&&(y.debug+="SEI ");var G=new P.default(E(z.data));G.readUByte();for(var W=0,te=0,ue=!1,be=0;!ue&&G.bytesAvailable>1;){W=0;do be=G.readUByte(),W+=be;while(be===255);te=0;do be=G.readUByte(),te+=be;while(be===255);if(W===4&&G.bytesAvailable!==0){ue=!0;var Oe=G.readUByte();if(Oe===181){var Ke=G.readUShort();if(Ke===49){var _e=G.readUInt();if(_e===1195456820){var Ie=G.readUByte();if(Ie===3){for(var Ue=G.readUByte(),Pe=G.readUByte(),Te=31&Ue,se=[Ue,Pe],He=0;He<Te;He++)se.push(G.readUByte()),se.push(G.readUByte()),se.push(G.readUByte());d(p._txtTrack.samples,{type:3,pts:b.pts,bytes:se})}}}}}else if(W===5&&G.bytesAvailable!==0){if(ue=!0,te>16){for(var ht=[],it=0;it<16;it++)ht.push(G.readUByte().toString(16)),(it===3||it===5||it===7||it===9)&&ht.push("-");for(var at=te-16,ft=new Uint8Array(at),je=0;je<at;je++)ft[je]=G.readUByte();d(p._txtTrack.samples,{pts:b.pts,payloadType:W,uuid:ht.join(""),userData:Object(H.utf8ArrayToStr)(ft),userDataBytes:ft})}}else if(te<G.bytesAvailable)for(var Ye=0;Ye<te;Ye++)G.readUByte()}break}case 7:if(T=!0,N=!0,S&&y&&(y.debug+="SPS "),!c.sps){var rt=new P.default(z.data),ot=rt.readSPS();c.width=ot.width,c.height=ot.height,c.pixelRatio=ot.pixelRatio,c.sps=[z.data],c.duration=p._duration;for(var et=z.data.subarray(1,4),Ve="avc1.",$e=0;$e<3;$e++){var bt=et[$e].toString(16);bt.length<2&&(bt="0"+bt),Ve+=bt}c.codec=Ve}break;case 8:T=!0,S&&y&&(y.debug+="PPS "),c.pps||(c.pps=[z.data]);break;case 9:T=!1,c.audFound=!0,y&&l(y,c),y=p.avcSample=L(!1,b.pts,b.dts,S?"AUD ":"");break;case 12:T=!1;break;default:T=!1,y&&(y.debug+="unknown NAL "+z.type+" ");break}if(y&&T){var pt=y.units;pt.push(z)}}),h&&y&&(l(y,c),this.avcSample=null)},m.getLastNalUnit=function(){var b,h=this.avcSample,p;if(!h||h.units.length===0){var c=this._avcTrack.samples;h=c[c.length-1]}if((b=h)!==null&&b!==void 0&&b.units){var o=h.units;p=o[o.length-1]}return p},m.parseAVCNALu=function(b){var h=b.byteLength,p=this._avcTrack,c=p.naluState||0,o=c,S=[],y=0,T,N,z,Y=-1,ee=0;for(c===-1&&(Y=0,ee=b[0]&31,c=0,y=1);y<h;){if(T=b[y++],!c){c=T?0:1;continue}if(c===1){c=T?0:2;continue}if(!T)c=3;else if(T===1){if(Y>=0){var G={data:b.subarray(Y,y-c-1),type:ee};S.push(G)}else{var W=this.getLastNalUnit();if(W&&(o&&y<=4-o&&(W.state&&(W.data=W.data.subarray(0,W.data.byteLength-o))),N=y-c-1,N>0)){var te=new Uint8Array(W.data.byteLength+N);te.set(W.data,0),te.set(b.subarray(0,N),W.data.byteLength),W.data=te,W.state=0}}y<h?(z=b[y]&31,Y=y,ee=z,c=0):c=-1}else c=0}if(Y>=0&&c>=0){var ue={data:b.subarray(Y,h),type:ee,state:c};S.push(ue)}if(S.length===0){var be=this.getLastNalUnit();if(be){var Oe=new Uint8Array(be.data.byteLength+b.byteLength);Oe.set(be.data,0),Oe.set(b,be.data.byteLength),be.data=Oe}}return p.naluState=c,S},m.parseAACPES=function(b){var h=0,p=this._audioTrack,c=this.aacOverFlow,o=b.data;if(c){this.aacOverFlow=null;var S=c.sample.unit.byteLength,y=Math.min(c.missing,S),T=S-y;c.sample.unit.set(o.subarray(0,y),T),p.samples.push(c.sample),h=c.missing}var N,z;for(N=h,z=o.length;N<z-1&&!K.isHeader(o,N);N++);if(N!==h){var Y,ee;if(N<z-1?(Y="AAC PES did not start with ADTS header,offset:"+N,ee=!1):(Y="no ADTS header found in AAC PES",ee=!0),x.logger.warn("parsing error:"+Y),this.observer.emit(I.Events.ERROR,I.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:ee,reason:Y}),ee)return}K.initTrackConfig(p,this.observer,o,N,this.audioCodec);var G;if(b.pts!==void 0)G=b.pts;else if(c){var W=K.getFrameDuration(p.samplerate);G=c.sample.pts+W}else{x.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var te=0;N<z;)if(K.isHeader(o,N)){if(N+5<z){var ue=K.appendFrame(p,o,N,G,te);if(ue)if(ue.missing)this.aacOverFlow=ue;else{N+=ue.length,te++;continue}}break}else N++},m.parseMPEGPES=function(b){var h=b.data,p=h.length,c=0,o=0,S=b.pts;if(S===void 0){x.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<p;)if(w.isHeader(h,o)){var y=w.appendFrame(this._audioTrack,h,o,S,c);if(y)o+=y.length,c++;else break}else o++},m.parseID3PES=function(b){if(b.pts===void 0){x.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(b)},v}();O.minProbeByteLength=188;function L(v,m,k,b){return{key:v,frame:!1,pts:m,dts:k,units:[],debug:b,length:0}}function g(v,m){return(v[m+10]&31)<<8|v[m+11]}function u(v,m,k,b){var h={audio:-1,avc:-1,id3:-1,isAAC:!0},p=(v[m+1]&15)<<8|v[m+2],c=m+3+p-4,o=(v[m+10]&15)<<8|v[m+11];for(m+=12+o;m<c;){var S=(v[m+1]&31)<<8|v[m+2];switch(v[m]){case 207:if(!b){x.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:h.audio===-1&&(h.audio=S);break;case 21:h.id3===-1&&(h.id3=S);break;case 219:if(!b){x.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:h.avc===-1&&(h.avc=S);break;case 3:case 4:k?h.audio===-1&&(h.audio=S,h.isAAC=!1):x.logger.log("MPEG audio found, not supported in this browser");break;case 36:x.logger.warn("Unsupported HEVC stream type found");break;default:break}m+=((v[m+3]&15)<<8|v[m+4])+5}return h}function a(v){var m=0,k,b,h,p,c,o=v.data;if(!v||v.size===0)return null;for(;o[0].length<19&&o.length>1;){var S=new Uint8Array(o[0].length+o[1].length);S.set(o[0]),S.set(o[1],o[0].length),o[0]=S,o.splice(1,1)}k=o[0];var y=(k[0]<<16)+(k[1]<<8)+k[2];if(y===1){if(b=(k[4]<<8)+k[5],b&&b>v.size-6)return null;var T=k[7];T&192&&(p=(k[9]&14)*536870912+(k[10]&255)*4194304+(k[11]&254)*16384+(k[12]&255)*128+(k[13]&254)/2,T&64?(c=(k[14]&14)*536870912+(k[15]&255)*4194304+(k[16]&254)*16384+(k[17]&255)*128+(k[18]&254)/2,p-c>60*9e4&&(x.logger.warn(Math.round((p-c)/9e4)+"s delta between PTS and DTS, align them"),p=c)):c=p),h=k[8];var N=h+9;if(v.size<=N)return null;v.size-=N;for(var z=new Uint8Array(v.size),Y=0,ee=o.length;Y<ee;Y++){k=o[Y];var G=k.byteLength;if(N)if(N>G){N-=G;continue}else k=k.subarray(N),G-=N,N=0;z.set(k,m),m+=G}return b&&(b-=h+3),{data:z,pts:p,dts:c,len:b}}return null}function l(v,m){if(v.units.length&&v.frame){if(v.pts===void 0){var k=m.samples,b=k.length;if(b){var h=k[b-1];v.pts=h.pts,v.dts=h.dts}else{m.dropped++;return}}m.samples.push(v)}v.debug.length&&x.logger.log(v.pts+"/"+v.dts+":"+v.debug)}function d(v,m){var k=v.length;if(k>0){if(m.pts>=v[k-1].pts)v.push(m);else for(var b=k-1;b>=0;b--)if(m.pts<v[b].pts){v.splice(b,0,m);break}}else v.push(m)}function E(v){for(var m=v.byteLength,k=[],b=1;b<m-2;)v[b]===0&&v[b+1]===0&&v[b+2]===3?(k.push(b+2),b+=2):b++;if(k.length===0)return v;var h=m-k.length,p=new Uint8Array(h),c=0;for(b=0;b<h;c++,b++)c===k[0]&&(c++,k.shift()),p[b]=v[c];return p}X.default=O},"./src/errors.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"ErrorTypes",function(){return K}),D.d(X,"ErrorDetails",function(){return w});var K;(function(P){P.NETWORK_ERROR="networkError",P.MEDIA_ERROR="mediaError",P.KEY_SYSTEM_ERROR="keySystemError",P.MUX_ERROR="muxError",P.OTHER_ERROR="otherError"})(K||(K={}));var w;(function(P){P.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",P.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",P.KEY_SYSTEM_NO_SESSION="keySystemNoSession",P.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",P.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",P.MANIFEST_LOAD_ERROR="manifestLoadError",P.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",P.MANIFEST_PARSING_ERROR="manifestParsingError",P.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",P.LEVEL_EMPTY_ERROR="levelEmptyError",P.LEVEL_LOAD_ERROR="levelLoadError",P.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",P.LEVEL_SWITCH_ERROR="levelSwitchError",P.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",P.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",P.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",P.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",P.FRAG_LOAD_ERROR="fragLoadError",P.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",P.FRAG_DECRYPT_ERROR="fragDecryptError",P.FRAG_PARSING_ERROR="fragParsingError",P.REMUX_ALLOC_ERROR="remuxAllocError",P.KEY_LOAD_ERROR="keyLoadError",P.KEY_LOAD_TIMEOUT="keyLoadTimeOut",P.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",P.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",P.BUFFER_APPEND_ERROR="bufferAppendError",P.BUFFER_APPENDING_ERROR="bufferAppendingError",P.BUFFER_STALLED_ERROR="bufferStalledError",P.BUFFER_FULL_ERROR="bufferFullError",P.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",P.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",P.INTERNAL_EXCEPTION="internalException",P.INTERNAL_ABORTED="aborted",P.UNKNOWN="unknown"})(w||(w={}))},"./src/events.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"Events",function(){return K});var K;(function(w){w.MEDIA_ATTACHING="hlsMediaAttaching",w.MEDIA_ATTACHED="hlsMediaAttached",w.MEDIA_DETACHING="hlsMediaDetaching",w.MEDIA_DETACHED="hlsMediaDetached",w.BUFFER_RESET="hlsBufferReset",w.BUFFER_CODECS="hlsBufferCodecs",w.BUFFER_CREATED="hlsBufferCreated",w.BUFFER_APPENDING="hlsBufferAppending",w.BUFFER_APPENDED="hlsBufferAppended",w.BUFFER_EOS="hlsBufferEos",w.BUFFER_FLUSHING="hlsBufferFlushing",w.BUFFER_FLUSHED="hlsBufferFlushed",w.MANIFEST_LOADING="hlsManifestLoading",w.MANIFEST_LOADED="hlsManifestLoaded",w.MANIFEST_PARSED="hlsManifestParsed",w.LEVEL_SWITCHING="hlsLevelSwitching",w.LEVEL_SWITCHED="hlsLevelSwitched",w.LEVEL_LOADING="hlsLevelLoading",w.LEVEL_LOADED="hlsLevelLoaded",w.LEVEL_UPDATED="hlsLevelUpdated",w.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",w.LEVELS_UPDATED="hlsLevelsUpdated",w.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",w.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",w.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",w.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",w.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",w.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",w.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",w.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",w.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",w.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",w.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",w.CUES_PARSED="hlsCuesParsed",w.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",w.INIT_PTS_FOUND="hlsInitPtsFound",w.FRAG_LOADING="hlsFragLoading",w.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",w.FRAG_LOADED="hlsFragLoaded",w.FRAG_DECRYPTED="hlsFragDecrypted",w.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",w.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",w.FRAG_PARSING_METADATA="hlsFragParsingMetadata",w.FRAG_PARSED="hlsFragParsed",w.FRAG_BUFFERED="hlsFragBuffered",w.FRAG_CHANGED="hlsFragChanged",w.FPS_DROP="hlsFpsDrop",w.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",w.ERROR="hlsError",w.DESTROYING="hlsDestroying",w.KEY_LOADING="hlsKeyLoading",w.KEY_LOADED="hlsKeyLoaded",w.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",w.BACK_BUFFER_REACHED="hlsBackBufferReached"})(K||(K={}))},"./src/hls.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return v});var K=D("./node_modules/url-toolkit/src/url-toolkit.js"),w=D.n(K),P=D("./src/loader/playlist-loader.ts"),H=D("./src/loader/key-loader.ts"),B=D("./src/controller/id3-track-controller.ts"),I=D("./src/controller/latency-controller.ts"),_=D("./src/controller/level-controller.ts"),x=D("./src/controller/fragment-tracker.ts"),A=D("./src/controller/stream-controller.ts"),M=D("./src/is-supported.ts"),O=D("./src/utils/logger.ts"),L=D("./src/config.ts"),g=D("./node_modules/eventemitter3/index.js"),u=D.n(g),a=D("./src/events.ts"),l=D("./src/errors.ts");function d(m,k){for(var b=0;b<k.length;b++){var h=k[b];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(m,h.key,h)}}function E(m,k,b){return k&&d(m.prototype,k),b&&d(m,b),m}var v=function(){m.isSupported=function(){return Object(M.isSupported)()};function m(b){b===void 0&&(b={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new g.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var h=this.config=Object(L.mergeConfig)(m.DefaultConfig,b);this.userConfig=b,Object(O.enableLogs)(h.debug),this._autoLevelCapping=-1,h.progressive&&Object(L.enableStreamingMode)(h);var p=h.abrController,c=h.bufferController,o=h.capLevelController,S=h.fpsController,y=this.abrController=new p(this),T=this.bufferController=new c(this),N=this.capLevelController=new o(this),z=new S(this),Y=new P.default(this),ee=new H.default(this),G=new B.default(this),W=this.levelController=new _.default(this),te=new x.FragmentTracker(this),ue=this.streamController=new A.default(this,te);N.setStreamController(ue),z.setStreamController(ue);var be=[W,ue];this.networkControllers=be;var Oe=[Y,ee,y,T,N,z,G,te];this.audioTrackController=this.createController(h.audioTrackController,null,be),this.createController(h.audioStreamController,te,be),this.subtitleTrackController=this.createController(h.subtitleTrackController,null,be),this.createController(h.subtitleStreamController,te,be),this.createController(h.timelineController,null,Oe),this.emeController=this.createController(h.emeController,null,Oe),this.cmcdController=this.createController(h.cmcdController,null,Oe),this.latencyController=this.createController(I.default,null,Oe),this.coreComponents=Oe}var k=m.prototype;return k.createController=function(h,p,c){if(h){var o=p?new h(this,p):new h(this);return c&&c.push(o),o}return null},k.on=function(h,p,c){c===void 0&&(c=this),this._emitter.on(h,p,c)},k.once=function(h,p,c){c===void 0&&(c=this),this._emitter.once(h,p,c)},k.removeAllListeners=function(h){this._emitter.removeAllListeners(h)},k.off=function(h,p,c,o){c===void 0&&(c=this),this._emitter.off(h,p,c,o)},k.listeners=function(h){return this._emitter.listeners(h)},k.emit=function(h,p,c){return this._emitter.emit(h,p,c)},k.trigger=function(h,p){if(this.config.debug)return this.emit(h,h,p);try{return this.emit(h,h,p)}catch(c){O.logger.error("An internal error happened while handling event "+h+'. Error message: "'+c.message+'". Here is a stacktrace:',c),this.trigger(a.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:h,error:c})}return!1},k.listenerCount=function(h){return this._emitter.listenerCount(h)},k.destroy=function(){O.logger.log("destroy"),this.trigger(a.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(h){return h.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(h){return h.destroy()}),this.coreComponents.length=0},k.attachMedia=function(h){O.logger.log("attachMedia"),this._media=h,this.trigger(a.Events.MEDIA_ATTACHING,{media:h})},k.detachMedia=function(){O.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},k.loadSource=function(h){this.stopLoad();var p=this.media,c=this.url,o=this.url=K.buildAbsoluteURL(self.location.href,h,{alwaysNormalize:!0});O.logger.log("loadSource:"+o),p&&c&&c!==o&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(p)),this.trigger(a.Events.MANIFEST_LOADING,{url:h})},k.startLoad=function(h){h===void 0&&(h=-1),O.logger.log("startLoad("+h+")"),this.networkControllers.forEach(function(p){p.startLoad(h)})},k.stopLoad=function(){O.logger.log("stopLoad"),this.networkControllers.forEach(function(h){h.stopLoad()})},k.swapAudioCodec=function(){O.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},k.recoverMediaError=function(){O.logger.log("recoverMediaError");var h=this._media;this.detachMedia(),h&&this.attachMedia(h)},k.removeLevel=function(h,p){p===void 0&&(p=0),this.levelController.removeLevel(h,p)},E(m,[{key:"levels",get:function(){var h=this.levelController.levels;return h||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(h){O.logger.log("set currentLevel:"+h),this.loadLevel=h,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(h){O.logger.log("set nextLevel:"+h),this.levelController.manualLevel=h,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(h){O.logger.log("set loadLevel:"+h),this.levelController.manualLevel=h}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(h){this.levelController.nextLoadLevel=h}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(h){O.logger.log("set firstLevel:"+h),this.levelController.firstLevel=h}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(h){O.logger.log("set startLevel:"+h),h!==-1&&(h=Math.max(h,this.minAutoLevel)),this.levelController.startLevel=h}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(h){var p=!!h;p!==this.config.capLevelToPlayerSize&&(p?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=p)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(h){this._autoLevelCapping!==h&&(O.logger.log("set autoLevelCapping:"+h),this._autoLevelCapping=h)}},{key:"bandwidthEstimate",get:function(){var h=this.abrController.bwEstimator;return h?h.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var h=this.levels,p=this.config.minAutoBitrate;if(!h)return 0;for(var c=h.length,o=0;o<c;o++)if(h[o].maxBitrate>p)return o;return 0}},{key:"maxAutoLevel",get:function(){var h=this.levels,p=this.autoLevelCapping,c;return p===-1&&h&&h.length?c=h.length-1:c=p,c}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(h){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,h)}},{key:"audioTracks",get:function(){var h=this.audioTrackController;return h?h.audioTracks:[]}},{key:"audioTrack",get:function(){var h=this.audioTrackController;return h?h.audioTrack:-1},set:function(h){var p=this.audioTrackController;p&&(p.audioTrack=h)}},{key:"subtitleTracks",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTrack:-1},set:function(h){var p=this.subtitleTrackController;p&&(p.subtitleTrack=h)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var h=this.subtitleTrackController;return h?h.subtitleDisplay:!1},set:function(h){var p=this.subtitleTrackController;p&&(p.subtitleDisplay=h)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(h){this.config.lowLatencyMode=h}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return a.Events}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return m.defaultConfig?m.defaultConfig:L.hlsDefaultConfig},set:function(h){m.defaultConfig=h}}]),m}();v.defaultConfig=void 0},"./src/is-supported.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"isSupported",function(){return P}),D.d(X,"changeTypeSupported",function(){return H});var K=D("./src/utils/mediasource-helper.ts");function w(){return self.SourceBuffer||self.WebKitSourceBuffer}function P(){var B=Object(K.getMediaSource)();if(!B)return!1;var I=w(),_=B&&typeof B.isTypeSupported=="function"&&B.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),x=!I||I.prototype&&typeof I.prototype.appendBuffer=="function"&&typeof I.prototype.remove=="function";return!!_&&!!x}function H(){var B,I=w();return typeof(I==null||((B=I.prototype)===null||B===void 0)?void 0:B.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return O}),D.d(X,"LoadError",function(){return g});var K=D("./src/polyfills/number.ts"),w=D("./src/errors.ts");function P(u,a){u.prototype=Object.create(a.prototype),u.prototype.constructor=u,x(u,a)}function H(u){var a=typeof Map=="function"?new Map:void 0;return H=function(d){if(d===null||!_(d))return d;if(typeof d!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(d))return a.get(d);a.set(d,E)}function E(){return B(d,arguments,A(this).constructor)}return E.prototype=Object.create(d.prototype,{constructor:{value:E,enumerable:!1,writable:!0,configurable:!0}}),x(E,d)},H(u)}function B(u,a,l){return I()?B=Reflect.construct:B=function(E,v,m){var k=[null];k.push.apply(k,v);var b=Function.bind.apply(E,k),h=new b;return m&&x(h,m.prototype),h},B.apply(null,arguments)}function I(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(u){return!1}}function _(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function x(u,a){return x=Object.setPrototypeOf||function(d,E){return d.__proto__=E,d},x(u,a)}function A(u){return A=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},A(u)}var M=Math.pow(2,17),O=function(){function u(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var a=u.prototype;return a.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},a.abort=function(){this.loader&&this.loader.abort()},a.load=function(d,E){var v=this,m=d.url;if(!m)return Promise.reject(new g({type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,networkDetails:null},"Fragment does not have a "+(m?"part list":"url")));this.abort();var k=this.config,b=k.fLoader,h=k.loader;return new Promise(function(p,c){v.loader&&v.loader.destroy();var o=v.loader=d.loader=b?new b(k):new h(k),S=L(d),y={timeout:k.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:k.fragLoadingMaxRetryTimeout,highWaterMark:M};d.stats=o.stats,o.load(S,y,{onSuccess:function(N,z,Y,ee){v.resetLoader(d,o),p({frag:d,part:null,payload:N.data,networkDetails:ee})},onError:function(N,z,Y){v.resetLoader(d,o),c(new g({type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,response:N,networkDetails:Y}))},onAbort:function(N,z,Y){v.resetLoader(d,o),c(new g({type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,networkDetails:Y}))},onTimeout:function(N,z,Y){v.resetLoader(d,o),c(new g({type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,networkDetails:Y}))},onProgress:function(N,z,Y,ee){E&&E({frag:d,part:null,payload:Y,networkDetails:ee})}})})},a.loadPart=function(d,E,v){var m=this;this.abort();var k=this.config,b=k.fLoader,h=k.loader;return new Promise(function(p,c){m.loader&&m.loader.destroy();var o=m.loader=d.loader=b?new b(k):new h(k),S=L(d,E),y={timeout:k.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:k.fragLoadingMaxRetryTimeout,highWaterMark:M};E.stats=o.stats,o.load(S,y,{onSuccess:function(N,z,Y,ee){m.resetLoader(d,o),m.updateStatsFromPart(d,E);var G={frag:d,part:E,payload:N.data,networkDetails:ee};v(G),p(G)},onError:function(N,z,Y){m.resetLoader(d,o),c(new g({type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,part:E,response:N,networkDetails:Y}))},onAbort:function(N,z,Y){d.stats.aborted=E.stats.aborted,m.resetLoader(d,o),c(new g({type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,part:E,networkDetails:Y}))},onTimeout:function(N,z,Y){m.resetLoader(d,o),c(new g({type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,part:E,networkDetails:Y}))}})})},a.updateStatsFromPart=function(d,E){var v=d.stats,m=E.stats,k=m.total;if(v.loaded+=m.loaded,k){var b=Math.round(d.duration/E.duration),h=Math.min(Math.round(v.loaded/k),b),p=b-h,c=p*Math.round(v.loaded/h);v.total=v.loaded+c}else v.total=Math.max(v.loaded,v.total);var o=v.loading,S=m.loading;o.start?o.first+=S.first-S.start:(o.start=S.start,o.first=S.first),o.end=S.end},a.resetLoader=function(d,E){d.loader=null,this.loader===E&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),E.destroy()},u}();function L(u,a){a===void 0&&(a=null);var l=a||u,d={frag:u,part:a,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},E=l.byteRangeStartOffset,v=l.byteRangeEndOffset;return Object(K.isFiniteNumber)(E)&&Object(K.isFiniteNumber)(v)&&(d.rangeStart=E,d.rangeEnd=v),d}var g=function(u){P(a,u);function a(l){for(var d,E=arguments.length,v=new Array(E>1?E-1:0),m=1;m<E;m++)v[m-1]=arguments[m];return d=u.call.apply(u,[this].concat(v))||this,d.data=void 0,d.data=l,d}return a}(H(Error))},"./src/loader/fragment.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"ElementaryStreamTypes",function(){return O}),D.d(X,"BaseSegment",function(){return L}),D.d(X,"Fragment",function(){return g}),D.d(X,"Part",function(){return u});var K=D("./src/polyfills/number.ts"),w=D("./node_modules/url-toolkit/src/url-toolkit.js"),P=D.n(w),H=D("./src/utils/logger.ts"),B=D("./src/loader/level-key.ts"),I=D("./src/loader/load-stats.ts");function _(a,l){a.prototype=Object.create(l.prototype),a.prototype.constructor=a,x(a,l)}function x(a,l){return x=Object.setPrototypeOf||function(E,v){return E.__proto__=v,E},x(a,l)}function A(a,l){for(var d=0;d<l.length;d++){var E=l[d];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(a,E.key,E)}}function M(a,l,d){return l&&A(a.prototype,l),d&&A(a,d),a}var O;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(O||(O={}));var L=function(){function a(d){var E;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(E={},E[O.AUDIO]=null,E[O.VIDEO]=null,E[O.AUDIOVIDEO]=null,E),this.baseurl=d}var l=a.prototype;return l.setByteRange=function(E,v){var m=E.split("@",2),k=[];m.length===1?k[0]=v?v.byteRangeEndOffset:0:k[0]=parseInt(m[1]),k[1]=parseInt(m[0])+k[0],this._byteRange=k},M(a,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(w.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(E){this._url=E}}]),a}(),g=function(a){_(l,a);function l(E,v){var m;return m=a.call(this,v)||this,m._decryptdata=null,m.rawProgramDateTime=null,m.programDateTime=null,m.tagList=[],m.duration=0,m.sn=0,m.levelkey=void 0,m.type=void 0,m.loader=null,m.level=-1,m.cc=0,m.startPTS=void 0,m.endPTS=void 0,m.appendedPTS=void 0,m.startDTS=void 0,m.endDTS=void 0,m.start=0,m.deltaPTS=void 0,m.maxStartPTS=void 0,m.minEndPTS=void 0,m.stats=new I.LoadStats,m.urlId=0,m.data=void 0,m.bitrateTest=!1,m.title=null,m.initSegment=null,m.type=E,m}var d=l.prototype;return d.createInitializationVector=function(v){for(var m=new Uint8Array(16),k=12;k<16;k++)m[k]=v>>8*(15-k)&255;return m},d.setDecryptDataFromLevelKey=function(v,m){var k=v;return(v==null?void 0:v.method)==="AES-128"&&v.uri&&!v.iv&&(k=B.LevelKey.fromURI(v.uri),k.method=v.method,k.iv=this.createInitializationVector(m),k.keyFormat="identity"),k},d.setElementaryStreamInfo=function(v,m,k,b,h,p){p===void 0&&(p=!1);var c=this.elementaryStreams,o=c[v];if(!o){c[v]={startPTS:m,endPTS:k,startDTS:b,endDTS:h,partial:p};return}o.startPTS=Math.min(o.startPTS,m),o.endPTS=Math.max(o.endPTS,k),o.startDTS=Math.min(o.startDTS,b),o.endDTS=Math.max(o.endDTS,h)},d.clearElementaryStreamInfo=function(){var v=this.elementaryStreams;v[O.AUDIO]=null,v[O.VIDEO]=null,v[O.AUDIOVIDEO]=null},M(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var v=this.sn;typeof v!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&H.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),v=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,v)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(K.isFiniteNumber)(this.programDateTime))return null;var v=Object(K.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+v*1e3}},{key:"encrypted",get:function(){var v;return!!((v=this.decryptdata)!==null&&v!==void 0&&v.keyFormat&&this.decryptdata.uri)}}]),l}(L),u=function(a){_(l,a);function l(d,E,v,m,k){var b;b=a.call(this,v)||this,b.fragOffset=0,b.duration=0,b.gap=!1,b.independent=!1,b.relurl=void 0,b.fragment=void 0,b.index=void 0,b.stats=new I.LoadStats,b.duration=d.decimalFloatingPoint("DURATION"),b.gap=d.bool("GAP"),b.independent=d.bool("INDEPENDENT"),b.relurl=d.enumeratedString("URI"),b.fragment=E,b.index=m;var h=d.enumeratedString("BYTERANGE");return h&&b.setByteRange(h,k),k&&(b.fragOffset=k.fragOffset+k.duration),b}return M(l,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var E=this.elementaryStreams;return!!(E.audio||E.video||E.audiovideo)}}]),l}(L)},"./src/loader/key-loader.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return H});var K=D("./src/events.ts"),w=D("./src/errors.ts"),P=D("./src/utils/logger.ts"),H=function(){function B(_){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=_,this._registerListeners()}var I=B.prototype;return I._registerListeners=function(){this.hls.on(K.Events.KEY_LOADING,this.onKeyLoading,this)},I._unregisterListeners=function(){this.hls.off(K.Events.KEY_LOADING,this.onKeyLoading)},I.destroy=function(){this._unregisterListeners();for(var x in this.loaders){var A=this.loaders[x];A&&A.destroy()}this.loaders={}},I.onKeyLoading=function(x,A){var M=A.frag,O=M.type,L=this.loaders[O];if(!M.decryptdata){P.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var g=M.decryptdata.uri;if(g!==this.decrypturl||this.decryptkey===null){var u=this.hls.config;if(L&&(P.logger.warn("abort previous key loader for type:"+O),L.abort()),!g){P.logger.warn("key uri is falsy");return}var a=u.loader,l=M.loader=this.loaders[O]=new a(u);this.decrypturl=g,this.decryptkey=null;var d={url:g,frag:M,responseType:"arraybuffer"},E={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:u.fragLoadingRetryDelay,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(d,E,v)}else this.decryptkey&&(M.decryptdata.key=this.decryptkey,this.hls.trigger(K.Events.KEY_LOADED,{frag:M}))},I.loadsuccess=function(x,A,M){var O=M.frag;if(!O.decryptdata){P.logger.error("after key load, decryptdata unset");return}this.decryptkey=O.decryptdata.key=new Uint8Array(x.data),O.loader=null,delete this.loaders[O.type],this.hls.trigger(K.Events.KEY_LOADED,{frag:O})},I.loaderror=function(x,A){var M=A.frag,O=M.loader;O&&O.abort(),delete this.loaders[M.type],this.hls.trigger(K.Events.ERROR,{type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:M,response:x})},I.loadtimeout=function(x,A){var M=A.frag,O=M.loader;O&&O.abort(),delete this.loaders[M.type],this.hls.trigger(K.Events.ERROR,{type:w.ErrorTypes.NETWORK_ERROR,details:w.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:M})},B}()},"./src/loader/level-details.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"LevelDetails",function(){return B});var K=D("./src/polyfills/number.ts");function w(I,_){for(var x=0;x<_.length;x++){var A=_[x];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(I,A.key,A)}}function P(I,_,x){return _&&w(I.prototype,_),x&&w(I,x),I}var H=10,B=function(){function I(x){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=x}var _=I.prototype;return _.reloaded=function(A){if(!A){this.advanced=!0,this.updated=!0;return}var M=this.lastPartSn-A.lastPartSn,O=this.lastPartIndex-A.lastPartIndex;this.updated=this.endSN!==A.endSN||!!O||!!M,this.advanced=this.endSN>A.endSN||M>0||M===0&&O>0,this.updated||this.advanced?this.misses=Math.floor(A.misses*.6):this.misses=A.misses+1,this.availabilityDelay=A.availabilityDelay},P(I,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(K.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||H}},{key:"drift",get:function(){var A=this.driftEndTime-this.driftStartTime;if(A>0){var M=this.driftEnd-this.driftStart;return M*1e3/A}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var A;return(A=this.fragments)!==null&&A!==void 0&&A.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 A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),I}()},"./src/loader/level-key.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"LevelKey",function(){return B});var K=D("./node_modules/url-toolkit/src/url-toolkit.js"),w=D.n(K);function P(I,_){for(var x=0;x<_.length;x++){var A=_[x];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(I,A.key,A)}}function H(I,_,x){return _&&P(I.prototype,_),x&&P(I,x),I}var B=function(){I.fromURL=function(x,A){return new I(x,A)},I.fromURI=function(x){return new I(x)};function I(_,x){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,x?this._uri=Object(K.buildAbsoluteURL)(_,x,{alwaysNormalize:!0}):this._uri=_}return H(I,[{key:"uri",get:function(){return this._uri}}]),I}()},"./src/loader/load-stats.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"LoadStats",function(){return K});var K=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return l});var K=D("./src/polyfills/number.ts"),w=D("./node_modules/url-toolkit/src/url-toolkit.js"),P=D.n(w),H=D("./src/loader/fragment.ts"),B=D("./src/loader/level-details.ts"),I=D("./src/loader/level-key.ts"),_=D("./src/utils/attr-list.ts"),x=D("./src/utils/logger.ts"),A=D("./src/utils/codecs.ts"),M=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,O=/#EXT-X-MEDIA:(.*)/g,L=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),g=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),u=/\.(mp4|m4s|m4v|m4a)$/i;function a(k){var b,h;return u.test((b=(h=w.parseURL(k))===null||h===void 0?void 0:h.path)!=null?b:"")}var l=function(){function k(){}return k.findGroup=function(h,p){for(var c=0;c<h.length;c++){var o=h[c];if(o.id===p)return o}},k.convertAVC1ToAVCOTI=function(h){var p=h.split(".");if(p.length>2){var c=p.shift()+".";return c+=parseInt(p.shift()).toString(16),c+=("000"+parseInt(p.shift()).toString(16)).substr(-4),c}return h},k.resolve=function(h,p){return w.buildAbsoluteURL(p,h,{alwaysNormalize:!0})},k.parseMasterPlaylist=function(h,p){var c=[],o={},S=!1;M.lastIndex=0;for(var y;(y=M.exec(h))!=null;)if(y[1]){var T=new _.AttrList(y[1]),N={attrs:T,bitrate:T.decimalInteger("AVERAGE-BANDWIDTH")||T.decimalInteger("BANDWIDTH"),name:T.NAME,url:k.resolve(y[2],p)},z=T.decimalResolution("RESOLUTION");z&&(N.width=z.width,N.height=z.height),d((T.CODECS||"").split(/[ ,]+/).filter(function(ee){return ee}),N),N.videoCodec&&N.videoCodec.indexOf("avc1")!==-1&&(N.videoCodec=k.convertAVC1ToAVCOTI(N.videoCodec)),c.push(N)}else if(y[3]){var Y=new _.AttrList(y[3]);Y["DATA-ID"]&&(S=!0,o[Y["DATA-ID"]]=Y)}return{levels:c,sessionData:S?o:null}},k.parseMasterPlaylistMedia=function(h,p,c,o){o===void 0&&(o=[]);var S,y=[],T=0;for(O.lastIndex=0;(S=O.exec(h))!==null;){var N=new _.AttrList(S[1]);if(N.TYPE===c){var z={attrs:N,bitrate:0,id:T++,groupId:N["GROUP-ID"],instreamId:N["INSTREAM-ID"],name:N.NAME||N.LANGUAGE||"",type:c,default:N.bool("DEFAULT"),autoselect:N.bool("AUTOSELECT"),forced:N.bool("FORCED"),lang:N.LANGUAGE,url:N.URI?k.resolve(N.URI,p):""};if(o.length){var Y=k.findGroup(o,z.groupId)||o[0];E(z,Y,"audioCodec"),E(z,Y,"textCodec")}y.push(z)}}return y},k.parseLevelPlaylist=function(h,p,c,o,S){var y=new B.LevelDetails(p),T=y.fragments,N=null,z=0,Y=0,ee=0,G=0,W=null,te=new H.Fragment(o,p),ue,be,Oe,Ke=-1,_e=!1;for(L.lastIndex=0,y.m3u8=h;(ue=L.exec(h))!==null;){_e&&(_e=!1,te=new H.Fragment(o,p),te.start=ee,te.sn=z,te.cc=G,te.level=c,N&&(te.initSegment=N,te.rawProgramDateTime=N.rawProgramDateTime));var Ie=ue[1];if(Ie){te.duration=parseFloat(Ie);var Ue=(" "+ue[2]).slice(1);te.title=Ue||null,te.tagList.push(Ue?["INF",Ie,Ue]:["INF",Ie])}else if(ue[3])Object(K.isFiniteNumber)(te.duration)&&(te.start=ee,Oe&&(te.levelkey=Oe),te.sn=z,te.level=c,te.cc=G,te.urlId=S,T.push(te),te.relurl=(" "+ue[3]).slice(1),m(te,W),W=te,ee+=te.duration,z++,Y=0,_e=!0);else if(ue[4]){var Pe=(" "+ue[4]).slice(1);W?te.setByteRange(Pe,W):te.setByteRange(Pe)}else if(ue[5])te.rawProgramDateTime=(" "+ue[5]).slice(1),te.tagList.push(["PROGRAM-DATE-TIME",te.rawProgramDateTime]),Ke===-1&&(Ke=T.length);else{if(ue=ue[0].match(g),!ue){x.logger.warn("No matches on slow regex match for level playlist!");continue}for(be=1;be<ue.length&&!(typeof ue[be]!="undefined");be++);var Te=(" "+ue[be]).slice(1),se=(" "+ue[be+1]).slice(1),He=ue[be+2]?(" "+ue[be+2]).slice(1):"";switch(Te){case"PLAYLIST-TYPE":y.type=se.toUpperCase();break;case"MEDIA-SEQUENCE":z=y.startSN=parseInt(se);break;case"SKIP":{var ht=new _.AttrList(se),it=ht.decimalInteger("SKIPPED-SEGMENTS");if(Object(K.isFiniteNumber)(it)){y.skippedSegments=it;for(var at=it;at--;)T.unshift(null);z+=it}var ft=ht.enumeratedString("RECENTLY-REMOVED-DATERANGES");ft&&(y.recentlyRemovedDateranges=ft.split(" "));break}case"TARGETDURATION":y.targetduration=parseFloat(se);break;case"VERSION":y.version=parseInt(se);break;case"EXTM3U":break;case"ENDLIST":y.live=!1;break;case"#":(se||He)&&te.tagList.push(He?[se,He]:[se]);break;case"DIS":G++;case"GAP":te.tagList.push([Te]);break;case"BITRATE":te.tagList.push([Te,se]);break;case"DISCONTINUITY-SEQ":G=parseInt(se);break;case"KEY":{var je,Ye=new _.AttrList(se),rt=Ye.enumeratedString("METHOD"),ot=Ye.URI,et=Ye.hexadecimalInteger("IV"),Ve=Ye.enumeratedString("KEYFORMATVERSIONS"),$e=Ye.enumeratedString("KEYID"),bt=(je=Ye.enumeratedString("KEYFORMAT"))!=null?je:"identity",pt=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(pt.indexOf(bt)>-1){x.logger.warn("Keyformat "+bt+" is not supported from the manifest");continue}else if(bt!=="identity")continue;rt&&(Oe=I.LevelKey.fromURL(p,ot),ot&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(rt)>=0&&(Oe.method=rt,Oe.keyFormat=bt,$e&&(Oe.keyID=$e),Ve&&(Oe.keyFormatVersions=Ve),Oe.iv=et));break}case"START":{var mt=new _.AttrList(se),st=mt.decimalFloatingPoint("TIME-OFFSET");Object(K.isFiniteNumber)(st)&&(y.startTimeOffset=st);break}case"MAP":{var Ot=new _.AttrList(se);te.relurl=Ot.URI,Ot.BYTERANGE&&te.setByteRange(Ot.BYTERANGE),te.level=c,te.sn="initSegment",Oe&&(te.levelkey=Oe),te.initSegment=null,N=te,_e=!0;break}case"SERVER-CONTROL":{var xt=new _.AttrList(se);y.canBlockReload=xt.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=xt.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=y.canSkipUntil>0&&xt.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=xt.optionalFloat("PART-HOLD-BACK",0),y.holdBack=xt.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var vt=new _.AttrList(se);y.partTarget=vt.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ne=y.partList;Ne||(Ne=y.partList=[]);var Lt=Y>0?Ne[Ne.length-1]:void 0,Et=Y++,Fe=new H.Part(new _.AttrList(se),te,p,Et,Lt);Ne.push(Fe),te.duration+=Fe.duration;break}case"PRELOAD-HINT":{var Ze=new _.AttrList(se);y.preloadHint=Ze;break}case"RENDITION-REPORT":{var we=new _.AttrList(se);y.renditionReports=y.renditionReports||[],y.renditionReports.push(we);break}default:x.logger.warn("line parsed but not handled: "+ue);break}}}W&&!W.relurl?(T.pop(),ee-=W.duration,y.partList&&(y.fragmentHint=W)):y.partList&&(m(te,W),te.cc=G,y.fragmentHint=te);var ye=T.length,Ee=T[0],re=T[ye-1];if(ee+=y.skippedSegments*y.targetduration,ee>0&&ye&&re){y.averagetargetduration=ee/ye;var ne=re.sn;y.endSN=ne!=="initSegment"?ne:0,Ee&&(y.startCC=Ee.cc,Ee.initSegment||y.fragments.every(function(de){return de.relurl&&a(de.relurl)})&&(x.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),te=new H.Fragment(o,p),te.relurl=re.relurl,te.level=c,te.sn="initSegment",Ee.initSegment=te,y.needSidxRanges=!0))}else y.endSN=0,y.startCC=0;return y.fragmentHint&&(ee+=y.fragmentHint.duration),y.totalduration=ee,y.endCC=G,Ke>0&&v(T,Ke),y},k}();function d(k,b){["video","audio","text"].forEach(function(h){var p=k.filter(function(o){return Object(A.isCodecType)(o,h)});if(p.length){var c=p.filter(function(o){return o.lastIndexOf("avc1",0)===0||o.lastIndexOf("mp4a",0)===0});b[h+"Codec"]=c.length>0?c[0]:p[0],k=k.filter(function(o){return p.indexOf(o)===-1})}}),b.unknownCodecs=k}function E(k,b,h){var p=b[h];p&&(k[h]=p)}function v(k,b){for(var h=k[b],p=b;p--;){var c=k[p];if(!c)return;c.programDateTime=h.programDateTime-c.duration*1e3,h=c}}function m(k,b){k.rawProgramDateTime?k.programDateTime=Date.parse(k.rawProgramDateTime):b!=null&&b.programDateTime&&(k.programDateTime=b.endProgramDateTime),Object(K.isFiniteNumber)(k.programDateTime)||(k.programDateTime=null,k.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/polyfills/number.ts"),w=D("./src/events.ts"),P=D("./src/errors.ts"),H=D("./src/utils/logger.ts"),B=D("./src/utils/mp4-tools.ts"),I=D("./src/loader/m3u8-parser.ts"),_=D("./src/types/loader.ts"),x=D("./src/utils/attr-list.ts");function A(L){var g=L.type;switch(g){case _.PlaylistContextType.AUDIO_TRACK:return _.PlaylistLevelType.AUDIO;case _.PlaylistContextType.SUBTITLE_TRACK:return _.PlaylistLevelType.SUBTITLE;default:return _.PlaylistLevelType.MAIN}}function M(L,g){var u=L.url;return(u===void 0||u.indexOf("data:")===0)&&(u=g.url),u}var O=function(){function L(u){this.hls=void 0,this.loaders=Object.create(null),this.hls=u,this.registerListeners()}var g=L.prototype;return g.registerListeners=function(){var a=this.hls;a.on(w.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(w.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(w.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(w.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},g.unregisterListeners=function(){var a=this.hls;a.off(w.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(w.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(w.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(w.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},g.createInternalLoader=function(a){var l=this.hls.config,d=l.pLoader,E=l.loader,v=d||E,m=new v(l);return a.loader=m,this.loaders[a.type]=m,m},g.getInternalLoader=function(a){return this.loaders[a.type]},g.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},g.destroyInternalLoaders=function(){for(var a in this.loaders){var l=this.loaders[a];l&&l.destroy(),this.resetInternalLoader(a)}},g.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},g.onManifestLoading=function(a,l){var d=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:_.PlaylistContextType.MANIFEST,url:d,deliveryDirectives:null})},g.onLevelLoading=function(a,l){var d=l.id,E=l.level,v=l.url,m=l.deliveryDirectives;this.load({id:d,groupId:null,level:E,responseType:"text",type:_.PlaylistContextType.LEVEL,url:v,deliveryDirectives:m})},g.onAudioTrackLoading=function(a,l){var d=l.id,E=l.groupId,v=l.url,m=l.deliveryDirectives;this.load({id:d,groupId:E,level:null,responseType:"text",type:_.PlaylistContextType.AUDIO_TRACK,url:v,deliveryDirectives:m})},g.onSubtitleTrackLoading=function(a,l){var d=l.id,E=l.groupId,v=l.url,m=l.deliveryDirectives;this.load({id:d,groupId:E,level:null,responseType:"text",type:_.PlaylistContextType.SUBTITLE_TRACK,url:v,deliveryDirectives:m})},g.load=function(a){var l,d=this.hls.config,E=this.getInternalLoader(a);if(E){var v=E.context;if(v&&v.url===a.url){H.logger.trace("[playlist-loader]: playlist request ongoing");return}H.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),E.abort()}var m,k,b,h;switch(a.type){case _.PlaylistContextType.MANIFEST:m=d.manifestLoadingMaxRetry,k=d.manifestLoadingTimeOut,b=d.manifestLoadingRetryDelay,h=d.manifestLoadingMaxRetryTimeout;break;case _.PlaylistContextType.LEVEL:case _.PlaylistContextType.AUDIO_TRACK:case _.PlaylistContextType.SUBTITLE_TRACK:m=0,k=d.levelLoadingTimeOut;break;default:m=d.levelLoadingMaxRetry,k=d.levelLoadingTimeOut,b=d.levelLoadingRetryDelay,h=d.levelLoadingMaxRetryTimeout;break}if(E=this.createInternalLoader(a),(l=a.deliveryDirectives)!==null&&l!==void 0&&l.part){var p;if(a.type===_.PlaylistContextType.LEVEL&&a.level!==null?p=this.hls.levels[a.level].details:a.type===_.PlaylistContextType.AUDIO_TRACK&&a.id!==null?p=this.hls.audioTracks[a.id].details:a.type===_.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(p=this.hls.subtitleTracks[a.id].details),p){var c=p.partTarget,o=p.targetduration;c&&o&&(k=Math.min(Math.max(c*3,o*.8)*1e3,k))}}var S={timeout:k,maxRetry:m,retryDelay:b,maxRetryDelay:h,highWaterMark:0},y={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};E.load(a,S,y)},g.loadsuccess=function(a,l,d,E){if(E===void 0&&(E=null),d.isSidxRequest){this.handleSidxRequest(a,d),this.handlePlaylistLoaded(a,l,d,E);return}this.resetInternalLoader(d.type);var v=a.data;if(v.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,d,"no EXTM3U delimiter",E);return}l.parsing.start=performance.now(),v.indexOf("#EXTINF:")>0||v.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,l,d,E):this.handleMasterPlaylist(a,l,d,E)},g.loaderror=function(a,l,d){d===void 0&&(d=null),this.handleNetworkError(l,d,!1,a)},g.loadtimeout=function(a,l,d){d===void 0&&(d=null),this.handleNetworkError(l,d,!0)},g.handleMasterPlaylist=function(a,l,d,E){var v=this.hls,m=a.data,k=M(a,d),b=I.default.parseMasterPlaylist(m,k),h=b.levels,p=b.sessionData;if(!h.length){this.handleManifestParsingError(a,d,"no level found in manifest",E);return}var c=h.map(function(z){return{id:z.attrs.AUDIO,audioCodec:z.audioCodec}}),o=h.map(function(z){return{id:z.attrs.SUBTITLES,textCodec:z.textCodec}}),S=I.default.parseMasterPlaylistMedia(m,k,"AUDIO",c),y=I.default.parseMasterPlaylistMedia(m,k,"SUBTITLES",o),T=I.default.parseMasterPlaylistMedia(m,k,"CLOSED-CAPTIONS");if(S.length){var N=S.some(function(z){return!z.url});!N&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(H.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),S.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new x.AttrList({}),bitrate:0,url:""}))}v.trigger(w.Events.MANIFEST_LOADED,{levels:h,audioTracks:S,subtitles:y,captions:T,url:k,stats:l,networkDetails:E,sessionData:p})},g.handleTrackOrLevelPlaylist=function(a,l,d,E){var v=this.hls,m=d.id,k=d.level,b=d.type,h=M(a,d),p=Object(K.isFiniteNumber)(m)?m:0,c=Object(K.isFiniteNumber)(k)?k:p,o=A(d),S=I.default.parseLevelPlaylist(a.data,h,c,o,p);if(!S.fragments.length){v.trigger(w.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:h,reason:"no fragments found in level",level:typeof d.level=="number"?d.level:void 0});return}if(b===_.PlaylistContextType.MANIFEST){var y={attrs:new x.AttrList({}),bitrate:0,details:S,name:"",url:h};v.trigger(w.Events.MANIFEST_LOADED,{levels:[y],audioTracks:[],url:h,stats:l,networkDetails:E,sessionData:null})}if(l.parsing.end=performance.now(),S.needSidxRanges){var T,N=(T=S.fragments[0].initSegment)===null||T===void 0?void 0:T.url;this.load({url:N,isSidxRequest:!0,type:b,level:k,levelDetails:S,id:m,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}d.levelDetails=S,this.handlePlaylistLoaded(a,l,d,E)},g.handleSidxRequest=function(a,l){var d=Object(B.parseSegmentIndex)(new Uint8Array(a.data));if(!d)return;var E=d.references,v=l.levelDetails;E.forEach(function(m,k){var b=m.info,h=v.fragments[k];h.byteRange.length===0&&h.setByteRange(String(1+b.end-b.start)+"@"+String(b.start)),h.initSegment&&h.initSegment.setByteRange(String(d.moovEndOffset)+"@0")})},g.handleManifestParsingError=function(a,l,d,E){this.hls.trigger(w.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===_.PlaylistContextType.MANIFEST,url:a.url,reason:d,response:a,context:l,networkDetails:E})},g.handleNetworkError=function(a,l,d,E){d===void 0&&(d=!1),H.logger.warn("[playlist-loader]: A network "+(d?"timeout":"error")+" occurred while loading "+a.type+" level: "+a.level+" id: "+a.id+' group-id: "'+a.groupId+'"');var v=P.ErrorDetails.UNKNOWN,m=!1,k=this.getInternalLoader(a);switch(a.type){case _.PlaylistContextType.MANIFEST:v=d?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case _.PlaylistContextType.LEVEL:v=d?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case _.PlaylistContextType.AUDIO_TRACK:v=d?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case _.PlaylistContextType.SUBTITLE_TRACK:v=d?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}k&&this.resetInternalLoader(a.type);var b={type:P.ErrorTypes.NETWORK_ERROR,details:v,fatal:m,url:a.url,loader:k,context:a,networkDetails:l};E&&(b.response=E),this.hls.trigger(w.Events.ERROR,b)},g.handlePlaylistLoaded=function(a,l,d,E){var v=d.type,m=d.level,k=d.id,b=d.groupId,h=d.loader,p=d.levelDetails,c=d.deliveryDirectives;if(!(p!=null&&p.targetduration)){this.handleManifestParsingError(a,d,"invalid target duration",E);return}if(!h)return;p.live&&(h.getCacheAge&&(p.ageHeader=h.getCacheAge()||0),(!h.getCacheAge||isNaN(p.ageHeader))&&(p.ageHeader=0));switch(v){case _.PlaylistContextType.MANIFEST:case _.PlaylistContextType.LEVEL:this.hls.trigger(w.Events.LEVEL_LOADED,{details:p,level:m||0,id:k||0,stats:l,networkDetails:E,deliveryDirectives:c});break;case _.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(w.Events.AUDIO_TRACK_LOADED,{details:p,id:k||0,groupId:b||"",stats:l,networkDetails:E,deliveryDirectives:c});break;case _.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(w.Events.SUBTITLE_TRACK_LOADED,{details:p,id:k||0,groupId:b||"",stats:l,networkDetails:E,deliveryDirectives:c});break}},L}();X.default=O},"./src/polyfills/number.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"isFiniteNumber",function(){return K}),D.d(X,"MAX_SAFE_INTEGER",function(){return w});var K=Number.isFinite||function(P){return typeof P=="number"&&isFinite(P)},w=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ae,X,D){"use strict";D.r(X);var K=function(){function w(){}return w.getSilentFrame=function(H,B){switch(H){case"mp4a.40.2":if(B===1)return new Uint8Array([0,200,0,128,35,128]);if(B===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(B===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(B===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(B===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(B===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(B===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(B===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(B===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},w}();X.default=K},"./src/remux/mp4-generator.ts":function(ae,X,D){"use strict";D.r(X);var K=Math.pow(2,32)-1,w=function(){function P(){}return P.init=function(){P.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 B;for(B in P.types)P.types.hasOwnProperty(B)&&(P.types[B]=[B.charCodeAt(0),B.charCodeAt(1),B.charCodeAt(2),B.charCodeAt(3)]);var I=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]),_=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]);P.HDLR_TYPES={video:I,audio:_};var x=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),A=new Uint8Array([0,0,0,0,0,0,0,0]);P.STTS=P.STSC=P.STCO=A,P.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),P.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),P.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),P.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var M=new Uint8Array([105,115,111,109]),O=new Uint8Array([97,118,99,49]),L=new Uint8Array([0,0,0,1]);P.FTYP=P.box(P.types.ftyp,M,L,M,O),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,x))},P.box=function(B){for(var I=8,_=arguments.length,x=new Array(_>1?_-1:0),A=1;A<_;A++)x[A-1]=arguments[A];for(var M=x.length,O=M;M--;)I+=x[M].byteLength;var L=new Uint8Array(I);for(L[0]=I>>24&255,L[1]=I>>16&255,L[2]=I>>8&255,L[3]=I&255,L.set(B,4),M=0,I=8;M<O;M++)L.set(x[M],I),I+=x[M].byteLength;return L},P.hdlr=function(B){return P.box(P.types.hdlr,P.HDLR_TYPES[B])},P.mdat=function(B){return P.box(P.types.mdat,B)},P.mdhd=function(B,I){I*=B;var _=Math.floor(I/(K+1)),x=Math.floor(I%(K+1));return P.box(P.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,B>>24&255,B>>16&255,B>>8&255,B&255,_>>24,_>>16&255,_>>8&255,_&255,x>>24,x>>16&255,x>>8&255,x&255,85,196,0,0]))},P.mdia=function(B){return P.box(P.types.mdia,P.mdhd(B.timescale,B.duration),P.hdlr(B.type),P.minf(B))},P.mfhd=function(B){return P.box(P.types.mfhd,new Uint8Array([0,0,0,0,B>>24,B>>16&255,B>>8&255,B&255]))},P.minf=function(B){return B.type==="audio"?P.box(P.types.minf,P.box(P.types.smhd,P.SMHD),P.DINF,P.stbl(B)):P.box(P.types.minf,P.box(P.types.vmhd,P.VMHD),P.DINF,P.stbl(B))},P.moof=function(B,I,_){return P.box(P.types.moof,P.mfhd(B),P.traf(_,I))},P.moov=function(B){for(var I=B.length,_=[];I--;)_[I]=P.trak(B[I]);return P.box.apply(null,[P.types.moov,P.mvhd(B[0].timescale,B[0].duration)].concat(_).concat(P.mvex(B)))},P.mvex=function(B){for(var I=B.length,_=[];I--;)_[I]=P.trex(B[I]);return P.box.apply(null,[P.types.mvex].concat(_))},P.mvhd=function(B,I){I*=B;var _=Math.floor(I/(K+1)),x=Math.floor(I%(K+1)),A=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,B>>24&255,B>>16&255,B>>8&255,B&255,_>>24,_>>16&255,_>>8&255,_&255,x>>24,x>>16&255,x>>8&255,x&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 P.box(P.types.mvhd,A)},P.sdtp=function(B){var I=B.samples||[],_=new Uint8Array(4+I.length),x,A;for(x=0;x<I.length;x++)A=I[x].flags,_[x+4]=A.dependsOn<<4|A.isDependedOn<<2|A.hasRedundancy;return P.box(P.types.sdtp,_)},P.stbl=function(B){return P.box(P.types.stbl,P.stsd(B),P.box(P.types.stts,P.STTS),P.box(P.types.stsc,P.STSC),P.box(P.types.stsz,P.STSZ),P.box(P.types.stco,P.STCO))},P.avc1=function(B){var I=[],_=[],x,A,M;for(x=0;x<B.sps.length;x++)A=B.sps[x],M=A.byteLength,I.push(M>>>8&255),I.push(M&255),I=I.concat(Array.prototype.slice.call(A));for(x=0;x<B.pps.length;x++)A=B.pps[x],M=A.byteLength,_.push(M>>>8&255),_.push(M&255),_=_.concat(Array.prototype.slice.call(A));var O=P.box(P.types.avcC,new Uint8Array([1,I[3],I[4],I[5],252|3,224|B.sps.length].concat(I).concat([B.pps.length]).concat(_))),L=B.width,g=B.height,u=B.pixelRatio[0],a=B.pixelRatio[1];return P.box(P.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,L>>8&255,L&255,g>>8&255,g&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),O,P.box(P.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),P.box(P.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,a>>24,a>>16&255,a>>8&255,a&255])))},P.esds=function(B){var I=B.config.length;return new Uint8Array([0,0,0,0,3,23+I,0,1,0,4,15+I,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([I]).concat(B.config).concat([6,1,2]))},P.mp4a=function(B){var I=B.samplerate;return P.box(P.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,B.channelCount,0,16,0,0,0,0,I>>8&255,I&255,0,0]),P.box(P.types.esds,P.esds(B)))},P.mp3=function(B){var I=B.samplerate;return P.box(P.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,B.channelCount,0,16,0,0,0,0,I>>8&255,I&255,0,0]))},P.stsd=function(B){return B.type==="audio"?!B.isAAC&&B.codec==="mp3"?P.box(P.types.stsd,P.STSD,P.mp3(B)):P.box(P.types.stsd,P.STSD,P.mp4a(B)):P.box(P.types.stsd,P.STSD,P.avc1(B))},P.tkhd=function(B){var I=B.id,_=B.duration*B.timescale,x=B.width,A=B.height,M=Math.floor(_/(K+1)),O=Math.floor(_%(K+1));return P.box(P.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,I>>24&255,I>>16&255,I>>8&255,I&255,0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255,O>>24,O>>16&255,O>>8&255,O&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,x>>8&255,x&255,0,0,A>>8&255,A&255,0,0]))},P.traf=function(B,I){var _=P.sdtp(B),x=B.id,A=Math.floor(I/(K+1)),M=Math.floor(I%(K+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,x>>24,x>>16&255,x>>8&255,x&255])),P.box(P.types.tfdt,new Uint8Array([1,0,0,0,A>>24,A>>16&255,A>>8&255,A&255,M>>24,M>>16&255,M>>8&255,M&255])),P.trun(B,_.length+16+20+8+16+8+8),_)},P.trak=function(B){return B.duration=B.duration||4294967295,P.box(P.types.trak,P.tkhd(B),P.mdia(B))},P.trex=function(B){var I=B.id;return P.box(P.types.trex,new Uint8Array([0,0,0,0,I>>24,I>>16&255,I>>8&255,I&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},P.trun=function(B,I){var _=B.samples||[],x=_.length,A=12+16*x,M=new Uint8Array(A),O,L,g,u,a,l;for(I+=8+A,M.set([0,0,15,1,x>>>24&255,x>>>16&255,x>>>8&255,x&255,I>>>24&255,I>>>16&255,I>>>8&255,I&255],0),O=0;O<x;O++)L=_[O],g=L.duration,u=L.size,a=L.flags,l=L.cts,M.set([g>>>24&255,g>>>16&255,g>>>8&255,g&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*O);return P.box(P.types.trun,M)},P.initSegment=function(B){P.types||P.init();var I=P.moov(B),_=new Uint8Array(P.FTYP.byteLength+I.byteLength);return _.set(P.FTYP),_.set(I,P.FTYP.byteLength),_},P}();w.types=void 0,w.HDLR_TYPES=void 0,w.STTS=void 0,w.STSC=void 0,w.STCO=void 0,w.STSZ=void 0,w.VMHD=void 0,w.SMHD=void 0,w.STSD=void 0,w.FTYP=void 0,w.DINF=void 0,X.default=w},"./src/remux/mp4-remuxer.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return l}),D.d(X,"normalizePts",function(){return d});var K=D("./src/polyfills/number.ts"),w=D("./src/remux/aac-helper.ts"),P=D("./src/remux/mp4-generator.ts"),H=D("./src/events.ts"),B=D("./src/errors.ts"),I=D("./src/utils/logger.ts"),_=D("./src/types/loader.ts"),x=D("./src/utils/timescale-conversion.ts");function A(){return A=Object.assign||function(k){for(var b=1;b<arguments.length;b++){var h=arguments[b];for(var p in h)Object.prototype.hasOwnProperty.call(h,p)&&(k[p]=h[p])}return k},A.apply(this,arguments)}var M=10*1e3,O=1024,L=1152,g=null,u=null,a=!1,l=function(){function k(h,p,c,o){if(o===void 0&&(o=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=h,this.config=p,this.typeSupported=c,this.ISGenerated=!1,g===null){var S=navigator.userAgent||"",y=S.match(/Chrome\/(\d+)/i);g=y?parseInt(y[1]):0}if(u===null){var T=navigator.userAgent.match(/Safari\/(\d+)/i);u=T?parseInt(T[1]):0}a=!!g&&g<75||!!u&&u<600}var b=k.prototype;return b.destroy=function(){},b.resetTimeStamp=function(p){I.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=p},b.resetNextTimestamp=function(){I.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},b.resetInitSegment=function(){I.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},b.getVideoStartPts=function(p){var c=!1,o=p.reduce(function(S,y){var T=y.pts-S;return T<-4294967296?(c=!0,d(S,y.pts)):T>0?S:y.pts},p[0].pts);return c&&I.logger.debug("PTS rollover detected"),o},b.remux=function(p,c,o,S,y,T,N,z){var Y,ee,G,W,te,ue,be=y,Oe=y,Ke=p.pid>-1,_e=c.pid>-1,Ie=c.samples.length,Ue=p.samples.length>0,Pe=Ie>1,Te=(!Ke||Ue)&&(!_e||Pe)||this.ISGenerated||N;if(Te){this.ISGenerated||(G=this.generateIS(p,c,y));var se=this.isVideoContiguous,He=-1;if(Pe&&(He=E(c.samples),!se&&this.config.forceKeyFrameOnDiscontinuity))if(ue=!0,He>0){I.logger.warn("[mp4-remuxer]: Dropped "+He+" out of "+Ie+" video samples due to a missing keyframe");var ht=this.getVideoStartPts(c.samples);c.samples=c.samples.slice(He),c.dropped+=He,Oe+=(c.samples[0].pts-ht)/(c.timescale||9e4)}else He===-1&&(I.logger.warn("[mp4-remuxer]: No keyframe found out of "+Ie+" video samples"),ue=!1);if(this.ISGenerated){if(Ue&&Pe){var it=this.getVideoStartPts(c.samples),at=d(p.samples[0].pts,it)-it,ft=at/c.inputTimeScale;be+=Math.max(0,ft),Oe+=Math.max(0,-ft)}if(Ue){if(p.samplerate||(I.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),G=this.generateIS(p,c,y)),ee=this.remuxAudio(p,be,this.isAudioContiguous,T,_e||Pe||z===_.PlaylistLevelType.AUDIO?Oe:void 0),Pe){var je=ee?ee.endPTS-ee.startPTS:0;c.inputTimeScale||(I.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),G=this.generateIS(p,c,y)),Y=this.remuxVideo(c,Oe,se,je)}}else Pe&&(Y=this.remuxVideo(c,Oe,se,0));Y&&(Y.firstKeyFrame=He,Y.independent=He!==-1)}}return this.ISGenerated&&(o.samples.length&&(te=this.remuxID3(o,y)),S.samples.length&&(W=this.remuxText(S,y))),{audio:ee,video:Y,initSegment:G,independent:ue,text:W,id3:te}},b.generateIS=function(p,c,o){var S=p.samples,y=c.samples,T=this.typeSupported,N={},z=!Object(K.isFiniteNumber)(this._initPTS),Y="audio/mp4",ee,G,W;if(z&&(ee=G=Infinity),p.config&&S.length&&(p.timescale=p.samplerate,p.isAAC||(T.mpeg?(Y="audio/mpeg",p.codec=""):T.mp3&&(p.codec="mp3")),N.audio={id:"audio",container:Y,codec:p.codec,initSegment:!p.isAAC&&T.mpeg?new Uint8Array(0):P.default.initSegment([p]),metadata:{channelCount:p.channelCount}},z&&(W=p.inputTimeScale,ee=G=S[0].pts-Math.round(W*o))),c.sps&&c.pps&&y.length&&(c.timescale=c.inputTimeScale,N.video={id:"main",container:"video/mp4",codec:c.codec,initSegment:P.default.initSegment([c]),metadata:{width:c.width,height:c.height}},z)){W=c.inputTimeScale;var te=this.getVideoStartPts(y),ue=Math.round(W*o);G=Math.min(G,d(y[0].dts,te)-ue),ee=Math.min(ee,te-ue)}if(Object.keys(N).length)return this.ISGenerated=!0,z&&(this._initPTS=ee,this._initDTS=G),{tracks:N,initPTS:ee,timescale:W}},b.remuxVideo=function(p,c,o,S){var y=p.inputTimeScale,T=p.samples,N=[],z=T.length,Y=this._initPTS,ee=this.nextAvcDts,G=8,W,te,ue,be=Number.POSITIVE_INFINITY,Oe=Number.NEGATIVE_INFINITY,Ke=0,_e=!1;if(!o||ee===null){var Ie=c*y,Ue=T[0].pts-d(T[0].dts,T[0].pts);ee=Ie-Ue}for(var Pe=0;Pe<z;Pe++){var Te=T[Pe];if(Te.pts=d(Te.pts-Y,ee),Te.dts=d(Te.dts-Y,ee),Te.dts>Te.pts){var se=9e4*.2;Ke=Math.max(Math.min(Ke,Te.pts-Te.dts),-1*se)}Te.dts<T[Pe>0?Pe-1:Pe].dts&&(_e=!0)}_e&&T.sort(function(Gt,Kt){var Ct=Gt.dts-Kt.dts,pr=Gt.pts-Kt.pts;return Ct||pr}),te=T[0].dts,ue=T[T.length-1].dts;var He=Math.round((ue-te)/(z-1));if(Ke<0){if(Ke<He*-2){I.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(x.toMsFromMpegTsClock)(-He,!0)+" ms");for(var ht=Ke,it=0;it<z;it++)T[it].dts=ht=Math.max(ht,T[it].pts-He),T[it].pts=Math.max(ht,T[it].pts)}else{I.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(x.toMsFromMpegTsClock)(Ke,!0)+" ms to overcome this issue");for(var at=0;at<z;at++)T[at].dts=T[at].dts+Ke}te=T[0].dts}if(o){var ft=te-ee,je=ft>He,Ye=ft<-1;if(je||Ye){je?I.logger.warn("AVC: "+Object(x.toMsFromMpegTsClock)(ft,!0)+" ms ("+ft+"dts) hole between fragments detected, filling it"):I.logger.warn("AVC: "+Object(x.toMsFromMpegTsClock)(-ft,!0)+" ms ("+ft+"dts) overlapping between fragments detected"),te=ee;var rt=T[0].pts-ft;T[0].dts=te,T[0].pts=rt,I.logger.log("Video: First PTS/DTS adjusted: "+Object(x.toMsFromMpegTsClock)(rt,!0)+"/"+Object(x.toMsFromMpegTsClock)(te,!0)+", delta: "+Object(x.toMsFromMpegTsClock)(ft,!0)+" ms")}}a&&(te=Math.max(0,te));for(var ot=0,et=0,Ve=0;Ve<z;Ve++){for(var $e=T[Ve],bt=$e.units,pt=bt.length,mt=0,st=0;st<pt;st++)mt+=bt[st].data.length;et+=mt,ot+=pt,$e.length=mt,$e.dts=Math.max($e.dts,te),$e.pts=Math.max($e.pts,$e.dts,0),be=Math.min($e.pts,be),Oe=Math.max($e.pts,Oe)}ue=T[z-1].dts;var Ot=et+4*ot+8,xt;try{xt=new Uint8Array(Ot)}catch(Gt){this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:B.ErrorTypes.MUX_ERROR,details:B.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ot,reason:"fail allocating video mdat "+Ot});return}var vt=new DataView(xt.buffer);vt.setUint32(0,Ot),xt.set(P.default.types.mdat,4);for(var Ne=0;Ne<z;Ne++){for(var Lt=T[Ne],Et=Lt.units,Fe=0,Ze=0,we=Et.length;Ze<we;Ze++){var ye=Et[Ze],Ee=ye.data,re=ye.data.byteLength;vt.setUint32(G,re),G+=4,xt.set(Ee,G),G+=re,Fe+=4+re}if(Ne<z-1)W=T[Ne+1].dts-Lt.dts;else{var ne=this.config,de=Lt.dts-T[Ne>0?Ne-1:Ne].dts;if(ne.stretchShortVideoTrack&&this.nextAudioPts!==null){var ge=Math.floor(ne.maxBufferHole*y),Se=(S?be+S*y:this.nextAudioPts)-Lt.pts;Se>ge?(W=Se-de,W<0&&(W=de),I.logger.log("[mp4-remuxer]: It is approximately "+Se/90+" ms to the next segment; using duration "+W/90+" ms for the last video frame.")):W=de}else W=de}var Re=Math.round(Lt.pts-Lt.dts);N.push(new v(Lt.key,W,Fe,Re))}if(N.length&&g&&g<70){var Ge=N[0].flags;Ge.dependsOn=2,Ge.isNonSync=0}console.assert(W!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=ee=ue+W,this.isVideoContiguous=!0;var yt=P.default.moof(p.sequenceNumber++,te,A({},p,{samples:N})),_t="video",kt={data1:yt,data2:xt,startPTS:be/y,endPTS:(Oe+W)/y,startDTS:te/y,endDTS:ee/y,type:_t,hasAudio:!1,hasVideo:!0,nb:N.length,dropped:p.dropped};return p.samples=[],p.dropped=0,console.assert(xt.length,"MDAT length must not be zero"),kt},b.remuxAudio=function(p,c,o,S,y){var T=p.inputTimeScale,N=p.samplerate?p.samplerate:T,z=T/N,Y=p.isAAC?O:L,ee=Y*z,G=this._initPTS,W=!p.isAAC&&this.typeSupported.mpeg,te=[],ue=p.samples,be=W?0:8,Oe=this.nextAudioPts||-1,Ke=c*T;if(this.isAudioContiguous=o=o||ue.length&&Oe>0&&(S&&Math.abs(Ke-Oe)<9e3||Math.abs(d(ue[0].pts-G,Ke)-Oe)<20*ee),ue.forEach(function(Ee){Ee.pts=d(Ee.pts-G,Ke)}),!o||Oe<0){if(ue=ue.filter(function(Ee){return Ee.pts>=0}),!ue.length)return;y===0?Oe=0:S?Oe=Math.max(0,Ke):Oe=ue[0].pts}if(p.isAAC)for(var _e=y!==void 0,Ie=this.config.maxAudioFramesDrift,Ue=0,Pe=Oe;Ue<ue.length;Ue++){var Te=ue[Ue],se=Te.pts,He=se-Pe,ht=Math.abs(1e3*He/T);if(He<=-Ie*ee&&_e)Ue===0&&(I.logger.warn("Audio frame @ "+(se/T).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*He/T)+" ms."),this.nextAudioPts=Oe=Pe=se);else if(He>=Ie*ee&&ht<M&&_e){var it=Math.round(He/ee);Pe=se-it*ee,Pe<0&&(it--,Pe+=ee),Ue===0&&(this.nextAudioPts=Oe=Pe),I.logger.warn("[mp4-remuxer]: Injecting "+it+" audio frame @ "+(Pe/T).toFixed(3)+"s due to "+Math.round(1e3*He/T)+" ms gap.");for(var at=0;at<it;at++){var ft=Math.max(Pe,0),je=w.default.getSilentFrame(p.manifestCodec||p.codec,p.channelCount);je||(I.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),je=Te.unit.subarray()),ue.splice(Ue,0,{unit:je,pts:ft}),Pe+=ee,Ue++}}Te.pts=Pe,Pe+=ee}for(var Ye=null,rt=null,ot,et=0,Ve=ue.length;Ve--;)et+=ue[Ve].unit.byteLength;for(var $e=0,bt=ue.length;$e<bt;$e++){var pt=ue[$e],mt=pt.unit,st=pt.pts;if(rt!==null){var Ot=te[$e-1];Ot.duration=Math.round((st-rt)/z)}else if(o&&p.isAAC&&(st=Oe),Ye=st,et>0){et+=be;try{ot=new Uint8Array(et)}catch(Ee){this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:B.ErrorTypes.MUX_ERROR,details:B.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:et,reason:"fail allocating audio mdat "+et});return}if(!W){var xt=new DataView(ot.buffer);xt.setUint32(0,et),ot.set(P.default.types.mdat,4)}}else return;ot.set(mt,be);var vt=mt.byteLength;be+=vt,te.push(new v(!0,Y,vt,0)),rt=st}var Ne=te.length;if(!Ne)return;var Lt=te[te.length-1];this.nextAudioPts=Oe=rt+z*Lt.duration;var Et=W?new Uint8Array(0):P.default.moof(p.sequenceNumber++,Ye/z,A({},p,{samples:te}));p.samples=[];var Fe=Ye/T,Ze=Oe/T,we="audio",ye={data1:Et,data2:ot,startPTS:Fe,endPTS:Ze,startDTS:Fe,endDTS:Ze,type:we,hasAudio:!0,hasVideo:!1,nb:Ne};return this.isAudioContiguous=!0,console.assert(ot.length,"MDAT length must not be zero"),ye},b.remuxEmptyAudio=function(p,c,o,S){var y=p.inputTimeScale,T=p.samplerate?p.samplerate:y,N=y/T,z=this.nextAudioPts,Y=(z!==null?z:S.startDTS*y)+this._initDTS,ee=S.endDTS*y+this._initDTS,G=N*O,W=Math.ceil((ee-Y)/G),te=w.default.getSilentFrame(p.manifestCodec||p.codec,p.channelCount);if(I.logger.warn("[mp4-remuxer]: remux empty Audio"),!te){I.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ue=[],be=0;be<W;be++){var Oe=Y+be*G;ue.push({unit:te,pts:Oe,dts:Oe})}return p.samples=ue,this.remuxAudio(p,c,o,!1)},b.remuxID3=function(p,c){var o=p.samples.length;if(!o)return;for(var S=p.inputTimeScale,y=this._initPTS,T=this._initDTS,N=0;N<o;N++){var z=p.samples[N];z.pts=d(z.pts-y,c*S)/S,z.dts=d(z.dts-T,c*S)/S}var Y=p.samples;return p.samples=[],{samples:Y}},b.remuxText=function(p,c){var o=p.samples.length;if(!o)return;for(var S=p.inputTimeScale,y=this._initPTS,T=0;T<o;T++){var N=p.samples[T];N.pts=d(N.pts-y,c*S)/S}p.samples.sort(function(Y,ee){return Y.pts-ee.pts});var z=p.samples;return p.samples=[],{samples:z}},k}();function d(k,b){var h;if(b===null)return k;for(b<k?h=-8589934592:h=8589934592;Math.abs(k-b)>4294967296;)k+=h;return k}function E(k){for(var b=0;b<k.length;b++)if(k[b].key)return b;return-1}var v=function(b,h,p,c){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=h,this.size=p,this.cts=c,this.flags=new m(b)},m=function(b){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=b?2:1,this.isNonSync=b?0:1}},"./src/remux/passthrough-remuxer.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/polyfills/number.ts"),w=D("./src/utils/mp4-tools.ts"),P=D("./src/loader/fragment.ts"),H=D("./src/utils/logger.ts"),B=function(){function x(){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 A=x.prototype;return A.destroy=function(){},A.resetTimeStamp=function(O){this.initPTS=O,this.lastEndDTS=null},A.resetNextTimestamp=function(){this.lastEndDTS=null},A.resetInitSegment=function(O,L,g){this.audioCodec=L,this.videoCodec=g,this.generateInitSegment(O),this.emitInitSegment=!0},A.generateInitSegment=function(O){var L=this.audioCodec,g=this.videoCodec;if(!O||!O.byteLength){this.initTracks=void 0,this.initData=void 0;return}var u=this.initData=Object(w.parseInitSegment)(O);L||(L=_(u.audio,P.ElementaryStreamTypes.AUDIO)),g||(g=_(u.video,P.ElementaryStreamTypes.VIDEO));var a={};u.audio&&u.video?a.audiovideo={container:"video/mp4",codec:L+","+g,initSegment:O,id:"main"}:u.audio?a.audio={container:"audio/mp4",codec:L,initSegment:O,id:"audio"}:u.video?a.video={container:"video/mp4",codec:g,initSegment:O,id:"main"}:H.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},A.remux=function(O,L,g,u,a){var l=this.initPTS,d=this.lastEndDTS,E={audio:void 0,video:void 0,text:u,id3:g,initSegment:void 0};Object(K.isFiniteNumber)(d)||(d=this.lastEndDTS=a||0);var v=L.samples;if(!v||!v.length)return E;var m={initPTS:void 0,timescale:1},k=this.initData;if((!k||!k.length)&&(this.generateInitSegment(v),k=this.initData),!k||!k.length)return H.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),E;this.emitInitSegment&&(m.tracks=this.initTracks,this.emitInitSegment=!1),Object(K.isFiniteNumber)(l)||(this.initPTS=m.initPTS=l=I(k,v,d));var b=Object(w.getDuration)(v,k),h=d,p=b+h;Object(w.offsetStartDTS)(k,v,l),b>0?this.lastEndDTS=p:(H.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var c=!!k.audio,o=!!k.video,S="";c&&(S+="audio"),o&&(S+="video");var y={data1:v,startPTS:h,startDTS:h,endPTS:p,endDTS:p,type:S,hasAudio:c,hasVideo:o,nb:1,dropped:0};return E.audio=y.type==="audio"?y:void 0,E.video=y.type!=="audio"?y:void 0,E.text=u,E.id3=g,E.initSegment=m,E},x}(),I=function(A,M,O){return Object(w.getStartDTS)(A,M)-O};function _(x,A){var M=x==null?void 0:x.codec;return M&&M.length>4?M:M==="hvc1"?"hvc1.1.c.L120.90":M==="av01"?"av01.0.04M.08":M==="avc1"||A===P.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}X.default=B},"./src/task-loop.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return K});var K=function(){function w(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var P=w.prototype;return P.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},P.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},P.onHandlerDestroyed=function(){},P.hasInterval=function(){return!!this._tickInterval},P.hasNextTick=function(){return!!this._tickTimer},P.setInterval=function(B){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,B),!0)},P.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},P.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},P.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},P.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},P.doTick=function(){},w}()},"./src/types/cmcd.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"CMCDVersion",function(){return K}),D.d(X,"CMCDObjectType",function(){return w}),D.d(X,"CMCDStreamingFormat",function(){return P}),D.d(X,"CMCDStreamType",function(){return H});var K=1,w;(function(B){B.MANIFEST="m",B.AUDIO="a",B.VIDEO="v",B.MUXED="av",B.INIT="i",B.CAPTION="c",B.TIMED_TEXT="tt",B.KEY="k",B.OTHER="o"})(w||(w={}));var P;(function(B){B.DASH="d",B.HLS="h",B.SMOOTH="s",B.OTHER="o"})(P||(P={}));var H;(function(B){B.VOD="v",B.LIVE="l"})(H||(H={}))},"./src/types/level.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"HlsSkip",function(){return P}),D.d(X,"getSkipValue",function(){return H}),D.d(X,"HlsUrlParameters",function(){return B}),D.d(X,"Level",function(){return I});function K(_,x){for(var A=0;A<x.length;A++){var M=x[A];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(_,M.key,M)}}function w(_,x,A){return x&&K(_.prototype,x),A&&K(_,A),_}var P;(function(_){_.No="",_.Yes="YES",_.v2="v2"})(P||(P={}));function H(_,x){var A=_.canSkipUntil,M=_.canSkipDateRanges,O=_.endSN,L=x!==void 0?x-O:0;return A&&L<A?M?P.v2:P.Yes:P.No}var B=function(){function _(A,M,O){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=A,this.part=M,this.skip=O}var x=_.prototype;return x.addDirectives=function(M){var O=new self.URL(M);return this.msn!==void 0&&O.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&O.searchParams.set("_HLS_part",this.part.toString()),this.skip&&O.searchParams.set("_HLS_skip",this.skip),O.toString()},_}(),I=function(){function _(x){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=[x.url],this.attrs=x.attrs,this.bitrate=x.bitrate,x.details&&(this.details=x.details),this.id=x.id||0,this.name=x.name,this.width=x.width||0,this.height=x.height||0,this.audioCodec=x.audioCodec,this.videoCodec=x.videoCodec,this.unknownCodecs=x.unknownCodecs,this.codecSet=[x.videoCodec,x.audioCodec].filter(function(A){return A}).join(",").replace(/\.[^.,]+/g,"")}return w(_,[{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(A){var M=A%this.url.length;this._urlId!==M&&(this.details=void 0,this._urlId=M)}}]),_}()},"./src/types/loader.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"PlaylistContextType",function(){return K}),D.d(X,"PlaylistLevelType",function(){return w});var K;(function(P){P.MANIFEST="manifest",P.LEVEL="level",P.AUDIO_TRACK="audioTrack",P.SUBTITLE_TRACK="subtitleTrack"})(K||(K={}));var w;(function(P){P.MAIN="main",P.AUDIO="audio",P.SUBTITLE="subtitle"})(w||(w={}))},"./src/types/transmuxer.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"ChunkMetadata",function(){return K});var K=function(H,B,I,_,x,A){_===void 0&&(_=0),x===void 0&&(x=-1),A===void 0&&(A=!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=w(),this.buffering={audio:w(),video:w(),audiovideo:w()},this.level=H,this.sn=B,this.id=I,this.size=_,this.part=x,this.partial=A};function w(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"AttrList",function(){return P});var K=/^(\d+)x(\d+)$/,w=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,P=function(){function H(I){typeof I=="string"&&(I=H.parseAttrList(I));for(var _ in I)I.hasOwnProperty(_)&&(this[_]=I[_])}var B=H.prototype;return B.decimalInteger=function(_){var x=parseInt(this[_],10);return x>Number.MAX_SAFE_INTEGER?Infinity:x},B.hexadecimalInteger=function(_){if(this[_]){var x=(this[_]||"0x").slice(2);x=(x.length&1?"0":"")+x;for(var A=new Uint8Array(x.length/2),M=0;M<x.length/2;M++)A[M]=parseInt(x.slice(M*2,M*2+2),16);return A}else return null},B.hexadecimalIntegerAsNumber=function(_){var x=parseInt(this[_],16);return x>Number.MAX_SAFE_INTEGER?Infinity:x},B.decimalFloatingPoint=function(_){return parseFloat(this[_])},B.optionalFloat=function(_,x){var A=this[_];return A?parseFloat(A):x},B.enumeratedString=function(_){return this[_]},B.bool=function(_){return this[_]==="YES"},B.decimalResolution=function(_){var x=K.exec(this[_]);return x===null?void 0:{width:parseInt(x[1],10),height:parseInt(x[2],10)}},H.parseAttrList=function(_){var x,A={},M='"';for(w.lastIndex=0;(x=w.exec(_))!==null;){var O=x[2];O.indexOf(M)===0&&O.lastIndexOf(M)===O.length-1&&(O=O.slice(1,-1)),A[x[1]]=O}return A},H}()},"./src/utils/binary-search.ts":function(ae,X,D){"use strict";D.r(X);var K={search:function(P,H){for(var B=0,I=P.length-1,_=null,x=null;B<=I;){_=(B+I)/2|0,x=P[_];var A=H(x);if(A>0)B=_+1;else if(A<0)I=_-1;else return x}return null}};X.default=K},"./src/utils/buffer-helper.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"BufferHelper",function(){return P});var K=D("./src/utils/logger.ts"),w={length:0,start:function(){return 0},end:function(){return 0}},P=function(){function H(){}return H.isBuffered=function(I,_){try{if(I){for(var x=H.getBuffered(I),A=0;A<x.length;A++)if(_>=x.start(A)&&_<=x.end(A))return!0}}catch(M){}return!1},H.bufferInfo=function(I,_,x){try{if(I){var A=H.getBuffered(I),M=[],O;for(O=0;O<A.length;O++)M.push({start:A.start(O),end:A.end(O)});return this.bufferedInfo(M,_,x)}}catch(L){}return{len:0,start:_,end:_,nextStart:void 0}},H.bufferedInfo=function(I,_,x){_=Math.max(0,_),I.sort(function(m,k){var b=m.start-k.start;return b||k.end-m.end});var A=[];if(x)for(var M=0;M<I.length;M++){var O=A.length;if(O){var L=A[O-1].end;I[M].start-L<x?I[M].end>L&&(A[O-1].end=I[M].end):A.push(I[M])}else A.push(I[M])}else A=I;for(var g=0,u,a=_,l=_,d=0;d<A.length;d++){var E=A[d].start,v=A[d].end;if(_+x>=E&&_<v)a=E,l=v,g=l-_;else if(_+x<E){u=E;break}}return{len:g,start:a||0,end:l||0,nextStart:u}},H.getBuffered=function(I){try{return I.buffered}catch(_){return K.logger.log("failed to get media.buffered",_),w}},H}()},"./src/utils/cea-608-parser.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"Row",function(){return l}),D.d(X,"CaptionScreen",function(){return d});var K=D("./src/utils/logger.ts"),w={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},P=function(p){var c=p;return w.hasOwnProperty(p)&&(c=w[p]),String.fromCharCode(c)},H=15,B=100,I={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},_={17:2,18:4,21:6,22:8,23:10,19:13,20:15},x={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},A={25:2,26:4,29:6,30:8,31:10,27:13,28:15},M=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],O;(function(h){h[h.ERROR=0]="ERROR",h[h.TEXT=1]="TEXT",h[h.WARNING=2]="WARNING",h[h.INFO=2]="INFO",h[h.DEBUG=3]="DEBUG",h[h.DATA=3]="DATA"})(O||(O={}));var L=function(){function h(){this.time=null,this.verboseLevel=O.ERROR}var p=h.prototype;return p.log=function(o,S){this.verboseLevel>=o&&K.logger.log(this.time+" ["+o+"] "+S)},h}(),g=function(p){for(var c=[],o=0;o<p.length;o++)c.push(p[o].toString(16));return c},u=function(){function h(c,o,S,y,T){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=c||"white",this.underline=o||!1,this.italics=S||!1,this.background=y||"black",this.flash=T||!1}var p=h.prototype;return p.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},p.setStyles=function(o){for(var S=["foreground","underline","italics","background","flash"],y=0;y<S.length;y++){var T=S[y];o.hasOwnProperty(T)&&(this[T]=o[T])}},p.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},p.equals=function(o){return this.foreground===o.foreground&&this.underline===o.underline&&this.italics===o.italics&&this.background===o.background&&this.flash===o.flash},p.copy=function(o){this.foreground=o.foreground,this.underline=o.underline,this.italics=o.italics,this.background=o.background,this.flash=o.flash},p.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},h}(),a=function(){function h(c,o,S,y,T,N){this.uchar=void 0,this.penState=void 0,this.uchar=c||" ",this.penState=new u(o,S,y,T,N)}var p=h.prototype;return p.reset=function(){this.uchar=" ",this.penState.reset()},p.setChar=function(o,S){this.uchar=o,this.penState.copy(S)},p.setPenState=function(o){this.penState.copy(o)},p.equals=function(o){return this.uchar===o.uchar&&this.penState.equals(o.penState)},p.copy=function(o){this.uchar=o.uchar,this.penState.copy(o.penState)},p.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},h}(),l=function(){function h(c){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var o=0;o<B;o++)this.chars.push(new a);this.logger=c,this.pos=0,this.currPenState=new u}var p=h.prototype;return p.equals=function(o){for(var S=!0,y=0;y<B;y++)if(!this.chars[y].equals(o.chars[y])){S=!1;break}return S},p.copy=function(o){for(var S=0;S<B;S++)this.chars[S].copy(o.chars[S])},p.isEmpty=function(){for(var o=!0,S=0;S<B;S++)if(!this.chars[S].isEmpty()){o=!1;break}return o},p.setCursor=function(o){this.pos!==o&&(this.pos=o),this.pos<0?(this.logger.log(O.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>B&&(this.logger.log(O.DEBUG,"Too large cursor position "+this.pos),this.pos=B)},p.moveCursor=function(o){var S=this.pos+o;if(o>1)for(var y=this.pos+1;y<S+1;y++)this.chars[y].setPenState(this.currPenState);this.setCursor(S)},p.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},p.insertChar=function(o){o>=144&&this.backSpace();var S=P(o);if(this.pos>=B){this.logger.log(O.ERROR,"Cannot insert "+o.toString(16)+" ("+S+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(S,this.currPenState),this.moveCursor(1)},p.clearFromPos=function(o){var S;for(S=o;S<B;S++)this.chars[S].reset()},p.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},p.clearToEndOfRow=function(){this.clearFromPos(this.pos)},p.getTextString=function(){for(var o=[],S=!0,y=0;y<B;y++){var T=this.chars[y].uchar;T!==" "&&(S=!1),o.push(T)}return S?"":o.join("")},p.setPenStyles=function(o){this.currPenState.setStyles(o);var S=this.chars[this.pos];S.setPenState(this.currPenState)},h}(),d=function(){function h(c){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var o=0;o<H;o++)this.rows.push(new l(c));this.logger=c,this.currRow=H-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var p=h.prototype;return p.reset=function(){for(var o=0;o<H;o++)this.rows[o].clear();this.currRow=H-1},p.equals=function(o){for(var S=!0,y=0;y<H;y++)if(!this.rows[y].equals(o.rows[y])){S=!1;break}return S},p.copy=function(o){for(var S=0;S<H;S++)this.rows[S].copy(o.rows[S])},p.isEmpty=function(){for(var o=!0,S=0;S<H;S++)if(!this.rows[S].isEmpty()){o=!1;break}return o},p.backSpace=function(){var o=this.rows[this.currRow];o.backSpace()},p.clearToEndOfRow=function(){var o=this.rows[this.currRow];o.clearToEndOfRow()},p.insertChar=function(o){var S=this.rows[this.currRow];S.insertChar(o)},p.setPen=function(o){var S=this.rows[this.currRow];S.setPenStyles(o)},p.moveCursor=function(o){var S=this.rows[this.currRow];S.moveCursor(o)},p.setCursor=function(o){this.logger.log(O.INFO,"setCursor: "+o);var S=this.rows[this.currRow];S.setCursor(o)},p.setPAC=function(o){this.logger.log(O.INFO,"pacData = "+JSON.stringify(o));var S=o.row-1;if(this.nrRollUpRows&&S<this.nrRollUpRows-1&&(S=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==S){for(var y=0;y<H;y++)this.rows[y].clear();var T=this.currRow+1-this.nrRollUpRows,N=this.lastOutputScreen;if(N){var z=N.rows[T].cueStartTime,Y=this.logger.time;if(z&&Y!==null&&z<Y)for(var ee=0;ee<this.nrRollUpRows;ee++)this.rows[S-this.nrRollUpRows+ee+1].copy(N.rows[T+ee])}}this.currRow=S;var G=this.rows[this.currRow];if(o.indent!==null){var W=o.indent,te=Math.max(W-1,0);G.setCursor(o.indent),o.color=G.chars[te].penState.foreground}var ue={foreground:o.color,underline:o.underline,italics:o.italics,background:"black",flash:!1};this.setPen(ue)},p.setBkgData=function(o){this.logger.log(O.INFO,"bkgData = "+JSON.stringify(o)),this.backSpace(),this.setPen(o),this.insertChar(32)},p.setRollUpRows=function(o){this.nrRollUpRows=o},p.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(O.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(O.TEXT,this.getDisplayText());var o=this.currRow+1-this.nrRollUpRows,S=this.rows.splice(o,1)[0];S.clear(),this.rows.splice(this.currRow,0,S),this.logger.log(O.INFO,"Rolling up")},p.getDisplayText=function(o){o=o||!1;for(var S=[],y="",T=-1,N=0;N<H;N++){var z=this.rows[N].getTextString();z&&(T=N+1,o?S.push("Row "+T+": '"+z+"'"):S.push(z.trim()))}return S.length>0&&(o?y="["+S.join(" | ")+"]":y=S.join(`
`)),y},p.getTextAndFormat=function(){return this.rows},h}(),E=function(){function h(c,o,S){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=c,this.outputFilter=o,this.mode=null,this.verbose=0,this.displayedMemory=new d(S),this.nonDisplayedMemory=new d(S),this.lastOutputScreen=new d(S),this.currRollUpRow=this.displayedMemory.rows[H-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=S}var p=h.prototype;return p.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[H-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},p.getHandler=function(){return this.outputFilter},p.setHandler=function(o){this.outputFilter=o},p.setPAC=function(o){this.writeScreen.setPAC(o)},p.setBkgData=function(o){this.writeScreen.setBkgData(o)},p.setMode=function(o){if(o===this.mode)return;this.mode=o,this.logger.log(O.INFO,"MODE="+o),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=o},p.insertChars=function(o){for(var S=0;S<o.length;S++)this.writeScreen.insertChar(o[S]);var y=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(O.INFO,y+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(O.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},p.ccRCL=function(){this.logger.log(O.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},p.ccBS=function(){if(this.logger.log(O.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},p.ccAOF=function(){},p.ccAON=function(){},p.ccDER=function(){this.logger.log(O.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},p.ccRU=function(o){this.logger.log(O.INFO,"RU("+o+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(o)},p.ccFON=function(){this.logger.log(O.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},p.ccRDC=function(){this.logger.log(O.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},p.ccTR=function(){this.logger.log(O.INFO,"TR"),this.setMode("MODE_TEXT")},p.ccRTD=function(){this.logger.log(O.INFO,"RTD"),this.setMode("MODE_TEXT")},p.ccEDM=function(){this.logger.log(O.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},p.ccCR=function(){this.logger.log(O.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},p.ccENM=function(){this.logger.log(O.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},p.ccEOC=function(){if(this.logger.log(O.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var o=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=o,this.writeScreen=this.nonDisplayedMemory,this.logger.log(O.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},p.ccTO=function(o){this.logger.log(O.INFO,"TO("+o+") - Tab Offset"),this.writeScreen.moveCursor(o)},p.ccMIDROW=function(o){var S={flash:!1};if(S.underline=o%2===1,S.italics=o>=46,S.italics)S.foreground="white";else{var y=Math.floor(o/2)-16,T=["white","green","blue","cyan","red","yellow","magenta"];S.foreground=T[y]}this.logger.log(O.INFO,"MIDROW: "+JSON.stringify(S)),this.writeScreen.setPen(S)},p.outputDataUpdate=function(o){o===void 0&&(o=!1);var S=this.logger.time;if(S===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=S:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,S,this.lastOutputScreen),o&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:S),this.lastOutputScreen.copy(this.displayedMemory))},p.cueSplitAtTime=function(o){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,o,this.displayedMemory),this.cueStartTime=o))},h}(),v=function(){function h(c,o,S){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var y=new L;this.channels=[null,new E(c,o,y),new E(c+1,S,y)],this.cmdHistory=b(),this.logger=y}var p=h.prototype;return p.getHandler=function(o){return this.channels[o].getHandler()},p.setHandler=function(o,S){this.channels[o].setHandler(S)},p.addData=function(o,S){var y,T,N,z=!1;this.logger.time=o;for(var Y=0;Y<S.length;Y+=2){if(T=S[Y]&127,N=S[Y+1]&127,T===0&&N===0)continue;if(this.logger.log(O.DATA,"["+g([S[Y],S[Y+1]])+"] -> ("+g([T,N])+")"),y=this.parseCmd(T,N),y||(y=this.parseMidrow(T,N)),y||(y=this.parsePAC(T,N)),y||(y=this.parseBackgroundAttributes(T,N)),!y&&(z=this.parseChars(T,N),z)){var ee=this.currentChannel;if(ee&&ee>0){var G=this.channels[ee];G.insertChars(z)}else this.logger.log(O.WARNING,"No channel found yet. TEXT-MODE?")}!y&&!z&&this.logger.log(O.WARNING,"Couldn't parse cleaned data "+g([T,N])+" orig: "+g([S[Y],S[Y+1]]))}},p.parseCmd=function(o,S){var y=this.cmdHistory,T=(o===20||o===28||o===21||o===29)&&S>=32&&S<=47,N=(o===23||o===31)&&S>=33&&S<=35;if(!(T||N))return!1;if(k(o,S,y))return m(null,null,y),this.logger.log(O.DEBUG,"Repeated command ("+g([o,S])+") is dropped"),!0;var z=o===20||o===21||o===23?1:2,Y=this.channels[z];return o===20||o===21||o===28||o===29?S===32?Y.ccRCL():S===33?Y.ccBS():S===34?Y.ccAOF():S===35?Y.ccAON():S===36?Y.ccDER():S===37?Y.ccRU(2):S===38?Y.ccRU(3):S===39?Y.ccRU(4):S===40?Y.ccFON():S===41?Y.ccRDC():S===42?Y.ccTR():S===43?Y.ccRTD():S===44?Y.ccEDM():S===45?Y.ccCR():S===46?Y.ccENM():S===47&&Y.ccEOC():Y.ccTO(S-32),m(o,S,y),this.currentChannel=z,!0},p.parseMidrow=function(o,S){var y=0;if((o===17||o===25)&&S>=32&&S<=47){if(o===17?y=1:y=2,y!==this.currentChannel)return this.logger.log(O.ERROR,"Mismatch channel in midrow parsing"),!1;var T=this.channels[y];return T?(T.ccMIDROW(S),this.logger.log(O.DEBUG,"MIDROW ("+g([o,S])+")"),!0):!1}return!1},p.parsePAC=function(o,S){var y,T=this.cmdHistory,N=(o>=17&&o<=23||o>=25&&o<=31)&&S>=64&&S<=127,z=(o===16||o===24)&&S>=64&&S<=95;if(!(N||z))return!1;if(k(o,S,T))return m(null,null,T),!0;var Y=o<=23?1:2;S>=64&&S<=95?y=Y===1?I[o]:x[o]:y=Y===1?_[o]:A[o];var ee=this.channels[Y];return ee?(ee.setPAC(this.interpretPAC(y,S)),m(o,S,T),this.currentChannel=Y,!0):!1},p.interpretPAC=function(o,S){var y,T={color:null,italics:!1,indent:null,underline:!1,row:o};return S>95?y=S-96:y=S-64,T.underline=(y&1)===1,y<=13?T.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(y/2)]:y<=15?(T.italics=!0,T.color="white"):T.indent=Math.floor((y-16)/2)*4,T},p.parseChars=function(o,S){var y,T=null,N=null;if(o>=25?(y=2,N=o-8):(y=1,N=o),N>=17&&N<=19){var z;N===17?z=S+80:N===18?z=S+112:z=S+144,this.logger.log(O.INFO,"Special char '"+P(z)+"' in channel "+y),T=[z]}else o>=32&&o<=127&&(T=S===0?[o]:[o,S]);if(T){var Y=g(T);this.logger.log(O.DEBUG,"Char codes = "+Y.join(",")),m(o,S,this.cmdHistory)}return T},p.parseBackgroundAttributes=function(o,S){var y=(o===16||o===24)&&S>=32&&S<=47,T=(o===23||o===31)&&S>=45&&S<=47;if(!(y||T))return!1;var N,z={};o===16||o===24?(N=Math.floor((S-32)/2),z.background=M[N],S%2===1&&(z.background=z.background+"_semi")):S===45?z.background="transparent":(z.foreground="black",S===47&&(z.underline=!0));var Y=o<=23?1:2,ee=this.channels[Y];return ee.setBkgData(z),m(o,S,this.cmdHistory),!0},p.reset=function(){for(var o=0;o<Object.keys(this.channels).length;o++){var S=this.channels[o];S&&S.reset()}this.cmdHistory=b()},p.cueSplitAtTime=function(o){for(var S=0;S<this.channels.length;S++){var y=this.channels[S];y&&y.cueSplitAtTime(o)}},h}();function m(h,p,c){c.a=h,c.b=p}function k(h,p,c){return c.a===h&&c.b===p}function b(){return{a:null,b:null}}X.default=v},"./src/utils/codecs.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"isCodecType",function(){return w}),D.d(X,"isCodecSupportedInMp4",function(){return P});var K={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function w(H,B){var I=K[B];return!!I&&I[H.slice(0,4)]===!0}function P(H,B){return MediaSource.isTypeSupported((B||"video")+'/mp4;codecs="'+H+'"')}},"./src/utils/cues.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/utils/vttparser.ts"),w=D("./src/utils/webvtt-parser.ts"),P=D("./src/utils/texttrack-utils.ts"),H=/\s/,B={newCue:function(_,x,A,M){for(var O=[],L,g,u,a,l,d=self.VTTCue||self.TextTrackCue,E=0;E<M.rows.length;E++)if(L=M.rows[E],u=!0,a=0,l="",!L.isEmpty()){for(var v=0;v<L.chars.length;v++)H.test(L.chars[v].uchar)&&u?a++:(l+=L.chars[v].uchar,u=!1);L.cueStartTime=x,x===A&&(A+=1e-4),a>=16?a--:a++;var m=Object(K.fixLineBreaks)(l.trim()),k=Object(w.generateCueId)(x,A,m);(!_||!_.cues||!_.cues.getCueById(k))&&(g=new d(x,A,m),g.id=k,g.line=E+1,g.align="left",g.position=10+Math.min(80,Math.floor(a*8/32)*10),O.push(g))}return _&&O.length&&(O.sort(function(b,h){return b.line==="auto"||h.line==="auto"?0:b.line>8&&h.line>8?h.line-b.line:b.line-h.line}),O.forEach(function(b){return Object(P.addCueToTrack)(_,b)})),O}};X.default=B},"./src/utils/discontinuities.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"findFirstFragWithCC",function(){return H}),D.d(X,"shouldAlignOnDiscontinuities",function(){return B}),D.d(X,"findDiscontinuousReferenceFrag",function(){return I}),D.d(X,"adjustSlidingStart",function(){return x}),D.d(X,"alignStream",function(){return A}),D.d(X,"alignPDT",function(){return O}),D.d(X,"alignFragmentByPDTDelta",function(){return L}),D.d(X,"alignMediaPlaylistByPDT",function(){return g});var K=D("./src/polyfills/number.ts"),w=D("./src/utils/logger.ts"),P=D("./src/controller/level-helper.ts");function H(u,a){for(var l=null,d=0,E=u.length;d<E;d++){var v=u[d];if(v&&v.cc===a){l=v;break}}return l}function B(u,a,l){return!!(a.details&&(l.endCC>l.startCC||u&&u.cc<l.startCC))}function I(u,a){var l=u.fragments,d=a.fragments;if(!d.length||!l.length){w.logger.log("No fragments to align");return}var E=H(l,d[0].cc);if(!E||E&&!E.startPTS){w.logger.log("No frag in previous level to align on");return}return E}function _(u,a){if(u){var l=u.start+a;u.start=u.startPTS=l,u.endPTS=l+u.duration}}function x(u,a){for(var l=a.fragments,d=0,E=l.length;d<E;d++)_(l[d],u);a.fragmentHint&&_(a.fragmentHint,u),a.alignedSliding=!0}function A(u,a,l){if(!a)return;M(u,l,a),!l.alignedSliding&&a.details&&O(l,a.details),!l.alignedSliding&&a.details&&!l.skippedSegments&&Object(P.adjustSliding)(a.details,l)}function M(u,a,l){if(B(u,l,a)){var d=I(l.details,a);d&&Object(K.isFiniteNumber)(d.start)&&(w.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),x(d.start,a))}}function O(u,a){if(!a.fragments.length||!u.hasProgramDateTime||!a.hasProgramDateTime)return;var l=a.fragments[0].programDateTime,d=u.fragments[0].programDateTime,E=(d-l)/1e3+a.fragments[0].start;E&&Object(K.isFiniteNumber)(E)&&(w.logger.log("Adjusting PTS using programDateTime delta "+(d-l)+"ms, sliding:"+E.toFixed(3)+" "+u.url+" "),x(E,u))}function L(u,a){var l=u.programDateTime;if(!l)return;var d=(l-a)/1e3;u.start=u.startPTS=d,u.endPTS=d+u.duration}function g(u,a){if(!a.fragments.length||!u.hasProgramDateTime||!a.hasProgramDateTime)return;var l=a.fragments[0].programDateTime,d=a.fragments[0].start,E=l-d*1e3;u.fragments.forEach(function(v){L(v,E)}),u.fragmentHint&&L(u.fragmentHint,E),u.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/utils/ewma.ts"),w=function(){function P(B,I,_){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=_,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new K.default(B),this.fast_=new K.default(I)}var H=P.prototype;return H.update=function(I,_){var x=this.slow_,A=this.fast_;this.slow_.halfLife!==I&&(this.slow_=new K.default(I,x.getEstimate(),x.getTotalWeight())),this.fast_.halfLife!==_&&(this.fast_=new K.default(_,A.getEstimate(),A.getTotalWeight()))},H.sample=function(I,_){I=Math.max(I,this.minDelayMs_);var x=8*_,A=I/1e3,M=x/A;this.fast_.sample(A,M),this.slow_.sample(A,M)},H.canEstimate=function(){var I=this.fast_;return I&&I.getTotalWeight()>=this.minWeight_},H.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},H.destroy=function(){},P}();X.default=w},"./src/utils/ewma.ts":function(ae,X,D){"use strict";D.r(X);var K=function(){function w(H,B,I){B===void 0&&(B=0),I===void 0&&(I=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=H,this.alpha_=H?Math.exp(Math.log(.5)/H):0,this.estimate_=B,this.totalWeight_=I}var P=w.prototype;return P.sample=function(B,I){var _=Math.pow(this.alpha_,B);this.estimate_=I*(1-_)+_*this.estimate_,this.totalWeight_+=B},P.getTotalWeight=function(){return this.totalWeight_},P.getEstimate=function(){if(this.alpha_){var B=1-Math.pow(this.alpha_,this.totalWeight_);if(B)return this.estimate_/B}return this.estimate_},w}();X.default=K},"./src/utils/fetch-loader.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"fetchSupported",function(){return L});var K=D("./src/polyfills/number.ts"),w=D("./src/loader/load-stats.ts"),P=D("./src/demux/chunk-cache.ts");function H(d,E){d.prototype=Object.create(E.prototype),d.prototype.constructor=d,A(d,E)}function B(d){var E=typeof Map=="function"?new Map:void 0;return B=function(m){if(m===null||!x(m))return m;if(typeof m!="function")throw new TypeError("Super expression must either be null or a function");if(typeof E!="undefined"){if(E.has(m))return E.get(m);E.set(m,k)}function k(){return I(m,arguments,M(this).constructor)}return k.prototype=Object.create(m.prototype,{constructor:{value:k,enumerable:!1,writable:!0,configurable:!0}}),A(k,m)},B(d)}function I(d,E,v){return _()?I=Reflect.construct:I=function(k,b,h){var p=[null];p.push.apply(p,b);var c=Function.bind.apply(k,p),o=new c;return h&&A(o,h.prototype),o},I.apply(null,arguments)}function _(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function x(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function A(d,E){return A=Object.setPrototypeOf||function(m,k){return m.__proto__=k,m},A(d,E)}function M(d){return M=Object.setPrototypeOf?Object.getPrototypeOf:function(v){return v.__proto__||Object.getPrototypeOf(v)},M(d)}function O(){return O=Object.assign||function(d){for(var E=1;E<arguments.length;E++){var v=arguments[E];for(var m in v)Object.prototype.hasOwnProperty.call(v,m)&&(d[m]=v[m])}return d},O.apply(this,arguments)}function L(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(d){}return!1}var g=function(){function d(v){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=v.fetchSetup||a,this.controller=new self.AbortController,this.stats=new w.LoadStats}var E=d.prototype;return E.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},E.abortInternal=function(){var m=this.response;(!m||!m.ok)&&(this.stats.aborted=!0,this.controller.abort())},E.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},E.load=function(m,k,b){var h=this,p=this.stats;if(p.loading.start)throw new Error("Loader can only be used once.");p.loading.start=self.performance.now();var c=u(m,this.controller.signal),o=b.onProgress,S=m.responseType==="arraybuffer",y=S?"byteLength":"length";this.context=m,this.config=k,this.callbacks=b,this.request=this.fetchSetup(m,c),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){h.abortInternal(),b.onTimeout(p,m,h.response)},k.timeout),self.fetch(this.request).then(function(T){if(h.response=h.loader=T,!T.ok){var N=T.status,z=T.statusText;throw new l(z||"fetch, bad network response",N,T)}return p.loading.first=Math.max(self.performance.now(),p.loading.start),p.total=parseInt(T.headers.get("Content-Length")||"0"),o&&Object(K.isFiniteNumber)(k.highWaterMark)?h.loadProgressively(T,p,m,k.highWaterMark,o):S?T.arrayBuffer():T.text()}).then(function(T){var N=h.response;self.clearTimeout(h.requestTimeout),p.loading.end=Math.max(self.performance.now(),p.loading.first),p.loaded=p.total=T[y];var z={url:N.url,data:T};o&&!Object(K.isFiniteNumber)(k.highWaterMark)&&o(p,m,T,N),b.onSuccess(z,p,m,N)}).catch(function(T){if(self.clearTimeout(h.requestTimeout),p.aborted)return;var N=T.code||0;b.onError({code:N,text:T.message},m,T.details)})},E.getCacheAge=function(){var m=null;if(this.response){var k=this.response.headers.get("age");m=k?parseFloat(k):null}return m},E.loadProgressively=function(m,k,b,h,p){h===void 0&&(h=0);var c=new P.default,o=m.body.getReader(),S=function y(){return o.read().then(function(T){if(T.done)return c.dataLength&&p(k,b,c.flush(),m),Promise.resolve(new ArrayBuffer(0));var N=T.value,z=N.length;return k.loaded+=z,z<h||c.dataLength?(c.push(N),c.dataLength>=h&&p(k,b,c.flush(),m)):p(k,b,N,m),y()}).catch(function(){return Promise.reject()})};return S()},d}();function u(d,E){var v={method:"GET",mode:"cors",credentials:"same-origin",signal:E,headers:new self.Headers(O({},d.headers))};return d.rangeEnd&&v.headers.set("Range","bytes="+d.rangeStart+"-"+String(d.rangeEnd-1)),v}function a(d,E){return new self.Request(d.url,E)}var l=function(d){H(E,d);function E(v,m,k){var b;return b=d.call(this,v)||this,b.code=void 0,b.details=void 0,b.code=m,b.details=k,b}return E}(B(Error));X.default=g},"./src/utils/imsc1-ttml-parser.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"IMSC1_CODEC",function(){return x}),D.d(X,"parseIMSC1",function(){return L});var K=D("./src/utils/mp4-tools.ts"),w=D("./src/utils/vttparser.ts"),P=D("./src/utils/vttcue.ts"),H=D("./src/demux/id3.ts"),B=D("./src/utils/timescale-conversion.ts"),I=D("./src/utils/webvtt-parser.ts");function _(){return _=Object.assign||function(h){for(var p=1;p<arguments.length;p++){var c=arguments[p];for(var o in c)Object.prototype.hasOwnProperty.call(c,o)&&(h[o]=c[o])}return h},_.apply(this,arguments)}var x="stpp.ttml.im1t",A=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,M=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,O={left:"start",center:"center",right:"end",start:"start",end:"end"};function L(h,p,c,o,S){var y=Object(K.findBox)(new Uint8Array(h),["mdat"]);if(y.length===0){S(new Error("Could not parse IMSC1 mdat"));return}var T=y[0],N=Object(H.utf8ArrayToStr)(new Uint8Array(h,T.start,T.end-T.start)),z=Object(B.toTimescaleFromScale)(p,1,c);try{o(g(N,z))}catch(Y){S(Y)}}function g(h,p){var c=new DOMParser,o=c.parseFromString(h,"text/xml"),S=o.getElementsByTagName("tt")[0];if(!S)throw new Error("Invalid ttml");var y={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},T=Object.keys(y).reduce(function(G,W){return G[W]=S.getAttribute("ttp:"+W)||y[W],G},{}),N=S.getAttribute("xml:space")!=="preserve",z=a(u(S,"styling","style")),Y=a(u(S,"layout","region")),ee=u(S,"body","[begin]");return[].map.call(ee,function(G){var W=l(G,N);if(!W||!G.hasAttribute("begin"))return null;var te=m(G.getAttribute("begin"),T),ue=m(G.getAttribute("dur"),T),be=m(G.getAttribute("end"),T);if(te===null)throw v(G);if(be===null){if(ue===null)throw v(G);be=te+ue}var Oe=new P.default(te-p,be-p,W);Oe.id=Object(I.generateCueId)(Oe.startTime,Oe.endTime,Oe.text);var Ke=Y[G.getAttribute("region")],_e=z[G.getAttribute("style")];Oe.position=10,Oe.size=80;var Ie=d(Ke,_e),Ue=Ie.textAlign;if(Ue){var Pe=O[Ue];Pe&&(Oe.lineAlign=Pe),Oe.align=Ue}return _(Oe,Ie),Oe}).filter(function(G){return G!==null})}function u(h,p,c){var o=h.getElementsByTagName(p)[0];return o?[].slice.call(o.querySelectorAll(c)):[]}function a(h){return h.reduce(function(p,c){var o=c.getAttribute("xml:id");return o&&(p[o]=c),p},{})}function l(h,p){return[].slice.call(h.childNodes).reduce(function(c,o,S){var y;return o.nodeName==="br"&&S?c+`
`:(y=o.childNodes)!==null&&y!==void 0&&y.length?l(o,p):p?c+o.textContent.trim().replace(/\s+/g," "):c+o.textContent},"")}function d(h,p){var c="http://www.w3.org/ns/ttml#styling",o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return o.reduce(function(S,y){var T=E(p,c,y)||E(h,c,y);return T&&(S[y]=T),S},{})}function E(h,p,c){return h.hasAttributeNS(p,c)?h.getAttributeNS(p,c):null}function v(h){return new Error("Could not parse ttml timestamp "+h)}function m(h,p){if(!h)return null;var c=Object(w.parseTimeStamp)(h);return c===null&&(A.test(h)?c=k(h,p):M.test(h)&&(c=b(h,p))),c}function k(h,p){var c=A.exec(h),o=(c[4]|0)+(c[5]|0)/p.subFrameRate;return(c[1]|0)*3600+(c[2]|0)*60+(c[3]|0)+o/p.frameRate}function b(h,p){var c=M.exec(h),o=Number(c[1]),S=c[2];switch(S){case"h":return o*3600;case"m":return o*60;case"ms":return o*1e3;case"f":return o/p.frameRate;case"t":return o/p.tickRate}return o}},"./src/utils/logger.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"enableLogs",function(){return I}),D.d(X,"logger",function(){return _});var K=function(){},w={trace:K,debug:K,log:K,warn:K,info:K,error:K},P=w;function H(x){var A=self.console[x];return A?A.bind(self.console,"["+x+"] >"):K}function B(x){for(var A=arguments.length,M=new Array(A>1?A-1:0),O=1;O<A;O++)M[O-1]=arguments[O];M.forEach(function(L){P[L]=x[L]?x[L].bind(x):H(L)})}function I(x){if(self.console&&x===!0||typeof x=="object"){B(x,"debug","log","info","warn","error");try{P.log()}catch(A){P=w}}else P=w}var _=P},"./src/utils/mediakeys-helper.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"KeySystems",function(){return K}),D.d(X,"requestMediaKeySystemAccess",function(){return w});var K;(function(P){P.WIDEVINE="com.widevine.alpha",P.PLAYREADY="com.microsoft.playready"})(K||(K={}));var w=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"getMediaSource",function(){return K});function K(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"bin2str",function(){return B}),D.d(X,"readUint16",function(){return I}),D.d(X,"readUint32",function(){return _}),D.d(X,"writeUint32",function(){return x}),D.d(X,"findBox",function(){return A}),D.d(X,"parseSegmentIndex",function(){return M}),D.d(X,"parseInitSegment",function(){return O}),D.d(X,"getStartDTS",function(){return L}),D.d(X,"getDuration",function(){return g}),D.d(X,"computeRawDurationFromSamples",function(){return u}),D.d(X,"offsetStartDTS",function(){return a}),D.d(X,"segmentValidRange",function(){return l}),D.d(X,"appendUint8Array",function(){return d});var K=D("./src/utils/typed-array.ts"),w=D("./src/loader/fragment.ts"),P=Math.pow(2,32)-1,H=[].push;function B(E){return String.fromCharCode.apply(null,E)}function I(E,v){"data"in E&&(v+=E.start,E=E.data);var m=E[v]<<8|E[v+1];return m<0?65536+m:m}function _(E,v){"data"in E&&(v+=E.start,E=E.data);var m=E[v]<<24|E[v+1]<<16|E[v+2]<<8|E[v+3];return m<0?4294967296+m:m}function x(E,v,m){"data"in E&&(v+=E.start,E=E.data),E[v]=m>>24,E[v+1]=m>>16&255,E[v+2]=m>>8&255,E[v+3]=m&255}function A(E,v){var m=[];if(!v.length)return m;var k,b,h;"data"in E?(k=E.data,b=E.start,h=E.end):(k=E,b=0,h=k.byteLength);for(var p=b;p<h;){var c=_(k,p),o=B(k.subarray(p+4,p+8)),S=c>1?p+c:h;if(o===v[0])if(v.length===1)m.push({data:k,start:p+8,end:S});else{var y=A({data:k,start:p+8,end:S},v.slice(1));y.length&&H.apply(m,y)}p=S}return m}function M(E){var v=A(E,["moov"]),m=v[0],k=m?m.end:null,b=A(E,["sidx"]);if(!b||!b[0])return null;var h=[],p=b[0],c=p.data[0],o=c===0?8:16,S=_(p,o);o+=4;var y=0,T=0;c===0?o+=8:o+=16,o+=2;var N=p.end+T,z=I(p,o);o+=2;for(var Y=0;Y<z;Y++){var ee=o,G=_(p,ee);ee+=4;var W=G&2147483647,te=(G&2147483648)>>>31;if(te===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ue=_(p,ee);ee+=4,h.push({referenceSize:W,subsegmentDuration:ue,info:{duration:ue/S,start:N,end:N+W-1}}),N+=W,ee+=4,o=ee}return{earliestPresentationTime:y,timescale:S,version:c,referencesCount:z,references:h,moovEndOffset:k}}function O(E){for(var v=[],m=A(E,["moov","trak"]),k=0;k<m.length;k++){var b=m[k],h=A(b,["tkhd"])[0];if(h){var p=h.data[h.start],c=p===0?12:20,o=_(h,c),S=A(b,["mdia","mdhd"])[0];if(S){p=S.data[S.start],c=p===0?12:20;var y=_(S,c),T=A(b,["mdia","hdlr"])[0];if(T){var N=B(T.data.subarray(T.start+8,T.start+12)),z={soun:w.ElementaryStreamTypes.AUDIO,vide:w.ElementaryStreamTypes.VIDEO}[N];if(z){var Y=A(b,["mdia","minf","stbl","stsd"])[0],ee=void 0;Y&&(ee=B(Y.data.subarray(Y.start+12,Y.start+16))),v[o]={timescale:y,type:z},v[z]={timescale:y,id:o,codec:ee}}}}}}var G=A(E,["moov","mvex","trex"]);return G.forEach(function(W){var te=_(W,4),ue=v[te];ue&&(ue.default={duration:_(W,12),flags:_(W,20)})}),v}function L(E,v){return A(v,["moof","traf"]).reduce(function(m,k){var b=A(k,["tfdt"])[0],h=b.data[b.start],p=A(k,["tfhd"]).reduce(function(c,o){var S=_(o,4),y=E[S];if(y){var T=_(b,4);h===1&&(T*=Math.pow(2,32),T+=_(b,8));var N=y.timescale||9e4,z=T/N;if(isFinite(z)&&(c===null||z<c))return z}return c},null);return p!==null&&isFinite(p)&&(m===null||p<m)?p:m},null)||0}function g(E,v){for(var m=0,k=0,b=0,h=A(E,["moof","traf"]),p=0;p<h.length;p++){var c=h[p],o=A(c,["tfhd"])[0],S=_(o,4),y=v[S];if(!y)continue;var T=y.default,N=_(o,0)|(T==null?void 0:T.flags),z=T==null?void 0:T.duration;N&8&&(N&2?z=_(o,12):z=_(o,8));for(var Y=y.timescale||9e4,ee=A(c,["trun"]),G=0;G<ee.length;G++){if(z){var W=_(ee[G],4);m=z*W}else m=u(ee[G]);y.type===w.ElementaryStreamTypes.VIDEO?k+=m/Y:y.type===w.ElementaryStreamTypes.AUDIO&&(b+=m/Y)}}if(k===0&&b===0){var te=M(E);if(te!=null&&te.references)return te.references.reduce(function(ue,be){return ue+be.info.duration||0},0)}return k||b}function u(E){var v=_(E,0),m=8;v&1&&(m+=4),v&4&&(m+=4);for(var k=0,b=_(E,4),h=0;h<b;h++){if(v&256){var p=_(E,m);k+=p,m+=4}v&512&&(m+=4),v&1024&&(m+=4),v&2048&&(m+=4)}return k}function a(E,v,m){A(v,["moof","traf"]).forEach(function(k){A(k,["tfhd"]).forEach(function(b){var h=_(b,4),p=E[h];if(!p)return;var c=p.timescale||9e4;A(k,["tfdt"]).forEach(function(o){var S=o.data[o.start],y=_(o,4);if(S===0)x(o,4,y-m*c);else{y*=Math.pow(2,32),y+=_(o,8),y-=m*c,y=Math.max(y,0);var T=Math.floor(y/(P+1)),N=Math.floor(y%(P+1));x(o,4,T),x(o,8,N)}})})})}function l(E){var v={valid:null,remainder:null},m=A(E,["moof"]);if(m){if(m.length<2)return v.remainder=E,v}else return v;var k=m[m.length-1];return v.valid=Object(K.sliceUint8)(E,0,k.start-8),v.remainder=Object(K.sliceUint8)(E,k.start-8),v}function d(E,v){var m=new Uint8Array(E.length+v.length);return m.set(E),m.set(v,E.length),m}},"./src/utils/output-filter.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"default",function(){return K});var K=function(){function w(H,B){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=H,this.trackName=B}var P=w.prototype;return P.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},P.newCue=function(B,I,_){(this.startTime===null||this.startTime>B)&&(this.startTime=B),this.endTime=I,this.screen=_,this.timelineController.createCaptionsTrack(this.trackName)},P.reset=function(){this.cueRanges=[]},w}()},"./src/utils/texttrack-utils.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"sendAddTrackEvent",function(){return w}),D.d(X,"addCueToTrack",function(){return P}),D.d(X,"clearCurrentCues",function(){return H}),D.d(X,"removeCuesInRange",function(){return B}),D.d(X,"getCuesInRange",function(){return _});var K=D("./src/utils/logger.ts");function w(x,A){var M;try{M=new Event("addtrack")}catch(O){M=document.createEvent("Event"),M.initEvent("addtrack",!1,!1)}M.track=x,A.dispatchEvent(M)}function P(x,A){var M=x.mode;if(M==="disabled"&&(x.mode="hidden"),x.cues&&!x.cues.getCueById(A.id))try{if(x.addCue(A),!x.cues.getCueById(A.id))throw new Error("addCue is failed for: "+A)}catch(L){K.logger.debug("[texttrack-utils]: "+L);var O=new self.TextTrackCue(A.startTime,A.endTime,A.text);O.id=A.id,x.addCue(O)}M==="disabled"&&(x.mode=M)}function H(x){var A=x.mode;if(A==="disabled"&&(x.mode="hidden"),x.cues)for(var M=x.cues.length;M--;)x.removeCue(x.cues[M]);A==="disabled"&&(x.mode=A)}function B(x,A,M){var O=x.mode;if(O==="disabled"&&(x.mode="hidden"),x.cues&&x.cues.length>0)for(var L=_(x.cues,A,M),g=0;g<L.length;g++)x.removeCue(L[g]);O==="disabled"&&(x.mode=O)}function I(x,A){if(A<x[0].startTime)return 0;var M=x.length-1;if(A>x[M].endTime)return-1;for(var O=0,L=M;O<=L;){var g=Math.floor((L+O)/2);if(A<x[g].startTime)L=g-1;else if(A>x[g].startTime&&O<M)O=g+1;else return g}return x[O].startTime-A<A-x[L].startTime?O:L}function _(x,A,M){var O=[],L=I(x,A);if(L>-1)for(var g=L,u=x.length;g<u;g++){var a=x[g];if(a.startTime>=A&&a.endTime<=M)O.push(a);else if(a.startTime>M)return O}return O}},"./src/utils/time-ranges.ts":function(ae,X,D){"use strict";D.r(X);var K={toString:function(P){for(var H="",B=P.length,I=0;I<B;I++)H+="["+P.start(I).toFixed(3)+","+P.end(I).toFixed(3)+"]";return H}};X.default=K},"./src/utils/timescale-conversion.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"toTimescaleFromBase",function(){return w}),D.d(X,"toTimescaleFromScale",function(){return P}),D.d(X,"toMsFromMpegTsClock",function(){return H}),D.d(X,"toMpegTsClockFromTimescale",function(){return B});var K=9e4;function w(I,_,x,A){x===void 0&&(x=1),A===void 0&&(A=!1);var M=I*_*x;return A?Math.round(M):M}function P(I,_,x,A){return x===void 0&&(x=1),A===void 0&&(A=!1),w(I,_,1/x,A)}function H(I,_){return _===void 0&&(_=!1),w(I,1e3,1/K,_)}function B(I,_){return _===void 0&&(_=1),w(I,K,1/_)}},"./src/utils/typed-array.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"sliceUint8",function(){return K});function K(w,P,H){return Uint8Array.prototype.slice?w.slice(P,H):new Uint8Array(Array.prototype.slice.call(w,P,H))}},"./src/utils/vttcue.ts":function(ae,X,D){"use strict";D.r(X),X.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var K=["","lr","rl"],w=["start","middle","end","left","right"];function P(x,A){if(typeof A!="string")return!1;if(!Array.isArray(x))return!1;var M=A.toLowerCase();return~x.indexOf(M)?M:!1}function H(x){return P(K,x)}function B(x){return P(w,x)}function I(x){for(var A=arguments.length,M=new Array(A>1?A-1:0),O=1;O<A;O++)M[O-1]=arguments[O];for(var L=1;L<arguments.length;L++){var g=arguments[L];for(var u in g)x[u]=g[u]}return x}function _(x,A,M){var O=this,L={enumerable:!0};O.hasBeenReset=!1;var g="",u=!1,a=x,l=A,d=M,E=null,v="",m=!0,k="auto",b="start",h=50,p="middle",c=50,o="middle";Object.defineProperty(O,"id",I({},L,{get:function(){return g},set:function(y){g=""+y}})),Object.defineProperty(O,"pauseOnExit",I({},L,{get:function(){return u},set:function(y){u=!!y}})),Object.defineProperty(O,"startTime",I({},L,{get:function(){return a},set:function(y){if(typeof y!="number")throw new TypeError("Start time must be set to a number.");a=y,this.hasBeenReset=!0}})),Object.defineProperty(O,"endTime",I({},L,{get:function(){return l},set:function(y){if(typeof y!="number")throw new TypeError("End time must be set to a number.");l=y,this.hasBeenReset=!0}})),Object.defineProperty(O,"text",I({},L,{get:function(){return d},set:function(y){d=""+y,this.hasBeenReset=!0}})),Object.defineProperty(O,"region",I({},L,{get:function(){return E},set:function(y){E=y,this.hasBeenReset=!0}})),Object.defineProperty(O,"vertical",I({},L,{get:function(){return v},set:function(y){var T=H(y);if(T===!1)throw new SyntaxError("An invalid or illegal string was specified.");v=T,this.hasBeenReset=!0}})),Object.defineProperty(O,"snapToLines",I({},L,{get:function(){return m},set:function(y){m=!!y,this.hasBeenReset=!0}})),Object.defineProperty(O,"line",I({},L,{get:function(){return k},set:function(y){if(typeof y!="number"&&y!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");k=y,this.hasBeenReset=!0}})),Object.defineProperty(O,"lineAlign",I({},L,{get:function(){return b},set:function(y){var T=B(y);if(!T)throw new SyntaxError("An invalid or illegal string was specified.");b=T,this.hasBeenReset=!0}})),Object.defineProperty(O,"position",I({},L,{get:function(){return h},set:function(y){if(y<0||y>100)throw new Error("Position must be between 0 and 100.");h=y,this.hasBeenReset=!0}})),Object.defineProperty(O,"positionAlign",I({},L,{get:function(){return p},set:function(y){var T=B(y);if(!T)throw new SyntaxError("An invalid or illegal string was specified.");p=T,this.hasBeenReset=!0}})),Object.defineProperty(O,"size",I({},L,{get:function(){return c},set:function(y){if(y<0||y>100)throw new Error("Size must be between 0 and 100.");c=y,this.hasBeenReset=!0}})),Object.defineProperty(O,"align",I({},L,{get:function(){return o},set:function(y){var T=B(y);if(!T)throw new SyntaxError("An invalid or illegal string was specified.");o=T,this.hasBeenReset=!0}})),O.displayState=void 0}return _.prototype.getCueAsHTML=function(){var x=self.WebVTT;return x.convertCueToDOMTree(self,this.text)},_}()},"./src/utils/vttparser.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"parseTimeStamp",function(){return P}),D.d(X,"fixLineBreaks",function(){return A}),D.d(X,"VTTParser",function(){return M});var K=D("./src/utils/vttcue.ts"),w=function(){function O(){}var L=O.prototype;return L.decode=function(u,a){if(!u)return"";if(typeof u!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(u))},O}();function P(O){function L(u,a,l,d){return(u|0)*3600+(a|0)*60+(l|0)+parseFloat(d||0)}var g=O.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return g?parseFloat(g[2])>59?L(g[2],g[3],0,g[4]):L(g[1],g[2],g[3],g[4]):null}var H=function(){function O(){this.values=Object.create(null)}var L=O.prototype;return L.set=function(u,a){!this.get(u)&&a!==""&&(this.values[u]=a)},L.get=function(u,a,l){return l?this.has(u)?this.values[u]:a[l]:this.has(u)?this.values[u]:a},L.has=function(u){return u in this.values},L.alt=function(u,a,l){for(var d=0;d<l.length;++d)if(a===l[d]){this.set(u,a);break}},L.integer=function(u,a){/^-?\d+$/.test(a)&&this.set(u,parseInt(a,10))},L.percent=function(u,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var l=parseFloat(a);if(l>=0&&l<=100)return this.set(u,l),!0}return!1},O}();function B(O,L,g,u){var a=u?O.split(u):[O];for(var l in a){if(typeof a[l]!="string")continue;var d=a[l].split(g);if(d.length!==2)continue;var E=d[0],v=d[1];L(E,v)}}var I=new K.default(0,0,""),_=I.align==="middle"?"middle":"center";function x(O,L,g){var u=O;function a(){var E=P(O);if(E===null)throw new Error("Malformed timestamp: "+u);return O=O.replace(/^[^\sa-zA-Z-]+/,""),E}function l(E,v){var m=new H;B(E,function(h,p){var c;switch(h){case"region":for(var o=g.length-1;o>=0;o--)if(g[o].id===p){m.set(h,g[o].region);break}break;case"vertical":m.alt(h,p,["rl","lr"]);break;case"line":c=p.split(","),m.integer(h,c[0]),m.percent(h,c[0])&&m.set("snapToLines",!1),m.alt(h,c[0],["auto"]),c.length===2&&m.alt("lineAlign",c[1],["start",_,"end"]);break;case"position":c=p.split(","),m.percent(h,c[0]),c.length===2&&m.alt("positionAlign",c[1],["start",_,"end","line-left","line-right","auto"]);break;case"size":m.percent(h,p);break;case"align":m.alt(h,p,["start",_,"end","left","right"]);break}},/:/,/\s/),v.region=m.get("region",null),v.vertical=m.get("vertical","");var k=m.get("line","auto");k==="auto"&&I.line===-1&&(k=-1),v.line=k,v.lineAlign=m.get("lineAlign","start"),v.snapToLines=m.get("snapToLines",!0),v.size=m.get("size",100),v.align=m.get("align",_);var b=m.get("position","auto");b==="auto"&&I.position===50&&(b=v.align==="start"||v.align==="left"?0:v.align==="end"||v.align==="right"?100:50),v.position=b}function d(){O=O.replace(/^\s+/,"")}if(d(),L.startTime=a(),d(),O.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+u);O=O.substr(3),d(),L.endTime=a(),d(),l(O,L)}function A(O){return O.replace(/<br(?: \/)?>/gi,`
`)}var M=function(){function O(){this.state="INITIAL",this.buffer="",this.decoder=new w,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var L=O.prototype;return L.parse=function(u){var a=this;u&&(a.buffer+=a.decoder.decode(u,{stream:!0}));function l(){var b=a.buffer,h=0;for(b=A(b);h<b.length&&b[h]!=="\r"&&b[h]!==`
`;)++h;var p=b.substr(0,h);return b[h]==="\r"&&++h,b[h]===`
`&&++h,a.buffer=b.substr(h),p}function d(b){B(b,function(h,p){},/:/)}try{var E="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;E=l();var v=E.match(/^()?WEBVTT([ \t].*)?$/);if(!v||!v[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var m=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;m?m=!1:E=l();switch(a.state){case"HEADER":/:/.test(E)?d(E):E||(a.state="ID");continue;case"NOTE":E||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(E)){a.state="NOTE";break}if(!E)continue;if(a.cue=new K.default(0,0,""),a.state="CUE",E.indexOf("-->")===-1){a.cue.id=E;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{x(E,a.cue,a.regionList)}catch(b){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var k=E.indexOf("-->")!==-1;if(!E||k&&(m=!0)){a.oncue&&a.cue&&a.oncue(a.cue),a.cue=null,a.state="ID";continue}if(a.cue===null)continue;a.cue.text&&(a.cue.text+=`
`),a.cue.text+=E}continue;case"BADCUE":E||(a.state="ID")}}}catch(b){a.state==="CUETEXT"&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state=a.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},L.flush=function(){var u=this;try{if((u.cue||u.state==="HEADER")&&(u.buffer+=`
`,u.parse()),u.state==="INITIAL"||u.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(a){u.onparsingerror&&u.onparsingerror(a)}return u.onflush&&u.onflush(),this},O}()},"./src/utils/webvtt-parser.ts":function(ae,X,D){"use strict";D.r(X),D.d(X,"generateCueId",function(){return M}),D.d(X,"parseWebVTT",function(){return L});var K=D("./src/polyfills/number.ts"),w=D("./src/utils/vttparser.ts"),P=D("./src/demux/id3.ts"),H=D("./src/utils/timescale-conversion.ts"),B=D("./src/remux/mp4-remuxer.ts"),I=/\r\n|\n\r|\n|\r/g,_=function(u,a,l){return l===void 0&&(l=0),u.substr(l,a.length)===a},x=function(u){var a=parseInt(u.substr(-3)),l=parseInt(u.substr(-6,2)),d=parseInt(u.substr(-9,2)),E=u.length>9?parseInt(u.substr(0,u.indexOf(":"))):0;if(!Object(K.isFiniteNumber)(a)||!Object(K.isFiniteNumber)(l)||!Object(K.isFiniteNumber)(d)||!Object(K.isFiniteNumber)(E))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+u);return a+=1e3*l,a+=60*1e3*d,a+=60*60*1e3*E,a},A=function(u){for(var a=5381,l=u.length;l;)a=a*33^u.charCodeAt(--l);return(a>>>0).toString()};function M(g,u,a){return A(g.toString())+A(u.toString())+A(a)}var O=function(u,a,l){var d=u[a],E=u[d.prevCC];if(!E||!E.new&&d.new){u.ccOffset=u.presentationOffset=d.start,d.new=!1;return}for(;(v=E)!==null&&v!==void 0&&v.new;){var v;u.ccOffset+=d.start-E.start,d.new=!1,d=E,E=u[d.prevCC]}u.presentationOffset=l};function L(g,u,a,l,d,E,v,m){var k=new w.VTTParser,b=Object(P.utf8ArrayToStr)(new Uint8Array(g)).trim().replace(I,`
`).split(`
`),h=[],p=Object(H.toMpegTsClockFromTimescale)(u,a),c="00:00.000",o=0,S=0,y,T=!0,N=!1;k.oncue=function(z){var Y=l[d],ee=l.ccOffset,G=(o-p)/9e4;if(Y!=null&&Y.new&&(S!==void 0?ee=l.ccOffset=Y.start:O(l,d,G)),G&&(ee=G-l.presentationOffset),N){var W=z.endTime-z.startTime,te=Object(B.normalizePts)((z.startTime+ee-S)*9e4,E*9e4)/9e4;z.startTime=te,z.endTime=te+W}var ue=z.text.trim();z.text=decodeURIComponent(encodeURIComponent(ue)),z.id||(z.id=M(z.startTime,z.endTime,ue)),z.endTime>0&&h.push(z)},k.onparsingerror=function(z){y=z},k.onflush=function(){if(y){m(y);return}v(h)},b.forEach(function(z){if(T)if(_(z,"X-TIMESTAMP-MAP=")){T=!1,N=!0,z.substr(16).split(",").forEach(function(Y){_(Y,"LOCAL:")?c=Y.substr(6):_(Y,"MPEGTS:")&&(o=parseInt(Y.substr(7)))});try{S=x(c)/1e3}catch(Y){N=!1,y=Y}return}else z===""&&(T=!1);k.parse(z+`
`)}),k.flush()}},"./src/utils/xhr-loader.ts":function(ae,X,D){"use strict";D.r(X);var K=D("./src/utils/logger.ts"),w=D("./src/loader/load-stats.ts"),P=/^age:\s*[\d.]+\s*$/m,H=function(){function B(_){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=_?_.xhrSetup:null,this.stats=new w.LoadStats,this.retryDelay=0}var I=B.prototype;return I.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},I.abortInternal=function(){var x=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),x&&(x.onreadystatechange=null,x.onprogress=null,x.readyState!==4&&(this.stats.aborted=!0,x.abort()))},I.abort=function(){var x;this.abortInternal(),(x=this.callbacks)!==null&&x!==void 0&&x.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},I.load=function(x,A,M){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=x,this.config=A,this.callbacks=M,this.retryDelay=A.retryDelay,this.loadInternal()},I.loadInternal=function(){var x=this.config,A=this.context;if(!x)return;var M=this.loader=new self.XMLHttpRequest,O=this.stats;O.loading.first=0,O.loaded=0;var L=this.xhrSetup;try{if(L)try{L(M,A.url)}catch(a){M.open("GET",A.url,!0),L(M,A.url)}M.readyState||M.open("GET",A.url,!0);var g=this.context.headers;if(g)for(var u in g)M.setRequestHeader(u,g[u])}catch(a){this.callbacks.onError({code:M.status,text:a.message},A,M);return}A.rangeEnd&&M.setRequestHeader("Range","bytes="+A.rangeStart+"-"+(A.rangeEnd-1)),M.onreadystatechange=this.readystatechange.bind(this),M.onprogress=this.loadprogress.bind(this),M.responseType=A.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),x.timeout),M.send()},I.readystatechange=function(){var x=this.context,A=this.loader,M=this.stats;if(!x||!A)return;var O=A.readyState,L=this.config;if(M.aborted)return;if(O>=2)if(self.clearTimeout(this.requestTimeout),M.loading.first===0&&(M.loading.first=Math.max(self.performance.now(),M.loading.start)),O===4){A.onreadystatechange=null,A.onprogress=null;var g=A.status;if(g>=200&&g<300){M.loading.end=Math.max(self.performance.now(),M.loading.first);var u,a;if(x.responseType==="arraybuffer"?(u=A.response,a=u.byteLength):(u=A.responseText,a=u.length),M.loaded=M.total=a,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(M,x,u,A),!this.callbacks)return;var d={url:A.responseURL,data:u};this.callbacks.onSuccess(d,M,x,A)}else M.retry>=L.maxRetry||g>=400&&g<499?(K.logger.error(g+" while loading "+x.url),this.callbacks.onError({code:g,text:A.statusText},x,A)):(K.logger.warn(g+" while loading "+x.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,L.maxRetryDelay),M.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),L.timeout)},I.loadtimeout=function(){K.logger.warn("timeout while loading "+this.context.url);var x=this.callbacks;x&&(this.abortInternal(),x.onTimeout(this.stats,this.context,this.loader))},I.loadprogress=function(x){var A=this.stats;A.loaded=x.loaded,x.lengthComputable&&(A.total=x.total)},I.getCacheAge=function(){var x=null;if(this.loader&&P.test(this.loader.getAllResponseHeaders())){var A=this.loader.getResponseHeader("age");x=A?parseFloat(A):null}return x},B}();X.default=H}}).default})},vHTk:function(Ft,gt,ie){Ft.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);