You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
373 lines
1.1 MiB
373 lines
1.1 MiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[187,5,6,7,8,16],{"+NIl":function(gt,ze,Y){(function(ce){ce(Y("VrN/"))})(function(ce){"use strict";ce.defineMode("stex",function(X,R){"use strict";function Z(w,y){w.cmdState.push(y)}function U(w){return w.cmdState.length>0?w.cmdState[w.cmdState.length-1]:null}function O(w){var y=w.cmdState.pop();y&&y.closeBracket()}function j(w){for(var y=w.cmdState,b=y.length-1;b>=0;b--){var c=y[b];if(c.name=="DEFAULT")continue;return c}return{styleIdentifier:function(){return null}}}function B(w,y,b){return function(){this.name=w,this.bracketNo=0,this.style=y,this.styles=b,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var k={};k.importmodule=B("importmodule","tag",["string","builtin"]),k.documentclass=B("documentclass","tag",["","atom"]),k.usepackage=B("usepackage","tag",["atom"]),k.begin=B("begin","tag",["atom"]),k.end=B("end","tag",["atom"]),k.label=B("label","tag",["atom"]),k.ref=B("ref","tag",["atom"]),k.eqref=B("eqref","tag",["atom"]),k.cite=B("cite","tag",["atom"]),k.bibitem=B("bibitem","tag",["atom"]),k.Bibitem=B("Bibitem","tag",["atom"]),k.RBibitem=B("RBibitem","tag",["atom"]),k.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function D(w,y){w.f=y}function E(w,y){var b;if(w.match(/^\\[a-zA-Z@]+/)){var c=w.current().slice(1);return b=k.hasOwnProperty(c)?k[c]:k.DEFAULT,b=new b,Z(y,b),D(y,P),b.style}if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/\\]/))return"tag";if(w.match("\\["))return D(y,function(u,f){return A(u,f,"\\]")}),"keyword";if(w.match("\\("))return D(y,function(u,f){return A(u,f,"\\)")}),"keyword";if(w.match("$$"))return D(y,function(u,f){return A(u,f,"$$")}),"keyword";if(w.match("$"))return D(y,function(u,f){return A(u,f,"$")}),"keyword";var s=w.next();if(s=="%")return w.skipToEnd(),"comment";if(s=="}"||s=="]"){if(b=U(y),b)b.closeBracket(s),D(y,P);else return"error";return"bracket"}else return s=="{"||s=="["?(b=k.DEFAULT,b=new b,Z(y,b),"bracket"):/\d/.test(s)?(w.eatWhile(/[\w.%]/),"atom"):(w.eatWhile(/[\w\-_]/),b=j(y),b.name=="begin"&&(b.argument=w.current()),b.styleIdentifier())}function A(w,y,b){if(w.eatSpace())return null;if(b&&w.match(b))return D(y,E),"keyword";if(w.match(/^\\[a-zA-Z@]+/))return"tag";if(w.match(/^[a-zA-Z]+/))return"variable-2";if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/]/))return"tag";if(w.match(/^[\^_&]/))return"tag";if(w.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(w.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var c=w.next();return c=="{"||c=="}"||c=="["||c=="]"||c=="("||c==")"?"bracket":c=="%"?(w.skipToEnd(),"comment"):"error"}function P(w,y){var b=w.peek(),c;return b=="{"||b=="["?(c=U(y),c.openBracket(b),w.eat(b),D(y,E),"bracket"):/[ \t\r]/.test(b)?(w.eat(b),null):(D(y,E),O(y),E(w,y))}return{startState:function(){var w=R.inMathMode?function(y,b){return A(y,b)}:E;return{cmdState:[],f:w}},copyState:function(w){return{cmdState:w.cmdState.slice(),f:w.f}},token:function(w,y){return y.f(w,y)},blankLine:function(w){w.f=E,w.cmdState.length=0},lineComment:"%"}}),ce.defineMIME("text/x-stex","stex"),ce.defineMIME("text/x-latex","stex")})},"0dNJ":function(gt,ze,Y){"use strict";Y.r(ze);var ce=Y("g9YV"),X=Y("wCAj"),R=Y("+L6B"),Z=Y("2/Rp"),U=Y("BoS7"),O=Y("Sdc0"),j=Y("6UJt"),B=Y("DFOY"),k=Y("7Kak"),D=Y("9yH6"),E=Y("sPJy"),A=Y("bE4q"),P=Y("2qtc"),w=Y("kLXV"),y=Y("9og8"),b=Y("oBTY"),c=Y("k1fw"),s=Y("miYZ"),u=Y("tsqr"),f=Y("y8nQ"),C=Y("Vl3Y"),v=Y("tJVT"),m=Y("PpiC"),_=Y("OaEy"),x=Y("2fM7"),d=Y("DZo9"),h=Y("8z0m"),o=Y("WmNS"),i=Y.n(o),g=Y("q1tI"),l=Y.n(g),T=Y("9kvl"),I=Y("m3rI"),F=Y("yFVG"),W=Y.n(F),V=Y("5Dmo"),M=Y("3S7+"),N=Y("Ot1p"),J=Y("9Bee"),ae=Y("EgHG"),ue=Y.n(ae),ve=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Te=function(pe,be){var te=pe.problemset,de=pe.globalSetting,he=pe.loading,ye=pe.dispatch,De=pe.onRef,we=De===void 0?function(){}:De,We=pe.isEdit,Qe=Object(m.a)(pe,["problemset","globalSetting","loading","dispatch","onRef","isEdit"]),nt=Object(g.useState)([]),Ve=Object(v.a)(nt,2),dt=Ve[0],ct=Ve[1],at=Object(g.useState)(),Dt=Object(v.a)(at,2),wt=Dt[0],xt=Dt[1],kt=Object(g.useState)(),Et=Object(v.a)(kt,2),Mt=Et[0],Rt=Et[1],Xe=Object(g.useState)(""),bt=Object(v.a)(Xe,2),ot=bt[0],lt=bt[1],st=Object(g.useState)(""),zt=Object(v.a)(st,2),Wt=zt[0],St=zt[1];Object(g.useEffect)(function(){ct(["","","",""])},[]),Object(g.useEffect)(function(){var $t,Tt,Ot,Gt;if(!te.editData||!We)return;lt(($t=te.editData)===null||$t===void 0?void 0:$t.name),St((Tt=te.editData)===null||Tt===void 0?void 0:Tt.analysis),ct((Ot=te.editData)===null||Ot===void 0?void 0:Ot.choices.map(function(ir){return ir.choice_text})),Rt((Gt=te.editData)===null||Gt===void 0?void 0:Gt.choices.findIndex(function(ir){return ir.is_answer}))},[te.editData]),Object(g.useImperativeHandle)(be,function(){return{onSave:ut,Clear:or}});var ut=function(){if(!ot)return u.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;var Tt=dt.findIndex(function(Gt){return!Gt});if(Tt>-1)return u.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(ve[Tt]," \u9009\u9879\u7684\u5185\u5BB9")),!1;if(console.log("activeAnswer: ",Mt),!(typeof Mt=="number"))return u.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),!1;var Ot=dt.map(function(Gt,ir){return{choice_text:Gt,is_answer:Mt===ir?1:0}});return{name:ot,choices:Ot,analysis:Wt}},or=function(){ct(["","","",""]),lt(""),St(""),Rt("")};return l.a.createElement("section",{className:ue.a.wrap},l.a.createElement("p",{className:ue.a.titleWrap},l.a.createElement("span",{className:ue.a.required},"*"),l.a.createElement("span",{className:ue.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(N.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:ot,onChange:function(Tt){return lt(Tt)}}),l.a.createElement("p",{className:ue.a.titleWrap},l.a.createElement("span",{className:ue.a.required},"*"),l.a.createElement("span",{className:ue.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",l.a.createElement("span",{className:ue.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),dt.map(function($t,Tt){return l.a.createElement("div",{className:ue.a.choiceWrap,key:Tt},l.a.createElement(M.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},l.a.createElement("div",{className:"".concat(ue.a.answer," ").concat(Mt===Tt?ue.a.activeAnswer:""),onClick:function(){return Rt(Tt)}},ve[Tt])),l.a.createElement("div",{className:ue.a.editorWrap},wt===Tt?l.a.createElement(N.a,{id:"single-question-option-".concat(Tt),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:$t,onChange:function(Gt){dt[Tt]=Gt,ct(dt)}}):l.a.createElement("div",{className:ue.a.htmlWrap,onClick:function(){return xt(Tt)}},l.a.createElement(J.a,{value:$t}))),Tt>1&&l.a.createElement(M.a,{title:"\u5220\u9664"},l.a.createElement("i",{className:"".concat(ue.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return ct(dt.filter(function(Gt,ir){return ir!==Tt}))}})),Tt<7&&Tt===dt.length-1&&l.a.createElement(M.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},l.a.createElement("i",{className:"".concat(ue.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return ct([].concat(Object(b.a)(dt),[""]))}})))}),l.a.createElement("p",{className:ue.a.titleWrap},l.a.createElement("span",{className:ue.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(N.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Wt,onChange:function(Tt){return St(Tt)}}))},_e=Object(T.a)(function(xe){var pe=xe.problemset,be=xe.loading,te=xe.globalSetting;return{problemset:pe,globalSetting:te,loading:be.effects}},null,null,{forwardRef:!0})(Object(g.forwardRef)(Te)),fe=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],ne=function(pe,be){var te=pe.problemset,de=pe.globalSetting,he=pe.loading,ye=pe.dispatch,De=pe.onRef,we=De===void 0?function(){}:De,We=pe.isEdit,Qe=Object(m.a)(pe,["problemset","globalSetting","loading","dispatch","onRef","isEdit"]),nt=Object(g.useState)([]),Ve=Object(v.a)(nt,2),dt=Ve[0],ct=Ve[1],at=Object(g.useState)(),Dt=Object(v.a)(at,2),wt=Dt[0],xt=Dt[1],kt=Object(g.useState)([]),Et=Object(v.a)(kt,2),Mt=Et[0],Rt=Et[1],Xe=Object(g.useState)(""),bt=Object(v.a)(Xe,2),ot=bt[0],lt=bt[1],st=Object(g.useState)(""),zt=Object(v.a)(st,2),Wt=zt[0],St=zt[1];Object(g.useEffect)(function(){ct(["","","",""])},[]),Object(g.useEffect)(function(){var $t,Tt,Ot,Gt;if(!te.editData||!We)return;lt(($t=te.editData)===null||$t===void 0?void 0:$t.name),St((Tt=te.editData)===null||Tt===void 0?void 0:Tt.analysis),ct((Ot=te.editData)===null||Ot===void 0?void 0:Ot.choices.map(function(Dr){return Dr.choice_text}));var ir=[];(Gt=te.editData)===null||Gt===void 0||Gt.choices.map(function(Dr,et){Dr.is_answer&&ir.push(et)}),Rt(ir)},[te.editData]),Object(g.useImperativeHandle)(be,function(){return{onSave:ut,Clear:or}});var ut=function(){if(!ot)return u.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;var Tt=dt.findIndex(function(Gt){return!Gt});if(Tt>-1)return u.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(fe[Tt]," \u9009\u9879\u7684\u5185\u5BB9")),!1;if(!Mt.length)return u.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),!1;if(Mt.length<2)return u.b.info("\u591A\u9009\u9898\u6700\u5C0F\u6B63\u786E\u9009\u9879\u4E3A2\u4E2A"),!1;var Ot=dt.map(function(Gt,ir){return{choice_text:Gt,is_answer:Mt.includes(ir)?1:0}});return{name:ot,choices:Ot,analysis:Wt}},or=function(){ct(["","","",""]),lt(""),St(""),Rt("")};return l.a.createElement("section",{className:ue.a.wrap},l.a.createElement("p",{className:ue.a.titleWrap},l.a.createElement("span",{className:ue.a.required},"*"),l.a.createElement("span",{className:ue.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(N.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:ot,onChange:function(Tt){return lt(Tt)}}),l.a.createElement("p",{className:ue.a.titleWrap},l.a.createElement("span",{className:ue.a.required},"*"),l.a.createElement("span",{className:ue.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",l.a.createElement("span",{className:ue.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),dt.map(function($t,Tt){return l.a.createElement("div",{className:ue.a.choiceWrap,key:Tt},l.a.createElement(M.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},l.a.createElement("div",{className:"".concat(ue.a.answer," ").concat(Mt.includes(Tt)?ue.a.activeAnswer:""),onClick:function(){Mt.includes(Tt)?Rt(Mt.filter(function(Gt){return Gt!==Tt})):Rt([].concat(Object(b.a)(Mt),[Tt]))}},fe[Tt])),l.a.createElement("div",{className:ue.a.editorWrap},wt===Tt?l.a.createElement(N.a,{id:"single-question-option-".concat(Tt),watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:$t,onChange:function(Gt){dt[Tt]=Gt,ct(dt)}}):l.a.createElement("div",{className:ue.a.htmlWrap,onClick:function(){return xt(Tt)}},l.a.createElement(J.a,{value:$t}))),Tt>1&&l.a.createElement(M.a,{title:"\u5220\u9664"},l.a.createElement("i",{className:"".concat(ue.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return ct(dt.filter(function(Gt,ir){return ir!==Tt}))}})),Tt<7&&Tt===dt.length-1&&l.a.createElement(M.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},l.a.createElement("i",{className:"".concat(ue.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return ct([].concat(Object(b.a)(dt),[""]))}})))}),l.a.createElement("p",{className:ue.a.titleWrap},l.a.createElement("span",{className:ue.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(N.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Wt,onChange:function(Tt){return St(Tt)}}))},me=Object(T.a)(function(xe){var pe=xe.problemset,be=xe.loading,te=xe.globalSetting;return{problemset:pe,globalSetting:te,loading:be.effects}},null,null,{forwardRef:!0})(Object(g.forwardRef)(ne)),ie=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],le=function(pe,be){var te=pe.problemset,de=pe.globalSetting,he=pe.loading,ye=pe.dispatch,De=pe.onRef,we=De===void 0?function(){}:De,We=pe.isEdit,Qe=Object(m.a)(pe,["problemset","globalSetting","loading","dispatch","onRef","isEdit"]),nt=Object(g.useState)(),Ve=Object(v.a)(nt,2),dt=Ve[0],ct=Ve[1],at=Object(g.useState)(""),Dt=Object(v.a)(at,2),wt=Dt[0],xt=Dt[1],kt=Object(g.useState)(""),Et=Object(v.a)(kt,2),Mt=Et[0],Rt=Et[1];Object(g.useEffect)(function(){var ot,lt,st;if(!te.editData||!We)return;xt((ot=te.editData)===null||ot===void 0?void 0:ot.name),Rt((lt=te.editData)===null||lt===void 0?void 0:lt.analysis);var zt=(st=te.editData)===null||st===void 0?void 0:st.choices.find(function(Wt){return Wt.is_answer});ct(zt.choice_text==="\u6B63\u786E"?"0":"1")},[te.editData]),Object(g.useImperativeHandle)(be,function(){return{onSave:Xe,Clear:bt}});var Xe=function(){if(!wt)return u.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;if(!dt)return u.b.info("\u8BF7\u5148\u70B9\u51FB\u9009\u62E9\u672C\u9009\u62E9\u9898\u7684\u6B63\u786E\u9009\u9879"),!1;var lt=[{choice_text:"\u6B63\u786E",is_answer:dt==="0"?1:0},{choice_text:"\u9519\u8BEF",is_answer:dt==="1"?1:0}];return{name:wt,choices:lt,analysis:Mt}},bt=function(){xt(""),Rt(""),ct("")};return l.a.createElement("section",{className:ue.a.wrap},l.a.createElement("p",{className:ue.a.titleWrap},l.a.createElement("span",{className:ue.a.required},"*"),l.a.createElement("span",{className:ue.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(N.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:wt,onChange:function(lt){return xt(lt)}}),l.a.createElement("p",{className:ue.a.titleWrap},l.a.createElement("span",{className:ue.a.required},"*"),l.a.createElement("span",{className:ue.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",l.a.createElement("span",{className:ue.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),l.a.createElement(D.a.Group,{buttonStyle:"solid",value:dt,onChange:function(lt){return ct(lt.target.value)}},l.a.createElement(D.a.Button,{value:"0",className:"".concat(ue.a.radio," mr40")},"\u6B63\u786E"),l.a.createElement(D.a.Button,{value:"1",className:ue.a.radio},"\u9519\u8BEF")),l.a.createElement("p",{className:ue.a.titleWrap},l.a.createElement("span",{className:ue.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(N.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Mt,onChange:function(lt){return Rt(lt)}}))},q=Object(T.a)(function(xe){var pe=xe.problemset,be=xe.loading,te=xe.globalSetting;return{problemset:pe,globalSetting:te,loading:be.effects}},null,null,{forwardRef:!0})(Object(g.forwardRef)(le)),re=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],oe=function(pe,be){var te=pe.problemset,de=pe.globalSetting,he=pe.loading,ye=pe.dispatch,De=pe.onRef,we=De===void 0?function(){}:De,We=pe.isEdit,Qe=Object(m.a)(pe,["problemset","globalSetting","loading","dispatch","onRef","isEdit"]),nt=Object(g.useState)(""),Ve=Object(v.a)(nt,2),dt=Ve[0],ct=Ve[1],at=Object(g.useState)(""),Dt=Object(v.a)(at,2),wt=Dt[0],xt=Dt[1],kt=Object(g.useState)(""),Et=Object(v.a)(kt,2),Mt=Et[0],Rt=Et[1];Object(g.useEffect)(function(){var ot,lt,st,zt;if(!te.editData||!We)return;ct((ot=te.editData)===null||ot===void 0?void 0:ot.name),xt((lt=te.editData)===null||lt===void 0?void 0:lt.analysis),Rt((st=te.editData)===null||st===void 0||((zt=st.answer_texts)===null||zt===void 0)?void 0:zt[0])},[te.editData]),Object(g.useImperativeHandle)(be,function(){return{onSave:Xe,Clear:bt}});var Xe=function(){return dt?{name:dt,answer_texts:[Mt],analysis:wt}:(u.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1)},bt=function(){ct(""),xt(""),Rt("")};return l.a.createElement("section",{className:ue.a.wrap},l.a.createElement("p",{className:ue.a.titleWrap},l.a.createElement("span",{className:ue.a.required},"*"),l.a.createElement("span",{className:ue.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(N.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:dt,onChange:function(lt){return ct(lt)}}),l.a.createElement("p",{className:ue.a.titleWrap},l.a.createElement("span",{className:ue.a.title},"\u53C2\u8003\u7B54\u6848\uFF1A")),l.a.createElement(N.a,{id:"single-question-reference-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848",defaultValue:Mt,onChange:function(lt){return Rt(lt)}}),l.a.createElement("p",{className:ue.a.titleWrap},l.a.createElement("span",{className:ue.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(N.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:wt,onChange:function(lt){return xt(lt)}}))},ge=Object(T.a)(function(xe){var pe=xe.problemset,be=xe.loading,te=xe.globalSetting;return{problemset:pe,globalSetting:te,loading:be.effects}},null,null,{forwardRef:!0})(Object(g.forwardRef)(oe)),Se=Y("sRBo"),Ee=Y("kaz8"),Re=Y("kqOp"),Pe=Y("7qnI"),Ue=Y("1vsH"),He=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Fe=function(pe,be){var te=pe.problemset,de=pe.globalSetting,he=pe.loading,ye=pe.dispatch,De=pe.isEdit,we=Object(m.a)(pe,["problemset","globalSetting","loading","dispatch","isEdit"]),We=Object(g.useState)(""),Qe=Object(v.a)(We,2),nt=Qe[0],Ve=Qe[1],dt=Object(g.useState)(""),ct=Object(v.a)(dt,2),at=ct[0],Dt=ct[1],wt=Object(g.useState)([]),xt=Object(v.a)(wt,2),kt=xt[0],Et=xt[1],Mt=Object(g.useState)(""),Rt=Object(v.a)(Mt,2),Xe=Rt[0],bt=Rt[1],ot=Object(g.useState)(),lt=Object(v.a)(ot,2),st=lt[0],zt=lt[1],Wt=Object(g.useState)(!1),St=Object(v.a)(Wt,2),ut=St[0],or=St[1];Object(g.useEffect)(function(){var Ct,Ut,nr;if(!te.editData||!De)return;Ve((Ct=te.editData)===null||Ct===void 0?void 0:Ct.name),Dt((Ut=te.editData)===null||Ut===void 0?void 0:Ut.analysis),zt((nr=te.editData)===null||nr===void 0?void 0:nr.is_ordered),or(!0)},[te.editData]),Object(g.useEffect)(function(){var Ct;if(!ut)return;var Ut=(Ct=te.editData)===null||Ct===void 0?void 0:Ct.standard_answer.map(function(nr){return nr.answer_text});Et(Ut),or(!1)},[ut]),Object(g.useImperativeHandle)(be,function(){return{onSave:$t,Clear:Tt}});var $t=function(){var Ut=[],nr=!1;return kt.forEach(function(mr,Cr){Ut.push({position:Cr+1,answer_text:[]}),mr.forEach(function(H,p){Ut[Cr].answer_text.push(H),(!H||!Object(Ue.Z)(H,1e4))&&(bt("".concat(Cr,"-").concat(p)),u.b.info(H?"\u7B54\u6848\u4E0D\u80FD\u8D85\u8FC710000\u5B57\u7B26":"\u7B54\u6848\uFF1A\u4E0D\u80FD\u4E3A\u7A7A"),nr=!0)})}),nr?!1:(Ut==null?void 0:Ut.length)>20?(u.b.warn("\u586B\u7A7A\u9898\u6807\u51C6\u7B54\u6848\u4E0D\u80FD\u4E3A\u7A7A/\u4E0D\u80FD\u8D85\u8FC720\u4E2A\uFF01"),!1):{name:nt,analysis:at,standard_answers:Ut,is_ordered:st}},Tt=function(){Ve(""),Dt(""),Et([]),zt(!1)},Ot=function(Ut,nr,mr){var Cr=kt.slice();if(nr&&Cr.splice(Ut,nr),mr)for(var H=0;H<mr;H++)Cr.splice(Ut+H,0,[""]);Et(Cr)},Gt=function(Ut,nr,mr){bt("");var Cr=kt.slice();Cr[Ut][nr]=mr,Et(Cr)},ir=function(Ut){var nr=kt.slice();nr[Ut]=[].concat(Object(b.a)(nr[Ut]),[""]),Et(nr)},Dr=function(Ut,nr){var mr=kt.slice();if(!mr[Ut][nr]){mr[Ut]=mr[Ut].filter(function(Cr,H){return H!==nr}),Et(mr);return}w.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",className:ue.a.modal,onOk:function(){mr[Ut]=mr[Ut].filter(function(H,p){return p!==nr}),Et(mr)}})},et=function(Ut){w.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",className:ue.a.modal,onOk:function(){var mr=kt.slice();mr=kt.filter(function(Cr,H){return Ut!==H}),Et(mr)}})};return l.a.createElement("section",{className:ue.a.wrap},l.a.createElement("p",{className:ue.a.titleWrap},l.a.createElement("span",{className:ue.a.required},"*"),l.a.createElement("span",{className:ue.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement("div",null,l.a.createElement(Re.a,{id:"completion-question-tittle",placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE",height:155,defaultValue:nt,onChange:function(Ut){return Ve(Ut)},showNullButton:!0,onPlaceholderChange:Ot})),l.a.createElement("div",{className:"mt20"},kt.map(function(Ct,Ut){return l.a.createElement(Pe.a,{key:Ut,answers:Ct,index:Ut,is_md:!0,activeOptionErrorIndex:Xe,onAnswerChange:Gt,addChildAnswer:ir,deleteChildAnswer:Dr,deleteChildAnswermain:et})})),l.a.createElement("div",{className:"mt20"},kt.length>1&&l.a.createElement("span",null,l.a.createElement(Ee.a,{checked:st,onChange:function(Ut){return zt(Ut.target.checked)},className:"".concat(ue.a.color333," font14")},"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"),l.a.createElement("span",{className:"".concat(ue.a.color999," font12")},"\uFF08\u9009\u4E2D\uFF0C\u6BCF\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u987A\u5E8F\u5FC5\u987B\u4E0E\u53C2\u8003\u7B54\u6848\u4E00\u81F4\uFF09"))),l.a.createElement("p",{className:ue.a.titleWrap},l.a.createElement("span",{className:ue.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(N.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:at,onChange:function(Ut){return Dt(Ut)}}))},Ne=Object(T.a)(function(xe){var pe=xe.problemset,be=xe.loading,te=xe.globalSetting;return{problemset:pe,globalSetting:te,loading:be.effects}},null,null,{forwardRef:!0})(Object(g.forwardRef)(Fe)),qe=Y("LvDl"),Je=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],it=function(pe,be){var te=pe.problemset,de=pe.globalSetting,he=pe.loading,ye=pe.dispatch,De=pe.onRef,we=De===void 0?function(){}:De,We=pe.isEdit,Qe=Object(m.a)(pe,["problemset","globalSetting","loading","dispatch","onRef","isEdit"]),nt=Object(g.useState)(""),Ve=Object(v.a)(nt,2),dt=Ve[0],ct=Ve[1],at=Object(g.useState)([]),Dt=Object(v.a)(at,2),wt=Dt[0],xt=Dt[1];Object(g.useEffect)(function(){var Xe,bt,ot;if(!te.editData||!We)return;ct((Xe=te.editData)===null||Xe===void 0?void 0:Xe.name);var lt=te==null||((bt=te.editData)===null||bt===void 0||((ot=bt.sub_item_banks)===null||ot===void 0))?void 0:ot.map(function(st){var zt,Wt,St;return Object(c.a)(Object(c.a)({},st),{},{id:st.id,open:!1,qusList:st==null||((zt=st.choices)===null||zt===void 0)?void 0:zt.map(function(ut){return ut.choice_text}),activeQusEditor:null,qusAnswer:(Wt=[st==null||((St=st.choices)===null||St===void 0)?void 0:St.findIndex(function(ut){return ut.is_answer})])===null||Wt===void 0?void 0:Wt.filter(function(ut){return ut!==-1})})});xt(lt)},[te.editData]),Object(g.useImperativeHandle)(be,function(){return{onSave:kt,Clear:Et}});var kt=function(){if(!dt)return u.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;if(wt.length===0)return u.b.info("\u8BF7\u60A8\u6DFB\u52A0\u5C0F\u9898"),!1;for(var bt=0;bt<wt.length;bt++){var ot,lt=wt[bt];if(!(lt!=null&<.name))return u.b.info("\u8BF7\u60A8\u8F93\u5165\u7B2C".concat(bt+1,"\u5C0F\u9898\u9898\u5E72")),!1;var st=lt==null||((ot=lt.qusList)===null||ot===void 0)?void 0:ot.findIndex(function(Wt){return!Wt});if(st>-1)return u.b.info("\u8BF7\u5148\u8F93\u5165\u7B2C".concat(bt+1,"\u5C0F\u9898").concat(Je[st],"\u9009\u9879\u7684\u5185\u5BB9")),!1;if(!(lt!=null&<.qusAnswer.length))return u.b.info("\u8BF7\u8BBE\u7F6E\u7B2C".concat(bt+1,"\u5C0F\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E")),!1}var zt=wt.map(function(Wt){return{id:Wt.id>1?Wt.id:null,name:Wt.name,item_type:Wt.item_type,analysis:Wt.analysis,choices:Wt.qusList.map(function(St,ut){return{choice_text:St,is_answer:Wt.qusAnswer[0]===ut?1:0}})}});return{name:dt,sub_item_banks:zt}},Et=function(){ct(""),xt([])},Mt=function(){var bt={id:Math.random(),item_type:"SINGLE",open:!1,name:"",qusList:["","","",""],activeQusEditor:null,qusAnswer:[],analysis:""};xt(wt.concat(bt))},Rt=function(bt,ot,lt){var st=Object(qe.cloneDeep)(wt);if(bt==="open"&&(st[ot].open=!st[ot].open),bt==="delete"&&st.splice(ot,1),bt==="value"&&(st[ot].name=lt),bt==="answer"&&(st[ot].qusAnswer=[lt]),bt==="edit"&&(st[ot].activeQusEditor=lt),bt==="details"&&(st[ot].qusList[st[ot].activeQusEditor]=lt),bt==="addQus"&&(st[ot].qusList=st[ot].qusList.concat("")),bt==="deleteQus"){var zt;st[ot].qusList=st[ot].qusList.filter(function(Wt,St){return St!==lt}),st[ot].qusAnswer=(zt=st[ot].qusAnswer)===null||zt===void 0?void 0:zt.filter(function(Wt){return Wt!==lt})}bt==="analysis"&&(st[ot].analysis=lt),xt(st)};return l.a.createElement("section",{className:ue.a.wrap},l.a.createElement("p",{className:ue.a.titleWrap},l.a.createElement("span",{className:ue.a.required},"*"),l.a.createElement("span",{className:ue.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(N.a,{id:"combination-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:dt,onChange:function(bt){return ct(bt)}}),wt==null?void 0:wt.map(function(Xe,bt){var ot;return l.a.createElement("div",{className:ue.a.fold,key:Xe.id},l.a.createElement("div",{onClick:function(){return Rt("open",bt)},className:ue.a.head},l.a.createElement("i",{className:"iconfont icon-sanjiaoxing",style:{transform:Xe.open?"initial":"rotate(270deg) translate(2px, 4px)"}}),l.a.createElement("span",null,"\u7B2C",bt+1,"\u5C0F\u9898\uFF08\u5355\u9009\u9898\uFF09"),l.a.createElement("b",{onClick:function(st){st.stopPropagation(),Rt("delete",bt)},className:"iconfont icon-shanchu8"})),l.a.createElement("div",{className:"mb10",style:{display:Xe.open?"block":"none"}},l.a.createElement(N.a,{watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Xe==null?void 0:Xe.name,onChange:function(st){return Rt("value",bt,st)}}),l.a.createElement("p",{className:ue.a.titleWrap},l.a.createElement("span",{className:ue.a.required},"*"),l.a.createElement("span",{className:ue.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",l.a.createElement("span",{className:ue.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),Xe==null||((ot=Xe.qusList)===null||ot===void 0)?void 0:ot.map(function(lt,st){var zt,Wt;return l.a.createElement("div",{className:ue.a.choiceWrap,key:st},l.a.createElement(M.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},l.a.createElement("div",{className:"".concat(ue.a.answer," ").concat(Xe!=null&&(zt=Xe.qusAnswer)!==null&&zt!==void 0&&zt.includes(st)?ue.a.activeAnswer:""),onClick:function(){return Rt("answer",bt,st)}},Je[st])),l.a.createElement("div",{className:ue.a.editorWrap},(Xe==null?void 0:Xe.activeQusEditor)===st?l.a.createElement(N.a,{id:"single-question-option-".concat(st),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:lt,onChange:function(ut){return Rt("details",bt,ut)}}):l.a.createElement("div",{className:ue.a.htmlWrap,onClick:function(){return Rt("edit",bt,st)}},l.a.createElement(J.a,{value:lt}))),st>1&&l.a.createElement(M.a,{title:"\u5220\u9664"},l.a.createElement("i",{className:"".concat(ue.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return Rt("deleteQus",bt,st)}})),st<7&&st===(Xe==null||((Wt=Xe.qusList)===null||Wt===void 0)?void 0:Wt.length)-1&&l.a.createElement(M.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},l.a.createElement("i",{className:"".concat(ue.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return Rt("addQus",bt)}})))}),l.a.createElement("p",{className:"mb10 mt10"},l.a.createElement("span",{className:ue.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(N.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Xe.analysis,onChange:function(st){return Rt("analysis",bt,st)}})))}),wt.length<20&&l.a.createElement(Z.a,{type:"primary",onClick:Mt},l.a.createElement("i",{className:"iconfont icon-tianjiatimu mr5 font14"}),"\u6DFB\u52A0\u5C0F\u9898"))},rt=Object(T.a)(function(xe){var pe=xe.problemset,be=xe.loading,te=xe.globalSetting;return{problemset:pe,globalSetting:te,loading:be.effects}},null,null,{forwardRef:!0})(Object(g.forwardRef)(it)),ht=Y("ErOA"),ft=Y("u2Z1"),ke=Y("xvlK"),Le=Y("P/tu"),Ge=h.a.Dragger,Ke=x.a.Option,Me=function(pe){var be,te,de,he=pe.problemset,ye=pe.globalSetting,De=pe.loading,we=pe.dispatch,We=Object(m.a)(pe,["problemset","globalSetting","loading","dispatch"]),Qe=C.a.useForm(),nt=Object(v.a)(Qe,1),Ve=nt[0],dt=Object(g.useState)({}),ct=Object(v.a)(dt,2),at=ct[0],Dt=ct[1],wt=Object(g.useState)(),xt=Object(v.a)(wt,2),kt=xt[0],Et=xt[1],Mt=Object(g.useState)(!1),Rt=Object(v.a)(Mt,2),Xe=Rt[0],bt=Rt[1],ot=Object(g.useState)([]),lt=Object(v.a)(ot,2),st=lt[0],zt=lt[1],Wt=Object(g.useRef)(),St=Object(g.useRef)(),ut=Object(g.useState)([]),or=Object(v.a)(ut,2),$t=or[0],Tt=or[1],Ot=Object(g.useState)(1),Gt=Object(v.a)(Ot,2),ir=Gt[0],Dr=Gt[1],et=Object(g.useState)([]),Ct=Object(v.a)(et,2),Ut=Ct[0],nr=Ct[1],mr=Object(g.useState)(),Cr=Object(v.a)(mr,2),H=Cr[0],p=Cr[1],S=Object(g.useState)(!1),K=Object(v.a)(S,2),$=K[0],G=K[1],Ae=Object(g.useState)(),$e=Object(v.a)(Ae,2),pt=$e[0],_t=$e[1];Object(g.useEffect)(function(){return we({type:"globalSetting/footerToggle",payload:!1}),function(){we({type:"globalSetting/footerToggle",payload:!0})}},[]),Object(g.useEffect)(function(){if(he!=null&&he.editData){var Jt;_t(!(he!=null&&(Jt=he.editData)!==null&&Jt!==void 0&&Jt.repeat_answer))}},[he==null?void 0:he.editData]);var Ze={onRemove:function(){nr([])},beforeUpload:function(jt){if(console.log(jt),(jt==null?void 0:jt.size)>1024*1024*50)return u.b.info("\u6587\u4EF6\u8D85\u8FC750M\uFF0C\u4E0D\u7B26\u5408\u4E0A\u4F20\u8981\u6C42"),!1;var Xt=[];return Xt.push(jt),nr([].concat(Xt)),!1},fileList:Ut,accept:".xls,.xlsx"};Object(g.useEffect)(function(){return window.addEventListener("beforeunload",Bt),function(){window.removeEventListener("beforeunload",Bt)}},[]),Object(g.useEffect)(function(){var Jt,jt,Xt=(Jt=We.location.query)===null||Jt===void 0?void 0:Jt.pages;Et(Xt);var Zt=(jt=We.match.params)===null||jt===void 0?void 0:jt.id;bt(!!Zt),Wt.current=Zt},[]),Object(g.useEffect)(function(){we({type:"problemset/getEditDisciplines",payload:{source:"question"}}),Wt.current&&we({type:"problemset/getEditData",payload:{id:Wt.current}})},[]),Object(g.useEffect)(function(){var Jt;Ve.setFieldsValue({itemType:"SINGLE"}),Ve.setFieldsValue({difficulty:1});var jt=((Jt=We.location.query)===null||Jt===void 0?void 0:Jt.group_id)||0;if(Ve.setFieldsValue({item_banks_group_id:[Number(jt)]}),!he.editData||!Wt.current)return;var Xt=(he==null?void 0:he.editData)||{},Zt=Xt.discipline,sr=Xt.sub_discipline,qt=Xt.tag_disciplines,Sr=Xt.item_type,Ir=Xt.difficulty,Or=Xt.item_banks_group_id;Ve.setFieldsValue({course:[Zt==null?void 0:Zt.id,sr==null?void 0:sr.id]}),Ve.setFieldsValue({itemType:Sr}),Ve.setFieldsValue({difficulty:Ir}),Ve.setFieldsValue({item_banks_group_id:Or}),Ve.setFieldsValue({knowledge:qt==null?void 0:qt.map(function(wr){return wr.id})}),Dt({course:[Zt==null?void 0:Zt.id,sr==null?void 0:sr.id],itemType:Sr,difficulty:Ir,item_banks_group_id:Or,knowledge:qt==null?void 0:qt.map(function(wr){return wr.id})}),It(Zt==null?void 0:Zt.id,sr==null?void 0:sr.id)},[he.editData,he.disciplinesData]);var Bt=function(jt){jt.preventDefault(),jt.returnValue=""},It=function(jt,Xt){var Zt,sr,qt,Sr,Ir,Or=(Zt=he.disciplinesData)===null||Zt===void 0||((sr=Zt.disciplines)===null||sr===void 0||((qt=sr.find(function(wr){return wr.id===jt}))===null||qt===void 0||((Sr=qt.sub_disciplines)===null||Sr===void 0||((Ir=Sr.find(function(wr){return wr.id===Xt}))===null||Ir===void 0))))?void 0:Ir.tag_disciplines;Sn(Xt)},hr=function(jt){if(jt!=null&&jt.course){var Xt,Zt,sr,qt,Sr=Object(v.a)(jt.course,2),Ir=Sr[0],Or=Sr[1],wr=(Xt=he.disciplinesData.disciplines)===null||Xt===void 0||((Zt=Xt.find(function(Zr){return Zr.id===Ir}))===null||Zt===void 0||((sr=Zt.sub_disciplines)===null||sr===void 0||((qt=sr.find(function(Zr){return Zr.id===Or}))===null||qt===void 0)))?void 0:qt.tag_disciplines;Sn(Or),Ve.setFieldsValue({knowledge:[]}),Dt(Object(c.a)(Object(c.a)({},Ve.getFieldsValue()),{},{knowledge:[]}))}else Dt(Object(c.a)({},Ve.getFieldsValue()))},Wr=function(jt){zt([].concat(Object(b.a)(st),[Object(c.a)({},jt)]))},Hr=function(){var Jt=Object(y.a)(i.a.mark(function jt(){var Xt,Zt,sr,qt,Sr,Ir,Or,wr,Zr,on,hn,lr,Yt,Tr,tr,Er,Vt,en,_r;return i.a.wrap(function(vr){for(;;)switch(vr.prev=vr.next){case 0:if(Xt=at||{},Zt=Xt.course,sr=Xt.itemType,qt=Xt.difficulty,Sr=Xt.item_banks_group_id,Ir=Xt.knowledge,Or=Ir===void 0?[]:Ir,wr=Object(v.a)(Zt,2),Zr=wr[0],on=wr[1],!(ir===1)){vr.next=24;break}if(!(sr==="PROGRAM")){vr.next=7;break}return lr=Or==null?void 0:Or.join(","),Object(Ue.O)("/problems/new?difficult=".concat(qt,"&sub_discipline_id=").concat(on,"&newoj=1&pages=").concat(kt,"&tagIds=").concat(lr,"&banksIds=").concat(Sr!=null&&Sr[0]?Sr==null?void 0:Sr[0]:0)),vr.abrupt("return");case 7:if(Yt=(hn=St.current)===null||hn===void 0?void 0:hn.onSave(),Yt){vr.next=10;break}return vr.abrupt("return");case 10:if(Tr=Object(c.a)({discipline_id:Zr,sub_discipline_id:on,item_banks_group_ids:Sr,tag_discipline_ids:Or,item_type:sr,difficulty:qt},Yt||{}),console.log(Tr,"postData"),!Xe){vr.next=18;break}return vr.next=15,we({type:"problemset/editProblemset",payload:Object(c.a)(Object(c.a)({},Tr),{},{repeat_answer:!pt,id:Wt.current})});case 15:tr=vr.sent,vr.next=21;break;case 18:return vr.next=20,we({type:"problemset/addProblemset",payload:Tr});case 20:tr=vr.sent;case 21:tr.status===0&&(Xe?T.d.replace("/problemset?group_id=".concat(Sr)):w.a.confirm({title:null,icon:null,content:"\u521B\u5EFA\u6210\u529F",okText:"\u7EE7\u7EED\u65B0\u589E",cancelText:"\u8FD4\u56DE\u5217\u8868",onOk:function(){var tn;(tn=St.current)===null||tn===void 0||tn.Clear()},onCancel:function(){T.d.replace("/problemset?group_id=".concat(Sr))}})),vr.next=44;break;case 24:if(!((Ut==null?void 0:Ut.length)<=0)){vr.next=27;break}return u.b.info("\u8BF7\u4E0A\u4F20\u8BD5\u9898\u6587\u4EF6"),vr.abrupt("return");case 27:return G(!0),Er=new FormData,Er.append("file",Ut[0]),Er.append("sub_discipline_id",on),vr.next=33,Object(ht.a)("/api/item_banks/file_import.json",{method:"post",body:Er},!0);case 33:if(Vt=vr.sent,G(!1),!((Vt==null?void 0:Vt.status)===0)){vr.next=44;break}if(!((Vt==null||((en=Vt.fail)===null||en===void 0)?void 0:en.length)>0)){vr.next=40;break}return p(Vt==null?void 0:Vt.fail),u.b.error("\u4E0A\u4F20\u5931\u8D25\u9898\u6570\u4E3A"+(Vt==null||((_r=Vt.fail)===null||_r===void 0)?void 0:_r.length)+"\uFF0C\u53EF\u5728\u5E95\u90E8\u8BD5\u9898\u5217\u8868\u67E5\u770B\u9519\u8BEF\u539F\u56E0\u3002"),vr.abrupt("return");case 40:Ve.setFieldsValue({course:[]}),nr([]),p([]),u.b.info("\u4E0A\u4F20\u6210\u529F");case 44:case"end":return vr.stop()}},jt)}));return function(){return Jt.apply(this,arguments)}}();Object(g.useEffect)(function(){function Jt(){return jt.apply(this,arguments)}function jt(){return jt=Object(y.a)(i.a.mark(function Xt(){var Zt;return i.a.wrap(function(qt){for(;;)switch(qt.prev=qt.next){case 0:return qt.next=2,Object(ht.c)("item_banks_groups/mine.json");case 2:Zt=qt.sent,Tt(Zt);case 4:case"end":return qt.stop()}},Xt)})),jt.apply(this,arguments)}Jt()},[]);var br=function(){var jt=at||{itemType:"SINGLE"},Xt=jt.itemType,Zt={SINGLE:l.a.createElement(_e,{ref:St,isEdit:Xe}),MULTIPLE:l.a.createElement(me,{ref:St,isEdit:Xe}),JUDGMENT:l.a.createElement(q,{ref:St,isEdit:Xe}),COMPLETION:l.a.createElement(Ne,{ref:St,isEdit:Xe}),SUBJECTIVE:l.a.createElement(ge,{ref:St,isEdit:Xe}),COMBINATION:l.a.createElement(rt,{ref:St,isEdit:Xe})};return Zt[Xt||"SINGLE"]},Jr=function(jt){var Xt=Object(v.a)(jt,2),Zt=Xt[0],sr=Xt[1]},Sn=function(){var Jt=Object(y.a)(i.a.mark(function jt(Xt){var Zt;return i.a.wrap(function(qt){for(;;)switch(qt.prev=qt.next){case 0:return qt.next=2,we({type:"exercise/getTagDiscipline",payload:{sub_discipline_id:Xt}});case 2:Zt=qt.sent,zt(Zt.tag_disciplines);case 4:case"end":return qt.stop()}},jt)}));return function(Xt){return Jt.apply(this,arguments)}}(),Fr=[{title:"\u9898\u76EE\u540D\u79F0",dataIndex:"name",key:"name"},{title:"\u9519\u8BEF\u539F\u56E0",dataIndex:"message",key:"message"}];return l.a.createElement("section",{className:W.a.bg},l.a.createElement(A.a,{className:"mb20 mt30",separator:">"},l.a.createElement(A.a.Item,{href:"/problemset"},"\u8BD5\u9898\u5E93"),l.a.createElement(A.a.Item,null,Xe?"\u7F16\u8F91":"\u65B0\u589E","\u8BD5\u9898")),l.a.createElement("div",{className:W.a.main},l.a.createElement("span",{style:{fontSize:"18px"}},"\u6DFB\u52A0\u7C7B\u578B"),l.a.createElement("br",null),l.a.createElement(D.a.Group,{style:{marginTop:"5px"},onChange:function(jt){Dr(jt.target.value),Ve.setFieldsValue({course:[]}),nr([]),p([])},value:ir},l.a.createElement(D.a,{value:1},"\u5355\u4E2A\u6DFB\u52A0"),l.a.createElement(D.a,{value:2},"\u6279\u91CF\u5BFC\u5165")),ir===1&&l.a.createElement(C.a,{form:Ve,style:{marginTop:"10px"},className:W.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:hr,onFinish:Hr},l.a.createElement(C.a.Item,{label:"\u65B9\u5411&\u8BFE\u7A0B\uFF1A",name:"course",labelCol:{span:5},wrapperCol:{span:5},rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u8BFE\u7A0B"}]},l.a.createElement(B.a,{placeholder:"\u8BF7\u9009\u62E9...",allowClear:!1,options:he.courseOptions,onChange:Jr})),l.a.createElement(C.a.Item,{label:l.a.createElement("span",null,"\u77E5\u8BC6\u70B9\uFF1A",l.a.createElement("span",{className:"c-grey-999"},"\uFF08\u6240\u6709\u81EA\u5EFA\u77E5\u8BC6\u70B9\u4EC5\u672C\u4EBA\u53EF\u89C1\uFF0C\u88ABEduCoder\u5E73\u53F0\u5BA1\u6838\u901A\u8FC7\u4E3A\u5B98\u65B9\u77E5\u8BC6\u70B9\u540E\u6240\u6709\u7528\u6237\u53EF\u89C1\uFF09")),name:"knowledge"},l.a.createElement(ft.a,{selectvalues:at==null?void 0:at.knowledge,subId:(be=at.course)===null||be===void 0?void 0:be[1],knowledgeOptions:st,onAddKnowledgeFinish:Wr})),l.a.createElement(C.a.Item,{label:"\u52A0\u5165\u6587\u4EF6\u5939\u76EE\u5F55",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u6587\u4EF6\u5939"}],initialValue:[0],name:"item_banks_group_id",labelCol:{span:24},wrapperCol:{span:24}},l.a.createElement(Le.a,null)),l.a.createElement(C.a.Item,{label:"\u9898\u578B\uFF1A",name:"itemType",wrapperCol:{span:5},rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u9898\u578B"}]},l.a.createElement(x.a,{placeholder:"\u8BF7\u9009\u62E9...",disabled:Xe},l.a.createElement(Ke,{value:"PROGRAM"},"\u7F16\u7A0B\u9898"),l.a.createElement(Ke,{value:"SINGLE"},"\u5355\u9009\u9898"),l.a.createElement(Ke,{value:"MULTIPLE"},"\u591A\u9009\u9898"),l.a.createElement(Ke,{value:"JUDGMENT"},"\u5224\u65AD\u9898"),l.a.createElement(Ke,{value:"COMPLETION"},"\u586B\u7A7A\u9898"),l.a.createElement(Ke,{value:"SUBJECTIVE"},"\u7B80\u7B54\u9898"),l.a.createElement(Ke,{value:"COMBINATION"},"\u7EC4\u5408\u9898"))),l.a.createElement(C.a.Item,{label:"\u96BE\u5EA6\uFF1A",name:"difficulty",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u96BE\u5EA6"}]},l.a.createElement(D.a.Group,null,l.a.createElement(D.a.Button,{value:1},"\u7B80\u5355"),l.a.createElement(D.a.Button,{value:2},"\u9002\u4E2D"),l.a.createElement(D.a.Button,{value:3},"\u56F0\u96BE"))),Xe&&(he==null||((te=he.editData)===null||te===void 0)?void 0:te.item_type)!="PROGRAM"&&(he==null||((de=he.editData)===null||de===void 0)?void 0:de.item_type)!="COMBINATION"&&l.a.createElement("div",null,l.a.createElement("span",{style:{marginRight:10}},"\u4E0D\u5141\u8BB8\u5B66\u751F\u91CD\u590D\u7B54\u9898"),l.a.createElement(O.a,{checked:pt,onChange:function(jt){_t(jt)}}))),ir===2&&l.a.createElement("div",null,l.a.createElement(C.a,{form:Ve,style:{marginTop:"20px"},className:W.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:hr,onFinish:Hr},l.a.createElement(C.a.Item,{label:"\u65B9\u5411&\u8BFE\u7A0B\uFF1A",name:"course",labelCol:{span:5},wrapperCol:{span:5},rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u8BFE\u7A0B"}]},l.a.createElement(B.a,{placeholder:"\u8BF7\u9009\u62E9...",allowClear:!1,options:he.courseOptions,onChange:Jr})),l.a.createElement("span",null,"\u4E0B\u8F7DExcel\u683C\u5F0F ",l.a.createElement("a",{onClick:Object(y.a)(i.a.mark(function Jt(){return i.a.wrap(function(Xt){for(;;)switch(Xt.prev=Xt.next){case 0:Object(Ue.t)("",Object(Ue.U)({url:I.a.API_SERVER+"/api/item_banks/down_template",query:{}}));case 1:case"end":return Xt.stop()}},Jt)}))},"\u8BD5\u9898\u6A21\u677F"),", \u6BCF\u6B21\u6700\u591A\u5BFC\u5165300\u9898\u3002"),l.a.createElement("br",null),l.a.createElement(h.a,Ze,l.a.createElement(Z.a,{className:W.a.upload,style:{marginTop:"20px"},type:"primary",icon:l.a.createElement(ke.a,null)},"\u9009\u62E9\u6587\u4EF6"))),l.a.createElement("br",null),(H==null?void 0:H.length)>0&&l.a.createElement("span",{style:{fontSize:"18px",display:"flex",width:"100%",justifyContent:"center"}},"\u9519\u8BEF\u5217\u8868"),(H==null?void 0:H.length)>0&&l.a.createElement(X.a,{style:{marginTop:"10px"},dataSource:H,columns:Fr}))),ir===1&&l.a.createElement("div",{className:W.a.topicWrap},br()),l.a.createElement("div",{className:W.a.buttonFixed},l.a.createElement("div",{className:W.a.buttonWrap},l.a.createElement(Z.a,{size:"large",className:"".concat(W.a.button," mr20"),onClick:function(){return T.d.push("/problemset")}},"\u53D6\u6D88"),l.a.createElement(Z.a,{size:"large",type:"primary",className:"".concat(W.a.button," mr20"),onClick:function(){return Ve.submit()},loading:De["problemset/editProblemset"]||De["problemset/addProblemset"]||$},at.itemType==="PROGRAM"?"\u521B\u5EFA":"\u4FDD\u5B58"))))},je=ze.default=Object(T.a)(function(xe){var pe=xe.problemset,be=xe.loading,te=xe.globalSetting;return{problemset:pe,globalSetting:te,loading:be.effects}})(Me)},"19Vz":function(gt,ze,Y){(function(ce){ce(Y("VrN/"))})(function(ce){ce.defineOption("placeholder","",function(B,k,D){var E=D&&D!=ce.Init;if(k&&!E)B.on("blur",U),B.on("change",O),B.on("swapDoc",O),ce.on(B.getInputField(),"compositionupdate",B.state.placeholderCompose=function(){Z(B)}),O(B);else if(!k&&E){B.off("blur",U),B.off("change",O),B.off("swapDoc",O),ce.off(B.getInputField(),"compositionupdate",B.state.placeholderCompose),X(B);var A=B.getWrapperElement();A.className=A.className.replace(" CodeMirror-empty","")}k&&!B.hasFocus()&&U(B)});function X(B){B.state.placeholder&&(B.state.placeholder.parentNode.removeChild(B.state.placeholder),B.state.placeholder=null)}function R(B){X(B);var k=B.state.placeholder=document.createElement("pre");k.style.cssText="height: 0; overflow: visible",k.style.direction=B.getOption("direction"),k.className="CodeMirror-placeholder CodeMirror-line-like";var D=B.getOption("placeholder");typeof D=="string"&&(D=document.createTextNode(D)),k.appendChild(D),B.display.lineSpace.insertBefore(k,B.display.lineSpace.firstChild)}function Z(B){setTimeout(function(){var k=!1,D=B.getInputField();D.nodeName=="TEXTAREA"?k=!D.value:B.lineCount()==1&&(k=!/[^\u200b]/.test(D.querySelector(".CodeMirror-line").textContent)),k?R(B):X(B)},20)}function U(B){j(B)&&R(B)}function O(B){var k=B.getWrapperElement(),D=j(B);k.className=k.className.replace(" CodeMirror-empty","")+(D?" CodeMirror-empty":""),D?R(B):X(B)}function j(B){return B.lineCount()===1&&B.getLine(0)===""}})},"1eCo":function(gt,ze,Y){(function(ce){ce(Y("VrN/"))})(function(ce){"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},R={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ce.defineMode("xml",function(Z,U){var O=Z.indentUnit,j={},B=U.htmlMode?X:R;for(var k in B)j[k]=B[k];for(var k in U)j[k]=U[k];var D,E;function A(i,g){function l(F){return g.tokenize=F,F(i,g)}var T=i.next();if(T=="<")return i.eat("!")?i.eat("[")?i.match("CDATA[")?l(y("atom","]]>")):null:i.match("--")?l(y("comment","-->")):i.match("DOCTYPE",!0,!0)?(i.eatWhile(/[\w\._\-]/),l(b(1))):null:i.eat("?")?(i.eatWhile(/[\w\._\-]/),g.tokenize=y("meta","?>"),"meta"):(D=i.eat("/")?"closeTag":"openTag",g.tokenize=P,"tag bracket");if(T=="&"){var I;return i.eat("#")?i.eat("x")?I=i.eatWhile(/[a-fA-F\d]/)&&i.eat(";"):I=i.eatWhile(/[\d]/)&&i.eat(";"):I=i.eatWhile(/[\w\.\-:]/)&&i.eat(";"),I?"atom":"error"}else return i.eatWhile(/[^&<]/),null}A.isInText=!0;function P(i,g){var l=i.next();if(l==">"||l=="/"&&i.eat(">"))return g.tokenize=A,D=l==">"?"endTag":"selfcloseTag","tag bracket";if(l=="=")return D="equals",null;if(l=="<"){g.tokenize=A,g.state=f,g.tagName=g.tagStart=null;var T=g.tokenize(i,g);return T?T+" tag error":"tag error"}else return/[\'\"]/.test(l)?(g.tokenize=w(l),g.stringStartCol=i.column(),g.tokenize(i,g)):(i.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function w(i){var g=function(l,T){for(;!l.eol();)if(l.next()==i){T.tokenize=P;break}return"string"};return g.isInAttribute=!0,g}function y(i,g){return function(l,T){for(;!l.eol();){if(l.match(g)){T.tokenize=A;break}l.next()}return i}}function b(i){return function(g,l){for(var T;(T=g.next())!=null;){if(T=="<")return l.tokenize=b(i+1),l.tokenize(g,l);if(T==">")if(i==1){l.tokenize=A;break}else return l.tokenize=b(i-1),l.tokenize(g,l)}return"meta"}}function c(i,g,l){this.prev=i.context,this.tagName=g,this.indent=i.indented,this.startOfLine=l,(j.doNotIndent.hasOwnProperty(g)||i.context&&i.context.noIndent)&&(this.noIndent=!0)}function s(i){i.context&&(i.context=i.context.prev)}function u(i,g){for(var l;;){if(!i.context)return;if(l=i.context.tagName,!j.contextGrabbers.hasOwnProperty(l)||!j.contextGrabbers[l].hasOwnProperty(g))return;s(i)}}function f(i,g,l){return i=="openTag"?(l.tagStart=g.column(),C):i=="closeTag"?v:f}function C(i,g,l){return i=="word"?(l.tagName=g.current(),E="tag",x):j.allowMissingTagName&&i=="endTag"?(E="tag bracket",x(i,g,l)):(E="error",C)}function v(i,g,l){if(i=="word"){var T=g.current();return l.context&&l.context.tagName!=T&&j.implicitlyClosed.hasOwnProperty(l.context.tagName)&&s(l),l.context&&l.context.tagName==T||j.matchClosing===!1?(E="tag",m):(E="tag error",_)}else return j.allowMissingTagName&&i=="endTag"?(E="tag bracket",m(i,g,l)):(E="error",_)}function m(i,g,l){return i!="endTag"?(E="error",m):(s(l),f)}function _(i,g,l){return E="error",m(i,g,l)}function x(i,g,l){if(i=="word")return E="attribute",d;if(i=="endTag"||i=="selfcloseTag"){var T=l.tagName,I=l.tagStart;return l.tagName=l.tagStart=null,i=="selfcloseTag"||j.autoSelfClosers.hasOwnProperty(T)?u(l,T):(u(l,T),l.context=new c(l,T,I==l.indented)),f}return E="error",x}function d(i,g,l){return i=="equals"?h:(j.allowMissing||(E="error"),x(i,g,l))}function h(i,g,l){return i=="string"?o:i=="word"&&j.allowUnquoted?(E="string",x):(E="error",x(i,g,l))}function o(i,g,l){return i=="string"?o:x(i,g,l)}return{startState:function(i){var g={tokenize:A,state:f,indented:i||0,tagName:null,tagStart:null,context:null};return i!=null&&(g.baseIndent=i),g},token:function(i,g){if(!g.tagName&&i.sol()&&(g.indented=i.indentation()),i.eatSpace())return null;D=null;var l=g.tokenize(i,g);return(l||D)&&l!="comment"&&(E=null,g.state=g.state(D||l,i,g),E&&(l=E=="error"?l+" error":E)),l},indent:function(i,g,l){var T=i.context;if(i.tokenize.isInAttribute)return i.tagStart==i.indented?i.stringStartCol+1:i.indented+O;if(T&&T.noIndent)return ce.Pass;if(i.tokenize!=P&&i.tokenize!=A)return l?l.match(/^(\s*)/)[0].length:0;if(i.tagName)return j.multilineTagIndentPastTag!==!1?i.tagStart+i.tagName.length+2:i.tagStart+O*(j.multilineTagIndentFactor||1);if(j.alignCDATA&&/<!\[CDATA\[/.test(g))return 0;var I=g&&/^<(\/)?([\w_:\.-]*)/.exec(g);if(I&&I[1])for(;T;)if(T.tagName==I[2]){T=T.prev;break}else if(j.implicitlyClosed.hasOwnProperty(T.tagName))T=T.prev;else break;else if(I)for(;T;){var F=j.contextGrabbers[T.tagName];if(F&&F.hasOwnProperty(I[2]))T=T.prev;else break}for(;T&&T.prev&&!T.startOfLine;)T=T.prev;return T?T.indent+O:i.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:j.htmlMode?"html":"xml",helperType:j.htmlMode?"html":"xml",skipAttribute:function(i){i.state==h&&(i.state=x)},xmlCurrentTag:function(i){return i.tagName?{name:i.tagName,close:i.type=="closeTag"}:null},xmlCurrentContext:function(i){for(var g=[],l=i.context;l;l=l.prev)l.tagName&&g.push(l.tagName);return g.reverse()}}}),ce.defineMIME("text/xml","xml"),ce.defineMIME("application/xml","xml"),ce.mimeModes.hasOwnProperty("text/html")||ce.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"6+eU":function(gt,ze,Y){"use strict";Y.d(ze,"a",function(){return m});var ce=Y("wx14"),X=Y("rePB"),R=Y("VTBJ"),Z=Y("1OyB"),U=Y("vuIU"),O=Y("Ji7U"),j=Y("LK+K"),B=Y("q1tI"),k=Y.n(B),D=Y("TSYQ"),E=Y.n(D),A=function(x){var d,h="".concat(x.rootPrefixCls,"-item"),o=E()(h,"".concat(h,"-").concat(x.page),(d={},Object(X.a)(d,"".concat(h,"-active"),x.active),Object(X.a)(d,x.className,!!x.className),Object(X.a)(d,"".concat(h,"-disabled"),!x.page),d)),i=function(){x.onClick(x.page)},g=function(T){x.onKeyPress(T,x.onClick,x.page)};return k.a.createElement("li",{title:x.showTitle?x.page:null,className:o,onClick:i,onKeyPress:g,tabIndex:"0"},x.itemRender(x.page,"page",k.a.createElement("a",{rel:"nofollow"},x.page)))},P=A,w={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},y=function(_){Object(O.a)(d,_);var x=Object(j.a)(d);function d(){var h;Object(Z.a)(this,d);for(var o=arguments.length,i=new Array(o),g=0;g<o;g++)i[g]=arguments[g];return h=x.call.apply(x,[this].concat(i)),h.state={goInputText:""},h.buildOptionText=function(l){return"".concat(l," ").concat(h.props.locale.items_per_page)},h.changeSize=function(l){h.props.changeSize(Number(l))},h.handleChange=function(l){h.setState({goInputText:l.target.value})},h.handleBlur=function(l){var T=h.props,I=T.goButton,F=T.quickGo,W=T.rootPrefixCls,V=h.state.goInputText;if(I||V==="")return;if(l.relatedTarget&&(l.relatedTarget.className.indexOf("".concat(W,"-prev"))>=0||l.relatedTarget.className.indexOf("".concat(W,"-next"))>=0))return;h.setState({goInputText:""}),F(h.getValidValue())},h.go=function(l){var T=h.state.goInputText;if(T==="")return;(l.keyCode===w.ENTER||l.type==="click")&&(h.setState({goInputText:""}),h.props.quickGo(h.getValidValue()))},h}return Object(U.a)(d,[{key:"getValidValue",value:function(){var o=this.state,i=o.goInputText,g=o.current;return!i||isNaN(i)?g:Number(i)}},{key:"getPageSizeOptions",value:function(){var o=this.props,i=o.pageSize,g=o.pageSizeOptions;return g.some(function(l){return l.toString()===i.toString()})?g:g.concat([i.toString()]).sort(function(l,T){var I=isNaN(Number(l))?0:Number(l),F=isNaN(Number(T))?0:Number(T);return I-F})}},{key:"render",value:function(){var o=this,i=this.props,g=i.pageSize,l=i.locale,T=i.rootPrefixCls,I=i.changeSize,F=i.quickGo,W=i.goButton,V=i.selectComponentClass,M=i.buildOptionText,N=i.selectPrefixCls,J=i.disabled,ae=this.state.goInputText,ue="".concat(T,"-options"),ve=V,Te=null,_e=null,fe=null;if(!I&&!F)return null;var ne=this.getPageSizeOptions();if(I&&ve){var me=ne.map(function(ie,le){return k.a.createElement(ve.Option,{key:le,value:ie.toString()},(M||o.buildOptionText)(ie))});Te=k.a.createElement(ve,{disabled:J,prefixCls:N,showSearch:!1,className:"".concat(ue,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(g||ne[0]).toString(),onChange:this.changeSize,getPopupContainer:function(le){return le.parentNode}},me)}return F&&(W&&(fe=typeof W=="boolean"?k.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:J,className:"".concat(ue,"-quick-jumper-button")},l.jump_to_confirm):k.a.createElement("span",{onClick:this.go,onKeyUp:this.go},W)),_e=k.a.createElement("div",{className:"".concat(ue,"-quick-jumper")},l.jump_to,k.a.createElement("input",{disabled:J,type:"text",value:ae,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),l.page,fe)),k.a.createElement("li",{className:"".concat(ue)},Te,_e)}}]),d}(k.a.Component);y.defaultProps={pageSizeOptions:["10","20","50","100"]};var b=y,c=Y("N2Kk");function s(){}function u(_){return typeof _=="number"&&isFinite(_)&&Math.floor(_)===_}function f(_,x,d){return d}function C(_,x,d){var h=typeof _=="undefined"?x.pageSize:_;return Math.floor((d.total-1)/h)+1}var v=function(_){Object(O.a)(d,_);var x=Object(j.a)(d);function d(h){var o;Object(Z.a)(this,d),o=x.call(this,h),o.getJumpPrevPage=function(){return Math.max(1,o.state.current-(o.props.showLessItems?3:5))},o.getJumpNextPage=function(){return Math.min(C(void 0,o.state,o.props),o.state.current+(o.props.showLessItems?3:5))},o.getItemIcon=function(I,F){var W=o.props.prefixCls,V=I||k.a.createElement("button",{type:"button","aria-label":F,className:"".concat(W,"-item-link")});return typeof I=="function"&&(V=k.a.createElement(I,Object(R.a)({},o.props))),V},o.savePaginationNode=function(I){o.paginationNode=I},o.isValid=function(I){return u(I)&&I!==o.state.current},o.shouldDisplayQuickJumper=function(){var I=o.props,F=I.showQuickJumper,W=I.pageSize,V=I.total;return V<=W?!1:F},o.handleKeyDown=function(I){(I.keyCode===w.ARROW_UP||I.keyCode===w.ARROW_DOWN)&&I.preventDefault()},o.handleKeyUp=function(I){var F=o.getValidValue(I),W=o.state.currentInputValue;F!==W&&o.setState({currentInputValue:F}),I.keyCode===w.ENTER?o.handleChange(F):I.keyCode===w.ARROW_UP?o.handleChange(F-1):I.keyCode===w.ARROW_DOWN&&o.handleChange(F+1)},o.changePageSize=function(I){var F=o.state.current,W=C(I,o.state,o.props);F=F>W?W:F,W===0&&(F=o.state.current),typeof I=="number"&&("pageSize"in o.props||o.setState({pageSize:I}),"current"in o.props||o.setState({current:F,currentInputValue:F})),o.props.onShowSizeChange(F,I),"onChange"in o.props&&o.props.onChange&&o.props.onChange(F,I)},o.handleChange=function(I){var F=o.props.disabled,W=I;if(o.isValid(W)&&!F){var V=C(void 0,o.state,o.props);W>V?W=V:W<1&&(W=1),"current"in o.props||o.setState({current:W,currentInputValue:W});var M=o.state.pageSize;return o.props.onChange(W,M),W}return o.state.current},o.prev=function(){o.hasPrev()&&o.handleChange(o.state.current-1)},o.next=function(){o.hasNext()&&o.handleChange(o.state.current+1)},o.jumpPrev=function(){o.handleChange(o.getJumpPrevPage())},o.jumpNext=function(){o.handleChange(o.getJumpNextPage())},o.hasPrev=function(){return o.state.current>1},o.hasNext=function(){return o.state.current<C(void 0,o.state,o.props)},o.runIfEnter=function(I,F){if(I.key==="Enter"||I.charCode===13){for(var W=arguments.length,V=new Array(W>2?W-2:0),M=2;M<W;M++)V[M-2]=arguments[M];F.apply(void 0,V)}},o.runIfEnterPrev=function(I){o.runIfEnter(I,o.prev)},o.runIfEnterNext=function(I){o.runIfEnter(I,o.next)},o.runIfEnterJumpPrev=function(I){o.runIfEnter(I,o.jumpPrev)},o.runIfEnterJumpNext=function(I){o.runIfEnter(I,o.jumpNext)},o.handleGoTO=function(I){(I.keyCode===w.ENTER||I.type==="click")&&o.handleChange(o.state.currentInputValue)};var i=h.onChange!==s,g="current"in h;g&&!i&&console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.");var l=h.defaultCurrent;"current"in h&&(l=h.current);var T=h.defaultPageSize;return"pageSize"in h&&(T=h.pageSize),l=Math.min(l,C(T,void 0,h)),o.state={current:l,currentInputValue:l,pageSize:T},o}return Object(U.a)(d,[{key:"componentDidUpdate",value:function(o,i){var g=this.props.prefixCls;if(i.current!==this.state.current&&this.paginationNode){var l=this.paginationNode.querySelector(".".concat(g,"-item-").concat(i.current));l&&document.activeElement===l&&l.blur()}}},{key:"getValidValue",value:function(o){var i=o.target.value,g=C(void 0,this.state,this.props),l=this.state.currentInputValue,T;return i===""?T=i:isNaN(Number(i))?T=l:i>=g?T=g:T=Number(i),T}},{key:"getShowSizeChanger",value:function(){var o=this.props,i=o.showSizeChanger,g=o.total,l=o.totalBoundaryShowSizeChanger;return typeof i!="undefined"?i:g>l}},{key:"renderPrev",value:function(o){var i=this.props,g=i.prevIcon,l=i.itemRender,T=l(o,"prev",this.getItemIcon(g,"prev page")),I=!this.hasPrev();return Object(B.isValidElement)(T)?Object(B.cloneElement)(T,{disabled:I}):T}},{key:"renderNext",value:function(o){var i=this.props,g=i.nextIcon,l=i.itemRender,T=l(o,"next",this.getItemIcon(g,"next page")),I=!this.hasNext();return Object(B.isValidElement)(T)?Object(B.cloneElement)(T,{disabled:I}):T}},{key:"render",value:function(){var o=this,i=this.props,g=i.prefixCls,l=i.className,T=i.style,I=i.disabled,F=i.hideOnSinglePage,W=i.total,V=i.locale,M=i.showQuickJumper,N=i.showLessItems,J=i.showTitle,ae=i.showTotal,ue=i.simple,ve=i.itemRender,Te=i.showPrevNextJumpers,_e=i.jumpPrevIcon,fe=i.jumpNextIcon,ne=i.selectComponentClass,me=i.selectPrefixCls,ie=i.pageSizeOptions,le=this.state,q=le.current,re=le.pageSize,oe=le.currentInputValue;if(F===!0&&W<=re)return null;var ge=C(void 0,this.state,this.props),Se=[],Ee=null,Re=null,Pe=null,Ue=null,He=null,Fe=M&&M.goButton,Ne=N?1:2,qe=q-1>0?q-1:0,Je=q+1<ge?q+1:ge,it=Object.keys(this.props).reduce(function(te,de){return(de.substr(0,5)==="data-"||de.substr(0,5)==="aria-"||de==="role")&&(te[de]=o.props[de]),te},{});if(ue)return Fe&&(typeof Fe=="boolean"?He=k.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},V.jump_to_confirm):He=k.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},Fe),He=k.a.createElement("li",{title:J?"".concat(V.jump_to).concat(q,"/").concat(ge):null,className:"".concat(g,"-simple-pager")},He)),k.a.createElement("ul",Object(ce.a)({className:E()(g,"".concat(g,"-simple"),Object(X.a)({},"".concat(g,"-disabled"),I),l),style:T,ref:this.savePaginationNode},it),k.a.createElement("li",{title:J?V.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:E()("".concat(g,"-prev"),Object(X.a)({},"".concat(g,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(qe)),k.a.createElement("li",{title:J?"".concat(q,"/").concat(ge):null,className:"".concat(g,"-simple-pager")},k.a.createElement("input",{type:"text",value:oe,disabled:I,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),k.a.createElement("span",{className:"".concat(g,"-slash")},"/"),ge),k.a.createElement("li",{title:J?V.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:E()("".concat(g,"-next"),Object(X.a)({},"".concat(g,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(Je)),He);if(ge<=3+Ne*2){var rt={locale:V,rootPrefixCls:g,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:J,itemRender:ve};ge||Se.push(k.a.createElement(P,Object(ce.a)({},rt,{key:"noPager",page:ge,className:"".concat(g,"-disabled")})));for(var ht=1;ht<=ge;ht+=1){var ft=q===ht;Se.push(k.a.createElement(P,Object(ce.a)({},rt,{key:ht,page:ht,active:ft})))}}else{var ke=N?V.prev_3:V.prev_5,Le=N?V.next_3:V.next_5;Te&&(Ee=k.a.createElement("li",{title:J?ke:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:E()("".concat(g,"-jump-prev"),Object(X.a)({},"".concat(g,"-jump-prev-custom-icon"),!!_e))},ve(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(_e,"prev page"))),Re=k.a.createElement("li",{title:J?Le:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:E()("".concat(g,"-jump-next"),Object(X.a)({},"".concat(g,"-jump-next-custom-icon"),!!fe))},ve(this.getJumpNextPage(),"jump-next",this.getItemIcon(fe,"next page")))),Ue=k.a.createElement(P,{locale:V,last:!0,rootPrefixCls:g,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:ge,page:ge,active:!1,showTitle:J,itemRender:ve}),Pe=k.a.createElement(P,{locale:V,rootPrefixCls:g,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:J,itemRender:ve});var Ge=Math.max(1,q-Ne),Ke=Math.min(q+Ne,ge);q-1<=Ne&&(Ke=1+Ne*2),ge-q<=Ne&&(Ge=ge-Ne*2);for(var Me=Ge;Me<=Ke;Me+=1){var je=q===Me;Se.push(k.a.createElement(P,{locale:V,rootPrefixCls:g,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:Me,page:Me,active:je,showTitle:J,itemRender:ve}))}q-1>=Ne*2&&q!==1+2&&(Se[0]=Object(B.cloneElement)(Se[0],{className:"".concat(g,"-item-after-jump-prev")}),Se.unshift(Ee)),ge-q>=Ne*2&&q!==ge-2&&(Se[Se.length-1]=Object(B.cloneElement)(Se[Se.length-1],{className:"".concat(g,"-item-before-jump-next")}),Se.push(Re)),Ge!==1&&Se.unshift(Pe),Ke!==ge&&Se.push(Ue)}var xe=null;ae&&(xe=k.a.createElement("li",{className:"".concat(g,"-total-text")},ae(W,[W===0?0:(q-1)*re+1,q*re>W?W:q*re])));var pe=!this.hasPrev()||!ge,be=!this.hasNext()||!ge;return k.a.createElement("ul",Object(ce.a)({className:E()(g,l,Object(X.a)({},"".concat(g,"-disabled"),I)),style:T,unselectable:"unselectable",ref:this.savePaginationNode},it),xe,k.a.createElement("li",{title:J?V.prev_page:null,onClick:this.prev,tabIndex:pe?null:0,onKeyPress:this.runIfEnterPrev,className:E()("".concat(g,"-prev"),Object(X.a)({},"".concat(g,"-disabled"),pe)),"aria-disabled":pe},this.renderPrev(qe)),Se,k.a.createElement("li",{title:J?V.next_page:null,onClick:this.next,tabIndex:be?null:0,onKeyPress:this.runIfEnterNext,className:E()("".concat(g,"-next"),Object(X.a)({},"".concat(g,"-disabled"),be)),"aria-disabled":be},this.renderNext(Je)),k.a.createElement(b,{disabled:I,locale:V,rootPrefixCls:g,selectComponentClass:ne,selectPrefixCls:me,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:q,pageSize:re,pageSizeOptions:ie,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:Fe}))}}],[{key:"getDerivedStateFromProps",value:function(o,i){var g={};if("current"in o&&(g.current=o.current,o.current!==i.current&&(g.currentInputValue=g.current)),"pageSize"in o&&o.pageSize!==i.pageSize){var l=i.current,T=C(o.pageSize,i,o);l=l>T?T:l,"current"in o||(g.current=l,g.currentInputValue=l),g.pageSize=o.pageSize}return g}}]),d}(k.a.Component);v.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:s,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:s,locale:c.a,style:{},itemRender:f,totalBoundaryShowSizeChanger:50};var m=v},"6RRn":function(gt,ze,Y){"use strict";var ce=Y("wCXF"),X=Y("n6Qo");Y.d(ze,"b",function(){return X.a});var R=Y("IBYe"),Z=Y("6eGT"),U=Y("hW8S");Y.d(ze,"a",function(){return U.a}),ze.c=ce.b},"6eGT":function(gt,ze,Y){"use strict";function ce(X){return null}ze.a=ce},"7Cbv":function(gt,ze,Y){"use strict";var ce=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 R(){if(!ce)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ce(X)}var Z=/^(?:[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 U(P){return typeof P=="string"&&Z.test(P)}for(var O=U,j=[],B=0;B<256;++B)j.push((B+256).toString(16).substr(1));function k(P){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,y=(j[P[w+0]]+j[P[w+1]]+j[P[w+2]]+j[P[w+3]]+"-"+j[P[w+4]]+j[P[w+5]]+"-"+j[P[w+6]]+j[P[w+7]]+"-"+j[P[w+8]]+j[P[w+9]]+"-"+j[P[w+10]]+j[P[w+11]]+j[P[w+12]]+j[P[w+13]]+j[P[w+14]]+j[P[w+15]]).toLowerCase();if(!O(y))throw TypeError("Stringified UUID is invalid");return y}var D=k;function E(P,w,y){P=P||{};var b=P.random||(P.rng||R)();if(b[6]=b[6]&15|64,b[8]=b[8]&63|128,w){y=y||0;for(var c=0;c<16;++c)w[y+c]=b[c];return w}return D(b)}var A=ze.a=E},"7ahc":function(gt,ze,Y){"use strict";Y.d(ze,"a",function(){return C});var ce=Y("k1fw"),X=Y("0Owb"),R=Y("+L6B"),Z=Y("2/Rp"),U=Y("y8nQ"),O=Y("Vl3Y"),j=Y("tJVT"),B=Y("OaEy"),k=Y("2fM7"),D=Y("q1tI"),E=Y.n(D),A=Y("VrN/"),P=Y.n(A),w=Y("p77/"),y=Y.n(w),b=Y("c5Ni"),c=Y.n(b),s=k.a.Option,u={labelCol:{span:4},wrapperCol:{span:20}},f={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"]};ze.b=function(v){var m=v.callback,_=v.onCancel,x=Object(D.useState)("python"),d=Object(j.a)(x,2),h=d[0],o=d[1];function i(l){o(f[l][1])}function g(l){m(l)}return E.a.createElement(O.a,Object(X.a)({},u,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:g}),E.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},E.a.createElement(k.a,{onChange:i},Object.keys(f).map(function(l){return E.a.createElement(s,{key:l,value:l},f[l][0])}))),E.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},E.a.createElement(C,{mode:h})),E.a.createElement("div",{className:"flex-container flex-end"},E.a.createElement(Z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),E.a.createElement(Z.a,{type:"ghost",onClick:_},"\u53D6\u6D88")))};function C(v){var m=v.value,_=v.onChange,x=v.mode,d=v.options,h=d===void 0?{}:d,o=Object(D.useRef)(),i=Object(D.useState)(),g=Object(j.a)(i,2),l=g[0],T=g[1];return Object(D.useEffect)(function(){if(l){function I(F){var W=F.getValue();_&&_(W)}return l.on("change",I),function(){l.off("change",I)}}},[l,_]),Object(D.useEffect)(function(){l&&l.setOption("mode",x)},[l,x]),Object(D.useEffect)(function(){l&&((m!==l.getValue()||m==="")&&setTimeout(function(){l.setValue(m||" ")},300))},[l,m]),Object(D.useEffect)(function(){if(o.current&&!l){var I=P.a.fromTextArea(o.current,Object(ce.a)({mode:x,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},h));T(I)}},[o.current,l]),E.a.createElement("div",{className:"my-codemirror-container"},E.a.createElement("textarea",{ref:o}))}},"7qnI":function(gt,ze,Y){"use strict";var ce=Y("5Dmo"),X=Y("3S7+"),R=Y("fWQN"),Z=Y("mtLc"),U=Y("yKVA"),O=Y("879j"),j=Y("5NDa"),B=Y("5rEg"),k=Y("q1tI"),D=Y.n(k),E=Y("O2Wb"),A=Y.n(E),P=B.a.TextArea,w=function(y){Object(U.a)(c,y);var b=Object(O.a)(c);function c(){return Object(R.a)(this,c),b.apply(this,arguments)}return Object(Z.a)(c,[{key:"render",value:function(){var u=this,f=this.props,C=f.index,v=f.onAnswerChange,m=f.addChildAnswer,_=f.exerciseIsPublish,x=f.answers,d=f.activeOptionErrorIndex,h=f.flex,o=h===void 0?"0 0 1000px":h;return D.a.createElement("div",{className:A.a.flex},D.a.createElement("div",{className:"".concat(A.a.color666," mb5 mt6"),style:{flex:"0 0 90px"}},"\u7B54\u6848(\u586B\u7A7A",C+1,"):"),D.a.createElement("div",{className:"".concat(A.a.flex," ").concat(A.a.flex1),style:{flexDirection:"column"}},x.map(function(i,g){var l="".concat(C,"-").concat(g);return D.a.createElement("div",{className:"".concat(A.a.flex," ").concat(A.a.flex1),key:g},D.a.createElement("div",{className:A.a.flex1,style:{flex:o}},D.a.createElement("div",null,D.a.createElement(P,{className:l===d?A.a.error:"",spellCheck:!1,rows:4,value:i||"",defaultValue:"\u8BF7\u8F93\u5165\u53C2\u8003\u7B54\u6848".concat(g==0?"":"(\u53EF\u9009)"),onChange:function(I){return v(C,g,I.target.value)},style:{minHeight:95}}))),!_&&D.a.createElement(D.a.Fragment,null,g!=0&&D.a.createElement(X.a,{title:"\u5220\u9664"},D.a.createElement("i",{className:"".concat(A.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return u.props.deleteChildAnswer(C,g)},style:{float:"right"}})),g===0&&D.a.createElement(X.a,{title:"\u5220\u9664"},D.a.createElement("i",{className:"".concat(A.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return u.props.deleteChildAnswermain(C,g)},style:{float:"right"}})),D.a.createElement(X.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},D.a.createElement("i",{className:"".concat(A.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return m(C)},style:{float:"right",visibility:g==x.length-1?"":"hidden"}}))))})))}}]),c}(k.Component);ze.a=w},"815F":function(gt,ze,Y){"use strict";Y.d(ze,"e",function(){return j}),Y.d(ze,"c",function(){return k}),Y.d(ze,"d",function(){return D}),Y.d(ze,"a",function(){return A}),Y.d(ze,"f",function(){return P}),Y.d(ze,"b",function(){return w});var ce=Y("KQm4"),X=Y("VTBJ"),R=Y("Ff2n"),Z=Y("Zm9Q"),U=Y("Kwbf"),O=Y("OZM5");function j(y,b){return y!=null?y:b}function B(){var y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],b=new Map;function c(s){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(s||[]).forEach(function(f){var C=f.key,v=f.children;Object(U.a)(C!=null,"Tree node must have a certain key: [".concat(u).concat(C,"]"));var m=String(C);Object(U.a)(!b.has(m)||C===null||C===void 0,"Same 'key' exist in the Tree: ".concat(m)),b.set(m,!0),c(v,"".concat(u).concat(m," > "))})}c(y)}function k(y){function b(c){var s=Object(Z.a)(c);return s.map(function(u){if(!Object(O.i)(u))return Object(U.a)(!u,"Tree/TreeNode can only accept TreeNode as children."),null;var f=u.key,C=u.props,v=C.children,m=Object(R.a)(C,["children"]),_=Object(X.a)({key:f},m),x=b(v);return x.length&&(_.children=x),_}).filter(function(u){return u})}return b(y)}function D(){var y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],c=new Set(b===!0?[]:b),s=[];function u(f){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return f.map(function(v,m){var _=Object(O.h)(C?C.pos:"0",m),x=j(v.key,_),d=Object(X.a)(Object(X.a)({},v),{},{parent:C,pos:_,children:null,data:v,isStart:[].concat(Object(ce.a)(C?C.isStart:[]),[m===0]),isEnd:[].concat(Object(ce.a)(C?C.isEnd:[]),[m===f.length-1])});return s.push(d),b===!0||c.has(x)?d.children=u(v.children||[],d):d.children=[],d})}return u(y),s}function E(y,b,c){var s;c?typeof c=="string"?s=function(C){return C[c]}:typeof c=="function"&&(s=function(C){return c(C)}):s=function(C,v){return j(C.key,v)};function u(f,C,v){var m=f?f.children:y,_=f?Object(O.h)(v.pos,C):"0";if(f){var x=s(f,_),d={node:f,index:C,pos:_,key:x,parentPos:v.node?v.pos:null,level:v.level+1};b(d)}m&&m.forEach(function(h,o){u(h,o,{node:f,pos:_,level:v?v.level+1:-1})})}u(null)}function A(y){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=b.initWrapper,s=b.processEntity,u=b.onProcessFinished,f=arguments.length>2?arguments[2]:void 0,C={},v={},m={posEntities:C,keyEntities:v};return c&&(m=c(m)||m),E(y,function(_){var x=_.node,d=_.index,h=_.pos,o=_.key,i=_.parentPos,g=_.level,l={node:x,index:d,key:o,pos:h,level:g},T=j(o,h);C[h]=l,v[T]=l,l.parent=C[i],l.parent&&(l.parent.children=l.parent.children||[],l.parent.children.push(l)),s&&s(l,m)},f),u&&u(m),m}function P(y,b){var c=b.expandedKeys,s=b.selectedKeys,u=b.loadedKeys,f=b.loadingKeys,C=b.checkedKeys,v=b.halfCheckedKeys,m=b.dragOverNodeKey,_=b.dropPosition,x=b.keyEntities,d=x[y],h={eventKey:y,expanded:c.indexOf(y)!==-1,selected:s.indexOf(y)!==-1,loaded:u.indexOf(y)!==-1,loading:f.indexOf(y)!==-1,checked:C.indexOf(y)!==-1,halfChecked:v.indexOf(y)!==-1,pos:String(d?d.pos:""),dragOver:m===y&&_===0,dragOverGapTop:m===y&&_===-1,dragOverGapBottom:m===y&&_===1};return h}function w(y){var b=y.data,c=y.expanded,s=y.selected,u=y.checked,f=y.loaded,C=y.loading,v=y.halfChecked,m=y.dragOver,_=y.dragOverGapTop,x=y.dragOverGapBottom,d=y.pos,h=y.active,o=Object(X.a)(Object(X.a)({},b),{},{expanded:c,selected:s,checked:u,loaded:f,loading:C,halfChecked:v,dragOver:m,dragOverGapTop:_,dragOverGapBottom:x,pos:d,active:h});return"props"in o||Object.defineProperty(o,"props",{get:function(){return Object(U.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),y}}),o}},"8EBN":function(gt,ze,Y){(function(ce){ce(Y("VrN/"))})(function(ce){"use strict";ce.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<ce.modeInfo.length;X++){var R=ce.modeInfo[X];R.mimes&&(R.mime=R.mimes[0])}ce.findModeByMIME=function(Z){Z=Z.toLowerCase();for(var U=0;U<ce.modeInfo.length;U++){var O=ce.modeInfo[U];if(O.mime==Z)return O;if(O.mimes){for(var j=0;j<O.mimes.length;j++)if(O.mimes[j]==Z)return O}}if(/\+xml$/.test(Z))return ce.findModeByMIME("application/xml");if(/\+json$/.test(Z))return ce.findModeByMIME("application/json")},ce.findModeByExtension=function(Z){Z=Z.toLowerCase();for(var U=0;U<ce.modeInfo.length;U++){var O=ce.modeInfo[U];if(O.ext){for(var j=0;j<O.ext.length;j++)if(O.ext[j]==Z)return O}}},ce.findModeByFileName=function(Z){for(var U=0;U<ce.modeInfo.length;U++){var O=ce.modeInfo[U];if(O.file&&O.file.test(Z))return O}var j=Z.lastIndexOf("."),B=j>-1&&Z.substring(j+1,Z.length);if(B)return ce.findModeByExtension(B)},ce.findModeByName=function(Z){Z=Z.toLowerCase();for(var U=0;U<ce.modeInfo.length;U++){var O=ce.modeInfo[U];if(O.name.toLowerCase()==Z)return O;if(O.alias){for(var j=0;j<O.alias.length;j++)if(O.alias[j].toLowerCase()==Z)return O}}}})},"8hTe":function(gt,ze,Y){gt.exports={button:"button___1wy9m"}},"9Bee":function(gt,ze,Y){"use strict";var ce=Y("DYRE"),X=Y("zeV3"),R=Y("+L6B"),Z=Y("2/Rp"),U=Y("k1fw"),O=Y("9og8"),j=Y("tJVT"),B=Y("WmNS"),k=Y.n(B),D=Y("q1tI"),E=Y.n(D),A=Y("vg9a"),P=Y("DlQD"),w=Y.n(P),y=Y("rUJ1");function b(H,p){var S=H.match(/^(\s+)(?:```)/);if(S===null)return p;var K=S[1];return p.split(`
|
|
`).map(function($){var G=$.match(/^\s+/);if(G===null)return $;var Ae=Object(j.a)(G,1),$e=Ae[0];return $e.length>=K.length?$.slice(K.length):$}).join(`
|
|
`)}var c=[],s=["<ul>"],u=new w.a.Renderer,f=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function C(){c.length=0,s=["<ul>"]}var v={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function m(H,p,S,K){if(p>=H.length||H[p].level<=S)return p;var $=H[p];K.push("<li><a href='#"+$.anchor+"'>"+$.text+"</a>"),p++;var G=[];return p=m(H,p,$.level,G),G.length>0&&(K.push("<ul>"),G.forEach(function(Ae){K.push(Ae)}),K.push("</ul>")),K.push("</li>"),p=m(H,p,S,K),p}function _(){return m(c,0,0,s),s.push("</ul>"),s.join("")}var x={heading:function(p){var S=f.exec(p);if(S)return{type:"heading",raw:S[0],depth:S[1].length,text:S[2]}},fences:function(p){var S=this.rules.block.fences.exec(p);if(S){var K=S[0],$=b(K,S[3]||""),G=S[2]?S[2].trim():S[2];if(["latex","katex","math"].indexOf(G)>=0){var Ae=o(),$e=$;$=Ae,i[Ae]={type:"block",expression:$e}}return{type:"code",raw:K,lang:G,text:$}}}},d=/(?:\${2})([^\n`]+?)(?:\${2})/gi,h=0,o=function(){return"__special_katext_id_".concat(h++,"__")},i={};function g(){return i}function l(){h=0,i={}}function T(H){return H=H.replace(d,function(p,S){var K=o();return i[K]={type:"inline",expression:S},K}),H}var I=u.listitem;u.listitem=function(H){return I(T(H))};var F=u.paragraph;u.paragraph=function(H){return F(T(H))};var W=u.tablecell;u.tablecell=function(H,p){return W(T(H),p)},u.code=function(H,p,S){var K=(p||"").match(/\S*/)[0];return K?["latex","katex","math"].indexOf(K)>=0?"<p class='editormd-tex'>".concat(H,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(p,'">').concat(S?H:Object(y.escape)(H,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(S?H:Object(y.escape)(H,!0))+"</code></pre>"},u.heading=function(H,p,S){var K=this.options.headerPrefix+S.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return c.push({anchor:K,level:p,text:H}),"<h"+p+' id="'+K+'">'+H+"</h"+p+">"},w.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),w.a.use({tokenizer:x,renderer:u});var V=w.a,M=Y("SJMd"),N=Y("ulZh"),J=Y.n(N),ae=Y("m3rI"),ue=Y("Oy/b"),ve=Y("p5ED"),Te=Y("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(H,p){return(_e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(S,K){S.__proto__=K}||function(S,K){for(var $ in K)Object.prototype.hasOwnProperty.call(K,$)&&(S[$]=K[$])})(H,p)};function fe(H,p){function S(){this.constructor=H}_e(H,p),H.prototype=p===null?Object.create(p):(S.prototype=p.prototype,new S)}function ne(H,p,S,K){return new(S||(S=Promise))(function($,G){function Ae(_t){try{pt(K.next(_t))}catch(Ze){G(Ze)}}function $e(_t){try{pt(K.throw(_t))}catch(Ze){G(Ze)}}function pt(_t){var Ze;_t.done?$(_t.value):(Ze=_t.value,Ze instanceof S?Ze:new S(function(Bt){Bt(Ze)})).then(Ae,$e)}pt((K=K.apply(H,p||[])).next())})}function me(H,p){var S,K,$,G,Ae={label:0,sent:function(){if(1&$[0])throw $[1];return $[1]},trys:[],ops:[]};return G={next:$e(0),throw:$e(1),return:$e(2)},typeof Symbol=="function"&&(G[Symbol.iterator]=function(){return this}),G;function $e(pt){return function(_t){return function(Ze){if(S)throw new TypeError("Generator is already executing.");for(;Ae;)try{if(S=1,K&&($=2&Ze[0]?K.return:Ze[0]?K.throw||(($=K.return)&&$.call(K),0):K.next)&&!($=$.call(K,Ze[1])).done)return $;switch(K=0,$&&(Ze=[2&Ze[0],$.value]),Ze[0]){case 0:case 1:$=Ze;break;case 4:return Ae.label++,{value:Ze[1],done:!1};case 5:Ae.label++,K=Ze[1],Ze=[0];continue;case 7:Ze=Ae.ops.pop(),Ae.trys.pop();continue;default:if(!($=Ae.trys,($=$.length>0&&$[$.length-1])||Ze[0]!==6&&Ze[0]!==2)){Ae=0;continue}if(Ze[0]===3&&(!$||Ze[1]>$[0]&&Ze[1]<$[3])){Ae.label=Ze[1];break}if(Ze[0]===6&&Ae.label<$[1]){Ae.label=$[1],$=Ze;break}if($&&Ae.label<$[2]){Ae.label=$[2],Ae.ops.push(Ze);break}$[2]&&Ae.ops.pop(),Ae.trys.pop();continue}Ze=p.call(H,Ae)}catch(Bt){Ze=[6,Bt],K=0}finally{S=$=0}if(5&Ze[0])throw Ze[1];return{value:Ze[0]?Ze[1]:void 0,done:!0}}([pt,_t])}}}function ie(){for(var H=0,p=0,S=arguments.length;p<S;p++)H+=arguments[p].length;var K=Array(H),$=0;for(p=0;p<S;p++)for(var G=arguments[p],Ae=0,$e=G.length;Ae<$e;Ae++,$++)K[$]=G[Ae];return K}var le=function(){function H(){}return H.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},H.setAttributes=function(p,S){for(var K=0,$=S;K<$.length;K++){var G=$[K],Ae=G[0],$e=G[1];p.setAttribute(Ae,$e)}},H.createRect=function(p,S,K){var $=document.createElementNS("http://www.w3.org/2000/svg","rect");return $.setAttribute("width",p.toString()),$.setAttribute("height",S.toString()),K&&H.setAttributes($,K),$},H.createLine=function(p,S,K,$,G){var Ae=document.createElementNS("http://www.w3.org/2000/svg","line");return Ae.setAttribute("x1",p.toString()),Ae.setAttribute("y1",S.toString()),Ae.setAttribute("x2",K.toString()),Ae.setAttribute("y2",$.toString()),G&&H.setAttributes(Ae,G),Ae},H.createPolygon=function(p,S){var K=document.createElementNS("http://www.w3.org/2000/svg","polygon");return K.setAttribute("points",p),S&&H.setAttributes(K,S),K},H.createCircle=function(p,S){var K=document.createElementNS("http://www.w3.org/2000/svg","circle");return K.setAttribute("cx",(p/2).toString()),K.setAttribute("cy",(p/2).toString()),K.setAttribute("r",p.toString()),S&&H.setAttributes(K,S),K},H.createEllipse=function(p,S,K){var $=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return $.setAttribute("cx",(p/2).toString()),$.setAttribute("cy",(S/2).toString()),$.setAttribute("rx",(p/2).toString()),$.setAttribute("ry",(S/2).toString()),K&&H.setAttributes($,K),$},H.createGroup=function(p){var S=document.createElementNS("http://www.w3.org/2000/svg","g");return p&&H.setAttributes(S,p),S},H.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},H.createMarker=function(p,S,K,$,G,Ae,$e){var pt=document.createElementNS("http://www.w3.org/2000/svg","marker");return H.setAttributes(pt,[["id",p],["orient",S],["markerWidth",K.toString()],["markerHeight",$.toString()],["refX",G.toString()],["refY",Ae.toString()]]),pt.appendChild($e),pt},H.createText=function(p){var S=document.createElementNS("http://www.w3.org/2000/svg","text");return S.setAttribute("x","0"),S.setAttribute("y","0"),p&&H.setAttributes(S,p),S},H.createTSpan=function(p,S){var K=document.createElementNS("http://www.w3.org/2000/svg","tspan");return K.textContent=p,S&&H.setAttributes(K,S),K},H.createImage=function(p){var S=document.createElementNS("http://www.w3.org/2000/svg","image");return p&&H.setAttributes(S,p),S},H.createPoint=function(p,S){var K=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return K.x=p,K.y=S,K},H.createPath=function(p,S){var K=document.createElementNS("http://www.w3.org/2000/svg","path");return K.setAttribute("d",p),S&&H.setAttributes(K,S),K},H}(),q=function(){function H(){}return H.addKey=function(p){H.key=p},Object.defineProperty(H,"isLicensed",{get:function(){return!!H.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(H.key)},enumerable:!1,configurable:!0}),H}(),re=function(){function H(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return H.prototype.rasterize=function(p,S,K){var $=this;return new Promise(function(G){var Ae=K!==void 0?K:document.createElement("canvas");p===null&&($.markersOnly=!0,$.naturalSize=!1);var $e=document.createElementNS("http://www.w3.org/2000/svg","svg");$e.setAttribute("xmlns","http://www.w3.org/2000/svg"),$e.setAttribute("width",S.width.baseVal.valueAsString),$e.setAttribute("height",S.height.baseVal.valueAsString),$e.setAttribute("viewBox","0 0 "+S.viewBox.baseVal.width.toString()+" "+S.viewBox.baseVal.height.toString()),$e.innerHTML=S.innerHTML,$.naturalSize===!0?($e.width.baseVal.value=p.naturalWidth,$e.height.baseVal.value=p.naturalHeight):$.width!==void 0&&$.height!==void 0&&($e.width.baseVal.value=$.width,$e.height.baseVal.value=$.height),Ae.width=$e.width.baseVal.value,Ae.height=$e.height.baseVal.value;var pt=$e.outerHTML,_t=Ae.getContext("2d");$.markersOnly!==!0&&_t.drawImage(p,0,0,Ae.width,Ae.height);var Ze=window.URL,Bt=new Image(Ae.width,Ae.height);Bt.setAttribute("crossOrigin","anonymous");var It=new Blob([pt],{type:"image/svg+xml"}),hr=Ze.createObjectURL(It);Bt.onload=function(){_t.drawImage(Bt,0,0),Ze.revokeObjectURL(hr);var Wr=Ae.toDataURL($.imageType,$.imageQuality);G(Wr)},Bt.src=hr})},H}(),oe=function(){},ge=function(){function H(p){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+p+"_"}return Object.defineProperty(H.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),H.prototype.addClass=function(p){return this.styleSheet===void 0&&this.addStyleSheet(),p.name=""+this.classNamePrefix+p.localName,this.classes.push(p),this.styleSheet.sheet.insertRule("."+p.name+" {"+p.style+"}",this.styleSheet.sheet.cssRules.length),p},H.prototype.addRule=function(p){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(p),this.styleSheet.sheet.insertRule(p.selector+" {"+p.style+"}",this.styleSheet.sheet.cssRules.length)},H.prototype.addStyleSheet=function(){var p;this.styleSheet=document.createElement("style"),((p=this.styleSheetRoot)!==null&&p!==void 0?p:document.head).appendChild(this.styleSheet),this.addRule(new Se("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Se("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new Se("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Ee("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Ee("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},H.prototype.removeStyleSheet=function(){var p;this.styleSheet&&(((p=this.styleSheetRoot)!==null&&p!==void 0?p:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},H}(),Se=function(H,p){this.selector=H,this.style=p},Ee=function(H,p){this.localName=H,this.style=p},Re=function(){function H(p,S,K,$,G){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=p,this.displayMode=S,this.markerItems=K,this.uiStyleSettings=$,this.styles=G,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return H.prototype.show=function(p){var S=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=p,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var K=document.createElement("div");K.className=this.toolbarBlockStyleClass.name,K.style.whiteSpace="nowrap",this.uiContainer.appendChild(K),this.addActionButton(K,'<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(K,'<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(K,'<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(K,'<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(K,'<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(K,'<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(K,'<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(K,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(G){var Ae=document.createElement("div");Ae.className=""+S.toolbarButtonStyleClass.name,Ae.setAttribute("data-type-name",G.typeName),Ae.innerHTML=G.icon,Ae.addEventListener("click",function(){S.markerToolbarButtonClicked(Ae,G)}),S.buttons.push(Ae),S.markerButtons.push(Ae)}),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 $=document.createElement("div");$.className=this.toolbarBlockStyleClass.name,$.style.whiteSpace="nowrap",$.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild($),this.addActionButton($,'<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($,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},H.prototype.addButtonClickListener=function(p){this.buttonClickListeners.push(p)},H.prototype.removeButtonClickListener=function(p){this.buttonClickListeners.indexOf(p)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(p),1)},H.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},H.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var p=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var S=0;S<this.markerButtons.length;S++)S<p||S===p&&this.markerButtons.length-1===p?this.markerButtonBlock.appendChild(this.markerButtons[S]):(S===p&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[S]))}},H.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},H.prototype.resetButtonStyles=function(){var p=this;this.buttons.forEach(function(S){S.className=S.className.replace(p.uiStyleSettings.toolbarButtonStyleColorsClassName?p.uiStyleSettings.toolbarButtonStyleColorsClassName:p.toolbarButtonStyleColorsClass.name,"").trim(),S.className=S.className.replace(p.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?p.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:p.toolbarActiveButtonStyleColorsClass.name,"").trim(),S.className+=" "+(p.uiStyleSettings.toolbarButtonStyleColorsClassName?p.uiStyleSettings.toolbarButtonStyleColorsClassName:p.toolbarButtonStyleColorsClass.name)})},H.prototype.addActionButton=function(p,S,K){var $=this,G=document.createElement("div");switch(G.className=""+this.toolbarButtonStyleClass.name,G.innerHTML=S,G.setAttribute("data-action",K),G.addEventListener("click",function(){$.actionToolbarButtonClicked(G,K)}),K){case"select":G.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":G.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":G.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":G.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":G.style.fill=this.uiStyleSettings.closeButtonColor}p.appendChild(G),this.buttons.push(G)},H.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Ee("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 Ee("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Ee("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new Ee("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 Ee("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var p=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Ee("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*p)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*p)+`px;
|
|
padding: `+p+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Ee("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Ee("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new Se("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new Se("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},H.prototype.markerToolbarButtonClicked=function(p,S){this.setActiveButton(p),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(K){return K("marker",S)}),this.markerButtonOverflowBlock.style.display="none"},H.prototype.actionToolbarButtonClicked=function(p,S){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(K){return K("action",S)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},H.prototype.setActiveButton=function(p){this.resetButtonStyles(),p.className=p.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),p.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},H.prototype.setActiveMarkerButton=function(p){var S=this.markerButtons.find(function(K){return K.getAttribute("data-type-name")===p});S&&this.setActiveButton(S)},H.prototype.setCurrentMarker=function(p){var S=this;this.currentMarker=p,this.buttons.filter(function(K){return/delete|notes/.test(K.getAttribute("data-action"))}).forEach(function(K){S.currentMarker===void 0?(K.style.fillOpacity="0.4",K.style.pointerEvents="none"):(K.style.fillOpacity="1",K.style.pointerEvents="all")})},H}(),Pe=function(){function H(p,S,K,$){this.panels=[],this.panelButtons=[],this.markerjsContainer=p,this.displayMode=S,this.uiStyleSettings=K,this.styles=$,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return H.prototype.addStyles=function(){var p;this.toolboxStyleClass=this.styles.addClass(new Ee("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 Ee("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var S=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Ee("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Ee("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Ee("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 Ee("toolbox-panel-row_colors",`
|
|
background-color: `+((p=this.uiStyleSettings.toolboxBackgroundColor)!==null&&p!==void 0?p:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new Ee("toolbox_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.toolboxButtonStyleColorsClass=this.styles.addClass(new Ee("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Ee("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new Se("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new Se("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},H.prototype.show=function(p){var S;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=p,this.uiContainer.className=this.toolboxStyleClass.name+" "+((S=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&S!==void 0?S:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},H.prototype.setPanelButtons=function(p){var S,K,$=this;this.panels=p,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((S=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&S!==void 0?S:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((K=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&K!==void 0?K:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(G){var Ae;G.uiStyleSettings=$.uiStyleSettings;var $e=document.createElement("div");$e.className=$.toolboxButtonStyleClass.name+" "+((Ae=$.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Ae!==void 0?Ae:$.toolboxButtonStyleColorsClass.name),$e.innerHTML=G.icon,$e.title=G.title,$e.addEventListener("click",function(){$.panelButtonClick(G)}),$.panelButtons.push($e),$.buttonRow.appendChild($e)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},H.prototype.panelButtonClick=function(p){var S=this,K=-1;if(p!==this.activePanel){K=this.panels.indexOf(p),this.panelRow.innerHTML="";var $=p.getUi();$.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild($),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=p}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){S.displayMode==="inline"?S.panelRow.style.display="none":S.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(G,Ae){var $e,pt;G.className=S.toolboxButtonStyleClass.name+" "+(Ae===K?""+(($e=S.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&$e!==void 0?$e:S.toolboxActiveButtonStyleColorsClass.name):""+((pt=S.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&pt!==void 0?pt:S.toolboxButtonStyleColorsClass.name))})},H}(),Ue=function(H,p){this.title=H,this.icon=p},He=function(H){function p(S,K,$,G){var Ae=H.call(this,S,G||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return Ae.colors=[],Ae.addTransparent=!1,Ae.colorBoxes=[],Ae.colors=K,Ae.currentColor=$,Ae.setCurrentColor=Ae.setCurrentColor.bind(Ae),Ae.getColorBox=Ae.getColorBox.bind(Ae),Ae}return fe(p,H),p.prototype.getUi=function(){var S=this,K=document.createElement("div");return K.style.overflow="hidden",K.style.whiteSpace="nowrap",this.colors.forEach(function($){var G=S.getColorBox($);K.appendChild(G),S.colorBoxes.push(G)}),K},p.prototype.getColorBox=function(S){var K=this,$=this.uiStyleSettings.toolbarHeight/4,G=this.uiStyleSettings.toolbarHeight-$,Ae=document.createElement("div");Ae.style.display="inline-block",Ae.style.boxSizing="content-box",Ae.style.width=G-2+"px",Ae.style.height=G-2+"px",Ae.style.padding="1px",Ae.style.marginRight="2px",Ae.style.marginBottom="2px",Ae.style.borderWidth="2px",Ae.style.borderStyle="solid",Ae.style.borderRadius=(G+2)/2+"px",Ae.style.borderColor=S===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",Ae.addEventListener("click",function(){K.setCurrentColor(S,Ae)});var $e=document.createElement("div");return $e.style.display="inline-block",$e.style.width=G-2+"px",$e.style.height=G-2+"px",$e.style.backgroundColor=S,$e.style.borderRadius=G/2+"px",S==="transparent"&&($e.style.fill=this.uiStyleSettings.toolboxAccentColor,$e.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>`),Ae.appendChild($e),Ae},p.prototype.setCurrentColor=function(S,K){var $=this;this.currentColor=S,this.colorBoxes.forEach(function(G){G.style.borderColor=G===K?$.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(S)},p}(Ue),Fe=function(){function H(p,S,K){this._state="new",this._isSelected=!1,this._container=p,this._overlayContainer=S,this.globalSettings=K,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(H.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),H.prototype.ownsTarget=function(p){return!1},Object.defineProperty(H.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),H.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},H.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},H.prototype.pointerDown=function(p,S){},H.prototype.dblClick=function(p,S){},H.prototype.manipulate=function(p){},H.prototype.pointerUp=function(p){this.stateChanged()},H.prototype.dispose=function(){},H.prototype.addMarkerVisualToContainer=function(p){this.container.childNodes.length>0?this.container.insertBefore(p,this.container.childNodes[0]):this.container.appendChild(p)},H.prototype.getState=function(){return{typeName:H.typeName,state:this.state,notes:this.notes}},H.prototype.restoreState=function(p){this._state=p.state,this.notes=p.notes},H.prototype.scale=function(p,S){},H.prototype.colorChanged=function(p){this.onColorChanged&&this.onColorChanged(p),this.stateChanged()},H.prototype.fillColorChanged=function(p){this.onFillColorChanged&&this.onFillColorChanged(p),this.stateChanged()},H.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var p=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),p.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(p)&&this.onStateChanged(this)}},H.typeName="MarkerBase",H}(),Ne=function(){function H(){this.findGripByVisual=this.findGripByVisual.bind(this)}return H.prototype.findGripByVisual=function(p){return this.topLeft.ownsTarget(p)?this.topLeft:this.topCenter.ownsTarget(p)?this.topCenter:this.topRight.ownsTarget(p)?this.topRight:this.centerLeft.ownsTarget(p)?this.centerLeft:this.centerRight.ownsTarget(p)?this.centerRight:this.bottomLeft.ownsTarget(p)?this.bottomLeft:this.bottomCenter.ownsTarget(p)?this.bottomCenter:this.bottomRight.ownsTarget(p)?this.bottomRight:void 0},H}(),qe=function(){function H(){this.GRIP_SIZE=10,this.visual=le.createGroup(),this.visual.appendChild(le.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(le.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return H.prototype.ownsTarget=function(p){return p===this.visual||p===this.visual.childNodes[0]||p===this.visual.childNodes[1]},H}(),Je=function(){function H(){}return H.toITransformMatrix=function(p){return{a:p.a,b:p.b,c:p.c,d:p.d,e:p.e,f:p.f}},H.toSVGMatrix=function(p,S){return p.a=S.a,p.b=S.b,p.c=S.c,p.d=S.d,p.e=S.e,p.f=S.f,p},H}(),it=function(H){function p(S,K,$){var G=H.call(this,S,K,$)||this;return G.left=0,G.top=0,G.width=0,G.height=0,G.defaultSize={x:50,y:20},G.offsetX=0,G.offsetY=0,G.rotationAngle=0,G.CB_DISTANCE=10,G._suppressMarkerCreateEvent=!1,G.container.transform.baseVal.appendItem(le.createTransform()),G.setupControlBox(),G}return fe(p,H),Object.defineProperty(p.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"visual",{get:function(){return this._visual},set:function(S){this._visual=S;var K=le.createTransform();this._visual.transform.baseVal.appendItem(K)},enumerable:!1,configurable:!0}),p.prototype.ownsTarget=function(S){return!!H.prototype.ownsTarget.call(this,S)||!!(this.controlGrips.findGripByVisual(S)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(S))},p.prototype.pointerDown=function(S,K){H.prototype.pointerDown.call(this,S,K),this.state==="new"&&(this.left=S.x,this.top=S.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var $=this.unrotatePoint(S);if(this.manipulationStartX=$.x,this.manipulationStartY=$.y,this.offsetX=$.x-this.left,this.offsetY=$.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(K),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(K)){this.activeGrip=this.rotatorGrip;var G=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=G.x-this.width/2,this.top=G.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var Ae=this.container.transform.baseVal.getItem(0);Ae.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(Ae,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},p.prototype.pointerUp=function(S){var K=this.state;H.prototype.pointerUp.call(this,S),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(S),this._state="select",K==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},p.prototype.moveVisual=function(S){this.visual.style.transform="translate("+S.x+"px, "+S.y+"px)"},p.prototype.manipulate=function(S){var K=this.unrotatePoint(S);this.state==="creating"?this.resize(S):this.state==="move"?(this.left=this.manipulationStartLeft+(K.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(K.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(K):this.state==="rotate"&&this.rotate(S)},p.prototype.resize=function(S){var K=this.manipulationStartLeft,$=this.manipulationStartWidth,G=this.manipulationStartTop,Ae=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:K=this.manipulationStartLeft+S.x-this.manipulationStartX,$=this.manipulationStartWidth+this.manipulationStartLeft-K;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:$=this.manipulationStartWidth+S.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:G=this.manipulationStartTop+S.y-this.manipulationStartY,Ae=this.manipulationStartHeight+this.manipulationStartTop-G;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:Ae=this.manipulationStartHeight+S.y-this.manipulationStartY}$>=0?(this.left=K,this.width=$):(this.left=K+$,this.width=-$),Ae>=0?(this.top=G,this.height=Ae):(this.top=G+Ae,this.height=-Ae),this.setSize()},p.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},p.prototype.rotate=function(S){if(Math.abs(S.x-this.centerX)>.1){var K=Math.sign(S.x-this.centerX);this.rotationAngle=180*Math.atan((S.y-this.centerY)/(S.x-this.centerX))/Math.PI+90*K,this.applyRotation()}},p.prototype.applyRotation=function(){var S=this.container.transform.baseVal.getItem(0);S.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(S,0)},p.prototype.rotatePoint=function(S){if(this.rotationAngle===0)return S;var K=this.container.getCTM(),$=le.createPoint(S.x,S.y);return{x:($=$.matrixTransform(K)).x,y:$.y}},p.prototype.unrotatePoint=function(S){if(this.rotationAngle===0)return S;var K=this.container.getCTM();K=K.inverse();var $=le.createPoint(S.x,S.y);return{x:($=$.matrixTransform(K)).x,y:$.y}},p.prototype.select=function(){H.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},p.prototype.deselect=function(){H.prototype.deselect.call(this),this.controlBox.style.display="none"},p.prototype.setupControlBox=function(){this.controlBox=le.createGroup();var S=le.createTransform();S.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(S),this.container.appendChild(this.controlBox),this.controlRect=le.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=le.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new Ne,this.addControlGrips(),this.controlBox.style.display="none"},p.prototype.adjustControlBox=function(){var S=this.controlBox.transform.baseVal.getItem(0);S.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(S,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()},p.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()},p.prototype.createGrip=function(){var S=new qe;return S.visual.transform.baseVal.appendItem(le.createTransform()),this.controlBox.appendChild(S.visual),S},p.prototype.positionGrips=function(){var S=this.controlGrips.topLeft.GRIP_SIZE,K=-S/2,$=K,G=(this.width+this.CB_DISTANCE)/2-S/2,Ae=(this.height+this.CB_DISTANCE)/2-S/2,$e=this.height+this.CB_DISTANCE-S/2,pt=this.width+this.CB_DISTANCE-S/2;this.positionGrip(this.controlGrips.topLeft.visual,K,$),this.positionGrip(this.controlGrips.topCenter.visual,G,$),this.positionGrip(this.controlGrips.topRight.visual,pt,$),this.positionGrip(this.controlGrips.centerLeft.visual,K,Ae),this.positionGrip(this.controlGrips.centerRight.visual,pt,Ae),this.positionGrip(this.controlGrips.bottomLeft.visual,K,$e),this.positionGrip(this.controlGrips.bottomCenter.visual,G,$e),this.positionGrip(this.controlGrips.bottomRight.visual,pt,$e),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,G,$-3*this.CB_DISTANCE)},p.prototype.positionGrip=function(S,K,$){var G=S.transform.baseVal.getItem(0);G.setTranslate(K,$),S.transform.baseVal.replaceItem(G,0)},p.prototype.hideControlBox=function(){this.controlBox.style.display="none"},p.prototype.showControlBox=function(){this.controlBox.style.display=""},p.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:Je.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:Je.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},H.prototype.getState.call(this))},p.prototype.restoreState=function(S){H.prototype.restoreState.call(this,S);var K=S;this.left=K.left,this.top=K.top,this.width=K.width,this.height=K.height,this.rotationAngle=K.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(Je.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,K.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(Je.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,K.containerTransformMatrix))},p.prototype.scale=function(S,K){H.prototype.scale.call(this,S,K);var $=this.rotatePoint({x:this.left,y:this.top}),G=this.unrotatePoint({x:$.x*S,y:$.y*K});this.left=G.x,this.top=G.y,this.width=this.width*S,this.height=this.height*K,this.adjustControlBox()},p}(Fe),rt=function(H){function p(S,K,$){var G=H.call(this,S,K,$)||this;return G.fillColor="transparent",G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.opacity=1,G.setStrokeColor=G.setStrokeColor.bind(G),G.setFillColor=G.setFillColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.createVisual=G.createVisual.bind(G),G}return fe(p,H),p.prototype.ownsTarget=function(S){return!(!H.prototype.ownsTarget.call(this,S)&&S!==this.visual)},p.prototype.createVisual=function(){this.visual=le.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},p.prototype.pointerDown=function(S,K){H.prototype.pointerDown.call(this,S,K),this.state==="new"&&(this.createVisual(),this.moveVisual(S),this._state="creating")},p.prototype.manipulate=function(S){H.prototype.manipulate.call(this,S)},p.prototype.resize=function(S){H.prototype.resize.call(this,S),this.setSize()},p.prototype.setSize=function(){H.prototype.setSize.call(this),le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},p.prototype.pointerUp=function(S){H.prototype.pointerUp.call(this,S),this.setSize()},p.prototype.setStrokeColor=function(S){this.strokeColor=S,this.visual&&le.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(S),this.stateChanged()},p.prototype.setFillColor=function(S){this.fillColor=S,this.visual&&le.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},p.prototype.setStrokeWidth=function(S){this.strokeWidth=S,this.visual&&le.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},p.prototype.setStrokeDasharray=function(S){this.strokeDasharray=S,this.visual&&le.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},p.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},H.prototype.getState.call(this))},p.prototype.restoreState=function(S){var K=S;this.fillColor=K.fillColor,this.strokeColor=K.strokeColor,this.strokeWidth=K.strokeWidth,this.strokeDasharray=K.strokeDasharray,this.opacity=K.opacity,this.createVisual(),H.prototype.restoreState.call(this,S),this.setSize()},p.prototype.scale=function(S,K){H.prototype.scale.call(this,S,K),this.setSize()},p.title="Rectangle marker",p}(it),ht=function(H){function p(S,K,$,G){var Ae=H.call(this,S,G||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return Ae.widths=[],Ae.widthBoxes=[],Ae.widths=K,Ae.currentWidth=$,Ae.setCurrentWidth=Ae.setCurrentWidth.bind(Ae),Ae}return fe(p,H),p.prototype.getUi=function(){var S=this,K=document.createElement("div");return K.style.display="flex",K.style.overflow="hidden",K.style.flexGrow="2",this.widths.forEach(function($){var G=document.createElement("div");G.style.display="flex",G.style.flexGrow="2",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.borderColor=$===S.currentWidth?S.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){S.setCurrentWidth($,G)}),K.appendChild(G);var Ae=document.createElement("div");Ae.innerText=$.toString(),Ae.style.marginRight="5px",G.appendChild(Ae);var $e=document.createElement("div");$e.style.minHeight="20px",$e.style.flexGrow="2",$e.style.display="flex",$e.style.alignItems="center";var pt=document.createElement("hr");pt.style.minWidth="20px",pt.style.border="0px",pt.style.borderTop=$+"px solid "+S.uiStyleSettings.toolboxColor,pt.style.flexGrow="2",$e.appendChild(pt),G.appendChild($e),S.widthBoxes.push(G)}),K},p.prototype.setCurrentWidth=function(S,K){var $=this;this.currentWidth=S,this.widthBoxes.forEach(function(G){G.style.borderColor=G===K?$.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},p}(Ue),ft=function(H){function p(S,K,$,G){var Ae=H.call(this,S,G||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return Ae.styles=[],Ae.styleBoxes=[],Ae.styles=K,Ae.currentStyle=$,Ae.setCurrentStyle=Ae.setCurrentStyle.bind(Ae),Ae}return fe(p,H),p.prototype.getUi=function(){var S=this,K=document.createElement("div");return K.style.display="flex",K.style.overflow="hidden",K.style.flexGrow="2",this.styles.forEach(function($){var G=document.createElement("div");G.style.display="flex",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.overflow="hidden",G.style.maxWidth=100/S.styles.length-5+"%",G.style.borderColor=$===S.currentStyle?S.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){S.setCurrentStyle($,G)}),K.appendChild(G);var Ae=document.createElement("div");Ae.style.minHeight="20px",Ae.style.flexGrow="2",Ae.style.overflow="hidden";var $e=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+S.uiStyleSettings.toolboxColor+'" stroke-width="3" '+($!==""?'stroke-dasharray="'+$+'"':"")+` />
|
|
</svg>`;Ae.innerHTML=$e,G.appendChild(Ae),S.styleBoxes.push(G)}),K},p.prototype.setCurrentStyle=function(S,K){var $=this;this.currentStyle=S,this.styleBoxes.forEach(function(G){G.style.borderColor=G===K?$.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},p}(Ue),ke=function(H){function p(S,K,$){var G=H.call(this,S,K,$)||this;return G.strokeColor=$.defaultColor,G.strokeWidth=$.defaultStrokeWidth,G.strokeDasharray=$.defaultStrokeDasharray,G.strokePanel=new He("Line color",$.defaultColorSet,$.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new ht("Line width",$.defaultStrokeWidths,$.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new ft("Line style",$.defaultStrokeDasharrays,$.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return fe(p,H),Object.defineProperty(p.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),p.prototype.getState=function(){var S=H.prototype.getState.call(this);return S.typeName=p.typeName,S},p.typeName="FrameMarker",p.title="Frame marker",p.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',p}(rt),Le=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},Ge=function(H){function p(S,K,$){var G=H.call(this,S,K,$)||this;return G.x1=0,G.y1=0,G.x2=0,G.y2=0,G.defaultLength=50,G.manipulationStartX=0,G.manipulationStartY=0,G.manipulationStartX1=0,G.manipulationStartY1=0,G.manipulationStartX2=0,G.manipulationStartY2=0,G.setupControlBox(),G}return fe(p,H),p.prototype.ownsTarget=function(S){return!!H.prototype.ownsTarget.call(this,S)||!(!this.grip1.ownsTarget(S)&&!this.grip2.ownsTarget(S))},p.prototype.pointerDown=function(S,K){H.prototype.pointerDown.call(this,S,K),this.manipulationStartX=S.x,this.manipulationStartY=S.y,this.state==="new"&&(this.x1=S.x,this.y1=S.y,this.x2=S.x,this.y2=S.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(K)?this.activeGrip=this.grip1:this.grip2.ownsTarget(K)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},p.prototype.pointerUp=function(S){var K=this.state;H.prototype.pointerUp.call(this,S),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(S),this._state="select",K==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},p.prototype.adjustVisual=function(){},p.prototype.manipulate=function(S){this.state==="creating"?this.resize(S):this.state==="move"?(this.x1=this.manipulationStartX1+S.x-this.manipulationStartX,this.y1=this.manipulationStartY1+S.y-this.manipulationStartY,this.x2=this.manipulationStartX2+S.x-this.manipulationStartX,this.y2=this.manipulationStartY2+S.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(S)},p.prototype.resize=function(S){switch(this.activeGrip){case this.grip1:this.x1=S.x,this.y1=S.y;break;case this.grip2:case void 0:this.x2=S.x,this.y2=S.y}this.adjustVisual(),this.adjustControlBox()},p.prototype.select=function(){H.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},p.prototype.deselect=function(){H.prototype.deselect.call(this),this.controlBox.style.display="none"},p.prototype.setupControlBox=function(){this.controlBox=le.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},p.prototype.adjustControlBox=function(){this.positionGrips()},p.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},p.prototype.createGrip=function(){var S=new qe;return S.visual.transform.baseVal.appendItem(le.createTransform()),this.controlBox.appendChild(S.visual),S},p.prototype.positionGrips=function(){var S=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-S/2,this.y1-S/2),this.positionGrip(this.grip2.visual,this.x2-S/2,this.y2-S/2)},p.prototype.positionGrip=function(S,K,$){var G=S.transform.baseVal.getItem(0);G.setTranslate(K,$),S.transform.baseVal.replaceItem(G,0)},p.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},H.prototype.getState.call(this))},p.prototype.restoreState=function(S){H.prototype.restoreState.call(this,S);var K=S;this.x1=K.x1,this.y1=K.y1,this.x2=K.x2,this.y2=K.y2},p.prototype.scale=function(S,K){H.prototype.scale.call(this,S,K),this.x1=this.x1*S,this.y1=this.y1*K,this.x2=this.x2*S,this.y2=this.y2*K,this.adjustVisual(),this.adjustControlBox()},p}(Fe),Ke=function(H){function p(S,K,$){var G=H.call(this,S,K,$)||this;return G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.setStrokeColor=G.setStrokeColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.strokeColor=$.defaultColor,G.strokeWidth=$.defaultStrokeWidth,G.strokeDasharray=$.defaultStrokeDasharray,G.strokePanel=new He("Line color",$.defaultColorSet,$.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new ht("Line width",$.defaultStrokeWidths,$.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new ft("Line style",$.defaultStrokeDasharrays,$.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return fe(p,H),p.prototype.ownsTarget=function(S){return!(!H.prototype.ownsTarget.call(this,S)&&S!==this.visual&&S!==this.selectorLine&&S!==this.visibleLine)},p.prototype.createVisual=function(){this.visual=le.createGroup(),this.selectorLine=le.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=le.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},p.prototype.pointerDown=function(S,K){H.prototype.pointerDown.call(this,S,K),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},p.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),le.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),le.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),le.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},p.prototype.setStrokeColor=function(S){this.strokeColor=S,this.adjustVisual(),this.colorChanged(S)},p.prototype.setStrokeWidth=function(S){this.strokeWidth=S,this.adjustVisual()},p.prototype.setStrokeDasharray=function(S){this.strokeDasharray=S,this.adjustVisual(),this.stateChanged()},Object.defineProperty(p.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),p.prototype.getState=function(){var S=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},H.prototype.getState.call(this));return S.typeName=p.typeName,S},p.prototype.restoreState=function(S){H.prototype.restoreState.call(this,S);var K=S;this.strokeColor=K.strokeColor,this.strokeWidth=K.strokeWidth,this.strokeDasharray=K.strokeDasharray,this.createVisual(),this.adjustVisual()},p.typeName="LineMarker",p.title="Line marker",p.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',p}(Ge),Me=function(H){function p(S,K,$,G){var Ae=H.call(this,S,G||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return Ae.fonts=[],Ae.fontBoxes=[],Ae.fonts=K,Ae.currentFont=$,Ae.setCurrentFont=Ae.setCurrentFont.bind(Ae),Ae}return fe(p,H),p.prototype.getUi=function(){var S=this,K=document.createElement("div");return K.style.overflow="hidden",K.style.flexGrow="2",this.fonts.forEach(function($){var G=document.createElement("div");G.style.display="inline-block",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.overflow="hidden",G.style.maxWidth=100/S.fonts.length-5+"%",G.style.borderColor=$===S.currentFont?S.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){S.setCurrentFont($,G)}),K.appendChild(G);var Ae=document.createElement("div");Ae.style.display="flex",Ae.style.minHeight="20px",Ae.style.flexGrow="2",Ae.style.fontFamily=$,Ae.style.overflow="hidden";var $e=document.createElement("div");$e.style.whiteSpace="nowrap",$e.style.overflow="hidden",$e.style.textOverflow="ellipsis",$e.innerHTML="The quick brown fox jumps over the lazy dog",Ae.appendChild($e),G.appendChild(Ae),S.fontBoxes.push(G)}),K},p.prototype.setCurrentFont=function(S,K){var $=this;this.currentFont=S,this.fontBoxes.forEach(function(G){G.style.borderColor=G===K?$.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},p}(Ue),je=function(H){function p(S,K,$){var G=H.call(this,S,K,$)||this;return G.color="transparent",G.padding=5,G.DEFAULT_TEXT="your text here",G.text=G.DEFAULT_TEXT,G.isMoved=!1,G.color=$.defaultColor,G.fontFamily=$.defaultFontFamily,G.defaultSize={x:100,y:30},G.setColor=G.setColor.bind(G),G.setFont=G.setFont.bind(G),G.renderText=G.renderText.bind(G),G.sizeText=G.sizeText.bind(G),G.textEditDivClicked=G.textEditDivClicked.bind(G),G.showTextEditor=G.showTextEditor.bind(G),G.setSize=G.setSize.bind(G),G.positionTextEditor=G.positionTextEditor.bind(G),G.colorPanel=new He("Color",$.defaultColorSet,$.defaultColor),G.colorPanel.onColorChanged=G.setColor,G.fontFamilyPanel=new Me("Font",$.defaultFontFamilies,$.defaultFontFamily),G.fontFamilyPanel.onFontChanged=G.setFont,G}return fe(p,H),p.prototype.ownsTarget=function(S){if(H.prototype.ownsTarget.call(this,S)||S===this.visual||S===this.textElement||S===this.bgRectangle)return!0;var K=!1;return this.textElement.childNodes.forEach(function($){$===S&&(K=!0)}),K},p.prototype.createVisual=function(){this.visual=le.createGroup(),this.bgRectangle=le.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=le.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(le.createTransform()),this.textElement.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},p.prototype.pointerDown=function(S,K){H.prototype.pointerDown.call(this,S,K),this.isMoved=!1,this.pointerDownPoint=S,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(S),this._state="creating")},p.prototype.renderText=function(){var S=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(K){S.textElement.appendChild(le.createTSpan(K.trim()===""?" ":K.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},p.prototype.getTextScale=function(){var S=this.textElement.getBBox(),K=1;if(S.width>0&&S.height>0){var $=(1*this.width-this.width*this.padding*2/100)/S.width,G=(1*this.height-this.height*this.padding*2/100)/S.height;K=Math.min($,G)}return K},p.prototype.getTextPosition=function(S){var K=this.textElement.getBBox(),$=0,G=0;return K.width>0&&K.height>0&&($=(this.width-K.width*S)/2,G=this.height/2-K.height*S/2),{x:$,y:G}},p.prototype.sizeText=function(){var S=this.textElement.getBBox(),K=this.getTextScale(),$=this.getTextPosition(K);$.y-=S.y*K,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+$.x+"px, "+$.y+"px) scale("+K+", "+K+")":(this.textElement.transform.baseVal.getItem(0).setTranslate($.x,$.y),this.textElement.transform.baseVal.getItem(1).setScale(K,K))},p.prototype.manipulate=function(S){H.prototype.manipulate.call(this,S),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(S.x-this.pointerDownPoint.x)>5||Math.abs(S.y-this.pointerDownPoint.y)>5)},p.prototype.resize=function(S){H.prototype.resize.call(this,S),this.isMoved=!0,this.setSize(),this.sizeText()},p.prototype.setSize=function(){H.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},p.prototype.pointerUp=function(S){var K=this.state;K==="creating"&&(this._suppressMarkerCreateEvent=!0),H.prototype.pointerUp.call(this,S),this.setSize(),(K==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},p.prototype.showTextEditor=function(){var S=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(K){K.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var K=Number.parseFloat(S.textEditor.style.fontSize);S.textEditor.clientWidth>=Number.parseInt(S.textEditor.style.maxWidth)&&K>.9;)K-=.1,S.textEditor.style.fontSize=Math.max(K,.9)+"em"}),this.textEditor.addEventListener("keyup",function(K){K.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(K){if(K.clipboardData){var $=K.clipboardData.getData("text"),G=window.getSelection();if(!G.rangeCount)return!1;G.deleteFromDocument(),G.getRangeAt(0).insertNode(document.createTextNode($)),K.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){S.textEditDivClicked(S.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},p.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var S=this.getTextScale(),K=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),$=this.textElement.getBBox(),G={x:$.width*S,y:$.height*S};K.x-=G.x/2,K.y-=G.y/2,this.textEditor.style.top=K.y+"px",this.textEditor.style.left=K.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-K.x+"px",this.textEditor.style.fontSize=Math.max(16*S,12)+"px",this.textElement.style.display="none"}},p.prototype.textEditDivClicked=function(S){this.text=S.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},p.prototype.select=function(){H.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},p.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),H.prototype.deselect.call(this)},p.prototype.dblClick=function(S,K){H.prototype.dblClick.call(this,S,K),this.showTextEditor()},p.prototype.setColor=function(S){this.textElement&&le.setAttributes(this.textElement,[["fill",S]]),this.color=S,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(S)},p.prototype.setFont=function(S){this.textElement&&le.setAttributes(this.textElement,[["font-family",S]]),this.fontFamily=S,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},p.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},p.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(p.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),p.prototype.getState=function(){var S=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},H.prototype.getState.call(this));return S.typeName=p.typeName,S},p.prototype.restoreState=function(S){var K=S;this.color=K.color,this.fontFamily=K.fontFamily,this.padding=K.padding,this.text=K.text,this.createVisual(),H.prototype.restoreState.call(this,S),this.setSize()},p.prototype.scale=function(S,K){H.prototype.scale.call(this,S,K),this.setSize(),this.sizeText(),this.positionTextEditor()},p.typeName="TextMarker",p.title="Text marker",p.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>',p}(it),xe=function(H){function p(S,K,$){var G=H.call(this,S,K,$)||this;return G.color="transparent",G.lineWidth=3,G.drawing=!1,G.pixelRatio=1,G.color=$.defaultColor,G.lineWidth=$.defaultStrokeWidth,G.pixelRatio=$.freehandPixelRatio,G.setColor=G.setColor.bind(G),G.addCanvas=G.addCanvas.bind(G),G.finishCreation=G.finishCreation.bind(G),G.setLineWidth=G.setLineWidth.bind(G),G.colorPanel=new He("Color",$.defaultColorSet,$.defaultColor),G.colorPanel.onColorChanged=G.setColor,G.lineWidthPanel=new ht("Line width",$.defaultStrokeWidths,$.defaultStrokeWidth),G.lineWidthPanel.onWidthChanged=G.setLineWidth,G}return fe(p,H),p.prototype.ownsTarget=function(S){return!(!H.prototype.ownsTarget.call(this,S)&&S!==this.visual&&S!==this.drawingImage)},p.prototype.createVisual=function(){this.visual=le.createGroup(),this.drawingImage=le.createImage(),this.visual.appendChild(this.drawingImage);var S=le.createTransform();this.visual.transform.baseVal.appendItem(S),this.addMarkerVisualToContainer(this.visual)},p.prototype.pointerDown=function(S,K){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(S.x,S.y),this.drawing=!0):H.prototype.pointerDown.call(this,S,K)},p.prototype.manipulate=function(S){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(S.x,S.y),this.canvasContext.stroke()):H.prototype.manipulate.call(this,S)},p.prototype.resize=function(S){H.prototype.resize.call(this,S),le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},p.prototype.pointerUp=function(S){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):H.prototype.pointerUp.call(this,S)},p.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)},p.prototype.select=function(){this.state==="creating"&&this.finishCreation(),H.prototype.select.call(this)},p.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),H.prototype.deselect.call(this)},p.prototype.finishCreation=function(){for(var S=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),K=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],$=K[0],G=K[1],Ae=K[2],$e=K[3],pt=!1,_t=0;_t<this.canvasElement.height;_t++)for(var Ze=0;Ze<this.canvasElement.width;Ze++)S.data[_t*this.canvasElement.width*4+4*Ze+3]>0&&(pt=!0,_t<G&&(G=_t),Ze<$&&($=Ze),_t>$e&&($e=_t),Ze>Ae&&(Ae=Ze));if(pt){this.left=$/this.pixelRatio,this.top=G/this.pixelRatio,this.width=(Ae-$)/this.pixelRatio,this.height=($e-G)/this.pixelRatio;var Bt=document.createElement("canvas");Bt.width=Ae-$,Bt.height=$e-G,Bt.getContext("2d").putImageData(this.canvasContext.getImageData($,G,Ae-$,$e-G),0,0),this.drawingImgUrl=Bt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},p.prototype.setDrawingImage=function(){le.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},p.prototype.setColor=function(S){this.color=S,this.colorChanged(S)},p.prototype.setLineWidth=function(S){this.lineWidth=S},Object.defineProperty(p.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),p.prototype.getState=function(){var S=Object.assign({drawingImgUrl:this.drawingImgUrl},H.prototype.getState.call(this));return S.typeName=p.typeName,S},p.prototype.restoreState=function(S){this.createVisual(),H.prototype.restoreState.call(this,S),this.drawingImgUrl=S.drawingImgUrl,this.setDrawingImage()},p.prototype.scale=function(S,K){H.prototype.scale.call(this,S,K),this.setDrawingImage()},p.typeName="FreehandMarker",p.title="Freehand marker",p.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>',p}(it),pe=function(H){function p(S,K,$){var G=H.call(this,S,$||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return G.typeBoxes=[],G.currentType=K,G.setCurrentType=G.setCurrentType.bind(G),G}return fe(p,H),p.prototype.getUi=function(){var S=this,K=document.createElement("div");K.style.display="flex",K.style.overflow="hidden",K.style.flexGrow="2";for(var $=function($e){var pt="both";switch($e){case 0:pt="both";break;case 1:pt="start";break;case 2:pt="end";break;case 3:pt="none"}var _t=document.createElement("div");if(_t.style.display="flex",_t.style.flexGrow="2",_t.style.alignItems="center",_t.style.justifyContent="space-between",_t.style.padding="5px",_t.style.borderWidth="2px",_t.style.borderStyle="solid",_t.style.borderColor=pt===G.currentType?G.uiStyleSettings.toolboxAccentColor:"transparent",_t.addEventListener("click",function(){S.setCurrentType(pt,_t)}),K.appendChild(_t),pt==="both"||pt==="start"){var Ze=document.createElement("div");Ze.style.display="flex",Ze.style.alignItems="center",Ze.style.minHeight="20px",Ze.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,5 10,0 10,10" fill="`+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Ze.style.marginLeft="5px",_t.appendChild(Ze)}var Bt=document.createElement("div");Bt.style.display="flex",Bt.style.alignItems="center",Bt.style.minHeight="20px",Bt.style.flexGrow="2";var It=document.createElement("hr");if(It.style.minWidth="20px",It.style.border="0px",It.style.borderTop="3px solid "+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee"),It.style.flexGrow="2",Bt.appendChild(It),_t.appendChild(Bt),pt==="both"||pt==="end"){var hr=document.createElement("div");hr.style.display="flex",hr.style.alignItems="center",hr.style.minHeight="20px",hr.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,0 10,5 0,10" fill="`+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,hr.style.marginRight="5px",_t.appendChild(hr)}G.typeBoxes.push(_t)},G=this,Ae=0;Ae<4;Ae++)$(Ae);return K},p.prototype.setCurrentType=function(S,K){var $=this;this.currentType=S,this.typeBoxes.forEach(function(G){G.style.borderColor=G===K?$.uiStyleSettings!==void 0?$.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},p}(Ue),be=function(H){function p(S,K,$){var G=H.call(this,S,K,$)||this;return G.arrowType="end",G.arrowBaseHeight=10,G.arrowBaseWidth=10,G.getArrowPoints=G.getArrowPoints.bind(G),G.setArrowType=G.setArrowType.bind(G),G.arrowTypePanel=new pe("Arrow type","end"),G.arrowTypePanel.onArrowTypeChanged=G.setArrowType,G}return fe(p,H),p.prototype.ownsTarget=function(S){return!(!H.prototype.ownsTarget.call(this,S)&&S!==this.arrow1&&S!==this.arrow2)},p.prototype.getArrowPoints=function(S,K){var $=this.arrowBaseWidth+2*this.strokeWidth,G=this.arrowBaseHeight+2*this.strokeWidth;return S-$/2+","+(K+G/2)+" "+S+","+(K-G/2)+" "+(S+$/2)+","+(K+G/2)},p.prototype.createTips=function(){this.arrow1=le.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=le.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.arrow2)},p.prototype.pointerDown=function(S,K){H.prototype.pointerDown.call(this,S,K),this.state==="creating"&&this.createTips()},p.prototype.adjustVisual=function(){if(H.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",le.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),le.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var S=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),K=this.arrow1.transform.baseVal.getItem(0);K.setRotate(S,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(K,0);var $=this.arrow2.transform.baseVal.getItem(0);$.setRotate(S+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem($,0)}},p.prototype.setArrowType=function(S){this.arrowType=S,this.adjustVisual(),this.stateChanged()},Object.defineProperty(p.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),p.prototype.getState=function(){var S=Object.assign({arrowType:this.arrowType},H.prototype.getState.call(this));return S.typeName=p.typeName,S},p.prototype.restoreState=function(S){H.prototype.restoreState.call(this,S);var K=S;this.arrowType=K.arrowType,this.createTips(),this.adjustVisual()},p.typeName="ArrowMarker",p.title="Arrow marker",p.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',p}(Ke),te=function(H){function p(S,K,$){var G=H.call(this,S,K,$)||this;return G.fillColor=$.defaultFillColor,G.strokeWidth=0,G.fillPanel=new He("Color",$.defaultColorSet,$.defaultFillColor),G.fillPanel.onColorChanged=G.setFillColor,G}return fe(p,H),Object.defineProperty(p.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),p.prototype.getState=function(){var S=H.prototype.getState.call(this);return S.typeName=p.typeName,S},p.typeName="CoverMarker",p.title="Cover marker",p.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',p}(rt),de=function(H){function p(S,K,$,G){var Ae=H.call(this,S,G||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return Ae.opacities=[],Ae.opacityBoxes=[],Ae.opacities=K,Ae.currentOpacity=$,Ae.setCurrentOpacity=Ae.setCurrentOpacity.bind(Ae),Ae}return fe(p,H),p.prototype.getUi=function(){var S=this,K=document.createElement("div");return K.style.display="flex",K.style.overflow="hidden",K.style.flexGrow="2",K.style.justifyContent="space-between",this.opacities.forEach(function($){var G=document.createElement("div");G.style.display="flex",G.style.alignItems="center",G.style.justifyContent="center",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.borderColor=$===S.currentOpacity?S.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){S.setCurrentOpacity($,G)}),K.appendChild(G);var Ae=document.createElement("div");Ae.innerText=100*$+"%",G.appendChild(Ae),S.opacityBoxes.push(G)}),K},p.prototype.setCurrentOpacity=function(S,K){var $=this;this.currentOpacity=S,this.opacityBoxes.forEach(function(G){G.style.borderColor=G===K?$.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},p}(Ue),he=function(H){function p(S,K,$){var G=H.call(this,S,K,$)||this;return G.setOpacity=G.setOpacity.bind(G),G.fillColor=$.defaultHighlightColor,G.strokeWidth=0,G.opacity=$.defaultHighlightOpacity,G.fillPanel=new He("Color",$.defaultColorSet,G.fillColor),G.fillPanel.onColorChanged=G.setFillColor,G.opacityPanel=new de("Opacity",$.defaultOpacitySteps,G.opacity),G.opacityPanel.onOpacityChanged=G.setOpacity,G}return fe(p,H),p.prototype.setOpacity=function(S){this.opacity=S,this.visual&&le.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(p.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),p.prototype.getState=function(){var S=H.prototype.getState.call(this);return S.typeName=p.typeName,S},p.typeName="HighlightMarker",p.title="Highlight marker",p.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>',p}(te),ye='<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>',De=function(H){function p(S,K,$){var G=H.call(this,S,K,$)||this;return G.bgColor="transparent",G.tipPosition={x:0,y:0},G.tipBase1Position={x:0,y:0},G.tipBase2Position={x:0,y:0},G.tipMoving=!1,G.color=$.defaultStrokeColor,G.bgColor=$.defaultFillColor,G.fontFamily=$.defaultFontFamily,G.defaultSize={x:100,y:30},G.setBgColor=G.setBgColor.bind(G),G.getTipPoints=G.getTipPoints.bind(G),G.positionTip=G.positionTip.bind(G),G.setTipPoints=G.setTipPoints.bind(G),G.colorPanel=new He("Text color",$.defaultColorSet,G.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),G.colorPanel.onColorChanged=G.setColor,G.bgColorPanel=new He("Fill color",$.defaultColorSet,G.bgColor,ye),G.bgColorPanel.onColorChanged=G.setBgColor,G.fontFamilyPanel=new Me("Font",$.defaultFontFamilies,$.defaultFontFamily),G.fontFamilyPanel.onFontChanged=G.setFont,G.tipGrip=new qe,G.tipGrip.visual.transform.baseVal.appendItem(le.createTransform()),G.controlBox.appendChild(G.tipGrip.visual),G}return fe(p,H),p.prototype.ownsTarget=function(S){return H.prototype.ownsTarget.call(this,S)||this.tipGrip.ownsTarget(S)||this.tip===S},p.prototype.createTip=function(){le.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=le.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},p.prototype.pointerDown=function(S,K){this.state==="new"&&H.prototype.pointerDown.call(this,S,K),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(K)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):H.prototype.pointerDown.call(this,S,K)},p.prototype.pointerUp=function(S){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,H.prototype.pointerUp.call(this,S);else{var K=this.state==="creating";H.prototype.pointerUp.call(this,S),this.setTipPoints(K),this.positionTip()}},p.prototype.manipulate=function(S){if(this.tipMoving){var K=this.unrotatePoint(S);this.tipPosition={x:K.x-this.manipulationStartLeft,y:K.y-this.manipulationStartTop},this.positionTip()}else H.prototype.manipulate.call(this,S)},p.prototype.setBgColor=function(S){this.bgRectangle&&this.tip&&(le.setAttributes(this.bgRectangle,[["fill",S]]),le.setAttributes(this.tip,[["fill",S]])),this.bgColor=S,this.fillColorChanged(S)},p.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},p.prototype.setTipPoints=function(S){S===void 0&&(S=!1);var K=Math.min(this.height/2,15),$=this.height/5;S&&(this.tipPosition={x:K+$/2,y:this.height+20});var G=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?G<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?($=this.width/5,K=Math.min(this.width/2,15),this.tipBase1Position={x:K,y:0},this.tipBase2Position={x:K+$,y:0}):(this.tipBase1Position={x:0,y:K},this.tipBase2Position={x:0,y:K+$}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?G<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?($=this.width/5,K=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-K-$,y:0},this.tipBase2Position={x:this.width-K,y:0}):(this.tipBase1Position={x:this.width,y:K},this.tipBase2Position={x:this.width,y:K+$}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?G<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?($=this.width/5,K=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-K-$,y:this.height},this.tipBase2Position={x:this.width-K,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-K-$},this.tipBase2Position={x:this.width,y:this.height-K}):G<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?($=this.width/5,K=Math.min(this.width/2,15),this.tipBase1Position={x:K,y:this.height},this.tipBase2Position={x:K+$,y:this.height}):(this.tipBase1Position={x:0,y:this.height-K},this.tipBase2Position={x:0,y:this.height-K-$})},p.prototype.resize=function(S){H.prototype.resize.call(this,S),this.positionTip()},p.prototype.positionTip=function(){le.setAttributes(this.tip,[["points",this.getTipPoints()]]);var S=this.tipGrip.visual.transform.baseVal.getItem(0);S.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(S,0)},Object.defineProperty(p.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),p.prototype.select=function(){this.positionTip(),H.prototype.select.call(this)},p.prototype.getState=function(){var S=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},H.prototype.getState.call(this));return S.typeName=p.typeName,S},p.prototype.restoreState=function(S){var K=S;this.bgColor=K.bgColor,this.tipPosition=K.tipPosition,H.prototype.restoreState.call(this,S),this.createTip(),this.setTipPoints()},p.prototype.scale=function(S,K){H.prototype.scale.call(this,S,K),this.tipPosition={x:this.tipPosition.x*S,y:this.tipPosition.y*K},this.positionTip()},p.typeName="CalloutMarker",p.title="Callout marker",p.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>',p}(je),we=function(H){function p(S,K,$){var G=H.call(this,S,K,$)||this;return G.fillColor="transparent",G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.opacity=1,G.strokeColor=$.defaultColor,G.strokeWidth=$.defaultStrokeWidth,G.strokeDasharray=$.defaultStrokeDasharray,G.fillColor=$.defaultFillColor,G.setStrokeColor=G.setStrokeColor.bind(G),G.setFillColor=G.setFillColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.setOpacity=G.setOpacity.bind(G),G.createVisual=G.createVisual.bind(G),G.strokePanel=new He("Line color",ie($.defaultColorSet,["transparent"]),$.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.fillPanel=new He("Fill color",ie($.defaultColorSet,["transparent"]),G.fillColor,ye),G.fillPanel.onColorChanged=G.setFillColor,G.strokeWidthPanel=new ht("Line width",$.defaultStrokeWidths,$.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new ft("Line style",$.defaultStrokeDasharrays,$.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G.opacityPanel=new de("Opacity",$.defaultOpacitySteps,G.opacity),G.opacityPanel.onOpacityChanged=G.setOpacity,G}return fe(p,H),p.prototype.ownsTarget=function(S){return!(!H.prototype.ownsTarget.call(this,S)&&S!==this.visual)},p.prototype.createVisual=function(){this.visual=le.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},p.prototype.pointerDown=function(S,K){H.prototype.pointerDown.call(this,S,K),this.state==="new"&&(this.createVisual(),this.moveVisual(S),this._state="creating")},p.prototype.manipulate=function(S){H.prototype.manipulate.call(this,S)},p.prototype.resize=function(S){H.prototype.resize.call(this,S),this.setSize()},p.prototype.setSize=function(){H.prototype.setSize.call(this),le.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},p.prototype.pointerUp=function(S){H.prototype.pointerUp.call(this,S),this.setSize()},p.prototype.setStrokeColor=function(S){this.strokeColor=S,this.visual&&le.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(S),this.stateChanged()},p.prototype.setFillColor=function(S){this.fillColor=S,this.visual&&le.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(S),this.stateChanged()},p.prototype.setStrokeWidth=function(S){this.strokeWidth=S,this.visual&&le.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},p.prototype.setStrokeDasharray=function(S){this.strokeDasharray=S,this.visual&&le.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},p.prototype.setOpacity=function(S){this.opacity=S,this.visual&&le.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(p.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),p.prototype.getState=function(){var S=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},H.prototype.getState.call(this));return S.typeName=p.typeName,S},p.prototype.restoreState=function(S){var K=S;this.fillColor=K.fillColor,this.strokeColor=K.strokeColor,this.strokeWidth=K.strokeWidth,this.strokeDasharray=K.strokeDasharray,this.opacity=K.opacity,this.createVisual(),H.prototype.restoreState.call(this,S),this.setSize()},p.prototype.scale=function(S,K){H.prototype.scale.call(this,S,K),this.setSize()},p.typeName="EllipseMarker",p.title="Ellipse marker",p.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>',p}(it),We=function(H){function p(S,K,$){return H.call(this,S,K,$)||this}return fe(p,H),Object.defineProperty(p.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),p.prototype.ownsTarget=function(S){return!(!H.prototype.ownsTarget.call(this,S)&&S!==this.tip1&&S!==this.tip2)},p.prototype.createTips=function(){this.tip1=le.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.tip1),this.tip2=le.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.tip2)},p.prototype.pointerDown=function(S,K){H.prototype.pointerDown.call(this,S,K),this.state==="creating"&&this.createTips()},p.prototype.adjustVisual=function(){if(H.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(le.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),le.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var S=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),K=this.tip1.transform.baseVal.getItem(0);K.setRotate(S,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(K,0);var $=this.tip2.transform.baseVal.getItem(0);$.setRotate(S+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem($,0)}},Object.defineProperty(p.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),p.prototype.getState=function(){var S=H.prototype.getState.call(this);return S.typeName=p.typeName,S},p.prototype.restoreState=function(S){H.prototype.restoreState.call(this,S),this.createTips(),this.adjustVisual()},p.typeName="MeasurementMarker",p.title="Measurement marker",p.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>',p}(Ke),Qe=function(H){function p(S,K,$){var G=H.call(this,S,K,$)||this;return G.strokePanel.colors=$.defaultColorSet,G.fillColor="transparent",G}return fe(p,H),Object.defineProperty(p.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),p.prototype.getState=function(){var S=H.prototype.getState.call(this);return S.typeName=p.typeName,S},p.typeName="EllipseFrameMarker",p.title="Ellipse frame marker",p.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>',p}(we),nt=function(){function H(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(H.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),H.prototype.addUndoStep=function(p){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(p)||(this.undoStack.push(p),JSON.stringify(this.lastRedoStep)!==JSON.stringify(p)&&this.redoStack.splice(0,this.redoStack.length))},H.prototype.replaceLastUndoStep=function(p){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=p)},H.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},H.prototype.undo=function(){if(this.undoStack.length>1){var p=this.undoStack.pop();return p!==void 0&&this.redoStack.push(p),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},H.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},H}(),Ve=function(H){function p(S,K,$){var G=H.call(this,S,K,$)||this;return G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.curveX=0,G.curveY=0,G.manipulationStartCurveX=0,G.manipulationStartCurveY=0,G.setStrokeColor=G.setStrokeColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.positionGrips=G.positionGrips.bind(G),G.addControlGrips=G.addControlGrips.bind(G),G.adjustVisual=G.adjustVisual.bind(G),G.setupControlBox=G.setupControlBox.bind(G),G.resize=G.resize.bind(G),G.strokeColor=$.defaultColor,G.strokeWidth=$.defaultStrokeWidth,G.strokeDasharray=$.defaultStrokeDasharray,G.strokePanel=new He("Line color",$.defaultColorSet,$.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new ht("Line width",$.defaultStrokeWidths,$.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new ft("Line style",$.defaultStrokeDasharrays,$.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return fe(p,H),p.prototype.ownsTarget=function(S){return!(!H.prototype.ownsTarget.call(this,S)&&S!==this.visual&&S!==this.selectorCurve&&S!==this.visibleCurve&&!this.curveGrip.ownsTarget(S))},p.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},p.prototype.createVisual=function(){this.visual=le.createGroup(),this.selectorCurve=le.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=le.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},p.prototype.pointerDown=function(S,K){H.prototype.pointerDown.call(this,S,K),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=S.x,this.curveY=S.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(K)&&(this.activeGrip=this.curveGrip,this._state="resize")},p.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),le.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),le.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),le.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},p.prototype.setupControlBox=function(){H.prototype.setupControlBox.call(this),this.curveControlLine1=le.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=le.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},p.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,H.prototype.addControlGrips.call(this)},p.prototype.positionGrips=function(){H.prototype.positionGrips.call(this);var S=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-S/2,this.curveY-S/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()))},p.prototype.manipulate=function(S){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+S.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+S.y-this.manipulationStartY),H.prototype.manipulate.call(this,S)},p.prototype.resize=function(S){this.activeGrip===this.curveGrip&&(this.curveX=S.x,this.curveY=S.y),H.prototype.resize.call(this,S),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},p.prototype.setStrokeColor=function(S){this.strokeColor=S,this.adjustVisual(),this.colorChanged(S)},p.prototype.setStrokeWidth=function(S){this.strokeWidth=S,this.adjustVisual()},p.prototype.setStrokeDasharray=function(S){this.strokeDasharray=S,this.adjustVisual()},p.prototype.scale=function(S,K){this.curveX=this.curveX*S,this.curveY=this.curveY*K,H.prototype.scale.call(this,S,K)},Object.defineProperty(p.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),p.prototype.getState=function(){var S=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},H.prototype.getState.call(this));return S.typeName=p.typeName,S},p.prototype.restoreState=function(S){H.prototype.restoreState.call(this,S);var K=S;this.strokeColor=K.strokeColor,this.strokeWidth=K.strokeWidth,this.strokeDasharray=K.strokeDasharray,this.curveX=K.curveX,this.curveY=K.curveY,this.createVisual(),this.adjustVisual()},p.typeName="CurveMarker",p.title="Curve marker",p.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>',p}(Ge),dt=function(){function H(p,S){S===void 0&&(S=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=p,this.cancelable=S}return Object.defineProperty(H.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),H.prototype.preventDefault=function(){this._defaultPrevented=!0},H}(),ct=function(H){function p(S,K,$){var G=H.call(this,S,!1)||this;return G.dataUrl=K,G.state=$,G}return fe(p,H),p}(dt),at=function(H){function p(S,K,$){$===void 0&&($=!1);var G=H.call(this,S,$)||this;return G.marker=K,G}return fe(p,H),p}(dt),Dt=function(){function H(){this.render=[],this.beforeclose=[],this.close=[],this.show=[],this.restorestate=[],this.statechange=[],this.markerselect=[],this.markerdeselect=[],this.markercreating=[],this.markercreate=[],this.markerbeforedelete=[],this.markerdelete=[],this.markerchange=[],this.focus=[],this.blur=[]}return H.prototype.addEventListener=function(p,S){this[p].push(S)},H.prototype.removeEventListener=function(p,S){var K=this[p].indexOf(S);K>-1&&this[p].splice(K,1)},H}(),wt=function(){function H(p){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Le,this._isOpen=!1,this.undoRedoManager=new nt,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 Dt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=H.instanceCounter++,this.styles=new ge(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=p,this.targetRoot=document.body,this.width=p.clientWidth,this.height=p.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(H.prototype,"ALL_MARKER_TYPES",{get:function(){return[ke,xe,be,je,Qe,we,he,De,We,te,Ke,Ve]},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[ke,xe,be,je,we,he,De]},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"BASIC_MARKER_TYPES",{get:function(){return[ke,xe,be,je,he]},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(p){var S=this;this._availableMarkerTypes.splice(0),p.forEach(function(K){if(typeof K=="string"){var $=S.ALL_MARKER_TYPES.find(function(G){return G.typeName===K});$!==void 0&&S._availableMarkerTypes.push($)}else S._availableMarkerTypes.push(K)})},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(p){this._zoomLevel=p,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),H.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),q.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},H.prototype.show=function(){var p=this;this.styles.styleSheetRoot===void 0&&oe.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=oe.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(S){return S(new dt(p))})},H.prototype.render=function(){return ne(this,void 0,void 0,function(){var p;return me(this,function(S){switch(S.label){case 0:return this.setCurrentMarker(),(p=new re).naturalSize=this.renderAtNaturalSize,p.imageType=this.renderImageType,p.imageQuality=this.renderImageQuality,p.markersOnly=this.renderMarkersOnly,p.width=this.renderWidth,p.height=this.renderHeight,[4,p.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return S.sent(),[4,p.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,S.sent()]}})})},H.prototype.close=function(p){var S=this;if(p===void 0&&(p=!1),this.isOpen){var K=!1;p||this.eventListeners.beforeclose.forEach(function($){var G=new dt(S,!0);$(G),G.defaultPrevented&&(K=!0)}),K||(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($){return $(new dt(S))}),this.detachEvents(),this._isOpen=!1)}},H.prototype.addMarkersToToolbar=function(){for(var p,S=[],K=0;K<arguments.length;K++)S[K]=arguments[K];(p=this._availableMarkerTypes).push.apply(p,S)},H.prototype.addRenderEventListener=function(p){this.addEventListener("render",function(S){p(S.dataUrl,S.state)})},H.prototype.removeRenderEventListener=function(p){},H.prototype.addCloseEventListener=function(p){this.addEventListener("close",function(){p()})},H.prototype.removeCloseEventListener=function(p){},H.prototype.setupResizeObserver=function(){var p=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){p.resize(p.target.clientWidth,p.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return p.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},H.prototype.onPopupTargetResize=function(){var p=1*this.target.clientWidth/this.target.clientHeight,S=this.editorCanvas.clientWidth/p>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*p:this.editorCanvas.clientWidth,K=S<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/p;this.resize(S,K)},H.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},H.prototype.resize=function(p,S){this._isResizing=!0;var K=p/this.imageWidth,$=S/this.imageHeight;this.imageWidth=Math.round(p),this.imageHeight=Math.round(S),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(K,$),this._isResizing=!1},H.prototype.scaleMarkers=function(p,S){var K,$=this;this._currentMarker&&this._currentMarker instanceof je?this._currentMarker.scale(p,S):(K=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(G){G!==$._currentMarker&&G.scale(p,S)}),K!==void 0&&this.setCurrentMarker(K)},H.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},H.prototype.setTopLeft=function(){var p=this.editingTarget.getBoundingClientRect(),S=this.editorCanvas.getBoundingClientRect();this.left=p.left-S.left,this.top=p.top-S.top},H.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},H.prototype.addDefs=function(){for(var p,S=[],K=0;K<arguments.length;K++)S[K]=arguments[K];this.defs=le.createDefs(),this.addDefsToImage(),(p=this.defs).append.apply(p,S)},H.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},H.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},H.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},H.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},H.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},H.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},H.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},H.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var p=document.createElement("a");p.href="https://markerjs.com/",p.target="_blank",p.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>',p.title="Powered by marker.js",p.style.display="grid",p.style.alignItems="center",p.style.justifyItems="center",p.style.padding="3px",p.style.width="20px",p.style.height="20px",this.logoUI.appendChild(p),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},H.prototype.positionLogo=function(){this.logoUI&&(this.uiStyleSettings.logoPosition!=="right"?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},H.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},H.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},H.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var p=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=p+"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 Re(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 Pe(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},H.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},H.prototype.removeMarker=function(p){this.markerImage.removeChild(p.container),this.markers.indexOf(p)>-1&&this.markers.splice(this.markers.indexOf(p),1),p.dispose()},H.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),this._currentMarker!==void 0&&(this._currentMarker.state!=="new"?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},H.prototype.toolbarButtonClicked=function(p,S){if(p==="marker"&&S!==void 0)this.createNewMarker(S);else if(p==="action")switch(S){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},H.prototype.deleteSelectedMarker=function(){var p=this;if(this._currentMarker!==void 0){var S=!1;if(this.eventListeners.markerbeforedelete.forEach(function($){var G=new at(p,p._currentMarker,!0);$(G),G.defaultPrevented&&(S=!0)}),!S){var K=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($){return $(new at(p,K))})}}},H.prototype.clear=function(){var p=this,S=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(Ae){var $e=new at(p,void 0,!0);Ae($e),$e.defaultPrevented&&(S=!0)}),!S)){this.setCurrentMarker();for(var K=function(Ae){var $e=$.markers[Ae];$.setCurrentMarker($.markers[Ae]),$._currentMarker.dispose(),$.markerImage.removeChild($._currentMarker.container),$.markers.splice($.markers.indexOf($._currentMarker),1),$.eventListeners.markerdelete.forEach(function(pt){return pt(new at(p,$e))})},$=this,G=this.markers.length-1;G>=0;G--)K(G);this.addUndoStep()}},Object.defineProperty(H.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),H.prototype.showNotesEditor=function(){var p;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=(p=this._currentMarker.notes)!==null&&p!==void 0?p:"",this.overlayContainer.appendChild(this.notesArea))},H.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(this._currentMarker!==void 0&&(this._currentMarker.notes=this.notesArea.value.trim()!==""?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},H.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},H.prototype.addUndoStep=function(){var p=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var S=this.getState(),K=this.undoRedoManager.getLastUndoStep();if(!K||K.width===S.width&&K.height===S.height){var $=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(S),$<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(G){return G(new dt(p))})}else this.undoRedoManager.replaceLastUndoStep(S),this.eventListeners.statechange.forEach(function(G){return G(new dt(p))})}},H.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},H.prototype.undoStep=function(){var p=this,S=this.undoRedoManager.undo();S!==void 0&&(this.restoreState(S),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(K){return K(new dt(p))}))},H.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},H.prototype.redoStep=function(){var p=this,S=this.undoRedoManager.redo();S!==void 0&&(this.restoreState(S),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(K){return K(new dt(p))}))},H.prototype.stepZoom=function(){var p=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=p<this.zoomSteps.length-1?this.zoomSteps[p+1]:this.zoomSteps[0]},H.prototype.panTo=function(p){this.contentDiv.scrollBy({left:this.prevPanPoint.x-p.x,top:this.prevPanPoint.y-p.y}),this.prevPanPoint=p},H.prototype.startRenderAndClose=function(){return ne(this,void 0,void 0,function(){var p,S,K=this;return me(this,function($){switch($.label){case 0:return[4,this.render()];case 1:return p=$.sent(),S=this.getState(),this.eventListeners.render.forEach(function(G){return G(new ct(K,p,S))}),this.close(!0),[2]}})})},H.prototype.getState=function(p){p===!0&&this.setCurrentMarker();var S={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(K){return S.markers.push(K.getState())}),S},H.prototype.restoreState=function(p){var S=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);p.markers.forEach(function(K){var $=S._availableMarkerTypes.find(function(Ae){return Ae.typeName===K.typeName});if($!==void 0){var G=S.addNewMarker($);G.restoreState(K),S.markers.push(G)}}),p.width&&p.height&&(p.width!==this.imageWidth||p.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/p.width,this.imageHeight/p.height),this.eventListeners.restorestate.forEach(function(K){return K(new dt(S))})},H.prototype.addNewMarker=function(p){var S=le.createGroup();return this.markerImage.appendChild(S),new p(S,this.overlayContainer,this.settings)},H.prototype.createNewMarker=function(p){var S,K=this;(S=typeof p=="string"?this._availableMarkerTypes.find(function($){return $.typeName===p}):p)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(S),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(S.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function($){return $(new at(K,K._currentMarker))}))},H.prototype.markerCreated=function(p){var S=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(p),this.setCurrentMarker(p),p instanceof xe&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(xe):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(K){return K(new at(S,S._currentMarker))})},H.prototype.colorChanged=function(p){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=p,this.settings.defaultStrokeColor=p)},H.prototype.fillColorChanged=function(p){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=p)},H.prototype.markerStateChanged=function(p){var S=this;this.eventListeners.markerchange.forEach(function(K){return K(new at(S,p))})},H.prototype.setCurrentMarker=function(p){var S=this;this._currentMarker!==p&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(K){return K(new at(S,S._currentMarker))})),this._currentMarker=p,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(K){return K(new at(S,S._currentMarker))}))},H.prototype.onPointerDown=function(p){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||p.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var S=this.markers.find(function(K){return K.ownsTarget(p.target)});S!==void 0?(this.setCurrentMarker(S),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(p.clientX,p.clientY),p.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:p.clientX,y:p.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(p.clientX,p.clientY))},H.prototype.onDblClick=function(p){if(this._isFocused||this.focus(),this.mode==="select"){var S=this.markers.find(function(K){return K.ownsTarget(p.target)});S!==void 0&&S!==this._currentMarker&&this.setCurrentMarker(S),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(p.clientX,p.clientY),p.target):this.setCurrentMarker()}},H.prototype.onPointerMove=function(p){this.touchPoints!==1&&p.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||p.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(p.clientX,p.clientY)):this.zoomLevel>1&&this.panTo({x:p.clientX,y:p.clientY}))},H.prototype.onPointerUp=function(p){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(p.clientX,p.clientY)),this.isDragging=!1,this.addUndoStep()},H.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},H.prototype.onKeyUp=function(p){this._currentMarker===void 0||this.notesArea!==void 0||p.key!=="Delete"&&p.key!=="Backspace"||this.deleteSelectedMarker()},H.prototype.clientToLocalCoordinates=function(p,S){var K=this.markerImage.getBoundingClientRect();return{x:(p-K.left)/this.zoomLevel,y:(S-K.top)/this.zoomLevel}},H.prototype.onWindowResize=function(){this.positionUI()},H.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var p=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=p+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},H.prototype.addLicenseKey=function(p){q.addKey(p)},H.prototype.addEventListener=function(p,S){this.eventListeners.addEventListener(p,S)},H.prototype.removeEventListener=function(p,S){this.eventListeners.removeEventListener(p,S)},H.prototype.renderState=function(p){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(p),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(H.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),H.prototype.focus=function(){var p=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(S){return S(new dt(p))}))},H.prototype.blur=function(){var p=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(S){return S(new dt(p))}))},H.instanceCounter=0,H}();/* **********************************
|
|
cropro version 1.2.0
|
|
@license SEE LICENSE IN LICENSE
|
|
|
|
copyright Alan Mendelevich
|
|
see README and LICENSE for details
|
|
********************************** *//*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var xt=function(H,p){return(xt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(S,K){S.__proto__=K}||function(S,K){for(var $ in K)Object.prototype.hasOwnProperty.call(K,$)&&(S[$]=K[$])})(H,p)};function kt(H,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");function S(){this.constructor=H}xt(H,p),H.prototype=p===null?Object.create(p):(S.prototype=p.prototype,new S)}function Et(H,p,S,K){return new(S||(S=Promise))(function($,G){function Ae(_t){try{pt(K.next(_t))}catch(Ze){G(Ze)}}function $e(_t){try{pt(K.throw(_t))}catch(Ze){G(Ze)}}function pt(_t){var Ze;_t.done?$(_t.value):(Ze=_t.value,Ze instanceof S?Ze:new S(function(Bt){Bt(Ze)})).then(Ae,$e)}pt((K=K.apply(H,p||[])).next())})}function Mt(H,p){var S,K,$,G,Ae={label:0,sent:function(){if(1&$[0])throw $[1];return $[1]},trys:[],ops:[]};return G={next:$e(0),throw:$e(1),return:$e(2)},typeof Symbol=="function"&&(G[Symbol.iterator]=function(){return this}),G;function $e(pt){return function(_t){return function(Ze){if(S)throw new TypeError("Generator is already executing.");for(;Ae;)try{if(S=1,K&&($=2&Ze[0]?K.return:Ze[0]?K.throw||(($=K.return)&&$.call(K),0):K.next)&&!($=$.call(K,Ze[1])).done)return $;switch(K=0,$&&(Ze=[2&Ze[0],$.value]),Ze[0]){case 0:case 1:$=Ze;break;case 4:return Ae.label++,{value:Ze[1],done:!1};case 5:Ae.label++,K=Ze[1],Ze=[0];continue;case 7:Ze=Ae.ops.pop(),Ae.trys.pop();continue;default:if(!($=Ae.trys,($=$.length>0&&$[$.length-1])||Ze[0]!==6&&Ze[0]!==2)){Ae=0;continue}if(Ze[0]===3&&(!$||Ze[1]>$[0]&&Ze[1]<$[3])){Ae.label=Ze[1];break}if(Ze[0]===6&&Ae.label<$[1]){Ae.label=$[1],$=Ze;break}if($&&Ae.label<$[2]){Ae.label=$[2],Ae.ops.push(Ze);break}$[2]&&Ae.ops.pop(),Ae.trys.pop();continue}Ze=p.call(H,Ae)}catch(Bt){Ze=[6,Bt],K=0}finally{S=$=0}if(5&Ze[0])throw Ze[1];return{value:Ze[0]?Ze[1]:void 0,done:!0}}([pt,_t])}}}var Rt=function(){function H(){}return H.addKey=function(p){H.key=p},Object.defineProperty(H,"isLicensed",{get:function(){return!!H.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(H.key)},enumerable:!1,configurable:!0}),H}(),Xe=function(){function H(){}return H.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},H.setAttributes=function(p,S){for(var K=0,$=S;K<$.length;K++){var G=$[K],Ae=G[0],$e=G[1];p.setAttribute(Ae,$e)}},H.createRect=function(p,S,K){var $=document.createElementNS("http://www.w3.org/2000/svg","rect");return $.setAttribute("width",p.toString()),$.setAttribute("height",S.toString()),K&&H.setAttributes($,K),$},H.createLine=function(p,S,K,$,G){var Ae=document.createElementNS("http://www.w3.org/2000/svg","line");return Ae.setAttribute("x1",p.toString()),Ae.setAttribute("y1",S.toString()),Ae.setAttribute("x2",K.toString()),Ae.setAttribute("y2",$.toString()),G&&H.setAttributes(Ae,G),Ae},H.createPolygon=function(p,S){var K=document.createElementNS("http://www.w3.org/2000/svg","polygon");return K.setAttribute("points",p),S&&H.setAttributes(K,S),K},H.createCircle=function(p,S){var K=document.createElementNS("http://www.w3.org/2000/svg","circle");return K.setAttribute("cx",(p/2).toString()),K.setAttribute("cy",(p/2).toString()),K.setAttribute("r",p.toString()),S&&H.setAttributes(K,S),K},H.createEllipse=function(p,S,K){var $=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return $.setAttribute("cx",(p/2).toString()),$.setAttribute("cy",(S/2).toString()),$.setAttribute("rx",(p/2).toString()),$.setAttribute("ry",(S/2).toString()),K&&H.setAttributes($,K),$},H.createGroup=function(p){var S=document.createElementNS("http://www.w3.org/2000/svg","g");return p&&H.setAttributes(S,p),S},H.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},H.createMarker=function(p,S,K,$,G,Ae,$e){var pt=document.createElementNS("http://www.w3.org/2000/svg","marker");return H.setAttributes(pt,[["id",p],["orient",S],["markerWidth",K.toString()],["markerHeight",$.toString()],["refX",G.toString()],["refY",Ae.toString()]]),pt.appendChild($e),pt},H.createText=function(p){var S=document.createElementNS("http://www.w3.org/2000/svg","text");return S.setAttribute("x","0"),S.setAttribute("y","0"),p&&H.setAttributes(S,p),S},H.createTSpan=function(p,S){var K=document.createElementNS("http://www.w3.org/2000/svg","tspan");return K.textContent=p,S&&H.setAttributes(K,S),K},H.createImage=function(p){var S=document.createElementNS("http://www.w3.org/2000/svg","image");return p&&H.setAttributes(S,p),S},H.createPoint=function(p,S){var K=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return K.x=p,K.y=S,K},H.createPath=function(p,S){var K=document.createElementNS("http://www.w3.org/2000/svg","path");return K.setAttribute("d",p),S&&H.setAttributes(K,S),K},H.createElement=function(p,S){var K=document.createElementNS("http://www.w3.org/2000/svg",p);return S&&H.setAttributes(K,S),K},H.getHollowRectanglePath=function(p,S,K,$,G,Ae,$e,pt){return"M"+p+","+S+"V"+(S+$)+"H"+(p+K)+"V"+S+"H"+G+"V"+Ae+"H"+(G+$e)+"V"+(Ae+pt)+"H"+G+"V"+S+"Z"},H}(),bt=function(){function H(p){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+p+"_"}return Object.defineProperty(H.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#333333",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarBackgroundActiveColor:"#282828",toolbarColor:"#eeeeee",cropShadeColor:"#ffffff",cropFrameColor:"#ffffff",gripColor:"#333333",gripFillColor:"#cccccc",toolbarHeight:40}},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),H.prototype.addClass=function(p){return this.styleSheet===void 0&&this.addStyleSheet(),p.name=""+this.classNamePrefix+p.localName,this.classes.push(p),this.styleSheet.sheet.insertRule("."+p.name+" {"+p.style+"}",this.styleSheet.sheet.cssRules.length),p},H.prototype.addRule=function(p){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(p),this.styleSheet.sheet.insertRule(p.selector+" {"+p.style+"}",this.styleSheet.sheet.cssRules.length)},H.prototype.addStyleSheet=function(){var p;this.styleSheet=document.createElement("style"),((p=this.styleSheetRoot)!==null&&p!==void 0?p:document.head).appendChild(this.styleSheet),this.addRule(new ot("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new ot("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new ot("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new lt("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new lt("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},H.prototype.removeStyleSheet=function(){var p;this.styleSheet&&(((p=this.styleSheetRoot)!==null&&p!==void 0?p:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},H}(),ot=function(H,p){this.selector=H,this.style=p},lt=function(H,p){this.localName=H,this.style=p},st=function(){function H(){this.blocks=[],this.display=""}return H.prototype.addButtonBlock=function(p){p.className=this.blockClassName,p.buttonClassName=this.buttonClassName,p.buttonColorsClassName=this.buttonColorsClassName,p.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(p)},H.prototype.addElementBlock=function(p){p.className===void 0&&(p.className=this.blockClassName),this.blocks.push(p)},H.prototype.getUI=function(){var p=document.createElement("div");return p.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,p.style.display=this.display,this.blocks.forEach(function(S){return p.appendChild(S.getUI())}),p},H}(),zt=function(){function H(){}return H.prototype.getUI=function(){var p=document.createElement("div");if(p.className=this.className,this.minWidth!==void 0&&(p.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":p.style.justifyContent="flex-start";break;case"center":p.style.justifyContent="center";break;case"end":p.style.justifyContent="flex-end"}return p.style.whiteSpace="nowrap",p},H}(),Wt=function(H){function p(){var S=H!==null&&H.apply(this,arguments)||this;return S.buttons=[],S}return kt(p,H),p.prototype.addButton=function(S){S.className=this.buttonClassName,S.colorsClassName=this.buttonColorsClassName,S.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(S)},p.prototype.getUI=function(){var S=H.prototype.getUI.call(this);return this.buttons.forEach(function(K){return S.appendChild(K.getUI())}),S},p}(zt),St=function(){function H(p,S){this._isActive=!1,this._isHidden=!1,this._icon=p,this.title=S,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(H.prototype,"icon",{get:function(){return this._icon},set:function(p){this._icon=p,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isActive",{get:function(){return this._isActive},set:function(p){this._isActive=p,this.adjustClassName()},enumerable:!1,configurable:!0}),H.prototype.getUI=function(){var p=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 p.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},H.prototype.adjustClassName=function(){this.activeColorsClassName&&(this._isActive&&this.buttonContainer.className.indexOf(this.activeColorsClassName)<0?this.buttonContainer.className+=" "+this.activeColorsClassName:this._isActive||(this.buttonContainer.className=this.buttonContainer.className.replace(this.activeColorsClassName,"")))},H.prototype.hide=function(){this._isHidden=!0},H}(),ut=function(H){function p(){var S=H!==null&&H.apply(this,arguments)||this;return S.elements=[],S}return kt(p,H),p.prototype.addElement=function(S){this.elements.push(S)},p.prototype.getUI=function(){var S=H.prototype.getUI.call(this);return this.elements.forEach(function(K){return S.appendChild(K)}),S},p}(zt),or=function(){function H(p,S){this.horizontal=p,this.vertical=S}return Object.defineProperty(H.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),H.prototype.getVerticalLength=function(p){return p/this.ratio},H.prototype.getHorizontalLength=function(p){return p*this.ratio},H}(),$t=function(){function H(){}return H.getIcon=function(p,S){if(p>0&&S>0){var K=new or(p,S),$=K.ratio>=1?20:K.getHorizontalLength(20),G=K.ratio<1?20:K.getVerticalLength(20),Ae=document.createElementNS("http://www.w3.org/2000/svg","svg");Ae.setAttribute("xmlns","http://www.w3.org/2000/svg"),Ae.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(Ae);var $e=Xe.createDefs();Ae.appendChild($e);var pt=Xe.createElement("clipPath",[["id","text-bg-clip"]]);$e.appendChild(pt);var _t=Xe.createPath(Xe.getHollowRectanglePath((24-$)/2,(24-G)/2,$,G,(24-$)/2+2,(24-G)/2+2,$-4,G-4));Ae.appendChild(_t);var Ze=Xe.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ze.appendChild(Xe.createTSpan(p+":"+S)),Ae.appendChild(Ze);var Bt=Ze.getBBox();Xe.setAttributes(Ze,[["x",((24-Bt.width)/2).toString()],["y",((24-Bt.height)/2-Bt.y).toString()]]);var It=Xe.createPath(Xe.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Bt.width))/2,(24-Math.ceil(Bt.height))/2,Math.ceil(Bt.width),Math.ceil(Bt.height)));return pt.appendChild(It),Xe.setAttributes(_t,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(Ae),Ae.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},H}(),Tt=function(H){function p(S,K,$){var G=H.call(this,S,K)||this;return G.isDropdownOpen=!1,G.onClick=G.dropdownButtonClicked,G.dropdownButtons=$,G}return kt(p,H),p.prototype.setupDropdown=function(){var S=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(K){K.className=S.className,K.colorsClassName=S.colorsClassName,S.dropdownBlock.appendChild(K.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},p.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},p.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},p.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},p.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},p.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},p}(St),Ot=function(){function H(p,S){this.GRIP_SIZE=10,this.color=p,this.fillColor=S,this.visual=Xe.createGroup(),this.visual.appendChild(Xe.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Xe.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return H.prototype.ownsTarget=function(p){return p===this.visual||p===this.visual.childNodes[0]||p===this.visual.childNodes[1]},H.prototype.setCenter=function(p,S){this.visual.childNodes.forEach(function(K){return Xe.setAttributes(K,[["cx",p.toString()],["cy",S.toString()]])})},H}(),Gt=function(){function H(p,S,K,$){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=p,this.canvasHeight=S,this.margin=K,this.container=$,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(H.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(p){this._aspectRatio=p,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(p){this._isGridVisible=p,this.gridContainer&&Xe.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(p){this._zoomFactor=p,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),H.prototype.open=function(){var p=this;this.cropShadeElement=Xe.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Xe.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var S=0;S<this.numberOfGridLines;S++)this.horizontalGridLines.push(Xe.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(Xe.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(K){return p.gridContainer.appendChild(K)}),this.verticalGridLines.forEach(function(K){return p.gridContainer.appendChild(K)}),this.cropRectElement=Xe.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},H.prototype.setCropRectangle=function(p){this.cropRect=p;var S=Object.assign({},this.cropRect);this.zoomFactor!==1&&(S.width=this.cropRect.width*this.zoomFactor,S.height=this.cropRect.height*this.zoomFactor,S.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-S.width/2,S.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-S.height/2),Xe.setAttributes(this.cropRectElement,[["x",S.x.toString()],["y",S.y.toString()],["width",S.width.toString()],["height",S.height.toString()]]);var K=S.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(G,Ae){var $e=S.y+K*(Ae+1);Xe.setAttributes(G,[["x1",""+S.x],["y1",""+$e],["x2",""+(S.x+S.width)],["y2",""+$e]])});var $=S.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(G,Ae){var $e=S.x+$*(Ae+1);Xe.setAttributes(G,[["x1",""+$e],["y1",""+S.y],["x2",""+$e],["y2",""+(S.y+S.height)]])}),Xe.setAttributes(this.cropShadeElement,[["d",Xe.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,S.x,S.y,S.width,S.height)]]),this.topLeftGrip.setCenter(S.x,S.y),this.topRightGrip.setCenter(S.x+S.width,S.y),this.bottomLeftGrip.setCenter(S.x,S.y+S.height),this.bottomRightGrip.setCenter(S.x+S.width,S.y+S.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},H.prototype.attachEvents=function(){this.container.style.touchAction="none",this.container.addEventListener("pointerdown",this.onPointerDown),this.container.addEventListener("pointermove",this.onPointerMove),this.container.addEventListener("pointerup",this.onPointerUp)},H.prototype.clientToLocalCoordinates=function(p,S){var K=this.container.getBoundingClientRect();return{x:p-K.left+this.margin,y:S-K.top+this.margin}},H.prototype.onPointerDown=function(p){this.container.setPointerCapture(p.pointerId),this.previousPoint=this.clientToLocalCoordinates(p.clientX,p.clientY),this.cropRectElement===p.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(p.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(p.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(p.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(p.target)&&(this.activeGrip=this.bottomRightGrip)},H.prototype.onPointerMove=function(p){if(this.isMoving)this.move(this.clientToLocalCoordinates(p.clientX,p.clientY));else if(this.activeGrip){var S=this.clientToLocalCoordinates(p.clientX,p.clientY);this.resize(S)}p.preventDefault()},H.prototype.onPointerUp=function(p){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(p.pointerId)},H.prototype.move=function(p){var S=p.x-this.previousPoint.x,K=p.y-this.previousPoint.y;this.zoomFactor!==1&&(S=-S/this.zoomFactor,K=-K/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+S),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+K),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=p},H.prototype.resize=function(p){var S=Object.assign({},this.cropRect),K=p.x-this.previousPoint.x,$=p.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:S.x+K<this.margin&&(K=this.margin-S.x),S.x+=K,S.width=this.cropRect.x+this.cropRect.width-S.x;break;case this.bottomRightGrip:case this.topRightGrip:S.width+K>this.canvasWidth*this.zoomFactor&&(K=this.canvasWidth*this.zoomFactor-S.width),S.width+=K}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(S.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(K),S.height=this.aspectRatio.getVerticalLength(S.width)):(S.y+=$,S.height=this.cropRect.y+this.cropRect.height-S.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?S.height=this.aspectRatio.getVerticalLength(S.width):S.height+=$}S.width<10&&(S.x=this.cropRect.x,S.width=10),S.height<10&&(S.y=this.cropRect.y,S.height=10),this.previousPoint=p,S.x>=this.margin&&S.y>=this.margin&&S.x-this.margin+S.width<=this.canvasWidth&&S.y-this.margin+S.height<=this.canvasHeight&&(this.cropRect=S,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},H.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var p=this.cropRect.x+this.cropRect.width/2,S=this.cropRect.y+this.cropRect.height/2,K=this.aspectRatio.getHorizontalLength(this.cropRect.height),$=this.aspectRatio.getVerticalLength(this.cropRect.width);K/this.canvasWidth<$/this.canvasHeight?this.cropRect.width=K:this.cropRect.height=$,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=p-this.cropRect.width/2,this.cropRect.y=S-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},H.prototype.getRescaledRect=function(p,S,K,$,G,Ae){var $e=K/p,pt=$/S;return{x:(G.x-Ae)*$e+Ae,y:(G.y-Ae)*pt+Ae,width:G.width*$e,height:G.height*pt}},H.prototype.scaleCanvas=function(p,S){var K=this.getRescaledRect(this.canvasWidth,this.canvasHeight,p,S,this.cropRect,this.margin);this.canvasWidth=p,this.canvasHeight=S,this.onCropChange&&this.onCropChange(K),this.setCropRectangle(K)},H}(),ir=function(){function H(p){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=p,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(H.prototype,"angle",{get:function(){return this._angle},set:function(p){this._angle=p,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),H.prototype.getUI=function(){return this.controlContainer=document.createElement("div"),this.controlContainer.title=this.title,this.controlContainer.className=this.className+" "+this.colorsClassName,this.controlContainer.appendChild(this.getVisual()),this.controlContainer.addEventListener("pointerdown",this.onPointerDown),this.controlContainer.addEventListener("pointermove",this.onPointerMove),this.controlContainer.addEventListener("pointerup",this.onPointerUp),this.uiContainer.appendChild(this.controlContainer),this.uiContainer.style.display="inline-block",this.uiContainer.style.touchAction="none",this.setAngleLabel(),this.positionScaleShape(),this.uiContainer},H.prototype.onPointerDown=function(p){this.controlContainer.setPointerCapture(p.pointerId),this.isDragging=!0,this.previousPoint={x:p.clientX,y:p.clientY}},H.prototype.onPointerMove=function(p){this.isDragging&&(this.onAngleChange&&this.onAngleChange((p.clientX-this.previousPoint.x)/5),this.previousPoint.x=p.clientX)},H.prototype.onPointerUp=function(p){this.isDragging&&this.onAngleChange&&this.onAngleChange((p.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(p.pointerId)},H.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var p=this.angleLabelText.getBBox();Xe.setAttributes(this.angleLabelElement,[["x",((this.width-p.width)/2).toString()],["y",(this.height/2).toString()]])}},H.prototype.positionScaleShape=function(){if(this.scaleShape){var p=this.scaleShape.transform.baseVal.getItem(0);p.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(p,0)}},H.prototype.getVisual=function(){var p=document.createElementNS("http://www.w3.org/2000/svg","svg");p.setAttribute("xmlns","http://www.w3.org/2000/svg"),p.setAttribute("width",this.width+"px"),p.setAttribute("height",this.height+"px"),p.setAttribute("viewBox","0 0 "+this.width+" "+this.height),p.style.flexShrink="0",document.body.appendChild(p);for(var S="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,K=1;K<=this.width/5+10;K++){var $=K%5==0?this.height/3:this.height/6;S+="h4v"+-$+"h1v"+$}S+="v1H0Z",this.scaleShape=Xe.createPath(S);var G=Xe.createTransform();this.scaleShape.transform.baseVal.appendItem(G),p.appendChild(this.scaleShape),this.angleLabelElement=Xe.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Xe.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var Ae=Xe.createTSpan("");return Ae.innerHTML="°",this.angleLabelElement.appendChild(Ae),p.appendChild(this.angleLabelElement),document.body.removeChild(p),p},H}(),Dr=function(){function H(){this.naturalSize=!1,this.imageType="image/png"}return H.prototype.rasterize=function(p,S,K,$,G,Ae,$e){var pt=this;return new Promise(function(_t){var Ze=document.createElement("canvas");Ze.width=p.width.baseVal.value-2*$,Ze.height=p.height.baseVal.value-2*$;var Bt=1,It=1;pt.naturalSize===!0?(Bt=S.naturalWidth/(p.width.baseVal.value-2*$)/Ae,It=S.naturalHeight/(p.height.baseVal.value-2*$)/$e,Ze.width=S.naturalWidth/Ae,Ze.height=S.naturalHeight/$e):pt.width!==void 0&&pt.height!==void 0&&(Bt=pt.width/K.width,It=pt.height/K.height,Ze.width*=Bt,Ze.height*=It);var hr=Ze.getContext("2d");hr.translate(Ze.width/2,Ze.height/2),hr.rotate(G*Math.PI/180),hr.scale(Ae,$e),hr.translate(-Ze.width/2,-Ze.height/2),hr.drawImage(S,0,0,Ze.width,Ze.height);var Wr=document.createElement("canvas");Wr.width=K.width*Bt,Wr.height=K.height*It,Wr.getContext("2d").putImageData(hr.getImageData((K.x-$)*Bt,(K.y-$)*It,K.width*Bt,K.height*It),0,0),_t(Wr.toDataURL(pt.imageType,pt.imageQuality))})},H}(),et=function(){function H(p){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=H.instanceCounter++,this.styles=new bt(this.instanceNo),this.target=p,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(H.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(p){this._zoomToCropEnabled=p,p?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(p){this._isGridVisible=p,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"gridLines",{get:function(){return this._gridLines},set:function(p){this._gridLines=p,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(p){this._rotationAngle=p,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"aspectRatio",{get:function(){var p;return(p=this._aspectRatio)!==null&&p!==void 0?p:this.aspectRatios[0]},set:function(p){this._aspectRatio=p},enumerable:!1,configurable:!0}),H.prototype.open=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.setupResizeObserver(),this.initCropCanvas(),this.setEditingTarget(),this.setTopLeft(),this.initCropLayer(),this.attachEvents(),this.applyAspectRatio(),this.displayMode==="popup"&&this.onPopupResize(),this._isOpen=!0},H.prototype.show=function(){this.showUI(),this.open()},H.prototype.close=function(p){p===void 0&&(p=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),p||this.closeEventListeners.forEach(function(S){return S()}),this._isOpen=!1)},H.prototype.addRenderEventListener=function(p){this.renderEventListeners.push(p)},H.prototype.removeRenderEventListener=function(p){this.renderEventListeners.indexOf(p)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(p),1)},H.prototype.addCloseEventListener=function(p){this.closeEventListeners.push(p)},H.prototype.removeCloseEventListener=function(p){this.closeEventListeners.indexOf(p)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(p),1)},H.prototype.setupResizeObserver=function(){var p=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){p.resize(p.target.clientWidth,p.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},H.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var p=1*this.target.clientWidth/this.target.clientHeight,S=this.contentDiv.clientWidth/p>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*p:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,K=S+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/p;this.resize(S,K)}},H.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},H.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",Xe.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},H.prototype.resize=function(p,S){this.imageWidth=Math.round(p),this.imageHeight=Math.round(S),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},H.prototype.setEditingTarget=function(){var p=document.createElement("canvas");p.width=this.target.naturalWidth,p.height=this.target.naturalHeight,p.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var S=p.toDataURL();Xe.setAttributes(this.editingTarget,[["href",S]]),this.setEditingTargetSize()},H.prototype.setTopLeft=function(){var p=this.target.getBoundingClientRect(),S=this.editorCanvas.getBoundingClientRect();this.left=p.left-S.left-this.CANVAS_MARGIN,this.top=p.top-S.top-this.CANVAS_MARGIN},H.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=Xe.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=Xe.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=Xe.createGroup(),this.editingTargetRotationScaleContainer=Xe.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var p=Xe.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(p);var S=Xe.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(S),this.editingTargetContainer=Xe.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},H.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},H.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=Xe.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Gt(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},H.prototype.zoomToCrop=function(){if(this.cropRect){var p=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,S=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=p+"px "+S+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-p+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-S+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},H.prototype.unzoomFromCrop=function(){this.zoomFactor=1,this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin="center",this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px) scale(1)",this.cropLayer.zoomFactor=this.zoomFactor)},H.prototype.cropRectChanged=function(p){this.cropRect=p,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},H.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},H.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},H.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},H.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var p=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,S=this.target.offsetTop>p+this.CANVAS_MARGIN?this.target.offsetTop-(p+this.CANVAS_MARGIN):0;this.coverDiv.style.top=S+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},H.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},H.prototype.addTopToolbar=function(){var p=this;this.topToolbar=new st,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 S=new Wt;S.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(S);var K=[];this.aspectRatios.forEach(function(It){var hr=new St($t.getIcon(It.horizontal,It.vertical),It.horizontal===0&&It.vertical===0?"FREE":It.horizontal+":"+It.vertical);hr.onClick=function(){return p.ratioButtonClicked(It)},K.push(hr)}),this.aspectRatioButton=new Tt($t.getIcon(0,0),"Aspect ratio",K),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,S.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var $=new St('<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");$.isActive=this.isGridVisible,$.onClick=function(){p.isGridVisible=!p.isGridVisible,$.isActive=p.isGridVisible},S.addButton($);var G=new St('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(G.isActive=this.zoomToCropEnabled,G.onClick=function(){p.zoomToCropEnabled=!p.zoomToCropEnabled,G.isActive=p.zoomToCropEnabled},S.addButton(G),!Rt.isLicensed){var Ae=new ut;this.topToolbar.addElementBlock(Ae);var $e=document.createElement("div");$e.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var pt=document.createElement("a");pt.style.color="currentColor",pt.href="https://markerjs.com/products/cropro",pt.target="_blank",pt.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>',$e.appendChild(pt),Ae.addElement($e)}var _t=new Wt;_t.minWidth=3*this.toolbarHeight+"px",_t.contentAlign="end",this.topToolbar.addButtonBlock(_t);var Ze=new St('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");Ze.onClick=this.startRenderAndClose,_t.addButton(Ze),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ze.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Bt=new St('<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");Bt.onClick=this.close,_t.addButton(Bt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Bt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},H.prototype.addBottomToolbar=function(){var p=this;this.bottomToolbar=new st,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 S=new Wt;S.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(S);var K=new St('<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");K.onClick=this.rotateLeftButtonClicked,S.addButton(K);var $=new St('<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");$.onClick=this.rotateRightButtonClicked,S.addButton($);var G=new ut;G.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(G),this.straightener=new ir("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(_t){p.rotateBy(_t),p.straightener.angle=p.rotationAngle},G.addElement(this.straightener.getUI());var Ae=new Wt;Ae.minWidth=2*this.toolbarHeight+"px",Ae.contentAlign="end",this.bottomToolbar.addButtonBlock(Ae);var $e=new St('<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");$e.onClick=this.flipHorizontallyButtonClicked,Ae.addButton($e);var pt=new St('<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");pt.onClick=this.flipVerticallyButtonClicked,Ae.addButton(pt)},H.prototype.ratioButtonClicked=function(p){this.aspectRatio=p,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},H.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=$t.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},H.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new or(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},H.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},H.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},H.prototype.restoreState=function(p){if(p){var S=this.cropLayer.getRescaledRect(p.width,p.height,this.imageWidth,this.imageHeight,p.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(S),this.cropRectChanged(S),this.flippedHorizontally=p.flippedHorizontally,this.flippedVertically=p.flippedVertically,this.applyFlip(),this.rotationAngle=p.rotationAngle,this.applyRotation()}},H.prototype.clientToLocalCoordinates=function(p,S){var K=this.cropImage.getBoundingClientRect();return{x:p-K.left,y:S-K.top}},H.prototype.onWindowResize=function(){this.positionUI()},H.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var p=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=p+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},H.prototype.rotateLeftButtonClicked=function(){var p=this.rotationAngle-90;this.rotationAngle%90!=0&&(p+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(p)},H.prototype.rotateRightButtonClicked=function(){var p=this.rotationAngle+90;this.rotationAngle%90!=0&&(p-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(p)},H.prototype.rotateTo=function(p){p=(p=p>180?p-360:p)<=-180?p+360:p,this.rotationAngle=p,this.applyRotation()},H.prototype.rotateBy=function(p){this.rotateTo((this.rotationAngle+p)%360)},H.prototype.applyRotation=function(){var p=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var S=this.editingTargetRotationContainer.transform.baseVal.getItem(0);S.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(S,0);var K=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/K.width,this.imageHeight/K.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=p},H.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},H.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},H.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},H.prototype.startRenderAndClose=function(){return Et(this,void 0,void 0,function(){var p,S;return Mt(this,function(K){switch(K.label){case 0:return[4,this.render()];case 1:return p=K.sent(),S=this.getState(),this.renderEventListeners.forEach(function($){return $(p,S)}),this.close(!0),[2]}})})},H.prototype.render=function(){return Et(this,void 0,void 0,function(){var p;return Mt(this,function(S){switch(S.label){case 0:return(p=new Dr).naturalSize=this.renderAtNaturalSize,p.imageType=this.renderImageType,p.imageQuality=this.renderImageQuality,p.width=this.renderWidth,p.height=this.renderHeight,this.unzoomFromCrop(),Xe.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,p.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 S.sent(),[4,p.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,S.sent()]}})})},H.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new lt("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 lt("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new lt("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var p=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new lt("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*p)+`px;
|
|
height: `+(this.toolbarHeight-2*p)+`px;
|
|
padding: `+p+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new lt("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new lt("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new ot("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new ot("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new lt("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 lt("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new lt("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 lt("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*p)+`px;
|
|
padding: `+p+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new lt("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},H.instanceCounter=0,H}(),Ct=Y("8hTe"),Ut=Y.n(Ct),nr=/<pre[^>]*>/g;function mr(H){var p=document.createElement("div");return p.innerHTML=H,p.childNodes.length===0?"":p.childNodes[0].nodeValue}var Cr=ze.a=function(H){var p=H.value,S=p===void 0?"":p,K=H.edit,$=K===void 0?!1:K,G=H.className,Ae=H.showTextOnly,$e=H.showLines,pt=H.replaces,_t=H.zoomImg,Ze=H.hasMask,Bt=H.style,It=Bt===void 0?{}:Bt,hr=H.stylesPrev,Wr=hr===void 0?{}:hr,Hr=String(S),br=Object(D.useRef)(),Jr=Object(D.useRef)(),Sn=Object(D.useState)(""),Fr=Object(j.a)(Sn,2),Jt=Fr[0],jt=Fr[1],Xt=Object(D.useState)("office"),Zt=Object(j.a)(Xt,2),sr=Zt[0],qt=Zt[1],Sr=function(){var Yt=new et(Jr.current);Yt.displayMode="popup",Yt.addRenderEventListener(function(){var Tr=Object(O.a)(k.a.mark(function tr(Er){var Vt;return k.a.wrap(function(_r){for(;;)switch(_r.prev=_r.next){case 0:return br.current.style.display="none",_r.next=3,Object(Te.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Er}});case 3:Vt=_r.sent,Vt!=null&&Vt.id&&pt(Jr.current.getAttribute("src").replace(ae.a.API_SERVER,""),"/api/attachments/".concat(Vt==null?void 0:Vt.id,"?type=").concat(Vt.content_type));case 5:case"end":return _r.stop()}},tr)}));return function(tr){return Tr.apply(this,arguments)}}()),Yt.show()},Ir=function(){var Yt=new wt(Jr.current);Yt.settings.displayMode="popup",Yt.addEventListener("render",function(){var Tr=Object(O.a)(k.a.mark(function tr(Er){var Vt;return k.a.wrap(function(_r){for(;;)switch(_r.prev=_r.next){case 0:if(br.current.style.display="none",!Jr.current){_r.next=6;break}return _r.next=4,Object(Te.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Er.dataUrl}});case 4:Vt=_r.sent,Vt!=null&&Vt.id&&pt(Jr.current.getAttribute("src").replace(ae.a.API_SERVER,""),"/api/attachments/".concat(Vt==null?void 0:Vt.id,"?type=").concat(Vt.content_type));case 6:case"end":return _r.stop()}},tr)}));return function(tr){return Tr.apply(this,arguments)}}()),Yt.show(),window.markerArea=Yt},Or=Object(D.useMemo)(function(){try{var lr=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Yt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Tr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Hr=Hr.replace(lr,"("+ae.a.API_SERVER+"/api/attachments/").replace(Yt,'"'+ae.a.API_SERVER+"/api/attachments/").replace(Tr,'"'+ae.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,`
|
|
`),Hr=Hr.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
|
|
`)}catch(en){}var tr=V(Hr),Er=g();if(Hr.match(/\[TOC\]/)&&(tr=tr.replace("<p>[TOC]</p>",_()),C()),tr=tr.replace(/(__special_katext_id_\d+__)/g,function(en,_r){var Xr=Er[_r],vr=Xr.type,bn=Xr.expression;return Object(ue.renderToString)(mr(bn)||"",{displayMode:vr==="block",throwOnError:!1,output:"html"})}),tr=tr.replace(/▁/g,"\u2581\u2581\u2581"),l(),Ae){var Vt=document.createElement("div");return Vt.innerHTML=tr,Vt.innerText}return setTimeout(function(){return on()},500),tr},[Hr]),wr=Object(D.useRef)();v.WebkitLineClamp=$e,$e&&(It=Object(U.a)(Object(U.a)({},It),v));function Zr(lr){var Yt=lr.target;if(Yt.tagName.toUpperCase()==="IMG"){if(_t){var Tr=Yt.getAttribute("src");jt(Tr),qt("image")}}else if(Yt.tagName.toUpperCase()==="A"){var tr=Yt.getAttribute("href");if(tr.indexOf("office")>-1)lr.preventDefault(),jt(tr),qt("office");else if(tr.indexOf("application/pdf")>-1)lr.preventDefault(),jt(tr),qt("pdf");else if(tr.indexOf("type=text")>-1)lr.preventDefault(),jt(tr),qt("html");else if(tr.startsWith("#")){lr.preventDefault();var Er=document.getElementById(tr.replace("#",""));Er&&Er.scrollIntoView(!0)}}}var on=function(){var Yt,Tr=(Yt=wr.current)===null||Yt===void 0?void 0:Yt.querySelectorAll("video");Tr==null||Tr.forEach(function(tr){if(tr.oncontextmenu=function(){return!1},tr.src.indexOf(".m3u8")>-1&&!tr.canPlayType("application/vnd.apple.mpegurl")){if(J.a.isSupported()){var Er=new J.a;Er.loadSource(tr.src),Er.attachMedia(tr)}}})};Object(D.useEffect)(function(){if(wr.current&&Or&&(Or.match(nr)&&window.PR.prettyPrint()),wr.current)return wr.current.addEventListener("click",Zr),function(){wr.current.removeEventListener("click",Zr),l(),C()}},[Or,wr.current,Zr]);var hn=function(Yt){if(!$)return;Yt.target.nodeName==="IMG"?(br.current.style.display="flex",br.current.style.width=Yt.target.clientWidth+"px",br.current.style.height=Yt.target.clientHeight+"px",br.current.style.top=Yt.target.offsetTop+"px",br.current.style.left=Yt.target.offsetLeft+"px",Jr.current.src=Yt.target.getAttribute("src")):br.current.style.display="none"};return E.a.createElement("div",{style:{position:"relative"}},E.a.createElement("div",{ref:wr,style:Object(U.a)({},It),className:"".concat(G||""," markdown-body ").concat(Ut.a.mdBody),onMouseOver:hn,dangerouslySetInnerHTML:{__html:Or}}),E.a.createElement("div",{ref:br,className:Ut.a.button},E.a.createElement(X.a,null,E.a.createElement(Z.a,{onClick:function(){return Sr()}},"\u88C1\u526A"),E.a.createElement(Z.a,{onClick:function(){return Ir()}},"\u7F16\u8F91"))),E.a.createElement("img",{ref:Jr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),E.a.createElement(ve.a,{close:!0,data:Jt,hasMask:Ze,type:Jt!=null&&Jt.length?sr:"",style:Object(U.a)({},Wr),onClose:function(){return jt("")}}))}},"9VGf":function(gt,ze,Y){"use strict";Y.d(ze,"a",function(){return R});var ce=Y("q1tI"),X=Y.n(ce);function R(Z,U){var O=Object(ce.useRef)();Object(ce.useEffect)(function(){O.current=Z}),Object(ce.useEffect)(function(){function j(){O.current()}if(U!==null){var B=setInterval(j,U);return function(){return clearInterval(B)}}},[U])}},BU3w:function(gt,ze,Y){"use strict";Y.d(ze,"a",function(){return O});var ce=Y("MNnm"),X="rc-util-key";function R(j){if(j.attachTo)return j.attachTo;var B=document.querySelector("head");return B||document.body}function Z(j){var B,k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ce.a)())return null;var D=document.createElement("style");if((B=k.csp)===null||B===void 0?void 0:B.nonce){var E;D.nonce=(E=k.csp)===null||E===void 0?void 0:E.nonce}D.innerHTML=j;var A=R(k),P=A.firstChild;return k.prepend&&A.prepend?A.prepend(D):k.prepend&&P?A.insertBefore(D,P):A.appendChild(D),D}var U=new Map;function O(j,B){var k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},D=R(k);if(!U.has(D)){var E=Z("",k),A=E.parentNode;U.set(D,A),A.removeChild(E)}var P=Array.from(U.get(D).children).find(function(s){return s.tagName==="STYLE"&&s[X]===B});if(P){var w,y;if(((w=k.csp)===null||w===void 0?void 0:w.nonce)&&P.nonce!==((y=k.csp)===null||y===void 0?void 0:y.nonce)){var b;P.nonce=(b=k.csp)===null||b===void 0?void 0:b.nonce}return P.innerHTML!==j&&(P.innerHTML=j),P}var c=Z(j,k);return c[X]=B,c}},Bd2K:function(gt,ze,Y){(function(ce){ce(Y("VrN/"),Y("osHv"))})(function(ce){ce.defineOption("autoCloseTags",!1,function(k,D,E){if(E!=ce.Init&&E&&k.removeKeyMap("autoCloseTags"),!D)return;var A={name:"autoCloseTags"};(typeof D!="object"||D.whenClosing!==!1)&&(A["'/'"]=function(P){return O(P)}),(typeof D!="object"||D.whenOpening!==!1)&&(A["'>'"]=function(P){return Z(P)}),k.addKeyMap(A)});var X=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],R=["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 Z(k){if(k.getOption("disableInput"))return ce.Pass;for(var D=k.listSelections(),E=[],A=k.getOption("autoCloseTags"),P=0;P<D.length;P++){if(!D[P].empty())return ce.Pass;var w=D[P].head,y=k.getTokenAt(w),b=ce.innerMode(k.getMode(),y.state),c=b.state,s=b.mode.xmlCurrentTag&&b.mode.xmlCurrentTag(c),u=s&&s.name;if(!u)return ce.Pass;var f=b.mode.configuration=="html",C=typeof A=="object"&&A.dontCloseTags||f&&X,v=typeof A=="object"&&A.indentTags||f&&R;y.end>w.ch&&(u=u.slice(0,u.length-y.end+w.ch));var m=u.toLowerCase();if(!u||y.type=="string"&&(y.end!=w.ch||!/[\"\']/.test(y.string.charAt(y.string.length-1))||y.string.length==1)||y.type=="tag"&&s.close||y.string.indexOf("/")==w.ch-y.start-1||C&&j(C,m)>-1||B(k,b.mode.xmlCurrentContext&&b.mode.xmlCurrentContext(c)||[],u,w,!0))return ce.Pass;var _=typeof A=="object"&&A.emptyTags;if(_&&j(_,u)>-1){E[P]={text:"/>",newPos:ce.Pos(w.line,w.ch+2)};continue}var x=v&&j(v,m)>-1;E[P]={indent:x,text:">"+(x?`
|
|
|
|
`:"")+"</"+u+">",newPos:x?ce.Pos(w.line+1,0):ce.Pos(w.line,w.ch+1)}}for(var d=typeof A=="object"&&A.dontIndentOnAutoClose,P=D.length-1;P>=0;P--){var h=E[P];k.replaceRange(h.text,D[P].head,D[P].anchor,"+insert");var o=k.listSelections().slice(0);o[P]={head:h.newPos,anchor:h.newPos},k.setSelections(o),!d&&h.indent&&(k.indentLine(h.newPos.line,null,!0),k.indentLine(h.newPos.line+1,null,!0))}}function U(k,D){for(var E=k.listSelections(),A=[],P=D?"/":"</",w=k.getOption("autoCloseTags"),y=typeof w=="object"&&w.dontIndentOnSlash,b=0;b<E.length;b++){if(!E[b].empty())return ce.Pass;var c=E[b].head,s=k.getTokenAt(c),u=ce.innerMode(k.getMode(),s.state),f=u.state;if(D&&(s.type=="string"||s.string.charAt(0)!="<"||s.start!=c.ch-1))return ce.Pass;var C,v=u.mode.name!="xml"&&k.getMode().name=="htmlmixed";if(v&&u.mode.name=="javascript")C=P+"script";else if(v&&u.mode.name=="css")C=P+"style";else{var m=u.mode.xmlCurrentContext&&u.mode.xmlCurrentContext(f);if(!m||m.length&&B(k,m,m[m.length-1],c))return ce.Pass;C=P+m[m.length-1]}k.getLine(c.line).charAt(s.end)!=">"&&(C+=">"),A[b]=C}if(k.replaceSelections(A),E=k.listSelections(),!y)for(var b=0;b<E.length;b++)(b==E.length-1||E[b].head.line<E[b+1].head.line)&&k.indentLine(E[b].head.line)}function O(k){return k.getOption("disableInput")?ce.Pass:U(k,!0)}ce.commands.closeTag=function(k){return U(k)};function j(k,D){if(k.indexOf)return k.indexOf(D);for(var E=0,A=k.length;E<A;++E)if(k[E]==D)return E;return-1}function B(k,D,E,A,P){if(!ce.scanForClosingTag)return!1;var w=Math.min(k.lastLine()+1,A.line+500),y=ce.scanForClosingTag(k,A,null,w);if(!y||y.tag!=E)return!1;for(var b=P?1:0,c=D.length-1;c>=0&&D[c]==E;c--)++b;A=y.to;for(var c=1;c<b;c++){var s=ce.scanForClosingTag(k,A,null,w);if(!s||s.tag!=E)return!1;A=s.to}return!0}})},BjJ7:function(gt,ze,Y){"use strict";Y.d(ze,"d",function(){return X}),Y.d(ze,"c",function(){return R}),Y.d(ze,"e",function(){return Z}),Y.d(ze,"b",function(){return U}),Y.d(ze,"a",function(){return j});var ce=Y("m3rI");function X(B){var k=!0;if(B.length>0){for(var D=0;D<B.length;D++)if(B[D].compile_success==0||!B[D].compile_success){k=!1;break}}else k=!1;return k}function R(B){for(var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",D=[],E=0;E<B.length;E++){var A=B[E],P=k?"".concat(k,"/").concat(A.name):"".concat(A.name);D.push({title:A.name,isLeaf:!(A.type==="tree"),key:P})}return D}function Z(B,k,D){for(var E=0;E<B.length;E++){var A=B[E];if(A.key===k){A.children=D;break}A.children&&Z(A.children,k,D)}return B}function U(B,k,D){var E;return function(){var A=this,P=arguments,w=function(){E=null,D||B.apply(A,P)},y=D&&!E;clearTimeout(E),E=setTimeout(w,k),y&&B.apply(A,P)}}var O=!0,j=ce.a.API_SERVER},"C+DQ":function(gt,ze,Y){},DlQD:function(gt,ze,Y){(function(ce,X){gt.exports=X()})(this,function(){"use strict";function ce(xe,pe){for(var be=0;be<pe.length;be++){var te=pe[be];te.enumerable=te.enumerable||!1,te.configurable=!0,"value"in te&&(te.writable=!0),Object.defineProperty(xe,te.key,te)}}function X(xe,pe,be){return pe&&ce(xe.prototype,pe),be&&ce(xe,be),xe}function R(xe,pe){if(!xe)return;if(typeof xe=="string")return Z(xe,pe);var be=Object.prototype.toString.call(xe).slice(8,-1);if(be==="Object"&&xe.constructor&&(be=xe.constructor.name),be==="Map"||be==="Set")return Array.from(xe);if(be==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(be))return Z(xe,pe)}function Z(xe,pe){(pe==null||pe>xe.length)&&(pe=xe.length);for(var be=0,te=new Array(pe);be<pe;be++)te[be]=xe[be];return te}function U(xe,pe){var be;if(typeof Symbol=="undefined"||xe[Symbol.iterator]==null){if(Array.isArray(xe)||(be=R(xe))||pe&&xe&&typeof xe.length=="number"){be&&(xe=be);var te=0;return function(){return te>=xe.length?{done:!0}:{done:!1,value:xe[te++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return be=xe[Symbol.iterator](),be.next.bind(be)}function O(xe,pe){return pe={exports:{}},xe(pe,pe.exports),pe.exports}var j=O(function(xe){function pe(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function be(te){xe.exports.defaults=te}xe.exports={defaults:pe(),getDefaults:pe,changeDefaults:be}}),B=j.defaults,k=j.getDefaults,D=j.changeDefaults,E=/[&<>"']/,A=/[&<>"']/g,P=/[<>"']|&(?!#?\w+;)/,w=/[<>"']|&(?!#?\w+;)/g,y={"&":"&","<":"<",">":">",'"':""","'":"'"},b=function(pe){return y[pe]};function c(xe,pe){if(pe){if(E.test(xe))return xe.replace(A,b)}else if(P.test(xe))return xe.replace(w,b);return xe}var s=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function u(xe){return xe.replace(s,function(pe,be){return be=be.toLowerCase(),be==="colon"?":":be.charAt(0)==="#"?be.charAt(1)==="x"?String.fromCharCode(parseInt(be.substring(2),16)):String.fromCharCode(+be.substring(1)):""})}var f=/(^|[^\[])\^/g;function C(xe,pe){xe=xe.source||xe,pe=pe||"";var be={replace:function(de,he){return he=he.source||he,he=he.replace(f,"$1"),xe=xe.replace(de,he),be},getRegex:function(){return new RegExp(xe,pe)}};return be}var v=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function _(xe,pe,be){if(xe){var te;try{te=decodeURIComponent(u(be)).replace(v,"").toLowerCase()}catch(de){return null}if(te.indexOf("javascript:")===0||te.indexOf("vbscript:")===0||te.indexOf("data:")===0)return null}pe&&!m.test(be)&&(be=i(pe,be));try{be=encodeURI(be).replace(/%25/g,"%")}catch(de){return null}return be}var x={},d=/^[^:]+:\/*[^/]*$/,h=/^([^:]+:)[\s\S]*$/,o=/^([^:]+:\/*[^/]*)[\s\S]*$/;function i(xe,pe){x[" "+xe]||(d.test(xe)?x[" "+xe]=xe+"/":x[" "+xe]=I(xe,"/",!0)),xe=x[" "+xe];var be=xe.indexOf(":")===-1;return pe.substring(0,2)==="//"?be?pe:xe.replace(h,"$1")+pe:pe.charAt(0)==="/"?be?pe:xe.replace(o,"$1")+pe:xe+pe}var g={exec:function(){}};function l(xe){for(var pe=1,be,te;pe<arguments.length;pe++){be=arguments[pe];for(te in be)Object.prototype.hasOwnProperty.call(be,te)&&(xe[te]=be[te])}return xe}function T(xe,pe){var be=xe.replace(/\|/g,function(he,ye,De){for(var we=!1,We=ye;--We>=0&&De[We]==="\\";)we=!we;return we?"|":" |"}),te=be.split(/ \|/),de=0;if(te.length>pe)te.splice(pe);else for(;te.length<pe;)te.push("");for(;de<te.length;de++)te[de]=te[de].trim().replace(/\\\|/g,"|");return te}function I(xe,pe,be){var te=xe.length;if(te===0)return"";for(var de=0;de<te;){var he=xe.charAt(te-de-1);if(he===pe&&!be)de++;else if(he!==pe&&be)de++;else break}return xe.substr(0,te-de)}function F(xe,pe){if(xe.indexOf(pe[1])===-1)return-1;for(var be=xe.length,te=0,de=0;de<be;de++)if(xe[de]==="\\")de++;else if(xe[de]===pe[0])te++;else if(xe[de]===pe[1]&&(te--,te<0))return de;return-1}function W(xe){xe&&xe.sanitize&&!xe.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 V={escape:c,unescape:u,edit:C,cleanUrl:_,resolveUrl:i,noopTest:g,merge:l,splitCells:T,rtrim:I,findClosingBracket:F,checkSanitizeDeprecation:W},M=j.defaults,N=V.rtrim,J=V.splitCells,ae=V.escape,ue=V.findClosingBracket;function ve(xe,pe,be){var te=pe.href,de=pe.title?ae(pe.title):null,he=xe[1].replace(/\\([\[\]])/g,"$1");return xe[0].charAt(0)!=="!"?{type:"link",raw:be,href:te,title:de,text:he}:{type:"image",raw:be,href:te,title:de,text:ae(he)}}function Te(xe,pe){var be=xe.match(/^(\s+)(?:```)/);if(be===null)return pe;var te=be[1];return pe.split(`
|
|
`).map(function(de){var he=de.match(/^\s+/);if(he===null)return de;var ye=he[0];return ye.length>=te.length?de.slice(te.length):de}).join(`
|
|
`)}var _e=function(){function xe(be){this.options=be||M}var pe=xe.prototype;return pe.space=function(te){var de=this.rules.block.newline.exec(te);if(de)return de[0].length>1?{type:"space",raw:de[0]}:{raw:`
|
|
`}},pe.code=function(te,de){var he=this.rules.block.code.exec(te);if(he){var ye=de[de.length-1];if(ye&&ye.type==="paragraph")return{raw:he[0],text:he[0].trimRight()};var De=he[0].replace(/^ {4}/gm,"");return{type:"code",raw:he[0],codeBlockStyle:"indented",text:this.options.pedantic?De:N(De,`
|
|
`)}}},pe.fences=function(te){var de=this.rules.block.fences.exec(te);if(de){var he=de[0],ye=Te(he,de[3]||"");return{type:"code",raw:he,lang:de[2]?de[2].trim():de[2],text:ye}}},pe.heading=function(te){var de=this.rules.block.heading.exec(te);if(de)return{type:"heading",raw:de[0],depth:de[1].length,text:de[2]}},pe.nptable=function(te){var de=this.rules.block.nptable.exec(te);if(de){var he={type:"table",header:J(de[1].replace(/^ *| *\| *$/g,"")),align:de[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:de[3]?de[3].replace(/\n$/,"").split(`
|
|
`):[],raw:de[0]};if(he.header.length===he.align.length){var ye=he.align.length,De;for(De=0;De<ye;De++)/^ *-+: *$/.test(he.align[De])?he.align[De]="right":/^ *:-+: *$/.test(he.align[De])?he.align[De]="center":/^ *:-+ *$/.test(he.align[De])?he.align[De]="left":he.align[De]=null;for(ye=he.cells.length,De=0;De<ye;De++)he.cells[De]=J(he.cells[De],he.header.length);return he}}},pe.hr=function(te){var de=this.rules.block.hr.exec(te);if(de)return{type:"hr",raw:de[0]}},pe.blockquote=function(te){var de=this.rules.block.blockquote.exec(te);if(de){var he=de[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:de[0],text:he}}},pe.list=function(te){var de=this.rules.block.list.exec(te);if(de){for(var he=de[0],ye=de[2],De=ye.length>1,we=ye[ye.length-1]===")",We={type:"list",raw:he,ordered:De,start:De?+ye.slice(0,-1):"",loose:!1,items:[]},Qe=de[0].match(this.rules.block.item),nt=!1,Ve,dt,ct,at,Dt,wt,xt,kt=Qe.length,Et=0;Et<kt;Et++)Ve=Qe[Et],he=Ve,dt=Ve.length,Ve=Ve.replace(/^ *([*+-]|\d+[.)]) */,""),~Ve.indexOf(`
|
|
`)&&(dt-=Ve.length,Ve=this.options.pedantic?Ve.replace(/^ {1,4}/gm,""):Ve.replace(new RegExp("^ {1,"+dt+"}","gm"),"")),Et!==kt-1&&(ct=this.rules.block.bullet.exec(Qe[Et+1])[0],(De?ct.length===1||!we&&ct[ct.length-1]===")":ct.length>1||this.options.smartLists&&ct!==ye)&&(at=Qe.slice(Et+1).join(`
|
|
`),We.raw=We.raw.substring(0,We.raw.length-at.length),Et=kt-1)),Dt=nt||/\n\n(?!\s*$)/.test(Ve),Et!==kt-1&&(nt=Ve.charAt(Ve.length-1)===`
|
|
`,Dt||(Dt=nt)),Dt&&(We.loose=!0),wt=/^\[[ xX]\] /.test(Ve),xt=void 0,wt&&(xt=Ve[1]!==" ",Ve=Ve.replace(/^\[[ xX]\] +/,"")),We.items.push({type:"list_item",raw:he,task:wt,checked:xt,loose:Dt,text:Ve});return We}},pe.html=function(te){var de=this.rules.block.html.exec(te);if(de)return{type:this.options.sanitize?"paragraph":"html",raw:de[0],pre:!this.options.sanitizer&&(de[1]==="pre"||de[1]==="script"||de[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(de[0]):ae(de[0]):de[0]}},pe.def=function(te){var de=this.rules.block.def.exec(te);if(de){de[3]&&(de[3]=de[3].substring(1,de[3].length-1));var he=de[1].toLowerCase().replace(/\s+/g," ");return{tag:he,raw:de[0],href:de[2],title:de[3]}}},pe.table=function(te){var de=this.rules.block.table.exec(te);if(de){var he={type:"table",header:J(de[1].replace(/^ *| *\| *$/g,"")),align:de[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:de[3]?de[3].replace(/\n$/,"").split(`
|
|
`):[]};if(he.header.length===he.align.length){he.raw=de[0];var ye=he.align.length,De;for(De=0;De<ye;De++)/^ *-+: *$/.test(he.align[De])?he.align[De]="right":/^ *:-+: *$/.test(he.align[De])?he.align[De]="center":/^ *:-+ *$/.test(he.align[De])?he.align[De]="left":he.align[De]=null;for(ye=he.cells.length,De=0;De<ye;De++)he.cells[De]=J(he.cells[De].replace(/^ *\| *| *\| *$/g,""),he.header.length);return he}}},pe.lheading=function(te){var de=this.rules.block.lheading.exec(te);if(de)return{type:"heading",raw:de[0],depth:de[2].charAt(0)==="="?1:2,text:de[1]}},pe.paragraph=function(te){var de=this.rules.block.paragraph.exec(te);if(de)return{type:"paragraph",raw:de[0],text:de[1].charAt(de[1].length-1)===`
|
|
`?de[1].slice(0,-1):de[1]}},pe.text=function(te,de){var he=this.rules.block.text.exec(te);if(he){var ye=de[de.length-1];return ye&&ye.type==="text"?{raw:he[0],text:he[0]}:{type:"text",raw:he[0],text:he[0]}}},pe.escape=function(te){var de=this.rules.inline.escape.exec(te);if(de)return{type:"escape",raw:de[0],text:ae(de[1])}},pe.tag=function(te,de,he){var ye=this.rules.inline.tag.exec(te);if(ye)return!de&&/^<a /i.test(ye[0])?de=!0:de&&/^<\/a>/i.test(ye[0])&&(de=!1),!he&&/^<(pre|code|kbd|script)(\s|>)/i.test(ye[0])?he=!0:he&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ye[0])&&(he=!1),{type:this.options.sanitize?"text":"html",raw:ye[0],inLink:de,inRawBlock:he,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ye[0]):ae(ye[0]):ye[0]}},pe.link=function(te){var de=this.rules.inline.link.exec(te);if(de){var he=ue(de[2],"()");if(he>-1){var ye=de[0].indexOf("!")===0?5:4,De=ye+de[1].length+he;de[2]=de[2].substring(0,he),de[0]=de[0].substring(0,De).trim(),de[3]=""}var we=de[2],We="";if(this.options.pedantic){var Qe=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(we);Qe?(we=Qe[1],We=Qe[3]):We=""}else We=de[3]?de[3].slice(1,-1):"";we=we.trim().replace(/^<([\s\S]*)>$/,"$1");var nt=ve(de,{href:we&&we.replace(this.rules.inline._escapes,"$1"),title:We&&We.replace(this.rules.inline._escapes,"$1")},de[0]);return nt}},pe.reflink=function(te,de){var he;if((he=this.rules.inline.reflink.exec(te))||(he=this.rules.inline.nolink.exec(te))){var ye=(he[2]||he[1]).replace(/\s+/g," ");if(ye=de[ye.toLowerCase()],!ye||!ye.href){var De=he[0].charAt(0);return{type:"text",raw:De,text:De}}var we=ve(he,ye,he[0]);return we}},pe.strong=function(te,de,he){he===void 0&&(he="");var ye=this.rules.inline.strong.start.exec(te);if(ye&&(!ye[1]||ye[1]&&(he===""||this.rules.inline.punctuation.exec(he)))){de=de.slice(-1*te.length);var De=ye[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;De.lastIndex=0;for(var we;(ye=De.exec(de))!=null;)if(we=this.rules.inline.strong.middle.exec(de.slice(0,ye.index+3)),we)return{type:"strong",raw:te.slice(0,we[0].length),text:te.slice(2,we[0].length-2)}}},pe.em=function(te,de,he){he===void 0&&(he="");var ye=this.rules.inline.em.start.exec(te);if(ye&&(!ye[1]||ye[1]&&(he===""||this.rules.inline.punctuation.exec(he)))){de=de.slice(-1*te.length);var De=ye[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;De.lastIndex=0;for(var we;(ye=De.exec(de))!=null;)if(we=this.rules.inline.em.middle.exec(de.slice(0,ye.index+2)),we)return{type:"em",raw:te.slice(0,we[0].length),text:te.slice(1,we[0].length-1)}}},pe.codespan=function(te){var de=this.rules.inline.code.exec(te);if(de){var he=de[2].replace(/\n/g," "),ye=/[^ ]/.test(he),De=he.startsWith(" ")&&he.endsWith(" ");return ye&&De&&(he=he.substring(1,he.length-1)),he=ae(he,!0),{type:"codespan",raw:de[0],text:he}}},pe.br=function(te){var de=this.rules.inline.br.exec(te);if(de)return{type:"br",raw:de[0]}},pe.del=function(te){var de=this.rules.inline.del.exec(te);if(de)return{type:"del",raw:de[0],text:de[1]}},pe.autolink=function(te,de){var he=this.rules.inline.autolink.exec(te);if(he){var ye,De;return he[2]==="@"?(ye=ae(this.options.mangle?de(he[1]):he[1]),De="mailto:"+ye):(ye=ae(he[1]),De=ye),{type:"link",raw:he[0],text:ye,href:De,tokens:[{type:"text",raw:ye,text:ye}]}}},pe.url=function(te,de){var he;if(he=this.rules.inline.url.exec(te)){var ye,De;if(he[2]==="@")ye=ae(this.options.mangle?de(he[0]):he[0]),De="mailto:"+ye;else{var we;do we=he[0],he[0]=this.rules.inline._backpedal.exec(he[0])[0];while(we!==he[0]);ye=ae(he[0]),he[1]==="www."?De="http://"+ye:De=ye}return{type:"link",raw:he[0],text:ye,href:De,tokens:[{type:"text",raw:ye,text:ye}]}}},pe.inlineText=function(te,de,he){var ye=this.rules.inline.text.exec(te);if(ye){var De;return de?De=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ye[0]):ae(ye[0]):ye[0]:De=ae(this.options.smartypants?he(ye[0]):ye[0]),{type:"text",raw:ye[0],text:De}}},xe}(),fe=V.noopTest,ne=V.edit,me=V.merge,ie={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:fe,table:fe,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ie._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ie._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ie.def=ne(ie.def).replace("label",ie._label).replace("title",ie._title).getRegex(),ie.bullet=/(?:[*+-]|\d{1,9}[.)])/,ie.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ie.item=ne(ie.item,"gm").replace(/bull/g,ie.bullet).getRegex(),ie.list=ne(ie.list).replace(/bull/g,ie.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ie.def.source+")").getRegex(),ie._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",ie._comment=/<!--(?!-?>)[\s\S]*?-->/,ie.html=ne(ie.html,"i").replace("comment",ie._comment).replace("tag",ie._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ie.paragraph=ne(ie._paragraph).replace("hr",ie.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",ie._tag).getRegex(),ie.blockquote=ne(ie.blockquote).replace("paragraph",ie.paragraph).getRegex(),ie.normal=me({},ie),ie.gfm=me({},ie.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*|$)"}),ie.gfm.nptable=ne(ie.gfm.nptable).replace("hr",ie.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",ie._tag).getRegex(),ie.gfm.table=ne(ie.gfm.table).replace("hr",ie.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",ie._tag).getRegex(),ie.pedantic=me({},ie.normal,{html:ne(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ie._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:fe,paragraph:ne(ie.normal._paragraph).replace("hr",ie.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ie.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var le={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:fe,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:fe,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};le._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",le.punctuation=ne(le.punctuation).replace(/punctuation/g,le._punctuation).getRegex(),le._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",le._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",le.em.start=ne(le.em.start).replace(/punctuation/g,le._punctuation).getRegex(),le.em.middle=ne(le.em.middle).replace(/punctuation/g,le._punctuation).replace(/overlapSkip/g,le._overlapSkip).getRegex(),le.em.endAst=ne(le.em.endAst,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.em.endUnd=ne(le.em.endUnd,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.strong.start=ne(le.strong.start).replace(/punctuation/g,le._punctuation).getRegex(),le.strong.middle=ne(le.strong.middle).replace(/punctuation/g,le._punctuation).replace(/blockSkip/g,le._blockSkip).getRegex(),le.strong.endAst=ne(le.strong.endAst,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.strong.endUnd=ne(le.strong.endUnd,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.blockSkip=ne(le._blockSkip,"g").getRegex(),le.overlapSkip=ne(le._overlapSkip,"g").getRegex(),le._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,le._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,le._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,le.autolink=ne(le.autolink).replace("scheme",le._scheme).replace("email",le._email).getRegex(),le._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,le.tag=ne(le.tag).replace("comment",ie._comment).replace("attribute",le._attribute).getRegex(),le._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,le._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,le._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,le.link=ne(le.link).replace("label",le._label).replace("href",le._href).replace("title",le._title).getRegex(),le.reflink=ne(le.reflink).replace("label",le._label).getRegex(),le.reflinkSearch=ne(le.reflinkSearch,"g").replace("reflink",le.reflink).replace("nolink",le.nolink).getRegex(),le.normal=me({},le),le.pedantic=me({},le.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:ne(/^!?\[(label)\]\((.*?)\)/).replace("label",le._label).getRegex(),reflink:ne(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",le._label).getRegex()}),le.gfm=me({},le.normal,{escape:ne(le.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),le.gfm.url=ne(le.gfm.url,"i").replace("email",le.gfm._extended_email).getRegex(),le.breaks=me({},le.gfm,{br:ne(le.br).replace("{2,}","*").getRegex(),text:ne(le.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var q={block:ie,inline:le},re=j.defaults,oe=q.block,ge=q.inline;function Se(xe){return xe.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 Ee(xe){var pe="",be,te,de=xe.length;for(be=0;be<de;be++)te=xe.charCodeAt(be),Math.random()>.5&&(te="x"+te.toString(16)),pe+="&#"+te+";";return pe}var Re=function(){function xe(be){this.tokens=[],this.tokens.links=Object.create(null),this.options=be||re,this.options.tokenizer=this.options.tokenizer||new _e,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var te={block:oe.normal,inline:ge.normal};this.options.pedantic?(te.block=oe.pedantic,te.inline=ge.pedantic):this.options.gfm&&(te.block=oe.gfm,this.options.breaks?te.inline=ge.breaks:te.inline=ge.gfm),this.tokenizer.rules=te}xe.lex=function(te,de){var he=new xe(de);return he.lex(te)};var pe=xe.prototype;return pe.lex=function(te){return te=te.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(te,this.tokens,!0),this.inline(this.tokens),this.tokens},pe.blockTokens=function(te,de,he){de===void 0&&(de=[]),he===void 0&&(he=!0),te=te.replace(/^ +$/gm,"");for(var ye,De,we,We;te;){if(ye=this.tokenizer.space(te)){te=te.substring(ye.raw.length),ye.type&&de.push(ye);continue}if(ye=this.tokenizer.code(te,de)){te=te.substring(ye.raw.length),ye.type?de.push(ye):(We=de[de.length-1],We.raw+=`
|
|
`+ye.raw,We.text+=`
|
|
`+ye.text);continue}if(ye=this.tokenizer.fences(te)){te=te.substring(ye.raw.length),de.push(ye);continue}if(ye=this.tokenizer.heading(te)){te=te.substring(ye.raw.length),de.push(ye);continue}if(ye=this.tokenizer.nptable(te)){te=te.substring(ye.raw.length),de.push(ye);continue}if(ye=this.tokenizer.hr(te)){te=te.substring(ye.raw.length),de.push(ye);continue}if(ye=this.tokenizer.blockquote(te)){te=te.substring(ye.raw.length),ye.tokens=this.blockTokens(ye.text,[],he),de.push(ye);continue}if(ye=this.tokenizer.list(te)){for(te=te.substring(ye.raw.length),we=ye.items.length,De=0;De<we;De++)ye.items[De].tokens=this.blockTokens(ye.items[De].text,[],!1);de.push(ye);continue}if(ye=this.tokenizer.html(te)){te=te.substring(ye.raw.length),de.push(ye);continue}if(he&&(ye=this.tokenizer.def(te))){te=te.substring(ye.raw.length),this.tokens.links[ye.tag]||(this.tokens.links[ye.tag]={href:ye.href,title:ye.title});continue}if(ye=this.tokenizer.table(te)){te=te.substring(ye.raw.length),de.push(ye);continue}if(ye=this.tokenizer.lheading(te)){te=te.substring(ye.raw.length),de.push(ye);continue}if(he&&(ye=this.tokenizer.paragraph(te))){te=te.substring(ye.raw.length),de.push(ye);continue}if(ye=this.tokenizer.text(te,de)){te=te.substring(ye.raw.length),ye.type?de.push(ye):(We=de[de.length-1],We.raw+=`
|
|
`+ye.raw,We.text+=`
|
|
`+ye.text);continue}if(te){var Qe="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(Qe);break}else throw new Error(Qe)}}return de},pe.inline=function(te){var de,he,ye,De,we,We,Qe=te.length;for(de=0;de<Qe;de++){We=te[de];switch(We.type){case"paragraph":case"text":case"heading":{We.tokens=[],this.inlineTokens(We.text,We.tokens);break}case"table":{for(We.tokens={header:[],cells:[]},De=We.header.length,he=0;he<De;he++)We.tokens.header[he]=[],this.inlineTokens(We.header[he],We.tokens.header[he]);for(De=We.cells.length,he=0;he<De;he++)for(we=We.cells[he],We.tokens.cells[he]=[],ye=0;ye<we.length;ye++)We.tokens.cells[he][ye]=[],this.inlineTokens(we[ye],We.tokens.cells[he][ye]);break}case"blockquote":{this.inline(We.tokens);break}case"list":{for(De=We.items.length,he=0;he<De;he++)this.inline(We.items[he].tokens);break}}}return te},pe.inlineTokens=function(te,de,he,ye,De){de===void 0&&(de=[]),he===void 0&&(he=!1),ye===void 0&&(ye=!1),De===void 0&&(De="");var we,We=te,Qe;if(this.tokens.links){var nt=Object.keys(this.tokens.links);if(nt.length>0)for(;(Qe=this.tokenizer.rules.inline.reflinkSearch.exec(We))!=null;)nt.includes(Qe[0].slice(Qe[0].lastIndexOf("[")+1,-1))&&(We=We.slice(0,Qe.index)+"["+"a".repeat(Qe[0].length-2)+"]"+We.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Qe=this.tokenizer.rules.inline.blockSkip.exec(We))!=null;)We=We.slice(0,Qe.index)+"["+"a".repeat(Qe[0].length-2)+"]"+We.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;te;){if(we=this.tokenizer.escape(te)){te=te.substring(we.raw.length),de.push(we);continue}if(we=this.tokenizer.tag(te,he,ye)){te=te.substring(we.raw.length),he=we.inLink,ye=we.inRawBlock,de.push(we);continue}if(we=this.tokenizer.link(te)){te=te.substring(we.raw.length),we.type==="link"&&(we.tokens=this.inlineTokens(we.text,[],!0,ye)),de.push(we);continue}if(we=this.tokenizer.reflink(te,this.tokens.links)){te=te.substring(we.raw.length),we.type==="link"&&(we.tokens=this.inlineTokens(we.text,[],!0,ye)),de.push(we);continue}if(we=this.tokenizer.strong(te,We,De)){te=te.substring(we.raw.length),we.tokens=this.inlineTokens(we.text,[],he,ye),de.push(we);continue}if(we=this.tokenizer.em(te,We,De)){te=te.substring(we.raw.length),we.tokens=this.inlineTokens(we.text,[],he,ye),de.push(we);continue}if(we=this.tokenizer.codespan(te)){te=te.substring(we.raw.length),de.push(we);continue}if(we=this.tokenizer.br(te)){te=te.substring(we.raw.length),de.push(we);continue}if(we=this.tokenizer.del(te)){te=te.substring(we.raw.length),we.tokens=this.inlineTokens(we.text,[],he,ye),de.push(we);continue}if(we=this.tokenizer.autolink(te,Ee)){te=te.substring(we.raw.length),de.push(we);continue}if(!he&&(we=this.tokenizer.url(te,Ee))){te=te.substring(we.raw.length),de.push(we);continue}if(we=this.tokenizer.inlineText(te,ye,Se)){te=te.substring(we.raw.length),De=we.raw.slice(-1),de.push(we);continue}if(te){var Ve="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(Ve);break}else throw new Error(Ve)}}return de},X(xe,null,[{key:"rules",get:function(){return{block:oe,inline:ge}}}]),xe}(),Pe=j.defaults,Ue=V.cleanUrl,He=V.escape,Fe=function(){function xe(be){this.options=be||Pe}var pe=xe.prototype;return pe.code=function(te,de,he){var ye=(de||"").match(/\S*/)[0];if(this.options.highlight){var De=this.options.highlight(te,ye);De!=null&&De!==te&&(he=!0,te=De)}return ye?'<pre><code class="'+this.options.langPrefix+He(ye,!0)+'">'+(he?te:He(te,!0))+`</code></pre>
|
|
`:"<pre><code>"+(he?te:He(te,!0))+`</code></pre>
|
|
`},pe.blockquote=function(te){return`<blockquote>
|
|
`+te+`</blockquote>
|
|
`},pe.html=function(te){return te},pe.heading=function(te,de,he,ye){return this.options.headerIds?"<h"+de+' id="'+this.options.headerPrefix+ye.slug(he)+'">'+te+"</h"+de+`>
|
|
`:"<h"+de+">"+te+"</h"+de+`>
|
|
`},pe.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},pe.list=function(te,de,he){var ye=de?"ol":"ul",De=de&&he!==1?' start="'+he+'"':"";return"<"+ye+De+`>
|
|
`+te+"</"+ye+`>
|
|
`},pe.listitem=function(te){return"<li>"+te+`</li>
|
|
`},pe.checkbox=function(te){return"<input "+(te?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},pe.paragraph=function(te){return"<p>"+te+`</p>
|
|
`},pe.table=function(te,de){return de&&(de="<tbody>"+de+"</tbody>"),`<table>
|
|
<thead>
|
|
`+te+`</thead>
|
|
`+de+`</table>
|
|
`},pe.tablerow=function(te){return`<tr>
|
|
`+te+`</tr>
|
|
`},pe.tablecell=function(te,de){var he=de.header?"th":"td",ye=de.align?"<"+he+' align="'+de.align+'">':"<"+he+">";return ye+te+"</"+he+`>
|
|
`},pe.strong=function(te){return"<strong>"+te+"</strong>"},pe.em=function(te){return"<em>"+te+"</em>"},pe.codespan=function(te){return"<code>"+te+"</code>"},pe.br=function(){return this.options.xhtml?"<br/>":"<br>"},pe.del=function(te){return"<del>"+te+"</del>"},pe.link=function(te,de,he){if(te=Ue(this.options.sanitize,this.options.baseUrl,te),te===null)return he;var ye='<a href="'+He(te)+'"';return de&&(ye+=' title="'+de+'"'),ye+=">"+he+"</a>",ye},pe.image=function(te,de,he){if(te=Ue(this.options.sanitize,this.options.baseUrl,te),te===null)return he;var ye='<img src="'+te+'" alt="'+he+'"';return de&&(ye+=' title="'+de+'"'),ye+=this.options.xhtml?"/>":">",ye},pe.text=function(te){return te},xe}(),Ne=function(){function xe(){}var pe=xe.prototype;return pe.strong=function(te){return te},pe.em=function(te){return te},pe.codespan=function(te){return te},pe.del=function(te){return te},pe.html=function(te){return te},pe.text=function(te){return te},pe.link=function(te,de,he){return""+he},pe.image=function(te,de,he){return""+he},pe.br=function(){return""},xe}(),qe=function(){function xe(){this.seen={}}var pe=xe.prototype;return pe.slug=function(te){var de=te.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(de)){var he=de;do this.seen[he]++,de=he+"-"+this.seen[he];while(this.seen.hasOwnProperty(de))}return this.seen[de]=0,de},xe}(),Je=j.defaults,it=V.unescape,rt=function(){function xe(be){this.options=be||Je,this.options.renderer=this.options.renderer||new Fe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ne,this.slugger=new qe}xe.parse=function(te,de){var he=new xe(de);return he.parse(te)};var pe=xe.prototype;return pe.parse=function(te,de){de===void 0&&(de=!0);var he="",ye,De,we,We,Qe,nt,Ve,dt,ct,at,Dt,wt,xt,kt,Et,Mt,Rt,Xe,bt=te.length;for(ye=0;ye<bt;ye++){at=te[ye];switch(at.type){case"space":continue;case"hr":{he+=this.renderer.hr();continue}case"heading":{he+=this.renderer.heading(this.parseInline(at.tokens),at.depth,it(this.parseInline(at.tokens,this.textRenderer)),this.slugger);continue}case"code":{he+=this.renderer.code(at.text,at.lang,at.escaped);continue}case"table":{for(dt="",Ve="",We=at.header.length,De=0;De<We;De++)Ve+=this.renderer.tablecell(this.parseInline(at.tokens.header[De]),{header:!0,align:at.align[De]});for(dt+=this.renderer.tablerow(Ve),ct="",We=at.cells.length,De=0;De<We;De++){for(nt=at.tokens.cells[De],Ve="",Qe=nt.length,we=0;we<Qe;we++)Ve+=this.renderer.tablecell(this.parseInline(nt[we]),{header:!1,align:at.align[we]});ct+=this.renderer.tablerow(Ve)}he+=this.renderer.table(dt,ct);continue}case"blockquote":{ct=this.parse(at.tokens),he+=this.renderer.blockquote(ct);continue}case"list":{for(Dt=at.ordered,wt=at.start,xt=at.loose,We=at.items.length,ct="",De=0;De<We;De++)Et=at.items[De],Mt=Et.checked,Rt=Et.task,kt="",Et.task&&(Xe=this.renderer.checkbox(Mt),xt?Et.tokens.length>0&&Et.tokens[0].type==="text"?(Et.tokens[0].text=Xe+" "+Et.tokens[0].text,Et.tokens[0].tokens&&Et.tokens[0].tokens.length>0&&Et.tokens[0].tokens[0].type==="text"&&(Et.tokens[0].tokens[0].text=Xe+" "+Et.tokens[0].tokens[0].text)):Et.tokens.unshift({type:"text",text:Xe}):kt+=Xe),kt+=this.parse(Et.tokens,xt),ct+=this.renderer.listitem(kt,Rt,Mt);he+=this.renderer.list(ct,Dt,wt);continue}case"html":{he+=this.renderer.html(at.text);continue}case"paragraph":{he+=this.renderer.paragraph(this.parseInline(at.tokens));continue}case"text":{for(ct=at.tokens?this.parseInline(at.tokens):at.text;ye+1<bt&&te[ye+1].type==="text";)at=te[++ye],ct+=`
|
|
`+(at.tokens?this.parseInline(at.tokens):at.text);he+=de?this.renderer.paragraph(ct):ct;continue}default:{var ot='Token with "'+at.type+'" type was not found.';if(this.options.silent){console.error(ot);return}else throw new Error(ot)}}}return he},pe.parseInline=function(te,de){de=de||this.renderer;var he="",ye,De,we=te.length;for(ye=0;ye<we;ye++){De=te[ye];switch(De.type){case"escape":{he+=de.text(De.text);break}case"html":{he+=de.html(De.text);break}case"link":{he+=de.link(De.href,De.title,this.parseInline(De.tokens,de));break}case"image":{he+=de.image(De.href,De.title,De.text);break}case"strong":{he+=de.strong(this.parseInline(De.tokens,de));break}case"em":{he+=de.em(this.parseInline(De.tokens,de));break}case"codespan":{he+=de.codespan(De.text);break}case"br":{he+=de.br();break}case"del":{he+=de.del(this.parseInline(De.tokens,de));break}case"text":{he+=de.text(De.text);break}default:{var We='Token with "'+De.type+'" type was not found.';if(this.options.silent){console.error(We);return}else throw new Error(We)}}}return he},xe}(),ht=V.merge,ft=V.checkSanitizeDeprecation,ke=V.escape,Le=j.getDefaults,Ge=j.changeDefaults,Ke=j.defaults;function Me(xe,pe,be){if(typeof xe=="undefined"||xe===null)throw new Error("marked(): input parameter is undefined or null");if(typeof xe!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(xe)+", string expected");if(typeof pe=="function"&&(be=pe,pe=null),pe=ht({},Me.defaults,pe||{}),ft(pe),be){var te=pe.highlight,de;try{de=Re.lex(xe,pe)}catch(we){return be(we)}var he=function(We){var Qe;if(!We)try{Qe=rt.parse(de,pe)}catch(nt){We=nt}return pe.highlight=te,We?be(We):be(null,Qe)};if(!te||te.length<3)return he();if(delete pe.highlight,!de.length)return he();var ye=0;Me.walkTokens(de,function(we){we.type==="code"&&(ye++,setTimeout(function(){te(we.text,we.lang,function(We,Qe){if(We)return he(We);Qe!=null&&Qe!==we.text&&(we.text=Qe,we.escaped=!0),ye--,ye===0&&he()})},0))}),ye===0&&he();return}try{var De=Re.lex(xe,pe);return pe.walkTokens&&Me.walkTokens(De,pe.walkTokens),rt.parse(De,pe)}catch(we){if(we.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,pe.silent)return"<p>An error occurred:</p><pre>"+ke(we.message+"",!0)+"</pre>";throw we}}Me.options=Me.setOptions=function(xe){return ht(Me.defaults,xe),Ge(Me.defaults),Me},Me.getDefaults=Le,Me.defaults=Ke,Me.use=function(xe){var pe=ht({},xe);if(xe.renderer&&function(){var te=Me.defaults.renderer||new Fe,de=function(De){var we=te[De];te[De]=function(){for(var We=arguments.length,Qe=new Array(We),nt=0;nt<We;nt++)Qe[nt]=arguments[nt];var Ve=xe.renderer[De].apply(te,Qe);return Ve===!1&&(Ve=we.apply(te,Qe)),Ve}};for(var he in xe.renderer)de(he);pe.renderer=te}(),xe.tokenizer&&function(){var te=Me.defaults.tokenizer||new _e,de=function(De){var we=te[De];te[De]=function(){for(var We=arguments.length,Qe=new Array(We),nt=0;nt<We;nt++)Qe[nt]=arguments[nt];var Ve=xe.tokenizer[De].apply(te,Qe);return Ve===!1&&(Ve=we.apply(te,Qe)),Ve}};for(var he in xe.tokenizer)de(he);pe.tokenizer=te}(),xe.walkTokens){var be=Me.defaults.walkTokens;pe.walkTokens=function(te){xe.walkTokens(te),be&&be(te)}}Me.setOptions(pe)},Me.walkTokens=function(xe,pe){for(var be=U(xe),te;!(te=be()).done;){var de=te.value;pe(de);switch(de.type){case"table":{for(var he=U(de.tokens.header),ye;!(ye=he()).done;){var De=ye.value;Me.walkTokens(De,pe)}for(var we=U(de.tokens.cells),We;!(We=we()).done;)for(var Qe=We.value,nt=U(Qe),Ve;!(Ve=nt()).done;){var dt=Ve.value;Me.walkTokens(dt,pe)}break}case"list":{Me.walkTokens(de.items,pe);break}default:de.tokens&&Me.walkTokens(de.tokens,pe)}}},Me.Parser=rt,Me.parser=rt.parse,Me.Renderer=Fe,Me.TextRenderer=Ne,Me.Lexer=Re,Me.lexer=Re.lex,Me.Tokenizer=_e,Me.Slugger=qe,Me.parse=Me;var je=Me;return je})},ELLl:function(gt,ze,Y){(function(ce){ce(Y("VrN/"))})(function(ce){var X={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},R=ce.Pos;ce.defineOption("autoCloseBrackets",!1,function(y,b,c){c&&c!=ce.Init&&(y.removeKeyMap(U),y.state.closeBrackets=null),b&&(O(Z(b,"pairs")),y.state.closeBrackets=b,y.addKeyMap(U))});function Z(y,b){return b=="pairs"&&typeof y=="string"?y:typeof y=="object"&&y[b]!=null?y[b]:X[b]}var U={Backspace:k,Enter:D};function O(y){for(var b=0;b<y.length;b++){var c=y.charAt(b),s="'"+c+"'";U[s]||(U[s]=j(c))}}O(X.pairs+"`");function j(y){return function(b){return A(b,y)}}function B(y){var b=y.state.closeBrackets;if(!b||b.override)return b;var c=y.getModeAt(y.getCursor());return c.closeBrackets||b}function k(y){var b=B(y);if(!b||y.getOption("disableInput"))return ce.Pass;for(var c=Z(b,"pairs"),s=y.listSelections(),u=0;u<s.length;u++){if(!s[u].empty())return ce.Pass;var f=P(y,s[u].head);if(!f||c.indexOf(f)%2!=0)return ce.Pass}for(var u=s.length-1;u>=0;u--){var C=s[u].head;y.replaceRange("",R(C.line,C.ch-1),R(C.line,C.ch+1),"+delete")}}function D(y){var b=B(y),c=b&&Z(b,"explode");if(!c||y.getOption("disableInput"))return ce.Pass;for(var s=y.listSelections(),u=0;u<s.length;u++){if(!s[u].empty())return ce.Pass;var f=P(y,s[u].head);if(!f||c.indexOf(f)%2!=0)return ce.Pass}y.operation(function(){var C=y.lineSeparator()||`
|
|
`;y.replaceSelection(C+C,null),y.execCommand("goCharLeft"),s=y.listSelections();for(var v=0;v<s.length;v++){var m=s[v].head.line;y.indentLine(m,null,!0),y.indentLine(m+1,null,!0)}})}function E(y){var b=ce.cmpPos(y.anchor,y.head)>0;return{anchor:new R(y.anchor.line,y.anchor.ch+(b?-1:1)),head:new R(y.head.line,y.head.ch+(b?1:-1))}}function A(y,b){var c=B(y);if(!c||y.getOption("disableInput"))return ce.Pass;var s=Z(c,"pairs"),u=s.indexOf(b);if(u==-1)return ce.Pass;for(var f=Z(c,"closeBefore"),C=Z(c,"triples"),v=s.charAt(u+1)==b,m=y.listSelections(),_=u%2==0,x,d=0;d<m.length;d++){var h=m[d],o=h.head,i,g=y.getRange(o,R(o.line,o.ch+1));if(_&&!h.empty())i="surround";else if((v||!_)&&g==b)v&&w(y,o)?i="both":C.indexOf(b)>=0&&y.getRange(o,R(o.line,o.ch+3))==b+b+b?i="skipThree":i="skip";else if(v&&o.ch>1&&C.indexOf(b)>=0&&y.getRange(R(o.line,o.ch-2),o)==b+b){if(o.ch>2&&/\bstring/.test(y.getTokenTypeAt(R(o.line,o.ch-2))))return ce.Pass;i="addFour"}else if(v){var l=o.ch==0?" ":y.getRange(R(o.line,o.ch-1),o);if(!ce.isWordChar(g)&&l!=b&&!ce.isWordChar(l))i="both";else return ce.Pass}else if(_&&(g.length===0||/\s/.test(g)||f.indexOf(g)>-1))i="both";else return ce.Pass;if(!x)x=i;else if(x!=i)return ce.Pass}var T=u%2?s.charAt(u-1):b,I=u%2?b:s.charAt(u+1);y.operation(function(){if(x=="skip")y.execCommand("goCharRight");else if(x=="skipThree")for(var F=0;F<3;F++)y.execCommand("goCharRight");else if(x=="surround"){for(var W=y.getSelections(),F=0;F<W.length;F++)W[F]=T+W[F]+I;y.replaceSelections(W,"around"),W=y.listSelections().slice();for(var F=0;F<W.length;F++)W[F]=E(W[F]);y.setSelections(W)}else x=="both"?(y.replaceSelection(T+I,null),y.triggerElectric(T+I),y.execCommand("goCharLeft")):x=="addFour"&&(y.replaceSelection(T+T+T+T,"before"),y.execCommand("goCharRight"))})}function P(y,b){var c=y.getRange(R(b.line,b.ch-1),R(b.line,b.ch+1));return c.length==2?c:null}function w(y,b){var c=y.getTokenAt(R(b.line,b.ch+1));return/\bstring/.test(c.type)&&c.start==b.ch&&(b.ch==0||!/\bstring/.test(y.getTokenTypeAt(b)))}})},EgHG:function(gt,ze,Y){gt.exports={wrap:"wrap___2vVqS",modal:"modal___AcHKf",titleWrap:"titleWrap___YV24j",required:"required___3XHD4",title:"title___3yV4s",colorGray:"colorGray___2oRqv",choiceWrap:"choiceWrap___2ypJV",answer:"answer___1tmCF",activeAnswer:"activeAnswer___7NV4I",deleteIcon:"deleteIcon___3LBHf",addIcon:"addIcon___2MzTA",editorWrap:"editorWrap___1Xe94",htmlWrap:"htmlWrap___14WFO",radio:"radio___1kFzU",color333:"color333___1Kwa2",color999:"color999___4cmSp",fold:"fold___1JSf-",head:"head___-ebd0"}},GfqC:function(gt,ze,Y){"use strict";var ce=Y("q1tI"),X=Y.n(ce),R=Y("TSYQ"),Z=Y.n(R);function U(V,M){var N="cannot "+V.method+" "+V.action+" "+M.status+"'",J=new Error(N);return J.status=M.status,J.method=V.method,J.url=V.action,J}function O(V){var M=V.responseText||V.response;if(!M)return M;try{return JSON.parse(M)}catch(N){return M}}function j(V){var M=new XMLHttpRequest;V.onProgress&&M.upload&&(M.upload.onprogress=function(ue){ue.total>0&&(ue.percent=ue.loaded/ue.total*100),V.onProgress(ue)});var N=new FormData;V.data&&Object.keys(V.data).forEach(function(ae){var ue=V.data[ae];if(Array.isArray(ue)){ue.forEach(function(ve){N.append(ae+"[]",ve)});return}N.append(ae,V.data[ae])}),V.file instanceof Blob?N.append(V.filename,V.file,V.file.name):N.append(V.filename,V.file),M.onerror=function(ue){V.onError(ue)},M.onload=function(){return M.status<200||M.status>=300?V.onError(U(V,M),O(M)):V.onSuccess(O(M),M)},M.open(V.method,V.action,!0),V.withCredentials&&"withCredentials"in M&&(M.withCredentials=!0);var J=V.headers||{};return J["X-Requested-With"]!==null&&M.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(J).forEach(function(ae){J[ae]!==null&&M.setRequestHeader(ae,J[ae])}),M.send(N),{abort:function(){M.abort()}}}var B=+new Date,k=0;function D(){return"rc-upload-"+B+"-"+ ++k}function E(V,M){return V.indexOf(M,V.length-M.length)!==-1}var A=function(V,M){if(V&&M){var N=Array.isArray(M)?M:M.split(","),J=V.name||"",ae=V.type||"",ue=ae.replace(/\/.*$/,"");return N.some(function(ve){var Te=ve.trim();return Te.charAt(0)==="."?E(J.toLowerCase(),Te.toLowerCase()):/\/\*$/.test(Te)?ue===Te.replace(/\/.*$/,""):ae===Te})}return!0};function P(V,M){var N=V.createReader(),J=[];function ae(){N.readEntries(function(ue){var ve=Array.prototype.slice.apply(ue);J=J.concat(ve);var Te=!ve.length;Te?M(J):ae()})}ae()}var w=function(M,N,J){var ae=function ue(ve,Te){Te=Te||"",ve.isFile?ve.file(function(_e){J(_e)&&(ve.fullPath&&!_e.webkitRelativePath&&(Object.defineProperties(_e,{webkitRelativePath:{writable:!0}}),_e.webkitRelativePath=ve.fullPath.replace(/^\//,""),Object.defineProperties(_e,{webkitRelativePath:{writable:!1}})),N([_e]))}):ve.isDirectory&&P(ve,function(_e){_e.forEach(function(fe){ue(fe,""+Te+ve.name+"/")})})};M.forEach(function(ue){ae(ue.webkitGetAsEntry())})},y=w,b=Object.assign||function(V){for(var M=1;M<arguments.length;M++){var N=arguments[M];for(var J in N)Object.prototype.hasOwnProperty.call(N,J)&&(V[J]=N[J])}return V},c=function(){function V(M,N){var J=[],ae=!0,ue=!1,ve=void 0;try{for(var Te=M[Symbol.iterator](),_e;!(ae=(_e=Te.next()).done)&&!(J.push(_e.value),N&&J.length===N);ae=!0);}catch(fe){ue=!0,ve=fe}finally{try{!ae&&Te.return&&Te.return()}finally{if(ue)throw ve}}return J}return function(M,N){if(Array.isArray(M))return M;if(Symbol.iterator in Object(M))return V(M,N);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=function(){function V(M,N){for(var J=0;J<N.length;J++){var ae=N[J];ae.enumerable=ae.enumerable||!1,ae.configurable=!0,"value"in ae&&(ae.writable=!0),Object.defineProperty(M,ae.key,ae)}}return function(M,N,J){return N&&V(M.prototype,N),J&&V(M,J),M}}();function u(V,M,N){return M in V?Object.defineProperty(V,M,{value:N,enumerable:!0,configurable:!0,writable:!0}):V[M]=N,V}function f(V,M){var N={};for(var J in V){if(M.indexOf(J)>=0)continue;if(!Object.prototype.hasOwnProperty.call(V,J))continue;N[J]=V[J]}return N}function C(V,M){if(!(V instanceof M))throw new TypeError("Cannot call a class as a function")}function v(V,M){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:V}function m(V,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);V.prototype=Object.create(M&&M.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(V,M):V.__proto__=M)}var _=function(M){return Object.keys(M).reduce(function(N,J){return(J.substr(0,5)==="data-"||J.substr(0,5)==="aria-"||J==="role")&&(N[J]=M[J]),N},{})},x=function(V){m(M,V);function M(){var N,J,ae,ue;C(this,M);for(var ve=arguments.length,Te=Array(ve),_e=0;_e<ve;_e++)Te[_e]=arguments[_e];return ue=(J=(ae=v(this,(N=M.__proto__||Object.getPrototypeOf(M)).call.apply(N,[this].concat(Te))),ae),ae.state={uid:D()},ae.reqs={},ae.onChange=function(fe){var ne=fe.target.files;ae.uploadFiles(ne),ae.reset()},ae.onClick=function(fe){var ne=ae.fileInput;if(!ne)return;var me=ae.props,ie=me.children,le=me.onClick;ie&&ie.type==="button"&&(ne.parentNode.focus(),ne.parentNode.querySelector("button").blur()),ne.click(),le&&le(fe)},ae.onKeyDown=function(fe){fe.key==="Enter"&&ae.onClick()},ae.onFileDrop=function(fe){var ne=ae.props.multiple;if(fe.preventDefault(),fe.type==="dragover")return;if(ae.props.directory)y(Array.prototype.slice.call(fe.dataTransfer.items),ae.uploadFiles,function(ie){return A(ie,ae.props.accept)});else{var me=Array.prototype.slice.call(fe.dataTransfer.files).filter(function(ie){return A(ie,ae.props.accept)});ne===!1&&(me=me.slice(0,1)),ae.uploadFiles(me)}},ae.uploadFiles=function(fe){var ne=Array.prototype.slice.call(fe);ne.map(function(me){return me.uid=D(),me}).forEach(function(me){ae.upload(me,ne)})},ae.saveFileInput=function(fe){ae.fileInput=fe},J),v(ae,ue)}return s(M,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(J,ae){var ue=this,ve=this.props;if(!ve.beforeUpload)return setTimeout(function(){return ue.post(J)},0);var Te=ve.beforeUpload(J,ae);Te&&Te.then?Te.then(function(_e){var fe=Object.prototype.toString.call(_e);return fe==="[object File]"||fe==="[object Blob]"?ue.post(_e):ue.post(J)}).catch(function(_e){console.log(_e)}):Te!==!1&&setTimeout(function(){return ue.post(J)},0);return}},{key:"post",value:function(J){var ae=this;if(!this._isMounted)return;var ue=this.props,ve=ue.onStart,Te=ue.onProgress,_e=ue.transformFile,fe=_e===void 0?function(ne){return ne}:_e;new Promise(function(ne){var me=ue.action;return typeof me=="function"&&(me=me(J)),ne(me)}).then(function(ne){var me=J.uid,ie=ue.customRequest||j,le=Promise.resolve(fe(J)).then(function(q){var re=ue.data;return typeof re=="function"&&(re=re(q)),Promise.all([q,re])}).catch(function(q){console.error(q)});le.then(function(q){var re=c(q,2),oe=re[0],ge=re[1],Se={action:ne,filename:ue.name,data:ge,file:oe,headers:ue.headers,withCredentials:ue.withCredentials,method:ue.method||"post",onProgress:Te?function(Ee){Te(Ee,J)}:null,onSuccess:function(Re,Pe){delete ae.reqs[me],ue.onSuccess(Re,J,Pe)},onError:function(Re,Pe){delete ae.reqs[me],ue.onError(Re,Pe,J)}};ve(J),ae.reqs[me]=ie(Se)})})}},{key:"reset",value:function(){this.setState({uid:D()})}},{key:"abort",value:function(J){var ae=this.reqs;if(J){var ue=J;J&&J.uid&&(ue=J.uid),ae[ue]&&ae[ue].abort&&ae[ue].abort(),delete ae[ue]}else Object.keys(ae).forEach(function(ve){ae[ve]&&ae[ve].abort&&ae[ve].abort(),delete ae[ve]})}},{key:"render",value:function(){var J,ae=this.props,ue=ae.component,ve=ae.prefixCls,Te=ae.className,_e=ae.disabled,fe=ae.id,ne=ae.style,me=ae.multiple,ie=ae.accept,le=ae.children,q=ae.directory,re=ae.openFileDialogOnClick,oe=ae.onMouseEnter,ge=ae.onMouseLeave,Se=f(ae,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),Ee=Z()((J={},u(J,ve,!0),u(J,ve+"-disabled",_e),u(J,Te,Te),J)),Re=_e?{}:{onClick:re?this.onClick:function(){},onKeyDown:re?this.onKeyDown:function(){},onMouseEnter:oe,onMouseLeave:ge,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return X.a.createElement(ue,b({},Re,{className:Ee,role:"button",style:ne}),X.a.createElement("input",b({},_(Se),{id:fe,type:"file",ref:this.saveFileInput,onClick:function(Ue){return Ue.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ie,directory:q?"directory":null,webkitdirectory:q?"webkitdirectory":null,multiple:me,onChange:this.onChange})),le)}}]),M}(ce.Component),d=x,h=Object.assign||function(V){for(var M=1;M<arguments.length;M++){var N=arguments[M];for(var J in N)Object.prototype.hasOwnProperty.call(N,J)&&(V[J]=N[J])}return V},o=function(){function V(M,N){for(var J=0;J<N.length;J++){var ae=N[J];ae.enumerable=ae.enumerable||!1,ae.configurable=!0,"value"in ae&&(ae.writable=!0),Object.defineProperty(M,ae.key,ae)}}return function(M,N,J){return N&&V(M.prototype,N),J&&V(M,J),M}}();function i(V,M){if(!(V instanceof M))throw new TypeError("Cannot call a class as a function")}function g(V,M){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:V}function l(V,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);V.prototype=Object.create(M&&M.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(V,M):V.__proto__=M)}function T(){}var I=function(V){l(M,V);function M(){var N,J,ae,ue;i(this,M);for(var ve=arguments.length,Te=Array(ve),_e=0;_e<ve;_e++)Te[_e]=arguments[_e];return ue=(J=(ae=g(this,(N=M.__proto__||Object.getPrototypeOf(M)).call.apply(N,[this].concat(Te))),ae),ae.saveUploader=function(fe){ae.uploader=fe},J),g(ae,ue)}return o(M,[{key:"abort",value:function(J){this.uploader.abort(J)}},{key:"render",value:function(){return X.a.createElement(d,h({},this.props,{ref:this.saveUploader}))}}]),M}(ce.Component);I.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:T,onError:T,onSuccess:T,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var F=I,W=ze.a=F},HmJG:function(gt,ze,Y){},IBYe:function(gt,ze,Y){"use strict";function ce(X){return null}ze.a=ce},LdHM:function(gt,ze,Y){"use strict";Y.d(ze,"b",function(){return f}),Y.d(ze,"a",function(){return v});var ce=Y("1OyB"),X=Y("vuIU"),R=Y("Ji7U"),Z=Y("LK+K"),U=Y("q1tI"),O=Y("rePB"),j=Y("Ff2n"),B=Y("ODXe"),k=Y("4IlW"),D=Y("bX4T"),E=Y("YrtM"),A=Y("TSYQ"),P=Y.n(A),w=Y("+nKL"),y=Y("8OUc"),b=function(J,ae){var ue=J.prefixCls,ve=J.id,Te=J.flattenOptions,_e=J.childrenAsData,fe=J.values,ne=J.searchValue,me=J.multiple,ie=J.defaultActiveFirstOption,le=J.height,q=J.itemHeight,re=J.notFoundContent,oe=J.open,ge=J.menuItemSelectedIcon,Se=J.virtual,Ee=J.onSelect,Re=J.onToggleOpen,Pe=J.onActiveValue,Ue=J.onScroll,He=J.onMouseEnter,Fe="".concat(ue,"-item"),Ne=Object(E.a)(function(){return Te},[oe,Te],function(je,xe){return xe[0]&&je[1]!==xe[1]}),qe=U.useRef(null),Je=function(xe){xe.preventDefault()},it=function(xe){qe.current&&qe.current.scrollTo({index:xe})},rt=function(xe){for(var pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,be=Ne.length,te=0;te<be;te+=1){var de=(xe+te*pe+be)%be,he=Ne[de],ye=he.group,De=he.data;if(!ye&&!De.disabled)return de}return-1},ht=U.useState(function(){return rt(0)}),ft=Object(B.a)(ht,2),ke=ft[0],Le=ft[1],Ge=function(xe){Le(xe);var pe=Ne[xe];if(!pe){Pe(null,-1);return}Pe(pe.data.value,xe)};U.useEffect(function(){Ge(ie!==!1?rt(0):-1)},[Ne.length,ne]),U.useEffect(function(){var je=setTimeout(function(){if(!me&&oe&&fe.size===1){var xe=Array.from(fe)[0],pe=Ne.findIndex(function(be){var te=be.data;return te.value===xe});Ge(pe),it(pe)}});return function(){return clearTimeout(je)}},[oe]);var Ke=function(xe){xe!==void 0&&Ee(xe,{selected:!fe.has(xe)}),me||Re(!1)};if(U.useImperativeHandle(ae,function(){return{onKeyDown:function(xe){var pe=xe.which;switch(pe){case k.a.UP:case k.a.DOWN:{var be=0;if(pe===k.a.UP?be=-1:pe===k.a.DOWN&&(be=1),be!==0){var te=rt(ke+be,be);it(te),Ge(te)}break}case k.a.ENTER:{var de=Ne[ke];de&&!de.data.disabled?Ke(de.data.value):Ke(void 0),oe&&xe.preventDefault();break}case k.a.ESC:Re(!1)}},onKeyUp:function(){},scrollTo:function(xe){it(xe)}}}),Ne.length===0)return U.createElement("div",{role:"listbox",id:"".concat(ve,"_list"),className:"".concat(Fe,"-empty"),onMouseDown:Je},re);function Me(je){var xe=Ne[je];if(!xe)return null;var pe=xe.data||{},be=pe.value,te=pe.label,de=pe.children,he=Object(D.a)(pe,!0),ye=_e?de:te;return xe?U.createElement("div",Object.assign({"aria-label":typeof ye=="string"?ye:null},he,{key:je,role:"option",id:"".concat(ve,"_list_").concat(je),"aria-selected":fe.has(be)}),be):null}return U.createElement(U.Fragment,null,U.createElement("div",{role:"listbox",id:"".concat(ve,"_list"),style:{height:0,width:0,overflow:"hidden"}},Me(ke-1),Me(ke),Me(ke+1)),U.createElement(w.a,{itemKey:"key",ref:qe,data:Ne,height:le,itemHeight:q,fullHeight:!1,onMouseDown:Je,onScroll:Ue,virtual:Se,onMouseEnter:He},function(je,xe){var pe,be=je.group,te=je.groupOption,de=je.data,he=de.label,ye=de.key;if(be)return U.createElement("div",{className:P()(Fe,"".concat(Fe,"-group"))},he!==void 0?he:ye);var De=de.disabled,we=de.value,We=de.title,Qe=de.children,nt=de.style,Ve=de.className,dt=Object(j.a)(de,["disabled","value","title","children","style","className"]),ct=fe.has(we),at="".concat(Fe,"-option"),Dt=P()(Fe,at,Ve,(pe={},Object(O.a)(pe,"".concat(at,"-grouped"),te),Object(O.a)(pe,"".concat(at,"-active"),ke===xe&&!De),Object(O.a)(pe,"".concat(at,"-disabled"),De),Object(O.a)(pe,"".concat(at,"-selected"),ct),pe)),wt=_e?Qe:he,xt=!ge||typeof ge=="function"||ct;return U.createElement("div",Object.assign({},dt,{"aria-selected":ct,className:Dt,title:We,onMouseMove:function(){if(ke===xe||De)return;Ge(xe)},onClick:function(){De||Ke(we)},style:nt}),U.createElement("div",{className:"".concat(at,"-content")},wt||we),U.isValidElement(ge)||ct,xt&&U.createElement(y.a,{className:"".concat(Fe,"-option-state"),customizeIcon:ge,customizeIconProps:{isSelected:ct}},ct?"\u2713":null))}))},c=U.forwardRef(b);c.displayName="OptionList";var s=c,u=function(){return null};u.isSelectOption=!0;var f=u,C=function(){return null};C.isSelectOptGroup=!0;var v=C,m=Y("VTBJ"),_=Y("Zm9Q");function x(N){var J=N.key,ae=N.props,ue=ae.children,ve=ae.value,Te=Object(j.a)(ae,["children","value"]);return Object(m.a)({key:J,value:ve!==void 0?ve:J,children:ue},Te)}function d(N){var J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(_.a)(N).map(function(ae,ue){if(!U.isValidElement(ae)||!ae.type)return null;var ve=ae.type.isSelectOptGroup,Te=ae.key,_e=ae.props,fe=_e.children,ne=Object(j.a)(_e,["children"]);return J||!ve?x(ae):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(Te===null?ue:Te,"__"),label:Te},ne),{},{options:d(fe)})}).filter(function(ae){return ae})}var h=Y("2Qr1"),o=Y("qNPg"),i=Y("U8pU"),g=Y("Kwbf"),l=Y("WKfj");function T(N){var J=N.mode,ae=N.options,ue=N.children,ve=N.backfill,Te=N.allowClear,_e=N.placeholder,fe=N.getInputElement,ne=N.showSearch,me=N.onSearch,ie=N.defaultOpen,le=N.autoFocus,q=N.labelInValue,re=N.value,oe=N.inputValue,ge=N.optionLabelProp,Se=J==="multiple"||J==="tags",Ee=ne!==void 0?ne:Se||J==="combobox",Re=ae||d(ue);if(Object(g.a)(J!=="tags"||Re.every(function(Fe){return!Fe.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),J==="tags"||J==="combobox"){var Pe=Re.some(function(Fe){return Fe.options?Fe.options.some(function(Ne){return typeof("value"in Ne?Ne.value:Ne.key)=="number"}):typeof("value"in Fe?Fe.value:Fe.key)=="number"});Object(g.a)(!Pe,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(g.a)(J!=="combobox"||!ge,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(g.a)(J==="combobox"||!ve,"`backfill` only works with `combobox` mode."),Object(g.a)(J==="combobox"||!fe,"`getInputElement` only work with `combobox` mode."),Object(g.b)(J!=="combobox"||!fe||!Te||!_e,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),me&&!Ee&&J!=="combobox"&&J!=="tags"&&Object(g.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(g.b)(!ie||le,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),re!=null){var Ue=Object(l.d)(re);Object(g.a)(!q||Ue.every(function(Fe){return Object(i.a)(Fe)==="object"&&("key"in Fe||"value"in Fe)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(g.a)(!Se||Array.isArray(re),"`value` should be array when `mode` is `multiple` or `tags`")}if(ue){var He=null;Object(_.a)(ue).some(function(Fe){if(!U.isValidElement(Fe)||!Fe.type)return!1;var Ne=Fe.type;if(Ne.isSelectOption)return!1;if(Ne.isSelectOptGroup){var qe=Object(_.a)(Fe.props.children).every(function(Je){return!U.isValidElement(Je)||!Fe.type||Je.type.isSelectOption?!0:(He=Je.type,!1)});return!qe}return He=Ne,!0}),He&&Object(g.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(He.displayName||He.name||He,"`.")),Object(g.a)(oe===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var I=T,F=Object(o.a)({prefixCls:"rc-select",components:{optionList:s},convertChildrenToData:d,flattenOptions:h.d,getLabeledValue:h.e,filterOptions:h.b,isValueDisabled:h.g,findValueOption:h.c,warningProps:I,fillOptionsWithMissingValue:h.a}),W=function(N){Object(R.a)(ae,N);var J=Object(Z.a)(ae);function ae(){var ue;return Object(ce.a)(this,ae),ue=J.apply(this,arguments),ue.selectRef=U.createRef(),ue.focus=function(){ue.selectRef.current.focus()},ue.blur=function(){ue.selectRef.current.blur()},ue}return Object(X.a)(ae,[{key:"render",value:function(){return U.createElement(F,Object.assign({ref:this.selectRef},this.props))}}]),ae}(U.Component);W.Option=f,W.OptGroup=v;var V=W,M=ze.c=V},M8RZ:function(gt,ze,Y){"use strict";Y.d(ze,"a",function(){return k});var ce=Y("fWQN"),X=Y("mtLc"),R=Y("yKVA"),Z=Y("879j"),U=Y("q1tI"),O=Y.n(U),j=Y("i8i4"),B=Y.n(j),k=function(D){Object(R.a)(A,D);var E=Object(Z.a)(A);function A(P){var w;Object(ce.a)(this,A),w=E.call(this,P);var y=window.document;return w.node=y.createElement("div"),y.body.appendChild(w.node),w}return Object(X.a)(A,[{key:"render",value:function(){var w=this.props.children;return Object(j.createPortal)(w,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),A}(O.a.Component)},NvD2:function(gt,ze,Y){"use strict";Y.d(ze,"a",function(){return O});var ce=Y("Kwbf");function X(j,B){var k=new Set;return j.forEach(function(D){B.has(D)||k.add(D)}),k}function R(j){var B=j||{},k=B.disabled,D=B.disableCheckbox,E=B.checkable;return!!(k||D)||E===!1}function Z(j,B,k,D){for(var E=new Set(j),A=new Set,P=0;P<=k;P+=1){var w=B.get(P)||new Set;w.forEach(function(s){var u=s.key,f=s.node,C=s.children,v=C===void 0?[]:C;E.has(u)&&!D(f)&&v.filter(function(m){return!D(m.node)}).forEach(function(m){E.add(m.key)})})}for(var y=new Set,b=k;b>=0;b-=1){var c=B.get(b)||new Set;c.forEach(function(s){var u=s.parent,f=s.node;if(D(f)||!s.parent||y.has(s.parent.key))return;if(D(s.parent.node)){y.add(u.key);return}var C=!0,v=!1;(u.children||[]).filter(function(m){return!D(m.node)}).forEach(function(m){var _=m.key,x=E.has(_);C&&!x&&(C=!1),!v&&(x||A.has(_))&&(v=!0)}),C&&E.add(u.key),v&&A.add(u.key),y.add(u.key)})}return{checkedKeys:Array.from(E),halfCheckedKeys:Array.from(X(A,E))}}function U(j,B,k,D,E){for(var A=new Set(j),P=new Set(B),w=0;w<=D;w+=1){var y=k.get(w)||new Set;y.forEach(function(u){var f=u.key,C=u.node,v=u.children,m=v===void 0?[]:v;!A.has(f)&&!P.has(f)&&!E(C)&&m.filter(function(_){return!E(_.node)}).forEach(function(_){A.delete(_.key)})})}P=new Set;for(var b=new Set,c=D;c>=0;c-=1){var s=k.get(c)||new Set;s.forEach(function(u){var f=u.parent,C=u.node;if(E(C)||!u.parent||b.has(u.parent.key))return;if(E(u.parent.node)){b.add(f.key);return}var v=!0,m=!1;(f.children||[]).filter(function(_){return!E(_.node)}).forEach(function(_){var x=_.key,d=A.has(x);v&&!d&&(v=!1),!m&&(d||P.has(x))&&(m=!0)}),v||A.delete(f.key),m&&P.add(f.key),b.add(f.key)})}return{checkedKeys:Array.from(A),halfCheckedKeys:Array.from(X(P,A))}}function O(j,B,k,D){var E=[],A;D?A=D:A=R;var P=new Set(j.filter(function(c){var s=!!k[c];return s||E.push(c),s})),w=new Map,y=0;Object.keys(k).forEach(function(c){var s=k[c],u=s.level,f=w.get(u);f||(f=new Set,w.set(u,f)),f.add(s),y=Math.max(y,u)}),Object(ce.a)(!E.length,"Tree missing follow keys: ".concat(E.slice(0,100).map(function(c){return"'".concat(c,"'")}).join(", ")));var b;return B===!0?b=Z(P,w,y,A):b=U(P,B.halfCheckedKeys,w,y,A),b}},O2Wb:function(gt,ze,Y){gt.exports={flex:"flex___2gmSR",flex1:"flex1___3Tu1g",color666:"color666___2uyGL",error:"error___yJ86W",deleteIcon:"deleteIcon___1D2tg",addIcon:"addIcon___2VIYB"}},OZM5:function(gt,ze,Y){"use strict";Y.d(ze,"b",function(){return D}),Y.d(ze,"a",function(){return E}),Y.d(ze,"k",function(){return A}),Y.d(ze,"h",function(){return P}),Y.d(ze,"i",function(){return w}),Y.d(ze,"g",function(){return y}),Y.d(ze,"c",function(){return b}),Y.d(ze,"d",function(){return c}),Y.d(ze,"j",function(){return f}),Y.d(ze,"e",function(){return C}),Y.d(ze,"f",function(){return v});var ce=Y("KQm4"),X=Y("U8pU"),R=Y("Ff2n"),Z=Y("q1tI"),U=Y.n(Z),O=Y("Kwbf"),j=Y("WaYH"),B=.25,k=2;function D(m,_){var x=m.slice(),d=x.indexOf(_);return d>=0&&x.splice(d,1),x}function E(m,_){var x=m.slice();return x.indexOf(_)===-1&&x.push(_),x}function A(m){return m.split("-")}function P(m,_){return"".concat(m,"-").concat(_)}function w(m){return m&&m.type&&m.type.isTreeNode}function y(m,_){var x=[m],d=_[m];function h(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];o.forEach(function(i){var g=i.key,l=i.children;x.push(g),h(l)})}return h(d.children),x}function b(m,_){var x=m.clientY,d=_.selectHandle.getBoundingClientRect(),h=d.top,o=d.bottom,i=d.height,g=Math.max(i*B,k);return x<=h+g?-1:x>=o-g?1:0}function c(m,_){if(!m)return;var x=_.multiple;return x?m.slice():m.length?[m[0]]:m}var s=function(_){return _};function u(m,_){if(!m)return[];var x=_||{},d=x.processProps,h=d===void 0?s:d,o=Array.isArray(m)?m:[m];return o.map(function(i){var g=i.children,l=Object(R.a)(i,["children"]),T=u(g,_);return U.a.createElement(j.a,Object.assign({},h(l)),T)})}function f(m){if(!m)return null;var _;if(Array.isArray(m))_={checkedKeys:m,halfCheckedKeys:void 0};else if(Object(X.a)(m)==="object")_={checkedKeys:m.checked||void 0,halfCheckedKeys:m.halfChecked||void 0};else return Object(O.a)(!1,"`checkedKeys` is not an array or an object"),null;return _}function C(m,_){var x=new Set;function d(h){if(x.has(h))return;var o=_[h];if(!o)return;x.add(h);var i=o.parent,g=o.node;if(g.disabled)return;i&&d(i.key)}return(m||[]).forEach(function(h){d(h)}),Object(ce.a)(x)}function v(m){var _={};return Object.keys(m).forEach(function(x){(x.startsWith("data-")||x.startsWith("aria-"))&&(_[x]=m[x])}),_}},Ot1p:function(gt,ze,Y){"use strict";var ce=Y("2qtc"),X=Y("kLXV"),R=Y("rAM+"),Z=Y("miYZ"),U=Y("tsqr"),O=Y("9og8"),j=Y("tJVT"),B=Y("jrin"),k=Y("WmNS"),D=Y.n(k),E=Y("q1tI"),A=Y.n(E),P=Y("VrN/"),w=Y.n(P),y=Y("bdgK"),b=Y("p77/"),c=Y("Bd2K"),s=Y("ELLl"),u=Y("19Vz"),f=Y("lZu9"),C=Y("+NIl"),v=Y("kSUc"),m=Y("9Bee"),_=function(we){var We=we.value,Qe=We===void 0?"":We,nt=we.className,Ve=we.showTextOnly,dt=we.showLines,ct=we.style,at=ct===void 0?{}:ct,Dt=Object(E.useMemo)(function(){return""},[Qe]);return A.a.createElement(A.a.Fragment,null,A.a.createElement("div",{dangerouslySetInnerHTML:{__html:Dt}}))},x=Y("0Owb"),d=Y("dejd"),h=Y("C+DQ"),o=Y("1vsH"),i=Y("m3rI"),g=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function l(we){var We=we.onActionCallback,Qe=we.title,nt=we.icon,Ve=we.actionName,dt=we.className,ct=dt===void 0?"":dt,at=we.children;function Dt(){We(Ve)}return A.a.createElement("a",{title:Qe,className:ct,onClick:Dt},A.a.createElement("i",{className:"md-iconfont ".concat(nt)}),at)}var T=function(we){var We=we.watch,Qe=we.showNullButton,nt=we.onActionCallback,Ve=we.fullScreen,dt=we.insertTemp,ct=we.hidetoolBar,at=we.uuid,Dt=we.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(o.D)("_educoder_session_login"),"&_educoder_session=").concat(Object(o.D)("_educoder_session"),"&key=").concat(at,"&api=").concat(encodeURIComponent(i.a.PROXY_SERVER)));var wt=[].concat(g,[{title:"".concat(We?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(We?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return A.a.createElement("ul",{className:"markdown-toolbar-container"},!ct&&wt.map(function(xt,kt){return A.a.createElement("li",{key:kt},xt.actionName?A.a.createElement(l,Object(x.a)({},xt,{onActionCallback:nt})):A.a.createElement("span",{className:"v-line"}))}),Qe?A.a.createElement("li",null,A.a.createElement(l,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:nt},A.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,dt&&A.a.createElement("li",null,A.a.createElement(l,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(dt),onActionCallback:nt},A.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),A.a.createElement("li",{className:"btn-full-screen"},A.a.createElement(l,{icon:"".concat(Ve?"icon-shrink":"icon-enlarge"),title:Ve?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:nt})))},I=Y("M8RZ"),F=Y("+L6B"),W=Y("2/Rp"),V=Y("y8nQ"),M=Y("Vl3Y"),N=Y("5NDa"),J=Y("5rEg"),ae={labelCol:{span:4},wrapperCol:{span:20}},ue=function(we){var We=we.callback,Qe=we.onCancel;function nt(Ve){We(Ve)}return A.a.createElement(M.a,Object(x.a)({},ae,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:nt}),A.a.createElement(M.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},A.a.createElement(J.a,null)),A.a.createElement(M.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},A.a.createElement(J.a,null)),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(W.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(W.a,{type:"ghost",onClick:Qe},"\u53D6\u6D88")))},ve=Y("7ahc"),Te=Y("k1fw"),_e=Y("HmJG"),fe=Y("BjJ7"),ne=M.a.useForm,me={width:280,marginRight:10},ie={labelCol:{span:5},wrapperCol:{span:19}},le=function(we){var We=we.callback,Qe=we.onCancel,nt=ne(),Ve=Object(j.a)(nt,1),dt=Ve[0],ct=Object(E.useRef)();function at(xt){We(Object(Te.a)(Object(Te.a)({},xt),{},{name:ct.current}))}function Dt(xt,kt){dt.setFieldsValue({src:"/api/attachments/".concat(xt.id,"?type=").concat(xt.content_type),type:kt.type})}function wt(xt){var kt=xt.target.files[0];ct.current=kt.name,re(kt,Dt)}return A.a.createElement(M.a,Object(x.a)({form:dt},ie,{className:"upload-image-panel",onFinish:at}),A.a.createElement(M.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},A.a.createElement("div",{className:"flex-container"},A.a.createElement(M.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},A.a.createElement(J.a,{style:me})),A.a.createElement(q,{onFileChange:wt}))),A.a.createElement(M.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},A.a.createElement(J.a,{style:{width:264}})),A.a.createElement(M.a.Item,{style:{textAlign:"right"}},A.a.createElement(W.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(W.a,{type:"ghost",onClick:Qe},"\u53D6\u6D88")))};function q(we){var We=we.onFileChange;return A.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",A.a.createElement("input",{type:"file",onChange:We}))}function re(we,We){if(!we)throw new String("\u6CA1\u6709\u6587\u4EF6");var Qe=new FormData;Qe.append("editormd-image-file",we),Qe.append("file_param_name","editormd-image-file"),Qe.append("byxhr","true");var nt=new window.XMLHttpRequest;nt.withCredentials=!0,nt.addEventListener("load",function(Ve){We(JSON.parse(Ve.target.responseText),we)},!1),nt.addEventListener("error",function(Ve){console.error(Ve)},!1),nt.open("POST","".concat(fe.a,"/api/attachments.json")),nt.send(Qe)}var oe=Y("giR+"),ge=Y("fyUT"),Se=Y("7Kak"),Ee=Y("9yH6"),Re=Ee.a.Group,Pe={margin:"0 8px"},Ue=function(we){var We=we.callback,Qe=we.onCancel;function nt(Ve){We(Ve)}return A.a.createElement(M.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:nt},A.a.createElement("div",{className:"flex-container"},A.a.createElement("span",{style:Pe},"\u5355\u5143\u683C\u6570\uFF1A"),A.a.createElement("span",{style:Pe},"\u884C\u6570"),A.a.createElement(M.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},A.a.createElement(ge.a,null)),A.a.createElement("span",{style:Pe},"\u5217\u6570"),A.a.createElement(M.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},A.a.createElement(ge.a,null))),A.a.createElement("div",{className:"flex-container",style:{marginTop:12}},A.a.createElement("span",{style:Pe},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),A.a.createElement(M.a.Item,{name:"align"},A.a.createElement(Re,null,A.a.createElement(Ee.a,{value:"default"},A.a.createElement("i",{className:"fa fa-align-justify"})),A.a.createElement(Ee.a,{value:"left"},A.a.createElement("i",{className:"fa fa-align-left"})),A.a.createElement(Ee.a,{value:"center"},A.a.createElement("i",{className:"fa fa-align-center"})),A.a.createElement(Ee.a,{value:"right"},A.a.createElement("i",{className:"fa fa-align-right"}))))),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(W.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(W.a,{type:"ghost",onClick:Qe},"\u53D6\u6D88")))},He=Y("ErOA"),Fe=Y("7Cbv"),Ne="link",qe="upload-image",Je="code-block",it="add-table",rt="------------",ht={default:rt,left:":".concat(rt),center:":".concat(rt,":"),right:"".concat(rt,":")},ft=Y("9VGf"),ke,Le;function Ge(){}var Ke=0,Me=1e4,je="\u2581",xe=`
|
|
**\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 pe(we){return/^\d+$/.test(we)?"".concat(we,"px"):we}var be=navigator.platform.toUpperCase().indexOf("MAC")>=0,te=be?"Cmd":"Ctrl",de=["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"],he=(ke={},Object(B.a)(ke,te+"-B","bold"),Object(B.a)(ke,te+"-I","italic"),ke),ye=(Le={},Object(B.a)(Le,Ne,"\u6DFB\u52A0\u94FE\u63A5"),Object(B.a)(Le,Je,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(B.a)(Le,qe,"\u6DFB\u52A0\u6587\u4EF6"),Object(B.a)(Le,it,"\u6DFB\u52A0\u8868\u683C"),Le),De=ze.a=function(we){var We=we.defaultValue,Qe=We===void 0?"":We,nt=we.onChange,Ve=we.width,dt=Ve===void 0?"100%":Ve,ct=we.height,at=ct===void 0?400:ct,Dt=we.miniToolbar,wt=Dt===void 0?!1:Dt,xt=we.isFocus,kt=xt===void 0?!1:xt,Et=we.watch,Mt=we.insertTemp,Rt=we.mode,Xe=Rt===void 0?"markdown":Rt,bt=we.id,ot=bt===void 0?"markdown-editor-id":bt,lt=we.showResizeBar,st=lt===void 0?!1:lt,zt=we.noStorage,Wt=zt===void 0?!1:zt,St=we.showNullButton,ut=St===void 0?!1:St,or=we.hidetoolBar,$t=or===void 0?!1:or,Tt=we.fullScreen,Ot=Tt===void 0?!1:Tt,Gt=we.onBlur,ir=we.onCMBeforeChange,Dr=we.onFullScreen,et=we.className,Ct=et===void 0?"":et,Ut=we.disablePaste,nr=Ut===void 0?!1:Ut,mr=we.placeholder,Cr=mr===void 0?"":mr,H=we.values,p=H===void 0?"":H,S=Object(E.useState)(null),K=Object(j.a)(S,2),$=K[0],G=K[1],Ae=Object(E.useState)(Qe),$e=Object(j.a)(Ae,2),pt=$e[0],_t=$e[1],Ze=Object(E.useState)(Et),Bt=Object(j.a)(Ze,2),It=Bt[0],hr=Bt[1],Wr=Object(E.useState)(Ot),Hr=Object(j.a)(Wr,2),br=Hr[0],Jr=Hr[1],Sn=Object(E.useState)(""),Fr=Object(j.a)(Sn,2),Jt=Fr[0],jt=Fr[1],Xt=Object(E.useState)(0),Zt=Object(j.a)(Xt,2),sr=Zt[0],qt=Zt[1],Sr=Object(E.useState)(at),Ir=Object(j.a)(Sr,2),Or=Ir[0],wr=Ir[1],Zr=Object(E.useState)(!1),on=Object(j.a)(Zr,2),hn=on[0],lr=on[1],Yt=Object(E.useRef)(Object(Fe.a)()),Tr=Object(E.useRef)(!1),tr=Object(E.useRef)(),Er=Object(E.useRef)(),Vt=Object(E.useRef)(),en=Object(E.useRef)(),_r=Object(E.useRef)(),Xr=function(){var Pt=Object(O.a)(D.a.mark(function Ht(){var Nt,Qt;return D.a.wrap(function(gr){for(;;)switch(gr.prev=gr.next){case 0:return gr.next=2,Object(He.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Yt.current}});case 2:Qt=gr.sent,Qt!=null&&(Nt=Qt.attachments)!==null&&Nt!==void 0&&Nt.length&&(console.log("cm:",$,Er),Qt.attachments.map(function(ar){ar.content_type.indexOf("image")>-1?$.replaceSelection(".concat(ar.content_type,")")):ar.content_type.indexOf("video")>-1?$.replaceSelection('<video width="100%" controls src="'.concat(i.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):ar.content_type.indexOf("pdf")>-1?$.replaceSelection('<a href="'.concat(i.a.API_SERVER,"/api/attachments/").concat(ar.id,"?type=").concat(ar.content_type,'&disposition=inline" target="_blank">').concat(ar.name,"</a>")):$.replaceSelection("[".concat(ar.name,"](").concat(i.a.API_SERVER,"/api/attachments/").concat(ar.id,"?type=").concat(ar.content_type,")"))}));case 4:case"end":return gr.stop()}},Ht)}));return function(){return Pt.apply(this,arguments)}}();Object(E.useEffect)(function(){_t(p),$==null||$.setValue(p)},[p]),Object(E.useEffect)(function(){Dr==null||Dr(br)},[br]),Object(E.useEffect)(function(){if(Er.current){var Pt=w.a.fromTextArea(Er.current,{mode:Xe,lineNumbers:!wt,lineWrapping:!0,value:Qe,autoCloseTags:!0,autoCloseBrackets:!0});kt&&Pt.focus();function Ht(Nt,Qt){if(nr){Qt.preventDefault();return}var fr=Qt.clipboardData;if(fr){var gr=fr.types.toString(),ar=fr.items;if(gr==="Files"||fr.types.indexOf("Files")>-1){if(Qt.preventDefault(),Xe=="stex")return;try{var Rr,Yr=ar[1];((Rr=ar[0])===null||Rr===void 0?void 0:Rr.kind)==="file"&&(Yr=ar[0]);var er=Yr.getAsFile(),An=er.name.split(".").pop();re(er,function(ur){if(ur.id){var Nr,pn,mn;(er==null||((Nr=er.type)===null||Nr===void 0)?void 0:Nr.indexOf("image"))>-1?Pt.replaceSelection(".concat(ur.content_type,")")):(er==null||((pn=er.type)===null||pn===void 0)?void 0:pn.indexOf("video"))>-1?Pt.replaceSelection('<video width="100%" controls src="'.concat(i.a.API_SERVER,"/api/attachments/").concat(ur.id,'"></video>')):(er==null||((mn=er.type)===null||mn===void 0)?void 0:mn.indexOf("pdf"))>-1?Pt.replaceSelection('<a href="'.concat(i.a.API_SERVER,"/api/attachments/").concat(ur.id,"?type=").concat(er.type,'&disposition=inline" target="_blank">').concat(er.name,"</a>")):de.includes(An)?Pt.replaceSelection('<a href="'.concat(i.a.API_SERVER,"/api/attachments/").concat(ur.id,'?type=office&disposition=inline" target="_blank">').concat(er.name,"</a>")):Pt.replaceSelection("[".concat(er.name,"](").concat(i.a.API_SERVER,"/api/attachments/").concat(ur.id,"?type=").concat(ur.content_type,")"))}else(ur==null?void 0:ur.status)===401&&(document.location.href="/user/login")})}catch(ur){U.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return Pt.on("paste",Ht),Pt.on("dragleave",function(Nt,Qt){Vt.current.classList.remove("mouse-hover-md")}),Pt.on("dragover",function(Nt,Qt){Vt.current.classList.add("mouse-hover-md")}),Pt.on("drop",function(Nt,Qt){Vt.current.classList.add("mouse-hover-md");var fr;if(fr=Qt.dataTransfer.files,fr.length>0){Qt.preventDefault(),Qt.stopPropagation();for(var gr=function(Yr){var er=fr[Yr],An=er.name.split(".").pop();re(er,function(ur){if(ur.id){var Nr,pn,mn;(er==null||((Nr=er.type)===null||Nr===void 0)?void 0:Nr.indexOf("image"))>-1?Pt.replaceSelection(".concat(ur.content_type,")")):(er==null||((pn=er.type)===null||pn===void 0)?void 0:pn.indexOf("video"))>-1?Pt.replaceSelection('<video width="100%" controls src="'.concat(i.a.API_SERVER,"/api/attachments/").concat(ur.id,'"></video>')):(er==null||((mn=er.type)===null||mn===void 0)?void 0:mn.indexOf("pdf"))>-1?Pt.replaceSelection('<a href="'.concat(i.a.API_SERVER,"/api/attachments/").concat(ur.id,"?type=").concat(er.type,'&disposition=inline" target="_blank">').concat(er.name,"</a>")):de.includes(An)?Pt.replaceSelection('<a href="'.concat(i.a.API_SERVER,"/api/attachments/").concat(ur.id,'?type=office&disposition=inline" target="_blank">').concat(er.name,"</a>")):Pt.replaceSelection("[".concat(er.name,"](").concat(i.a.API_SERVER,"/api/attachments/").concat(ur.id,"?type=").concat(ur.content_type,")"))}else(ur==null?void 0:ur.status)===401&&(document.location.href="/user/login")})},ar=0;ar<fr.length;ar++)gr(ar)}}),G(Pt),function(){Pt.off("paste",Ht)}}},[]);var vr=Object(E.useCallback)(function(){if(Vt.current)try{}catch(Pt){console.log(Pt,"---- to set md editor body height")}},[Or,Vt,br]);Object(E.useEffect)(function(){function Pt(){var Nt=new y.default(function(Qt){var fr=Object(R.a)(Qt),gr;try{for(fr.s();!(gr=fr.n()).done;){var ar=gr.value;(ar.target.offsetHeight>0||ar.target.offsetWidth>0)&&(vr(),$.setSize("100%","100%"),$.refresh())}}catch(Rr){fr.e(Rr)}finally{fr.f()}});return Nt.observe(Er.current.parentElement),Nt}if($){var Ht=Pt();return function(){Ht.unobserve(Er.current.parentElement)}}},[$,vr]),Object(E.useEffect)(function(){if($){for(var Pt=[],Ht=function(){var ar=Qt[Nt];fr=Object(j.a)(ar,2);var Rr=fr[0],Yr=fr[1],er=Object(B.a)({},Rr,function(){bn(Yr)});Pt.push(er),$.addKeyMap(er)},Nt=0,Qt=Object.entries(he);Nt<Qt.length;Nt++){var fr;Ht()}return tr.current=setInterval(function(){Tr.current&&Xr()},4e3),function(){clearInterval(tr.current);var gr=Object(R.a)(Pt),ar;try{for(gr.s();!(ar=gr.n()).done;){var Rr=ar.value;$.removeKeyMap(Rr)}}catch(Yr){gr.e(Yr)}finally{gr.f()}}}},[$]),Object(E.useEffect)(function(){Ot!==br&&Jr(Ot)},[Ot]),Object(ft.a)(function(){if(!Wt&&sr>0){var Pt=new Date().getTime(),Ht=window.sessionStorage.getItem(ot);Pt>=sr+Me&&(!Ht||Ht!==pt)&&(window.sessionStorage.setItem(ot,pt),lr(!0))}},Me),Object(E.useEffect)(function(){hr(Et)},[$,Et]),Object(E.useEffect)(function(){$&&(kt&&$.focus())},[$,kt]),Object(E.useEffect)(function(){if(It&&$){var Pt=$.getScrollerElement();function Ht(Nt){var Qt=Nt.target;if(_r.current){var fr=Qt.scrollTop/Qt.scrollHeight;_r.current.scrollTop=_r.current.scrollHeight*fr}}return Pt.addEventListener("scroll",Ht),function(){Pt.removeEventListener("scroll",Ht)}}},[$,It]),Object(E.useEffect)(function(){if($&&ir){function Pt(Ht,Nt){ir(Ht,Nt)}return $.on("beforeChange",Pt),function(){$.off("beforeChange",Pt)}}},[$,ir]),Object(E.useEffect)(function(){if($&&Gt){function Pt(){Gt($.getValue())}return $.on("blur",Pt),function(){$.off("blur",Pt)}}},[$,Gt]),Object(E.useEffect)(function(){if($){function Pt(Ht){var Nt=Ht.getValue();_t(Nt),qt(new Date().getTime()),Ht.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),nt&&nt(Nt)}return $.on("change",Pt),function(){$.off("change",Pt)}}},[$,nt]),Object(E.useEffect)(function(){$&&(Qe==null?($.setValue(""),_t("")):Qe!==$.getValue()&&($.setValue(Qe),_t(Qe),$.setCursor($.lineCount(),0)))},[$,Qe]);var bn=Object(E.useCallback)(function(Pt){var Ht=$.getCursor(),Nt=$.getSelection(),Qt=Nt.split(`
|
|
`);switch(Pt){case"bold":return $.replaceSelection("**"+Nt+"**"),Nt===""&&$.setCursor(Ht.line,Ht.ch+2),$.focus();case"italic":return $.replaceSelection("*"+Nt+"*"),Nt===""&&$.setCursor(Ht.line,Ht.ch+1),$.focus();case"code":return $.replaceSelection("`"+Nt+"`"),Nt===""&&$.setCursor(Ht.line,Ht.ch+1),$.focus();case"inline-latex":return $.replaceSelection("`$$"+Nt+"$$`"),Nt===""&&$.setCursor(Ht.line,Ht.ch+3),$.focus();case"latex":return $.replaceSelection("```latex\n"+Nt+"\n```"),$.setCursor(Ht.line+1,Nt.length+1),$.focus();case"line-break":return $.replaceSelection(`<br/>
|
|
`),$.focus();case"list-ul":return Nt===""?$.replaceSelection("- "+Nt):$.replaceSelection(Qt.map(function(fr){return fr===""?"":"- ".concat(fr)}).join(`
|
|
`)),$.focus();case"list-ol":return Nt===""?$.replaceSelection("1. "+Nt):$.replaceSelection(Qt.map(function(fr,gr){return fr===""?"":"".concat(gr+1,". ").concat(fr)}).join(`
|
|
`)),$.focus();case"add-null-ch":return Nt===""&&$.setCursor(Ht.line,Ht.ch+1),$.replaceSelection(je),$.focus();case"inster-template-1":return Nt===""&&$.setCursor(Ht.line,Ht.ch),$.replaceSelection(xe),$.focus();case"eraser":return $.setValue(""),$.focus();case"trigger-watch":return hr(!It),$.focus();case"trigger-full-screen":return Jr(!br),$.focus();case Ne:jt(Ne);return;case Je:jt(Je);return;case qe:jt(qe);return;case it:jt(it);return;default:throw new Error}},[$,It,br]),tn=Object(E.useCallback)(function(Pt){jt("");switch(Jt){case Ne:var Ht=Pt.title,Nt=Pt.link;return $.replaceSelection("[".concat(Ht,"](").concat(Nt,")")),$.focus();case Je:var Qt=Pt.language,fr=Pt.content;return $.replaceSelection(["```"+Qt,fr,"```"].join(`
|
|
`)),$.focus();case qe:var gr=Pt.src,ar=Pt.alt,Rr=Pt.name;return gr.indexOf("type=image")>-1?$.replaceSelection(".concat(gr,' "').concat(ar||"",'" )')):gr.indexOf("type=application/pdf")>-1?$.replaceSelection('<a href="'.concat(gr,'&disposition=inline" target="_blank">').concat(Rr,"</a>")):$.replaceSelection('<a href="'.concat(gr,'" target="_blank">').concat(Rr,"</a>")),$.focus();case it:for(var Yr=Pt.row,er=Pt.col,An=Pt.align,ur=`
|
|
`,Nr=0;Nr<Yr;Nr++){for(var pn=[],mn=[],dr=0;dr<er;dr++)Nr===1&&mn.push(ht[An]),pn.push(" ");Nr===1&&(ur+="| ".concat(mn.join(" | "),` |
|
|
`)),ur+="| ".concat(pn.join(er===1?"":" | "),` |
|
|
`)}return $.replaceSelection(ur+`
|
|
`),$.focus();default:throw new Error}},[$,Jt]),Xn=Object(E.useMemo)(function(){switch(Jt){case Ne:return A.a.createElement(ue,{callback:tn,onCancel:rn});case Je:return A.a.createElement(ve.b,{callback:tn,onCancel:rn});case qe:return A.a.createElement(le,{callback:tn,onCancel:rn});case it:return A.a.createElement(Ue,{callback:tn,onCancel:rn});default:return null}},[Jt]);function rn(){jt("")}Object(E.useEffect)(function(){if(en.current){var Pt=en.current,Ht=!1,Nt=0;function Qt(ar){Ht=!0,Nt=ar.pageY}function fr(){Ht=!1}function gr(ar){if(Ht){var Rr=ar.pageY-Nt;Rr<0&&(Rr=0),Rr>300&&(Rr=300);var Yr=at+Rr+"px";wr(Yr)}}return Pt.addEventListener("mousedown",Qt),document.addEventListener("mousemove",gr),document.addEventListener("mouseup",fr),function(){Pt.removeEventListener("mousedown",Qt),document.removeEventListener("mousemove",gr),document.removeEventListener("mouseup",fr)}}},[$,en]),Object(E.useEffect)(function(){wr(at)},[at]);var In=pe(dt),En=pe(Or),Rn={width:In,height:En},Nn=Object(E.useMemo)(function(){if(sr){var Pt=new Date(sr),Ht=Pt.getHours(),Nt=Pt.getMinutes(),Qt=Pt.getSeconds();return Ht=Ht<10?"0"+Ht:Ht,Nt=Nt<10?"0"+Nt:Nt,Qt=Qt<10?"0"+Qt:Qt,"".concat(Ht,":").concat(Nt,":").concat(Qt)}return 0},[sr]);function fn(){window.sessionStorage.removeItem(ot),lr(!1),qt(0)}function ii(){lr(!1),qt(0),$.setValue(window.sessionStorage.getItem(ot))}function Ci(Pt,Ht){var Nt=$.getValue();Nt=Nt.replace(Pt,Ht),_t(Nt),$==null||$.setValue(Nt)}return A.a.createElement(E.Fragment,null,A.a.createElement("div",{className:"markdown-editor-wrapper",ref:Vt},A.a.createElement("div",{className:"markdown-editor-container ".concat(Ct," ").concat(It?"on-preview":""," ").concat(wt?"mini":""," ").concat(br?"full-screen":""),style:Rn},A.a.createElement(T,{insertTemp:Mt,watch:It,fullScreen:br,showNullButton:ut,onActionCallback:bn,hidetoolBar:$t,uuid:Yt.current,setOpenPhones:function(){Tr.current=!0}}),A.a.createElement("div",{className:"markdown-editor-body"},A.a.createElement("div",{className:"codemirror-container"},A.a.createElement("textarea",{ref:Er,placeholder:Cr})),It?A.a.createElement("div",{ref:_r,className:"preview-container"},Xe==="stex"&&A.a.createElement(_,{value:pt}),Xe!=="stex"&&A.a.createElement(m.a,{edit:!0,value:pt,replaces:Ci})):null))),st?A.a.createElement("a",{ref:en,className:"editor-resize"}):null,A.a.createElement(I.a,null,ye[Jt]?A.a.createElement(X.a,{centered:!0,title:ye[Jt],visible:!0,onCancel:rn,footer:null},Xn):null))}},"P/tu":function(gt,ze,Y){"use strict";var ce=Y("ozfa"),X=Y("MJZm"),R=Y("0Owb"),Z=Y("9og8"),U=Y("tJVT"),O=Y("PpiC"),j=Y("WmNS"),B=Y.n(j),k=Y("q1tI"),D=Y.n(k),E=Y("WCUW"),A=Y("spXi"),P=Y.n(A),w=function(b){var c=b.value,s=b.onChange,u=b.defaultValue,f=b.disabled,C=Object(O.a)(b,["value","onChange","defaultValue","disabled"]),v=Object(k.useState)([]),m=Object(U.a)(v,2),_=m[0],x=m[1],d=Object(k.useState)("1"),h=Object(U.a)(d,2),o=h[0],i=h[1];Object(k.useEffect)(function(){g()},[]);var g=function(){var I=Object(Z.a)(B.a.mark(function F(){var W,V;return B.a.wrap(function(N){for(;;)switch(N.prev=N.next){case 0:return N.next=2,Object(E.x)({});case 2:W=N.sent,W!=null&&W.data&&(V=[{title:D.a.createElement("div",{title:"\u6839\u76EE\u5F55",className:P.a.name},"\u6839\u76EE\u5F55"),value:0,key:0,icon:D.a.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:l(W.data||[])}],x(V),i("2"));case 4:case"end":return N.stop()}},F)}));return function(){return I.apply(this,arguments)}}(),l=function(F){function W(V){var M=V.children,N=Array.isArray(M)&&M.length>0,J=V==null?void 0:V.group_id;return{title:D.a.createElement("div",{title:V==null?void 0:V.name,className:P.a.name},V==null?void 0:V.name),value:J,key:J,icon:D.a.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:N?M==null?void 0:M.map(function(ae){return W(ae)}):[]}}return F==null?void 0:F.map(function(V){return W(V)})},T=u?{defaultExpandedKeys:[0]}:{selectedKeys:c,defaultExpandedKeys:c};return D.a.createElement("div",{className:P.a.customTree},D.a.createElement(X.a,Object(R.a)({key:o},T,{showIcon:!0,treeData:_,onSelect:s,disabled:f},C)))};ze.a=w},RxwV:function(gt,ze,Y){"use strict";var ce=Y("q1tI"),X=Y("uciX"),R=Y("2W6z"),Z=Y.n(R),U=Y("4IlW"),O=Y("uK0f"),j=Y.n(O);function B(ne,me){if(ne===me)return!0;if(!ne||!me)return!1;var ie=ne.length;if(me.length!==ie)return!1;for(var le=0;le<ie;le++)if(ne[le]!==me[le])return!1;return!0}function k(ne){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?k=function(ie){return typeof ie}:k=function(ie){return ie&&typeof Symbol=="function"&&ie.constructor===Symbol&&ie!==Symbol.prototype?"symbol":typeof ie},k(ne)}function D(ne,me){if(!(ne instanceof me))throw new TypeError("Cannot call a class as a function")}function E(ne,me){for(var ie=0;ie<me.length;ie++){var le=me[ie];le.enumerable=le.enumerable||!1,le.configurable=!0,"value"in le&&(le.writable=!0),Object.defineProperty(ne,le.key,le)}}function A(ne,me,ie){return me&&E(ne.prototype,me),ie&&E(ne,ie),ne}function P(ne,me){if(typeof me!="function"&&me!==null)throw new TypeError("Super expression must either be null or a function");ne.prototype=Object.create(me&&me.prototype,{constructor:{value:ne,writable:!0,configurable:!0}}),me&&w(ne,me)}function w(ne,me){return w=Object.setPrototypeOf||function(le,q){return le.__proto__=q,le},w(ne,me)}function y(ne){var me=s();return function(){var ie=u(ne),le;if(me){var q=u(this).constructor;le=Reflect.construct(ie,arguments,q)}else le=ie.apply(this,arguments);return b(this,le)}}function b(ne,me){return me&&(k(me)==="object"||typeof me=="function")?me:c(ne)}function c(ne){if(ne===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return ne}function s(){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(ne){return!1}}function u(ne){return u=Object.setPrototypeOf?Object.getPrototypeOf:function(ie){return ie.__proto__||Object.getPrototypeOf(ie)},u(ne)}var f=function(){var ne=function(me){P(le,me);var ie=y(le);function le(){var q;return D(this,le),q=ie.apply(this,arguments),q.menuItems={},q.saveMenuItem=function(re){return function(oe){q.menuItems[re]=oe}},q}return A(le,[{key:"componentDidMount",value:function(){this.scrollActiveItemToView()}},{key:"componentDidUpdate",value:function(re){!re.visible&&this.props.visible&&this.scrollActiveItemToView()}},{key:"getFieldName",value:function(re){var oe=this.props,ge=oe.fieldNames,Se=oe.defaultFieldNames;return ge[re]||Se[re]}},{key:"getOption",value:function(re,oe){var ge=this.props,Se=ge.prefixCls,Ee=ge.expandTrigger,Re=ge.expandIcon,Pe=ge.loadingIcon,Ue=this.props.onSelect.bind(this,re,oe),He=this.props.onItemDoubleClick.bind(this,re,oe),Fe={onClick:Ue,onDoubleClick:He},Ne="".concat(Se,"-menu-item"),qe=null,Je=re[this.getFieldName("children")]&&re[this.getFieldName("children")].length>0;(Je||re.isLeaf===!1)&&(Ne+=" ".concat(Se,"-menu-item-expand"),re.loading||(qe=ce.createElement("span",{className:"".concat(Se,"-menu-item-expand-icon")},Re))),Ee==="hover"&&(Je||re.isLeaf===!1)&&(Fe={onMouseEnter:this.delayOnSelect.bind(this,Ue),onMouseLeave:this.delayOnSelect.bind(this),onClick:Ue}),this.isActiveOption(re,oe)&&(Ne+=" ".concat(Se,"-menu-item-active"),Fe.ref=this.saveMenuItem(oe)),re.disabled&&(Ne+=" ".concat(Se,"-menu-item-disabled"));var it=null;re.loading&&(Ne+=" ".concat(Se,"-menu-item-loading"),it=Pe||null);var rt="";return"title"in re?rt=re.title:typeof re[this.getFieldName("label")]=="string"&&(rt=re[this.getFieldName("label")]),ce.createElement("li",Object.assign({key:re[this.getFieldName("value")],className:Ne,title:rt},Fe,{role:"menuitem",onMouseDown:function(ft){return ft.preventDefault()}}),re[this.getFieldName("label")],qe,it)}},{key:"getActiveOptions",value:function(re){var oe=this,ge=this.props.options,Se=re||this.props.activeValue;return j()(ge,function(Ee,Re){return Ee[oe.getFieldName("value")]===Se[Re]},{childrenKeyName:this.getFieldName("children")})}},{key:"getShowOptions",value:function(){var re=this,oe=this.props.options,ge=this.getActiveOptions().map(function(Se){return Se[re.getFieldName("children")]}).filter(function(Se){return!!Se});return ge.unshift(oe),ge}},{key:"delayOnSelect",value:function(re){for(var oe=this,ge=arguments.length,Se=new Array(ge>1?ge-1:0),Ee=1;Ee<ge;Ee++)Se[Ee-1]=arguments[Ee];this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null),typeof re=="function"&&(this.delayTimer=window.setTimeout(function(){re(Se),oe.delayTimer=null},150))}},{key:"scrollActiveItemToView",value:function(){for(var re=this.getShowOptions().length,oe=0;oe<re;oe++){var ge=this.menuItems[oe];ge&&ge.parentElement&&(ge.parentElement.scrollTop=ge.offsetTop)}}},{key:"isActiveOption",value:function(re,oe){var ge=this.props.activeValue,Se=ge===void 0?[]:ge;return Se[oe]===re[this.getFieldName("value")]}},{key:"render",value:function(){var re=this,oe=this.props,ge=oe.prefixCls,Se=oe.dropdownMenuColumnStyle;return ce.createElement("div",null,this.getShowOptions().map(function(Ee,Re){return ce.createElement("ul",{className:"".concat(ge,"-menu"),key:Re,style:Se},Ee.map(function(Pe){return re.getOption(Pe,Re)}))}))}}]),le}(ce.Component);return ne.defaultProps={options:[],value:[],activeValue:[],onSelect:function(){},prefixCls:"rc-cascader-menus",visible:!1,expandTrigger:"click"},ne}(),C=f,v={bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},topLeft:{points:["bl","tl"],offset:[0,-4],overflow:{adjustX:1,adjustY:1}},bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},topRight:{points:["br","tr"],offset:[0,-4],overflow:{adjustX:1,adjustY:1}}},m=v;function _(ne){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_=function(ie){return typeof ie}:_=function(ie){return ie&&typeof Symbol=="function"&&ie.constructor===Symbol&&ie!==Symbol.prototype?"symbol":typeof ie},_(ne)}function x(ne,me){if(ne==null)return{};var ie=d(ne,me),le,q;if(Object.getOwnPropertySymbols){var re=Object.getOwnPropertySymbols(ne);for(q=0;q<re.length;q++){if(le=re[q],me.indexOf(le)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(ne,le))continue;ie[le]=ne[le]}}return ie}function d(ne,me){if(ne==null)return{};var ie={},le=Object.keys(ne),q,re;for(re=0;re<le.length;re++){if(q=le[re],me.indexOf(q)>=0)continue;ie[q]=ne[q]}return ie}function h(ne){return l(ne)||g(ne)||i(ne)||o()}function o(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function i(ne,me){if(!ne)return;if(typeof ne=="string")return T(ne,me);var ie=Object.prototype.toString.call(ne).slice(8,-1);if(ie==="Object"&&ne.constructor&&(ie=ne.constructor.name),ie==="Map"||ie==="Set")return Array.from(ne);if(ie==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ie))return T(ne,me)}function g(ne){if(typeof Symbol!="undefined"&&Symbol.iterator in Object(ne))return Array.from(ne)}function l(ne){if(Array.isArray(ne))return T(ne)}function T(ne,me){(me==null||me>ne.length)&&(me=ne.length);for(var ie=0,le=new Array(me);ie<me;ie++)le[ie]=ne[ie];return le}function I(ne,me){if(!(ne instanceof me))throw new TypeError("Cannot call a class as a function")}function F(ne,me){for(var ie=0;ie<me.length;ie++){var le=me[ie];le.enumerable=le.enumerable||!1,le.configurable=!0,"value"in le&&(le.writable=!0),Object.defineProperty(ne,le.key,le)}}function W(ne,me,ie){return me&&F(ne.prototype,me),ie&&F(ne,ie),ne}function V(ne,me){if(typeof me!="function"&&me!==null)throw new TypeError("Super expression must either be null or a function");ne.prototype=Object.create(me&&me.prototype,{constructor:{value:ne,writable:!0,configurable:!0}}),me&&M(ne,me)}function M(ne,me){return M=Object.setPrototypeOf||function(le,q){return le.__proto__=q,le},M(ne,me)}function N(ne){var me=ue();return function(){var ie=ve(ne),le;if(me){var q=ve(this).constructor;le=Reflect.construct(ie,arguments,q)}else le=ie.apply(this,arguments);return J(this,le)}}function J(ne,me){return me&&(_(me)==="object"||typeof me=="function")?me:ae(ne)}function ae(ne){if(ne===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return ne}function ue(){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(ne){return!1}}function ve(ne){return ve=Object.setPrototypeOf?Object.getPrototypeOf:function(ie){return ie.__proto__||Object.getPrototypeOf(ie)},ve(ne)}var Te=function(){var ne=function(me){V(le,me);var ie=N(le);function le(q){var re;I(this,le),re=ie.call(this,q),re.setPopupVisible=function(ge){var Se=re.state.value;"popupVisible"in re.props||re.setState({popupVisible:ge}),ge&&!re.state.popupVisible&&re.setState({activeValue:Se}),re.props.onPopupVisibleChange(ge)},re.handleChange=function(ge,Se,Ee){var Re=Se.visible;(Ee.type!=="keydown"||Ee.keyCode===U.a.ENTER)&&(re.props.onChange(ge.map(function(Pe){return Pe[re.getFieldName("value")]}),ge),re.setPopupVisible(Re))},re.handlePopupVisibleChange=function(ge){re.setPopupVisible(ge)},re.handleMenuSelect=function(ge,Se,Ee){var Re=re.trigger.getRootDomNode();Re&&Re.focus&&Re.focus();var Pe=re.props,Ue=Pe.changeOnSelect,He=Pe.loadData,Fe=Pe.expandTrigger;if(!ge||ge.disabled)return;var Ne=re.state.activeValue;Ne=Ne.slice(0,Se+1),Ne[Se]=ge[re.getFieldName("value")];var qe=re.getActiveOptions(Ne);if(ge.isLeaf===!1&&!ge[re.getFieldName("children")]&&He){Ue&&re.handleChange(qe,{visible:!0},Ee),re.setState({activeValue:Ne}),He(qe);return}var Je={};!ge[re.getFieldName("children")]||!ge[re.getFieldName("children")].length?(re.handleChange(qe,{visible:!1},Ee),Je.value=Ne):Ue&&(Ee.type==="click"||Ee.type==="keydown")&&(Fe==="hover"?re.handleChange(qe,{visible:!1},Ee):re.handleChange(qe,{visible:!0},Ee),Je.value=Ne),Je.activeValue=Ne,("value"in re.props||Ee.type==="keydown"&&Ee.keyCode!==U.a.ENTER)&&delete Je.value,re.setState(Je)},re.handleItemDoubleClick=function(){var ge=re.props.changeOnSelect;ge&&re.setPopupVisible(!1)},re.handleKeyDown=function(ge){var Se=re.props.children;if(Se&&Se.props.onKeyDown){Se.props.onKeyDown(ge);return}var Ee=h(re.state.activeValue),Re=Ee.length-1<0?0:Ee.length-1,Pe=re.getCurrentLevelOptions(),Ue=Pe.map(function(qe){return qe[re.getFieldName("value")]}).indexOf(Ee[Re]);if(ge.keyCode!==U.a.DOWN&&ge.keyCode!==U.a.UP&&ge.keyCode!==U.a.LEFT&&ge.keyCode!==U.a.RIGHT&&ge.keyCode!==U.a.ENTER&&ge.keyCode!==U.a.SPACE&&ge.keyCode!==U.a.BACKSPACE&&ge.keyCode!==U.a.ESC&&ge.keyCode!==U.a.TAB)return;if(!re.state.popupVisible&&ge.keyCode!==U.a.BACKSPACE&&ge.keyCode!==U.a.LEFT&&ge.keyCode!==U.a.RIGHT&&ge.keyCode!==U.a.ESC&&ge.keyCode!==U.a.TAB){re.setPopupVisible(!0);return}if(ge.keyCode===U.a.DOWN||ge.keyCode===U.a.UP){ge.preventDefault();var He=Ue;He!==-1?ge.keyCode===U.a.DOWN?(He+=1,He=He>=Pe.length?0:He):(He-=1,He=He<0?Pe.length-1:He):He=0,Ee[Re]=Pe[He][re.getFieldName("value")]}else if(ge.keyCode===U.a.LEFT||ge.keyCode===U.a.BACKSPACE)ge.preventDefault(),Ee.splice(Ee.length-1,1);else if(ge.keyCode===U.a.RIGHT)ge.preventDefault(),Pe[Ue]&&Pe[Ue][re.getFieldName("children")]&&Ee.push(Pe[Ue][re.getFieldName("children")][0][re.getFieldName("value")]);else if(ge.keyCode===U.a.ESC||ge.keyCode===U.a.TAB){re.setPopupVisible(!1);return}(!Ee||Ee.length===0)&&re.setPopupVisible(!1);var Fe=re.getActiveOptions(Ee),Ne=Fe[Fe.length-1];re.handleMenuSelect(Ne,Fe.length-1,ge),re.props.onKeyDown&&re.props.onKeyDown(ge)},re.saveTrigger=function(ge){re.trigger=ge};var oe=[];return"value"in q?oe=q.value||[]:"defaultValue"in q&&(oe=q.defaultValue||[]),Z()(!("filedNames"in q),"`filedNames` of Cascader is a typo usage and deprecated, please use `fieldNames` instead."),re.state={popupVisible:q.popupVisible,activeValue:oe,value:oe,prevProps:q},re.defaultFieldNames={label:"label",value:"value",children:"children"},re}return W(le,[{key:"getPopupDOMNode",value:function(){return this.trigger.getPopupDomNode()}},{key:"getFieldName",value:function(re){var oe=this.defaultFieldNames,ge=this.props,Se=ge.fieldNames,Ee=ge.filedNames;return"filedNames"in this.props?Ee[re]||oe[re]:Se[re]||oe[re]}},{key:"getFieldNames",value:function(){var re=this.props,oe=re.fieldNames,ge=re.filedNames;return"filedNames"in this.props?ge:oe}},{key:"getCurrentLevelOptions",value:function(){var re=this,oe=this.props.options,ge=oe===void 0?[]:oe,Se=this.state.activeValue,Ee=Se===void 0?[]:Se,Re=j()(ge,function(Pe,Ue){return Pe[re.getFieldName("value")]===Ee[Ue]},{childrenKeyName:this.getFieldName("children")});return Re[Re.length-2]?Re[Re.length-2][this.getFieldName("children")]:h(ge).filter(function(Pe){return!Pe.disabled})}},{key:"getActiveOptions",value:function(re){var oe=this;return j()(this.props.options||[],function(ge,Se){return ge[oe.getFieldName("value")]===re[Se]},{childrenKeyName:this.getFieldName("children")})}},{key:"render",value:function(){var re=this.props,oe=re.prefixCls,ge=re.transitionName,Se=re.popupClassName,Ee=re.options,Re=Ee===void 0?[]:Ee,Pe=re.disabled,Ue=re.builtinPlacements,He=re.popupPlacement,Fe=re.children,Ne=re.dropdownRender,qe=x(re,["prefixCls","transitionName","popupClassName","options","disabled","builtinPlacements","popupPlacement","children","dropdownRender"]),Je=ce.createElement("div",null),it="";Re&&Re.length>0?Je=ce.createElement(C,Object.assign({},this.props,{fieldNames:this.getFieldNames(),defaultFieldNames:this.defaultFieldNames,activeValue:this.state.activeValue,onSelect:this.handleMenuSelect,onItemDoubleClick:this.handleItemDoubleClick,visible:this.state.popupVisible})):it=" ".concat(oe,"-menus-empty");var rt=Je;return Ne&&(rt=Ne(Je)),ce.createElement(X.a,Object.assign({ref:this.saveTrigger},qe,{popupPlacement:He,builtinPlacements:Ue,popupTransitionName:ge,action:Pe?[]:["click"],popupVisible:Pe?!1:this.state.popupVisible,onPopupVisibleChange:this.handlePopupVisibleChange,prefixCls:"".concat(oe,"-menus"),popupClassName:Se+it,popup:rt}),ce.cloneElement(Fe,{onKeyDown:this.handleKeyDown,tabIndex:Pe?void 0:0}))}}],[{key:"getDerivedStateFromProps",value:function(re,oe){var ge=oe.prevProps,Se=ge===void 0?{}:ge,Ee={prevProps:re};return"value"in re&&!B(Se.value,re.value)&&(Ee.value=re.value||[],"loadData"in re||(Ee.activeValue=re.value||[])),"popupVisible"in re&&(Ee.popupVisible=re.popupVisible),Ee}}]),le}(ce.Component);return ne.defaultProps={onChange:function(){},onPopupVisibleChange:function(){},disabled:!1,transitionName:"",prefixCls:"rc-cascader",popupClassName:"",popupPlacement:"bottomLeft",builtinPlacements:m,expandTrigger:"click",fieldNames:{label:"label",value:"value",children:"children"},expandIcon:">"},ne}(),_e=Te,fe=ze.a=_e},"SA+Z":function(gt,ze,Y){var ce=Y("wTVA"),X=Y("EbDI"),R=Y("ZhPi"),Z=Y("wkBT");function U(O){return ce(O)||X(O)||R(O)||Z()}gt.exports=U,gt.exports.__esModule=!0,gt.exports.default=gt.exports},SJMd:function(gt,ze){/**
|
|
* @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 Y,ce,X,R=!1,Z,U;window.PR_SHOULD_USE_CONTINUATION=!0;var O,j;(function(){var B=window,k=["break,continue,do,else,for,if,return,while"],D=[k,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],E=[D,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],A=[E,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],P=[E,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],w=[E,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],y="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",b=[E,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],c="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",s=[k,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],u=[k,"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"],f=[k,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],C=[A,w,P,b,c,s,u,f],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",_="kwd",x="com",d="typ",h="lit",o="pun",i="pln",g="tag",l="dec",T="src",I="atn",F="atv",W="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function M(Ee){for(var Re=0,Pe=!1,Ue=!1,He=0,Fe=Ee.length;He<Fe;++He){var Ne=Ee[He];if(Ne.ignoreCase)Ue=!0;else if(/[a-z]/i.test(Ne.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Pe=!0,Ue=!1;break}}var qe={b:8,t:9,n:10,v:11,f:12,r:13};function Je(ke){var Le=ke.charCodeAt(0);if(Le!==92)return Le;var Ge=ke.charAt(1);return Le=qe[Ge],Le||("0"<=Ge&&Ge<="7"?parseInt(ke.substring(1),8):Ge==="u"||Ge==="x"?parseInt(ke.substring(2),16):ke.charCodeAt(1))}function it(ke){if(ke<32)return(ke<16?"\\x0":"\\x")+ke.toString(16);var Le=String.fromCharCode(ke);return Le==="\\"||Le==="-"||Le==="]"||Le==="^"?"\\"+Le:Le}function rt(ke){var Le=ke.substring(1,ke.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")),Ge=[],Ke=Le[0]==="^",Me=["["];Ke&&Me.push("^");for(var je=Ke?1:0,xe=Le.length;je<xe;++je){var pe=Le[je];if(/\\[bdsw]/i.test(pe))Me.push(pe);else{var be=Je(pe),te;je+2<xe&&Le[je+1]==="-"?(te=Je(Le[je+2]),je+=2):te=be,Ge.push([be,te]),te<65||be>122||(te<65||be>90||Ge.push([Math.max(65,be)|32,Math.min(te,90)|32]),te<97||be>122||Ge.push([Math.max(97,be)&~32,Math.min(te,122)&~32]))}}Ge.sort(function(De,we){return De[0]-we[0]||we[1]-De[1]});for(var de=[],he=[],je=0;je<Ge.length;++je){var ye=Ge[je];ye[0]<=he[1]+1?he[1]=Math.max(he[1],ye[1]):de.push(he=ye)}for(var je=0;je<de.length;++je){var ye=de[je];Me.push(it(ye[0])),ye[1]>ye[0]&&(ye[1]+1>ye[0]&&Me.push("-"),Me.push(it(ye[1])))}return Me.push("]"),Me.join("")}function ht(ke){for(var Le=ke.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")),Ge=Le.length,Ke=[],Me=0,je=0;Me<Ge;++Me){var xe=Le[Me];if(xe==="(")++je;else if(xe.charAt(0)==="\\"){var pe=+xe.substring(1);pe&&(pe<=je?Ke[pe]=-1:Le[Me]=it(pe))}}for(var Me=1;Me<Ke.length;++Me)Ke[Me]===-1&&(Ke[Me]=++Re);for(var Me=0,je=0;Me<Ge;++Me){var xe=Le[Me];if(xe==="(")++je,Ke[je]||(Le[Me]="(?:");else if(xe.charAt(0)==="\\"){var pe=+xe.substring(1);pe&&pe<=je&&(Le[Me]="\\"+Ke[pe])}}for(var Me=0;Me<Ge;++Me)Le[Me]==="^"&&Le[Me+1]!=="^"&&(Le[Me]="");if(ke.ignoreCase&&Pe)for(var Me=0;Me<Ge;++Me){var xe=Le[Me],be=xe.charAt(0);xe.length>=2&&be==="["?Le[Me]=rt(xe):be!=="\\"&&(Le[Me]=xe.replace(/[a-zA-Z]/g,function(he){var ye=he.charCodeAt(0);return"["+String.fromCharCode(ye&~32,ye|32)+"]"}))}return Le.join("")}for(var ft=[],He=0,Fe=Ee.length;He<Fe;++He){var Ne=Ee[He];if(Ne.global||Ne.multiline)throw new Error(""+Ne);ft.push("(?:"+ht(Ne)+")")}return new RegExp(ft.join("|"),Ue?"gi":"g")}function N(Ee,Re){var Pe=/(?:^|\s)nocode(?:\s|$)/,Ue=[],He=0,Fe=[],Ne=0;function qe(Je){var it=Je.nodeType;if(it==1){if(Pe.test(Je.className))return;for(var rt=Je.firstChild;rt;rt=rt.nextSibling)qe(rt);var ht=Je.nodeName.toLowerCase();(ht==="br"||ht==="li")&&(Ue[Ne]=`
|
|
`,Fe[Ne<<1]=He++,Fe[Ne++<<1|1]=Je)}else if(it==3||it==4){var ft=Je.nodeValue;ft.length&&(Re?ft=ft.replace(/\r\n?/g,`
|
|
`):ft=ft.replace(/[ \t\r\n]+/g," "),Ue[Ne]=ft,Fe[Ne<<1]=He,He+=ft.length,Fe[Ne++<<1|1]=Je)}}return qe(Ee),{sourceCode:Ue.join("").replace(/\n$/,""),spans:Fe}}function J(Ee,Re,Pe,Ue,He){if(!Pe)return;var Fe={sourceNode:Ee,pre:1,langExtension:null,numberLines:null,sourceCode:Pe,spans:null,basePos:Re,decorations:null};Ue(Fe),He.push.apply(He,Fe.decorations)}var ae=/\S/;function ue(Ee){for(var Re=void 0,Pe=Ee.firstChild;Pe;Pe=Pe.nextSibling){var Ue=Pe.nodeType;Re=Ue===1?Re?Ee:Pe:Ue===3&&ae.test(Pe.nodeValue)?Ee:Re}return Re===Ee?void 0:Re}function ve(Ee,Re){var Pe={},Ue;(function(){for(var Ne=Ee.concat(Re),qe=[],Je={},it=0,rt=Ne.length;it<rt;++it){var ht=Ne[it],ft=ht[3];if(ft)for(var ke=ft.length;--ke>=0;)Pe[ft.charAt(ke)]=ht;var Le=ht[1],Ge=""+Le;Je.hasOwnProperty(Ge)||(qe.push(Le),Je[Ge]=null)}qe.push(/[\0-\uffff]/),Ue=M(qe)})();var He=Re.length,Fe=function(Ne){for(var qe=Ne.sourceCode,Je=Ne.basePos,it=Ne.sourceNode,rt=[Je,i],ht=0,ft=qe.match(Ue)||[],ke={},Le=0,Ge=ft.length;Le<Ge;++Le){var Ke=ft[Le],Me=ke[Ke],je=void 0,xe;if(typeof Me=="string")xe=!1;else{var pe=Pe[Ke.charAt(0)];if(pe)je=Ke.match(pe[1]),Me=pe[0];else{for(var be=0;be<He;++be)if(pe=Re[be],je=Ke.match(pe[1]),je){Me=pe[0];break}je||(Me=i)}xe=Me.length>=5&&Me.substring(0,5)==="lang-",xe&&!(je&&typeof je[1]=="string")&&(xe=!1,Me=T),xe||(ke[Ke]=Me)}var te=ht;if(ht+=Ke.length,!xe)rt.push(Je+te,Me);else{var de=je[1],he=Ke.indexOf(de),ye=he+de.length;je[2]&&(ye=Ke.length-je[2].length,he=ye-de.length);var De=Me.substring(5);J(it,Je+te,Ke.substring(0,he),Fe,rt),J(it,Je+te+he,de,le(De,de),rt),J(it,Je+te+ye,Ke.substring(ye),Fe,rt)}}Ne.decorations=rt};return Fe}function Te(Ee){var Re=[],Pe=[];Ee.tripleQuotedStrings?Re.push([m,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Ee.multiLineStrings?Re.push([m,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Re.push([m,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Ee.verbatimStrings&&Pe.push([m,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ue=Ee.hashComments;Ue&&(Ee.cStyleComments?(Ue>1?Re.push([x,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Re.push([x,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Pe.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Re.push([x,/^#[^\r\n]*/,null,"#"])),Ee.cStyleComments&&(Pe.push([x,/^\/\/[^\r\n]*/,null]),Pe.push([x,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var He=Ee.regexLiterals;if(He){var Fe=He>1?"":`
|
|
\r`,Ne=Fe?".":"[\\S\\s]",qe="/(?=[^/*"+Fe+"])(?:[^/\\x5B\\x5C"+Fe+"]|\\x5C"+Ne+"|\\x5B(?:[^\\x5C\\x5D"+Fe+"]|\\x5C"+Ne+")*(?:\\x5D|$))+/";Pe.push(["lang-regex",RegExp("^"+V+"("+qe+")")])}var Je=Ee.types;Je&&Pe.push([d,Je]);var it=(""+Ee.keywords).replace(/^ | $/g,"");it.length&&Pe.push([_,new RegExp("^(?:"+it.replace(/[\s,]+/g,"|")+")\\b"),null]),Re.push([i,/^\s+/,null,` \r
|
|
\xA0`]);var rt="^.[^\\s\\w.$@'\"`/\\\\]*";return Ee.regexLiterals&&(rt+="(?!s*/)"),Pe.push([h,/^@[a-z_$][a-z_$@0-9]*/i,null],[d,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[i,/^[a-z_$][a-z_$@0-9]*/i,null],[h,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[i,/^\\[\s\S]?/,null],[o,new RegExp(rt),null]),ve(Re,Pe)}var _e=Te({keywords:C,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function fe(Ee,Re,Pe){for(var Ue=/(?:^|\s)nocode(?:\s|$)/,He=/\r\n?|\n/,Fe=Ee.ownerDocument,Ne=Fe.createElement("li");Ee.firstChild;)Ne.appendChild(Ee.firstChild);var qe=[Ne];function Je(Le){var Ge=Le.nodeType;if(Ge==1&&!Ue.test(Le.className))if(Le.nodeName==="br")it(Le),Le.parentNode&&Le.parentNode.removeChild(Le);else for(var Ke=Le.firstChild;Ke;Ke=Ke.nextSibling)Je(Ke);else if((Ge==3||Ge==4)&&Pe){var Me=Le.nodeValue,je=Me.match(He);if(je){var xe=Me.substring(0,je.index);Le.nodeValue=xe;var pe=Me.substring(je.index+je[0].length);if(pe){var be=Le.parentNode;be.insertBefore(Fe.createTextNode(pe),Le.nextSibling)}it(Le),xe||Le.parentNode.removeChild(Le)}}}function it(Le){for(;!Le.nextSibling;)if(Le=Le.parentNode,!Le)return;function Ge(je,xe){var pe=xe?je.cloneNode(!1):je,be=je.parentNode;if(be){var te=Ge(be,1),de=je.nextSibling;te.appendChild(pe);for(var he=de;he;he=de)de=he.nextSibling,te.appendChild(he)}return pe}for(var Ke=Ge(Le.nextSibling,0),Me;(Me=Ke.parentNode)&&Me.nodeType===1;)Ke=Me;qe.push(Ke)}for(var rt=0;rt<qe.length;++rt)Je(qe[rt]);Re===(Re|0)&&qe[0].setAttribute("value",Re);var ht=Fe.createElement("ol");ht.className="linenums";for(var ft=Math.max(0,Re-1|0)||0,rt=0,ke=qe.length;rt<ke;++rt)Ne=qe[rt],Ne.className="L"+(rt+ft)%10,Ne.firstChild||Ne.appendChild(Fe.createTextNode("\xA0")),ht.appendChild(Ne);Ee.appendChild(ht)}function ne(Ee){var Re=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Re=Re&&+Re[1]<=8;var Pe=/\n/g,Ue=Ee.sourceCode,He=Ue.length,Fe=0,Ne=Ee.spans,qe=Ne.length,Je=0,it=Ee.decorations,rt=it.length,ht=0;it[rt]=He;var ft,ke;for(ke=ft=0;ke<rt;)it[ke]!==it[ke+2]?(it[ft++]=it[ke++],it[ft++]=it[ke++]):ke+=2;for(rt=ft,ke=ft=0;ke<rt;){for(var Le=it[ke],Ge=it[ke+1],Ke=ke+2;Ke+2<=rt&&it[Ke+1]===Ge;)Ke+=2;it[ft++]=Le,it[ft++]=Ge,ke=Ke}rt=it.length=ft;var Me=Ee.sourceNode,je="";Me&&(je=Me.style.display,Me.style.display="none");try{for(var xe=null;Je<qe;){var pe=Ne[Je],be=Ne[Je+2]||He,te=it[ht+2]||He,Ke=Math.min(be,te),de=Ne[Je+1],he;if(de.nodeType!==1&&(he=Ue.substring(Fe,Ke))){Re&&(he=he.replace(Pe,"\r")),de.nodeValue=he;var ye=de.ownerDocument,De=ye.createElement("span");De.className=it[ht+1];var we=de.parentNode;we.replaceChild(De,de),De.appendChild(de),Fe<be&&(Ne[Je+1]=de=ye.createTextNode(Ue.substring(Ke,be)),we.insertBefore(de,De.nextSibling))}Fe=Ke,Fe>=be&&(Je+=2),Fe>=te&&(ht+=2)}}finally{Me&&(Me.style.display=je)}}var me={};function ie(Ee,Re){for(var Pe=Re.length;--Pe>=0;){var Ue=Re[Pe];me.hasOwnProperty(Ue)?B.console&&console.warn("cannot override language handler %s",Ue):me[Ue]=Ee}}function le(Ee,Re){return Ee&&me.hasOwnProperty(Ee)||(Ee=/^\s*</.test(Re)?"default-markup":"default-code"),me[Ee]}ie(_e,["default-code"]),ie(ve([],[[i,/^[^<?]+/],[l,/^<!\w[^>]*(?:>|$)/],[x,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[o,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ie(ve([[i,/^[\s]+/,null,` \r
|
|
`],[F,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[g,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[I,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[o,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ie(ve([],[[F,/^[\s\S]+/]]),["uq.val"]),ie(Te({keywords:A,hashComments:!0,cStyleComments:!0,types:v}),["c","cc","cpp","cxx","cyc","m"]),ie(Te({keywords:"null,true,false"}),["json"]),ie(Te({keywords:w,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:v}),["cs"]),ie(Te({keywords:P,cStyleComments:!0}),["java"]),ie(Te({keywords:f,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ie(Te({keywords:s,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ie(Te({keywords:c,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ie(Te({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ie(Te({keywords:b,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ie(Te({keywords:y,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ie(ve([],[[m,/^[\s\S]+/]]),["regex"]);function q(Ee){var Re=Ee.langExtension;try{var Pe=N(Ee.sourceNode,Ee.pre),Ue=Pe.sourceCode;Ee.sourceCode=Ue,Ee.spans=Pe.spans,Ee.basePos=0,le(Re,Ue)(Ee),ne(Ee)}catch(He){B.console&&console.log(He&&He.stack||He)}}function re(Ee,Re,Pe){var Ue=Pe||!1,He=Re||null,Fe=document.createElement("div");Fe.innerHTML="<pre>"+Ee+"</pre>",Fe=Fe.firstChild,Ue&&fe(Fe,Ue,!0);var Ne={langExtension:He,numberLines:Ue,sourceNode:Fe,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return q(Ne),Fe.innerHTML}function oe(Ee,Re){var Pe=Re||document.body,Ue=Pe.ownerDocument||document;function He(pe){return Pe.getElementsByTagName(pe)}for(var Fe=[He("pre"),He("code"),He("xmp")],Ne=[],qe=0;qe<Fe.length;++qe)for(var Je=0,it=Fe[qe].length;Je<it;++Je)Ne.push(Fe[qe][Je]);Fe=null;var rt=Date;rt.now||(rt={now:function(){return+new Date}});var ht=0,ft=/\blang(?:uage)?-([\w.]+)(?!\S)/,ke=/\bprettyprint\b/,Le=/\bprettyprinted\b/,Ge=/pre|xmp/i,Ke=/^code$/i,Me=/^(?:pre|code|xmp)$/i,je={};function xe(){for(var pe=B.PR_SHOULD_USE_CONTINUATION?rt.now()+250:Infinity;ht<Ne.length&&rt.now()<pe;ht++){for(var be=Ne[ht],te=je,de=be;de=de.previousSibling;){var he=de.nodeType,ye=(he===7||he===8)&&de.nodeValue;if(ye?!/^\??prettify\b/.test(ye):he!==3||/\S/.test(de.nodeValue))break;if(ye){te={},ye.replace(/\b(\w+)=([\w:.%+-]+)/g,function(kt,Et,Mt){te[Et]=Mt});break}}var De=be.className;if((te!==je||ke.test(De))&&!Le.test(De)){for(var we=!1,We=be.parentNode;We;We=We.parentNode){var Qe=We.tagName;if(Me.test(Qe)&&We.className&&ke.test(We.className)){we=!0;break}}if(!we){be.className+=" prettyprinted";var nt=te.lang;if(!nt){nt=De.match(ft);var Ve;!nt&&(Ve=ue(be))&&Ke.test(Ve.tagName)&&(nt=Ve.className.match(ft)),nt&&(nt=nt[1])}var dt;if(Ge.test(be.tagName))dt=1;else{var ct=be.currentStyle,at=Ue.defaultView,Dt=ct?ct.whiteSpace:at&&at.getComputedStyle?at.getComputedStyle(be,null).getPropertyValue("white-space"):0;dt=Dt&&Dt.substring(0,3)==="pre"}var wt=te.linenums;(wt=wt==="true"||+wt)||(wt=De.match(/\blinenums\b(?::(\d+))?/),wt=wt?wt[1]&&wt[1].length?+wt[1]:!0:!1),wt&&fe(be,wt,dt);var xt={langExtension:nt,sourceNode:be,numberLines:wt,pre:dt,sourceCode:null,basePos:null,spans:null,decorations:null};q(xt)}}}ht<Ne.length?B.setTimeout(xe,250):typeof Ee=="function"&&Ee()}xe()}var ge=B.PR={createSimpleLexer:ve,registerLangHandler:ie,sourceDecorator:Te,PR_ATTRIB_NAME:I,PR_ATTRIB_VALUE:F,PR_COMMENT:x,PR_DECLARATION:l,PR_KEYWORD:_,PR_LITERAL:h,PR_NOCODE:W,PR_PLAIN:i,PR_PUNCTUATION:o,PR_SOURCE:T,PR_STRING:m,PR_TAG:g,PR_TYPE:d,prettyPrintOne:R?B.prettyPrintOne=re:O=re,prettyPrint:j=R?B.prettyPrint=oe:j=oe},Se=B.define;typeof Se=="function"&&Se.amd&&Se("google-code-prettify",[],function(){return ge})})()},T1X5:function(gt,ze){gt.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGwAAABsCAYAAACPZlfNAAALdklEQVR4Xu2dC2wc1RVAzx1nDXFiO4SEhqxtxS0JHzX94TS0FEKLALX8WkKbqrRVKQrh15Zfq0IqIaSGSOXb8ktANFJbKqUFWigEAUohfFRQDC1KxS8UR/7wDbZ3TRxix3urN951No7Xnt15M7Mbz0hRImXevffds/PmzXv33StU0KWqTlcfh6mwkCHmq8M8B5oUZosyS6EeOCD7x/Rsl/kjkFJhu8AHGWiXDNuoYqsoW5K1vCkimUpxg5SzoW+r1gylOUGErygci9IC1Fi2uR+hVeA5VZ6tquOpuSL9lnVYE1d2wNo+0jnVylLNcKYKx6EcaK23XgQJH4vyjDg8OCDc3zxd3vXSLKx7ygJYW5seOGUmZ6GcJ8IShaqwHDCeHoEhVTYh3LO7mweam+XjqO2KFNjWPp09VblUlQuAmVE7YwL93SKs2SncMr9WPojK1kiAdWzXpCa40oHlCtOi6nwpegV2ZOBuGeSGxlnSVYoMP21CBfZmnx5SneFagXPzZnJ+7I+y7S6FdQMO1xxWK++HZUgowNzpeIoVKqwCDgqrcyHp6RFlZbKetWF8HgQOrD2liwTuAHdKvj9frVVTuHDuNGkNspOBAWtt1cShC1ilcLlqecz6gnSkkS3CkMBN77zBypYWGQxCXyDAuvq1KTPIeuCYIIyuAJnPOwmWJWuk3bat1oF1pfWMjLKuAqbptn05Wl63I5ybrJOHbCqyCqw9ratEucqMDjaNrGBZqsLqpjpZaasPVhyrqlVdKe5Wcafr8TXKA6KsS9azXESG/DrHN7CODp0qdaxXON2vMftze4F/aJpljY2y008/fQFr69EZCYeH3ZX0+JrQA2ZHYDDDac0HSe+ENxe4oWRg2SfriRhWca53t3HSnFTqk1YSMPedleZv8TBYHKzc3WZ4TNbxrVLeaSUB6+zV38cTjNJgjUBT1jXMkB8XK6VoYNmp+9XFKorv39cDKlxX7JS/KGDZj+K/x99Z1n5+6gjfLObj2jOw7HLTv+MVDGuwcoK6nQSf97qM5QmYWcj9xHyensRrg9YpjRL4/HtbOd7LgrEnYF1p/U1G+XnQVk9m+Y5wfbJOfjGRDyYEZvazHOFfk2WLZCKHBfX/Zmsmo3ypqV42j6djXGBmp7gzzQuTYPMxKA7Fym1tqGPxeDvX4wLr7NULVdzd4vgKyQOiXNQwQ+4spK4gMBMwc0CG1/bDGIyQXF+ymp5dDkcUCuwpCKwzpXcqbrxgfIXsAYU1TfVy4VhqxwRm4gZJ8L/9IBQtZFdbU7eLQT41VtzjmMDaU3qzwKXW1MeCivaAwi1N9XLZ6Ib7AHPDpzO0hRmR+/L78Ict8J93IT1QdN+sN6irhs/NgR8uhM8eYl28J4EmwninQ/PosPB9gHWmdZUqoS3u/uUVuPEFKMcDWg5wxWL4zlGefGz9JhGuaxgVD7IXsOwpEhMvHsrBBPNknf9IecLKed9Au+vUyJ607t3dJPNPzewFrCOl3wPutf5TKSDwio3wdF7k3imfhMNnugGZkV2q8Ho3PPbWHhOOb4IbT4zMpHMa6+XPOe17A+vVjQhfC8u0E+/d884ysH69JCzNE+v51aY90Mw7beM5E7cJ5A7ln40zZOTnMgLMnHxMDNEZ5mG6RSbcNHv9tAV+sDCQLpck9I9b4Hd5UfKbIwrgM4cKB6toyJ0EHQHWkdJLgFtL6l2JjfKB/WwRfP/TJQoKoNmf/gu/zVuGjQqY6ZrjcEmyVm43/x4B1pnSxxVOCqDvBUXGwLx5W+CJhno5eQSYe1q/jw/DPgAeA/MGDOHjqloONtkN3CesI6XfAB7x2NzabV6B3fca3LoZ+ndbU+0KmpaAn7TA0iP2lVtOQ2LWulMb62WDC6wzrdfp8CGGUC+vwL56L3wU0ArI9Gp4cowZYLkBE2F1Q51cPfyEpXUTyvGh0gK8ArvgUXgxoGwZX5gDa79eAU+Y8HRjnSyR7K5yXwAZZibk7xXYjkHY2Abmb5uXGRJPnAfTqisAGPQ31FErnWldoMrrNh3hVZZXYF7l2byv3IZEd4YoHC4dfbqUDPfZ7KxXWTEwr57K3udwtnT06i8RVhfZ1MrtMbAi3ahcJe1pXSPKiiKbWrk9BlacG1VYa95hG1QZY55UnLBS7vYK7JXtwxuc/ZYnHTWJ4U3Ko2ZVxKTDvMMelY60bs7mISzF577aeAV25l/h7Y98qSrYeO50ePDblQHMzevYmVITDjAvGHeMLzUGVpzXBbZJR0p7gBnFNbVzt1dgr+aGRMtLUzVThofEI8cYEh9/C1ZuGu7n7BrYsMxOn31K6TXAdkTx0WwM9wrMZydLaj6UgTtegje64UefgaPnlCTGdqN+A8z8biPJAFrOwGx72pK8oRiYJU+GJMYFFg+JIXnbghp3SOyO6sCD1yFxxwBs3BbA4m91dvE3YcGV4YjoqYhp/YpH4aWAtlfMZGJNJMsGxRMentZXwIdzFBuYxbszhBbuh3MFLE25IQKtwSxNmRCBs8cIEQjB/UWrcJem4sXfvf32Qhdc8jjcdjIsThbt00AbuIu/8fZK5QDDbK/EG5gVBMxsYMYhApUDzA0RqIQgnEBfDKOEl/E7bDgIx9hb7mFuMTA3qH44zM04o9wDSWNgbsRUXiBpmYdq2wZmhr1C16sfwu0vwsVHw5EHF74vgin/nlDtcjgMEeb5sPw1zFJ/DKEePxp9GMIdFiM4bhTVCUyvT9gR4zxhx4T4Ub3PcSMDrKtPL85kuK3UX1wp7fyccTaHGE5uBhP5ZPMqx1nimAf6ojgy+/J7cP6G0rMILJ4Lt51iExeUG7CCR2bd6X3Ih9KNTj95OmZOhce+u38Do9ChdBdYyGkfcq4uJRPO9ARc9kU4Y8F+DgwKp30IO7GKXVfbkVZmQ+L4iVWyH9Ghpi6y42Z7UsoJ2ISpi0y3o0gOZs/d/iWVCzDPycFMl+P0e/7B+5XgOf2eO/mIE1z69bff9sUluMw+ZXdKnELWr+NLal90ClmjJU7SXJKvbTQqLUmzO2OM06DbAFCUjJLToBstcaGBonxt42Z/hQay77K4lIcNFBPIsFLKI6cjLpYTBjGub7RRLMeYGpejChyY3XJUxty44Ftg0OwXfMsbGs/IKHFJRXvsgiupmLMxLlpqkVbQRUtzpsZlgf1Dk7DKAme/z+LC2z6YhV54210g7tCpUkdc2r5IcJGUts/Z2NajMxIODyscW6Tdk/J2A2sww2nNB0lvqQ7wXTQj+6StVzi9VCMmQzszDGqaZY2NstNPf30DM8qfVJ0yP8VdKkRUP8GPC4JvayYYyXqWi8iQX21WgI2a8pvs3Fbl+u1khO1VhdVNo0pK+bHHumO70mo+rk1VlVBKWvnpfMBtux3h3GSdPGRTj3VgectY64FjbBpbQbKedxIsS9ZIXrEtO9YHAsyYZhaMD13AKoXLJ0uVdbNFInDTO2+wsqVFLOdPHQYeGLCR91pKFwlu8e4WO7+xspXSqnDRRKXp/VofODBjoNm57kqxQoVVUeW18uuocdr3iLIyWc/a8UrS29IfCrCcsSawpzrDtYI7/T/AVicikrNLYd2AwzWFqpoHYVeowHIdMHGPmuBKB5aHWX7YhgNNRG4G7pZBbhirMLYNHePJiARYziA3LFy5VJULKuAzoFuENTuFW0bXVg4aUr78SIHlDMmemjkL5TwRloRZh3OCX/OQKpsQ7tndzQP55XnDhFR2wPINMidBq5WlmuFMFY4Lu2qgqYYnyjPi8OCAcH+uWGhUgEbrLYsnrJAz3OwGaU5AOQ6HL2cLItRYdl6/m8AfnlPl2ao6njKlCy3rsCaurIGN7qX7edDHYSosZIj56jDPgSaF2aLM0uH8+6YaWG4GugsYEOhVYbvABxlolwzbqGKrKFuStbwZxnTcFrH/A8wNv8JI/KKJAAAAAElFTkSuQmCC"},"VrN/":function(gt,ze,Y){(function(ce,X){gt.exports=X()})(this,function(){"use strict";var ce=navigator.userAgent,X=navigator.platform,R=/gecko\/\d/i.test(ce),Z=/MSIE \d/.test(ce),U=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ce),O=/Edge\/(\d+)/.exec(ce),j=Z||U||O,B=j&&(Z?document.documentMode||6:+(O||U)[1]),k=!O&&/WebKit\//.test(ce),D=k&&/Qt\/\d+\.\d+/.test(ce),E=!O&&/Chrome\//.test(ce),A=/Opera\//.test(ce),P=/Apple Computer/.test(navigator.vendor),w=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ce),y=/PhantomJS/.test(ce),b=!O&&/AppleWebKit/.test(ce)&&/Mobile\/\w+/.test(ce),c=/Android/.test(ce),s=b||c||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ce),u=b||/Mac/.test(X),f=/\bCrOS\b/.test(ce),C=/win/i.test(X),v=A&&ce.match(/Version\/(\d*\.\d*)/);v&&(v=Number(v[1])),v&&v>=15&&(A=!1,k=!0);var m=u&&(D||A&&(v==null||v<12.11)),_=R||j&&B>=9;function x(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var d=function(e,t){var n=e.className,r=x(t).exec(n);if(r){var a=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(a?r[1]+a:"")}};function h(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function o(e,t){return h(e).appendChild(t)}function i(e,t,n,r){var a=document.createElement(e);if(n&&(a.className=n),r&&(a.style.cssText=r),typeof t=="string")a.appendChild(document.createTextNode(t));else if(t)for(var L=0;L<t.length;++L)a.appendChild(t[L]);return a}function g(e,t,n,r){var a=i(e,t,n,r);return a.setAttribute("role","presentation"),a}var l;document.createRange?l=function(e,t,n,r){var a=document.createRange();return a.setEnd(r||e,n),a.setStart(e,t),a}:l=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(a){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 I(){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 F(e,t){var n=e.className;x(t).test(n)||(e.className+=(n?" ":"")+t)}function W(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!x(n[r]).test(t)&&(t+=" "+n[r]);return t}var V=function(e){e.select()};b?V=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:j&&(V=function(e){try{e.select()}catch(t){}});function M(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function N(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 J(e,t,n,r,a){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var L=r||0,z=a||0;;){var Q=e.indexOf(" ",L);if(Q<0||Q>=t)return z+(t-L);z+=Q-L,z+=n-z%n,L=Q+1}}var ae=function(){this.id=null,this.f=null,this.time=0,this.handler=M(this.onTimeout,this)};ae.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ae.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 ue(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var ve=50,Te={toString:function(){return"CodeMirror.Pass"}},_e={scroll:!1},fe={origin:"*mouse"},ne={origin:"+move"};function me(e,t,n){for(var r=0,a=0;;){var L=e.indexOf(" ",r);L==-1&&(L=e.length);var z=L-r;if(L==e.length||a+z>=t)return r+Math.min(z,t-a);if(a+=L-r,a+=n-a%n,r=L+1,a>=t)return r}}var ie=[""];function le(e){for(;ie.length<=e;)ie.push(q(ie)+" ");return ie[e]}function q(e){return e[e.length-1]}function re(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function oe(e,t,n){for(var r=0,a=n(t);r<e.length&&n(e[r])<=a;)r++;e.splice(r,0,t)}function ge(){}function Se(e,t){var n;return Object.create?n=Object.create(e):(ge.prototype=e,n=new ge),t&&N(t,n),n}var Ee=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Re(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Ee.test(e))}function Pe(e,t){return t?t.source.indexOf("\\w")>-1&&Re(e)?!0:t.test(e):Re(e)}function Ue(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var He=/[\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 Fe(e){return e.charCodeAt(0)>=768&&He.test(e)}function Ne(e,t,n){for(;(n<0?t>0:t<e.length)&&Fe(e.charAt(t));)t+=n;return t}function qe(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var a=(t+n)/2,L=r<0?Math.ceil(a):Math.floor(a);if(L==t)return e(L)?t:n;e(L)?n=L:t=L+r}}function Je(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var a=!1,L=0;L<e.length;++L){var z=e[L];(z.from<n&&z.to>t||t==n&&z.to==t)&&(r(Math.max(z.from,t),Math.min(z.to,n),z.level==1?"rtl":"ltr",L),a=!0)}a||r(t,n,"ltr")}var it=null;function rt(e,t,n){var r;it=null;for(var a=0;a<e.length;++a){var L=e[a];if(L.from<t&&L.to>t)return a;L.to==t&&(L.from!=L.to&&n=="before"?r=a:it=a),L.from==t&&(L.from!=L.to&&n!="before"?r=a:it=a)}return r!=null?r:it}var ht=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(se){return se<=247?e.charAt(se):1424<=se&&se<=1524?"R":1536<=se&&se<=1785?t.charAt(se-1536):1774<=se&&se<=2220?"r":8192<=se&&se<=8203?"w":se==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,a=/[stwN]/,L=/[LRr]/,z=/[Lb1n]/,Q=/[1n]/;function ee(se,Ce,Oe){this.level=se,this.from=Ce,this.to=Oe}return function(se,Ce){var Oe=Ce=="ltr"?"L":"R";if(se.length==0||Ce=="ltr"&&!r.test(se))return!1;for(var Be=se.length,Ie=[],Ye=0;Ye<Be;++Ye)Ie.push(n(se.charCodeAt(Ye)));for(var tt=0,mt=Oe;tt<Be;++tt){var vt=Ie[tt];vt=="m"?Ie[tt]=mt:mt=vt}for(var At=0,yt=Oe;At<Be;++At){var Lt=Ie[At];Lt=="1"&&yt=="r"?Ie[At]="n":L.test(Lt)&&(yt=Lt,Lt=="r"&&(Ie[At]="R"))}for(var Kt=1,Ft=Ie[0];Kt<Be-1;++Kt){var rr=Ie[Kt];rr=="+"&&Ft=="1"&&Ie[Kt+1]=="1"?Ie[Kt]="1":rr==","&&Ft==Ie[Kt+1]&&(Ft=="1"||Ft=="n")&&(Ie[Kt]=Ft),Ft=rr}for(var Ar=0;Ar<Be;++Ar){var Gr=Ie[Ar];if(Gr==",")Ie[Ar]="N";else if(Gr=="%"){var kr=void 0;for(kr=Ar+1;kr<Be&&Ie[kr]=="%";++kr);for(var yn=Ar&&Ie[Ar-1]=="!"||kr<Be&&Ie[kr]=="1"?"1":"N",un=Ar;un<kr;++un)Ie[un]=yn;Ar=kr-1}}for(var Ur=0,dn=Oe;Ur<Be;++Ur){var $r=Ie[Ur];dn=="L"&&$r=="1"?Ie[Ur]="L":L.test($r)&&(dn=$r)}for(var jr=0;jr<Be;++jr)if(a.test(Ie[jr])){var Br=void 0;for(Br=jr+1;Br<Be&&a.test(Ie[Br]);++Br);for(var Pr=(jr?Ie[jr-1]:Oe)=="L",cn=(Br<Be?Ie[Br]:Oe)=="L",Ei=Pr==cn?Pr?"L":"R":Oe,Vn=jr;Vn<Br;++Vn)Ie[Vn]=Ei;jr=Br-1}for(var qr=[],Dn,Vr=0;Vr<Be;)if(z.test(Ie[Vr])){var qa=Vr;for(++Vr;Vr<Be&&z.test(Ie[Vr]);++Vr);qr.push(new ee(0,qa,Vr))}else{var Mn=Vr,ri=qr.length,ni=Ce=="rtl"?1:0;for(++Vr;Vr<Be&&Ie[Vr]!="L";++Vr);for(var an=Mn;an<Vr;)if(Q.test(Ie[an])){Mn<an&&(qr.splice(ri,0,new ee(1,Mn,an)),ri+=ni);var xi=an;for(++an;an<Vr&&Q.test(Ie[an]);++an);qr.splice(ri,0,new ee(2,xi,an)),ri+=ni,Mn=an}else++an;Mn<Vr&&qr.splice(ri,0,new ee(1,Mn,Vr))}return Ce=="ltr"&&(qr[0].level==1&&(Dn=se.match(/^\s+/))&&(qr[0].from=Dn[0].length,qr.unshift(new ee(0,0,Dn[0].length))),q(qr).level==1&&(Dn=se.match(/\s+$/))&&(q(qr).to-=Dn[0].length,qr.push(new ee(0,Be-Dn[0].length,Be)))),Ce=="rtl"?qr.reverse():qr}}();function ft(e,t){var n=e.order;return n==null&&(n=e.order=ht(e.text,t)),n}var ke=[],Le=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]||ke).concat(n)}};function Ge(e,t){return e._handlers&&e._handlers[t]||ke}function Ke(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,a=r&&r[t];if(a){var L=ue(a,n);L>-1&&(r[t]=a.slice(0,L).concat(a.slice(L+1)))}}}function Me(e,t){var n=Ge(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),a=0;a<n.length;++a)n[a].apply(null,r)}function je(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Me(e,n||t.type,e,t),he(t)||t.codemirrorIgnore}function xe(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)ue(n,t[r])==-1&&n.push(t[r])}function pe(e,t){return Ge(e,t).length>0}function be(e){e.prototype.on=function(t,n){Le(this,t,n)},e.prototype.off=function(t,n){Ke(this,t,n)}}function te(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function de(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function he(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ye(e){te(e),de(e)}function De(e){return e.target||e.srcElement}function we(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),u&&e.ctrlKey&&t==1&&(t=3),t}var We=function(){if(j&&B<9)return!1;var e=i("div");return"draggable"in e||"dragDrop"in e}(),Qe;function nt(e){if(Qe==null){var t=i("span","\u200B");o(e,i("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Qe=t.offsetWidth<=1&&t.offsetHeight>2&&!(j&&B<8))}var n=Qe?i("span","\u200B"):i("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var Ve;function dt(e){if(Ve!=null)return Ve;var t=o(e,document.createTextNode("A\u062EA")),n=l(t,0,1).getBoundingClientRect(),r=l(t,1,2).getBoundingClientRect();return h(e),!n||n.left==n.right?!1:Ve=r.right-n.right<3}var ct=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var a=e.indexOf(`
|
|
`,t);a==-1&&(a=e.length);var L=e.slice(t,e.charAt(a-1)=="\r"?a-1:a),z=L.indexOf("\r");z!=-1?(n.push(L.slice(0,z)),t+=z+1):(n.push(L),t=a+1)}return n}:function(e){return e.split(/\r\n?|\n/)},at=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Dt=function(){var e=i("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),wt=null;function xt(e){if(wt!=null)return wt;var t=o(e,i("span","x")),n=t.getBoundingClientRect(),r=l(t,0,1).getBoundingClientRect();return wt=Math.abs(n.left-r.left)>1}var kt={},Et={};function Mt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),kt[e]=t}function Rt(e,t){Et[e]=t}function Xe(e){if(typeof e=="string"&&Et.hasOwnProperty(e))e=Et[e];else if(e&&typeof e.name=="string"&&Et.hasOwnProperty(e.name)){var t=Et[e.name];typeof t=="string"&&(t={name:t}),e=Se(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Xe("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Xe("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function bt(e,t){t=Xe(t);var n=kt[t.name];if(!n)return bt(e,"text/plain");var r=n(e,t);if(ot.hasOwnProperty(t.name)){var a=ot[t.name];for(var L in a){if(!a.hasOwnProperty(L))continue;r.hasOwnProperty(L)&&(r["_"+L]=r[L]),r[L]=a[L]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var z in t.modeProps)r[z]=t.modeProps[z];return r}var ot={};function lt(e,t){var n=ot.hasOwnProperty(e)?ot[e]:ot[e]={};N(t,n)}function st(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var a=t[r];a instanceof Array&&(a=a.concat([])),n[r]=a}return n}function zt(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 Wt(e,t,n){return e.startState?e.startState(t,n):!0}var St=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};St.prototype.eol=function(){return this.pos>=this.string.length},St.prototype.sol=function(){return this.pos==this.lineStart},St.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},St.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},St.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},St.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},St.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},St.prototype.skipToEnd=function(){this.pos=this.string.length},St.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},St.prototype.backUp=function(e){this.pos-=e},St.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=J(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?J(this.string,this.lineStart,this.tabSize):0)},St.prototype.indentation=function(){return J(this.string,null,this.tabSize)-(this.lineStart?J(this.string,this.lineStart,this.tabSize):0)},St.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(z){return n?z.toLowerCase():z},a=this.string.substr(this.pos,e.length);if(r(a)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var L=this.string.slice(this.pos).match(e);return L&&L.index>0?null:(L&&t!==!1&&(this.pos+=L[0].length),L)}},St.prototype.current=function(){return this.string.slice(this.start,this.pos)},St.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},St.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},St.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ut(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 a=n.children[r],L=a.chunkSize();if(t<L){n=a;break}t-=L}return n.lines[t]}function or(e,t,n){var r=[],a=t.line;return e.iter(t.line,n.line+1,function(L){var z=L.text;a==n.line&&(z=z.slice(0,n.ch)),a==t.line&&(z=z.slice(t.ch)),r.push(z),++a}),r}function $t(e,t,n){var r=[];return e.iter(t,n,function(a){r.push(a.text)}),r}function Tt(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Ot(e){if(e.parent==null)return null;for(var t=e.parent,n=ue(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var a=0;!(r.children[a]==t);++a)n+=r.children[a].chunkSize();return n+t.first}function Gt(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var a=e.children[r],L=a.height;if(t<L){e=a;continue e}t-=L,n+=a.chunkSize()}return n}while(!e.lines);for(var z=0;z<e.lines.length;++z){var Q=e.lines[z],ee=Q.height;if(t<ee)break;t-=ee}return n+z}function ir(e,t){return t>=e.first&&t<e.first+e.size}function Dr(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function et(e,t,n){if(n===void 0&&(n=null),!(this instanceof et))return new et(e,t,n);this.line=e,this.ch=t,this.sticky=n}function Ct(e,t){return e.line-t.line||e.ch-t.ch}function Ut(e,t){return e.sticky==t.sticky&&Ct(e,t)==0}function nr(e){return et(e.line,e.ch)}function mr(e,t){return Ct(e,t)<0?t:e}function Cr(e,t){return Ct(e,t)<0?e:t}function H(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function p(e,t){if(t.line<e.first)return et(e.first,0);var n=e.first+e.size-1;return t.line>n?et(n,ut(e,n).text.length):S(t,ut(e,t.line).text.length)}function S(e,t){var n=e.ch;return n==null||n>t?et(e.line,t):n<0?et(e.line,0):e}function K(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=p(e,t[r]);return n}var $=function(e,t){this.state=e,this.lookAhead=t},G=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};G.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},G.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},G.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},G.fromSaved=function(e,t,n){return t instanceof $?new G(e,st(e.mode,t.state),n,t.lookAhead):new G(e,st(e.mode,t),n)},G.prototype.save=function(e){var t=e!==!1?st(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new $(t,this.maxLookAhead):t};function Ae(e,t,n,r){var a=[e.state.modeGen],L={};Hr(e,t.text,e.doc.mode,n,function(se,Ce){return a.push(se,Ce)},L,r);for(var z=n.state,Q=function(se){n.baseTokens=a;var Ce=e.state.overlays[se],Oe=1,Be=0;n.state=!0,Hr(e,t.text,Ce.mode,n,function(Ie,Ye){for(var tt=Oe;Be<Ie;){var mt=a[Oe];mt>Ie&&a.splice(Oe,1,Ie,a[Oe+1],mt),Oe+=2,Be=Math.min(Ie,mt)}if(!Ye)return;if(Ce.opaque)a.splice(tt,Oe-tt,Ie,"overlay "+Ye),Oe=tt+2;else for(;tt<Oe;tt+=2){var vt=a[tt+1];a[tt+1]=(vt?vt+" ":"")+"overlay "+Ye}},L),n.state=z,n.baseTokens=null,n.baseTokenPos=1},ee=0;ee<e.state.overlays.length;++ee)Q(ee);return{styles:a,classes:L.bgClass||L.textClass?L:null}}function $e(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=pt(e,Ot(t)),a=t.text.length>e.options.maxHighlightLength&&st(e.doc.mode,r.state),L=Ae(e,t,r);a&&(r.state=a),t.stateAfter=r.save(!a),t.styles=L.styles,L.classes?t.styleClasses=L.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 pt(e,t,n){var r=e.doc,a=e.display;if(!r.mode.startState)return new G(r,!0,t);var L=br(e,t,n),z=L>r.first&&ut(r,L-1).stateAfter,Q=z?G.fromSaved(r,z,L):new G(r,Wt(r.mode),L);return r.iter(L,t,function(ee){_t(e,ee.text,Q);var se=Q.line;ee.stateAfter=se==t-1||se%5==0||se>=a.viewFrom&&se<a.viewTo?Q.save():null,Q.nextLine()}),n&&(r.modeFrontier=Q.line),Q}function _t(e,t,n,r){var a=e.doc.mode,L=new St(t,e.options.tabSize,n);for(L.start=L.pos=r||0,t==""&&Ze(a,n.state);!L.eol();)Bt(a,L,n.state),L.start=L.pos}function Ze(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=zt(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function Bt(e,t,n,r){for(var a=0;a<10;a++){r&&(r[0]=zt(e,n).mode);var L=e.token(t,n);if(t.pos>t.start)return L}throw new Error("Mode "+e.name+" failed to advance stream.")}var It=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function hr(e,t,n,r){var a=e.doc,L=a.mode,z;t=p(a,t);var Q=ut(a,t.line),ee=pt(e,t.line,n),se=new St(Q.text,e.options.tabSize,ee),Ce;for(r&&(Ce=[]);(r||se.pos<t.ch)&&!se.eol();)se.start=se.pos,z=Bt(L,se,ee.state),r&&Ce.push(new It(se,z,st(a.mode,ee.state)));return r?Ce:new It(se,z,ee.state)}function Wr(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 Hr(e,t,n,r,a,L,z){var Q=n.flattenSpans;Q==null&&(Q=e.options.flattenSpans);var ee=0,se=null,Ce=new St(t,e.options.tabSize,r),Oe,Be=e.options.addModeClass&&[null];for(t==""&&Wr(Ze(n,r.state),L);!Ce.eol();){if(Ce.pos>e.options.maxHighlightLength?(Q=!1,z&&_t(e,t,r,Ce.pos),Ce.pos=t.length,Oe=null):Oe=Wr(Bt(n,Ce,r.state,Be),L),Be){var Ie=Be[0].name;Ie&&(Oe="m-"+(Oe?Ie+" "+Oe:Ie))}if(!Q||se!=Oe){for(;ee<Ce.start;)ee=Math.min(Ce.start,ee+5e3),a(ee,se);se=Oe}Ce.start=Ce.pos}for(;ee<Ce.pos;){var Ye=Math.min(Ce.pos,ee+5e3);a(Ye,se),ee=Ye}}function br(e,t,n){for(var r,a,L=e.doc,z=n?-1:t-(e.doc.mode.innerMode?1e3:100),Q=t;Q>z;--Q){if(Q<=L.first)return L.first;var ee=ut(L,Q-1),se=ee.stateAfter;if(se&&(!n||Q+(se instanceof $?se.lookAhead:0)<=L.modeFrontier))return Q;var Ce=J(ee.text,null,e.options.tabSize);(a==null||r>Ce)&&(a=Q-1,r=Ce)}return a}function Jr(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 a=ut(e,r).stateAfter;if(a&&(!(a instanceof $)||r+a.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Sn=!1,Fr=!1;function Jt(){Sn=!0}function jt(){Fr=!0}function Xt(e,t,n){this.marker=e,this.from=t,this.to=n}function Zt(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function sr(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function qt(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Sr(e,t,n){var r;if(e)for(var a=0;a<e.length;++a){var L=e[a],z=L.marker,Q=L.from==null||(z.inclusiveLeft?L.from<=t:L.from<t);if(Q||L.from==t&&z.type=="bookmark"&&(!n||!L.marker.insertLeft)){var ee=L.to==null||(z.inclusiveRight?L.to>=t:L.to>t);(r||(r=[])).push(new Xt(z,L.from,ee?null:L.to))}}return r}function Ir(e,t,n){var r;if(e)for(var a=0;a<e.length;++a){var L=e[a],z=L.marker,Q=L.to==null||(z.inclusiveRight?L.to>=t:L.to>t);if(Q||L.from==t&&z.type=="bookmark"&&(!n||L.marker.insertLeft)){var ee=L.from==null||(z.inclusiveLeft?L.from<=t:L.from<t);(r||(r=[])).push(new Xt(z,ee?null:L.from-t,L.to==null?null:L.to-t))}}return r}function Or(e,t){if(t.full)return null;var n=ir(e,t.from.line)&&ut(e,t.from.line).markedSpans,r=ir(e,t.to.line)&&ut(e,t.to.line).markedSpans;if(!n&&!r)return null;var a=t.from.ch,L=t.to.ch,z=Ct(t.from,t.to)==0,Q=Sr(n,a,z),ee=Ir(r,L,z),se=t.text.length==1,Ce=q(t.text).length+(se?a:0);if(Q)for(var Oe=0;Oe<Q.length;++Oe){var Be=Q[Oe];if(Be.to==null){var Ie=Zt(ee,Be.marker);Ie?se&&(Be.to=Ie.to==null?null:Ie.to+Ce):Be.to=a}}if(ee)for(var Ye=0;Ye<ee.length;++Ye){var tt=ee[Ye];if(tt.to!=null&&(tt.to+=Ce),tt.from==null){var mt=Zt(Q,tt.marker);mt||(tt.from=Ce,se&&(Q||(Q=[])).push(tt))}else tt.from+=Ce,se&&(Q||(Q=[])).push(tt)}Q&&(Q=wr(Q)),ee&&ee!=Q&&(ee=wr(ee));var vt=[Q];if(!se){var At=t.text.length-2,yt;if(At>0&&Q)for(var Lt=0;Lt<Q.length;++Lt)Q[Lt].to==null&&(yt||(yt=[])).push(new Xt(Q[Lt].marker,null,null));for(var Kt=0;Kt<At;++Kt)vt.push(yt);vt.push(ee)}return vt}function wr(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 Zr(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(Ie){if(Ie.markedSpans)for(var Ye=0;Ye<Ie.markedSpans.length;++Ye){var tt=Ie.markedSpans[Ye].marker;tt.readOnly&&(!r||ue(r,tt)==-1)&&(r||(r=[])).push(tt)}}),!r)return null;for(var a=[{from:t,to:n}],L=0;L<r.length;++L)for(var z=r[L],Q=z.find(0),ee=0;ee<a.length;++ee){var se=a[ee];if(Ct(se.to,Q.from)<0||Ct(se.from,Q.to)>0)continue;var Ce=[ee,1],Oe=Ct(se.from,Q.from),Be=Ct(se.to,Q.to);(Oe<0||!z.inclusiveLeft&&!Oe)&&Ce.push({from:se.from,to:Q.from}),(Be>0||!z.inclusiveRight&&!Be)&&Ce.push({from:Q.to,to:se.to}),a.splice.apply(a,Ce),ee+=Ce.length-3}return a}function on(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 hn(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function lr(e){return e.inclusiveLeft?-1:0}function Yt(e){return e.inclusiveRight?1:0}function Tr(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),a=t.find(),L=Ct(r.from,a.from)||lr(e)-lr(t);if(L)return-L;var z=Ct(r.to,a.to)||Yt(e)-Yt(t);return z||t.id-e.id}function tr(e,t){var n=Fr&&e.markedSpans,r;if(n)for(var a=void 0,L=0;L<n.length;++L)a=n[L],a.marker.collapsed&&(t?a.from:a.to)==null&&(!r||Tr(r,a.marker)<0)&&(r=a.marker);return r}function Er(e){return tr(e,!0)}function Vt(e){return tr(e,!1)}function en(e,t){var n=Fr&&e.markedSpans,r;if(n)for(var a=0;a<n.length;++a){var L=n[a];L.marker.collapsed&&(L.from==null||L.from<t)&&(L.to==null||L.to>t)&&(!r||Tr(r,L.marker)<0)&&(r=L.marker)}return r}function _r(e,t,n,r,a){var L=ut(e,t),z=Fr&&L.markedSpans;if(z)for(var Q=0;Q<z.length;++Q){var ee=z[Q];if(!ee.marker.collapsed)continue;var se=ee.marker.find(0),Ce=Ct(se.from,n)||lr(ee.marker)-lr(a),Oe=Ct(se.to,r)||Yt(ee.marker)-Yt(a);if(Ce>=0&&Oe<=0||Ce<=0&&Oe>=0)continue;if(Ce<=0&&(ee.marker.inclusiveRight&&a.inclusiveLeft?Ct(se.to,n)>=0:Ct(se.to,n)>0)||Ce>=0&&(ee.marker.inclusiveRight&&a.inclusiveLeft?Ct(se.from,r)<=0:Ct(se.from,r)<0))return!0}}function Xr(e){for(var t;t=Er(e);)e=t.find(-1,!0).line;return e}function vr(e){for(var t;t=Vt(e);)e=t.find(1,!0).line;return e}function bn(e){for(var t,n;t=Vt(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function tn(e,t){var n=ut(e,t),r=Xr(n);return n==r?t:Ot(r)}function Xn(e,t){if(t>e.lastLine())return t;var n=ut(e,t),r;if(!rn(e,n))return t;for(;r=Vt(n);)n=r.find(1,!0).line;return Ot(n)+1}function rn(e,t){var n=Fr&&t.markedSpans;if(n)for(var r=void 0,a=0;a<n.length;++a){if(r=n[a],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&In(e,t,r))return!0}}function In(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return In(e,r.line,Zt(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var a=void 0,L=0;L<t.markedSpans.length;++L)if(a=t.markedSpans[L],a.marker.collapsed&&!a.marker.widgetNode&&a.from==n.to&&(a.to==null||a.to!=n.from)&&(a.marker.inclusiveLeft||n.marker.inclusiveRight)&&In(e,t,a))return!0}function En(e){e=Xr(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var a=n.lines[r];if(a==e)break;t+=a.height}for(var L=n.parent;L;n=L,L=n.parent)for(var z=0;z<L.children.length;++z){var Q=L.children[z];if(Q==n)break;t+=Q.height}return t}function Rn(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Er(r);){var a=n.find(0,!0);r=a.from.line,t+=a.from.ch-a.to.ch}for(r=e;n=Vt(r);){var L=n.find(0,!0);t-=r.text.length-L.from.ch,r=L.to.line,t+=r.text.length-L.to.ch}return t}function Nn(e){var t=e.display,n=e.doc;t.maxLine=ut(n,n.first),t.maxLineLength=Rn(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var a=Rn(r);a>t.maxLineLength&&(t.maxLineLength=a,t.maxLine=r)})}var fn=function(e,t,n){this.text=e,hn(this,t),this.height=n?n(this):1};fn.prototype.lineNo=function(){return Ot(this)},be(fn);function ii(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),on(e),hn(e,n);var a=r?r(e):1;a!=e.height&&Tt(e,a)}function Ci(e){e.parent=null,on(e)}var Pt={},Ht={};function Nt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Ht:Pt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Qt(e,t){var n=g("span",null,null,k?"padding-right: .1px":null),r={pre:g("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var a=0;a<=(t.rest?t.rest.length:0);a++){var L=a?t.rest[a-1]:t.line,z=void 0;r.pos=0,r.addToken=gr,dt(e.display.measure)&&(z=ft(L,e.doc.direction))&&(r.addToken=Rr(r.addToken,z)),r.map=[];var Q=t!=e.display.externalMeasured&&Ot(L);er(L,r,$e(e,L,Q)),L.styleClasses&&(L.styleClasses.bgClass&&(r.bgClass=W(L.styleClasses.bgClass,r.bgClass||"")),L.styleClasses.textClass&&(r.textClass=W(L.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(nt(e.display.measure))),a==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(k){var ee=r.content.lastChild;(/\bcm-tab\b/.test(ee.className)||ee.querySelector&&ee.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Me(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=W(r.pre.className,r.textClass||"")),r}function fr(e){var t=i("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function gr(e,t,n,r,a,L,z){if(!t)return;var Q=e.splitSpaces?ar(t,e.trailingSpace):t,ee=e.cm.state.specialChars,se=!1,Ce;if(!ee.test(t))e.col+=t.length,Ce=document.createTextNode(Q),e.map.push(e.pos,e.pos+t.length,Ce),j&&B<9&&(se=!0),e.pos+=t.length;else{Ce=document.createDocumentFragment();for(var Oe=0;;){ee.lastIndex=Oe;var Be=ee.exec(t),Ie=Be?Be.index-Oe:t.length-Oe;if(Ie){var Ye=document.createTextNode(Q.slice(Oe,Oe+Ie));j&&B<9?Ce.appendChild(i("span",[Ye])):Ce.appendChild(Ye),e.map.push(e.pos,e.pos+Ie,Ye),e.col+=Ie,e.pos+=Ie}if(!Be)break;Oe+=Ie+1;var tt=void 0;if(Be[0]==" "){var mt=e.cm.options.tabSize,vt=mt-e.col%mt;tt=Ce.appendChild(i("span",le(vt),"cm-tab")),tt.setAttribute("role","presentation"),tt.setAttribute("cm-text"," "),e.col+=vt}else Be[0]=="\r"||Be[0]==`
|
|
`?(tt=Ce.appendChild(i("span",Be[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),tt.setAttribute("cm-text",Be[0]),e.col+=1):(tt=e.cm.options.specialCharPlaceholder(Be[0]),tt.setAttribute("cm-text",Be[0]),j&&B<9?Ce.appendChild(i("span",[tt])):Ce.appendChild(tt),e.col+=1);e.map.push(e.pos,e.pos+1,tt),e.pos++}}if(e.trailingSpace=Q.charCodeAt(t.length-1)==32,n||r||a||se||L||z){var At=n||"";r&&(At+=r),a&&(At+=a);var yt=i("span",[Ce],At,L);if(z)for(var Lt in z)z.hasOwnProperty(Lt)&&Lt!="style"&&Lt!="class"&&yt.setAttribute(Lt,z[Lt]);return e.content.appendChild(yt)}e.content.appendChild(Ce)}function ar(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",a=0;a<e.length;a++){var L=e.charAt(a);L==" "&&n&&(a==e.length-1||e.charCodeAt(a+1)==32)&&(L="\xA0"),r+=L,n=L==" "}return r}function Rr(e,t){return function(n,r,a,L,z,Q,ee){a=a?a+" cm-force-border":"cm-force-border";for(var se=n.pos,Ce=se+r.length;;){for(var Oe=void 0,Be=0;Be<t.length&&!(Oe=t[Be],Oe.to>se&&Oe.from<=se);Be++);if(Oe.to>=Ce)return e(n,r,a,L,z,Q,ee);e(n,r.slice(0,Oe.to-se),a,L,null,Q,ee),L=null,r=r.slice(Oe.to-se),se=Oe.to}}}function Yr(e,t,n,r){var a=!r&&n.widgetNode;a&&e.map.push(e.pos,e.pos+t,a),!r&&e.cm.display.input.needsContentAttribute&&(a||(a=e.content.appendChild(document.createElement("span"))),a.setAttribute("cm-marker",n.id)),a&&(e.cm.display.input.setUneditable(a),e.content.appendChild(a)),e.pos+=t,e.trailingSpace=!1}function er(e,t,n){var r=e.markedSpans,a=e.text,L=0;if(!r){for(var z=1;z<n.length;z+=2)t.addToken(t,a.slice(L,L=n[z]),Nt(n[z+1],t.cm.options));return}for(var Q=a.length,ee=0,se=1,Ce="",Oe,Be,Ie=0,Ye,tt,mt,vt,At;;){if(Ie==ee){Ye=tt=mt=Be="",At=null,vt=null,Ie=Infinity;for(var yt=[],Lt=void 0,Kt=0;Kt<r.length;++Kt){var Ft=r[Kt],rr=Ft.marker;if(rr.type=="bookmark"&&Ft.from==ee&&rr.widgetNode)yt.push(rr);else if(Ft.from<=ee&&(Ft.to==null||Ft.to>ee||rr.collapsed&&Ft.to==ee&&Ft.from==ee)){if(Ft.to!=null&&Ft.to!=ee&&Ie>Ft.to&&(Ie=Ft.to,tt=""),rr.className&&(Ye+=" "+rr.className),rr.css&&(Be=(Be?Be+";":"")+rr.css),rr.startStyle&&Ft.from==ee&&(mt+=" "+rr.startStyle),rr.endStyle&&Ft.to==Ie&&(Lt||(Lt=[])).push(rr.endStyle,Ft.to),rr.title&&((At||(At={})).title=rr.title),rr.attributes)for(var Ar in rr.attributes)(At||(At={}))[Ar]=rr.attributes[Ar];rr.collapsed&&(!vt||Tr(vt.marker,rr)<0)&&(vt=Ft)}else Ft.from>ee&&Ie>Ft.from&&(Ie=Ft.from)}if(Lt)for(var Gr=0;Gr<Lt.length;Gr+=2)Lt[Gr+1]==Ie&&(tt+=" "+Lt[Gr]);if(!vt||vt.from==ee)for(var kr=0;kr<yt.length;++kr)Yr(t,0,yt[kr]);if(vt&&(vt.from||0)==ee){if(Yr(t,(vt.to==null?Q+1:vt.to)-ee,vt.marker,vt.from==null),vt.to==null)return;vt.to==ee&&(vt=!1)}}if(ee>=Q)break;for(var yn=Math.min(Q,Ie);;){if(Ce){var un=ee+Ce.length;if(!vt){var Ur=un>yn?Ce.slice(0,yn-ee):Ce;t.addToken(t,Ur,Oe?Oe+Ye:Ye,mt,ee+Ur.length==Ie?tt:"",Be,At)}if(un>=yn){Ce=Ce.slice(yn-ee),ee=yn;break}ee=un,mt=""}Ce=a.slice(L,L=n[se++]),Oe=Nt(n[se++],t.cm.options)}}}function An(e,t,n){this.line=t,this.rest=bn(t),this.size=this.rest?Ot(q(this.rest))-n+1:1,this.node=this.text=null,this.hidden=rn(e,t)}function ur(e,t,n){for(var r=[],a,L=t;L<n;L=a){var z=new An(e.doc,ut(e.doc,L),L);a=L+z.size,r.push(z)}return r}var Nr=null;function pn(e){Nr?Nr.ops.push(e):e.ownsGroup=Nr={ops:[e],delayedCallbacks:[]}}function mn(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 a=e.ops[r];if(a.cursorActivityHandlers)for(;a.cursorActivityCalled<a.cursorActivityHandlers.length;)a.cursorActivityHandlers[a.cursorActivityCalled++].call(null,a.cm)}}while(n<t.length)}function dr(e,t){var n=e.ownsGroup;if(!n)return;try{mn(n)}finally{Nr=null,t(n)}}var cr=null;function pr(e,t){var n=Ge(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),a;Nr?a=Nr.delayedCallbacks:cr?a=cr:(a=cr=[],setTimeout(gn,0));for(var L=function(Q){a.push(function(){return n[Q].apply(null,r)})},z=0;z<n.length;++z)L(z)}function gn(){var e=cr;cr=null;for(var t=0;t<e.length;++t)e[t]()}function Un(e,t,n,r){for(var a=0;a<t.changes.length;a++){var L=t.changes[a];L=="text"?ga(e,t):L=="gutter"?to(e,t,n,r):L=="class"?va(e,t):L=="widget"&&Is(e,t,r)}t.changes=null}function Bn(e){return e.node==e.text&&(e.node=i("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),j&&B<8&&(e.node.style.zIndex=2)),e.node}function Si(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=Bn(t);t.background=r.insertBefore(i("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Xi(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Qt(e,t)}function ga(e,t){var n=t.text.className,r=Xi(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,va(e,t)):n&&(t.text.className=n)}function va(e,t){Si(e,t),t.line.wrapClass?Bn(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 to(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 a=Bn(t);t.gutterBackground=i("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),a.insertBefore(t.gutterBackground,t.text)}var L=t.line.gutterMarkers;if(e.options.lineNumbers||L){var z=Bn(t),Q=t.gutter=i("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Q),z.insertBefore(Q,t.text),t.line.gutterClass&&(Q.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!L||!L["CodeMirror-linenumbers"])&&(t.lineNumber=Q.appendChild(i("div",Dr(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),L)for(var ee=0;ee<e.display.gutterSpecs.length;++ee){var se=e.display.gutterSpecs[ee].className,Ce=L.hasOwnProperty(se)&&L[se];Ce&&Q.appendChild(i("div",[Ce],"CodeMirror-gutter-elt","left: "+r.gutterLeft[se]+"px; width: "+r.gutterWidth[se]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=x("CodeMirror-linewidget"),a=t.node.firstChild,L=void 0;a;a=L)L=a.nextSibling,r.test(a.className)&&t.node.removeChild(a);ro(e,t,n)}function Ns(e,t,n,r){var a=Xi(e,t);return t.text=t.node=a.pre,a.bgClass&&(t.bgClass=a.bgClass),a.textClass&&(t.textClass=a.textClass),va(e,t),to(e,t,n,r),ro(e,t,r),t.node}function ro(e,t,n){if(no(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)no(e,t.rest[r],t,n,!1)}function no(e,t,n,r,a){if(!t.widgets)return;for(var L=Bn(n),z=0,Q=t.widgets;z<Q.length;++z){var ee=Q[z],se=i("div",[ee.node],"CodeMirror-linewidget"+(ee.className?" "+ee.className:""));ee.handleMouseEvents||se.setAttribute("cm-ignore-events","true"),Us(ee,se,n,r),e.display.input.setUneditable(se),a&&ee.above?L.insertBefore(se,n.gutter||n.text):L.appendChild(se),pr(ee,"redraw")}}function Us(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var a=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(a-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=a+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function Ti(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;"),o(t.display.measure,i("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function kn(e,t){for(var n=De(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Yi(e){return e.lineSpace.offsetTop}function ya(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function io(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=o(e.measure,i("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 On(e){return ve-e.display.nativeBarWidth}function Yn(e){return e.display.scroller.clientWidth-On(e)-e.display.barWidth}function ba(e){return e.display.scroller.clientHeight-On(e)-e.display.barHeight}function Bs(e,t,n){var r=e.options.lineWrapping,a=r&&Yn(e);if(!t.measure.heights||r&&t.measure.width!=a){var L=t.measure.heights=[];if(r){t.measure.width=a;for(var z=t.text.firstChild.getClientRects(),Q=0;Q<z.length-1;Q++){var ee=z[Q],se=z[Q+1];Math.abs(ee.bottom-se.bottom)>2&&L.push((ee.bottom+se.top)/2-n.top)}}L.push(n.bottom-n.top)}}function ao(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 a=0;a<e.rest.length;a++)if(Ot(e.rest[a])>n)return{map:e.measure.maps[a],cache:e.measure.caches[a],before:!0}}function Fs(e,t){t=Xr(t);var n=Ot(t),r=e.display.externalMeasured=new An(e.doc,t,n);r.lineN=n;var a=r.built=Qt(e,r);return r.text=a.pre,o(e.display.lineMeasure,a.pre),r}function oo(e,t,n,r){return Ln(e,ai(e,t),n,r)}function Ea(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Zn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function ai(e,t){var n=Ot(t),r=Ea(e,n);r&&!r.text?r=null:r&&r.changes&&(Un(e,r,n,_a(e)),e.curOp.forceUpdate=!0),r||(r=Fs(e,t));var a=ao(r,t,n);return{line:t,view:r,rect:null,map:a.map,cache:a.cache,before:a.before,hasHeights:!1}}function Ln(e,t,n,r,a){t.before&&(n=-1);var L=n+(r||""),z;return t.cache.hasOwnProperty(L)?z=t.cache[L]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Bs(e,t.view,t.rect),t.hasHeights=!0),z=Ws(e,t,n,r),z.bogus||(t.cache[L]=z)),{left:z.left,right:z.right,top:a?z.rtop:z.top,bottom:a?z.rbottom:z.bottom}}var so={left:0,right:0,top:0,bottom:0};function lo(e,t,n){for(var r,a,L,z,Q,ee,se=0;se<e.length;se+=3)if(Q=e[se],ee=e[se+1],t<Q?(a=0,L=1,z="left"):t<ee?(a=t-Q,L=a+1):(se==e.length-3||t==ee&&e[se+3]>t)&&(L=ee-Q,a=L-1,t>=ee&&(z="right")),a!=null){if(r=e[se+2],Q==ee&&n==(r.insertLeft?"left":"right")&&(z=n),n=="left"&&a==0)for(;se&&e[se-2]==e[se-3]&&e[se-1].insertLeft;)r=e[(se-=3)+2],z="left";if(n=="right"&&a==ee-Q)for(;se<e.length-3&&e[se+3]==e[se+4]&&!e[se+5].insertLeft;)r=e[(se+=3)+2],z="right";break}return{node:r,start:a,end:L,collapse:z,coverStart:Q,coverEnd:ee}}function js(e,t){var n=so;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var a=e.length-1;a>=0&&!((n=e[a]).left!=n.right);a--);return n}function Ws(e,t,n,r){var a=lo(t.map,n,r),L=a.node,z=a.start,Q=a.end,ee=a.collapse,se;if(L.nodeType==3){for(var Ce=0;Ce<4;Ce++){for(;z&&Fe(t.line.text.charAt(a.coverStart+z));)--z;for(;a.coverStart+Q<a.coverEnd&&Fe(t.line.text.charAt(a.coverStart+Q));)++Q;if(j&&B<9&&z==0&&Q==a.coverEnd-a.coverStart?se=L.parentNode.getBoundingClientRect():se=js(l(L,z,Q).getClientRects(),r),se.left||se.right||z==0)break;Q=z,z=z-1,ee="right"}j&&B<11&&(se=Hs(e.display.measure,se))}else{z>0&&(ee=r="right");var Oe;e.options.lineWrapping&&(Oe=L.getClientRects()).length>1?se=Oe[r=="right"?Oe.length-1:0]:se=L.getBoundingClientRect()}if(j&&B<9&&!z&&(!se||!se.left&&!se.right)){var Be=L.parentNode.getClientRects()[0];Be?se={left:Be.left,right:Be.left+si(e.display),top:Be.top,bottom:Be.bottom}:se=so}for(var Ie=se.top-t.rect.top,Ye=se.bottom-t.rect.top,tt=(Ie+Ye)/2,mt=t.view.measure.heights,vt=0;vt<mt.length-1&&!(tt<mt[vt]);vt++);var At=vt?mt[vt-1]:0,yt=mt[vt],Lt={left:(ee=="right"?se.right:se.left)-t.rect.left,right:(ee=="left"?se.left:se.right)-t.rect.left,top:At,bottom:yt};return!se.left&&!se.right&&(Lt.bogus=!0),e.options.singleCursorHeightPerLine||(Lt.rtop=Ie,Lt.rbottom=Ye),Lt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!xt(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 uo(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function co(e){e.display.externalMeasure=null,h(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)uo(e.display.view[t])}function wi(e){co(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function ho(){return E&&c?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function fo(){return E&&c?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function xa(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=Ti(e.widgets[n]));return t}function $i(e,t,n,r,a){if(!a){var L=xa(t);n.top+=L,n.bottom+=L}if(r=="line")return n;r||(r="local");var z=En(t);if(r=="local"?z+=Yi(e.display):z-=e.display.viewOffset,r=="page"||r=="window"){var Q=e.display.lineSpace.getBoundingClientRect();z+=Q.top+(r=="window"?0:fo());var ee=Q.left+(r=="window"?0:ho());n.left+=ee,n.right+=ee}return n.top+=z,n.bottom+=z,n}function po(e,t,n){if(n=="div")return t;var r=t.left,a=t.top;if(n=="page")r-=ho(),a-=fo();else if(n=="local"||!n){var L=e.display.sizer.getBoundingClientRect();r+=L.left,a+=L.top}var z=e.display.lineSpace.getBoundingClientRect();return{left:r-z.left,top:a-z.top}}function Ca(e,t,n,r,a){return r||(r=ut(e.doc,t.line)),$i(e,r,oo(e,r,t.ch,a),n)}function Tn(e,t,n,r,a,L){r=r||ut(e.doc,t.line),a||(a=ai(e,r));function z(Ye,tt){var mt=Ln(e,a,Ye,tt?"right":"left",L);return tt?mt.left=mt.right:mt.right=mt.left,$i(e,r,mt,n)}var Q=ft(r,e.doc.direction),ee=t.ch,se=t.sticky;if(ee>=r.text.length?(ee=r.text.length,se="before"):ee<=0&&(ee=0,se="after"),!Q)return z(se=="before"?ee-1:ee,se=="before");function Ce(Ye,tt,mt){var vt=Q[tt],At=vt.level==1;return z(mt?Ye-1:Ye,At!=mt)}var Oe=rt(Q,ee,se),Be=it,Ie=Ce(ee,Oe,se=="before");return Be!=null&&(Ie.other=Ce(ee,Be,se!="before")),Ie}function mo(e,t){var n=0;t=p(e.doc,t),e.options.lineWrapping||(n=si(e.display)*t.ch);var r=ut(e.doc,t.line),a=En(r)+Yi(e.display);return{left:n,right:n,top:a,bottom:a+r.height}}function Sa(e,t,n,r,a){var L=et(e,t,n);return L.xRel=a,r&&(L.outside=r),L}function Ta(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return Sa(r.first,0,null,-1,-1);var a=Gt(r,n),L=r.first+r.size-1;if(a>L)return Sa(r.first+r.size-1,ut(r,L).text.length,null,1,1);t<0&&(t=0);for(var z=ut(r,a);;){var Q=Ks(e,z,a,t,n),ee=en(z,Q.ch+(Q.xRel>0||Q.outside>0?1:0));if(!ee)return Q;var se=ee.find(1);if(se.line==a)return se;z=ut(r,a=se.line)}}function go(e,t,n,r){r-=xa(t);var a=t.text.length,L=qe(function(z){return Ln(e,n,z-1).bottom<=r},a,0);return a=qe(function(z){return Ln(e,n,z).top>r},L,a),{begin:L,end:a}}function vo(e,t,n,r){n||(n=ai(e,t));var a=$i(e,t,Ln(e,n,r),"line").top;return go(e,t,n,a)}function wa(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ks(e,t,n,r,a){a-=En(t);var L=ai(e,t),z=xa(t),Q=0,ee=t.text.length,se=!0,Ce=ft(t,e.doc.direction);if(Ce){var Oe=(e.options.lineWrapping?Gs:zs)(e,t,n,L,Ce,r,a);se=Oe.level!=1,Q=se?Oe.from:Oe.to-1,ee=se?Oe.to:Oe.from-1}var Be=null,Ie=null,Ye=qe(function(Kt){var Ft=Ln(e,L,Kt);return Ft.top+=z,Ft.bottom+=z,wa(Ft,r,a,!1)?(Ft.top<=a&&Ft.left<=r&&(Be=Kt,Ie=Ft),!0):!1},Q,ee),tt,mt,vt=!1;if(Ie){var At=r-Ie.left<Ie.right-r,yt=At==se;Ye=Be+(yt?0:1),mt=yt?"after":"before",tt=At?Ie.left:Ie.right}else{!se&&(Ye==ee||Ye==Q)&&Ye++,mt=Ye==0?"after":Ye==t.text.length?"before":Ln(e,L,Ye-(se?1:0)).bottom+z<=a==se?"after":"before";var Lt=Tn(e,et(n,Ye,mt),"line",t,L);tt=Lt.left,vt=a<Lt.top?-1:a>=Lt.bottom?1:0}return Ye=Ne(t.text,Ye,1),Sa(n,Ye,mt,vt,r-tt)}function zs(e,t,n,r,a,L,z){var Q=qe(function(Oe){var Be=a[Oe],Ie=Be.level!=1;return wa(Tn(e,et(n,Ie?Be.to:Be.from,Ie?"before":"after"),"line",t,r),L,z,!0)},0,a.length-1),ee=a[Q];if(Q>0){var se=ee.level!=1,Ce=Tn(e,et(n,se?ee.from:ee.to,se?"after":"before"),"line",t,r);wa(Ce,L,z,!0)&&Ce.top>z&&(ee=a[Q-1])}return ee}function Gs(e,t,n,r,a,L,z){var Q=go(e,t,r,z),ee=Q.begin,se=Q.end;/\s/.test(t.text.charAt(se-1))&&se--;for(var Ce=null,Oe=null,Be=0;Be<a.length;Be++){var Ie=a[Be];if(Ie.from>=se||Ie.to<=ee)continue;var Ye=Ie.level!=1,tt=Ln(e,r,Ye?Math.min(se,Ie.to)-1:Math.max(ee,Ie.from)).right,mt=tt<L?L-tt+1e9:tt-L;(!Ce||Oe>mt)&&(Ce=Ie,Oe=mt)}return Ce||(Ce=a[a.length-1]),Ce.from<ee&&(Ce={from:ee,to:Ce.to,level:Ce.level}),Ce.to>se&&(Ce={from:Ce.from,to:se,level:Ce.level}),Ce}var $n;function oi(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if($n==null){$n=i("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)$n.appendChild(document.createTextNode("x")),$n.appendChild(i("br"));$n.appendChild(document.createTextNode("x"))}o(e.measure,$n);var n=$n.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),h(e.measure),n||1}function si(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=i("span","xxxxxxxxxx"),n=i("pre",[t],"CodeMirror-line-like");o(e.measure,n);var r=t.getBoundingClientRect(),a=(r.right-r.left)/10;return a>2&&(e.cachedCharWidth=a),a||10}function _a(e){for(var t=e.display,n={},r={},a=t.gutters.clientLeft,L=t.gutters.firstChild,z=0;L;L=L.nextSibling,++z){var Q=e.display.gutterSpecs[z].className;n[Q]=L.offsetLeft+L.clientLeft+a,r[Q]=L.clientWidth}return{fixedPos:Aa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Aa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function yo(e){var t=oi(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/si(e.display)-3);return function(a){if(rn(e.doc,a))return 0;var L=0;if(a.widgets)for(var z=0;z<a.widgets.length;z++)a.widgets[z].height&&(L+=a.widgets[z].height);return n?L+(Math.ceil(a.text.length/r)||1)*t:L+t}}function Oa(e){var t=e.doc,n=yo(e);t.iter(function(r){var a=n(r);a!=r.height&&Tt(r,a)})}function Jn(e,t,n,r){var a=e.display;if(!n&&De(t).getAttribute("cm-not-content")=="true")return null;var L,z,Q=a.lineSpace.getBoundingClientRect();try{L=t.clientX-Q.left,z=t.clientY-Q.top}catch(Oe){return null}var ee=Ta(e,L,z),se;if(r&&ee.xRel>0&&(se=ut(e.doc,ee.line).text).length==ee.ch){var Ce=J(se,se.length,e.options.tabSize)-se.length;ee=et(ee.line,Math.max(0,Math.round((L-io(e.display).left)/si(e.display))-Ce))}return ee}function Zn(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 sn(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var a=e.display;if(r&&n<a.viewTo&&(a.updateLineNumbers==null||a.updateLineNumbers>t)&&(a.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=a.viewTo)Fr&&tn(e.doc,t)<a.viewTo&&jn(e);else if(n<=a.viewFrom)Fr&&Xn(e.doc,n+r)>a.viewFrom?jn(e):(a.viewFrom+=r,a.viewTo+=r);else if(t<=a.viewFrom&&n>=a.viewTo)jn(e);else if(t<=a.viewFrom){var L=Ji(e,n,n+r,1);L?(a.view=a.view.slice(L.index),a.viewFrom=L.lineN,a.viewTo+=r):jn(e)}else if(n>=a.viewTo){var z=Ji(e,t,t,-1);z?(a.view=a.view.slice(0,z.index),a.viewTo=z.lineN):jn(e)}else{var Q=Ji(e,t,t,-1),ee=Ji(e,n,n+r,1);Q&&ee?(a.view=a.view.slice(0,Q.index).concat(ur(e,Q.lineN,ee.lineN)).concat(a.view.slice(ee.index)),a.viewTo+=r):jn(e)}var se=a.externalMeasured;se&&(n<se.lineN?se.lineN+=r:t<se.lineN+se.size&&(a.externalMeasured=null))}function Fn(e,t,n){e.curOp.viewChanged=!0;var r=e.display,a=e.display.externalMeasured;if(a&&t>=a.lineN&&t<a.lineN+a.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var L=r.view[Zn(e,t)];if(L.node==null)return;var z=L.changes||(L.changes=[]);ue(z,n)==-1&&z.push(n)}function jn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ji(e,t,n,r){var a=Zn(e,t),L,z=e.display.view;if(!Fr||n==e.doc.first+e.doc.size)return{index:a,lineN:n};for(var Q=e.display.viewFrom,ee=0;ee<a;ee++)Q+=z[ee].size;if(Q!=t){if(r>0){if(a==z.length-1)return null;L=Q+z[a].size-t,a++}else L=Q-t;t+=L,n+=L}for(;tn(e.doc,n)!=n;){if(a==(r<0?0:z.length-1))return null;n+=r*z[a-(r<0?1:0)].size,a+=r}return{index:a,lineN:n}}function Vs(e,t,n){var r=e.display,a=r.view;a.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=ur(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=ur(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Zn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(ur(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,Zn(e,n)))),r.viewTo=n}function bo(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var a=t[r];!a.hidden&&(!a.node||a.changes)&&++n}return n}function _i(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Eo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},a=r.cursors=document.createDocumentFragment(),L=r.selection=document.createDocumentFragment(),z=0;z<n.sel.ranges.length;z++){if(!t&&z==n.sel.primIndex)continue;var Q=n.sel.ranges[z];if(Q.from().line>=e.display.viewTo||Q.to().line<e.display.viewFrom)continue;var ee=Q.empty();(ee||e.options.showCursorWhenSelecting)&&xo(e,Q.head,a),ee||Xs(e,Q,L)}return r}function xo(e,t,n){var r=Tn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),a=n.appendChild(i("div","\xA0","CodeMirror-cursor"));if(a.style.left=r.left+"px",a.style.top=r.top+"px",a.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var L=n.appendChild(i("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));L.style.display="",L.style.left=r.other.left+"px",L.style.top=r.other.top+"px",L.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Zi(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,a=e.doc,L=document.createDocumentFragment(),z=io(e.display),Q=z.left,ee=Math.max(r.sizerWidth,Yn(e)-r.sizer.offsetLeft)-z.right,se=a.direction=="ltr";function Ce(yt,Lt,Kt,Ft){Lt<0&&(Lt=0),Lt=Math.round(Lt),Ft=Math.round(Ft),L.appendChild(i("div",null,"CodeMirror-selected","position: absolute; left: "+yt+`px;
|
|
top: `+Lt+"px; width: "+(Kt==null?ee-yt:Kt)+`px;
|
|
height: `+(Ft-Lt)+"px"))}function Oe(yt,Lt,Kt){var Ft=ut(a,yt),rr=Ft.text.length,Ar,Gr;function kr(Ur,dn){return Ca(e,et(yt,Ur),"div",Ft,dn)}function yn(Ur,dn,$r){var jr=vo(e,Ft,null,Ur),Br=dn=="ltr"==($r=="after")?"left":"right",Pr=$r=="after"?jr.begin:jr.end-(/\s/.test(Ft.text.charAt(jr.end-1))?2:1);return kr(Pr,Br)[Br]}var un=ft(Ft,a.direction);return Je(un,Lt||0,Kt==null?rr:Kt,function(Ur,dn,$r,jr){var Br=$r=="ltr",Pr=kr(Ur,Br?"left":"right"),cn=kr(dn-1,Br?"right":"left"),Ei=Lt==null&&Ur==0,Vn=Kt==null&&dn==rr,qr=jr==0,Dn=!un||jr==un.length-1;if(cn.top-Pr.top<=3){var Vr=(se?Ei:Vn)&&qr,qa=(se?Vn:Ei)&&Dn,Mn=Vr?Q:(Br?Pr:cn).left,ri=qa?ee:(Br?cn:Pr).right;Ce(Mn,Pr.top,ri-Mn,Pr.bottom)}else{var ni,an,xi,eo;Br?(ni=se&&Ei&&qr?Q:Pr.left,an=se?ee:yn(Ur,$r,"before"),xi=se?Q:yn(dn,$r,"after"),eo=se&&Vn&&Dn?ee:cn.right):(ni=se?yn(Ur,$r,"before"):Q,an=!se&&Ei&&qr?ee:Pr.right,xi=!se&&Vn&&Dn?Q:cn.left,eo=se?yn(dn,$r,"after"):ee),Ce(ni,Pr.top,an-ni,Pr.bottom),Pr.bottom<cn.top&&Ce(Q,Pr.bottom,null,cn.top),Ce(xi,cn.top,eo-xi,cn.bottom)}(!Ar||Zi(Pr,Ar)<0)&&(Ar=Pr),Zi(cn,Ar)<0&&(Ar=cn),(!Gr||Zi(Pr,Gr)<0)&&(Gr=Pr),Zi(cn,Gr)<0&&(Gr=cn)}),{start:Ar,end:Gr}}var Be=t.from(),Ie=t.to();if(Be.line==Ie.line)Oe(Be.line,Be.ch,Ie.ch);else{var Ye=ut(a,Be.line),tt=ut(a,Ie.line),mt=Xr(Ye)==Xr(tt),vt=Oe(Be.line,Be.ch,mt?Ye.text.length+1:null).end,At=Oe(Ie.line,mt?0:null,Ie.ch).start;mt&&(vt.top<At.top-2?(Ce(vt.right,vt.top,null,vt.bottom),Ce(Q,At.top,At.left,At.bottom)):Ce(vt.right,vt.top,At.left-vt.right,vt.bottom)),vt.bottom<At.top&&Ce(Q,vt.bottom,null,At.top)}n.appendChild(L)}function La(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()||li(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function Co(e){e.state.focused||(e.display.input.focus(),Da(e))}function So(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,li(e))},100)}function Da(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Me(e,"focus",e,t),e.state.focused=!0,F(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),k&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),La(e)}function li(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Me(e,"blur",e,t),e.state.focused=!1,d(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Qi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var a=t.view[r],L=e.options.lineWrapping,z=void 0,Q=0;if(a.hidden)continue;if(j&&B<8){var ee=a.node.offsetTop+a.node.offsetHeight;z=ee-n,n=ee}else{var se=a.node.getBoundingClientRect();z=se.bottom-se.top,!L&&a.text.firstChild&&(Q=a.text.firstChild.getBoundingClientRect().right-se.left-1)}var Ce=a.line.height-z;if((Ce>.005||Ce<-.005)&&(Tt(a.line,z),To(a.line),a.rest))for(var Oe=0;Oe<a.rest.length;Oe++)To(a.rest[Oe]);if(Q>e.display.sizerWidth){var Be=Math.ceil(Q/si(e.display));Be>e.display.maxLineLength&&(e.display.maxLineLength=Be,e.display.maxLine=a.line,e.display.maxLineChanged=!0)}}}function To(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 qi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Yi(e));var a=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,L=Gt(t,r),z=Gt(t,a);if(n&&n.ensure){var Q=n.ensure.from.line,ee=n.ensure.to.line;Q<L?(L=Q,z=Gt(t,En(ut(t,Q))+e.wrapper.clientHeight)):Math.min(ee,t.lastLine())>=z&&(L=Gt(t,En(ut(t,ee))-e.wrapper.clientHeight),z=ee)}return{from:L,to:Math.max(z,L+1)}}function Ys(e,t){if(je(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),a=null;if(t.top+r.top<0?a=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(a=!1),a!=null&&!y){var L=i("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Yi(e.display))+`px;
|
|
height: `+(t.bottom-t.top+On(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(L),L.scrollIntoView(a),e.display.lineSpace.removeChild(L)}}function $s(e,t,n,r){r==null&&(r=0);var a;!e.options.lineWrapping&&t==n&&(t=t.ch?et(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?et(t.line,t.ch+1,"before"):t);for(var L=0;L<5;L++){var z=!1,Q=Tn(e,t),ee=!n||n==t?Q:Tn(e,n);a={left:Math.min(Q.left,ee.left),top:Math.min(Q.top,ee.top)-r,right:Math.max(Q.left,ee.left),bottom:Math.max(Q.bottom,ee.bottom)+r};var se=Ra(e,a),Ce=e.doc.scrollTop,Oe=e.doc.scrollLeft;if(se.scrollTop!=null&&(Oi(e,se.scrollTop),Math.abs(e.doc.scrollTop-Ce)>1&&(z=!0)),se.scrollLeft!=null&&(Qn(e,se.scrollLeft),Math.abs(e.doc.scrollLeft-Oe)>1&&(z=!0)),!z)break}return a}function Js(e,t){var n=Ra(e,t);n.scrollTop!=null&&Oi(e,n.scrollTop),n.scrollLeft!=null&&Qn(e,n.scrollLeft)}function Ra(e,t){var n=e.display,r=oi(e.display);t.top<0&&(t.top=0);var a=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,L=ba(e),z={};t.bottom-t.top>L&&(t.bottom=t.top+L);var Q=e.doc.height+ya(n),ee=t.top<r,se=t.bottom>Q-r;if(t.top<a)z.scrollTop=ee?0:t.top;else if(t.bottom>a+L){var Ce=Math.min(t.top,(se?Q:t.bottom)-L);Ce!=a&&(z.scrollTop=Ce)}var Oe=e.options.fixedGutter?0:n.gutters.offsetWidth,Be=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-Oe,Ie=Yn(e)-n.gutters.offsetWidth,Ye=t.right-t.left>Ie;return Ye&&(t.right=t.left+Ie),t.left<10?z.scrollLeft=0:t.left<Be?z.scrollLeft=Math.max(0,t.left+Oe-(Ye?0:10)):t.right>Ie+Be-3&&(z.scrollLeft=t.right+(Ye?0:10)-Ie),z}function ka(e,t){if(t==null)return;ea(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function ui(e){ea(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Ai(e,t,n){(t!=null||n!=null)&&ea(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Zs(e,t){ea(e),e.curOp.scrollToPos=t}function ea(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=mo(e,t.from),r=mo(e,t.to);wo(e,n,r,t.margin)}}function wo(e,t,n,r){var a=Ra(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});Ai(e,a.scrollLeft,a.scrollTop)}function Oi(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;R||Ma(e,{top:t}),_o(e,t,!0),R&&Ma(e),Ri(e,100)}function _o(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 Qn(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,Ro(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function Li(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ya(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+On(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var qn=function(e,t,n){this.cm=n;var r=this.vert=i("div",[i("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),a=this.horiz=i("div",[i("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=a.tabIndex=-1,e(r),e(a),Le(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Le(a,"scroll",function(){a.clientWidth&&t(a.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,j&&B<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};qn.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 a=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+a)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var L=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+L)+"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}},qn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},qn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},qn.prototype.zeroWidthHack=function(){var e=u&&!w?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ae,this.disableVert=new ae},qn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var a=e.getBoundingClientRect(),L=n=="vert"?document.elementFromPoint(a.right-1,(a.top+a.bottom)/2):document.elementFromPoint((a.right+a.left)/2,a.bottom-1);L!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},qn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Di=function(){};Di.prototype.update=function(){return{bottom:0,right:0}},Di.prototype.setScrollLeft=function(){},Di.prototype.setScrollTop=function(){},Di.prototype.clear=function(){};function di(e,t){t||(t=Li(e));var n=e.display.barWidth,r=e.display.barHeight;Ao(e,t);for(var a=0;a<4&&n!=e.display.barWidth||r!=e.display.barHeight;a++)n!=e.display.barWidth&&e.options.lineWrapping&&Qi(e),Ao(e,Li(e)),n=e.display.barWidth,r=e.display.barHeight}function Ao(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 Oo={native:qn,null:Di};function Lo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&d(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Oo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Le(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"?Qn(e,t):Oi(e,t)},e),e.display.scrollbars.addClass&&F(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=0;function ei(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Qs},pn(e.curOp)}function ti(e){var t=e.curOp;t&&dr(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;qs(n)})}function qs(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var r=0;r<t.length;r++)tl(t[r]);for(var a=0;a<t.length;a++)rl(t[a]);for(var L=0;L<t.length;L++)nl(t[L]);for(var z=0;z<t.length;z++)il(t[z])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&Nn(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 ta(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Pa(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Qi(t),e.barMeasure=Li(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=oo(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+On(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Yn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Qn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==I();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&di(t,e.barMeasure),e.updatedDisplay&&Na(t,e.barMeasure),e.selectionChanged&&La(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&Co(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Do(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&_o(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Qn(t,e.scrollLeft,!0,!0),e.scrollToPos){var a=$s(t,p(r,e.scrollToPos.from),p(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,a)}var L=e.maybeHiddenMarkers,z=e.maybeUnhiddenMarkers;if(L)for(var Q=0;Q<L.length;++Q)L[Q].lines.length||Me(L[Q],"hide");if(z)for(var ee=0;ee<z.length;++ee)z[ee].lines.length&&Me(z[ee],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Me(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function vn(e,t){if(e.curOp)return t();ei(e);try{return t()}finally{ti(e)}}function Kr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);ei(e);try{return t.apply(e,arguments)}finally{ti(e)}}}function nn(e){return function(){if(this.curOp)return e.apply(this,arguments);ei(this);try{return e.apply(this,arguments)}finally{ti(this)}}}function zr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);ei(t);try{return e.apply(this,arguments)}finally{ti(t)}}}function Ri(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,M(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=pt(e,t.highlightFrontier),a=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(L){if(r.line>=e.display.viewFrom){var z=L.styles,Q=L.text.length>e.options.maxHighlightLength?st(t.mode,r.state):null,ee=Ae(e,L,r,!0);Q&&(r.state=Q),L.styles=ee.styles;var se=L.styleClasses,Ce=ee.classes;Ce?L.styleClasses=Ce:se&&(L.styleClasses=null);for(var Oe=!z||z.length!=L.styles.length||se!=Ce&&(!se||!Ce||se.bgClass!=Ce.bgClass||se.textClass!=Ce.textClass),Be=0;!Oe&&Be<z.length;++Be)Oe=z[Be]!=L.styles[Be];Oe&&a.push(r.line),L.stateAfter=r.save(),r.nextLine()}else L.text.length<=e.options.maxHighlightLength&&_t(e,L.text,r),L.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return Ri(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),a.length&&vn(e,function(){for(var L=0;L<a.length;L++)Fn(e,a[L],"text")})}var ta=function(e,t,n){var r=e.display;this.viewport=t,this.visible=qi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Yn(e),this.force=n,this.dims=_a(e),this.events=[]};ta.prototype.signal=function(e,t){pe(e,t)&&this.events.push(arguments)},ta.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Me.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=On(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=On(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=I();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 ll(e){if(!e||!e.activeElt||e.activeElt==I())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 Pa(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return jn(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&&bo(e)==0)return!1;ko(e)&&(jn(e),t.dims=_a(e));var a=r.first+r.size,L=Math.max(t.visible.from-e.options.viewportMargin,r.first),z=Math.min(a,t.visible.to+e.options.viewportMargin);n.viewFrom<L&&L-n.viewFrom<20&&(L=Math.max(r.first,n.viewFrom)),n.viewTo>z&&n.viewTo-z<20&&(z=Math.min(a,n.viewTo)),Fr&&(L=tn(e.doc,L),z=Xn(e.doc,z));var Q=L!=n.viewFrom||z!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,L,z),n.viewOffset=En(ut(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var ee=bo(e);if(!Q&&ee==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var se=sl(e);return ee>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),ee>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(se),h(n.cursorDiv),h(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,Q&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Ri(e,400)),n.updateLineNumbers=null,!0}function Do(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Yn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ya(e.display)-ba(e),n.top)}),t.visible=qi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=qi(e.display,e.doc,n));if(!Pa(e,t))break;Qi(e);var a=Li(e);_i(e),di(e,a),Na(e,a),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Ma(e,t){var n=new ta(e,t);if(Pa(e,n)){Qi(e),Do(e,n);var r=Li(e);_i(e),di(e,r),Na(e,r),n.finish()}}function ul(e,t,n){var r=e.display,a=e.options.lineNumbers,L=r.lineDiv,z=L.firstChild;function Q(Ye){var tt=Ye.nextSibling;return k&&u&&e.display.currentWheelTarget==Ye?Ye.style.display="none":Ye.parentNode.removeChild(Ye),tt}for(var ee=r.view,se=r.viewFrom,Ce=0;Ce<ee.length;Ce++){var Oe=ee[Ce];if(!Oe.hidden)if(!Oe.node||Oe.node.parentNode!=L){var Be=Ns(e,Oe,se,n);L.insertBefore(Be,z)}else{for(;z!=Oe.node;)z=Q(z);var Ie=a&&t!=null&&t<=se&&Oe.lineNumber;Oe.changes&&(ue(Oe.changes,"gutter")>-1&&(Ie=!1),Un(e,Oe,se,n)),Ie&&(h(Oe.lineNumber),Oe.lineNumber.appendChild(document.createTextNode(Dr(e.options,se)))),z=Oe.node.nextSibling}se+=Oe.size}for(;z;)z=Q(z)}function Ia(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Na(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+On(e)+"px"}function Ro(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Aa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,a=t.gutters.offsetWidth,L=r+"px",z=0;z<n.length;z++)if(!n[z].hidden){e.options.fixedGutter&&(n[z].gutter&&(n[z].gutter.style.left=L),n[z].gutterBackground&&(n[z].gutterBackground.style.left=L));var Q=n[z].alignable;if(Q)for(var ee=0;ee<Q.length;ee++)Q[ee].style.left=L}e.options.fixedGutter&&(t.gutters.style.left=r+a+"px")}function ko(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=Dr(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var a=r.measure.appendChild(i("div",[i("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),L=a.firstChild.offsetWidth,z=a.offsetWidth-L;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(L,r.lineGutter.offsetWidth-z)+1,r.lineNumWidth=r.lineNumInnerWidth+z,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Ia(e.display),!0}return!1}function Ua(e,t){for(var n=[],r=!1,a=0;a<e.length;a++){var L=e[a],z=null;if(typeof L!="string"&&(z=L.style,L=L.className),L=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:L,style:z})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Po(e){var t=e.gutters,n=e.gutterSpecs;h(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var a=n[r],L=a.className,z=a.style,Q=t.appendChild(i("div",null,"CodeMirror-gutter "+L));z&&(Q.style.cssText=z),L=="CodeMirror-linenumbers"&&(e.lineGutter=Q,Q.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Ia(e)}function ki(e){Po(e.display),sn(e),Ro(e)}function dl(e,t,n,r){var a=this;this.input=n,a.scrollbarFiller=i("div",null,"CodeMirror-scrollbar-filler"),a.scrollbarFiller.setAttribute("cm-not-content","true"),a.gutterFiller=i("div",null,"CodeMirror-gutter-filler"),a.gutterFiller.setAttribute("cm-not-content","true"),a.lineDiv=g("div",null,"CodeMirror-code"),a.selectionDiv=i("div",null,null,"position: relative; z-index: 1"),a.cursorDiv=i("div",null,"CodeMirror-cursors"),a.measure=i("div",null,"CodeMirror-measure"),a.lineMeasure=i("div",null,"CodeMirror-measure"),a.lineSpace=g("div",[a.measure,a.lineMeasure,a.selectionDiv,a.cursorDiv,a.lineDiv],null,"position: relative; outline: none");var L=g("div",[a.lineSpace],"CodeMirror-lines");a.mover=i("div",[L],null,"position: relative"),a.sizer=i("div",[a.mover],"CodeMirror-sizer"),a.sizerWidth=null,a.heightForcer=i("div",null,null,"position: absolute; height: "+ve+"px; width: 1px;"),a.gutters=i("div",null,"CodeMirror-gutters"),a.lineGutter=null,a.scroller=i("div",[a.sizer,a.heightForcer,a.gutters],"CodeMirror-scroll"),a.scroller.setAttribute("tabIndex","-1"),a.wrapper=i("div",[a.scrollbarFiller,a.gutterFiller,a.scroller],"CodeMirror"),j&&B<8&&(a.gutters.style.zIndex=-1,a.scroller.style.paddingRight=0),!k&&!(R&&s)&&(a.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(a.wrapper):e(a.wrapper)),a.viewFrom=a.viewTo=t.first,a.reportedViewFrom=a.reportedViewTo=t.first,a.view=[],a.renderedView=null,a.externalMeasured=null,a.viewOffset=0,a.lastWrapHeight=a.lastWrapWidth=0,a.updateLineNumbers=null,a.nativeBarWidth=a.barHeight=a.barWidth=0,a.scrollbarsClipped=!1,a.lineNumWidth=a.lineNumInnerWidth=a.lineNumChars=null,a.alignWidgets=!1,a.cachedCharWidth=a.cachedTextHeight=a.cachedPaddingH=null,a.maxLine=null,a.maxLineLength=0,a.maxLineChanged=!1,a.wheelDX=a.wheelDY=a.wheelStartX=a.wheelStartY=null,a.shift=!1,a.selForContextMenu=null,a.activeTouch=null,a.gutterSpecs=Ua(r.gutters,r.lineNumbers),Po(a),n.init(a)}var ra=0,xn=null;j?xn=-.53:R?xn=15:E?xn=-.7:P&&(xn=-1/3);function Mo(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function cl(e){var t=Mo(e);return t.x*=xn,t.y*=xn,t}function Io(e,t){var n=Mo(t),r=n.x,a=n.y,L=e.display,z=L.scroller,Q=z.scrollWidth>z.clientWidth,ee=z.scrollHeight>z.clientHeight;if(!(r&&Q||a&&ee))return;if(a&&u&&k){e:for(var se=t.target,Ce=L.view;se!=z;se=se.parentNode)for(var Oe=0;Oe<Ce.length;Oe++)if(Ce[Oe].node==se){e.display.currentWheelTarget=se;break e}}if(r&&!R&&!A&&xn!=null){a&&ee&&Oi(e,Math.max(0,z.scrollTop+a*xn)),Qn(e,Math.max(0,z.scrollLeft+r*xn)),(!a||a&&ee)&&te(t),L.wheelStartX=null;return}if(a&&xn!=null){var Be=a*xn,Ie=e.doc.scrollTop,Ye=Ie+L.wrapper.clientHeight;Be<0?Ie=Math.max(0,Ie+Be-50):Ye=Math.min(e.doc.height,Ye+Be+50),Ma(e,{top:Ie,bottom:Ye})}ra<20&&(L.wheelStartX==null?(L.wheelStartX=z.scrollLeft,L.wheelStartY=z.scrollTop,L.wheelDX=r,L.wheelDY=a,setTimeout(function(){if(L.wheelStartX==null)return;var tt=z.scrollLeft-L.wheelStartX,mt=z.scrollTop-L.wheelStartY,vt=mt&&L.wheelDY&&mt/L.wheelDY||tt&&L.wheelDX&&tt/L.wheelDX;if(L.wheelStartX=L.wheelStartY=null,!vt)return;xn=(xn*ra+vt)/(ra+1),++ra},200)):(L.wheelDX+=r,L.wheelDY+=a))}var Cn=function(e,t){this.ranges=e,this.primIndex=t};Cn.prototype.primary=function(){return this.ranges[this.primIndex]},Cn.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(!Ut(n.anchor,r.anchor)||!Ut(n.head,r.head))return!1}return!0},Cn.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new yr(nr(this.ranges[t].anchor),nr(this.ranges[t].head));return new Cn(e,this.primIndex)},Cn.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Cn.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(Ct(t,r.from())>=0&&Ct(e,r.to())<=0)return n}return-1};var yr=function(e,t){this.anchor=e,this.head=t};yr.prototype.from=function(){return Cr(this.anchor,this.head)},yr.prototype.to=function(){return mr(this.anchor,this.head)},yr.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function wn(e,t,n){var r=e&&e.options.selectionsMayTouch,a=t[n];t.sort(function(Be,Ie){return Ct(Be.from(),Ie.from())}),n=ue(t,a);for(var L=1;L<t.length;L++){var z=t[L],Q=t[L-1],ee=Ct(Q.to(),z.from());if(r&&!z.empty()?ee>0:ee>=0){var se=Cr(Q.from(),z.from()),Ce=mr(Q.to(),z.to()),Oe=Q.empty()?z.from()==z.head:Q.from()==Q.head;L<=n&&--n,t.splice(--L,2,new yr(Oe?Ce:se,Oe?se:Ce))}}return new Cn(t,n)}function Wn(e,t){return new Cn([new yr(e,t||e)],0)}function Hn(e){return e.text?et(e.from.line+e.text.length-1,q(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function No(e,t){if(Ct(e,t.from)<0)return e;if(Ct(e,t.to)<=0)return Hn(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+=Hn(t).ch-t.to.ch),et(n,r)}function Ba(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var a=e.sel.ranges[r];n.push(new yr(No(a.anchor,t),No(a.head,t)))}return wn(e.cm,n,e.sel.primIndex)}function Uo(e,t,n){return e.line==t.line?et(n.line,e.ch-t.ch+n.ch):et(n.line+(e.line-t.line),e.ch)}function hl(e,t,n){for(var r=[],a=et(e.first,0),L=a,z=0;z<t.length;z++){var Q=t[z],ee=Uo(Q.from,a,L),se=Uo(Hn(Q),a,L);if(a=Q.to,L=se,n=="around"){var Ce=e.sel.ranges[z],Oe=Ct(Ce.head,Ce.anchor)<0;r[z]=new yr(Oe?se:ee,Oe?ee:se)}else r[z]=new yr(ee,ee)}return new Cn(r,e.sel.primIndex)}function Fa(e){e.doc.mode=bt(e.options,e.doc.modeOption),Pi(e)}function Pi(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,Ri(e,100),e.state.modeGen++,e.curOp&&sn(e)}function Bo(e,t){return t.from.ch==0&&t.to.ch==0&&q(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function ja(e,t,n,r){function a(At){return n?n[At]:null}function L(At,yt,Lt){ii(At,yt,Lt,r),pr(At,"change",At,t)}function z(At,yt){for(var Lt=[],Kt=At;Kt<yt;++Kt)Lt.push(new fn(se[Kt],a(Kt),r));return Lt}var Q=t.from,ee=t.to,se=t.text,Ce=ut(e,Q.line),Oe=ut(e,ee.line),Be=q(se),Ie=a(se.length-1),Ye=ee.line-Q.line;if(t.full)e.insert(0,z(0,se.length)),e.remove(se.length,e.size-se.length);else if(Bo(e,t)){var tt=z(0,se.length-1);L(Oe,Oe.text,Ie),Ye&&e.remove(Q.line,Ye),tt.length&&e.insert(Q.line,tt)}else if(Ce==Oe)if(se.length==1)L(Ce,Ce.text.slice(0,Q.ch)+Be+Ce.text.slice(ee.ch),Ie);else{var mt=z(1,se.length-1);mt.push(new fn(Be+Ce.text.slice(ee.ch),Ie,r)),L(Ce,Ce.text.slice(0,Q.ch)+se[0],a(0)),e.insert(Q.line+1,mt)}else if(se.length==1)L(Ce,Ce.text.slice(0,Q.ch)+se[0]+Oe.text.slice(ee.ch),a(0)),e.remove(Q.line+1,Ye);else{L(Ce,Ce.text.slice(0,Q.ch)+se[0],a(0)),L(Oe,Be+Oe.text.slice(ee.ch),Ie);var vt=z(1,se.length-1);Ye>1&&e.remove(Q.line+1,Ye-1),e.insert(Q.line+1,vt)}pr(e,"change",e,t)}function Kn(e,t,n){function r(a,L,z){if(a.linked)for(var Q=0;Q<a.linked.length;++Q){var ee=a.linked[Q];if(ee.doc==L)continue;var se=z&&ee.sharedHist;if(n&&!se)continue;t(ee.doc,se),r(ee.doc,a,se)}}r(e,null,!0)}function Fo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Oa(e),Fa(e),jo(e),e.options.lineWrapping||Nn(e),e.options.mode=t.modeOption,sn(e)}function jo(e){(e.doc.direction=="rtl"?F:d)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){vn(e,function(){jo(e),sn(e)})}function na(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Wa(e,t){var n={from:nr(t.from),to:Hn(t),text:or(e,t.from,t.to)};return Ko(e,n,t.from.line,t.to.line+1),Kn(e,function(r){return Ko(r,n,t.from.line,t.to.line+1)},!0),n}function Wo(e){for(;e.length;){var t=q(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Wo(e.done),q(e.done);if(e.done.length&&!q(e.done).ranges)return q(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),q(e.done)}function Ho(e,t,n,r){var a=e.history;a.undone.length=0;var L=+new Date,z,Q;if((a.lastOp==r||a.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&a.lastModTime>L-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(z=pl(a,a.lastOp==r)))Q=q(z.changes),Ct(t.from,t.to)==0&&Ct(t.from,Q.to)==0?Q.to=Hn(t):z.changes.push(Wa(e,t));else{var ee=q(a.done);for((!ee||!ee.ranges)&&ia(e.sel,a.done),z={changes:[Wa(e,t)],generation:a.generation},a.done.push(z);a.done.length>a.undoDepth;)a.done.shift(),a.done[0].ranges||a.done.shift()}a.done.push(n),a.generation=++a.maxGeneration,a.lastModTime=a.lastSelTime=L,a.lastOp=a.lastSelOp=r,a.lastOrigin=a.lastSelOrigin=t.origin,Q||Me(e,"historyAdded")}function ml(e,t,n,r){var a=t.charAt(0);return a=="*"||a=="+"&&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 a=e.history,L=r&&r.origin;n==a.lastSelOp||L&&a.lastSelOrigin==L&&(a.lastModTime==a.lastSelTime&&a.lastOrigin==L||ml(e,L,q(a.done),t))?a.done[a.done.length-1]=t:ia(t,a.done),a.lastSelTime=+new Date,a.lastSelOrigin=L,a.lastSelOp=n,r&&r.clearRedo!==!1&&Wo(a.undone)}function ia(e,t){var n=q(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Ko(e,t,n,r){var a=t["spans_"+e.id],L=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(z){z.markedSpans&&((a||(a=t["spans_"+e.id]={}))[L]=z.markedSpans),++L})}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=[],a=0;a<t.text.length;++a)r.push(vl(n[a]));return r}function zo(e,t){var n=yl(e,t),r=Or(e,t);if(!n)return r;if(!r)return n;for(var a=0;a<n.length;++a){var L=n[a],z=r[a];if(L&&z){e:for(var Q=0;Q<z.length;++Q){for(var ee=z[Q],se=0;se<L.length;++se)if(L[se].marker==ee.marker)continue e;L.push(ee)}}else z&&(n[a]=z)}return n}function ci(e,t,n){for(var r=[],a=0;a<e.length;++a){var L=e[a];if(L.ranges){r.push(n?Cn.prototype.deepCopy.call(L):L);continue}var z=L.changes,Q=[];r.push({changes:Q});for(var ee=0;ee<z.length;++ee){var se=z[ee],Ce=void 0;if(Q.push({from:se.from,to:se.to,text:se.text}),t)for(var Oe in se)(Ce=Oe.match(/^spans_(\d+)$/))&&(ue(t,Number(Ce[1]))>-1&&(q(Q)[Oe]=se[Oe],delete se[Oe]))}}return r}function Ha(e,t,n,r){if(r){var a=e.anchor;if(n){var L=Ct(t,a)<0;L!=Ct(n,a)<0?(a=t,t=n):L!=Ct(t,n)<0&&(t=n)}return new yr(a,t)}else return new yr(n||t,t)}function aa(e,t,n,r,a){a==null&&(a=e.cm&&(e.cm.display.shift||e.extend)),Qr(e,new Cn([Ha(e.sel.primary(),t,n,a)],0),r)}function Go(e,t,n){for(var r=[],a=e.cm&&(e.cm.display.shift||e.extend),L=0;L<e.sel.ranges.length;L++)r[L]=Ha(e.sel.ranges[L],t[L],null,a);var z=wn(e.cm,r,e.sel.primIndex);Qr(e,z,n)}function Ka(e,t,n,r){var a=e.sel.ranges.slice(0);a[t]=n,Qr(e,wn(e.cm,a,e.sel.primIndex),r)}function Vo(e,t,n,r){Qr(e,Wn(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(a){this.ranges=[];for(var L=0;L<a.length;L++)this.ranges[L]=new yr(p(e,a[L].anchor),p(e,a[L].head))},origin:n&&n.origin};return Me(e,"beforeSelectionChange",e,r),e.cm&&Me(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?wn(e.cm,r.ranges,r.ranges.length-1):t}function Xo(e,t,n){var r=e.history.done,a=q(r);a&&a.ranges?(r[r.length-1]=t,oa(e,t,n)):Qr(e,t,n)}function Qr(e,t,n){oa(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function oa(e,t,n){(pe(e,"beforeSelectionChange")||e.cm&&pe(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(Ct(t.primary().head,e.sel.primary().head)<0?-1:1);Yo(e,Jo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&ui(e.cm)}function Yo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,xe(e.cm)),pr(e,"cursorActivity",e)}function $o(e){Yo(e,Jo(e,e.sel,null,!1))}function Jo(e,t,n,r){for(var a,L=0;L<t.ranges.length;L++){var z=t.ranges[L],Q=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[L],ee=sa(e,z.anchor,Q&&Q.anchor,n,r),se=sa(e,z.head,Q&&Q.head,n,r);(a||ee!=z.anchor||se!=z.head)&&(a||(a=t.ranges.slice(0,L)),a[L]=new yr(ee,se))}return a?wn(e.cm,a,t.primIndex):t}function hi(e,t,n,r,a){var L=ut(e,t.line);if(L.markedSpans)for(var z=0;z<L.markedSpans.length;++z){var Q=L.markedSpans[z],ee=Q.marker,se="selectLeft"in ee?!ee.selectLeft:ee.inclusiveLeft,Ce="selectRight"in ee?!ee.selectRight:ee.inclusiveRight;if((Q.from==null||(se?Q.from<=t.ch:Q.from<t.ch))&&(Q.to==null||(Ce?Q.to>=t.ch:Q.to>t.ch))){if(a&&(Me(ee,"beforeCursorEnter"),ee.explicitlyCleared))if(L.markedSpans){--z;continue}else break;if(!ee.atomic)continue;if(n){var Oe=ee.find(r<0?1:-1),Be=void 0;if((r<0?Ce:se)&&(Oe=Zo(e,Oe,-r,Oe&&Oe.line==t.line?L:null)),Oe&&Oe.line==t.line&&(Be=Ct(Oe,n))&&(r<0?Be<0:Be>0))return hi(e,Oe,t,r,a)}var Ie=ee.find(r<0?-1:1);return(r<0?se:Ce)&&(Ie=Zo(e,Ie,r,Ie.line==t.line?L:null)),Ie?hi(e,Ie,t,r,a):null}}return t}function sa(e,t,n,r,a){var L=r||1,z=hi(e,t,n,L,a)||!a&&hi(e,t,n,L,!0)||hi(e,t,n,-L,a)||!a&&hi(e,t,n,-L,!0);return z||(e.cantEdit=!0,et(e.first,0))}function Zo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?p(e,et(t.line-1)):null:n>0&&t.ch==(r||ut(e,t.line)).text.length?t.line<e.first+e.size-1?et(t.line+1,0):null:new et(t.line,t.ch+n)}function Qo(e){e.setSelection(et(e.firstLine(),0),et(e.lastLine()),_e)}function qo(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(a,L,z,Q){a&&(r.from=p(e,a)),L&&(r.to=p(e,L)),z&&(r.text=z),Q!==void 0&&(r.origin=Q)}),Me(e,"beforeChange",e,r),e.cm&&Me(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 fi(e,t,n){if(e.cm){if(!e.cm.curOp)return Kr(e.cm,fi)(e,t,n);if(e.cm.state.suppressEdits)return}if((pe(e,"beforeChange")||e.cm&&pe(e.cm,"beforeChange"))&&(t=qo(e,t,!0),!t))return;var r=Sn&&!n&&Zr(e,t.from,t.to);if(r)for(var a=r.length-1;a>=0;--a)es(e,{from:r[a].from,to:r[a].to,text:a?[""]:t.text,origin:t.origin});else es(e,t)}function es(e,t){if(t.text.length==1&&t.text[0]==""&&Ct(t.from,t.to)==0)return;var n=Ba(e,t);Ho(e,t,n,e.cm?e.cm.curOp.id:NaN),Mi(e,t,n,Or(e,t));var r=[];Kn(e,function(a,L){!L&&ue(r,a.history)==-1&&(is(a.history,t),r.push(a.history)),Mi(a,t,null,Or(a,t))})}function la(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var a=e.history,L,z=e.sel,Q=t=="undo"?a.done:a.undone,ee=t=="undo"?a.undone:a.done,se=0;se<Q.length&&!(L=Q[se],n?L.ranges&&!L.equals(e.sel):!L.ranges);se++);if(se==Q.length)return;for(a.lastOrigin=a.lastSelOrigin=null;;)if(L=Q.pop(),L.ranges){if(ia(L,ee),n&&!L.equals(e.sel)){Qr(e,L,{clearRedo:!1});return}z=L}else if(r){Q.push(L);return}else break;var Ce=[];ia(z,ee),ee.push({changes:Ce,generation:a.generation}),a.generation=L.generation||++a.maxGeneration;for(var Oe=pe(e,"beforeChange")||e.cm&&pe(e.cm,"beforeChange"),Be=function(tt){var mt=L.changes[tt];if(mt.origin=t,Oe&&!qo(e,mt,!1))return Q.length=0,{};Ce.push(Wa(e,mt));var vt=tt?Ba(e,mt):q(Q);Mi(e,mt,vt,zo(e,mt)),!tt&&e.cm&&e.cm.scrollIntoView({from:mt.from,to:Hn(mt)});var At=[];Kn(e,function(yt,Lt){!Lt&&ue(At,yt.history)==-1&&(is(yt.history,mt),At.push(yt.history)),Mi(yt,mt,null,zo(yt,mt))})},Ie=L.changes.length-1;Ie>=0;--Ie){var Ye=Be(Ie);if(Ye)return Ye.v}}function ts(e,t){if(t==0)return;if(e.first+=t,e.sel=new Cn(re(e.sel.ranges,function(a){return new yr(et(a.anchor.line+t,a.anchor.ch),et(a.head.line+t,a.head.ch))}),e.sel.primIndex),e.cm){sn(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Fn(e.cm,r,"gutter")}}function Mi(e,t,n,r){if(e.cm&&!e.cm.curOp)return Kr(e.cm,Mi)(e,t,n,r);if(t.to.line<e.first){ts(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var a=t.text.length-1-(e.first-t.from.line);ts(e,a),t={from:et(e.first,0),to:et(t.to.line+a,t.to.ch),text:[q(t.text)],origin:t.origin}}var L=e.lastLine();t.to.line>L&&(t={from:t.from,to:et(L,ut(e,L).text.length),text:[t.text[0]],origin:t.origin}),t.removed=or(e,t.from,t.to),n||(n=Ba(e,t)),e.cm?El(e.cm,t,r):ja(e,t,r),oa(e,n,_e),e.cantEdit&&sa(e,et(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,a=e.display,L=t.from,z=t.to,Q=!1,ee=L.line;e.options.lineWrapping||(ee=Ot(Xr(ut(r,L.line))),r.iter(ee,z.line+1,function(Ie){if(Ie==a.maxLine)return Q=!0,!0})),r.sel.contains(t.from,t.to)>-1&&xe(e),ja(r,t,n,yo(e)),e.options.lineWrapping||(r.iter(ee,L.line+t.text.length,function(Ie){var Ye=Rn(Ie);Ye>a.maxLineLength&&(a.maxLine=Ie,a.maxLineLength=Ye,a.maxLineChanged=!0,Q=!1)}),Q&&(e.curOp.updateMaxLine=!0)),Jr(r,L.line),Ri(e,400);var se=t.text.length-(z.line-L.line)-1;t.full?sn(e):L.line==z.line&&t.text.length==1&&!Bo(e.doc,t)?Fn(e,L.line,"text"):sn(e,L.line,z.line+1,se);var Ce=pe(e,"changes"),Oe=pe(e,"change");if(Oe||Ce){var Be={from:L,to:z,text:t.text,removed:t.removed,origin:t.origin};Oe&&pr(e,"change",e,Be),Ce&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Be)}e.display.selForContextMenu=null}function pi(e,t,n,r,a){var L;r||(r=n),Ct(r,n)<0&&(L=[r,n],n=L[0],r=L[1]),typeof t=="string"&&(t=e.splitLines(t)),fi(e,{from:n,to:r,text:t,origin:a})}function rs(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function ns(e,t,n,r){for(var a=0;a<e.length;++a){var L=e[a],z=!0;if(L.ranges){L.copied||(L=e[a]=L.deepCopy(),L.copied=!0);for(var Q=0;Q<L.ranges.length;Q++)rs(L.ranges[Q].anchor,t,n,r),rs(L.ranges[Q].head,t,n,r);continue}for(var ee=0;ee<L.changes.length;++ee){var se=L.changes[ee];if(n<se.from.line)se.from=et(se.from.line+r,se.from.ch),se.to=et(se.to.line+r,se.to.ch);else if(t<=se.to.line){z=!1;break}}z||(e.splice(0,a+1),a=0)}}function is(e,t){var n=t.from.line,r=t.to.line,a=t.text.length-(r-n)-1;ns(e.done,n,r,a),ns(e.undone,n,r,a)}function Ii(e,t,n,r){var a=t,L=t;return typeof t=="number"?L=ut(e,H(e,t)):a=Ot(t),a==null?null:(r(L,a)&&e.cm&&Fn(e.cm,a,n),L)}function Ni(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}Ni.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var a=this.lines[n];this.height-=a.height,Ci(a),pr(a,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var 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 Ui(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var a=e[r];t+=a.chunkSize(),n+=a.height,a.parent=this}this.size=t,this.height=n,this.parent=null}Ui.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],a=r.chunkSize();if(e<a){var L=Math.min(t,a-e),z=r.height;if(r.removeInner(e,L),this.height-=z-r.height,a==L&&(this.children.splice(n--,1),r.parent=null),(t-=L)==0)break;e=0}else e-=a}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Ni))){var Q=[];this.collapse(Q),this.children=[new Ni(Q)],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 a=this.children[r],L=a.chunkSize();if(e<=L){if(a.insertInner(e,t,n),a.lines&&a.lines.length>50){for(var z=a.lines.length%25+25,Q=z;Q<a.lines.length;){var ee=new Ni(a.lines.slice(Q,Q+=25));a.height-=ee.height,this.children.splice(++r,0,ee),ee.parent=this}a.lines=a.lines.slice(0,z),this.maybeSpill()}break}e-=L}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new Ui(t);if(e.parent){e.size-=n.size,e.height-=n.height;var a=ue(e.parent.children,e);e.parent.children.splice(a+1,0,n)}else{var r=new Ui(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 a=this.children[r],L=a.chunkSize();if(e<L){var z=Math.min(t,L-e);if(a.iterN(e,z,n))return!0;if((t-=z)==0)break;e=0}else e-=L}}};var Bi=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};Bi.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Ot(n);if(r==null||!t)return;for(var a=0;a<t.length;++a)t[a]==this&&t.splice(a--,1);t.length||(n.widgets=null);var L=Ti(this);Tt(n,Math.max(0,n.height-L)),e&&(vn(e,function(){as(e,n,-L),Fn(e,r,"widget")}),pr(e,"lineWidgetCleared",e,this,r))},Bi.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var a=Ti(this)-t;if(!a)return;rn(this.doc,r)||Tt(r,r.height+a),n&&vn(n,function(){n.curOp.forceUpdate=!0,as(n,r,a),pr(n,"lineWidgetChanged",n,e,Ot(r))})},be(Bi);function as(e,t,n){En(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&ka(e,n)}function xl(e,t,n,r){var a=new Bi(e,n,r),L=e.cm;return L&&a.noHScroll&&(L.display.alignWidgets=!0),Ii(e,t,"widget",function(z){var Q=z.widgets||(z.widgets=[]);if(a.insertAt==null?Q.push(a):Q.splice(Math.min(Q.length-1,Math.max(0,a.insertAt)),0,a),a.line=z,L&&!rn(e,z)){var ee=En(z)<e.scrollTop;Tt(z,z.height+Ti(a)),ee&&ka(L,a.height),L.curOp.forceUpdate=!0}return!0}),L&&pr(L,"lineWidgetAdded",L,a,typeof t=="number"?t:Ot(t)),a}var os=0,zn=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++os};zn.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&ei(e),pe(this,"clear")){var n=this.find();n&&pr(this,"clear",n.from,n.to)}for(var r=null,a=null,L=0;L<this.lines.length;++L){var z=this.lines[L],Q=Zt(z.markedSpans,this);e&&!this.collapsed?Fn(e,Ot(z),"text"):e&&(Q.to!=null&&(a=Ot(z)),Q.from!=null&&(r=Ot(z))),z.markedSpans=sr(z.markedSpans,Q),Q.from==null&&this.collapsed&&!rn(this.doc,z)&&e&&Tt(z,oi(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var ee=0;ee<this.lines.length;++ee){var se=Xr(this.lines[ee]),Ce=Rn(se);Ce>e.display.maxLineLength&&(e.display.maxLine=se,e.display.maxLineLength=Ce,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&sn(e,r,a+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&$o(e.doc)),e&&pr(e,"markerCleared",e,this,r,a),t&&ti(e),this.parent&&this.parent.clear()},zn.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,a=0;a<this.lines.length;++a){var L=this.lines[a],z=Zt(L.markedSpans,this);if(z.from!=null&&(n=et(t?L:Ot(L),z.from),e==-1))return n;if(z.to!=null&&(r=et(t?L:Ot(L),z.to),e==1))return r}return n&&{from:n,to:r}},zn.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;vn(r,function(){var a=t.line,L=Ot(t.line),z=Ea(r,L);if(z&&(uo(z),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!rn(n.doc,a)&&n.height!=null){var Q=n.height;n.height=null;var ee=Ti(n)-Q;ee&&Tt(a,a.height+ee)}pr(r,"markerChanged",r,e)})},zn.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ue(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},zn.prototype.detachLine=function(e){if(this.lines.splice(ue(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},be(zn);function mi(e,t,n,r,a){if(r&&r.shared)return Cl(e,t,n,r,a);if(e.cm&&!e.cm.curOp)return Kr(e.cm,mi)(e,t,n,r,a);var L=new zn(e,a),z=Ct(t,n);if(r&&N(r,L,!1),z>0||z==0&&L.clearWhenEmpty!==!1)return L;if(L.replacedWith&&(L.collapsed=!0,L.widgetNode=g("span",[L.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||L.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(L.widgetNode.insertLeft=!0)),L.collapsed){if(_r(e,t.line,t,n,L)||t.line!=n.line&&_r(e,n.line,t,n,L))throw new Error("Inserting collapsed marker partially overlapping an existing one");jt()}L.addToHistory&&Ho(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var Q=t.line,ee=e.cm,se;if(e.iter(Q,n.line+1,function(Oe){ee&&L.collapsed&&!ee.options.lineWrapping&&Xr(Oe)==ee.display.maxLine&&(se=!0),L.collapsed&&Q!=t.line&&Tt(Oe,0),qt(Oe,new Xt(L,Q==t.line?t.ch:null,Q==n.line?n.ch:null)),++Q}),L.collapsed&&e.iter(t.line,n.line+1,function(Oe){rn(e,Oe)&&Tt(Oe,0)}),L.clearOnEnter&&Le(L,"beforeCursorEnter",function(){return L.clear()}),L.readOnly&&(Jt(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),L.collapsed&&(L.id=++os,L.atomic=!0),ee){if(se&&(ee.curOp.updateMaxLine=!0),L.collapsed)sn(ee,t.line,n.line+1);else if(L.className||L.startStyle||L.endStyle||L.css||L.attributes||L.title)for(var Ce=t.line;Ce<=n.line;Ce++)Fn(ee,Ce,"text");L.atomic&&$o(ee.doc),pr(ee,"markerAdded",ee,L)}return L}var Fi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};Fi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();pr(this,"clear")},Fi.prototype.find=function(e,t){return this.primary.find(e,t)},be(Fi);function Cl(e,t,n,r,a){r=N(r),r.shared=!1;var L=[mi(e,t,n,r,a)],z=L[0],Q=r.widgetNode;return Kn(e,function(ee){Q&&(r.widgetNode=Q.cloneNode(!0)),L.push(mi(ee,p(ee,t),p(ee,n),r,a));for(var se=0;se<ee.linked.length;++se)if(ee.linked[se].isParent)return;z=q(L)}),new Fi(L,z)}function ss(e){return e.findMarks(et(e.first,0),e.clipPos(et(e.lastLine())),function(t){return t.parent})}function Sl(e,t){for(var n=0;n<t.length;n++){var r=t[n],a=r.find(),L=e.clipPos(a.from),z=e.clipPos(a.to);if(Ct(L,z)){var Q=mi(e,L,z,r.primary,r.primary.type);r.markers.push(Q),Q.parent=r}}}function Tl(e){for(var t=function(r){var a=e[r],L=[a.primary.doc];Kn(a.primary.doc,function(ee){return L.push(ee)});for(var z=0;z<a.markers.length;z++){var Q=a.markers[z];ue(L,Q.doc)==-1&&(Q.parent=null,a.markers.splice(z--,1))}},n=0;n<e.length;n++)t(n)}var wl=0,ln=function(e,t,n,r,a){if(!(this instanceof ln))return new ln(e,t,n,r,a);n==null&&(n=0),Ui.call(this,[new Ni([new fn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var L=et(n,0);this.sel=Wn(L),this.history=new na(null),this.id=++wl,this.modeOption=t,this.lineSep=r,this.direction=a=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),ja(this,{from:L,to:L,text:e}),Qr(this,Wn(L),_e)};ln.prototype=Se(Ui.prototype,{constructor:ln,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=$t(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:zr(function(e){var t=et(this.first,0),n=this.first+this.size-1;fi(this,{from:t,to:et(n,ut(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Ai(this.cm,0,0),Qr(this,Wn(t),_e)}),replaceRange:function(e,t,n,r){t=p(this,t),n=n?p(this,n):t,pi(this,e,t,n,r)},getRange:function(e,t,n){var r=or(this,p(this,e),p(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(ir(this,e))return ut(this,e)},getLineNumber:function(e){return Ot(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=ut(this,e)),Xr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return p(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:zr(function(e,t,n){Vo(this,p(this,typeof e=="number"?et(e,t||0):e),null,n)}),setSelection:zr(function(e,t,n){Vo(this,p(this,e),p(this,t||e),n)}),extendSelection:zr(function(e,t,n){aa(this,p(this,e),t&&p(this,t),n)}),extendSelections:zr(function(e,t){Go(this,K(this,e),t)}),extendSelectionsBy:zr(function(e,t){var n=re(this.sel.ranges,e);Go(this,K(this,n),t)}),setSelections:zr(function(e,t,n){if(!e.length)return;for(var r=[],a=0;a<e.length;a++)r[a]=new yr(p(this,e[a].anchor),p(this,e[a].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Qr(this,wn(this.cm,r,t),n)}),addSelection:zr(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new yr(p(this,e),p(this,t||e))),Qr(this,wn(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var a=or(this,t[r].from(),t[r].to());n=n?n.concat(a):a}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var a=or(this,n[r].from(),n[r].to());e!==!1&&(a=a.join(e||this.lineSeparator())),t[r]=a}return t},replaceSelection:function(e,t,n){for(var r=[],a=0;a<this.sel.ranges.length;a++)r[a]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:zr(function(e,t,n){for(var r=[],a=this.sel,L=0;L<a.ranges.length;L++){var z=a.ranges[L];r[L]={from:z.from(),to:z.to(),text:this.splitLines(e[L]),origin:n}}for(var Q=t&&t!="end"&&hl(this,r,t),ee=r.length-1;ee>=0;ee--)fi(this,r[ee]);Q?Xo(this,Q):this.cm&&ui(this.cm)}),undo:zr(function(){la(this,"undo")}),redo:zr(function(){la(this,"redo")}),undoSelection:zr(function(){la(this,"undo",!0)}),redoSelection:zr(function(){la(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 a=0;a<e.undone.length;a++)e.undone[a].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new na(this.history.maxGeneration),Kn(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:ci(this.history.done),undone:ci(this.history.undone)}},setHistory:function(e){var t=this.history=new na(this.history.maxGeneration);t.done=ci(e.done.slice(0),null,!0),t.undone=ci(e.undone.slice(0),null,!0)},setGutterMarker:zr(function(e,t,n){return Ii(this,e,"gutter",function(r){var a=r.gutterMarkers||(r.gutterMarkers={});return a[t]=n,!n&&Ue(a)&&(r.gutterMarkers=null),!0})}),clearGutter:zr(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&Ii(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Ue(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!ir(this,e))return null;if(t=e,e=ut(this,e),!e)return null}else if(t=Ot(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:zr(function(e,t,n){return Ii(this,e,t=="gutter"?"gutter":"class",function(r){var a=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[a])r[a]=n;else{if(x(n).test(r[a]))return!1;r[a]+=" "+n}return!0})}),removeLineClass:zr(function(e,t,n){return Ii(this,e,t=="gutter"?"gutter":"class",function(r){var a=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",L=r[a];if(L)if(n==null)r[a]=null;else{var z=L.match(x(n));if(!z)return!1;var Q=z.index+z[0].length;r[a]=L.slice(0,z.index)+(!z.index||Q==L.length?"":" ")+L.slice(Q)||null}else return!1;return!0})}),addLineWidget:zr(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return mi(this,p(this,e),p(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=p(this,e),mi(this,e,e,n,"bookmark")},findMarksAt:function(e){e=p(this,e);var t=[],n=ut(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var a=n[r];(a.from==null||a.from<=e.ch)&&(a.to==null||a.to>=e.ch)&&t.push(a.marker.parent||a.marker)}return t},findMarks:function(e,t,n){e=p(this,e),t=p(this,t);var r=[],a=e.line;return this.iter(e.line,t.line+1,function(L){var z=L.markedSpans;if(z)for(var Q=0;Q<z.length;Q++){var ee=z[Q];!(ee.to!=null&&a==e.line&&e.ch>=ee.to||ee.from==null&&a!=e.line||ee.from!=null&&a==t.line&&ee.from>=t.ch)&&(!n||n(ee.marker))&&r.push(ee.marker.parent||ee.marker)}++a}),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(a){var L=a.text.length+r;if(L>e)return t=e,!0;e-=L,++n}),p(this,et(n,t))},indexFromPos:function(e){e=p(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 ln($t(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 ln($t(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}],Sl(r,ss(this)),r},unlinkDoc:function(e){if(e instanceof Lr&&(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(ss(this));break}if(e.history==this.history){var r=[e.id];Kn(e,function(a){return r.push(a.id)},!0),e.history=new na(null),e.history.done=ci(this.history.done,r),e.history.undone=ci(this.history.undone,r)}},iterLinkedDocs:function(e){Kn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):ct(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:zr(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)})}),ln.prototype.eachLine=ln.prototype.iter;var ls=0;function _l(e){var t=this;if(us(t),je(t,e)||kn(t.display,e))return;te(e),j&&(ls=+new Date);var n=Jn(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var a=r.length,L=Array(a),z=0,Q=function(){++z==a&&Kr(t,function(){n=p(t.doc,n);var Ie={from:n,to:n,text:t.doc.splitLines(L.filter(function(Ye){return Ye!=null}).join(t.doc.lineSeparator())),origin:"paste"};fi(t.doc,Ie),Xo(t.doc,Wn(p(t.doc,n),p(t.doc,Hn(Ie))))})()},ee=function(Ie,Ye){if(t.options.allowDropFileTypes&&ue(t.options.allowDropFileTypes,Ie.type)==-1){Q();return}var tt=new FileReader;tt.onerror=function(){return Q()},tt.onload=function(){var mt=tt.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(mt)){Q();return}L[Ye]=mt,Q()},tt.readAsText(Ie)},se=0;se<r.length;se++)ee(r[se],se);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var Ce=e.dataTransfer.getData("Text");if(Ce){var Oe;if(t.state.draggingText&&!t.state.draggingText.copy&&(Oe=t.listSelections()),oa(t.doc,Wn(n,n)),Oe)for(var Be=0;Be<Oe.length;++Be)pi(t.doc,"",Oe[Be].anchor,Oe[Be].head,"drag");t.replaceSelection(Ce,"around","paste"),t.display.input.focus()}}catch(Ie){}}}function Al(e,t){if(j&&(!e.state.draggingText||+new Date-ls<100)){ye(t);return}if(je(e,t)||kn(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!P){var n=i("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=Jn(e,t);if(!n)return;var r=document.createDocumentFragment();xo(e,n,r),e.display.dragCursor||(e.display.dragCursor=i("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),o(e.display.dragCursor,r)}function us(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ds(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var a=t[r].CodeMirror;a&&n.push(a)}n.length&&n[0].operation(function(){for(var L=0;L<n.length;L++)e(n[L])})}var cs=!1;function Ll(){if(cs)return;Dl(),cs=!0}function Dl(){var e;Le(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ds(Rl)},100))}),Le(window,"blur",function(){return ds(li)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Gn={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"},ji=0;ji<10;ji++)Gn[ji+48]=Gn[ji+96]=String(ji);for(var ua=65;ua<=90;ua++)Gn[ua]=String.fromCharCode(ua);for(var Wi=1;Wi<=12;Wi++)Gn[Wi+111]=Gn[Wi+63235]="F"+Wi;var Pn={};Pn.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"},Pn.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"},Pn.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"},Pn.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"]},Pn.default=u?Pn.macDefault:Pn.pcDefault;function kl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,a,L,z=0;z<t.length-1;z++){var Q=t[z];if(/^(cmd|meta|m)$/i.test(Q))L=!0;else if(/^a(lt)?$/i.test(Q))n=!0;else if(/^(c|ctrl|control)$/i.test(Q))r=!0;else if(/^s(hift)?$/i.test(Q))a=!0;else throw new Error("Unrecognized modifier name: "+Q)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),L&&(e="Cmd-"+e),a&&(e="Shift-"+e),e}function Pl(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 a=re(n.split(" "),kl),L=0;L<a.length;L++){var z=void 0,Q=void 0;L==a.length-1?(Q=a.join(" "),z=r):(Q=a.slice(0,L+1).join(" "),z="...");var ee=t[Q];if(!ee)t[Q]=z;else if(ee!=z)throw new Error("Inconsistent bindings for "+Q)}delete e[n]}for(var se in t)e[se]=t[se];return e}function gi(e,t,n,r){t=da(t);var a=t.call?t.call(e,r):t[e];if(a===!1)return"nothing";if(a==="...")return"multi";if(a!=null&&n(a))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return gi(e,t.fallthrough,n,r);for(var L=0;L<t.fallthrough.length;L++){var z=gi(e,t.fallthrough[L],n,r);if(z)return z}}}function hs(e){var t=typeof e=="string"?e:Gn[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function fs(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 ps(e,t){if(A&&e.keyCode==34&&e.char)return!1;var n=Gn[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),fs(n,e,t))}function da(e){return typeof e=="string"?Pn[e]:e}function vi(e,t){for(var n=e.doc.sel.ranges,r=[],a=0;a<n.length;a++){for(var L=t(n[a]);r.length&&Ct(L.from,q(r).to)<=0;){var z=r.pop();if(Ct(z.from,L.from)<0){L.from=z.from;break}}r.push(L)}vn(e,function(){for(var Q=r.length-1;Q>=0;Q--)pi(e.doc,"",r[Q].from,r[Q].to,"+delete");ui(e)})}function za(e,t,n){var r=Ne(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ga(e,t,n){var r=za(e,t.ch,n);return r==null?null:new et(t.line,r,n<0?"after":"before")}function Va(e,t,n,r,a){if(e){t.doc.direction=="rtl"&&(a=-a);var L=ft(n,t.doc.direction);if(L){var z=a<0?q(L):L[0],Q=a<0==(z.level==1),ee=Q?"after":"before",se;if(z.level>0||t.doc.direction=="rtl"){var Ce=ai(t,n);se=a<0?n.text.length-1:0;var Oe=Ln(t,Ce,se).top;se=qe(function(Be){return Ln(t,Ce,Be).top==Oe},a<0==(z.level==1)?z.from:z.to-1,se),ee=="before"&&(se=za(n,se,1))}else se=a<0?z.to:z.from;return new et(r,se,ee)}}return new et(r,a<0?n.text.length:0,a<0?"before":"after")}function Ml(e,t,n,r){var a=ft(t,e.doc.direction);if(!a)return Ga(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 L=rt(a,n.ch,n.sticky),z=a[L];if(e.doc.direction=="ltr"&&z.level%2==0&&(r>0?z.to>n.ch:z.from<n.ch))return Ga(t,n,r);var Q=function(vt,At){return za(t,vt instanceof et?vt.ch:vt,At)},ee,se=function(vt){return e.options.lineWrapping?(ee=ee||ai(e,t),vo(e,t,ee,vt)):{begin:0,end:t.text.length}},Ce=se(n.sticky=="before"?Q(n,-1):n.ch);if(e.doc.direction=="rtl"||z.level==1){var Oe=z.level==1==r<0,Be=Q(n,Oe?1:-1);if(Be!=null&&(Oe?Be<=z.to&&Be<=Ce.end:Be>=z.from&&Be>=Ce.begin)){var Ie=Oe?"before":"after";return new et(n.line,Be,Ie)}}var Ye=function(vt,At,yt){for(var Lt=function(Ar,Gr){return Gr?new et(n.line,Q(Ar,1),"before"):new et(n.line,Ar,"after")};vt>=0&&vt<a.length;vt+=At){var Kt=a[vt],Ft=At>0==(Kt.level!=1),rr=Ft?yt.begin:Q(yt.end,-1);if(Kt.from<=rr&&rr<Kt.to)return Lt(rr,Ft);if(rr=Ft?Kt.from:Q(Kt.to,-1),yt.begin<=rr&&rr<yt.end)return Lt(rr,Ft)}},tt=Ye(L+r,r,Ce);if(tt)return tt;var mt=r>0?Ce.end:Q(Ce.begin,-1);return mt!=null&&!(r>0&&mt==t.text.length)&&(tt=Ye(r>0?0:a.length-1,r,se(mt)),tt)?tt:null}var Hi={selectAll:Qo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),_e)},killLine:function(e){return vi(e,function(t){if(t.empty()){var n=ut(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:et(t.head.line+1,0)}:{from:t.head,to:et(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return vi(e,function(t){return{from:et(t.from().line,0),to:p(e.doc,et(t.to().line+1,0))}})},delLineLeft:function(e){return vi(e,function(t){return{from:et(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return vi(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 vi(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(et(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(et(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return ms(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return gs(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},ne)},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")},ne)},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/)?gs(e,t.head):r},ne)},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,a=0;a<n.length;a++){var L=n[a].from(),z=J(e.getLine(L.line),L.ch,r);t.push(le(r-z%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return vn(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var a=t[r].head,L=ut(e.doc,a.line).text;if(L){if(a.ch==L.length&&(a=new et(a.line,a.ch-1)),a.ch>0)a=new et(a.line,a.ch+1),e.replaceRange(L.charAt(a.ch-1)+L.charAt(a.ch-2),et(a.line,a.ch-2),a,"+transpose");else if(a.line>e.doc.first){var z=ut(e.doc,a.line-1).text;z&&(a=new et(a.line,1),e.replaceRange(L.charAt(0)+e.doc.lineSeparator()+z.charAt(z.length-1),et(a.line-1,z.length-1),a,"+transpose"))}}n.push(new yr(a,a))}e.setSelections(n)})},newlineAndIndent:function(e){return vn(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);ui(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ms(e,t){var n=ut(e.doc,t),r=Xr(n);return r!=n&&(t=Ot(r)),Va(!0,e,r,t,1)}function Il(e,t){var n=ut(e.doc,t),r=vr(n);return r!=n&&(t=Ot(r)),Va(!0,e,n,t,-1)}function gs(e,t){var n=ms(e,t.line),r=ut(e.doc,n.line),a=ft(r,e.doc.direction);if(!a||a[0].level==0){var L=Math.max(n.ch,r.text.search(/\S/)),z=t.line==n.line&&t.ch<=L&&t.ch;return et(n.line,z?0:L,n.sticky)}return n}function ca(e,t,n){if(typeof t=="string"&&(t=Hi[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,a=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),a=t(e)!=Te}finally{e.display.shift=r,e.state.suppressEdits=!1}return a}function Nl(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var a=gi(t,e.state.keyMaps[r],n,e);if(a)return a}return e.options.extraKeys&&gi(t,e.options.extraKeys,n,e)||gi(t,e.options.keyMap,n,e)}var Ul=new ae;function Ki(e,t,n,r){var a=e.state.keySeq;if(a){if(hs(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ul.set(50,function(){e.state.keySeq==a&&(e.state.keySeq=null,e.display.input.reset())}),vs(e,a+" "+t,n,r))return!0}return vs(e,t,n,r)}function vs(e,t,n,r){var a=Nl(e,t,r);return a=="multi"&&(e.state.keySeq=t),a=="handled"&&pr(e,"keyHandled",e,t,n),(a=="handled"||a=="multi")&&(te(n),La(e)),!!a}function ys(e,t){var n=ps(t,!0);return n?t.shiftKey&&!e.state.keySeq?Ki(e,"Shift-"+n,t,function(r){return ca(e,r,!0)})||Ki(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return ca(e,r)}):Ki(e,n,t,function(r){return ca(e,r)}):!1}function Bl(e,t,n){return Ki(e,"'"+n+"'",t,function(r){return ca(e,r,!0)})}var Xa=null;function bs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=I(),je(t,e))return;j&&B<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=ys(t,e);A&&(Xa=r?n:null,!r&&n==88&&!Dt&&(u?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),R&&!u&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Fl(t)}function Fl(e){var t=e.display.lineDiv;F(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(d(t,"CodeMirror-crosshair"),Ke(document,"keyup",n),Ke(document,"mouseover",n))}Le(document,"keyup",n),Le(document,"mouseover",n)}function Es(e){e.keyCode==16&&(this.doc.sel.shift=!1),je(this,e)}function xs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(kn(t.display,e)||je(t,e)||e.ctrlKey&&!e.altKey||u&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(A&&n==Xa){Xa=null,te(e);return}if(A&&(!e.which||e.which<10)&&ys(t,e))return;var a=String.fromCharCode(r==null?n:r);if(a=="\b")return;if(Bl(t,e,a))return;t.display.input.onKeyPress(e)}var jl=400,Ya=function(e,t,n){this.time=e,this.pos=t,this.button=n};Ya.prototype.compare=function(e,t,n){return this.time+jl>e&&Ct(t,this.pos)==0&&n==this.button};var zi,Gi;function Wl(e,t){var n=+new Date;return Gi&&Gi.compare(n,e,t)?(zi=Gi=null,"triple"):zi&&zi.compare(n,e,t)?(Gi=new Ya(n,e,t),zi=null,"double"):(zi=new Ya(n,e,t),Gi=null,"single")}function Cs(e){var t=this,n=t.display;if(je(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,kn(n,e)){k||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if($a(t,e))return;var r=Jn(t,e),a=we(e),L=r?Wl(r,a):"single";if(window.focus(),a==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,a,r,L,e))return;a==1?r?zl(t,r,L,e):De(e)==n.scroller&&te(e):a==2?(r&&aa(t.doc,r),setTimeout(function(){return n.input.focus()},20)):a==3&&(_?t.display.input.onContextMenu(e):So(t))}function Hl(e,t,n,r,a){var L="Click";return r=="double"?L="Double"+L:r=="triple"&&(L="Triple"+L),L=(t==1?"Left":t==2?"Middle":"Right")+L,Ki(e,fs(L,a),a,function(z){if(typeof z=="string"&&(z=Hi[z]),!z)return!1;var Q=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Q=z(e,n)!=Te}finally{e.state.suppressEdits=!1}return Q})}function Kl(e,t,n){var r=e.getOption("configureMouse"),a=r?r(e,t,n):{};if(a.unit==null){var L=f?n.shiftKey&&n.metaKey:n.altKey;a.unit=L?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(a.extend==null||e.doc.extend)&&(a.extend=e.doc.extend||n.shiftKey),a.addNew==null&&(a.addNew=u?n.metaKey:n.ctrlKey),a.moveOnDrag==null&&(a.moveOnDrag=!(u?n.altKey:n.ctrlKey)),a}function zl(e,t,n,r){j?setTimeout(M(Co,e),0):e.curOp.focus=I();var a=Kl(e,n,r),L=e.doc.sel,z;e.options.dragDrop&&We&&!e.isReadOnly()&&n=="single"&&(z=L.contains(t))>-1&&(Ct((z=L.ranges[z]).from(),t)<0||t.xRel>0)&&(Ct(z.to(),t)>0||t.xRel<0)?Gl(e,r,t,a):Vl(e,r,t,a)}function Gl(e,t,n,r){var a=e.display,L=!1,z=Kr(e,function(se){k&&(a.scroller.draggable=!1),e.state.draggingText=!1,Ke(a.wrapper.ownerDocument,"mouseup",z),Ke(a.wrapper.ownerDocument,"mousemove",Q),Ke(a.scroller,"dragstart",ee),Ke(a.scroller,"drop",z),L||(te(se),r.addNew||aa(e.doc,n,null,null,r.extend),k&&!P||j&&B==9?setTimeout(function(){a.wrapper.ownerDocument.body.focus({preventScroll:!0}),a.input.focus()},20):a.input.focus())}),Q=function(se){L=L||Math.abs(t.clientX-se.clientX)+Math.abs(t.clientY-se.clientY)>=10},ee=function(){return L=!0};k&&(a.scroller.draggable=!0),e.state.draggingText=z,z.copy=!r.moveOnDrag,a.scroller.dragDrop&&a.scroller.dragDrop(),Le(a.wrapper.ownerDocument,"mouseup",z),Le(a.wrapper.ownerDocument,"mousemove",Q),Le(a.scroller,"dragstart",ee),Le(a.scroller,"drop",z),So(e),setTimeout(function(){return a.input.focus()},20)}function Ss(e,t,n){if(n=="char")return new yr(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new yr(et(t.line,0),p(e.doc,et(t.line+1,0)));var r=n(e,t);return new yr(r.from,r.to)}function Vl(e,t,n,r){var a=e.display,L=e.doc;te(t);var z,Q,ee=L.sel,se=ee.ranges;if(r.addNew&&!r.extend?(Q=L.sel.contains(n),Q>-1?z=se[Q]:z=new yr(n,n)):(z=L.sel.primary(),Q=L.sel.primIndex),r.unit=="rectangle")r.addNew||(z=new yr(n,n)),n=Jn(e,t,!0,!0),Q=-1;else{var Ce=Ss(e,n,r.unit);r.extend?z=Ha(z,Ce.anchor,Ce.head,r.extend):z=Ce}r.addNew?Q==-1?(Q=se.length,Qr(L,wn(e,se.concat([z]),Q),{scroll:!1,origin:"*mouse"})):se.length>1&&se[Q].empty()&&r.unit=="char"&&!r.extend?(Qr(L,wn(e,se.slice(0,Q).concat(se.slice(Q+1)),0),{scroll:!1,origin:"*mouse"}),ee=L.sel):Ka(L,Q,z,fe):(Q=0,Qr(L,new Cn([z],0),fe),ee=L.sel);var Oe=n;function Be(yt){if(Ct(Oe,yt)==0)return;if(Oe=yt,r.unit=="rectangle"){for(var Lt=[],Kt=e.options.tabSize,Ft=J(ut(L,n.line).text,n.ch,Kt),rr=J(ut(L,yt.line).text,yt.ch,Kt),Ar=Math.min(Ft,rr),Gr=Math.max(Ft,rr),kr=Math.min(n.line,yt.line),yn=Math.min(e.lastLine(),Math.max(n.line,yt.line));kr<=yn;kr++){var un=ut(L,kr).text,Ur=me(un,Ar,Kt);Ar==Gr?Lt.push(new yr(et(kr,Ur),et(kr,Ur))):un.length>Ur&&Lt.push(new yr(et(kr,Ur),et(kr,me(un,Gr,Kt))))}Lt.length||Lt.push(new yr(n,n)),Qr(L,wn(e,ee.ranges.slice(0,Q).concat(Lt),Q),{origin:"*mouse",scroll:!1}),e.scrollIntoView(yt)}else{var dn=z,$r=Ss(e,yt,r.unit),jr=dn.anchor,Br;Ct($r.anchor,jr)>0?(Br=$r.head,jr=Cr(dn.from(),$r.anchor)):(Br=$r.anchor,jr=mr(dn.to(),$r.head));var Pr=ee.ranges.slice(0);Pr[Q]=Xl(e,new yr(p(L,jr),Br)),Qr(L,wn(e,Pr,Q),fe)}}var Ie=a.wrapper.getBoundingClientRect(),Ye=0;function tt(yt){var Lt=++Ye,Kt=Jn(e,yt,!0,r.unit=="rectangle");if(!Kt)return;if(Ct(Kt,Oe)!=0){e.curOp.focus=I(),Be(Kt);var Ft=qi(a,L);(Kt.line>=Ft.to||Kt.line<Ft.from)&&setTimeout(Kr(e,function(){Ye==Lt&&tt(yt)}),150)}else{var rr=yt.clientY<Ie.top?-20:yt.clientY>Ie.bottom?20:0;rr&&setTimeout(Kr(e,function(){if(Ye!=Lt)return;a.scroller.scrollTop+=rr,tt(yt)}),50)}}function mt(yt){e.state.selectingText=!1,Ye=Infinity,yt&&(te(yt),a.input.focus()),Ke(a.wrapper.ownerDocument,"mousemove",vt),Ke(a.wrapper.ownerDocument,"mouseup",At),L.history.lastSelOrigin=null}var vt=Kr(e,function(yt){yt.buttons===0||!we(yt)?mt(yt):tt(yt)}),At=Kr(e,mt);e.state.selectingText=At,Le(a.wrapper.ownerDocument,"mousemove",vt),Le(a.wrapper.ownerDocument,"mouseup",At)}function Xl(e,t){var n=t.anchor,r=t.head,a=ut(e.doc,n.line);if(Ct(n,r)==0&&n.sticky==r.sticky)return t;var L=ft(a);if(!L)return t;var z=rt(L,n.ch,n.sticky),Q=L[z];if(Q.from!=n.ch&&Q.to!=n.ch)return t;var ee=z+(Q.from==n.ch==(Q.level!=1)?0:1);if(ee==0||ee==L.length)return t;var se;if(r.line!=n.line)se=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var Ce=rt(L,r.ch,r.sticky),Oe=Ce-z||(r.ch-n.ch)*(Q.level==1?-1:1);Ce==ee-1||Ce==ee?se=Oe<0:se=Oe>0}var Be=L[ee+(se?-1:0)],Ie=se==(Be.level==1),Ye=Ie?Be.from:Be.to,tt=Ie?"after":"before";return n.ch==Ye&&n.sticky==tt?t:new yr(new et(n.line,Ye,tt),r)}function Ts(e,t,n,r){var a,L;if(t.touches)a=t.touches[0].clientX,L=t.touches[0].clientY;else try{a=t.clientX,L=t.clientY}catch(Be){return!1}if(a>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&te(t);var z=e.display,Q=z.lineDiv.getBoundingClientRect();if(L>Q.bottom||!pe(e,n))return he(t);L-=Q.top-z.viewOffset;for(var ee=0;ee<e.display.gutterSpecs.length;++ee){var se=z.gutters.childNodes[ee];if(se&&se.getBoundingClientRect().right>=a){var Ce=Gt(e.doc,L),Oe=e.display.gutterSpecs[ee];return Me(e,n,e,Ce,Oe.className,t),he(t)}}}function $a(e,t){return Ts(e,t,"gutterClick",!0)}function ws(e,t){if(kn(e.display,t)||Yl(e,t))return;if(je(e,t,"contextmenu"))return;_||e.display.input.onContextMenu(t)}function Yl(e,t){return pe(e,"gutterContextMenu")?Ts(e,t,"gutterContextMenu",!1):!1}function _s(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),wi(e)}var yi={toString:function(){return"CodeMirror.Init"}},As={},ha={};function $l(e){var t=e.optionHandlers;function n(r,a,L,z){e.defaults[r]=a,L&&(t[r]=z?function(Q,ee,se){se!=yi&&L(Q,ee,se)}:L)}e.defineOption=n,e.Init=yi,n("value","",function(r,a){return r.setValue(a)},!0),n("mode",null,function(r,a){r.doc.modeOption=a,Fa(r)},!0),n("indentUnit",2,Fa,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){Pi(r),wi(r),sn(r)},!0),n("lineSeparator",null,function(r,a){if(r.doc.lineSep=a,!a)return;var L=[],z=r.doc.first;r.doc.iter(function(ee){for(var se=0;;){var Ce=ee.text.indexOf(a,se);if(Ce==-1)break;se=Ce+a.length,L.push(et(z,Ce))}z++});for(var Q=L.length-1;Q>=0;Q--)pi(r.doc,a,L[Q],et(L[Q].line,L[Q].ch+a.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,a,L){r.state.specialChars=new RegExp(a.source+(a.test(" ")?"":"| "),"g"),L!=yi&&r.refresh()}),n("specialCharPlaceholder",fr,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",s?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,a){return r.getInputField().spellcheck=a},!0),n("autocorrect",!1,function(r,a){return r.getInputField().autocorrect=a},!0),n("autocapitalize",!1,function(r,a){return r.getInputField().autocapitalize=a},!0),n("rtlMoveVisually",!C),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){_s(r),ki(r)},!0),n("keyMap","default",function(r,a,L){var z=da(a),Q=L!=yi&&da(L);Q&&Q.detach&&Q.detach(r,z),z.attach&&z.attach(r,Q||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Zl,!0),n("gutters",[],function(r,a){r.display.gutterSpecs=Ua(a,r.options.lineNumbers),ki(r)},!0),n("fixedGutter",!0,function(r,a){r.display.gutters.style.left=a?Aa(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return di(r)},!0),n("scrollbarStyle","native",function(r){Lo(r),di(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,a){r.display.gutterSpecs=Ua(r.options.gutters,a),ki(r)},!0),n("firstLineNumber",1,ki,!0),n("lineNumberFormatter",function(r){return r},ki,!0),n("showCursorWhenSelecting",!1,_i,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,a){a=="nocursor"&&(li(r),r.display.input.blur()),r.display.input.readOnlyChanged(a)}),n("screenReaderLabel",null,function(r,a){a=a===""?null:a,r.display.input.screenReaderLabelChanged(a)}),n("disableInput",!1,function(r,a){a||r.display.input.reset()},!0),n("dragDrop",!0,Jl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,_i,!0),n("singleCursorHeightPerLine",!0,_i,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Pi,!0),n("addModeClass",!1,Pi,!0),n("pollInterval",100),n("undoDepth",200,function(r,a){return r.doc.history.undoDepth=a}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,Pi,!0),n("moveInputWithCursor",!0,function(r,a){a||r.display.input.resetPosition()}),n("tabindex",null,function(r,a){return r.display.input.getField().tabIndex=a||""}),n("autofocus",null),n("direction","ltr",function(r,a){return r.doc.setDirection(a)},!0),n("phrases",null)}function Jl(e,t,n){var r=n&&n!=yi;if(!t!=!r){var a=e.display.dragFunctions,L=t?Le:Ke;L(e.display.scroller,"dragstart",a.start),L(e.display.scroller,"dragenter",a.enter),L(e.display.scroller,"dragover",a.over),L(e.display.scroller,"dragleave",a.leave),L(e.display.scroller,"drop",a.drop)}}function Zl(e){e.options.lineWrapping?(F(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(d(e.display.wrapper,"CodeMirror-wrap"),Nn(e)),Oa(e),sn(e),wi(e),setTimeout(function(){return di(e)},100)}function Lr(e,t){var n=this;if(!(this instanceof Lr))return new Lr(e,t);this.options=t=t?N(t):{},N(As,t,!1);var r=t.value;typeof r=="string"?r=new ln(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var a=new Lr.inputStyles[t.inputStyle](this),L=this.display=new dl(e,r,a,t);L.wrapper.CodeMirror=this,_s(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Lo(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 ae,keySeq:null,specialChars:null},t.autofocus&&!s&&L.input.focus(),j&&B<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Ql(this),Ll(),ei(this),this.curOp.forceUpdate=!0,Fo(this,r),t.autofocus&&!s||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Da(n)},20):li(this);for(var z in ha)ha.hasOwnProperty(z)&&ha[z](this,t[z],yi);ko(this),t.finishInit&&t.finishInit(this);for(var Q=0;Q<Ja.length;++Q)Ja[Q](this);ti(this),k&&t.lineWrapping&&getComputedStyle(L.lineDiv).textRendering=="optimizelegibility"&&(L.lineDiv.style.textRendering="auto")}Lr.defaults=As,Lr.optionHandlers=ha;function Ql(e){var t=e.display;Le(t.scroller,"mousedown",Kr(e,Cs)),j&&B<11?Le(t.scroller,"dblclick",Kr(e,function(ee){if(je(e,ee))return;var se=Jn(e,ee);if(!se||$a(e,ee)||kn(e.display,ee))return;te(ee);var Ce=e.findWordAt(se);aa(e.doc,Ce.anchor,Ce.head)})):Le(t.scroller,"dblclick",function(ee){return je(e,ee)||te(ee)}),Le(t.scroller,"contextmenu",function(ee){return ws(e,ee)}),Le(t.input.getField(),"contextmenu",function(ee){t.scroller.contains(ee.target)||ws(e,ee)});var n,r={end:0};function a(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function L(ee){if(ee.touches.length!=1)return!1;var se=ee.touches[0];return se.radiusX<=1&&se.radiusY<=1}function z(ee,se){if(se.left==null)return!0;var Ce=se.left-ee.left,Oe=se.top-ee.top;return Ce*Ce+Oe*Oe>20*20}Le(t.scroller,"touchstart",function(ee){if(!je(e,ee)&&!L(ee)&&!$a(e,ee)){t.input.ensurePolled(),clearTimeout(n);var se=+new Date;t.activeTouch={start:se,moved:!1,prev:se-r.end<=300?r:null},ee.touches.length==1&&(t.activeTouch.left=ee.touches[0].pageX,t.activeTouch.top=ee.touches[0].pageY)}}),Le(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Le(t.scroller,"touchend",function(ee){var se=t.activeTouch;if(se&&!kn(t,ee)&&se.left!=null&&!se.moved&&new Date-se.start<300){var Ce=e.coordsChar(t.activeTouch,"page"),Oe;!se.prev||z(se,se.prev)?Oe=new yr(Ce,Ce):!se.prev.prev||z(se,se.prev.prev)?Oe=e.findWordAt(Ce):Oe=new yr(et(Ce.line,0),p(e.doc,et(Ce.line+1,0))),e.setSelection(Oe.anchor,Oe.head),e.focus(),te(ee)}a()}),Le(t.scroller,"touchcancel",a),Le(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Oi(e,t.scroller.scrollTop),Qn(e,t.scroller.scrollLeft,!0),Me(e,"scroll",e))}),Le(t.scroller,"mousewheel",function(ee){return Io(e,ee)}),Le(t.scroller,"DOMMouseScroll",function(ee){return Io(e,ee)}),Le(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(ee){je(e,ee)||ye(ee)},over:function(ee){je(e,ee)||(Ol(e,ee),ye(ee))},start:function(ee){return Al(e,ee)},drop:Kr(e,_l),leave:function(ee){je(e,ee)||us(e)}};var Q=t.input.getField();Le(Q,"keyup",function(ee){return Es.call(e,ee)}),Le(Q,"keydown",Kr(e,bs)),Le(Q,"keypress",Kr(e,xs)),Le(Q,"focus",function(ee){return Da(e,ee)}),Le(Q,"blur",function(ee){return li(e,ee)})}var Ja=[];Lr.defineInitHook=function(e){return Ja.push(e)};function Vi(e,t,n,r){var a=e.doc,L;n==null&&(n="add"),n=="smart"&&(a.mode.indent?L=pt(e,t).state:n="prev");var z=e.options.tabSize,Q=ut(a,t),ee=J(Q.text,null,z);Q.stateAfter&&(Q.stateAfter=null);var se=Q.text.match(/^\s*/)[0],Ce;if(!r&&!/\S/.test(Q.text))Ce=0,n="not";else if(n=="smart"&&(Ce=a.mode.indent(L,Q.text.slice(se.length),Q.text),Ce==Te||Ce>150)){if(!r)return;n="prev"}n=="prev"?t>a.first?Ce=J(ut(a,t-1).text,null,z):Ce=0:n=="add"?Ce=ee+e.options.indentUnit:n=="subtract"?Ce=ee-e.options.indentUnit:typeof n=="number"&&(Ce=ee+n),Ce=Math.max(0,Ce);var Oe="",Be=0;if(e.options.indentWithTabs)for(var Ie=Math.floor(Ce/z);Ie;--Ie)Be+=z,Oe+=" ";if(Be<Ce&&(Oe+=le(Ce-Be)),Oe!=se)return pi(a,Oe,et(t,0),et(t,se.length),"+input"),Q.stateAfter=null,!0;for(var Ye=0;Ye<a.sel.ranges.length;Ye++){var tt=a.sel.ranges[Ye];if(tt.head.line==t&&tt.head.ch<se.length){var mt=et(t,se.length);Ka(a,Ye,new yr(mt,mt));break}}}var _n=null;function fa(e){_n=e}function Za(e,t,n,r,a){var L=e.doc;e.display.shift=!1,r||(r=L.sel);var z=+new Date-200,Q=a=="paste"||e.state.pasteIncoming>z,ee=ct(t),se=null;if(Q&&r.ranges.length>1)if(_n&&_n.text.join(`
|
|
`)==t){if(r.ranges.length%_n.text.length==0){se=[];for(var Ce=0;Ce<_n.text.length;Ce++)se.push(L.splitLines(_n.text[Ce]))}}else ee.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(se=re(ee,function(vt){return[vt]}));for(var Oe=e.curOp.updateInput,Be=r.ranges.length-1;Be>=0;Be--){var Ie=r.ranges[Be],Ye=Ie.from(),tt=Ie.to();Ie.empty()&&(n&&n>0?Ye=et(Ye.line,Ye.ch-n):e.state.overwrite&&!Q?tt=et(tt.line,Math.min(ut(L,tt.line).text.length,tt.ch+q(ee).length)):Q&&_n&&_n.lineWise&&_n.text.join(`
|
|
`)==ee.join(`
|
|
`)&&(Ye=tt=et(Ye.line,0)));var mt={from:Ye,to:tt,text:se?se[Be%se.length]:ee,origin:a||(Q?"paste":e.state.cutIncoming>z?"cut":"+input")};fi(e.doc,mt),pr(e,"inputRead",e,mt)}t&&!Q&&Ls(e,t),ui(e),e.curOp.updateInput<2&&(e.curOp.updateInput=Oe),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Os(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&vn(t,function(){return Za(t,n,0,null,"paste")}),!0}function Ls(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 a=n.ranges[r];if(a.head.ch>100||r&&n.ranges[r-1].head.line==a.head.line)continue;var L=e.getModeAt(a.head),z=!1;if(L.electricChars){for(var Q=0;Q<L.electricChars.length;Q++)if(t.indexOf(L.electricChars.charAt(Q))>-1){z=Vi(e,a.head.line,"smart");break}}else L.electricInput&&(L.electricInput.test(ut(e.doc,a.head.line).text.slice(0,a.head.ch))&&(z=Vi(e,a.head.line,"smart")));z&&pr(e,"electricInput",e,a.head.line)}}function Ds(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var a=e.doc.sel.ranges[r].head.line,L={anchor:et(a,0),head:et(a+1,0)};n.push(L),t.push(e.getRange(L.anchor,L.head))}return{text:t,ranges:n}}function Rs(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function ks(){var e=i("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=i("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return k?e.style.width="1000px":e.setAttribute("wrap","off"),b&&(e.style.border="1px solid black"),Rs(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,a){var L=this.options,z=L[r];if(L[r]==a&&r!="mode")return;L[r]=a,t.hasOwnProperty(r)&&Kr(this,t[r])(this,a,z),Me(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,a){this.state.keyMaps[a?"push":"unshift"](da(r))},removeKeyMap:function(r){for(var a=this.state.keyMaps,L=0;L<a.length;++L)if(a[L]==r||a[L].name==r)return a.splice(L,1),!0},addOverlay:nn(function(r,a){var L=r.token?r:e.getMode(this.options,r);if(L.startState)throw new Error("Overlays may not be stateful.");oe(this.state.overlays,{mode:L,modeSpec:r,opaque:a&&a.opaque,priority:a&&a.priority||0},function(z){return z.priority}),this.state.modeGen++,sn(this)}),removeOverlay:nn(function(r){for(var a=this.state.overlays,L=0;L<a.length;++L){var z=a[L].modeSpec;if(z==r||typeof r=="string"&&z.name==r){a.splice(L,1),this.state.modeGen++,sn(this);return}}}),indentLine:nn(function(r,a,L){typeof a!="string"&&typeof a!="number"&&(a==null?a=this.options.smartIndent?"smart":"prev":a=a?"add":"subtract"),ir(this.doc,r)&&Vi(this,r,a,L)}),indentSelection:nn(function(r){for(var a=this.doc.sel.ranges,L=-1,z=0;z<a.length;z++){var Q=a[z];if(Q.empty())Q.head.line>L&&(Vi(this,Q.head.line,r,!0),L=Q.head.line,z==this.doc.sel.primIndex&&ui(this));else{var ee=Q.from(),se=Q.to(),Ce=Math.max(L,ee.line);L=Math.min(this.lastLine(),se.line-(se.ch?0:1))+1;for(var Oe=Ce;Oe<L;++Oe)Vi(this,Oe,r);var Be=this.doc.sel.ranges;ee.ch==0&&a.length==Be.length&&Be[z].from().ch>0&&Ka(this.doc,z,new yr(ee,Be[z].to()),_e)}}}),getTokenAt:function(r,a){return hr(this,r,a)},getLineTokens:function(r,a){return hr(this,et(r),a,!0)},getTokenTypeAt:function(r){r=p(this.doc,r);var a=$e(this,ut(this.doc,r.line)),L=0,z=(a.length-1)/2,Q=r.ch,ee;if(Q==0)ee=a[2];else for(;;){var se=L+z>>1;if((se?a[se*2-1]:0)>=Q)z=se;else if(a[se*2+1]<Q)L=se+1;else{ee=a[se*2+2];break}}var Ce=ee?ee.indexOf("overlay "):-1;return Ce<0?ee:Ce==0?null:ee.slice(0,Ce-1)},getModeAt:function(r){var a=this.doc.mode;return a.innerMode?e.innerMode(a,this.getTokenAt(r).state).mode:a},getHelper:function(r,a){return this.getHelpers(r,a)[0]},getHelpers:function(r,a){var L=[];if(!n.hasOwnProperty(a))return L;var z=n[a],Q=this.getModeAt(r);if(typeof Q[a]=="string")z[Q[a]]&&L.push(z[Q[a]]);else if(Q[a])for(var ee=0;ee<Q[a].length;ee++){var se=z[Q[a][ee]];se&&L.push(se)}else Q.helperType&&z[Q.helperType]?L.push(z[Q.helperType]):z[Q.name]&&L.push(z[Q.name]);for(var Ce=0;Ce<z._global.length;Ce++){var Oe=z._global[Ce];Oe.pred(Q,this)&&ue(L,Oe.val)==-1&&L.push(Oe.val)}return L},getStateAfter:function(r,a){var L=this.doc;return r=H(L,r==null?L.first+L.size-1:r),pt(this,r+1,a).state},cursorCoords:function(r,a){var L,z=this.doc.sel.primary();return r==null?L=z.head:typeof r=="object"?L=p(this.doc,r):L=r?z.from():z.to(),Tn(this,L,a||"page")},charCoords:function(r,a){return Ca(this,p(this.doc,r),a||"page")},coordsChar:function(r,a){return r=po(this,r,a||"page"),Ta(this,r.left,r.top)},lineAtHeight:function(r,a){return r=po(this,{top:r,left:0},a||"page").top,Gt(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,a,L){var z=!1,Q;if(typeof r=="number"){var ee=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>ee&&(r=ee,z=!0),Q=ut(this.doc,r)}else Q=r;return $i(this,Q,{top:0,left:0},a||"page",L||z).top+(z?this.doc.height-En(Q):0)},defaultTextHeight:function(){return oi(this.display)},defaultCharWidth:function(){return si(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,a,L,z,Q){var ee=this.display;r=Tn(this,p(this.doc,r));var se=r.bottom,Ce=r.left;if(a.style.position="absolute",a.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(a),ee.sizer.appendChild(a),z=="over")se=r.top;else if(z=="above"||z=="near"){var Oe=Math.max(ee.wrapper.clientHeight,this.doc.height),Be=Math.max(ee.sizer.clientWidth,ee.lineSpace.clientWidth);(z=="above"||r.bottom+a.offsetHeight>Oe)&&r.top>a.offsetHeight?se=r.top-a.offsetHeight:r.bottom+a.offsetHeight<=Oe&&(se=r.bottom),Ce+a.offsetWidth>Be&&(Ce=Be-a.offsetWidth)}a.style.top=se+"px",a.style.left=a.style.right="",Q=="right"?(Ce=ee.sizer.clientWidth-a.offsetWidth,a.style.right="0px"):(Q=="left"?Ce=0:Q=="middle"&&(Ce=(ee.sizer.clientWidth-a.offsetWidth)/2),a.style.left=Ce+"px"),L&&Js(this,{left:Ce,top:se,right:Ce+a.offsetWidth,bottom:se+a.offsetHeight})},triggerOnKeyDown:nn(bs),triggerOnKeyPress:nn(xs),triggerOnKeyUp:Es,triggerOnMouseDown:nn(Cs),execCommand:function(r){if(Hi.hasOwnProperty(r))return Hi[r].call(null,this)},triggerElectric:nn(function(r){Ls(this,r)}),findPosH:function(r,a,L,z){var Q=1;a<0&&(Q=-1,a=-a);for(var ee=p(this.doc,r),se=0;se<a&&!(ee=Qa(this.doc,ee,Q,L,z),ee.hitSide);++se);return ee},moveH:nn(function(r,a){var L=this;this.extendSelectionsBy(function(z){return L.display.shift||L.doc.extend||z.empty()?Qa(L.doc,z.head,r,a,L.options.rtlMoveVisually):r<0?z.from():z.to()},ne)}),deleteH:nn(function(r,a){var L=this.doc.sel,z=this.doc;L.somethingSelected()?z.replaceSelection("",null,"+delete"):vi(this,function(Q){var ee=Qa(z,Q.head,r,a,!1);return r<0?{from:ee,to:Q.head}:{from:Q.head,to:ee}})}),findPosV:function(r,a,L,z){var Q=1,ee=z;a<0&&(Q=-1,a=-a);for(var se=p(this.doc,r),Ce=0;Ce<a;++Ce){var Oe=Tn(this,se,"div");if(ee==null?ee=Oe.left:Oe.left=ee,se=Ps(this,Oe,Q,L),se.hitSide)break}return se},moveV:nn(function(r,a){var L=this,z=this.doc,Q=[],ee=!this.display.shift&&!z.extend&&z.sel.somethingSelected();if(z.extendSelectionsBy(function(Ce){if(ee)return r<0?Ce.from():Ce.to();var Oe=Tn(L,Ce.head,"div");Ce.goalColumn!=null&&(Oe.left=Ce.goalColumn),Q.push(Oe.left);var Be=Ps(L,Oe,r,a);return a=="page"&&Ce==z.sel.primary()&&ka(L,Ca(L,Be,"div").top-Oe.top),Be},ne),Q.length)for(var se=0;se<z.sel.ranges.length;se++)z.sel.ranges[se].goalColumn=Q[se]}),findWordAt:function(r){var a=this.doc,L=ut(a,r.line).text,z=r.ch,Q=r.ch;if(L){var ee=this.getHelper(r,"wordChars");(r.sticky=="before"||Q==L.length)&&z?--z:++Q;for(var se=L.charAt(z),Ce=Pe(se,ee)?function(Oe){return Pe(Oe,ee)}:/\s/.test(se)?function(Oe){return/\s/.test(Oe)}:function(Oe){return!/\s/.test(Oe)&&!Pe(Oe)};z>0&&Ce(L.charAt(z-1));)--z;for(;Q<L.length&&Ce(L.charAt(Q));)++Q}return new yr(et(r.line,z),et(r.line,Q))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?F(this.display.cursorDiv,"CodeMirror-overwrite"):d(this.display.cursorDiv,"CodeMirror-overwrite"),Me(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==I()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:nn(function(r,a){Ai(this,r,a)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-On(this)-this.display.barHeight,width:r.scrollWidth-On(this)-this.display.barWidth,clientHeight:ba(this),clientWidth:Yn(this)}},scrollIntoView:nn(function(r,a){r==null?(r={from:this.doc.sel.primary().head,to:null},a==null&&(a=this.options.cursorScrollMargin)):typeof r=="number"?r={from:et(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=a||0,r.from.line!=null?Zs(this,r):wo(this,r.from,r.to,r.margin)}),setSize:nn(function(r,a){var L=this,z=function(ee){return typeof ee=="number"||/^\d+$/.test(String(ee))?ee+"px":ee};r!=null&&(this.display.wrapper.style.width=z(r)),a!=null&&(this.display.wrapper.style.height=z(a)),this.options.lineWrapping&&co(this);var Q=this.display.viewFrom;this.doc.iter(Q,this.display.viewTo,function(ee){if(ee.widgets){for(var se=0;se<ee.widgets.length;se++)if(ee.widgets[se].noHScroll){Fn(L,Q,"widget");break}}++Q}),this.curOp.forceUpdate=!0,Me(this,"refresh",this)}),operation:function(r){return vn(this,r)},startOperation:function(){return ei(this)},endOperation:function(){return ti(this)},refresh:nn(function(){var r=this.display.cachedTextHeight;sn(this),this.curOp.forceUpdate=!0,wi(this),Ai(this,this.doc.scrollLeft,this.doc.scrollTop),Ia(this.display),(r==null||Math.abs(r-oi(this.display))>.5||this.options.lineWrapping)&&Oa(this),Me(this,"refresh",this)}),swapDoc:nn(function(r){var a=this.doc;return a.cm=null,this.state.selectingText&&this.state.selectingText(),Fo(this,r),wi(this),this.display.input.reset(),Ai(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,pr(this,"swapDoc",this,a),a}),phrase:function(r){var a=this.options.phrases;return a&&Object.prototype.hasOwnProperty.call(a,r)?a[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}},be(e),e.registerHelper=function(r,a,L){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][a]=L},e.registerGlobalHelper=function(r,a,L,z){e.registerHelper(r,a,z),n[r]._global.push({pred:L,val:z})}}function Qa(e,t,n,r,a){var L=t,z=n,Q=ut(e,t.line),ee=a&&e.direction=="rtl"?-n:n;function se(){var At=t.line+ee;return At<e.first||At>=e.first+e.size?!1:(t=new et(At,t.ch,t.sticky),Q=ut(e,At))}function Ce(At){var yt;if(r=="codepoint"){var Lt=Q.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(Lt)?yt=null:yt=new et(t.line,Math.max(0,Math.min(Q.text.length,t.ch+n*(Lt>=55296&&Lt<56320?2:1))),-n)}else a?yt=Ml(e.cm,Q,t,n):yt=Ga(Q,t,n);if(yt==null)if(!At&&se())t=Va(a,e.cm,Q,t.line,ee);else return!1;else t=yt;return!0}if(r=="char"||r=="codepoint")Ce();else if(r=="column")Ce(!0);else if(r=="word"||r=="group")for(var Oe=null,Be=r=="group",Ie=e.cm&&e.cm.getHelper(t,"wordChars"),Ye=!0;!(n<0&&!Ce(!Ye));Ye=!1){var tt=Q.text.charAt(t.ch)||`
|
|
`,mt=Pe(tt,Ie)?"w":Be&&tt==`
|
|
`?"n":!Be||/\s/.test(tt)?null:"p";if(Be&&!Ye&&!mt&&(mt="s"),Oe&&Oe!=mt){n<0&&(n=1,Ce(),t.sticky="after");break}if(mt&&(Oe=mt),n>0&&!Ce(!Ye))break}var vt=sa(e,t,L,z,!0);return Ut(L,vt)&&(vt.hitSide=!0),vt}function Ps(e,t,n,r){var a=e.doc,L=t.left,z;if(r=="page"){var Q=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),ee=Math.max(Q-.5*oi(e.display),3);z=(n>0?t.bottom:t.top)+n*ee}else r=="line"&&(z=n>0?t.bottom+3:t.top-3);for(var se;!(se=Ta(e,L,z),!se.outside);){if(n<0?z<=0:z>=a.height){se.hitSide=!0;break}z+=n*5}return se}var xr=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ae,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};xr.prototype.init=function(e){var t=this,n=this,r=n.cm,a=n.div=e.lineDiv;Rs(a,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function L(Q){for(var ee=Q.target;ee;ee=ee.parentNode){if(ee==a)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(ee.className))break}return!1}Le(a,"paste",function(Q){if(!L(Q)||je(r,Q)||Os(Q,r))return;B<=11&&setTimeout(Kr(r,function(){return t.updateFromDOM()}),20)}),Le(a,"compositionstart",function(Q){t.composing={data:Q.data,done:!1}}),Le(a,"compositionupdate",function(Q){t.composing||(t.composing={data:Q.data,done:!1})}),Le(a,"compositionend",function(Q){t.composing&&(Q.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Le(a,"touchstart",function(){return n.forceCompositionEnd()}),Le(a,"input",function(){t.composing||t.readFromDOMSoon()});function z(Q){if(!L(Q)||je(r,Q))return;if(r.somethingSelected())fa({lineWise:!1,text:r.getSelections()}),Q.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var ee=Ds(r);fa({lineWise:!0,text:ee.text}),Q.type=="cut"&&r.operation(function(){r.setSelections(ee.ranges,0,_e),r.replaceSelection("",null,"cut")})}else return;if(Q.clipboardData){Q.clipboardData.clearData();var se=_n.text.join(`
|
|
`);if(Q.clipboardData.setData("Text",se),Q.clipboardData.getData("Text")==se){Q.preventDefault();return}}var Ce=ks(),Oe=Ce.firstChild;r.display.lineSpace.insertBefore(Ce,r.display.lineSpace.firstChild),Oe.value=_n.text.join(`
|
|
`);var Be=document.activeElement;V(Oe),setTimeout(function(){r.display.lineSpace.removeChild(Ce),Be.focus(),Be==a&&n.showPrimarySelection()},50)}Le(a,"copy",z),Le(a,"cut",z)},xr.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},xr.prototype.prepareSelection=function(){var e=Eo(this.cm,!1);return e.focus=document.activeElement==this.div,e},xr.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},xr.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},xr.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),a=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||a.line<t.display.viewFrom){e.removeAllRanges();return}var L=pa(t,e.anchorNode,e.anchorOffset),z=pa(t,e.focusNode,e.focusOffset);if(L&&!L.bad&&z&&!z.bad&&Ct(Cr(L,z),r)==0&&Ct(mr(L,z),a)==0)return;var Q=t.display.view,ee=r.line>=t.display.viewFrom&&Ms(t,r)||{node:Q[0].measure.map[2],offset:0},se=a.line<t.display.viewTo&&Ms(t,a);if(!se){var Ce=Q[Q.length-1].measure,Oe=Ce.maps?Ce.maps[Ce.maps.length-1]:Ce.map;se={node:Oe[Oe.length-1],offset:Oe[Oe.length-2]-Oe[Oe.length-3]}}if(!ee||!se){e.removeAllRanges();return}var Be=e.rangeCount&&e.getRangeAt(0),Ie;try{Ie=l(ee.node,ee.offset,se.offset,se.node)}catch(Ye){}Ie&&(!R&&t.state.focused?(e.collapse(ee.node,ee.offset),Ie.collapsed||(e.removeAllRanges(),e.addRange(Ie))):(e.removeAllRanges(),e.addRange(Ie)),Be&&e.anchorNode==null?e.addRange(Be):R&&this.startGracePeriod()),this.rememberSelection()},xr.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)},xr.prototype.showMultipleSelections=function(e){o(this.cm.display.cursorDiv,e.cursors),o(this.cm.display.selectionDiv,e.selection)},xr.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},xr.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return T(this.div,t)},xr.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},xr.prototype.blur=function(){this.div.blur()},xr.prototype.getField=function(){return this.div},xr.prototype.supportsTouch=function(){return!0},xr.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():vn(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)},xr.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},xr.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(c&&E&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=pa(t,e.anchorNode,e.anchorOffset),r=pa(t,e.focusNode,e.focusOffset);n&&r&&vn(t,function(){Qr(t.doc,Wn(n,r),_e),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},xr.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(),a=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=et(r.line-1,ut(e.doc,r.line-1).length)),a.ch==ut(e.doc,a.line).text.length&&a.line<e.lastLine()&&(a=et(a.line+1,0)),r.line<t.viewFrom||a.line>t.viewTo-1)return!1;var L,z,Q;r.line==t.viewFrom||(L=Zn(e,r.line))==0?(z=Ot(t.view[0].line),Q=t.view[0].node):(z=Ot(t.view[L].line),Q=t.view[L-1].node.nextSibling);var ee=Zn(e,a.line),se,Ce;if(ee==t.view.length-1?(se=t.viewTo-1,Ce=t.lineDiv.lastChild):(se=Ot(t.view[ee+1].line)-1,Ce=t.view[ee+1].node.previousSibling),!Q)return!1;for(var Oe=e.doc.splitLines(tu(e,Q,Ce,z,se)),Be=or(e.doc,et(z,0),et(se,ut(e.doc,se).text.length));Oe.length>1&&Be.length>1;)if(q(Oe)==q(Be))Oe.pop(),Be.pop(),se--;else if(Oe[0]==Be[0])Oe.shift(),Be.shift(),z++;else break;for(var Ie=0,Ye=0,tt=Oe[0],mt=Be[0],vt=Math.min(tt.length,mt.length);Ie<vt&&tt.charCodeAt(Ie)==mt.charCodeAt(Ie);)++Ie;for(var At=q(Oe),yt=q(Be),Lt=Math.min(At.length-(Oe.length==1?Ie:0),yt.length-(Be.length==1?Ie:0));Ye<Lt&&At.charCodeAt(At.length-Ye-1)==yt.charCodeAt(yt.length-Ye-1);)++Ye;if(Oe.length==1&&Be.length==1&&z==r.line)for(;Ie&&Ie>r.ch&&At.charCodeAt(At.length-Ye-1)==yt.charCodeAt(yt.length-Ye-1);)Ie--,Ye++;Oe[Oe.length-1]=At.slice(0,At.length-Ye).replace(/^\u200b+/,""),Oe[0]=Oe[0].slice(Ie).replace(/\u200b+$/,"");var Kt=et(z,Ie),Ft=et(se,Be.length?q(Be).length-Ye:0);if(Oe.length>1||Oe[0]||Ct(Kt,Ft))return pi(e.doc,Oe,Kt,Ft,"+input"),!0},xr.prototype.ensurePolled=function(){this.forceCompositionEnd()},xr.prototype.reset=function(){this.forceCompositionEnd()},xr.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},xr.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)},xr.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&vn(this.cm,function(){return sn(e.cm)})},xr.prototype.setUneditable=function(e){e.contentEditable="false"},xr.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Kr(this.cm,Za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},xr.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},xr.prototype.onContextMenu=function(){},xr.prototype.resetPosition=function(){},xr.prototype.needsContentAttribute=!0;function Ms(e,t){var n=Ea(e,t.line);if(!n||n.hidden)return null;var r=ut(e.doc,t.line),a=ao(n,r,t.line),L=ft(r,e.doc.direction),z="left";if(L){var Q=rt(L,t.ch);z=Q%2?"right":"left"}var ee=lo(a.map,t.ch,z);return ee.offset=ee.collapse=="right"?ee.end:ee.start,ee}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function bi(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,a){var L="",z=!1,Q=e.doc.lineSeparator(),ee=!1;function se(Ie){return function(Ye){return Ye.id==Ie}}function Ce(){z&&(L+=Q,ee&&(L+=Q),z=ee=!1)}function Oe(Ie){Ie&&(Ce(),L+=Ie)}function Be(Ie){if(Ie.nodeType==1){var Ye=Ie.getAttribute("cm-text");if(Ye){Oe(Ye);return}var tt=Ie.getAttribute("cm-marker"),mt;if(tt){var vt=e.findMarks(et(r,0),et(a+1,0),se(+tt));vt.length&&(mt=vt[0].find(0))&&Oe(or(e.doc,mt.from,mt.to).join(Q));return}if(Ie.getAttribute("contenteditable")=="false")return;var At=/^(pre|div|p|li|table|br)$/i.test(Ie.nodeName);if(!/^br$/i.test(Ie.nodeName)&&Ie.textContent.length==0)return;At&&Ce();for(var yt=0;yt<Ie.childNodes.length;yt++)Be(Ie.childNodes[yt]);/^(pre|p)$/i.test(Ie.nodeName)&&(ee=!0),At&&(z=!0)}else Ie.nodeType==3&&Oe(Ie.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Be(t),t==n);)t=t.nextSibling,ee=!1;return L}function pa(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return bi(e.clipPos(et(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 a=0;a<e.display.view.length;a++){var L=e.display.view[a];if(L.node==r)return ru(L,t,n)}}function ru(e,t,n){var r=e.text.firstChild,a=!1;if(!t||!T(r,t))return bi(et(Ot(e.line),0),!0);if(t==r&&(a=!0,t=r.childNodes[n],n=0,!t)){var L=e.rest?q(e.rest):e.line;return bi(et(Ot(L),L.text.length),a)}var z=t.nodeType==3?t:null,Q=t;for(!z&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(z=t.firstChild,n&&(n=z.nodeValue.length));Q.parentNode!=r;)Q=Q.parentNode;var ee=e.measure,se=ee.maps;function Ce(mt,vt,At){for(var yt=-1;yt<(se?se.length:0);yt++)for(var Lt=yt<0?ee.map:se[yt],Kt=0;Kt<Lt.length;Kt+=3){var Ft=Lt[Kt+2];if(Ft==mt||Ft==vt){var rr=Ot(yt<0?e.line:e.rest[yt]),Ar=Lt[Kt]+At;return(At<0||Ft!=mt)&&(Ar=Lt[Kt+(At?1:0)]),et(rr,Ar)}}}var Oe=Ce(z,Q,n);if(Oe)return bi(Oe,a);for(var Be=Q.nextSibling,Ie=z?z.nodeValue.length-n:0;Be;Be=Be.nextSibling){if(Oe=Ce(Be,Be.firstChild,0),Oe)return bi(et(Oe.line,Oe.ch-Ie),a);Ie+=Be.textContent.length}for(var Ye=Q.previousSibling,tt=n;Ye;Ye=Ye.previousSibling){if(Oe=Ce(Ye,Ye.firstChild,-1),Oe)return bi(et(Oe.line,Oe.ch+tt),a);tt+=Ye.textContent.length}}var Mr=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ae,this.hasSelection=!1,this.composing=null};Mr.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var a=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),b&&(a.style.width="0px"),Le(a,"input",function(){j&&B>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Le(a,"paste",function(z){if(je(r,z)||Os(z,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function L(z){if(je(r,z))return;if(r.somethingSelected())fa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var Q=Ds(r);fa({lineWise:!0,text:Q.text}),z.type=="cut"?r.setSelections(Q.ranges,null,_e):(n.prevInput="",a.value=Q.text.join(`
|
|
`),V(a))}else return;z.type=="cut"&&(r.state.cutIncoming=+new Date)}Le(a,"cut",L),Le(a,"copy",L),Le(e.scroller,"paste",function(z){if(kn(e,z)||je(r,z))return;if(!a.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var Q=new Event("paste");Q.clipboardData=z.clipboardData,a.dispatchEvent(Q)}),Le(e.lineSpace,"selectstart",function(z){kn(e,z)||te(z)}),Le(a,"compositionstart",function(){var z=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:z,range:r.markText(z,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Le(a,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Mr.prototype.createField=function(e){this.wrapper=ks(),this.textarea=this.wrapper.firstChild},Mr.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Mr.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=Eo(e);if(e.options.moveInputWithCursor){var a=Tn(e,n.sel.primary().head,"div"),L=t.wrapper.getBoundingClientRect(),z=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,a.top+z.top-L.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,a.left+z.left-L.left))}return r},Mr.prototype.showSelection=function(e){var t=this.cm,n=t.display;o(n.cursorDiv,e.cursors),o(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Mr.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&&V(this.textarea),j&&B>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",j&&B>=9&&(this.hasSelection=null))},Mr.prototype.getField=function(){return this.textarea},Mr.prototype.supportsTouch=function(){return!1},Mr.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!s||I()!=this.textarea))try{this.textarea.focus()}catch(e){}},Mr.prototype.blur=function(){this.textarea.blur()},Mr.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Mr.prototype.receivedFocus=function(){this.slowPoll()},Mr.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()})},Mr.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)},Mr.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||at(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var a=n.value;if(a==r&&!t.somethingSelected())return!1;if(j&&B>=9&&this.hasSelection===a||u&&/[\uf700-\uf7ff]/.test(a))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var L=a.charCodeAt(0);if(L==8203&&!r&&(r="\u200B"),L==8666)return this.reset(),this.cm.execCommand("undo")}for(var z=0,Q=Math.min(r.length,a.length);z<Q&&r.charCodeAt(z)==a.charCodeAt(z);)++z;return vn(t,function(){Za(t,a.slice(z),r.length-z,null,e.composing?"*compose":null),a.length>1e3||a.indexOf(`
|
|
`)>-1?n.value=e.prevInput="":e.prevInput=a,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Mr.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Mr.prototype.onKeyPress=function(){j&&B>=9&&(this.hasSelection=null),this.fastPoll()},Mr.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,a=t.textarea;t.contextMenuPending&&t.contextMenuPending();var L=Jn(n,e),z=r.scroller.scrollTop;if(!L||A)return;var Q=n.options.resetSelectionOnContextMenu;Q&&n.doc.sel.contains(L)==-1&&Kr(n,Qr)(n.doc,Wn(L),_e);var ee=a.style.cssText,se=t.wrapper.style.cssText,Ce=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",a.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-Ce.top-5)+"px; left: "+(e.clientX-Ce.left-5)+`px;
|
|
z-index: 1000; background: `+(j?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var Oe;k&&(Oe=window.scrollY),r.input.focus(),k&&window.scrollTo(null,Oe),r.input.reset(),n.somethingSelected()||(a.value=t.prevInput=" "),t.contextMenuPending=Ie,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function Be(){if(a.selectionStart!=null){var tt=n.somethingSelected(),mt="\u200B"+(tt?a.value:"");a.value="\u21DA",a.value=mt,t.prevInput=tt?"":"\u200B",a.selectionStart=1,a.selectionEnd=mt.length,r.selForContextMenu=n.doc.sel}}function Ie(){if(t.contextMenuPending!=Ie)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=se,a.style.cssText=ee,j&&B<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=z),a.selectionStart!=null){(!j||j&&B<9)&&Be();var tt=0,mt=function(){r.selForContextMenu==n.doc.sel&&a.selectionStart==0&&a.selectionEnd>0&&t.prevInput=="\u200B"?Kr(n,Qo)(n):tt++<10?r.detectingSelectAll=setTimeout(mt,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(mt,200)}}if(j&&B>=9&&Be(),_){ye(e);var Ye=function(){Ke(window,"mouseup",Ye),setTimeout(Ie,20)};Le(window,"mouseup",Ye)}else setTimeout(Ie,50)},Mr.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Mr.prototype.setUneditable=function(){},Mr.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?N(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=I();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=Q.getValue()}var a;if(e.form&&(Le(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var L=e.form;a=L.submit;try{var z=L.submit=function(){r(),L.submit=a,L.submit(),L.submit=z}}catch(ee){}}t.finishInit=function(ee){ee.save=r,ee.getTextArea=function(){return e},ee.toTextArea=function(){ee.toTextArea=isNaN,r(),e.parentNode.removeChild(ee.getWrapperElement()),e.style.display="",e.form&&(Ke(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=a))}},e.style.display="none";var Q=Lr(function(ee){return e.parentNode.insertBefore(ee,e.nextSibling)},t);return Q}function iu(e){e.off=Ke,e.on=Le,e.wheelEventPixels=cl,e.Doc=ln,e.splitLines=ct,e.countColumn=J,e.findColumn=me,e.isWordChar=Re,e.Pass=Te,e.signal=Me,e.Line=fn,e.changeEnd=Hn,e.scrollbarModel=Oo,e.Pos=et,e.cmpPos=Ct,e.modes=kt,e.mimeModes=Et,e.resolveMode=Xe,e.getMode=bt,e.modeExtensions=ot,e.extendMode=lt,e.copyState=st,e.startState=Wt,e.innerMode=zt,e.commands=Hi,e.keyMap=Pn,e.keyName=ps,e.isModifierKey=hs,e.lookupKey=gi,e.normalizeKeyMap=Pl,e.StringStream=St,e.SharedTextMarker=Fi,e.TextMarker=zn,e.LineWidget=Bi,e.e_preventDefault=te,e.e_stopPropagation=de,e.e_stop=ye,e.addClass=F,e.contains=T,e.rmClass=d,e.keyNames=Gn}$l(Lr),ql(Lr);var au="iter insert remove copy getEditor constructor".split(" ");for(var ma in ln.prototype)ln.prototype.hasOwnProperty(ma)&&ue(au,ma)<0&&(Lr.prototype[ma]=function(e){return function(){return e.apply(this.doc,arguments)}}(ln.prototype[ma]));return be(ln),Lr.inputStyles={textarea:Mr,contenteditable:xr},Lr.defineMode=function(e){!Lr.defaults.mode&&e!="null"&&(Lr.defaults.mode=e),Mt.apply(this,arguments)},Lr.defineMIME=Rt,Lr.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Lr.defineMIME("text/plain","null"),Lr.defineExtension=function(e,t){Lr.prototype[e]=t},Lr.defineDocExtension=function(e,t){ln.prototype[e]=t},Lr.fromTextArea=nu,iu(Lr),Lr.version="5.58.2",Lr})},WaYH:function(gt,ze,Y){"use strict";var ce=Y("rePB"),X=Y("Ff2n"),R=Y("VTBJ"),Z=Y("1OyB"),U=Y("vuIU"),O=Y("JX7q"),j=Y("Ji7U"),B=Y("LK+K"),k=Y("q1tI"),D=Y("TSYQ"),E=Y.n(D),A=Y("sboe"),P=Y("OZM5"),w=function(_){var x=_.prefixCls,d=_.level,h=_.isStart,o=_.isEnd;if(!d)return null;for(var i="".concat(x,"-indent-unit"),g=[],l=0;l<d;l+=1){var T;g.push(k.createElement("span",{key:l,className:E()(i,(T={},Object(ce.a)(T,"".concat(i,"-start"),h[l+1]),Object(ce.a)(T,"".concat(i,"-end"),o[l+1]),Object(ce.a)(T,"".concat(i,"-end-first-level"),!l&&o[0]),T))}))}return k.createElement("span",{"aria-hidden":"true",className:"".concat(x,"-indent")},g)},y=w,b=Y("815F"),c="open",s="close",u="---",f=function(m){Object(j.a)(x,m);var _=Object(B.a)(x);function x(){var d;return Object(Z.a)(this,x),d=_.apply(this,arguments),d.state={dragNodeHighlight:!1},d.onSelectorClick=function(h){var o=d.props.context.onNodeClick;o(h,Object(b.b)(d.props)),d.isSelectable()?d.onSelect(h):d.onCheck(h)},d.onSelectorDoubleClick=function(h){var o=d.props.context.onNodeDoubleClick;o(h,Object(b.b)(d.props))},d.onSelect=function(h){if(d.isDisabled())return;var o=d.props.context.onNodeSelect;h.preventDefault(),o(h,Object(b.b)(d.props))},d.onCheck=function(h){if(d.isDisabled())return;var o=d.props,i=o.disableCheckbox,g=o.checked,l=d.props.context.onNodeCheck;if(!d.isCheckable()||i)return;h.preventDefault();var T=!g;l(h,Object(b.b)(d.props),T)},d.onMouseEnter=function(h){var o=d.props.context.onNodeMouseEnter;o(h,Object(b.b)(d.props))},d.onMouseLeave=function(h){var o=d.props.context.onNodeMouseLeave;o(h,Object(b.b)(d.props))},d.onContextMenu=function(h){var o=d.props.context.onNodeContextMenu;o(h,Object(b.b)(d.props))},d.onDragStart=function(h){var o=d.props.context.onNodeDragStart;h.stopPropagation(),d.setState({dragNodeHighlight:!0}),o(h,Object(O.a)(d));try{h.dataTransfer.setData("text/plain","")}catch(i){}},d.onDragEnter=function(h){var o=d.props.context.onNodeDragEnter;h.preventDefault(),h.stopPropagation(),o(h,Object(O.a)(d))},d.onDragOver=function(h){var o=d.props.context.onNodeDragOver;h.preventDefault(),h.stopPropagation(),o(h,Object(O.a)(d))},d.onDragLeave=function(h){var o=d.props.context.onNodeDragLeave;h.stopPropagation(),o(h,Object(O.a)(d))},d.onDragEnd=function(h){var o=d.props.context.onNodeDragEnd;h.stopPropagation(),d.setState({dragNodeHighlight:!1}),o(h,Object(O.a)(d))},d.onDrop=function(h){var o=d.props.context.onNodeDrop;h.preventDefault(),h.stopPropagation(),d.setState({dragNodeHighlight:!1}),o(h,Object(O.a)(d))},d.onExpand=function(h){var o=d.props.context.onNodeExpand;o(h,Object(b.b)(d.props))},d.setSelectHandle=function(h){d.selectHandle=h},d.getNodeState=function(){var h=d.props.expanded;return d.isLeaf()?null:h?c:s},d.hasChildren=function(){var h=d.props.eventKey,o=d.props.context.keyEntities,i=o[h]||{},g=i.children;return!!(g||[]).length},d.isLeaf=function(){var h=d.props,o=h.isLeaf,i=h.loaded,g=d.props.context.loadData,l=d.hasChildren();return o===!1?!1:o||!g&&!l||g&&i&&!l},d.isDisabled=function(){var h=d.props.disabled,o=d.props.context.disabled;return!!(o||h)},d.isCheckable=function(){var h=d.props.checkable,o=d.props.context.checkable;return!o||h===!1?!1:o},d.syncLoadData=function(h){var o=h.expanded,i=h.loading,g=h.loaded,l=d.props.context,T=l.loadData,I=l.onNodeLoad;if(i)return;T&&o&&!d.isLeaf()&&(!d.hasChildren()&&!g&&I(Object(b.b)(d.props)))},d.renderSwitcher=function(){var h=d.props,o=h.expanded,i=h.switcherIcon,g=d.props.context,l=g.prefixCls,T=g.switcherIcon,I=i||T;if(d.isLeaf())return k.createElement("span",{className:E()("".concat(l,"-switcher"),"".concat(l,"-switcher-noop"))},typeof I=="function"?I(Object(R.a)(Object(R.a)({},d.props),{},{isLeaf:!0})):I);var F=E()("".concat(l,"-switcher"),"".concat(l,"-switcher_").concat(o?c:s));return k.createElement("span",{onClick:d.onExpand,className:F},typeof I=="function"?I(Object(R.a)(Object(R.a)({},d.props),{},{isLeaf:!1})):I)},d.renderCheckbox=function(){var h=d.props,o=h.checked,i=h.halfChecked,g=h.disableCheckbox,l=d.props.context.prefixCls,T=d.isDisabled(),I=d.isCheckable();if(!I)return null;var F=typeof I!="boolean"?I:null;return k.createElement("span",{className:E()("".concat(l,"-checkbox"),o&&"".concat(l,"-checkbox-checked"),!o&&i&&"".concat(l,"-checkbox-indeterminate"),(T||g)&&"".concat(l,"-checkbox-disabled")),onClick:d.onCheck},F)},d.renderIcon=function(){var h=d.props.loading,o=d.props.context.prefixCls;return k.createElement("span",{className:E()("".concat(o,"-iconEle"),"".concat(o,"-icon__").concat(d.getNodeState()||"docu"),h&&"".concat(o,"-icon_loading"))})},d.renderSelector=function(){var h=d.state.dragNodeHighlight,o=d.props,i=o.title,g=o.selected,l=o.icon,T=o.loading,I=o.data,F=d.props.context,W=F.prefixCls,V=F.showIcon,M=F.icon,N=F.draggable,J=F.loadData,ae=F.titleRender,ue=d.isDisabled(),ve="".concat(W,"-node-content-wrapper"),Te;if(V){var _e=l||M;Te=_e?k.createElement("span",{className:E()("".concat(W,"-iconEle"),"".concat(W,"-icon__customize"))},typeof _e=="function"?_e(d.props):_e):d.renderIcon()}else J&&T&&(Te=d.renderIcon());var fe;typeof i=="function"?fe=i(I):ae?fe=ae(I):fe=i;var ne=k.createElement("span",{className:"".concat(W,"-title")},fe);return k.createElement("span",{ref:d.setSelectHandle,title:typeof i=="string"?i:"",className:E()("".concat(ve),"".concat(ve,"-").concat(d.getNodeState()||"normal"),!ue&&(g||h)&&"".concat(W,"-node-selected"),!ue&&N&&"draggable"),draggable:!ue&&N||void 0,"aria-grabbed":!ue&&N||void 0,onMouseEnter:d.onMouseEnter,onMouseLeave:d.onMouseLeave,onContextMenu:d.onContextMenu,onClick:d.onSelectorClick,onDoubleClick:d.onSelectorDoubleClick,onDragStart:N?d.onDragStart:void 0},Te,ne)},d}return Object(U.a)(x,[{key:"componentDidMount",value:function(){this.syncLoadData(this.props)}},{key:"componentDidUpdate",value:function(){this.syncLoadData(this.props)}},{key:"isSelectable",value:function(){var h=this.props.selectable,o=this.props.context.selectable;return typeof h=="boolean"?h:o}},{key:"render",value:function(){var h,o=this.props,i=o.eventKey,g=o.className,l=o.style,T=o.dragOver,I=o.dragOverGapTop,F=o.dragOverGapBottom,W=o.isLeaf,V=o.isStart,M=o.isEnd,N=o.expanded,J=o.selected,ae=o.checked,ue=o.halfChecked,ve=o.loading,Te=o.domRef,_e=o.active,fe=o.onMouseMove,ne=Object(X.a)(o,["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","onMouseMove"]),me=this.props.context,ie=me.prefixCls,le=me.filterTreeNode,q=me.draggable,re=me.keyEntities,oe=this.isDisabled(),ge=Object(P.f)(ne),Se=re[i]||{},Ee=Se.level,Re=M[M.length-1];return k.createElement("div",Object.assign({ref:Te,className:E()(g,"".concat(ie,"-treenode"),(h={},Object(ce.a)(h,"".concat(ie,"-treenode-disabled"),oe),Object(ce.a)(h,"".concat(ie,"-treenode-switcher-").concat(N?"open":"close"),!W),Object(ce.a)(h,"".concat(ie,"-treenode-checkbox-checked"),ae),Object(ce.a)(h,"".concat(ie,"-treenode-checkbox-indeterminate"),ue),Object(ce.a)(h,"".concat(ie,"-treenode-selected"),J),Object(ce.a)(h,"".concat(ie,"-treenode-loading"),ve),Object(ce.a)(h,"".concat(ie,"-treenode-active"),_e),Object(ce.a)(h,"".concat(ie,"-treenode-leaf-last"),Re),Object(ce.a)(h,"drag-over",!oe&&T),Object(ce.a)(h,"drag-over-gap-top",!oe&&I),Object(ce.a)(h,"drag-over-gap-bottom",!oe&&F),Object(ce.a)(h,"filter-node",le&&le(Object(b.b)(this.props))),h)),style:l,onDragEnter:q?this.onDragEnter:void 0,onDragOver:q?this.onDragOver:void 0,onDragLeave:q?this.onDragLeave:void 0,onDrop:q?this.onDrop:void 0,onDragEnd:q?this.onDragEnd:void 0,onMouseMove:fe},ge),k.createElement(y,{prefixCls:ie,level:Ee,isStart:V,isEnd:M}),this.renderSwitcher(),this.renderCheckbox(),this.renderSelector())}}]),x}(k.Component),C=function(_){return k.createElement(A.a.Consumer,null,function(x){return k.createElement(f,Object.assign({},_,{context:x}))})};C.displayName="TreeNode",C.defaultProps={title:u},C.isTreeNode=1;var v=ze.a=C},XIdC:function(gt,ze,Y){"use strict";var ce=Y("rePB"),X=Y("ODXe"),R=Y("Ff2n"),Z=Y("q1tI"),U=Y.n(Z),O=Y("TSYQ"),j=Y.n(O),B=Y("6cGi"),k=Y("4IlW"),D=Z.forwardRef(function(E,A){var P,w=E.prefixCls,y=w===void 0?"rc-switch":w,b=E.className,c=E.checked,s=E.defaultChecked,u=E.disabled,f=E.loadingIcon,C=E.checkedChildren,v=E.unCheckedChildren,m=E.onClick,_=E.onChange,x=E.onKeyDown,d=Object(R.a)(E,["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"]),h=Object(B.a)(!1,{value:c,defaultValue:s}),o=Object(X.a)(h,2),i=o[0],g=o[1];function l(W,V){var M=i;return u||(M=W,g(M),_==null||_(M,V)),M}function T(W){W.which===k.a.LEFT?l(!1,W):W.which===k.a.RIGHT&&l(!0,W),x==null||x(W)}function I(W){var V=l(!i,W);m==null||m(V,W)}var F=j()(y,b,(P={},Object(ce.a)(P,"".concat(y,"-checked"),i),Object(ce.a)(P,"".concat(y,"-disabled"),u),P));return Z.createElement("button",Object.assign({},d,{type:"button",role:"switch","aria-checked":i,disabled:u,className:F,ref:A,onKeyDown:T,onClick:I}),f,Z.createElement("span",{className:"".concat(y,"-inner")},i?C:v))});D.displayName="Switch",ze.a=D},Y1PL:function(gt,ze,Y){"use strict";Y.r(ze),Y.d(ze,"ResizableTextArea",function(){return ue});var ce=Y("wx14"),X=Y("1OyB"),R=Y("vuIU"),Z=Y("Ji7U"),U=Y("LK+K"),O=Y("q1tI"),j=Y("VTBJ"),B=Y("rePB"),k=Y("Zm9Q"),D=Y("Kwbf"),E=Y("c+Xe"),A=Y("m+aA"),P=Y("bdgK"),w=new Map;function y(_e){_e.forEach(function(fe){var ne,me=fe.target;(ne=w.get(me))===null||ne===void 0||ne.forEach(function(ie){return ie(me)})})}var b=new P.default(y),c=null,s=null;function u(_e,fe){w.has(_e)||(w.set(_e,new Set),b.observe(_e)),w.get(_e).add(fe)}function f(_e,fe){w.has(_e)&&(w.get(_e).delete(fe),w.get(_e).size||(b.unobserve(_e),w.delete(_e)))}var C=function(_e){Object(Z.a)(ne,_e);var fe=Object(U.a)(ne);function ne(){return Object(X.a)(this,ne),fe.apply(this,arguments)}return Object(R.a)(ne,[{key:"render",value:function(){return this.props.children}}]),ne}(O.Component),v=O.createContext(null);function m(_e){var fe=_e.children,ne=_e.onBatchResize,me=O.useRef(0),ie=O.useRef([]),le=O.useContext(v),q=O.useCallback(function(re,oe,ge){me.current+=1;var Se=me.current;ie.current.push({size:re,element:oe,data:ge}),Promise.resolve().then(function(){Se===me.current&&(ne==null||ne(ie.current),ie.current=[])}),le==null||le(re,oe,ge)},[ne,le]);return O.createElement(v.Provider,{value:q},fe)}function _(_e){var fe=_e.children,ne=_e.disabled,me=O.useRef(null),ie=O.useRef(null),le=O.useContext(v),q=O.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),re=O.isValidElement(fe)&&Object(E.c)(fe),oe=re?fe.ref:null,ge=O.useMemo(function(){return Object(E.a)(oe,me)},[oe,me]),Se=O.useRef(_e);Se.current=_e;var Ee=O.useCallback(function(Re){var Pe=Se.current,Ue=Pe.onResize,He=Pe.data,Fe=Re.getBoundingClientRect(),Ne=Fe.width,qe=Fe.height,Je=Re.offsetWidth,it=Re.offsetHeight,rt=Math.floor(Ne),ht=Math.floor(qe);if(q.current.width!==rt||q.current.height!==ht||q.current.offsetWidth!==Je||q.current.offsetHeight!==it){var ft={width:rt,height:ht,offsetWidth:Je,offsetHeight:it};q.current=ft;var ke=Je===Math.round(Ne)?Ne:Je,Le=it===Math.round(qe)?qe:it,Ge=Object(j.a)(Object(j.a)({},ft),{},{offsetWidth:ke,offsetHeight:Le});le==null||le(Ge,Re,He),Ue&&Promise.resolve().then(function(){Ue(Ge,Re)})}},[]);return O.useEffect(function(){var Re=Object(A.a)(me.current)||Object(A.a)(ie.current);return Re&&!ne&&u(Re,Ee),function(){return f(Re,Ee)}},[me.current,ne]),O.createElement(C,{ref:ie},re?O.cloneElement(fe,{ref:ge}):fe)}var x="rc-observer-key";function d(_e){var fe=_e.children,ne=Object(k.a)(fe);return ne.map(function(me,ie){var le=(me==null?void 0:me.key)||"".concat(x,"-").concat(ie);return O.createElement(_,Object(ce.a)({},_e,{key:le}),me)})}d.Collection=m;var h=d,o=Y("bT9E"),i=Y("TSYQ"),g=Y.n(i),l=`
|
|
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"],I={},F;function W(_e){var fe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ne=_e.getAttribute("id")||_e.getAttribute("data-reactid")||_e.getAttribute("name");if(fe&&I[ne])return I[ne];var me=window.getComputedStyle(_e),ie=me.getPropertyValue("box-sizing")||me.getPropertyValue("-moz-box-sizing")||me.getPropertyValue("-webkit-box-sizing"),le=parseFloat(me.getPropertyValue("padding-bottom"))+parseFloat(me.getPropertyValue("padding-top")),q=parseFloat(me.getPropertyValue("border-bottom-width"))+parseFloat(me.getPropertyValue("border-top-width")),re=T.map(function(ge){return"".concat(ge,":").concat(me.getPropertyValue(ge))}).join(";"),oe={sizingStyle:re,paddingSize:le,borderSize:q,boxSizing:ie};return fe&&ne&&(I[ne]=oe),oe}function V(_e){var fe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,me=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;F||(F=document.createElement("textarea"),F.setAttribute("tab-index","-1"),F.setAttribute("aria-hidden","true"),document.body.appendChild(F)),_e.getAttribute("wrap")?F.setAttribute("wrap",_e.getAttribute("wrap")):F.removeAttribute("wrap");var ie=W(_e,fe),le=ie.paddingSize,q=ie.borderSize,re=ie.boxSizing,oe=ie.sizingStyle;F.setAttribute("style","".concat(oe,";").concat(l)),F.value=_e.value||_e.placeholder||"";var ge=Number.MIN_SAFE_INTEGER,Se=Number.MAX_SAFE_INTEGER,Ee=F.scrollHeight,Re;if(re==="border-box"?Ee+=q:re==="content-box"&&(Ee-=le),ne!==null||me!==null){F.value=" ";var Pe=F.scrollHeight-le;ne!==null&&(ge=Pe*ne,re==="border-box"&&(ge=ge+le+q),Ee=Math.max(ge,Ee)),me!==null&&(Se=Pe*me,re==="border-box"&&(Se=Se+le+q),Re=Ee>Se?"":"hidden",Ee=Math.min(Se,Ee))}return{height:Ee,minHeight:ge,maxHeight:Se,overflowY:Re,resize:"none"}}var M=Y("Gytx"),N=Y.n(M),J;(function(_e){_e[_e.NONE=0]="NONE",_e[_e.RESIZING=1]="RESIZING",_e[_e.RESIZED=2]="RESIZED"})(J||(J={}));var ae=function(_e){Object(Z.a)(ne,_e);var fe=Object(U.a)(ne);function ne(me){var ie;return Object(X.a)(this,ne),ie=fe.call(this,me),ie.nextFrameActionId=void 0,ie.resizeFrameId=void 0,ie.textArea=void 0,ie.saveTextArea=function(le){ie.textArea=le},ie.handleResize=function(le){var q=ie.state.resizeStatus,re=ie.props,oe=re.autoSize,ge=re.onResize;if(q!==J.NONE)return;typeof ge=="function"&&ge(le),oe&&ie.resizeOnNextFrame()},ie.resizeOnNextFrame=function(){cancelAnimationFrame(ie.nextFrameActionId),ie.nextFrameActionId=requestAnimationFrame(ie.resizeTextarea)},ie.resizeTextarea=function(){var le=ie.props.autoSize;if(!le||!ie.textArea)return;var q=le.minRows,re=le.maxRows,oe=V(ie.textArea,!1,q,re);ie.setState({textareaStyles:oe,resizeStatus:J.RESIZING},function(){cancelAnimationFrame(ie.resizeFrameId),ie.resizeFrameId=requestAnimationFrame(function(){ie.setState({resizeStatus:J.RESIZED},function(){ie.resizeFrameId=requestAnimationFrame(function(){ie.setState({resizeStatus:J.NONE}),ie.fixFirefoxAutoScroll()})})})})},ie.renderTextArea=function(){var le=ie.props,q=le.prefixCls,re=q===void 0?"rc-textarea":q,oe=le.autoSize,ge=le.onResize,Se=le.className,Ee=le.disabled,Re=ie.state,Pe=Re.textareaStyles,Ue=Re.resizeStatus,He=Object(o.a)(ie.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Fe=g()(re,Se,Object(B.a)({},"".concat(re,"-disabled"),Ee));"value"in He&&(He.value=He.value||"");var Ne=Object(j.a)(Object(j.a)(Object(j.a)({},ie.props.style),Pe),Ue===J.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return O.createElement(h,{onResize:ie.handleResize,disabled:!(oe||ge)},O.createElement("textarea",Object(ce.a)({},He,{className:Fe,style:Ne,ref:ie.saveTextArea})))},ie.state={textareaStyles:{},resizeStatus:J.NONE},ie}return Object(R.a)(ne,[{key:"componentDidUpdate",value:function(ie){(ie.value!==this.props.value||!N()(ie.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 ie=this.textArea.selectionStart,le=this.textArea.selectionEnd;this.textArea.setSelectionRange(ie,le)}}catch(q){}}},{key:"render",value:function(){return this.renderTextArea()}}]),ne}(O.Component),ue=ae,ve=function(_e){Object(Z.a)(ne,_e);var fe=Object(U.a)(ne);function ne(me){var ie;Object(X.a)(this,ne),ie=fe.call(this,me),ie.resizableTextArea=void 0,ie.focus=function(){ie.resizableTextArea.textArea.focus()},ie.saveTextArea=function(q){ie.resizableTextArea=q},ie.handleChange=function(q){var re=ie.props.onChange;ie.setValue(q.target.value,function(){ie.resizableTextArea.resizeTextarea()}),re&&re(q)},ie.handleKeyDown=function(q){var re=ie.props,oe=re.onPressEnter,ge=re.onKeyDown;q.keyCode===13&&oe&&oe(q),ge&&ge(q)};var le=typeof me.value=="undefined"||me.value===null?me.defaultValue:me.value;return ie.state={value:le},ie}return Object(R.a)(ne,[{key:"setValue",value:function(ie,le){"value"in this.props||this.setState({value:ie},le)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return O.createElement(ue,Object(ce.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ie){return"value"in ie?{value:ie.value}:null}}]),ne}(O.Component),Te=ze.default=ve},ZW9T:function(gt,ze,Y){"use strict";Y.d(ze,"a",function(){return C});var ce=Y("k1fw"),X=Y("miYZ"),R=Y("tsqr"),Z=Y("rAM+"),U=Y("tJVT"),O=Y("PpiC"),j=Y("q1tI"),B=Y.n(j),k=Y("bdgK");function D(v,m,_,x,d){var h=m.getWordUntilPosition(_),o={startLineNumber:_.lineNumber,endLineNumber:_.lineNumber,startColumn:h.startColumn,endColumn:h.endColumn},i=x.map(function(g){return{label:g,kind:v.languages.CompletionItemKind.Keyword,insertText:g,insertTextRules:v.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:o}});return d.map(function(g){i.push(Object(ce.a)(Object(ce.a)({},g),{},{range:o}))}),i}var E=function(v){var m={label:"ifelse",kind:v.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:v.languages.CompletionItemInsertTextRule.InsertAsSnippet},_=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];v.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(o,i){var g=D(v,o,i,_,[m]);return{suggestions:g}}});var x=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];v.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(o,i){var g=[{label:"print",kind:v.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:v.languages.CompletionItemInsertTextRule.InsertAsSnippet}],l=D(v,o,i,x,g);return{suggestions:l}}});var d=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];v.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(o,i){var g=[m,{label:"main",kind:v.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`),insertTextRules:v.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:v.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
|
|
`),insertTextRules:v.languages.CompletionItemInsertTextRule.InsertAsSnippet}],l=D(v,o,i,d,g);return{suggestions:l}}})},A="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",P=Y("LvDl");function w(v){return/^\d+$/.test(v)?"".concat(v,"px"):v}function y(){}var b=!1,c={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function s(){var v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],m=v;if(Array.isArray(v)){for(var _=0;_<v.length;_++){var x=c[v[_]];if(x)return x}return m[0]}return c[m]||m}var u=null,f=ze.b=function(v){var m=v.width,_=m===void 0?"100%":m,x=v.height,d=x===void 0?"100%":x,h=v.value,o=v.language,i=o===void 0?"javascript":o,g=v.style,l=g===void 0?{}:g,T=v.options,I=T===void 0?{}:T,F=v.overrideServices,W=F===void 0?{}:F,V=v.theme,M=V===void 0?"vs-dark":V,N=v.onEditBlur,J=v.onSave,ae=v.autoHeight,ue=ae===void 0?!1:ae,ve=v.forbidCopy,Te=ve===void 0?!1:ve,_e=v.onChange,fe=_e===void 0?y:_e,ne=v.editorDidMount,me=ne===void 0?y:ne,ie=v.onFocus,le=ie===void 0?y:ie,q=v.filename,re=q===void 0?"educoder.txt":q,oe=Object(O.a)(v,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),ge=Object(j.useRef)(),Se=Object(j.useRef)({}),Ee=Object(j.useRef)(),Re=Object(j.useRef)(!1),Pe=Object(j.useRef)(),Ue=Object(j.useState)(!1),He=Object(U.a)(Ue,2),Fe=He[0],Ne=He[1];function qe(){var he;return ge.current&&(he=new k.default(function(ye){var De=Object(Z.a)(ye),we;try{for(De.s();!(we=De.n()).done;){var We=we.value;(We.target.offsetHeight>0||We.target.offsetWidth>0)&&Se.current.instance.layout()}}catch(Qe){De.e(Qe)}finally{De.f()}}),he.observe(ge.current)),he}function Je(){R.b.warn(decodeURIComponent(A))}var it=function(){var ye=Se.current.instance;if(h!=null&&ye&&Fe){var De=ye.getModel();De&&h!==De.getValue()&&(b=!0,De.setValue(h),ye.layout(),b=!1)}};Object(j.useEffect)(function(){Ee.current&&clearTimeout(Ee.current),Ee.current=setTimeout(function(){it()},500)},[h,Fe,Se.current]);function rt(){var he=Se.current.instance;if(he){var ye=he.getSelection(),De=Se.current.pastePos||{},we=new u.Range(De.startLineNumber||ye.endLineNumber,De.startColumn||ye.endColumn,De.endLineNumber||ye.endLineNumber,De.endColumn||ye.endColumn);setTimeout(function(){he.executeEdits("",[{range:we,text:""}])},300)}}function ht(he){(window.navigator.platform.match("Mac")?he.metaKey:he.ctrlKey)&&he.keyCode==83&&(he.preventDefault(),J())}var ft=function(){if(ue&&Se.current.instance){var ye=Se.current.instance.getContentHeight();te(ye<d?d:ye)}else te(d)};function ke(he){var ye=document.createEvent("MouseEvents");ye.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),he.dispatchEvent(ye)}function Le(he,ye){var De=window.URL||window.webkitURL||window,we=new Blob([ye]),We=document.createElementNS("http://www.w3.org/1999/xhtml","a");We.href=De.createObjectURL(we),We.download=he,ke(We)}Object(j.useEffect)(function(){ft()},[ft]),Object(j.useEffect)(function(){ge.current&&!Fe&&Y.e(27).then(Y.t.bind(null,"M/lh",7)).then(function(he){try{u=he,Se.current.instance=u.editor.create(ge.current,{value:h,language:s(i),theme:M,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},W);var ye=Se.current.instance;if(me(ye,u),setTimeout(function(){ft(),Se.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Le(re||"educoder.txt",ye.getValue())}})},500),Se.current.subscription=ye.onDidChangeModelContent(function(we){Re.current?clearTimeout(Pe.current):(ft(),fe(ye.getValue(),we)),Pe.current=setTimeout(function(){Re.current=!1},500)}),window.Monaco||E(u),Te&&(ye.addCommand(u.KeyMod.CtrlCmd|u.KeyMod.Shift|u.KeyCode.KEY_V,function(){return Je(),null}),ye.addCommand(u.KeyMod.CtrlCmd|u.KeyCode.KEY_C,function(){return Je(),null})),window.Monaco=u,N&&ye.onDidBlurEditorWidget(function(){N(ye.getValue())}),le&&ye.onDidFocusEditorText(function(){le(ye.getValue())}),Te){ye.addCommand(u.KeyMod.CtrlCmd|u.KeyCode.KEY_V,function(){return Je(),null}),ye.onDidPaste(function(we){Se.current.pastePos=we});try{window.addEventListener("paste",rt)}catch(we){}}var De=qe();return Ne(!0),function(){var we=Se.current.instance;we.dispose();var We=we.getModel();We&&We.dispose(),Se.current.subscription&&Se.current.subscription.dispose(),Te&&window.removeEventListener("paste",rt),De.unobserve(ge.current)}}catch(we){}})},[]),Object(j.useEffect)(function(){var he=Se.current.instance;if(he&&Fe)return document.addEventListener("keydown",ht,!1),function(){document.removeEventListener("keydown",ht)}},[J,Fe]),Object(j.useEffect)(function(){var he=Se.current.instance;if(he&&Fe){var ye=s(i);u.editor.setModelLanguage(he.getModel(),ye),console.log("language:",i,he.getModel(),ye)}},[i,Fe]),Object(j.useEffect)(function(){var he=Se.current.instance;he&&Fe&&u.editor.setTheme(M)},[M,Fe]),Object(j.useEffect)(function(){var he=Se.current.instance;he&&Fe&&(he.updateOptions(Object(ce.a)({},I)),setTimeout(function(){he.getModel().updateOptions(Object(ce.a)({},I))},200))},[JSON.stringify(I),Fe]),Object(j.useEffect)(function(){var he=Se.current.instance;he&&Fe&&he.layout()},[_,d,Fe]);var Ge=Object(j.useState)(w(_)),Ke=Object(U.a)(Ge,2),Me=Ke[0],je=Ke[1],xe=Object(j.useState)(w(d)),pe=Object(U.a)(xe,2),be=pe[0],te=pe[1],de=Object(ce.a)(Object(ce.a)({},l),{},{width:Me,height:be});return B.a.createElement("div",{className:"my-monaco-editor",ref:ge,style:de})};function C(v){var m=v.width,_=m===void 0?"100%":m,x=v.height,d=x===void 0?"100%":x,h=v.original,o=v.modified,i=v.language,g=v.options,l=g===void 0?{}:g,T=Object(j.useRef)(),I=Object(j.useState)(null),F=Object(U.a)(I,2),W=F[0],V=F[1];function M(ue){var ve;return T.current&&(ve=new k.default(function(Te){var _e=Object(Z.a)(Te),fe;try{for(_e.s();!(fe=_e.n()).done;){var ne=fe.value;(ne.target.offsetHeight>0||ne.target.offsetWidth>0)&&ue.layout()}}catch(me){_e.e(me)}finally{_e.f()}}),ve.observe(T.current)),ve}Object(j.useEffect)(function(){T.current&&Y.e(27).then(Y.t.bind(null,"M/lh",7)).then(function(ue){u=ue;var ve=u.editor.createDiffEditor(T.current,Object(ce.a)(Object(ce.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},l),{},{wordWrap:!0}));V(ve);var Te=M(ve);return function(){ve.dispose();var _e=ve.getModel();_e&&_e.dispose(),Te.unobserve(T.current)}})},[]),Object(j.useEffect)(function(){W&&W.setModel({original:u.editor.createModel(h,i),modified:u.editor.createModel(o,i)})},[h,o,i,W]);var N=w(_),J=w(d),ae={width:N,height:J};return B.a.createElement("div",{className:"my-diff-editor",ref:T,style:ae})}},ZpRC:function(gt,ze,Y){"use strict";function ce(E){return typeof E=="object"&&E!=null&&E.nodeType===1}function X(E,A){return(!A||E!=="hidden")&&E!=="visible"&&E!=="clip"}function R(E,A){if(E.clientHeight<E.scrollHeight||E.clientWidth<E.scrollWidth){var P=getComputedStyle(E,null);return X(P.overflowY,A)||X(P.overflowX,A)||function(w){var y=function(b){if(!b.ownerDocument||!b.ownerDocument.defaultView)return null;try{return b.ownerDocument.defaultView.frameElement}catch(c){return null}}(w);return!!y&&(y.clientHeight<w.scrollHeight||y.clientWidth<w.scrollWidth)}(E)}return!1}function Z(E,A,P,w,y,b,c,s){return b<E&&c>A||b>E&&c<A?0:b<=E&&s<=P||c>=A&&s>=P?b-E-w:c>A&&s<P||b<E&&s>P?c-A+y:0}var U=function(E,A){var P=window,w=A.scrollMode,y=A.block,b=A.inline,c=A.boundary,s=A.skipOverflowHiddenElements,u=typeof c=="function"?c:function(Pe){return Pe!==c};if(!ce(E))throw new TypeError("Invalid target");for(var f=document.scrollingElement||document.documentElement,C=[],v=E;ce(v)&&u(v);){if((v=v.parentElement)===f){C.push(v);break}v!=null&&v===document.body&&R(v)&&!R(document.documentElement)||v!=null&&R(v,s)&&C.push(v)}for(var m=P.visualViewport?P.visualViewport.width:innerWidth,_=P.visualViewport?P.visualViewport.height:innerHeight,x=window.scrollX||pageXOffset,d=window.scrollY||pageYOffset,h=E.getBoundingClientRect(),o=h.height,i=h.width,g=h.top,l=h.right,T=h.bottom,I=h.left,F=y==="start"||y==="nearest"?g:y==="end"?T:g+o/2,W=b==="center"?I+i/2:b==="end"?l:I,V=[],M=0;M<C.length;M++){var N=C[M],J=N.getBoundingClientRect(),ae=J.height,ue=J.width,ve=J.top,Te=J.right,_e=J.bottom,fe=J.left;if(w==="if-needed"&&g>=0&&I>=0&&T<=_&&l<=m&&g>=ve&&T<=_e&&I>=fe&&l<=Te)return V;var ne=getComputedStyle(N),me=parseInt(ne.borderLeftWidth,10),ie=parseInt(ne.borderTopWidth,10),le=parseInt(ne.borderRightWidth,10),q=parseInt(ne.borderBottomWidth,10),re=0,oe=0,ge="offsetWidth"in N?N.offsetWidth-N.clientWidth-me-le:0,Se="offsetHeight"in N?N.offsetHeight-N.clientHeight-ie-q:0;if(f===N)re=y==="start"?F:y==="end"?F-_:y==="nearest"?Z(d,d+_,_,ie,q,d+F,d+F+o,o):F-_/2,oe=b==="start"?W:b==="center"?W-m/2:b==="end"?W-m:Z(x,x+m,m,me,le,x+W,x+W+i,i),re=Math.max(0,re+d),oe=Math.max(0,oe+x);else{re=y==="start"?F-ve-ie:y==="end"?F-_e+q+Se:y==="nearest"?Z(ve,_e,ae,ie,q+Se,F,F+o,o):F-(ve+ae/2)+Se/2,oe=b==="start"?W-fe-me:b==="center"?W-(fe+ue/2)+ge/2:b==="end"?W-Te+le+ge:Z(fe,Te,ue,me,le+ge,W,W+i,i);var Ee=N.scrollLeft,Re=N.scrollTop;F+=Re-(re=Math.max(0,Math.min(Re+re,N.scrollHeight-ae+Se))),W+=Ee-(oe=Math.max(0,Math.min(Ee+oe,N.scrollWidth-ue+ge)))}V.push({el:N,top:re,left:oe})}return V};function O(E){return E===Object(E)&&Object.keys(E).length!==0}function j(E,A){A===void 0&&(A="auto");var P="scrollBehavior"in document.body.style;E.forEach(function(w){var y=w.el,b=w.top,c=w.left;y.scroll&&P?y.scroll({top:b,left:c,behavior:A}):(y.scrollTop=b,y.scrollLeft=c)})}function B(E){return E===!1?{block:"end",inline:"nearest"}:O(E)?E:{block:"start",inline:"nearest"}}function k(E,A){var P=!E.ownerDocument.documentElement.contains(E);if(O(A)&&typeof A.behavior=="function")return A.behavior(P?[]:U(E,A));if(P)return;var w=B(A);return j(U(E,w),w.behavior)}var D=ze.a=k},Zss7:function(gt,ze,Y){var ce;(function(X){var R=/^\s+/,Z=/\s+$/,U=0,O=X.round,j=X.min,B=X.max,k=X.random;function D(q,re){if(q=q||"",re=re||{},q instanceof D)return q;if(!(this instanceof D))return new D(q,re);var oe=E(q);this._originalInput=q,this._r=oe.r,this._g=oe.g,this._b=oe.b,this._a=oe.a,this._roundA=O(100*this._a)/100,this._format=re.format||oe.format,this._gradientType=re.gradientType,this._r<1&&(this._r=O(this._r)),this._g<1&&(this._g=O(this._g)),this._b<1&&(this._b=O(this._b)),this._ok=oe.ok,this._tc_id=U++}D.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var q=this.toRgb();return(q.r*299+q.g*587+q.b*114)/1e3},getLuminance:function(){var q=this.toRgb(),re,oe,ge,Se,Ee,Re;return re=q.r/255,oe=q.g/255,ge=q.b/255,re<=.03928?Se=re/12.92:Se=X.pow((re+.055)/1.055,2.4),oe<=.03928?Ee=oe/12.92:Ee=X.pow((oe+.055)/1.055,2.4),ge<=.03928?Re=ge/12.92:Re=X.pow((ge+.055)/1.055,2.4),.2126*Se+.7152*Ee+.0722*Re},setAlpha:function(q){return this._a=V(q),this._roundA=O(100*this._a)/100,this},toHsv:function(){var q=y(this._r,this._g,this._b);return{h:q.h*360,s:q.s,v:q.v,a:this._a}},toHsvString:function(){var q=y(this._r,this._g,this._b),re=O(q.h*360),oe=O(q.s*100),ge=O(q.v*100);return this._a==1?"hsv("+re+", "+oe+"%, "+ge+"%)":"hsva("+re+", "+oe+"%, "+ge+"%, "+this._roundA+")"},toHsl:function(){var q=P(this._r,this._g,this._b);return{h:q.h*360,s:q.s,l:q.l,a:this._a}},toHslString:function(){var q=P(this._r,this._g,this._b),re=O(q.h*360),oe=O(q.s*100),ge=O(q.l*100);return this._a==1?"hsl("+re+", "+oe+"%, "+ge+"%)":"hsla("+re+", "+oe+"%, "+ge+"%, "+this._roundA+")"},toHex:function(q){return c(this._r,this._g,this._b,q)},toHexString:function(q){return"#"+this.toHex(q)},toHex8:function(q){return s(this._r,this._g,this._b,this._a,q)},toHex8String:function(q){return"#"+this.toHex8(q)},toRgb:function(){return{r:O(this._r),g:O(this._g),b:O(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+O(this._r)+", "+O(this._g)+", "+O(this._b)+")":"rgba("+O(this._r)+", "+O(this._g)+", "+O(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:O(M(this._r,255)*100)+"%",g:O(M(this._g,255)*100)+"%",b:O(M(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+O(M(this._r,255)*100)+"%, "+O(M(this._g,255)*100)+"%, "+O(M(this._b,255)*100)+"%)":"rgba("+O(M(this._r,255)*100)+"%, "+O(M(this._g,255)*100)+"%, "+O(M(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:F[c(this._r,this._g,this._b,!0)]||!1},toFilter:function(q){var re="#"+u(this._r,this._g,this._b,this._a),oe=re,ge=this._gradientType?"GradientType = 1, ":"";if(q){var Se=D(q);oe="#"+u(Se._r,Se._g,Se._b,Se._a)}return"progid:DXImageTransform.Microsoft.gradient("+ge+"startColorstr="+re+",endColorstr="+oe+")"},toString:function(q){var re=!!q;q=q||this._format;var oe=!1,ge=this._a<1&&this._a>=0,Se=!re&&ge&&(q==="hex"||q==="hex6"||q==="hex3"||q==="hex4"||q==="hex8"||q==="name");return Se?q==="name"&&this._a===0?this.toName():this.toRgbString():(q==="rgb"&&(oe=this.toRgbString()),q==="prgb"&&(oe=this.toPercentageRgbString()),(q==="hex"||q==="hex6")&&(oe=this.toHexString()),q==="hex3"&&(oe=this.toHexString(!0)),q==="hex4"&&(oe=this.toHex8String(!0)),q==="hex8"&&(oe=this.toHex8String()),q==="name"&&(oe=this.toName()),q==="hsl"&&(oe=this.toHslString()),q==="hsv"&&(oe=this.toHsvString()),oe||this.toHexString())},clone:function(){return D(this.toString())},_applyModification:function(q,re){var oe=q.apply(null,[this].concat([].slice.call(re)));return this._r=oe._r,this._g=oe._g,this._b=oe._b,this.setAlpha(oe._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(_,arguments)},darken:function(){return this._applyModification(x,arguments)},desaturate:function(){return this._applyModification(f,arguments)},saturate:function(){return this._applyModification(C,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(d,arguments)},_applyCombination:function(q,re){return q.apply(null,[this].concat([].slice.call(re)))},analogous:function(){return this._applyCombination(l,arguments)},complement:function(){return this._applyCombination(h,arguments)},monochromatic:function(){return this._applyCombination(T,arguments)},splitcomplement:function(){return this._applyCombination(g,arguments)},triad:function(){return this._applyCombination(o,arguments)},tetrad:function(){return this._applyCombination(i,arguments)}},D.fromRatio=function(q,re){if(typeof q=="object"){var oe={};for(var ge in q)q.hasOwnProperty(ge)&&(ge==="a"?oe[ge]=q[ge]:oe[ge]=Te(q[ge]));q=oe}return D(q,re)};function E(q){var re={r:0,g:0,b:0},oe=1,ge=null,Se=null,Ee=null,Re=!1,Pe=!1;return typeof q=="string"&&(q=ie(q)),typeof q=="object"&&(me(q.r)&&me(q.g)&&me(q.b)?(re=A(q.r,q.g,q.b),Re=!0,Pe=String(q.r).substr(-1)==="%"?"prgb":"rgb"):me(q.h)&&me(q.s)&&me(q.v)?(ge=Te(q.s),Se=Te(q.v),re=b(q.h,ge,Se),Re=!0,Pe="hsv"):me(q.h)&&me(q.s)&&me(q.l)&&(ge=Te(q.s),Ee=Te(q.l),re=w(q.h,ge,Ee),Re=!0,Pe="hsl"),q.hasOwnProperty("a")&&(oe=q.a)),oe=V(oe),{ok:Re,format:q.format||Pe,r:j(255,B(re.r,0)),g:j(255,B(re.g,0)),b:j(255,B(re.b,0)),a:oe}}function A(q,re,oe){return{r:M(q,255)*255,g:M(re,255)*255,b:M(oe,255)*255}}function P(q,re,oe){q=M(q,255),re=M(re,255),oe=M(oe,255);var ge=B(q,re,oe),Se=j(q,re,oe),Ee,Re,Pe=(ge+Se)/2;if(ge==Se)Ee=Re=0;else{var Ue=ge-Se;Re=Pe>.5?Ue/(2-ge-Se):Ue/(ge+Se);switch(ge){case q:Ee=(re-oe)/Ue+(re<oe?6:0);break;case re:Ee=(oe-q)/Ue+2;break;case oe:Ee=(q-re)/Ue+4;break}Ee/=6}return{h:Ee,s:Re,l:Pe}}function w(q,re,oe){var ge,Se,Ee;q=M(q,360),re=M(re,100),oe=M(oe,100);function Re(He,Fe,Ne){return Ne<0&&(Ne+=1),Ne>1&&(Ne-=1),Ne<1/6?He+(Fe-He)*6*Ne:Ne<1/2?Fe:Ne<2/3?He+(Fe-He)*(2/3-Ne)*6:He}if(re===0)ge=Se=Ee=oe;else{var Pe=oe<.5?oe*(1+re):oe+re-oe*re,Ue=2*oe-Pe;ge=Re(Ue,Pe,q+1/3),Se=Re(Ue,Pe,q),Ee=Re(Ue,Pe,q-1/3)}return{r:ge*255,g:Se*255,b:Ee*255}}function y(q,re,oe){q=M(q,255),re=M(re,255),oe=M(oe,255);var ge=B(q,re,oe),Se=j(q,re,oe),Ee,Re,Pe=ge,Ue=ge-Se;if(Re=ge===0?0:Ue/ge,ge==Se)Ee=0;else{switch(ge){case q:Ee=(re-oe)/Ue+(re<oe?6:0);break;case re:Ee=(oe-q)/Ue+2;break;case oe:Ee=(q-re)/Ue+4;break}Ee/=6}return{h:Ee,s:Re,v:Pe}}function b(q,re,oe){q=M(q,360)*6,re=M(re,100),oe=M(oe,100);var ge=X.floor(q),Se=q-ge,Ee=oe*(1-re),Re=oe*(1-Se*re),Pe=oe*(1-(1-Se)*re),Ue=ge%6,He=[oe,Re,Ee,Ee,Pe,oe][Ue],Fe=[Pe,oe,oe,Re,Ee,Ee][Ue],Ne=[Ee,Ee,Pe,oe,oe,Re][Ue];return{r:He*255,g:Fe*255,b:Ne*255}}function c(q,re,oe,ge){var Se=[ve(O(q).toString(16)),ve(O(re).toString(16)),ve(O(oe).toString(16))];return ge&&Se[0].charAt(0)==Se[0].charAt(1)&&Se[1].charAt(0)==Se[1].charAt(1)&&Se[2].charAt(0)==Se[2].charAt(1)?Se[0].charAt(0)+Se[1].charAt(0)+Se[2].charAt(0):Se.join("")}function s(q,re,oe,ge,Se){var Ee=[ve(O(q).toString(16)),ve(O(re).toString(16)),ve(O(oe).toString(16)),ve(_e(ge))];return Se&&Ee[0].charAt(0)==Ee[0].charAt(1)&&Ee[1].charAt(0)==Ee[1].charAt(1)&&Ee[2].charAt(0)==Ee[2].charAt(1)&&Ee[3].charAt(0)==Ee[3].charAt(1)?Ee[0].charAt(0)+Ee[1].charAt(0)+Ee[2].charAt(0)+Ee[3].charAt(0):Ee.join("")}function u(q,re,oe,ge){var Se=[ve(_e(ge)),ve(O(q).toString(16)),ve(O(re).toString(16)),ve(O(oe).toString(16))];return Se.join("")}D.equals=function(q,re){return!q||!re?!1:D(q).toRgbString()==D(re).toRgbString()},D.random=function(){return D.fromRatio({r:k(),g:k(),b:k()})};function f(q,re){re=re===0?0:re||10;var oe=D(q).toHsl();return oe.s-=re/100,oe.s=N(oe.s),D(oe)}function C(q,re){re=re===0?0:re||10;var oe=D(q).toHsl();return oe.s+=re/100,oe.s=N(oe.s),D(oe)}function v(q){return D(q).desaturate(100)}function m(q,re){re=re===0?0:re||10;var oe=D(q).toHsl();return oe.l+=re/100,oe.l=N(oe.l),D(oe)}function _(q,re){re=re===0?0:re||10;var oe=D(q).toRgb();return oe.r=B(0,j(255,oe.r-O(255*-(re/100)))),oe.g=B(0,j(255,oe.g-O(255*-(re/100)))),oe.b=B(0,j(255,oe.b-O(255*-(re/100)))),D(oe)}function x(q,re){re=re===0?0:re||10;var oe=D(q).toHsl();return oe.l-=re/100,oe.l=N(oe.l),D(oe)}function d(q,re){var oe=D(q).toHsl(),ge=(oe.h+re)%360;return oe.h=ge<0?360+ge:ge,D(oe)}function h(q){var re=D(q).toHsl();return re.h=(re.h+180)%360,D(re)}function o(q){var re=D(q).toHsl(),oe=re.h;return[D(q),D({h:(oe+120)%360,s:re.s,l:re.l}),D({h:(oe+240)%360,s:re.s,l:re.l})]}function i(q){var re=D(q).toHsl(),oe=re.h;return[D(q),D({h:(oe+90)%360,s:re.s,l:re.l}),D({h:(oe+180)%360,s:re.s,l:re.l}),D({h:(oe+270)%360,s:re.s,l:re.l})]}function g(q){var re=D(q).toHsl(),oe=re.h;return[D(q),D({h:(oe+72)%360,s:re.s,l:re.l}),D({h:(oe+216)%360,s:re.s,l:re.l})]}function l(q,re,oe){re=re||6,oe=oe||30;var ge=D(q).toHsl(),Se=360/oe,Ee=[D(q)];for(ge.h=(ge.h-(Se*re>>1)+720)%360;--re;)ge.h=(ge.h+Se)%360,Ee.push(D(ge));return Ee}function T(q,re){re=re||6;for(var oe=D(q).toHsv(),ge=oe.h,Se=oe.s,Ee=oe.v,Re=[],Pe=1/re;re--;)Re.push(D({h:ge,s:Se,v:Ee})),Ee=(Ee+Pe)%1;return Re}D.mix=function(q,re,oe){oe=oe===0?0:oe||50;var ge=D(q).toRgb(),Se=D(re).toRgb(),Ee=oe/100,Re={r:(Se.r-ge.r)*Ee+ge.r,g:(Se.g-ge.g)*Ee+ge.g,b:(Se.b-ge.b)*Ee+ge.b,a:(Se.a-ge.a)*Ee+ge.a};return D(Re)},D.readability=function(q,re){var oe=D(q),ge=D(re);return(X.max(oe.getLuminance(),ge.getLuminance())+.05)/(X.min(oe.getLuminance(),ge.getLuminance())+.05)},D.isReadable=function(q,re,oe){var ge=D.readability(q,re),Se,Ee;Ee=!1,Se=le(oe);switch(Se.level+Se.size){case"AAsmall":case"AAAlarge":Ee=ge>=4.5;break;case"AAlarge":Ee=ge>=3;break;case"AAAsmall":Ee=ge>=7;break}return Ee},D.mostReadable=function(q,re,oe){var ge=null,Se=0,Ee,Re,Pe,Ue;oe=oe||{},Re=oe.includeFallbackColors,Pe=oe.level,Ue=oe.size;for(var He=0;He<re.length;He++)Ee=D.readability(q,re[He]),Ee>Se&&(Se=Ee,ge=D(re[He]));return D.isReadable(q,ge,{level:Pe,size:Ue})||!Re?ge:(oe.includeFallbackColors=!1,D.mostReadable(q,["#fff","#000"],oe))};var I=D.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},F=D.hexNames=W(I);function W(q){var re={};for(var oe in q)q.hasOwnProperty(oe)&&(re[q[oe]]=oe);return re}function V(q){return q=parseFloat(q),(isNaN(q)||q<0||q>1)&&(q=1),q}function M(q,re){ae(q)&&(q="100%");var oe=ue(q);return q=j(re,B(0,parseFloat(q))),oe&&(q=parseInt(q*re,10)/100),X.abs(q-re)<1e-6?1:q%re/parseFloat(re)}function N(q){return j(1,B(0,q))}function J(q){return parseInt(q,16)}function ae(q){return typeof q=="string"&&q.indexOf(".")!=-1&&parseFloat(q)===1}function ue(q){return typeof q=="string"&&q.indexOf("%")!=-1}function ve(q){return q.length==1?"0"+q:""+q}function Te(q){return q<=1&&(q=q*100+"%"),q}function _e(q){return X.round(parseFloat(q)*255).toString(16)}function fe(q){return J(q)/255}var ne=function(){var q="[-\\+]?\\d+%?",re="[-\\+]?\\d*\\.\\d+%?",oe="(?:"+re+")|(?:"+q+")",ge="[\\s|\\(]+("+oe+")[,|\\s]+("+oe+")[,|\\s]+("+oe+")\\s*\\)?",Se="[\\s|\\(]+("+oe+")[,|\\s]+("+oe+")[,|\\s]+("+oe+")[,|\\s]+("+oe+")\\s*\\)?";return{CSS_UNIT:new RegExp(oe),rgb:new RegExp("rgb"+ge),rgba:new RegExp("rgba"+Se),hsl:new RegExp("hsl"+ge),hsla:new RegExp("hsla"+Se),hsv:new RegExp("hsv"+ge),hsva:new RegExp("hsva"+Se),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function me(q){return!!ne.CSS_UNIT.exec(q)}function ie(q){q=q.replace(R,"").replace(Z,"").toLowerCase();var re=!1;if(I[q])q=I[q],re=!0;else if(q=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var oe;return(oe=ne.rgb.exec(q))?{r:oe[1],g:oe[2],b:oe[3]}:(oe=ne.rgba.exec(q))?{r:oe[1],g:oe[2],b:oe[3],a:oe[4]}:(oe=ne.hsl.exec(q))?{h:oe[1],s:oe[2],l:oe[3]}:(oe=ne.hsla.exec(q))?{h:oe[1],s:oe[2],l:oe[3],a:oe[4]}:(oe=ne.hsv.exec(q))?{h:oe[1],s:oe[2],v:oe[3]}:(oe=ne.hsva.exec(q))?{h:oe[1],s:oe[2],v:oe[3],a:oe[4]}:(oe=ne.hex8.exec(q))?{r:J(oe[1]),g:J(oe[2]),b:J(oe[3]),a:fe(oe[4]),format:re?"name":"hex8"}:(oe=ne.hex6.exec(q))?{r:J(oe[1]),g:J(oe[2]),b:J(oe[3]),format:re?"name":"hex"}:(oe=ne.hex4.exec(q))?{r:J(oe[1]+""+oe[1]),g:J(oe[2]+""+oe[2]),b:J(oe[3]+""+oe[3]),a:fe(oe[4]+""+oe[4]),format:re?"name":"hex8"}:(oe=ne.hex3.exec(q))?{r:J(oe[1]+""+oe[1]),g:J(oe[2]+""+oe[2]),b:J(oe[3]+""+oe[3]),format:re?"name":"hex"}:!1}function le(q){var re,oe;return q=q||{level:"AA",size:"small"},re=(q.level||"AA").toUpperCase(),oe=(q.size||"small").toLowerCase(),re!=="AA"&&re!=="AAA"&&(re="AA"),oe!=="small"&&oe!=="large"&&(oe="small"),{level:re,size:oe}}gt.exports?gt.exports=D:!(ce=function(){return D}.call(ze,Y,ze,gt),ce!==void 0&&(gt.exports=ce))})(Math)},bT9E:function(gt,ze,Y){"use strict";Y.d(ze,"a",function(){return X});var ce=Y("VTBJ");function X(R,Z){var U=Object(ce.a)({},R);return Array.isArray(Z)&&Z.forEach(function(O){delete U[O]}),U}},biw7:function(gt,ze,Y){"use strict";var ce=Y("q1tI"),X=Y.n(ce),R=ce.createContext(null);ze.a=R},c5Ni:function(gt,ze,Y){},dejd:function(gt,ze,Y){},dmUQ:function(gt,ze,Y){"use strict";var ce=Y("Ff2n"),X=Y("rePB"),R=Y("1OyB"),Z=Y("vuIU"),U=Y("Ji7U"),O=Y("md7G"),j=Y("foSv"),B=Y("q1tI"),k=Y.n(B),D=Y("TSYQ"),E=Y.n(D),A=Y("4IlW");function P(o,i){var g=Object.keys(o);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(o);i&&(l=l.filter(function(T){return Object.getOwnPropertyDescriptor(o,T).enumerable})),g.push.apply(g,l)}return g}function w(o){for(var i=1;i<arguments.length;i++){var g=arguments[i]!=null?arguments[i]:{};i%2?P(Object(g),!0).forEach(function(l){Object(X.a)(o,l,g[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(g)):P(Object(g)).forEach(function(l){Object.defineProperty(o,l,Object.getOwnPropertyDescriptor(g,l))})}return o}function y(o){var i=b();return function(){var l=Object(j.a)(o),T;if(i){var I=Object(j.a)(this).constructor;T=Reflect.construct(l,arguments,I)}else T=l.apply(this,arguments);return Object(O.a)(this,T)}}function b(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(o){return!1}}function c(){}function s(o){o.preventDefault()}var u=function(i){return i.replace(/[^\w.-]+/g,"")},f=200,C=600,v=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,m=function(i){return i!=null},_=function(i,g){return g===i||typeof g=="number"&&typeof i=="number"&&isNaN(g)&&isNaN(i)},x=function(o){Object(U.a)(g,o);var i=y(g);function g(l){var T;Object(R.a)(this,g),T=i.call(this,l),T.onKeyDown=function(W){var V=T.props,M=V.onKeyDown,N=V.onPressEnter;if(W.keyCode===A.a.UP){var J=T.getRatio(W);T.up(W,J,null),T.stop()}else if(W.keyCode===A.a.DOWN){var ae=T.getRatio(W);T.down(W,ae,null),T.stop()}else W.keyCode===A.a.ENTER&&N&&N(W);if(T.recordCursorPosition(),T.lastKeyCode=W.keyCode,M){for(var ue=arguments.length,ve=new Array(ue>1?ue-1:0),Te=1;Te<ue;Te++)ve[Te-1]=arguments[Te];M.apply(void 0,[W].concat(ve))}},T.onKeyUp=function(W){var V=T.props.onKeyUp;if(T.stop(),T.recordCursorPosition(),V){for(var M=arguments.length,N=new Array(M>1?M-1:0),J=1;J<M;J++)N[J-1]=arguments[J];V.apply(void 0,[W].concat(N))}},T.onChange=function(W){var V=T.props.onChange;T.state.focused&&(T.inputting=!0),T.rawInput=T.props.parser(T.getValueFromEvent(W)),T.setState({inputValue:T.rawInput}),V(T.toNumber(T.rawInput))},T.onMouseUp=function(){var W=T.props.onMouseUp;T.recordCursorPosition(),W&&W.apply(void 0,arguments)},T.onFocus=function(){var W;T.setState({focused:!0}),(W=T.props).onFocus.apply(W,arguments)},T.onBlur=function(){var W=T.props.onBlur;T.inputting=!1,T.setState({focused:!1});var V=T.getCurrentValidValue(T.state.inputValue),M=T.setValue(V,c);if(W){var N=T.input.value,J=T.getInputDisplayValue({focus:!1,value:M});T.input.value=J&&Number(J),W.apply(void 0,arguments),T.input.value=N}},T.getRatio=function(W){var V=1;return W.metaKey||W.ctrlKey?V=.1:W.shiftKey&&(V=10),V},T.getFullNum=function(W){return isNaN(W)?W:/e/i.test(String(W))?Number(W).toFixed(18).replace(/\.?0+$/,""):W},T.getPrecision=function(W){if(m(T.props.precision))return T.props.precision;var V=String(W);if(V.indexOf("e-")>=0)return parseInt(V.slice(V.indexOf("e-")+2),10);var M=0;return V.indexOf(".")>=0&&(M=V.length-V.indexOf(".")-1),M},T.getInputDisplayValue=function(W){var V=W||T.state,M=V.focused,N=V.inputValue,J=V.value,ae;M?ae=N:ae=T.toPrecisionAsStep(J),ae==null&&(ae="");var ue=T.formatWrapper(ae);return m(T.props.decimalSeparator)&&(ue=ue.toString().replace(".",T.props.decimalSeparator)),ue},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(W){}},T.restoreByAfter=function(W){if(W===void 0)return!1;var V=T.input.value,M=V.lastIndexOf(W);if(M===-1)return!1;var N=T.cursorBefore.length;return T.lastKeyCode===A.a.DELETE&&T.cursorBefore.charAt(N-1)===W[0]?(T.fixCaret(N,N),!0):M+W.length===V.length?(T.fixCaret(M,M),!0):!1},T.partRestoreByAfter=function(W){return W===void 0?!1:Array.prototype.some.call(W,function(V,M){var N=W.substring(M);return T.restoreByAfter(N)})},T.isNotCompleteNumber=function(W){return isNaN(W)||W===""||W===null||W&&W.toString().indexOf(".")===W.toString().length-1},T.stop=function(){T.autoStepTimer&&clearTimeout(T.autoStepTimer)},T.down=function(W,V,M){T.pressingUpOrDown=!0,T.step("down",W,V,M)},T.up=function(W,V,M){T.pressingUpOrDown=!0,T.step("up",W,V,M)},T.saveInput=function(W){T.input=W};var I=l.value;I===void 0&&(I=l.defaultValue),T.state={focused:l.autoFocus};var F=T.getValidValue(T.toNumber(I));return T.state=w(w({},T.state),{},{inputValue:T.toPrecisionAsStep(F),value:F}),T}return Object(Z.a)(g,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(T){var I=this.props,F=I.value,W=I.onChange,V=I.max,M=I.min,N=this.state.focused;if(T){if(!_(T.value,F)||!_(T.max,V)||!_(T.min,M)){var J=N?F:this.getValidValue(F),ae;this.pressingUpOrDown?ae=J:this.inputting?ae=this.rawInput:ae=this.toPrecisionAsStep(J),this.setState({value:J,inputValue:ae})}var ue="value"in this.props?F:this.state.value;"max"in this.props&&T.max!==V&&typeof ue=="number"&&ue>V&&W&&W(V),"min"in this.props&&T.min!==M&&typeof ue=="number"&&ue<M&&W&&W(M)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ve=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===A.a.BACKSPACE?ve=this.cursorStart-1:this.lastKeyCode===A.a.DELETE&&(ve=this.cursorStart):ve=this.input.value.length,this.fixCaret(ve,ve)}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(Te){}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 I=T;return I===""?I="":this.isNotCompleteNumber(parseFloat(I))?I=this.state.value:I=this.getValidValue(I),this.toNumber(I)}},{key:"getValueFromEvent",value:function(T){var I=T.target.value.trim().replace(/。/g,".");return m(this.props.decimalSeparator)&&(I=I.replace(this.props.decimalSeparator,".")),I}},{key:"getValidValue",value:function(T){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,W=parseFloat(T);return isNaN(W)?T:(W<I&&(W=I),W>F&&(W=F),W)}},{key:"setValue",value:function(T,I){var F=this.props.precision,W=this.isNotCompleteNumber(parseFloat(T))?null:parseFloat(T),V=this.state.value,M=V===void 0?null:V,N=this.state.inputValue,J=N===void 0?null:N,ae=typeof W=="number"?W.toFixed(F):"".concat(W),ue=W!==M||ae!=="".concat(J);return"value"in this.props?(J=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:J},I)):this.setState({value:W,inputValue:this.toPrecisionAsStep(T)},I),ue&&this.props.onChange(W),W}},{key:"getMaxPrecision",value:function(T){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.props,W=F.precision,V=F.step;if(m(W))return W;var M=this.getPrecision(I),N=this.getPrecision(V),J=this.getPrecision(T);return T?Math.max(J,M+N):M+N}},{key:"getPrecisionFactor",value:function(T){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.getMaxPrecision(T,I);return Math.pow(10,F)}},{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 I=Math.abs(this.getMaxPrecision(T));return isNaN(I)?T.toString():Number(T).toFixed(I)}},{key:"toNumber",value:function(T){var I=this.props.precision,F=this.state.focused,W=T&&T.length>16&&F;return this.isNotCompleteNumber(T)||W?T:m(I)?Math.round(T*Math.pow(10,I))/Math.pow(10,I):Number(T)}},{key:"upStep",value:function(T,I){var F=this.props.step,W=this.getPrecisionFactor(T,I),V=Math.abs(this.getMaxPrecision(T,I)),M=((W*T+W*F*I)/W).toFixed(V);return this.toNumber(M)}},{key:"downStep",value:function(T,I){var F=this.props.step,W=this.getPrecisionFactor(T,I),V=Math.abs(this.getMaxPrecision(T,I)),M=((W*T-W*F*I)/W).toFixed(V);return this.toNumber(M)}},{key:"step",value:function(T,I){var F=this,W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),I&&(I.persist(),I.preventDefault());var M=this.props;if(M.disabled)return;var N=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(N))return;var J=this["".concat(T,"Step")](N,W),ae=J>M.max||J<M.min;if(J>M.max?J=M.max:J<M.min&&(J=M.min),this.setValue(J,null),this.setState({focused:!0},function(){F.pressingUpOrDown=!1}),ae)return;this.autoStepTimer=setTimeout(function(){F[T](I,W,!0)},V?f:C)}},{key:"fixCaret",value:function(T,I){if(T===void 0||I===void 0||!this.input||!this.input.value)return;try{var F=this.input.selectionStart,W=this.input.selectionEnd;(T!==F||I!==W)&&this.input.setSelectionRange(T,I)}catch(V){}}},{key:"render",value:function(){var T,I=this.props,F=I.prefixCls,W=I.disabled,V=I.readOnly,M=I.useTouch,N=I.autoComplete,J=I.upHandler,ae=I.downHandler,ue=I.className,ve=I.max,Te=I.min,_e=I.style,fe=I.title,ne=I.onMouseEnter,me=I.onMouseLeave,ie=I.onMouseOver,le=I.onMouseOut,q=I.required,re=I.onClick,oe=I.tabIndex,ge=I.type,Se=I.placeholder,Ee=I.id,Re=I.inputMode,Pe=I.pattern,Ue=I.step,He=I.maxLength,Fe=I.autoFocus,Ne=I.name,qe=I.onPaste,Je=I.onInput,it=Object(ce.a)(I,["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"]),rt=this.state,ht=rt.value,ft=rt.focused,ke=E()(F,(T={},Object(X.a)(T,ue,!!ue),Object(X.a)(T,"".concat(F,"-disabled"),W),Object(X.a)(T,"".concat(F,"-focused"),ft),T)),Le={};Object.keys(it).forEach(function(ye){(ye.substr(0,5)==="data-"||ye.substr(0,5)==="aria-"||ye==="role")&&(Le[ye]=it[ye])});var Ge=!V&&!W,Ke=this.getInputDisplayValue(null),Me=(ht||ht===0)&&(isNaN(ht)||Number(ht)>=ve),je=(ht||ht===0)&&(isNaN(ht)||Number(ht)<=Te),xe=Me||W||V,pe=je||W||V,be=E()("".concat(F,"-handler"),"".concat(F,"-handler-up"),Object(X.a)({},"".concat(F,"-handler-up-disabled"),xe)),te=E()("".concat(F,"-handler"),"".concat(F,"-handler-down"),Object(X.a)({},"".concat(F,"-handler-down-disabled"),pe)),de=M?{onTouchStart:xe?c:this.up,onTouchEnd:this.stop}:{onMouseDown:xe?c:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},he=M?{onTouchStart:pe?c:this.down,onTouchEnd:this.stop}:{onMouseDown:pe?c:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return k.a.createElement("div",{className:ke,style:_e,title:fe,onMouseEnter:ne,onMouseLeave:me,onMouseOver:ie,onMouseOut:le,onFocus:function(){return null},onBlur:function(){return null}},k.a.createElement("div",{className:"".concat(F,"-handler-wrap")},k.a.createElement("span",Object.assign({unselectable:"on"},de,{role:"button","aria-label":"Increase Value","aria-disabled":xe,className:be}),J||k.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-up-inner"),onClick:s})),k.a.createElement("span",Object.assign({unselectable:"on"},he,{role:"button","aria-label":"Decrease Value","aria-disabled":pe,className:te}),ae||k.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-down-inner"),onClick:s}))),k.a.createElement("div",{className:"".concat(F,"-input-wrap")},k.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Te,"aria-valuemax":ve,"aria-valuenow":ht,required:q,type:ge,placeholder:Se,onPaste:qe,onClick:re,onMouseUp:this.onMouseUp,className:"".concat(F,"-input"),tabIndex:oe,autoComplete:N,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Ge?this.onKeyDown:c,onKeyUp:Ge?this.onKeyUp:c,autoFocus:Fe,maxLength:He,readOnly:V,disabled:W,max:ve,min:Te,step:Ue,name:Ne,title:fe,id:Ee,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ke),pattern:Pe,inputMode:Re,onInput:Je},Le))))}}]),g}(k.a.Component);x.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:v,min:-v,step:1,style:{},onChange:c,onKeyDown:c,onPressEnter:c,onFocus:c,onBlur:c,parser:u,required:!1,autoComplete:"off"};var d=x,h=ze.a=d},fAei:function(gt,ze,Y){"use strict";Y.d(ze,"a",function(){return f.a});var ce=Y("rePB"),X=Y("VTBJ"),R=Y("KQm4"),Z=Y("1OyB"),U=Y("vuIU"),O=Y("Ji7U"),j=Y("LK+K"),B=Y("q1tI"),k=Y("4IlW"),D=Y("Kwbf"),E=Y("TSYQ"),A=Y.n(E),P=Y("sboe"),w=Y("OZM5"),y=Y("815F"),b=Y("ODXe"),c=Y("Ff2n"),s=Y("+nKL"),u=Y("8XRh"),f=Y("WaYH"),C=function(Te,_e){var fe=Te.className,ne=Te.style,me=Te.motion,ie=Te.motionNodes,le=Te.motionType,q=Te.onMotionStart,re=Te.onMotionEnd,oe=Te.active,ge=Te.treeNodeRequiredProps,Se=Object(c.a)(Te,["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"]),Ee=B.useState(!0),Re=Object(b.a)(Ee,2),Pe=Re[0],Ue=Re[1],He=B.useContext(P.a),Fe=He.prefixCls,Ne=B.useRef(!1),qe=function(){Ne.current||re(),Ne.current=!0};return Object(B.useEffect)(function(){ie&&le==="hide"&&Pe&&Ue(!1)},[ie]),Object(B.useEffect)(function(){return ie&&q(),function(){ie&&qe()}},[]),ie?B.createElement(u.default,Object.assign({ref:_e,visible:Pe},me,{motionAppear:le==="show",onAppearEnd:qe,onLeaveEnd:qe}),function(Je,it){var rt=Je.className,ht=Je.style;return B.createElement("div",{ref:it,className:A()("".concat(Fe,"-treenode-motion"),rt),style:ht},ie.map(function(ft){var ke=ft.data,Le=ke.key,Ge=Object(c.a)(ke,["key"]),Ke=ft.isStart,Me=ft.isEnd;delete Ge.children;var je=Object(y.f)(Le,ge);return B.createElement(f.a,Object.assign({},Ge,je,{active:oe,data:ft.data,key:Le,isStart:Ke,isEnd:Me}))}))}):B.createElement(f.a,Object.assign({domRef:_e,className:fe,style:ne},Se,{active:oe}))};C.displayName="MotionTreeNode";var v=B.forwardRef(C),m=v;function _(){var ve=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],_e=ve.length,fe=Te.length;if(Math.abs(_e-fe)!==1)return{add:!1,key:null};function ne(me,ie){var le=new Map;me.forEach(function(re){le.set(re,!0)});var q=ie.filter(function(re){return!le.has(re)});return q.length===1?q[0]:null}return _e<fe?{add:!0,key:ne(ve,Te)}:{add:!1,key:ne(Te,ve)}}function x(ve,Te,_e){var fe=ve.findIndex(function(le){var q=le.data;return q.key===_e}),ne=ve[fe+1],me=Te.findIndex(function(le){var q=le.data;return q.key===_e});if(ne){var ie=Te.findIndex(function(le){var q=le.data;return q.key===ne.data.key});return Te.slice(me+1,ie)}return Te.slice(me+1)}var d={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},h=function(){},o="RC_TREE_MOTION_".concat(Math.random()),i={key:o},g={key:o,level:0,index:0,pos:"0",node:i},l={parent:null,children:[],pos:g.pos,data:i,isStart:[],isEnd:[]};function T(ve,Te,_e,fe){return Te===!1||!_e?ve:ve.slice(0,Math.ceil(_e/fe)+1)}function I(ve){var Te=ve.data.key,_e=ve.pos;return Object(y.e)(Te,_e)}function F(ve){for(var Te=String(ve.data.key),_e=ve;_e.parent;)_e=_e.parent,Te="".concat(_e.data.key," > ").concat(Te);return Te}var W=function(Te,_e){var fe=Te.prefixCls,ne=Te.data,me=Te.selectable,ie=Te.checkable,le=Te.expandedKeys,q=Te.selectedKeys,re=Te.checkedKeys,oe=Te.loadedKeys,ge=Te.loadingKeys,Se=Te.halfCheckedKeys,Ee=Te.keyEntities,Re=Te.disabled,Pe=Te.dragging,Ue=Te.dragOverNodeKey,He=Te.dropPosition,Fe=Te.motion,Ne=Te.height,qe=Te.itemHeight,Je=Te.virtual,it=Te.focusable,rt=Te.activeItem,ht=Te.focused,ft=Te.tabIndex,ke=Te.onKeyDown,Le=Te.onFocus,Ge=Te.onBlur,Ke=Te.onActiveChange,Me=Te.onListChangeStart,je=Te.onListChangeEnd,xe=Object(c.a)(Te,["prefixCls","data","selectable","checkable","expandedKeys","selectedKeys","checkedKeys","loadedKeys","loadingKeys","halfCheckedKeys","keyEntities","disabled","dragging","dragOverNodeKey","dropPosition","motion","height","itemHeight","virtual","focusable","activeItem","focused","tabIndex","onKeyDown","onFocus","onBlur","onActiveChange","onListChangeStart","onListChangeEnd"]),pe=B.useRef(null);B.useImperativeHandle(_e,function(){return{scrollTo:function(lt){pe.current.scrollTo(lt)}}});var be=B.useState(le),te=Object(b.a)(be,2),de=te[0],he=te[1],ye=B.useState(ne),De=Object(b.a)(ye,2),we=De[0],We=De[1],Qe=B.useState(ne),nt=Object(b.a)(Qe,2),Ve=nt[0],dt=nt[1],ct=B.useState([]),at=Object(b.a)(ct,2),Dt=at[0],wt=at[1],xt=B.useState(null),kt=Object(b.a)(xt,2),Et=kt[0],Mt=kt[1];function Rt(){We(ne),dt(ne),wt([]),Mt(null),je()}B.useEffect(function(){he(le);var ot=_(de,le);if(ot.key!==null)if(ot.add){var lt=we.findIndex(function(or){var $t=or.data.key;return $t===ot.key}),st=T(x(we,ne,ot.key),Je,Ne,qe),zt=we.slice();zt.splice(lt+1,0,l),dt(zt),wt(st),Mt("show")}else{var Wt=ne.findIndex(function(or){var $t=or.data.key;return $t===ot.key}),St=T(x(ne,we,ot.key),Je,Ne,qe),ut=ne.slice();ut.splice(Wt+1,0,l),dt(ut),wt(St),Mt("hide")}else we!==ne&&(We(ne),dt(ne))},[le,ne]),B.useEffect(function(){Pe||Rt()},[Pe]);var Xe=Fe?Ve:ne,bt={expandedKeys:le,selectedKeys:q,loadedKeys:oe,loadingKeys:ge,checkedKeys:re,halfCheckedKeys:Se,dragOverNodeKey:Ue,dropPosition:He,keyEntities:Ee};return B.createElement(B.Fragment,null,ht&&rt&&B.createElement("span",{style:d,"aria-live":"assertive"},F(rt)),B.createElement("div",{role:"tree"},B.createElement("input",{style:d,disabled:it===!1||Re,tabIndex:it!==!1?ft:null,onKeyDown:ke,onFocus:Le,onBlur:Ge,value:"",onChange:h})),B.createElement(s.a,Object.assign({},xe,{data:Xe,itemKey:I,height:Ne,fullHeight:!1,virtual:Je,itemHeight:qe,prefixCls:"".concat(fe,"-list"),ref:pe}),function(ot){var lt=ot.pos,st=ot.data,zt=st.key,Wt=Object(c.a)(st,["key"]),St=ot.isStart,ut=ot.isEnd,or=Object(y.e)(zt,lt);delete Wt.children;var $t=Object(y.f)(or,bt);return B.createElement(m,Object.assign({},Wt,$t,{active:rt&&zt===rt.data.key,pos:lt,data:ot.data,isStart:St,isEnd:ut,motion:Fe,motionNodes:zt===o?Dt:null,motionType:Et,onMotionStart:Me,onMotionEnd:Rt,treeNodeRequiredProps:bt,onMouseMove:function(){Ke(null)}}))}))},V=B.forwardRef(W);V.displayName="NodeList";var M=V,N=Y("NvD2"),J=function(ve){Object(O.a)(_e,ve);var Te=Object(j.a)(_e);function _e(){var fe;return Object(Z.a)(this,_e),fe=Te.apply(this,arguments),fe.destroyed=!1,fe.state={keyEntities:{},selectedKeys:[],checkedKeys:[],halfCheckedKeys:[],loadedKeys:[],loadingKeys:[],expandedKeys:[],dragging:!1,dragNodesKeys:[],dragOverNodeKey:null,dropPosition:null,treeData:[],flattenNodes:[],focused:!1,activeKey:null,listChanging:!1,prevProps:null},fe.listRef=B.createRef(),fe.onNodeDragStart=function(ne,me){var ie=fe.state,le=ie.expandedKeys,q=ie.keyEntities,re=fe.props.onDragStart,oe=me.props.eventKey;fe.dragNode=me;var ge=Object(w.b)(le,oe);fe.setState({dragging:!0,dragNodesKeys:Object(w.g)(oe,q)}),fe.setExpandedKeys(ge),re&&re({event:ne,node:Object(y.b)(me.props)})},fe.onNodeDragEnter=function(ne,me){var ie=fe.state,le=ie.expandedKeys,q=ie.keyEntities,re=ie.dragNodesKeys,oe=fe.props.onDragEnter,ge=me.props,Se=ge.pos,Ee=ge.eventKey;if(!fe.dragNode||re.indexOf(Ee)!==-1)return;var Re=Object(w.c)(ne,me);if(fe.dragNode.props.eventKey===Ee&&Re===0){fe.setState({dragOverNodeKey:"",dropPosition:null});return}setTimeout(function(){fe.setState({dragOverNodeKey:Ee,dropPosition:Re}),fe.delayedDragEnterLogic||(fe.delayedDragEnterLogic={}),Object.keys(fe.delayedDragEnterLogic).forEach(function(Pe){clearTimeout(fe.delayedDragEnterLogic[Pe])}),fe.delayedDragEnterLogic[Se]=window.setTimeout(function(){if(!fe.state.dragging)return;var Pe=Object(R.a)(le),Ue=q[Ee];Ue&&(Ue.children||[]).length&&(Pe=Object(w.a)(le,Ee)),"expandedKeys"in fe.props||fe.setExpandedKeys(Pe),oe&&oe({event:ne,node:Object(y.b)(me.props),expandedKeys:Pe})},400)},0)},fe.onNodeDragOver=function(ne,me){var ie=fe.state.dragNodesKeys,le=fe.props.onDragOver,q=me.props.eventKey;if(ie.indexOf(q)!==-1)return;if(fe.dragNode&&q===fe.state.dragOverNodeKey){var re=Object(w.c)(ne,me);if(re===fe.state.dropPosition)return;fe.setState({dropPosition:re})}le&&le({event:ne,node:Object(y.b)(me.props)})},fe.onNodeDragLeave=function(ne,me){var ie=fe.props.onDragLeave;fe.setState({dragOverNodeKey:""}),ie&&ie({event:ne,node:Object(y.b)(me.props)})},fe.onNodeDragEnd=function(ne,me){var ie=fe.props.onDragEnd;fe.setState({dragOverNodeKey:""}),fe.cleanDragState(),ie&&ie({event:ne,node:Object(y.b)(me.props)}),fe.dragNode=null},fe.onNodeDrop=function(ne,me){var ie=fe.state,le=ie.dragNodesKeys,q=le===void 0?[]:le,re=ie.dropPosition,oe=fe.props.onDrop,ge=me.props,Se=ge.eventKey,Ee=ge.pos;if(fe.setState({dragOverNodeKey:""}),fe.cleanDragState(),q.indexOf(Se)!==-1){Object(D.a)(!1,"Can not drop to dragNode(include it's children node)");return}var Re=Object(w.k)(Ee),Pe={event:ne,node:Object(y.b)(me.props),dragNode:fe.dragNode?Object(y.b)(fe.dragNode.props):null,dragNodesKeys:q.slice(),dropPosition:re+Number(Re[Re.length-1]),dropToGap:!1};re!==0&&(Pe.dropToGap=!0),oe&&oe(Pe),fe.dragNode=null},fe.cleanDragState=function(){var ne=fe.state.dragging;ne&&fe.setState({dragging:!1})},fe.onNodeClick=function(ne,me){var ie=fe.props.onClick;ie&&ie(ne,me)},fe.onNodeDoubleClick=function(ne,me){var ie=fe.props.onDoubleClick;ie&&ie(ne,me)},fe.onNodeSelect=function(ne,me){var ie=fe.state.selectedKeys,le=fe.state.keyEntities,q=fe.props,re=q.onSelect,oe=q.multiple,ge=me.selected,Se=me.key,Ee=!ge;Ee?oe?ie=Object(w.a)(ie,Se):ie=[Se]:ie=Object(w.b)(ie,Se);var Re=ie.map(function(Pe){var Ue=le[Pe];return Ue?Ue.node:null}).filter(function(Pe){return Pe});fe.setUncontrolledState({selectedKeys:ie}),re&&re(ie,{event:"select",selected:Ee,node:me,selectedNodes:Re,nativeEvent:ne.nativeEvent})},fe.onNodeCheck=function(ne,me,ie){var le=fe.state,q=le.keyEntities,re=le.checkedKeys,oe=le.halfCheckedKeys,ge=fe.props,Se=ge.checkStrictly,Ee=ge.onCheck,Re=me.key,Pe,Ue={event:"check",node:me,checked:ie,nativeEvent:ne.nativeEvent};if(Se){var He=ie?Object(w.a)(re,Re):Object(w.b)(re,Re),Fe=Object(w.b)(oe,Re);Pe={checked:He,halfChecked:Fe},Ue.checkedNodes=He.map(function(ht){return q[ht]}).filter(function(ht){return ht}).map(function(ht){return ht.node}),fe.setUncontrolledState({checkedKeys:He})}else{var Ne=Object(N.a)([].concat(Object(R.a)(re),[Re]),!0,q),qe=Ne.checkedKeys,Je=Ne.halfCheckedKeys;if(!ie){var it=new Set(qe);it.delete(Re);var rt=Object(N.a)(Array.from(it),{checked:!1,halfCheckedKeys:Je},q);qe=rt.checkedKeys,Je=rt.halfCheckedKeys}Pe=qe,Ue.checkedNodes=[],Ue.checkedNodesPositions=[],Ue.halfCheckedKeys=Je,qe.forEach(function(ht){var ft=q[ht];if(!ft)return;var ke=ft.node,Le=ft.pos;Ue.checkedNodes.push(ke),Ue.checkedNodesPositions.push({node:ke,pos:Le})}),fe.setUncontrolledState({checkedKeys:qe},!1,{halfCheckedKeys:Je})}Ee&&Ee(Pe,Ue)},fe.onNodeLoad=function(ne){return new Promise(function(me){fe.setState(function(ie){var le=ie.loadedKeys,q=le===void 0?[]:le,re=ie.loadingKeys,oe=re===void 0?[]:re,ge=fe.props,Se=ge.loadData,Ee=ge.onLoad,Re=ne.key;if(!Se||q.indexOf(Re)!==-1||oe.indexOf(Re)!==-1)return{};var Pe=Se(ne);return Pe.then(function(){var Ue=fe.state,He=Ue.loadedKeys,Fe=Ue.loadingKeys,Ne=Object(w.a)(He,Re),qe=Object(w.b)(Fe,Re);Ee&&Ee(Ne,{event:"load",node:ne}),fe.setUncontrolledState({loadedKeys:Ne}),fe.setState({loadingKeys:qe}),me()}),{loadingKeys:Object(w.a)(oe,Re)}})})},fe.onNodeMouseEnter=function(ne,me){var ie=fe.props.onMouseEnter;ie&&ie({event:ne,node:me})},fe.onNodeMouseLeave=function(ne,me){var ie=fe.props.onMouseLeave;ie&&ie({event:ne,node:me})},fe.onNodeContextMenu=function(ne,me){var ie=fe.props.onRightClick;ie&&(ne.preventDefault(),ie({event:ne,node:me}))},fe.onFocus=function(){var ne=fe.props.onFocus;fe.setState({focused:!0}),ne&&ne.apply(void 0,arguments)},fe.onBlur=function(){var ne=fe.props.onBlur;fe.setState({focused:!1}),fe.onActiveChange(null),ne&&ne.apply(void 0,arguments)},fe.getTreeNodeRequiredProps=function(){var ne=fe.state,me=ne.expandedKeys,ie=ne.selectedKeys,le=ne.loadedKeys,q=ne.loadingKeys,re=ne.checkedKeys,oe=ne.halfCheckedKeys,ge=ne.dragOverNodeKey,Se=ne.dropPosition,Ee=ne.keyEntities;return{expandedKeys:me||[],selectedKeys:ie||[],loadedKeys:le||[],loadingKeys:q||[],checkedKeys:re||[],halfCheckedKeys:oe||[],dragOverNodeKey:ge,dropPosition:Se,keyEntities:Ee}},fe.setExpandedKeys=function(ne){var me=fe.state.treeData,ie=Object(y.d)(me,ne);fe.setUncontrolledState({expandedKeys:ne,flattenNodes:ie},!0)},fe.onNodeExpand=function(ne,me){var ie=fe.state.expandedKeys,le=fe.state.listChanging,q=fe.props,re=q.onExpand,oe=q.loadData,ge=me.key,Se=me.expanded;if(le)return;var Ee=ie.indexOf(ge),Re=!Se;if(Object(D.a)(Se&&Ee!==-1||!Se&&Ee===-1,"Expand state not sync with index check"),Re?ie=Object(w.a)(ie,ge):ie=Object(w.b)(ie,ge),fe.setExpandedKeys(ie),re&&re(ie,{node:me,expanded:Re,nativeEvent:ne.nativeEvent}),Re&&oe){var Pe=fe.onNodeLoad(me);Pe&&Pe.then(function(){var Ue=Object(y.d)(fe.state.treeData,ie);fe.setUncontrolledState({flattenNodes:Ue})})}},fe.onListChangeStart=function(){fe.setUncontrolledState({listChanging:!0})},fe.onListChangeEnd=function(){setTimeout(function(){fe.setUncontrolledState({listChanging:!1})})},fe.onActiveChange=function(ne){var me=fe.state.activeKey,ie=fe.props.onActiveChange;if(me===ne)return;fe.setState({activeKey:ne}),ne!==null&&fe.scrollTo({key:ne}),ie&&ie(ne)},fe.getActiveItem=function(){var ne=fe.state,me=ne.activeKey,ie=ne.flattenNodes;return me===null?null:ie.find(function(le){var q=le.data.key;return q===me})||null},fe.offsetActiveKey=function(ne){var me=fe.state,ie=me.flattenNodes,le=me.activeKey,q=ie.findIndex(function(ge){var Se=ge.data.key;return Se===le});q===-1&&ne<0&&(q=ie.length),q=(q+ne+ie.length)%ie.length;var re=ie[q];if(re){var oe=re.data.key;fe.onActiveChange(oe)}else fe.onActiveChange(null)},fe.onKeyDown=function(ne){var me=fe.state,ie=me.activeKey,le=me.expandedKeys,q=me.checkedKeys,re=fe.props,oe=re.onKeyDown,ge=re.checkable,Se=re.selectable;switch(ne.which){case k.a.UP:{fe.offsetActiveKey(-1),ne.preventDefault();break}case k.a.DOWN:{fe.offsetActiveKey(1),ne.preventDefault();break}}var Ee=fe.getActiveItem();if(Ee&&Ee.data){var Re=fe.getTreeNodeRequiredProps(),Pe=Ee.data.isLeaf===!1||!!(Ee.data.children||[]).length,Ue=Object(y.b)(Object(X.a)(Object(X.a)({},Object(y.f)(ie,Re)),{},{data:Ee.data,active:!0}));switch(ne.which){case k.a.LEFT:{Pe&&le.includes(ie)?fe.onNodeExpand({},Ue):Ee.parent&&fe.onActiveChange(Ee.parent.data.key),ne.preventDefault();break}case k.a.RIGHT:{Pe&&!le.includes(ie)?fe.onNodeExpand({},Ue):Ee.children&&Ee.children.length&&fe.onActiveChange(Ee.children[0].data.key),ne.preventDefault();break}case k.a.ENTER:case k.a.SPACE:{ge&&!Ue.disabled&&Ue.checkable!==!1&&!Ue.disableCheckbox?fe.onNodeCheck({},Ue,!q.includes(ie)):!ge&&Se&&!Ue.disabled&&Ue.selectable!==!1&&fe.onNodeSelect({},Ue);break}}}oe&&oe(ne)},fe.setUncontrolledState=function(ne){var me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ie=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(fe.destroyed)return;var le=!1,q=!0,re={};Object.keys(ne).forEach(function(oe){if(oe in fe.props){q=!1;return}le=!0,re[oe]=ne[oe]}),le&&(!me||q)&&fe.setState(Object(X.a)(Object(X.a)({},re),ie))},fe.scrollTo=function(ne){fe.listRef.current.scrollTo(ne)},fe}return Object(U.a)(_e,[{key:"componentWillUnmount",value:function(){this.destroyed=!0}},{key:"render",value:function(){var ne,me=this.state,ie=me.focused,le=me.flattenNodes,q=me.keyEntities,re=me.dragging,oe=me.activeKey,ge=this.props,Se=ge.prefixCls,Ee=ge.className,Re=ge.style,Pe=ge.showLine,Ue=ge.focusable,He=ge.tabIndex,Fe=He===void 0?0:He,Ne=ge.selectable,qe=ge.showIcon,Je=ge.icon,it=ge.switcherIcon,rt=ge.draggable,ht=ge.checkable,ft=ge.checkStrictly,ke=ge.disabled,Le=ge.motion,Ge=ge.loadData,Ke=ge.filterTreeNode,Me=ge.height,je=ge.itemHeight,xe=ge.virtual,pe=ge.titleRender,be=ge.onContextMenu,te=Object(w.f)(this.props);return B.createElement(P.a.Provider,{value:{prefixCls:Se,selectable:Ne,showIcon:qe,icon:Je,switcherIcon:it,draggable:rt,checkable:ht,checkStrictly:ft,disabled:ke,keyEntities:q,loadData:Ge,filterTreeNode:Ke,titleRender:pe,onNodeClick:this.onNodeClick,onNodeDoubleClick:this.onNodeDoubleClick,onNodeExpand:this.onNodeExpand,onNodeSelect:this.onNodeSelect,onNodeCheck:this.onNodeCheck,onNodeLoad:this.onNodeLoad,onNodeMouseEnter:this.onNodeMouseEnter,onNodeMouseLeave:this.onNodeMouseLeave,onNodeContextMenu:this.onNodeContextMenu,onNodeDragStart:this.onNodeDragStart,onNodeDragEnter:this.onNodeDragEnter,onNodeDragOver:this.onNodeDragOver,onNodeDragLeave:this.onNodeDragLeave,onNodeDragEnd:this.onNodeDragEnd,onNodeDrop:this.onNodeDrop}},B.createElement("div",{className:A()(Se,Ee,(ne={},Object(ce.a)(ne,"".concat(Se,"-show-line"),Pe),Object(ce.a)(ne,"".concat(Se,"-focused"),ie),Object(ce.a)(ne,"".concat(Se,"-active-focused"),oe!==null),ne))},B.createElement(M,Object.assign({ref:this.listRef,prefixCls:Se,style:Re,data:le,disabled:ke,selectable:Ne,checkable:!!ht,motion:Le,dragging:re,height:Me,itemHeight:je,virtual:xe,focusable:Ue,focused:ie,tabIndex:Fe,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:be},this.getTreeNodeRequiredProps(),te))))}}],[{key:"getDerivedStateFromProps",value:function(ne,me){var ie=me.prevProps,le={prevProps:ne};function q(Je){return!ie&&Je in ne||ie&&ie[Je]!==ne[Je]}var re;if(q("treeData")?re=ne.treeData:q("children")&&(Object(D.a)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),re=Object(y.c)(ne.children)),re){le.treeData=re;var oe=Object(y.a)(re);le.keyEntities=Object(X.a)(Object(ce.a)({},o,g),oe.keyEntities)}var ge=le.keyEntities||me.keyEntities;if(q("expandedKeys")||ie&&q("autoExpandParent"))le.expandedKeys=ne.autoExpandParent||!ie&&ne.defaultExpandParent?Object(w.e)(ne.expandedKeys,ge):ne.expandedKeys;else if(!ie&&ne.defaultExpandAll){var Se=Object(X.a)({},ge);delete Se[o],le.expandedKeys=Object.keys(Se).map(function(Je){return Se[Je].key})}else!ie&&ne.defaultExpandedKeys&&(le.expandedKeys=ne.autoExpandParent||ne.defaultExpandParent?Object(w.e)(ne.defaultExpandedKeys,ge):ne.defaultExpandedKeys);if(le.expandedKeys||delete le.expandedKeys,re||le.expandedKeys){var Ee=Object(y.d)(re||me.treeData,le.expandedKeys||me.expandedKeys);le.flattenNodes=Ee}if(ne.selectable&&(q("selectedKeys")?le.selectedKeys=Object(w.d)(ne.selectedKeys,ne):!ie&&ne.defaultSelectedKeys&&(le.selectedKeys=Object(w.d)(ne.defaultSelectedKeys,ne))),ne.checkable){var Re;if(q("checkedKeys")?Re=Object(w.j)(ne.checkedKeys)||{}:!ie&&ne.defaultCheckedKeys?Re=Object(w.j)(ne.defaultCheckedKeys)||{}:re&&(Re=Object(w.j)(ne.checkedKeys)||{checkedKeys:me.checkedKeys,halfCheckedKeys:me.halfCheckedKeys}),Re){var Pe=Re,Ue=Pe.checkedKeys,He=Ue===void 0?[]:Ue,Fe=Pe.halfCheckedKeys,Ne=Fe===void 0?[]:Fe;if(!ne.checkStrictly){var qe=Object(N.a)(He,!0,ge);He=qe.checkedKeys,Ne=qe.halfCheckedKeys}le.checkedKeys=He,le.halfCheckedKeys=Ne}}return q("loadedKeys")&&(le.loadedKeys=ne.loadedKeys),le}}]),_e}(B.Component);J.defaultProps={prefixCls:"rc-tree",showLine:!1,showIcon:!0,selectable:!0,multiple:!1,checkable:!1,disabled:!1,checkStrictly:!1,draggable:!1,defaultExpandParent:!0,autoExpandParent:!1,defaultExpandAll:!1,defaultExpandedKeys:[],defaultCheckedKeys:[],defaultSelectedKeys:[]},J.TreeNode=f.a;var ae=J,ue=ze.b=ae},fyJ8:function(gt,ze,Y){"use strict";var ce=Y("rePB"),X=Y("VTBJ"),R=Y("Ff2n"),Z=Y("U8pU"),U=Y("q1tI"),O=Y.n(U),j=Y("TSYQ"),B=Y.n(j),k=Y("c+Xe"),D=Y("sR1s");function E(b){return b&&Object(Z.a)(b)==="object"&&!Array.isArray(b)&&!U.isValidElement(b)}function A(b){return typeof b=="string"?!0:Object(k.c)(b)}function P(b,c){var s,u=b.prefixCls,f=b.className,C=b.record,v=b.index,m=b.dataIndex,_=b.render,x=b.children,d=b.component,h=d===void 0?"td":d,o=b.colSpan,i=b.rowSpan,g=b.fixLeft,l=b.fixRight,T=b.firstFixLeft,I=b.lastFixLeft,F=b.firstFixRight,W=b.lastFixRight,V=b.appendNode,M=b.additionalProps,N=M===void 0?{}:M,J=b.ellipsis,ae=b.align,ue=b.rowType,ve=b.isSticky,Te="".concat(u,"-cell"),_e,fe;if(x)fe=x;else{var ne=Object(D.b)(C,m);if(fe=ne,_){var me=_(ne,C,v);E(me)?(fe=me.children,_e=me.props):fe=me}}Object(Z.a)(fe)==="object"&&!Array.isArray(fe)&&!U.isValidElement(fe)&&(fe=null),J&&(I||F)&&(fe=U.createElement("span",{className:"".concat(Te,"-content")},fe));var ie=_e||{},le=ie.colSpan,q=ie.rowSpan,re=ie.style,oe=ie.className,ge=Object(R.a)(ie,["colSpan","rowSpan","style","className"]),Se=le!==void 0?le:o,Ee=q!==void 0?q:i;if(Se===0||Ee===0)return null;var Re={},Pe=typeof g=="number",Ue=typeof l=="number";Pe&&(Re.position="sticky",Re.left=g),Ue&&(Re.position="sticky",Re.right=l);var He={};ae&&(He.textAlign=ae);var Fe,Ne=J===!0?{showTitle:!0}:J;Ne&&(Ne.showTitle||ue==="header")&&(typeof fe=="string"||typeof fe=="number"?Fe=fe.toString():U.isValidElement(fe)&&typeof fe.props.children=="string"&&(Fe=fe.props.children));var qe=Object(X.a)(Object(X.a)(Object(X.a)({title:Fe},ge),N),{},{colSpan:Se&&Se!==1?Se:null,rowSpan:Ee&&Ee!==1?Ee:null,className:B()(Te,f,(s={},Object(ce.a)(s,"".concat(Te,"-fix-left"),Pe),Object(ce.a)(s,"".concat(Te,"-fix-left-first"),T),Object(ce.a)(s,"".concat(Te,"-fix-left-last"),I),Object(ce.a)(s,"".concat(Te,"-fix-right"),Ue),Object(ce.a)(s,"".concat(Te,"-fix-right-first"),F),Object(ce.a)(s,"".concat(Te,"-fix-right-last"),W),Object(ce.a)(s,"".concat(Te,"-ellipsis"),J),Object(ce.a)(s,"".concat(Te,"-with-append"),V),Object(ce.a)(s,"".concat(Te,"-fix-sticky"),(Pe||Ue)&&ve),s),N.className,oe),style:Object(X.a)(Object(X.a)(Object(X.a)(Object(X.a)({},N.style),He),Re),re),ref:A(h)?c:null});return U.createElement(h,Object.assign({},qe),V,fe)}var w=U.forwardRef(P);w.displayName="Cell";var y=U.memo(w,function(b,c){return c.shouldCellUpdate?!c.shouldCellUpdate(c.record,b.record):!1});ze.a=y},h78n:function(gt,ze,Y){"use strict";Y.d(ze,"a",function(){return T});var ce=Y("q1tI"),X=Y.n(ce),R=Y("TSYQ"),Z=Y.n(R),U={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},O=function(W){var V=W.map(function(){return Object(ce.useRef)()}),M=Object(ce.useRef)();return Object(ce.useEffect)(function(){var N=Date.now(),J=!1;Object.keys(V).forEach(function(ae){var ue=V[ae].current;if(!ue)return;J=!0;var ve=ue.style;ve.transitionDuration=".3s, .3s, .3s, .06s",M.current&&N-M.current<100&&(ve.transitionDuration="0s, 0s")}),J&&(M.current=Date.now())}),[V]};function j(){return j=Object.assign||function(F){for(var W=1;W<arguments.length;W++){var V=arguments[W];for(var M in V)Object.prototype.hasOwnProperty.call(V,M)&&(F[M]=V[M])}return F},j.apply(this,arguments)}function B(F,W){return P(F)||A(F,W)||D(F,W)||k()}function k(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function D(F,W){if(!F)return;if(typeof F=="string")return E(F,W);var V=Object.prototype.toString.call(F).slice(8,-1);if(V==="Object"&&F.constructor&&(V=F.constructor.name),V==="Map"||V==="Set")return Array.from(F);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return E(F,W)}function E(F,W){(W==null||W>F.length)&&(W=F.length);for(var V=0,M=new Array(W);V<W;V++)M[V]=F[V];return M}function A(F,W){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var V=[],M=!0,N=!1,J=void 0;try{for(var ae=F[Symbol.iterator](),ue;!(M=(ue=ae.next()).done)&&!(V.push(ue.value),W&&V.length===W);M=!0);}catch(ve){N=!0,J=ve}finally{try{!M&&ae.return!=null&&ae.return()}finally{if(N)throw J}}return V}function P(F){if(Array.isArray(F))return F}function w(F,W){if(F==null)return{};var V=y(F,W),M,N;if(Object.getOwnPropertySymbols){var J=Object.getOwnPropertySymbols(F);for(N=0;N<J.length;N++){if(M=J[N],W.indexOf(M)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,M))continue;V[M]=F[M]}}return V}function y(F,W){if(F==null)return{};var V={},M=Object.keys(F),N,J;for(J=0;J<M.length;J++){if(N=M[J],W.indexOf(N)>=0)continue;V[N]=F[N]}return V}var b=function(W){var V=W.className,M=W.percent,N=W.prefixCls,J=W.strokeColor,ae=W.strokeLinecap,ue=W.strokeWidth,ve=W.style,Te=W.trailColor,_e=W.trailWidth,fe=W.transition,ne=w(W,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete ne.gapPosition;var me=Array.isArray(M)?M:[M],ie=Array.isArray(J)?J:[J],le=O(me),q=B(le,1),re=q[0],oe=ue/2,ge=100-ue/2,Se="M ".concat(ae==="round"?oe:0,",").concat(oe,`
|
|
L `).concat(ae==="round"?ge:100,",").concat(oe),Ee="0 0 100 ".concat(ue),Re=0;return X.a.createElement("svg",j({className:Z()("".concat(N,"-line"),V),viewBox:Ee,preserveAspectRatio:"none",style:ve},ne),X.a.createElement("path",{className:"".concat(N,"-line-trail"),d:Se,strokeLinecap:ae,stroke:Te,strokeWidth:_e||ue,fillOpacity:"0"}),me.map(function(Pe,Ue){var He={strokeDasharray:"".concat(Pe,"px, 100px"),strokeDashoffset:"-".concat(Re,"px"),transition:fe||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Fe=ie[Ue]||ie[ie.length-1];return Re+=Pe,X.a.createElement("path",{key:Ue,className:"".concat(N,"-line-path"),d:Se,strokeLinecap:ae,stroke:Fe,strokeWidth:ue,fillOpacity:"0",ref:re[Ue],style:He})}))};b.defaultProps=U;var c=b;function s(){return s=Object.assign||function(F){for(var W=1;W<arguments.length;W++){var V=arguments[W];for(var M in V)Object.prototype.hasOwnProperty.call(V,M)&&(F[M]=V[M])}return F},s.apply(this,arguments)}function u(F,W){return _(F)||m(F,W)||C(F,W)||f()}function f(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function C(F,W){if(!F)return;if(typeof F=="string")return v(F,W);var V=Object.prototype.toString.call(F).slice(8,-1);if(V==="Object"&&F.constructor&&(V=F.constructor.name),V==="Map"||V==="Set")return Array.from(F);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return v(F,W)}function v(F,W){(W==null||W>F.length)&&(W=F.length);for(var V=0,M=new Array(W);V<W;V++)M[V]=F[V];return M}function m(F,W){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var V=[],M=!0,N=!1,J=void 0;try{for(var ae=F[Symbol.iterator](),ue;!(M=(ue=ae.next()).done)&&!(V.push(ue.value),W&&V.length===W);M=!0);}catch(ve){N=!0,J=ve}finally{try{!M&&ae.return!=null&&ae.return()}finally{if(N)throw J}}return V}function _(F){if(Array.isArray(F))return F}function x(F,W){if(F==null)return{};var V=d(F,W),M,N;if(Object.getOwnPropertySymbols){var J=Object.getOwnPropertySymbols(F);for(N=0;N<J.length;N++){if(M=J[N],W.indexOf(M)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,M))continue;V[M]=F[M]}}return V}function d(F,W){if(F==null)return{};var V={},M=Object.keys(F),N,J;for(J=0;J<M.length;J++){if(N=M[J],W.indexOf(N)>=0)continue;V[N]=F[N]}return V}var h=0;function o(F){return+F.replace("%","")}function i(F){return Array.isArray(F)?F:[F]}function g(F,W,V,M){var N=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,J=arguments.length>5?arguments[5]:void 0,ae=50-M/2,ue=0,ve=-ae,Te=0,_e=-2*ae;switch(J){case"left":ue=-ae,ve=0,Te=2*ae,_e=0;break;case"right":ue=ae,ve=0,Te=-2*ae,_e=0;break;case"bottom":ve=ae,_e=2*ae;break;default:}var fe="M 50,50 m ".concat(ue,",").concat(ve,`
|
|
a `).concat(ae,",").concat(ae," 0 1 1 ").concat(Te,",").concat(-_e,`
|
|
a `).concat(ae,",").concat(ae," 0 1 1 ").concat(-Te,",").concat(_e),ne=Math.PI*2*ae,me={stroke:V,strokeDasharray:"".concat(W/100*(ne-N),"px ").concat(ne,"px"),strokeDashoffset:"-".concat(N/2+F/100*(ne-N),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:fe,pathStyle:me}}var l=function(W){var V=W.prefixCls,M=W.strokeWidth,N=W.trailWidth,J=W.gapDegree,ae=W.gapPosition,ue=W.trailColor,ve=W.strokeLinecap,Te=W.style,_e=W.className,fe=W.strokeColor,ne=W.percent,me=x(W,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ie=Object(ce.useMemo)(function(){return h+=1,h},[]),le=g(0,100,ue,M,J,ae),q=le.pathString,re=le.pathStyle,oe=i(ne),ge=i(fe),Se=ge.find(function(He){return Object.prototype.toString.call(He)==="[object Object]"}),Ee=O(oe),Re=u(Ee,1),Pe=Re[0],Ue=function(){var Fe=0;return oe.map(function(Ne,qe){var Je=ge[qe]||ge[ge.length-1],it=Object.prototype.toString.call(Je)==="[object Object]"?"url(#".concat(V,"-gradient-").concat(ie,")"):"",rt=g(Fe,Ne,Je,M,J,ae);return Fe+=Ne,X.a.createElement("path",{key:qe,className:"".concat(V,"-circle-path"),d:rt.pathString,stroke:it,strokeLinecap:ve,strokeWidth:M,opacity:Ne===0?0:1,fillOpacity:"0",style:rt.pathStyle,ref:Pe[qe]})})};return X.a.createElement("svg",s({className:Z()("".concat(V,"-circle"),_e),viewBox:"0 0 100 100",style:Te},me),Se&&X.a.createElement("defs",null,X.a.createElement("linearGradient",{id:"".concat(V,"-gradient-").concat(ie),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Se).sort(function(He,Fe){return o(He)-o(Fe)}).map(function(He,Fe){return X.a.createElement("stop",{key:Fe,offset:He,stopColor:Se[He]})}))),X.a.createElement("path",{className:"".concat(V,"-circle-trail"),d:q,stroke:ue,strokeLinecap:ve,strokeWidth:N||M,fillOpacity:"0",style:re}),Ue().reverse())};l.defaultProps=U;var T=l,I={Line:c,Circle:T}},hW8S:function(gt,ze,Y){"use strict";Y.d(ze,"a",function(){return Z}),Y.d(ze,"c",function(){return U}),Y.d(ze,"b",function(){return O});var ce=Y("VTBJ"),X=Y("Ff2n"),R=Y("Kwbf"),Z="RC_TABLE_INTERNAL_COL_DEFINE";function U(j){var B=j.expandable,k=Object(X.a)(j,["expandable"]);return"expandable"in j?Object(ce.a)(Object(ce.a)({},k),B):k}function O(j){return Object.keys(j).reduce(function(B,k){return(k.substr(0,5)==="data-"||k.substr(0,5)==="aria-")&&(B[k]=j[k]),B},{})}},i58Z:function(gt,ze,Y){gt.exports={wrap:"wrap___Yg2Z9",addKnowledge:"addKnowledge___2FlI0",disabled:"disabled___1_wxN"}},kSUc:function(gt,ze,Y){},kqOp:function(gt,ze,Y){"use strict";Y.d(ze,"a",function(){return D});var ce=Y("0Owb"),X=Y("fWQN"),R=Y("mtLc"),Z=Y("yKVA"),U=Y("879j"),O=Y("q1tI"),j=Y.n(O),B=Y("Ot1p"),k="\u2581",D=function(E){Object(Z.a)(P,E);var A=Object(U.a)(P);function P(){var w;Object(X.a)(this,P);for(var y=arguments.length,b=new Array(y),c=0;c<y;c++)b[c]=arguments[c];return w=A.call.apply(A,[this].concat(b)),w.getChCountBeforeCursor=function(s,u){for(var f=u.line,C=0,v=0;v<f;v++)C+=s.getLine(v).split(k).length-1;var m=s.getLine(f).substring(0,u.ch);return C+=m.split(k).length-1,C},w.onCMBeforeChange=function(s,u){var f=s.getRange(u.from,u.to),C=0;if(u.text.forEach(function(x){C+=x.split(k).length-1}),f&&f.indexOf(k)!=-1){var v=f.split(k).length-1,m=w.getChCountBeforeCursor(s,u.from);console.log("\u5220\u9664".concat(v,"\u4E2A\uFF0C \u4E4B\u524D\u6709").concat(m,"\u4E2A\uFF0C\u65B0\u589E").concat(C,"\u4E2A")),w.props.deleteEmptyDisabled?u.cancel():w.props.onPlaceholderChange&&w.props.onPlaceholderChange(m,v,C)}else if(C){var _=w.getChCountBeforeCursor(s,u.from);console.log("\u65B0\u589E".concat(C,"\u4E2A\uFF0C\u4E4B\u524D\u6709").concat(_,"\u4E2A")),w.props.onPlaceholderChange&&w.props.onPlaceholderChange(_,0,C)}},w}return Object(R.a)(P,[{key:"render",value:function(){return j.a.createElement(B.a,Object(ce.a)({},this.props,{onCMBeforeChange:this.onCMBeforeChange}))}}]),P}(O.Component)},lZu9:function(gt,ze,Y){(function(ce){ce(Y("VrN/"),Y("1eCo"),Y("8EBN"))})(function(ce){"use strict";ce.defineMode("markdown",function(X,R){var Z=ce.getMode(X,"text/html"),U=Z.name=="null";function O(M){if(ce.findModeByName){var N=ce.findModeByName(M);N&&(M=N.mime||N.mimes[0])}var J=ce.getMode(X,M);return J.name=="null"?null:J}R.highlightFormatting===void 0&&(R.highlightFormatting=!1),R.maxBlockquoteDepth===void 0&&(R.maxBlockquoteDepth=0),R.taskLists===void 0&&(R.taskLists=!1),R.strikethrough===void 0&&(R.strikethrough=!1),R.emoji===void 0&&(R.emoji=!1),R.fencedCodeBlockHighlighting===void 0&&(R.fencedCodeBlockHighlighting=!0),R.fencedCodeBlockDefaultMode===void 0&&(R.fencedCodeBlockDefaultMode="text/plain"),R.xml===void 0&&(R.xml=!0),R.tokenTypeOverrides===void 0&&(R.tokenTypeOverrides={});var j={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 j)j.hasOwnProperty(B)&&R.tokenTypeOverrides[B]&&(j[B]=R.tokenTypeOverrides[B]);var k=/^([*\-_])(?:\s*\1){2,}\s*$/,D=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,E=/^\[(x| )\](?=\s)/i,A=R.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,P=/^ {0,3}(?:\={1,}|-{2,})\s*$/,w=/^[^#!\[\]*_\\<>` "'(~:]+/,y=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,b=/^\s*\[[^\]]+?\]:.*$/,c=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,s=" ";function u(M,N,J){return N.f=N.inline=J,J(M,N)}function f(M,N,J){return N.f=N.block=J,J(M,N)}function C(M){return!M||!/\S/.test(M.string)}function v(M){if(M.linkTitle=!1,M.linkHref=!1,M.linkText=!1,M.em=!1,M.strong=!1,M.strikethrough=!1,M.quote=0,M.indentedCode=!1,M.f==_){var N=U;if(!N){var J=ce.innerMode(Z,M.htmlState);N=J.mode.name=="xml"&&J.state.tagStart===null&&!J.state.context&&J.state.tokenize.isInText}N&&(M.f=o,M.block=m,M.htmlState=null)}return M.trailingSpace=0,M.trailingSpaceNewLine=!1,M.prevLine=M.thisLine,M.thisLine={stream:null},null}function m(M,N){var J=M.column()===N.indentation,ae=C(N.prevLine.stream),ue=N.indentedCode,ve=N.prevLine.hr,Te=N.list!==!1,_e=(N.listStack[N.listStack.length-1]||0)+3;N.indentedCode=!1;var fe=N.indentation;if(N.indentationDiff===null&&(N.indentationDiff=N.indentation,Te)){for(N.list=null;fe<N.listStack[N.listStack.length-1];)N.listStack.pop(),N.listStack.length?N.indentation=N.listStack[N.listStack.length-1]:N.list=!1;N.list!==!1&&(N.indentationDiff=fe-N.listStack[N.listStack.length-1])}var ne=!ae&&!ve&&!N.prevLine.header&&(!Te||!ue)&&!N.prevLine.fencedCodeEnd,me=(N.list===!1||ve||ae)&&N.indentation<=_e&&M.match(k),ie=null;if(N.indentationDiff>=4&&(ue||N.prevLine.fencedCodeEnd||N.prevLine.header||ae))return M.skipToEnd(),N.indentedCode=!0,j.code;if(M.eatSpace())return null;if(J&&N.indentation<=_e&&(ie=M.match(A))&&ie[1].length<=6)return N.quote=0,N.header=ie[1].length,N.thisLine.header=!0,R.highlightFormatting&&(N.formatting="header"),N.f=N.inline,d(N);if(N.indentation<=_e&&M.eat(">"))return N.quote=J?1:N.quote+1,R.highlightFormatting&&(N.formatting="quote"),M.eatSpace(),d(N);if(!me&&!N.setext&&J&&N.indentation<=_e&&(ie=M.match(D))){var le=ie[1]?"ol":"ul";return N.indentation=fe+M.current().length,N.list=!0,N.quote=0,N.listStack.push(N.indentation),N.em=!1,N.strong=!1,N.code=!1,N.strikethrough=!1,R.taskLists&&M.match(E,!1)&&(N.taskList=!0),N.f=N.inline,R.highlightFormatting&&(N.formatting=["list","list-"+le]),d(N)}else{if(J&&N.indentation<=_e&&(ie=M.match(y,!0)))return N.quote=0,N.fencedEndRE=new RegExp(ie[1]+"+ *$"),N.localMode=R.fencedCodeBlockHighlighting&&O(ie[2]||R.fencedCodeBlockDefaultMode),N.localMode&&(N.localState=ce.startState(N.localMode)),N.f=N.block=x,R.highlightFormatting&&(N.formatting="code-block"),N.code=-1,d(N);if(N.setext||(!ne||!Te)&&!N.quote&&N.list===!1&&!N.code&&!me&&!b.test(M.string)&&(ie=M.lookAhead(1))&&(ie=ie.match(P)))return N.setext?(N.header=N.setext,N.setext=0,M.skipToEnd(),R.highlightFormatting&&(N.formatting="header")):(N.header=ie[0].charAt(0)=="="?1:2,N.setext=N.header),N.thisLine.header=!0,N.f=N.inline,d(N);if(me)return M.skipToEnd(),N.hr=!0,N.thisLine.hr=!0,j.hr;if(M.peek()==="[")return u(M,N,I)}return u(M,N,N.inline)}function _(M,N){var J=Z.token(M,N.htmlState);if(!U){var ae=ce.innerMode(Z,N.htmlState);(ae.mode.name=="xml"&&ae.state.tagStart===null&&!ae.state.context&&ae.state.tokenize.isInText||N.md_inside&&M.current().indexOf(">")>-1)&&(N.f=o,N.block=m,N.htmlState=null)}return J}function x(M,N){var J=N.listStack[N.listStack.length-1]||0,ae=N.indentation<J,ue=J+3;if(N.fencedEndRE&&N.indentation<=ue&&(ae||M.match(N.fencedEndRE))){R.highlightFormatting&&(N.formatting="code-block");var ve;return ae||(ve=d(N)),N.localMode=N.localState=null,N.block=m,N.f=o,N.fencedEndRE=null,N.code=0,N.thisLine.fencedCodeEnd=!0,ae?f(M,N,N.block):ve}else return N.localMode?N.localMode.token(M,N.localState):(M.skipToEnd(),j.code)}function d(M){var N=[];if(M.formatting){N.push(j.formatting),typeof M.formatting=="string"&&(M.formatting=[M.formatting]);for(var J=0;J<M.formatting.length;J++)N.push(j.formatting+"-"+M.formatting[J]),M.formatting[J]==="header"&&N.push(j.formatting+"-"+M.formatting[J]+"-"+M.header),M.formatting[J]==="quote"&&(!R.maxBlockquoteDepth||R.maxBlockquoteDepth>=M.quote?N.push(j.formatting+"-"+M.formatting[J]+"-"+M.quote):N.push("error"))}if(M.taskOpen)return N.push("meta"),N.length?N.join(" "):null;if(M.taskClosed)return N.push("property"),N.length?N.join(" "):null;if(M.linkHref?N.push(j.linkHref,"url"):(M.strong&&N.push(j.strong),M.em&&N.push(j.em),M.strikethrough&&N.push(j.strikethrough),M.emoji&&N.push(j.emoji),M.linkText&&N.push(j.linkText),M.code&&N.push(j.code),M.image&&N.push(j.image),M.imageAltText&&N.push(j.imageAltText,"link"),M.imageMarker&&N.push(j.imageMarker)),M.header&&N.push(j.header,j.header+"-"+M.header),M.quote&&(N.push(j.quote),!R.maxBlockquoteDepth||R.maxBlockquoteDepth>=M.quote?N.push(j.quote+"-"+M.quote):N.push(j.quote+"-"+R.maxBlockquoteDepth)),M.list!==!1){var ae=(M.listStack.length-1)%3;ae?ae===1?N.push(j.list2):N.push(j.list3):N.push(j.list1)}return M.trailingSpaceNewLine?N.push("trailing-space-new-line"):M.trailingSpace&&N.push("trailing-space-"+(M.trailingSpace%2?"a":"b")),N.length?N.join(" "):null}function h(M,N){return M.match(w,!0)?d(N):void 0}function o(M,N){var J=N.text(M,N);if(typeof J!="undefined")return J;if(N.list)return N.list=null,d(N);if(N.taskList){var ae=M.match(E,!0)[1]===" ";return ae?N.taskOpen=!0:N.taskClosed=!0,R.highlightFormatting&&(N.formatting="task"),N.taskList=!1,d(N)}if(N.taskOpen=!1,N.taskClosed=!1,N.header&&M.match(/^#+$/,!0))return R.highlightFormatting&&(N.formatting="header"),d(N);var ue=M.next();if(N.linkTitle){N.linkTitle=!1;var ve=ue;ue==="("&&(ve=")"),ve=(ve+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Te="^\\s*(?:[^"+ve+"\\\\]+|\\\\\\\\|\\\\.)"+ve;if(M.match(new RegExp(Te),!0))return j.linkHref}if(ue==="`"){var _e=N.formatting;R.highlightFormatting&&(N.formatting="code"),M.eatWhile("`");var fe=M.current().length;if(N.code==0&&(!N.quote||fe==1))return N.code=fe,d(N);if(fe==N.code){var ne=d(N);return N.code=0,ne}else return N.formatting=_e,d(N)}else if(N.code)return d(N);if(ue==="\\"&&(M.next(),R.highlightFormatting)){var me=d(N),ie=j.formatting+"-escape";return me?me+" "+ie:ie}if(ue==="!"&&M.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return N.imageMarker=!0,N.image=!0,R.highlightFormatting&&(N.formatting="image"),d(N);if(ue==="["&&N.imageMarker&&M.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return N.imageMarker=!1,N.imageAltText=!0,R.highlightFormatting&&(N.formatting="image"),d(N);if(ue==="]"&&N.imageAltText){R.highlightFormatting&&(N.formatting="image");var me=d(N);return N.imageAltText=!1,N.image=!1,N.inline=N.f=g,me}if(ue==="["&&!N.image)return N.linkText&&M.match(/^.*?\]/)||(N.linkText=!0,R.highlightFormatting&&(N.formatting="link")),d(N);if(ue==="]"&&N.linkText){R.highlightFormatting&&(N.formatting="link");var me=d(N);return N.linkText=!1,N.inline=N.f=M.match(/\(.*?\)| ?\[.*?\]/,!1)?g:o,me}if(ue==="<"&&M.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=i,R.highlightFormatting&&(N.formatting="link");var me=d(N);return me?me+=" ":me="",me+j.linkInline}if(ue==="<"&&M.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=i,R.highlightFormatting&&(N.formatting="link");var me=d(N);return me?me+=" ":me="",me+j.linkEmail}if(R.xml&&ue==="<"&&M.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var le=M.string.indexOf(">",M.pos);if(le!=-1){var q=M.string.substring(M.start,le);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(q)&&(N.md_inside=!0)}return M.backUp(1),N.htmlState=ce.startState(Z),f(M,N,_)}if(R.xml&&ue==="<"&&M.match(/^\/\w*?>/))return N.md_inside=!1,"tag";if(ue==="*"||ue==="_"){for(var re=1,oe=M.pos==1?" ":M.string.charAt(M.pos-2);re<3&&M.eat(ue);)re++;var ge=M.peek()||" ",Se=!/\s/.test(ge)&&(!c.test(ge)||/\s/.test(oe)||c.test(oe)),Ee=!/\s/.test(oe)&&(!c.test(oe)||/\s/.test(ge)||c.test(ge)),Re=null,Pe=null;if(re%2&&(!N.em&&Se&&(ue==="*"||!Ee||c.test(oe))?Re=!0:N.em==ue&&Ee&&(ue==="*"||!Se||c.test(ge))&&(Re=!1)),re>1&&(!N.strong&&Se&&(ue==="*"||!Ee||c.test(oe))?Pe=!0:N.strong==ue&&Ee&&(ue==="*"||!Se||c.test(ge))&&(Pe=!1)),Pe!=null||Re!=null){R.highlightFormatting&&(N.formatting=Re==null?"strong":Pe==null?"em":"strong em"),Re===!0&&(N.em=ue),Pe===!0&&(N.strong=ue);var ne=d(N);return Re===!1&&(N.em=!1),Pe===!1&&(N.strong=!1),ne}}else if(ue===" "&&(M.eat("*")||M.eat("_"))){if(M.peek()===" ")return d(N);M.backUp(1)}if(R.strikethrough){if(ue==="~"&&M.eatWhile(ue)){if(N.strikethrough){R.highlightFormatting&&(N.formatting="strikethrough");var ne=d(N);return N.strikethrough=!1,ne}else if(M.match(/^[^\s]/,!1))return N.strikethrough=!0,R.highlightFormatting&&(N.formatting="strikethrough"),d(N)}else if(ue===" "&&M.match(/^~~/,!0)){if(M.peek()===" ")return d(N);M.backUp(2)}}if(R.emoji&&ue===":"&&M.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){N.emoji=!0,R.highlightFormatting&&(N.formatting="emoji");var Ue=d(N);return N.emoji=!1,Ue}return ue===" "&&(M.match(/^ +$/,!1)?N.trailingSpace++:N.trailingSpace&&(N.trailingSpaceNewLine=!0)),d(N)}function i(M,N){var J=M.next();if(J===">"){N.f=N.inline=o,R.highlightFormatting&&(N.formatting="link");var ae=d(N);return ae?ae+=" ":ae="",ae+j.linkInline}return M.match(/^[^>]+/,!0),j.linkInline}function g(M,N){if(M.eatSpace())return null;var J=M.next();return J==="("||J==="["?(N.f=N.inline=T(J==="("?")":"]"),R.highlightFormatting&&(N.formatting="link-string"),N.linkHref=!0,d(N)):"error"}var l={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function T(M){return function(N,J){var ae=N.next();if(ae===M){J.f=J.inline=o,R.highlightFormatting&&(J.formatting="link-string");var ue=d(J);return J.linkHref=!1,ue}return N.match(l[M]),J.linkHref=!0,d(J)}}function I(M,N){return M.match(/^([^\]\\]|\\.)*\]:/,!1)?(N.f=F,M.next(),R.highlightFormatting&&(N.formatting="link"),N.linkText=!0,d(N)):u(M,N,o)}function F(M,N){if(M.match(/^\]:/,!0)){N.f=N.inline=W,R.highlightFormatting&&(N.formatting="link");var J=d(N);return N.linkText=!1,J}return M.match(/^([^\]\\]|\\.)+/,!0),j.linkText}function W(M,N){return M.eatSpace()?null:(M.match(/^[^\s]+/,!0),M.peek()===void 0?N.linkTitle=!0:M.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),N.f=N.inline=o,j.linkHref+" url")}var V={startState:function(){return{f:m,prevLine:{stream:null},thisLine:{stream:null},block:m,htmlState:null,indentation:0,inline:o,text:h,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(M){return{f:M.f,prevLine:M.prevLine,thisLine:M.thisLine,block:M.block,htmlState:M.htmlState&&ce.copyState(Z,M.htmlState),indentation:M.indentation,localMode:M.localMode,localState:M.localMode?ce.copyState(M.localMode,M.localState):null,inline:M.inline,text:M.text,formatting:!1,linkText:M.linkText,linkTitle:M.linkTitle,linkHref:M.linkHref,code:M.code,em:M.em,strong:M.strong,strikethrough:M.strikethrough,emoji:M.emoji,header:M.header,setext:M.setext,hr:M.hr,taskList:M.taskList,list:M.list,listStack:M.listStack.slice(0),quote:M.quote,indentedCode:M.indentedCode,trailingSpace:M.trailingSpace,trailingSpaceNewLine:M.trailingSpaceNewLine,md_inside:M.md_inside,fencedEndRE:M.fencedEndRE}},token:function(M,N){if(N.formatting=!1,M!=N.thisLine.stream){if(N.header=0,N.hr=!1,M.match(/^\s*$/,!0))return v(N),null;if(N.prevLine=N.thisLine,N.thisLine={stream:M},N.taskList=!1,N.trailingSpace=0,N.trailingSpaceNewLine=!1,!N.localState&&(N.f=N.block,N.f!=_)){var J=M.match(/^\s*/,!0)[0].replace(/\t/g,s).length;if(N.indentation=J,N.indentationDiff=null,J>0)return null}}return N.f(M,N)},innerMode:function(M){return M.block==_?{state:M.htmlState,mode:Z}:M.localState?{state:M.localState,mode:M.localMode}:{state:M,mode:V}},indent:function(M,N,J){return M.block==_&&Z.indent?Z.indent(M.htmlState,N,J):M.localState&&M.localMode.indent?M.localMode.indent(M.localState,N,J):ce.Pass},blankLine:v,getType:d,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return V},"xml"),ce.defineMIME("text/markdown","markdown"),ce.defineMIME("text/x-markdown","markdown")})},n6Qo:function(gt,ze,Y){"use strict";Y.d(ze,"a",function(){return B});var ce=Y("q1tI"),X=Y("biw7"),R=Y("fyJ8");function Z(k){var D=k.className,E=k.index,A=k.children,P=k.colSpan,w=k.rowSpan,y=ce.useContext(X.a),b=y.prefixCls,c=y.fixedInfoList,s=c[E];return ce.createElement(R.a,Object.assign({className:D,index:E,component:"td",prefixCls:b,record:null,dataIndex:null,render:function(){return{children:A,props:{colSpan:P,rowSpan:w}}}},s))}function U(k){return ce.createElement("tr",Object.assign({},k))}function O(k){var D=k.children,E=ce.useContext(X.a),A=E.prefixCls;return ce.createElement("tfoot",{className:"".concat(A,"-summary")},D)}var j=ze.b=O,B={Cell:Z,Row:U}},osHv:function(gt,ze,Y){(function(ce){ce(Y("VrN/"))})(function(ce){"use strict";var X=ce.Pos;function R(c,s){return c.line-s.line||c.ch-s.ch}var Z="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",U=Z+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",O=new RegExp("<(/?)(["+Z+"]["+U+"]*)","g");function j(c,s,u,f){this.line=s,this.ch=u,this.cm=c,this.text=c.getLine(s),this.min=f?Math.max(f.from,c.firstLine()):c.firstLine(),this.max=f?Math.min(f.to-1,c.lastLine()):c.lastLine()}function B(c,s){var u=c.cm.getTokenTypeAt(X(c.line,s));return u&&/\btag\b/.test(u)}function k(c){return c.line>=c.max?void 0:(c.ch=0,c.text=c.cm.getLine(++c.line),!0)}function D(c){return c.line<=c.min?void 0:(c.text=c.cm.getLine(--c.line),c.ch=c.text.length,!0)}function E(c){for(;;){var s=c.text.indexOf(">",c.ch);if(s==-1){if(k(c))continue;return}if(!B(c,s+1)){c.ch=s+1;continue}var u=c.text.lastIndexOf("/",s),f=u>-1&&!/\S/.test(c.text.slice(u+1,s));return c.ch=s+1,f?"selfClose":"regular"}}function A(c){for(;;){var s=c.ch?c.text.lastIndexOf("<",c.ch-1):-1;if(s==-1){if(D(c))continue;return}if(!B(c,s+1)){c.ch=s;continue}O.lastIndex=s,c.ch=s;var u=O.exec(c.text);if(u&&u.index==s)return u}}function P(c){for(;;){O.lastIndex=c.ch;var s=O.exec(c.text);if(!s){if(k(c))continue;return}if(!B(c,s.index+1)){c.ch=s.index+1;continue}return c.ch=s.index+s[0].length,s}}function w(c){for(;;){var s=c.ch?c.text.lastIndexOf(">",c.ch-1):-1;if(s==-1){if(D(c))continue;return}if(!B(c,s+1)){c.ch=s;continue}var u=c.text.lastIndexOf("/",s),f=u>-1&&!/\S/.test(c.text.slice(u+1,s));return c.ch=s+1,f?"selfClose":"regular"}}function y(c,s){for(var u=[];;){var f=P(c),C,v=c.line,m=c.ch-(f?f[0].length:0);if(!f||!(C=E(c)))return;if(C=="selfClose")continue;if(f[1]){for(var _=u.length-1;_>=0;--_)if(u[_]==f[2]){u.length=_;break}if(_<0&&(!s||s==f[2]))return{tag:f[2],from:X(v,m),to:X(c.line,c.ch)}}else u.push(f[2])}}function b(c,s){for(var u=[];;){var f=w(c);if(!f)return;if(f=="selfClose"){A(c);continue}var C=c.line,v=c.ch,m=A(c);if(!m)return;if(m[1])u.push(m[2]);else{for(var _=u.length-1;_>=0;--_)if(u[_]==m[2]){u.length=_;break}if(_<0&&(!s||s==m[2]))return{tag:m[2],from:X(c.line,c.ch),to:X(C,v)}}}}ce.registerHelper("fold","xml",function(c,s){for(var u=new j(c,s.line,0);;){var f=P(u);if(!f||u.line!=s.line)return;var C=E(u);if(!C)return;if(!f[1]&&C!="selfClose"){var v=X(u.line,u.ch),m=y(u,f[2]);return m&&R(m.from,v)>0?{from:v,to:m.from}:null}}}),ce.findMatchingTag=function(c,s,u){var f=new j(c,s.line,s.ch,u);if(f.text.indexOf(">")==-1&&f.text.indexOf("<")==-1)return;var C=E(f),v=C&&X(f.line,f.ch),m=C&&A(f);if(!C||!m||R(f,s)>0)return;var _={from:X(f.line,f.ch),to:v,tag:m[2]};return C=="selfClose"?{open:_,close:null,at:"open"}:m[1]?{open:b(f,m[2]),close:_,at:"close"}:(f=new j(c,v.line,v.ch,u),{open:_,close:y(f,m[2]),at:"open"})},ce.findEnclosingTag=function(c,s,u,f){for(var C=new j(c,s.line,s.ch,u);;){var v=b(C,f);if(!v)break;var m=new j(c,s.line,s.ch,u),_=y(m,v.tag);if(_)return{open:v,close:_}}},ce.scanForClosingTag=function(c,s,u,f){var C=new j(c,s.line,s.ch,f?{from:0,to:f}:null);return y(C,u)}})},p5ED:function(gt,ze,Y){"use strict";var ce=Y("+L6B"),X=Y("2/Rp"),R=Y("5Dmo"),Z=Y("3S7+"),U=Y("k1fw"),O=Y("9og8"),j=Y("tJVT"),B=Y("WmNS"),k=Y.n(B),D=Y("q1tI"),E=Y.n(D),A=Y("vHTk"),P=Y.n(A),w=Y("yEEn"),y=Y("ZW9T"),b=Y("1vsH"),c=Y("V0Rq"),s=Y("m3rI"),u=function(C){var v=C.name,m=C.data,_=C.theme,x=C.type,d=C.filename,h=C.monacoEditor,o=C.className,i=C.style,g=C.close,l=C.onClose,T=C.hasMask,I=C.otherData,F=I===void 0?{}:I,W=Object(D.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),V=Object(j.a)(W,2),M=V[0],N=V[1],J=Object(D.useState)(""),ae=Object(j.a)(J,2),ue=ae[0],ve=ae[1],Te=Object(D.useState)(),_e=Object(j.a)(Te,2),fe=_e[0],ne=_e[1],me=window.ENV==="build"?"/react/build/office.html":"/office.html",ie,le=1024*1024,q=10*le,re=Object(D.useRef)();x==="office"&&(ie=Object(b.P)(m).filesize,ie>q&&(x="other")),d&&(h.filename=d),Object(D.useEffect)(function(){var Ee,Re,Pe=(Ee=document.cookie)===null||Ee===void 0||((Re=Ee.replace(/\s/g,""))===null||Re===void 0)?void 0:Re.split(";");Pe==null||Pe.map(function(Ue){var He=Ue.split("=");He[0]==="_educoder_session"&&ve(He[1])})},[]),Object(D.useEffect)(function(){x==="office"&&oe()},[x]);var oe=function(){var Ee=Object(O.a)(k.a.mark(function Re(){var Pe,Ue,He;return k.a.wrap(function(Ne){for(;;)switch(Ne.prev=Ne.next){case 0:return console.log("data:",m),Pe=m,m.startsWith("http")||(Pe=location.origin+Pe),Ue=new URL(Pe).pathname.split("/").pop(),Ne.next=6,Object(c.U)({attachment_id:Ue});case 6:He=Ne.sent,ne(He);case 8:case"end":return Ne.stop()}},Re)}));return function(){return Ee.apply(this,arguments)}}(),ge=function(){if(m.startsWith("http")||m.startsWith("blob:")){Se();return}Object(b.x)(d||"educoder",m,d)},Se=function(){Object(b.v)(d||"educoder",decodeURIComponent(m))};return E.a.createElement("div",{style:Object(U.a)({},i||{}),className:"".concat(T&&P.a.bgBlack," ").concat(x?P.a.wrp:"hide")},g&&E.a.createElement("div",{className:P.a.close,ref:re},E.a.createElement(Z.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return re.current}},E.a.createElement("span",{onClick:Se},E.a.createElement("i",{className:"icon-quxiaozhiding"}))),E.a.createElement(Z.a,{title:"\u5173\u95ED",getPopupContainer:function(){return re.current}},E.a.createElement("span",{className:"",onClick:function(){l(),ne(null)}},E.a.createElement("i",{className:"icon-guanbi1"})))),E.a.createElement("div",{className:"".concat(P.a[o]," ").concat(o," ").concat(P.a.monaco," ").concat(x==="txt"?"show":"hide")},x==="txt"&&E.a.createElement(y.b,h)),x==="audio"&&E.a.createElement("audio",{src:"".concat((m==null?void 0:m.indexOf("http://"))>-1||(m==null?void 0:m.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(m),autoPlay:!0}),x==="video"&&E.a.createElement(E.a.Fragment,null,(m==null?void 0:m.indexOf("/api"))>-1?E.a.createElement("video",{controls:!0,src:"".concat(m),autoPlay:!0}):E.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(m),autoPlay:!0})),x==="office"&&fe&&E.a.createElement("iframe",{src:"".concat(me,"?key=").concat(fe.key,"&url=").concat(s.a.API_SERVER+fe.url,"&callbackUrl=").concat(s.a.API_SERVER+fe.callbackUrl,"&fileType=").concat(fe.fileType,"&title=").concat(fe.title,"&model=view")}),(x==="xlsx"||x==="doc"||x==="pptx"||x==="docx")&&E.a.createElement("iframe",{src:"".concat(me,"?key=").concat(F.key,"&url=").concat(s.a.API_SERVER+F.url,"&callbackUrl=").concat(s.a.API_SERVER+F.callbackUrl,"&fileType=").concat(F.fileType,"&title=").concat(F.title,"&model=").concat(F.model)}),x==="html"&&E.a.createElement("iframe",{src:m+"&disposition=inline"}),x==="pdf"&&E.a.createElement("embed",{className:P.a.embed,src:m,type:"application/pdf"}),x==="image"&&E.a.createElement("img",{src:"".concat((m==null?void 0:m.indexOf("http://"))>-1||(m==null?void 0:m.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(m)}),x==="other"&&E.a.createElement("div",null,E.a.createElement(X.a,{type:"primary",size:"large",onClick:ge},E.a.createElement(w.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),x==="download"&&E.a.createElement(X.a,{type:"primary",size:"large",onClick:ge},E.a.createElement(w.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))};ze.a=u},"p77/":function(gt,ze,Y){},"rAM+":function(gt,ze,Y){"use strict";Y.d(ze,"a",function(){return X});var ce=Y("Qw5x");function X(R,Z){var U;if(typeof Symbol=="undefined"||R[Symbol.iterator]==null){if(Array.isArray(R)||(U=Object(ce.a)(R))||Z&&R&&typeof R.length=="number"){U&&(R=U);var O=0,j=function(){};return{s:j,n:function(){return O>=R.length?{done:!0}:{done:!1,value:R[O++]}},e:function(A){throw A},f:j}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var B=!0,k=!1,D;return{s:function(){U=R[Symbol.iterator]()},n:function(){var A=U.next();return B=A.done,A},e:function(A){k=!0,D=A},f:function(){try{!B&&U.return!=null&&U.return()}finally{if(k)throw D}}}}},rUJ1:function(gt,ze){const Y=/[&<>"']/,ce=/[&<>"']/g,X=/[<>"']|&(?!#?\w+;)/,R=/[<>"']|&(?!#?\w+;)/g,Z={"&":"&","<":"<",">":">",'"':""","'":"'"},U=x=>Z[x];function O(x,d){if(d){if(Y.test(x))return x.replace(ce,U)}else if(X.test(x))return x.replace(R,U);return x}const j=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function B(x){return x.replace(j,(d,h)=>(h=h.toLowerCase(),h==="colon"?":":h.charAt(0)==="#"?h.charAt(1)==="x"?String.fromCharCode(parseInt(h.substring(2),16)):String.fromCharCode(+h.substring(1)):""))}const k=/(^|[^\[])\^/g;function D(x,d){x=x.source||x,d=d||"";const h={replace:(o,i)=>(i=i.source||i,i=i.replace(k,"$1"),x=x.replace(o,i),h),getRegex:()=>new RegExp(x,d)};return h}const E=/[^\w:]/g,A=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function P(x,d,h){if(x){let o;try{o=decodeURIComponent(B(h)).replace(E,"").toLowerCase()}catch(i){return null}if(o.indexOf("javascript:")===0||o.indexOf("vbscript:")===0||o.indexOf("data:")===0)return null}d&&!A.test(h)&&(h=s(d,h));try{h=encodeURI(h).replace(/%25/g,"%")}catch(o){return null}return h}const w={},y=/^[^:]+:\/*[^/]*$/,b=/^([^:]+:)[\s\S]*$/,c=/^([^:]+:\/*[^/]*)[\s\S]*$/;function s(x,d){w[" "+x]||(y.test(x)?w[" "+x]=x+"/":w[" "+x]=v(x,"/",!0)),x=w[" "+x];const h=x.indexOf(":")===-1;return d.substring(0,2)==="//"?h?d:x.replace(b,"$1")+d:d.charAt(0)==="/"?h?d:x.replace(c,"$1")+d:x+d}const u={exec:function(){}};function f(x){let d=1,h,o;for(;d<arguments.length;d++){h=arguments[d];for(o in h)Object.prototype.hasOwnProperty.call(h,o)&&(x[o]=h[o])}return x}function C(x,d){const h=x.replace(/\|/g,(g,l,T)=>{let I=!1,F=l;for(;--F>=0&&T[F]==="\\";)I=!I;return I?"|":" |"}),o=h.split(/ \|/);let i=0;if(o.length>d)o.splice(d);else for(;o.length<d;)o.push("");for(;i<o.length;i++)o[i]=o[i].trim().replace(/\\\|/g,"|");return o}function v(x,d,h){const o=x.length;if(o===0)return"";let i=0;for(;i<o;){const g=x.charAt(o-i-1);if(g===d&&!h)i++;else if(g!==d&&h)i++;else break}return x.substr(0,o-i)}function m(x,d){if(x.indexOf(d[1])===-1)return-1;const h=x.length;let o=0,i=0;for(;i<h;i++)if(x[i]==="\\")i++;else if(x[i]===d[0])o++;else if(x[i]===d[1]&&(o--,o<0))return i;return-1}function _(x){x&&x.sanitize&&!x.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")}gt.exports={escape:O,unescape:B,edit:D,cleanUrl:P,resolveUrl:s,noopTest:u,merge:f,splitCells:C,rtrim:v,findClosingBracket:m,checkSanitizeDeprecation:_}},sR1s:function(gt,ze,Y){"use strict";Y.d(ze,"b",function(){return Z}),Y.d(ze,"a",function(){return U}),Y.d(ze,"c",function(){return O}),Y.d(ze,"d",function(){return j});var ce=Y("U8pU"),X="RC_TABLE_KEY";function R(B){return B==null?[]:Array.isArray(B)?B:[B]}function Z(B,k){if(!k&&typeof k!="number")return B;for(var D=R(k),E=B,A=0;A<D.length;A+=1){if(!E)return null;var P=D[A];E=E[P]}return E}function U(B){var k=[],D={};return B.forEach(function(E){for(var A=E||{},P=A.key,w=A.dataIndex,y=P||R(w).join("-")||X;D[y];)y="".concat(y,"_next");D[y]=!0,k.push(y)}),k}function O(){var B={};function k(P,w){w&&Object.keys(w).forEach(function(y){var b=w[y];b&&Object(ce.a)(b)==="object"?(P[y]=P[y]||{},k(P[y],b)):P[y]=b})}for(var D=arguments.length,E=new Array(D),A=0;A<D;A++)E[A]=arguments[A];return E.forEach(function(P){k(B,P)}),B}function j(B){return B!=null}},sboe:function(gt,ze,Y){"use strict";Y.d(ze,"a",function(){return R});var ce=Y("q1tI"),X=Y.n(ce),R=ce.createContext(null)},spXi:function(gt,ze,Y){gt.exports={flex_box_center:"flex_box_center___2B_Y7",flex_space_between:"flex_space_between___2olzC",flex_box_vertical_center:"flex_box_vertical_center___2Z4dV",flex_box_center_end:"flex_box_center_end___3FiwX",flex_box_column:"flex_box_column___8kyK-",customTree:"customTree___1KOYx",name:"name___3pqs4"}},t23M:function(gt,ze,Y){"use strict";var ce=Y("VTBJ"),X=Y("1OyB"),R=Y("vuIU"),Z=Y("Ji7U"),U=Y("LK+K"),O=Y("q1tI"),j=Y.n(O),B=Y("m+aA"),k=Y("Zm9Q"),D=Y("Kwbf"),E=Y("c+Xe"),A=Y("bdgK"),P="rc-observer-key",w=function(y){Object(Z.a)(c,y);var b=Object(U.a)(c);function c(){var s;return Object(X.a)(this,c),s=b.apply(this,arguments),s.resizeObserver=null,s.childNode=null,s.currentElement=null,s.state={width:0,height:0,offsetHeight:0,offsetWidth:0},s.onResize=function(u){var f=s.props.onResize,C=u[0].target,v=C.getBoundingClientRect(),m=v.width,_=v.height,x=C.offsetWidth,d=C.offsetHeight,h=Math.floor(m),o=Math.floor(_);if(s.state.width!==h||s.state.height!==o||s.state.offsetWidth!==x||s.state.offsetHeight!==d){var i={width:h,height:o,offsetWidth:x,offsetHeight:d};s.setState(i),f&&Promise.resolve().then(function(){f(Object(ce.a)(Object(ce.a)({},i),{},{offsetWidth:x,offsetHeight:d}))})}},s.setChildNode=function(u){s.childNode=u},s}return Object(R.a)(c,[{key:"componentDidMount",value:function(){this.onComponentUpdated()}},{key:"componentDidUpdate",value:function(){this.onComponentUpdated()}},{key:"componentWillUnmount",value:function(){this.destroyObserver()}},{key:"onComponentUpdated",value:function(){var u=this.props.disabled;if(u){this.destroyObserver();return}var f=Object(B.a)(this.childNode||this),C=f!==this.currentElement;C&&(this.destroyObserver(),this.currentElement=f),!this.resizeObserver&&f&&(this.resizeObserver=new A.default(this.onResize),this.resizeObserver.observe(f))}},{key:"destroyObserver",value:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"render",value:function(){var u=this.props.children,f=Object(k.a)(u);if(f.length>1)Object(D.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(f.length===0)return Object(D.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var C=f[0];if(O.isValidElement(C)&&Object(E.c)(C)){var v=C.ref;f[0]=O.cloneElement(C,{ref:Object(E.a)(v,this.setChildNode)})}return f.length===1?f[0]:f.map(function(m,_){return!O.isValidElement(m)||"key"in m&&m.key!==null?m:O.cloneElement(m,{key:"".concat(P,"-").concat(_)})})}}]),c}(O.Component);w.displayName="ResizeObserver",ze.a=w},u2Z1:function(gt,ze,Y){"use strict";Y.d(ze,"a",function(){return v});var ce=Y("miYZ"),X=Y("tsqr"),R=Y("9og8"),Z=Y("5NDa"),U=Y("5rEg"),O=Y("2qtc"),j=Y("kLXV"),B=Y("oBTY"),k=Y("tJVT"),D=Y("OaEy"),E=Y("2fM7"),A=Y("WmNS"),P=Y.n(A),w=Y("q1tI"),y=Y.n(w),b=Y("ErOA"),c=Y("i58Z"),s=Y.n(c),u=Y("T1X5"),f=Y.n(u),C=E.a.Option,v=function(_){var x=_.subId,d=_.value,h=_.selectvalues,o=_.disabled,i=_.knowledgeOptions,g=i===void 0?[]:i,l=_.onChange,T=l===void 0?function(){}:l,I=_.onAddKnowledgeFinish,F=I===void 0?function(){}:I,W=Object(w.useRef)(),V=Object(w.useState)([]),M=Object(k.a)(V,2),N=M[0],J=M[1];d=d||[];var ae=function(Te,_e){Te?(J([_e.key]),T([_e.key])):(J([]),T([]))};Object(w.useEffect)(function(){(h==null?void 0:h.length)>0&&(J(Object(B.a)(h)),T(Object(B.a)(h)))},[g]),Object(w.useEffect)(function(){var ve;((ve=d)===null||ve===void 0?void 0:ve.length)>0&&T(Object(B.a)(d))},[g]);var ue=function(Te){Te.preventDefault(),W.current="",j.a.confirm({centered:!0,width:700,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",icon:null,title:"\u65B0\u5EFA\u77E5\u8BC6\u70B9",className:"custom-modal-divider",content:y.a.createElement("div",{className:"font14"},y.a.createElement("div",{style:{display:"flex",marginTop:"48px",marginBottom:"36px"}},y.a.createElement("img",{src:f.a,style:{width:"108px",height:"108px",marginRight:"29px"}}),"\u60A8\u586B\u5199\u7684\u77E5\u8BC6\u70B9\u6682\u65F6\u4EC5\u5BF9\u672C\u4EBA\u53EF\u89C1\uFF0C\u5E73\u53F0\u5BA1\u6838\u901A\u8FC7\u540E\u5C06\u5217\u5165\u516C\u5F00\u77E5\u8BC6\u70B9\uFF0C\u5BF9\u6240\u6709\u7528\u6237\u53EF\u89C1\uFF1B",y.a.createElement("br",null),"\u5E73\u53F0\u5BA1\u6838\u8FC7\u7A0B\u4E2D\u6709\u6743\u5220\u9664\u4E0D\u5408\u9002\u7684\u77E5\u8BC6\u70B9\uFF08\u5305\u62EC\u4F46\u4E0D\u9650\u4E8E\u9519\u8BEF\u3001\u975E\u6CD5\u3001\u4E0D\u96C5\u3001\u4E0D\u5339\u914D\u5F53\u524D\u8BFE\u7A0B\u7B49\u60C5\u5F62\uFF09\uFF0C\u5220\u9664\u540E\u53EF\u80FD\u5F71\u54CD\u60A8\u7684\u8BD5\u9898\u7684\u6B63\u5E38\u4F7F\u7528\u3002",y.a.createElement("br",null),"\u8BF7\u8BA4\u771F\u586B\u5199\u4E0E\u6559\u5B66\u5185\u5BB9\u76F8\u5173\u7684\u771F\u5B9E\u77E5\u8BC6\u70B9 ",y.a.createElement("br",null)),y.a.createElement(U.a,{className:"mt5",maxLength:20,style:{marginBottom:"42px"},placeholder:"\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC720\u5B57\u7684\u77E5\u8BC6\u70B9\u540D\u79F0",defaultValue:W.current,onChange:function(fe){W.current=fe.target.value}})),onOk:function(){return new Promise(function(){var fe=Object(R.a)(P.a.mark(function ne(me,ie){var le,q;return P.a.wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:if(W.current){oe.next=3;break}return X.b.warn("\u8BF7\u8F93\u5165\u77E5\u8BC6\u70B9\u540D\u79F0"),oe.abrupt("return",ie());case 3:if(!(W.current.length>20)){oe.next=6;break}return X.b.warn("\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC720\u5B57\u7684\u77E5\u8BC6\u70B9\u540D\u79F0"),oe.abrupt("return",ie());case 6:return oe.next=8,Object(b.a)("/api/tag_disciplines.json",{method:"post",body:{name:W.current,sub_discipline_id:x}});case 8:return le=oe.sent,(le==null?void 0:le.status)===0&&(F({id:le.tag_discipline_id,name:W.current,type:"personal"}),q=[],q.push(le.tag_discipline_id),T([].concat(q)),J([le.tag_discipline_id]),T([].concat(q))),oe.abrupt("return",me());case 11:case"end":return oe.stop()}},ne)}));return function(ne,me){return fe.apply(this,arguments)}}())}})};return y.a.createElement("div",{className:s.a.wrap},y.a.createElement(E.a,{disabled:!x||o,className:"mr5",style:{width:"242px"},onChange:ae,showSearch:!0,allowClear:!0,value:g==null?void 0:g.filter(function(ve){return(N==null?void 0:N.includes(ve==null?void 0:ve.id))||(N==null?void 0:N.includes((ve==null?void 0:ve.id)+""))}).map(function(ve){return ve.name})},g==null?void 0:g.map(function(ve){return y.a.createElement(C,{key:ve.id,value:ve.name},y.a.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},y.a.createElement("span",{style:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}},ve.name),y.a.createElement("span",null,ve.type==="personal"?"\uFF08\u81EA\u7528\uFF09":"")))})),y.a.createElement("button",{disabled:!x,className:"".concat(s.a.addKnowledge," ").concat(x?"":s.a.disabled),onClick:ue},"\u65B0\u5EFA\u77E5\u8BC6\u70B9"))}},uK0f:function(gt,ze,Y){(function(ce,X){gt.exports=X()})(this,function(){"use strict";function ce(X,R,Z){Z=Z||{},Z.childrenKeyName=Z.childrenKeyName||"children";var U=X||[],O=[],j=0;do{var B=U.filter(function(k){return R(k,j)})[0];if(!B)break;O.push(B),U=B[Z.childrenKeyName]||[],j+=1}while(U.length>0);return O}return ce})},ulZh:function(gt,ze,Y){typeof window!="undefined"&&function(X,R){gt.exports=R()}(this,function(){return function(ce){var X={};function R(Z){if(X[Z])return X[Z].exports;var U=X[Z]={i:Z,l:!1,exports:{}};return ce[Z].call(U.exports,U,U.exports,R),U.l=!0,U.exports}return R.m=ce,R.c=X,R.d=function(Z,U,O){R.o(Z,U)||Object.defineProperty(Z,U,{enumerable:!0,get:O})},R.r=function(Z){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Z,"__esModule",{value:!0})},R.t=function(Z,U){if(U&1&&(Z=R(Z)),U&8)return Z;if(U&4&&typeof Z=="object"&&Z&&Z.__esModule)return Z;var O=Object.create(null);if(R.r(O),Object.defineProperty(O,"default",{enumerable:!0,value:Z}),U&2&&typeof Z!="string")for(var j in Z)R.d(O,j,function(B){return Z[B]}.bind(null,j));return O},R.n=function(Z){var U=Z&&Z.__esModule?function(){return Z.default}:function(){return Z};return R.d(U,"a",U),U},R.o=function(Z,U){return Object.prototype.hasOwnProperty.call(Z,U)},R.p="/dist/",R(R.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ce,X,R){"use strict";var Z=Object.prototype.hasOwnProperty,U="~";function O(){}Object.create&&(O.prototype=Object.create(null),new O().__proto__||(U=!1));function j(E,A,P){this.fn=E,this.context=A,this.once=P||!1}function B(E,A,P,w,y){if(typeof P!="function")throw new TypeError("The listener must be a function");var b=new j(P,w||E,y),c=U?U+A:A;return E._events[c]?E._events[c].fn?E._events[c]=[E._events[c],b]:E._events[c].push(b):(E._events[c]=b,E._eventsCount++),E}function k(E,A){--E._eventsCount===0?E._events=new O:delete E._events[A]}function D(){this._events=new O,this._eventsCount=0}D.prototype.eventNames=function(){var A=[],P,w;if(this._eventsCount===0)return A;for(w in P=this._events)Z.call(P,w)&&A.push(U?w.slice(1):w);return Object.getOwnPropertySymbols?A.concat(Object.getOwnPropertySymbols(P)):A},D.prototype.listeners=function(A){var P=U?U+A:A,w=this._events[P];if(!w)return[];if(w.fn)return[w.fn];for(var y=0,b=w.length,c=new Array(b);y<b;y++)c[y]=w[y].fn;return c},D.prototype.listenerCount=function(A){var P=U?U+A:A,w=this._events[P];return w?w.fn?1:w.length:0},D.prototype.emit=function(A,P,w,y,b,c){var s=U?U+A:A;if(!this._events[s])return!1;var u=this._events[s],f=arguments.length,C,v;if(u.fn){u.once&&this.removeListener(A,u.fn,void 0,!0);switch(f){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,P),!0;case 3:return u.fn.call(u.context,P,w),!0;case 4:return u.fn.call(u.context,P,w,y),!0;case 5:return u.fn.call(u.context,P,w,y,b),!0;case 6:return u.fn.call(u.context,P,w,y,b,c),!0}for(v=1,C=new Array(f-1);v<f;v++)C[v-1]=arguments[v];u.fn.apply(u.context,C)}else{var m=u.length,_;for(v=0;v<m;v++){u[v].once&&this.removeListener(A,u[v].fn,void 0,!0);switch(f){case 1:u[v].fn.call(u[v].context);break;case 2:u[v].fn.call(u[v].context,P);break;case 3:u[v].fn.call(u[v].context,P,w);break;case 4:u[v].fn.call(u[v].context,P,w,y);break;default:if(!C)for(_=1,C=new Array(f-1);_<f;_++)C[_-1]=arguments[_];u[v].fn.apply(u[v].context,C)}}}return!0},D.prototype.on=function(A,P,w){return B(this,A,P,w,!1)},D.prototype.once=function(A,P,w){return B(this,A,P,w,!0)},D.prototype.removeListener=function(A,P,w,y){var b=U?U+A:A;if(!this._events[b])return this;if(!P)return k(this,b),this;var c=this._events[b];if(c.fn)c.fn===P&&(!y||c.once)&&(!w||c.context===w)&&k(this,b);else{for(var s=0,u=[],f=c.length;s<f;s++)(c[s].fn!==P||y&&!c[s].once||w&&c[s].context!==w)&&u.push(c[s]);u.length?this._events[b]=u.length===1?u[0]:u:k(this,b)}return this},D.prototype.removeAllListeners=function(A){var P;return A?(P=U?U+A:A,this._events[P]&&k(this,P)):(this._events=new O,this._eventsCount=0),this},D.prototype.off=D.prototype.removeListener,D.prototype.addListener=D.prototype.on,D.prefixed=U,D.EventEmitter=D,ce.exports=D},"./node_modules/url-toolkit/src/url-toolkit.js":function(ce,X,R){(function(Z){var U=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,O=/^([^\/?#]*)([^]*)$/,j=/(?:\/|^)\.(?=\/)/g,B=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,k={buildAbsoluteURL:function(D,E,A){if(A=A||{},D=D.trim(),E=E.trim(),!E){if(!A.alwaysNormalize)return D;var P=k.parseURL(D);if(!P)throw new Error("Error trying to parse base URL.");return P.path=k.normalizePath(P.path),k.buildURLFromParts(P)}var w=k.parseURL(E);if(!w)throw new Error("Error trying to parse relative URL.");if(w.scheme)return A.alwaysNormalize?(w.path=k.normalizePath(w.path),k.buildURLFromParts(w)):E;var y=k.parseURL(D);if(!y)throw new Error("Error trying to parse base URL.");if(!y.netLoc&&y.path&&y.path[0]!=="/"){var b=O.exec(y.path);y.netLoc=b[1],y.path=b[2]}y.netLoc&&!y.path&&(y.path="/");var c={scheme:y.scheme,netLoc:w.netLoc,path:null,params:w.params,query:w.query,fragment:w.fragment};if(!w.netLoc&&(c.netLoc=y.netLoc,w.path[0]!=="/"))if(!w.path)c.path=y.path,w.params||(c.params=y.params,w.query||(c.query=y.query));else{var s=y.path,u=s.substring(0,s.lastIndexOf("/")+1)+w.path;c.path=k.normalizePath(u)}return c.path===null&&(c.path=A.alwaysNormalize?k.normalizePath(w.path):w.path),k.buildURLFromParts(c)},parseURL:function(D){var E=U.exec(D);return E?{scheme:E[1]||"",netLoc:E[2]||"",path:E[3]||"",params:E[4]||"",query:E[5]||"",fragment:E[6]||""}:null},normalizePath:function(D){for(D=D.split("").reverse().join("").replace(j,"");D.length!==(D=D.replace(B,"")).length;);return D.split("").reverse().join("")},buildURLFromParts:function(D){return D.scheme+D.netLoc+D.path+D.params+D.query+D.fragment}};ce.exports=k})(this)},"./node_modules/webworkify-webpack/index.js":function(ce,X,R){function Z(A){var P={};function w(b){if(P[b])return P[b].exports;var c=P[b]={i:b,l:!1,exports:{}};return A[b].call(c.exports,c,c.exports,w),c.l=!0,c.exports}w.m=A,w.c=P,w.i=function(b){return b},w.d=function(b,c,s){w.o(b,c)||Object.defineProperty(b,c,{configurable:!1,enumerable:!0,get:s})},w.r=function(b){Object.defineProperty(b,"__esModule",{value:!0})},w.n=function(b){var c=b&&b.__esModule?function(){return b.default}:function(){return b};return w.d(c,"a",c),c},w.o=function(b,c){return Object.prototype.hasOwnProperty.call(b,c)},w.p="/",w.oe=function(b){throw console.error(b),b};var y=w(w.s=ENTRY_MODULE);return y.default||y}var U="[\\.|\\-|\\+|\\w|/|@]+",O="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+U+").*?\\)";function j(A){return(A+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function B(A){return!isNaN(1*A)}function k(A,P,w){var y={};y[w]=[];var b=P.toString(),c=b.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!c)return y;for(var s=c[1],u=new RegExp("(\\\\n|\\W)"+j(s)+O,"g"),f;f=u.exec(b);){if(f[3]==="dll-reference")continue;y[w].push(f[3])}for(u=new RegExp("\\("+j(s)+'\\("(dll-reference\\s('+U+'))"\\)\\)'+O,"g");f=u.exec(b);)A[f[2]]||(y[w].push(f[1]),A[f[2]]=R(f[1]).m),y[f[2]]=y[f[2]]||[],y[f[2]].push(f[4]);for(var C=Object.keys(y),v=0;v<C.length;v++)for(var m=0;m<y[C[v]].length;m++)B(y[C[v]][m])&&(y[C[v]][m]=1*y[C[v]][m]);return y}function D(A){var P=Object.keys(A);return P.reduce(function(w,y){return w||A[y].length>0},!1)}function E(A,P){for(var w={main:[P]},y={main:[]},b={main:{}};D(w);)for(var c=Object.keys(w),s=0;s<c.length;s++){var u=c[s],f=w[u],C=f.pop();if(b[u]=b[u]||{},b[u][C]||!A[u][C])continue;b[u][C]=!0,y[u]=y[u]||[],y[u].push(C);for(var v=k(A,A[u][C],u),m=Object.keys(v),_=0;_<m.length;_++)w[m[_]]=w[m[_]]||[],w[m[_]]=w[m[_]].concat(v[m[_]])}return y}ce.exports=function(A,P){P=P||{};var w={main:R.m},y=P.all?{main:Object.keys(w.main)}:E(w,A),b="";Object.keys(y).filter(function(C){return C!=="main"}).forEach(function(C){for(var v=0;y[C][v];)v++;y[C].push(v),w[C][v]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",b=b+"var "+C+" = ("+Z.toString().replace("ENTRY_MODULE",JSON.stringify(v))+")({"+y[C].map(function(m){return""+JSON.stringify(m)+": "+w[C][m].toString()}).join(",")+`});
|
|
`}),b=b+"new (("+Z.toString().replace("ENTRY_MODULE",JSON.stringify(A))+")({"+y.main.map(function(C){return""+JSON.stringify(C)+": "+w.main[C].toString()}).join(",")+"}))(self);";var c=new window.Blob([b],{type:"text/javascript"});if(P.bare)return c;var s=window.URL||window.webkitURL||window.mozURL||window.msURL,u=s.createObjectURL(c),f=new window.Worker(u);return f.objectURL=u,f}},"./src/config.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"hlsDefaultConfig",function(){return _}),R.d(X,"mergeConfig",function(){return d}),R.d(X,"enableStreamingMode",function(){return h});var Z=R("./src/controller/abr-controller.ts"),U=R("./src/controller/audio-stream-controller.ts"),O=R("./src/controller/audio-track-controller.ts"),j=R("./src/controller/subtitle-stream-controller.ts"),B=R("./src/controller/subtitle-track-controller.ts"),k=R("./src/controller/buffer-controller.ts"),D=R("./src/controller/timeline-controller.ts"),E=R("./src/controller/cap-level-controller.ts"),A=R("./src/controller/fps-controller.ts"),P=R("./src/controller/eme-controller.ts"),w=R("./src/controller/cmcd-controller.ts"),y=R("./src/utils/xhr-loader.ts"),b=R("./src/utils/fetch-loader.ts"),c=R("./src/utils/cues.ts"),s=R("./src/utils/mediakeys-helper.ts"),u=R("./src/utils/logger.ts");function f(){return f=Object.assign||function(o){for(var i=1;i<arguments.length;i++){var g=arguments[i];for(var l in g)Object.prototype.hasOwnProperty.call(g,l)&&(o[l]=g[l])}return o},f.apply(this,arguments)}function C(o,i){var g=Object.keys(o);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(o);i&&(l=l.filter(function(T){return Object.getOwnPropertyDescriptor(o,T).enumerable})),g.push.apply(g,l)}return g}function v(o){for(var i=1;i<arguments.length;i++){var g=arguments[i]!=null?arguments[i]:{};i%2?C(Object(g),!0).forEach(function(l){m(o,l,g[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(g)):C(Object(g)).forEach(function(l){Object.defineProperty(o,l,Object.getOwnPropertyDescriptor(g,l))})}return o}function m(o,i,g){return i in o?Object.defineProperty(o,i,{value:g,enumerable:!0,configurable:!0,writable:!0}):o[i]=g,o}var _=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:y.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Z.default,bufferController:k.default,capLevelController:E.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:s.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},x()),{},{subtitleStreamController:j.SubtitleStreamController,subtitleTrackController:B.default,timelineController:D.TimelineController,audioStreamController:U.default,audioTrackController:O.default,emeController:P.default,cmcdController:w.default});function x(){return{cueHandler:c.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function d(o,i){if((i.liveSyncDurationCount||i.liveMaxLatencyDurationCount)&&(i.liveSyncDuration||i.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(i.liveMaxLatencyDurationCount!==void 0&&(i.liveSyncDurationCount===void 0||i.liveMaxLatencyDurationCount<=i.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(i.liveMaxLatencyDuration!==void 0&&(i.liveSyncDuration===void 0||i.liveMaxLatencyDuration<=i.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return f({},o,i)}function h(o){var i=o.loader;if(i!==b.default&&i!==y.default)u.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),o.progressive=!1;else{var g=Object(b.fetchSupported)();g&&(o.loader=b.default,o.progressive=!0,o.enableSoftwareAES=!0,u.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ce,X,R){"use strict";R.r(X);var Z=R("./src/polyfills/number.ts"),U=R("./src/utils/ewma-bandwidth-estimator.ts"),O=R("./src/events.ts"),j=R("./src/utils/buffer-helper.ts"),B=R("./src/errors.ts"),k=R("./src/types/loader.ts"),D=R("./src/utils/logger.ts");function E(w,y){for(var b=0;b<y.length;b++){var c=y[b];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(w,c.key,c)}}function A(w,y,b){return y&&E(w.prototype,y),b&&E(w,b),w}var P=function(){function w(b){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=b;var c=b.config;this.bwEstimator=new U.default(c.abrEwmaSlowVoD,c.abrEwmaFastVoD,c.abrEwmaDefaultEstimate),this.registerListeners()}var y=w.prototype;return y.registerListeners=function(){var c=this.hls;c.on(O.Events.FRAG_LOADING,this.onFragLoading,this),c.on(O.Events.FRAG_LOADED,this.onFragLoaded,this),c.on(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),c.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(O.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){var c=this.hls;c.off(O.Events.FRAG_LOADING,this.onFragLoading,this),c.off(O.Events.FRAG_LOADED,this.onFragLoaded,this),c.off(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),c.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(O.Events.ERROR,this.onError,this)},y.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},y.onFragLoading=function(c,s){var u=s.frag;if(u.type===k.PlaylistLevelType.MAIN&&!this.timer){var f;this.fragCurrent=u,this.partCurrent=(f=s.part)!=null?f:null,this.timer=self.setInterval(this.onCheck,100)}},y.onLevelLoaded=function(c,s){var u=this.hls.config;s.details.live?this.bwEstimator.update(u.abrEwmaSlowLive,u.abrEwmaFastLive):this.bwEstimator.update(u.abrEwmaSlowVoD,u.abrEwmaFastVoD)},y._abandonRulesCheck=function(){var c=this.fragCurrent,s=this.partCurrent,u=this.hls,f=u.autoLevelEnabled,C=u.config,v=u.media;if(!c||!v)return;var m=s?s.stats:c.stats,_=s?s.duration:c.duration;if(m.aborted){D.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!f||v.paused||!v.playbackRate||!v.readyState)return;var x=performance.now()-m.loading.start,d=Math.abs(v.playbackRate);if(x<=500*_/d)return;var h=u.levels,o=u.minAutoLevel,i=h[c.level],g=m.total||Math.max(m.loaded,Math.round(_*i.maxBitrate/8)),l=Math.max(1,m.bwEstimate?m.bwEstimate/8:m.loaded*1e3/x),T=(g-m.loaded)/l,I=v.currentTime,F=(j.BufferHelper.bufferInfo(v,I,C.maxBufferHole).end-I)/d;if(F>=2*_/d||T<=F)return;var W=Number.POSITIVE_INFINITY,V;for(V=c.level-1;V>o;V--){var M=h[V].maxBitrate;if(W=_*M/(8*.8*l),W<F)break}if(W>=T)return;var N=this.bwEstimator.getEstimate();D.logger.warn("Fragment "+c.sn+(s?" part "+s.index:"")+" of level "+c.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+V+`
|
|
Current BW estimate: `+(Object(Z.isFiniteNumber)(N)?(N/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+T.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+W.toFixed(3)+` s
|
|
Time to underbuffer: `+F.toFixed(3)+" s"),u.nextLoadLevel=V,this.bwEstimator.sample(x,m.loaded),this.clearTimer(),c.loader&&(this.fragCurrent=this.partCurrent=null,c.loader.abort()),u.trigger(O.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:c,part:s,stats:m})},y.onFragLoaded=function(c,s){var u=s.frag,f=s.part;if(u.type===k.PlaylistLevelType.MAIN&&Object(Z.isFiniteNumber)(u.sn)){var C=f?f.stats:u.stats,v=f?f.duration:u.duration;if(this.clearTimer(),this.lastLoadedFragLevel=u.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var m=this.hls.levels[u.level],_=(m.loaded?m.loaded.bytes:0)+C.loaded,x=(m.loaded?m.loaded.duration:0)+v;m.loaded={bytes:_,duration:x},m.realBitrate=Math.round(8*_/x)}if(u.bitrateTest){var d={stats:C,frag:u,part:f,id:u.type};this.onFragBuffered(O.Events.FRAG_BUFFERED,d),u.bitrateTest=!1}}},y.onFragBuffered=function(c,s){var u=s.frag,f=s.part,C=f?f.stats:u.stats;if(C.aborted)return;if(u.type!==k.PlaylistLevelType.MAIN||u.sn==="initSegment")return;var v=C.parsing.end-C.loading.start;this.bwEstimator.sample(v,C.loaded),C.bwEstimate=this.bwEstimator.getEstimate(),u.bitrateTest?this.bitrateTestDelay=v/1e3:this.bitrateTestDelay=0},y.onError=function(c,s){switch(s.details){case B.ErrorDetails.FRAG_LOAD_ERROR:case B.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},y.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},y.getNextABRAutoLevel=function(){var c=this.fragCurrent,s=this.partCurrent,u=this.hls,f=u.maxAutoLevel,C=u.config,v=u.minAutoLevel,m=u.media,_=s?s.duration:c?c.duration:0,x=m?m.currentTime:0,d=m&&m.playbackRate!==0?Math.abs(m.playbackRate):1,h=this.bwEstimator?this.bwEstimator.getEstimate():C.abrEwmaDefaultEstimate,o=(j.BufferHelper.bufferInfo(m,x,C.maxBufferHole).end-x)/d,i=this.findBestLevel(h,v,f,o,C.abrBandWidthFactor,C.abrBandWidthUpFactor);if(i>=0)return i;D.logger.trace((o?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var g=_?Math.min(_,C.maxStarvationDelay):C.maxStarvationDelay,l=C.abrBandWidthFactor,T=C.abrBandWidthUpFactor;if(!o){var I=this.bitrateTestDelay;if(I){var F=_?Math.min(_,C.maxLoadingDelay):C.maxLoadingDelay;g=F-I,D.logger.trace("bitrate test took "+Math.round(1e3*I)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*g)+" ms"),l=T=1}}return i=this.findBestLevel(h,v,f,o+g,l,T),Math.max(i,0)},y.findBestLevel=function(c,s,u,f,C,v){for(var m,_=this.fragCurrent,x=this.partCurrent,d=this.lastLoadedFragLevel,h=this.hls.levels,o=h[d],i=!!(o!=null&&(m=o.details)!==null&&m!==void 0&&m.live),g=o==null?void 0:o.codecSet,l=x?x.duration:_?_.duration:0,T=u;T>=s;T--){var I=h[T];if(!I||g&&I.codecSet!==g)continue;var F=I.details,W=(x?F==null?void 0:F.partTarget:F==null?void 0:F.averagetargetduration)||l,V=void 0;T<=d?V=C*c:V=v*c;var M=h[T].maxBitrate,N=M*W/V;if(D.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+T+"/"+Math.round(V)+"/"+M+"/"+W+"/"+f+"/"+N),V>M&&(!N||i&&!this.bitrateTestDelay||N<f))return T}return-1},A(w,[{key:"nextAutoLevel",get:function(){var c=this._nextAutoLevel,s=this.bwEstimator;if(c!==-1&&(!s||!s.canEstimate()))return c;var u=this.getNextABRAutoLevel();return c!==-1&&(u=Math.min(c,u)),u},set:function(c){this._nextAutoLevel=c}}]),w}();X.default=P},"./src/controller/audio-stream-controller.ts":function(ce,X,R){"use strict";R.r(X);var Z=R("./src/polyfills/number.ts"),U=R("./src/controller/base-stream-controller.ts"),O=R("./src/events.ts"),j=R("./src/utils/buffer-helper.ts"),B=R("./src/controller/fragment-tracker.ts"),k=R("./src/types/level.ts"),D=R("./src/types/loader.ts"),E=R("./src/loader/fragment.ts"),A=R("./src/demux/chunk-cache.ts"),P=R("./src/demux/transmuxer-interface.ts"),w=R("./src/types/transmuxer.ts"),y=R("./src/controller/fragment-finders.ts"),b=R("./src/utils/discontinuities.ts"),c=R("./src/errors.ts"),s=R("./src/utils/logger.ts");function u(){return u=Object.assign||function(_){for(var x=1;x<arguments.length;x++){var d=arguments[x];for(var h in d)Object.prototype.hasOwnProperty.call(d,h)&&(_[h]=d[h])}return _},u.apply(this,arguments)}function f(_,x){_.prototype=Object.create(x.prototype),_.prototype.constructor=_,C(_,x)}function C(_,x){return C=Object.setPrototypeOf||function(h,o){return h.__proto__=o,h},C(_,x)}var v=100,m=function(_){f(x,_);function x(h,o){var i;return i=_.call(this,h,o,"[audio-stream-controller]")||this,i.videoBuffer=null,i.videoTrackCC=-1,i.waitingVideoCC=-1,i.audioSwitch=!1,i.trackId=-1,i.waitingData=null,i.mainDetails=null,i.bufferFlushed=!1,i._registerListeners(),i}var d=x.prototype;return d.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},d._registerListeners=function(){var o=this.hls;o.on(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.on(O.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),o.on(O.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),o.on(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.on(O.Events.ERROR,this.onError,this),o.on(O.Events.BUFFER_RESET,this.onBufferReset,this),o.on(O.Events.BUFFER_CREATED,this.onBufferCreated,this),o.on(O.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),o.on(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),o.on(O.Events.FRAG_BUFFERED,this.onFragBuffered,this)},d._unregisterListeners=function(){var o=this.hls;o.off(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),o.off(O.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),o.off(O.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),o.off(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),o.off(O.Events.ERROR,this.onError,this),o.off(O.Events.BUFFER_RESET,this.onBufferReset,this),o.off(O.Events.BUFFER_CREATED,this.onBufferCreated,this),o.off(O.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),o.off(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),o.off(O.Events.FRAG_BUFFERED,this.onFragBuffered,this)},d.onInitPtsFound=function(o,i){var g=i.frag,l=i.id,T=i.initPTS;if(l==="main"){var I=g.cc;this.initPTS[g.cc]=T,this.log("InitPTS for cc: "+I+" found from main: "+T),this.videoTrackCC=I,this.state===U.State.WAITING_INIT_PTS&&this.tick()}},d.startLoad=function(o){if(!this.levels){this.startPosition=o,this.state=U.State.STOPPED;return}var i=this.lastCurrentTime;this.stopLoad(),this.setInterval(v),this.fragLoadError=0,i>0&&o===-1?(this.log("Override startPosition with lastCurrentTime @"+i.toFixed(3)),this.state=U.State.IDLE):(this.loadedmetadata=!1,this.state=U.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=o,this.tick()},d.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_TRACK:{var o,i=this.levels,g=this.trackId,l=i==null||((o=i[g])===null||o===void 0)?void 0:o.details;if(l){if(this.waitForCdnTuneIn(l))break;this.state=U.State.WAITING_INIT_PTS}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var T,I=performance.now(),F=this.retryDate;(!F||I>=F||(T=this.media)!==null&&T!==void 0&&T.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=U.State.IDLE);break}case U.State.WAITING_INIT_PTS:{var W=this.waitingData;if(W){var V=W.frag,M=W.part,N=W.cache,J=W.complete;if(this.initPTS[V.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.FRAG_LOADING;var ae=N.flush(),ue={frag:V,part:M,payload:ae,networkDetails:null};this._handleFragmentLoadProgress(ue),J&&_.prototype._handleFragmentLoadComplete.call(this,ue)}else if(this.videoTrackCC!==this.waitingVideoCC)s.logger.log("Waiting fragment cc ("+V.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ve=this.getLoadPosition(),Te=j.BufferHelper.bufferInfo(this.mediaBuffer,ve,this.config.maxBufferHole),_e=Object(y.fragmentWithinToleranceTest)(Te.end,this.config.maxFragLookUpTolerance,V);_e<0&&(s.logger.log("Waiting fragment cc ("+V.cc+") @ "+V.start+" cancelled because another fragment at "+Te.end+" is needed"),this.clearWaitingFragment())}}else this.state=U.State.IDLE}}this.onTickEnd()},d.clearWaitingFragment=function(){var o=this.waitingData;o&&(this.fragmentTracker.removeFragment(o.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.IDLE)},d.onTickEnd=function(){var o=this.media;if(!o||!o.readyState)return;var i=this.mediaBuffer?this.mediaBuffer:o,g=i.buffered;!this.loadedmetadata&&g.length&&(this.loadedmetadata=!0),this.lastCurrentTime=o.currentTime},d.doTickIdle=function(){var o,i,g=this.hls,l=this.levels,T=this.media,I=this.trackId,F=g.config;if(!l||!l[I])return;if(!T&&(this.startFragRequested||!F.startFragPrefetch))return;var W=l[I],V=W.details;if(!V||V.live&&this.levelLastLoaded!==I||this.waitForCdnTuneIn(V)){this.state=U.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,E.ElementaryStreamTypes.AUDIO,D.PlaylistLevelType.AUDIO));var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,D.PlaylistLevelType.AUDIO);if(M===null)return;var N=M.len,J=this.getMaxBufferLength(),ae=this.audioSwitch;if(N>=J&&!ae)return;if(!ae&&this._streamEnded(M,V)){g.trigger(O.Events.BUFFER_EOS,{type:"audio"}),this.state=U.State.ENDED;return}var ue=V.fragments,ve=ue[0].start,Te=M.end;if(ae){var _e=this.getLoadPosition();Te=_e,V.PTSKnown&&_e<ve&&((M.end>ve||M.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),T.currentTime=ve+.05))}var fe=this.getNextFragment(Te,V);if(!fe){this.bufferFlushed=!0;return}((o=fe.decryptdata)===null||o===void 0?void 0:o.keyFormat)==="identity"&&!((i=fe.decryptdata)!==null&&i!==void 0&&i.key)?this.loadKey(fe,V):this.loadFragment(fe,V,Te)},d.getMaxBufferLength=function(){var o=_.prototype.getMaxBufferLength.call(this),i=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,D.PlaylistLevelType.MAIN);return i===null?o:Math.max(o,i.len)},d.onMediaDetaching=function(){this.videoBuffer=null,_.prototype.onMediaDetaching.call(this)},d.onAudioTracksUpdated=function(o,i){var g=i.audioTracks;this.resetTransmuxer(),this.levels=g.map(function(l){return new k.Level(l)})},d.onAudioTrackSwitching=function(o,i){var g=!!i.url;this.trackId=i.id;var l=this.fragCurrent;l!=null&&l.loader&&l.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),g?this.setInterval(v):this.resetTransmuxer(),g?(this.audioSwitch=!0,this.state=U.State.IDLE):this.state=U.State.STOPPED,this.tick()},d.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},d.onLevelLoaded=function(o,i){this.mainDetails=i.details},d.onAudioTrackLoaded=function(o,i){var g,l=this.levels,T=i.details,I=i.id;if(!l){this.warn("Audio tracks were reset while loading level "+I);return}this.log("Track "+I+" loaded ["+T.startSN+","+T.endSN+"],duration:"+T.totalduration);var F=l[I],W=0;if(T.live||(g=F.details)!==null&&g!==void 0&&g.live){var V=this.mainDetails;if(T.fragments[0]||(T.deltaUpdateFailed=!0),T.deltaUpdateFailed||!V)return;!F.details&&T.hasProgramDateTime&&V.hasProgramDateTime?(Object(b.alignMediaPlaylistByPDT)(T,V),W=T.fragments[0].start):W=this.alignPlaylists(T,F.details)}F.details=T,this.levelLastLoaded=I,!this.startFragRequested&&(this.mainDetails||!T.live)&&this.setStartPosition(F.details,W),this.state===U.State.WAITING_TRACK&&!this.waitForCdnTuneIn(T)&&(this.state=U.State.IDLE),this.tick()},d._handleFragmentLoadProgress=function(o){var i,g=o.frag,l=o.part,T=o.payload,I=this.config,F=this.trackId,W=this.levels;if(!W){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+g.sn+" of level "+g.level+" will not be buffered");return}var V=W[F];console.assert(V,"Audio track is defined on fragment load progress");var M=V.details;console.assert(M,"Audio track details are defined on fragment load progress");var N=I.defaultAudioCodec||V.audioCodec||"mp4a.40.2",J=this.transmuxer;J||(J=this.transmuxer=new P.default(this.hls,D.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ae=this.initPTS[g.cc],ue=(i=g.initSegment)===null||i===void 0?void 0:i.data;if(ae!==void 0){var ve=!1,Te=l?l.index:-1,_e=Te!==-1,fe=new w.ChunkMetadata(g.level,g.sn,g.stats.chunkCount,T.byteLength,Te,_e);J.push(T,ue,N,"",g,l,M.totalduration,ve,fe,ae)}else{s.logger.log("Unknown video PTS for cc "+g.cc+", waiting for video PTS before demuxing audio frag "+g.sn+" of ["+M.startSN+" ,"+M.endSN+"],track "+F);var ne=this.waitingData=this.waitingData||{frag:g,part:l,cache:new A.default,complete:!1},me=ne.cache;me.push(new Uint8Array(T)),this.waitingVideoCC=this.videoTrackCC,this.state=U.State.WAITING_INIT_PTS}},d._handleFragmentLoadComplete=function(o){if(this.waitingData){this.waitingData.complete=!0;return}_.prototype._handleFragmentLoadComplete.call(this,o)},d.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},d.onBufferCreated=function(o,i){var g=i.tracks.audio;g&&(this.mediaBuffer=g.buffer),i.tracks.video&&(this.videoBuffer=i.tracks.video.buffer)},d.onFragBuffered=function(o,i){var g=i.frag,l=i.part;if(g.type!==D.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(g)){this.warn("Fragment "+g.sn+(l?" p: "+l.index:"")+" of level "+g.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}g.sn!=="initSegment"&&(this.fragPrevious=g,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(g,l)},d.onError=function(o,i){switch(i.details){case c.ErrorDetails.FRAG_LOAD_ERROR:case c.ErrorDetails.FRAG_LOAD_TIMEOUT:case c.ErrorDetails.KEY_LOAD_ERROR:case c.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.AUDIO,i);break;case c.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case c.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==U.State.ERROR&&this.state!==U.State.STOPPED&&(this.state=i.fatal?U.State.ERROR:U.State.IDLE,this.warn(i.details+" while loading frag, switching to "+this.state+" state"));break;case c.ErrorDetails.BUFFER_FULL_ERROR:if(i.parent==="audio"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var g=!0,l=this.getFwdBufferInfo(this.mediaBuffer,D.PlaylistLevelType.AUDIO);l&&l.len>.5&&(g=!this.reduceMaxBufferLength(l.len)),g&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,_.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},d.onBufferFlushed=function(o,i){var g=i.type;g===E.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},d._handleTransmuxComplete=function(o){var i,g="audio",l=this.hls,T=o.remuxResult,I=o.chunkMeta,F=this.getCurrentContext(I);if(!F){this.warn("The loading context changed while buffering fragment "+I.sn+" of level "+I.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(I.level);return}var W=F.frag,V=F.part,M=T.audio,N=T.text,J=T.id3,ae=T.initSegment;if(this.fragContextChanged(W))return;if(this.state=U.State.PARSING,this.audioSwitch&&M&&this.completeAudioSwitch(),ae!=null&&ae.tracks&&(this._bufferInitSegment(ae.tracks,W,I),l.trigger(O.Events.FRAG_PARSING_INIT_SEGMENT,{frag:W,id:g,tracks:ae.tracks})),M){var ue=M.startPTS,ve=M.endPTS,Te=M.startDTS,_e=M.endDTS;V&&(V.elementaryStreams[E.ElementaryStreamTypes.AUDIO]={startPTS:ue,endPTS:ve,startDTS:Te,endDTS:_e}),W.setElementaryStreamInfo(E.ElementaryStreamTypes.AUDIO,ue,ve,Te,_e),this.bufferFragmentData(M,W,V,I)}if(J!=null&&(i=J.samples)!==null&&i!==void 0&&i.length){var fe=u({frag:W,id:g},J);l.trigger(O.Events.FRAG_PARSING_METADATA,fe)}if(N){var ne=u({frag:W,id:g},N);l.trigger(O.Events.FRAG_PARSING_USERDATA,ne)}},d._bufferInitSegment=function(o,i,g){if(this.state!==U.State.PARSING)return;o.video&&delete o.video;var l=o.audio;if(!l)return;l.levelCodec=l.codec,l.id="audio",this.log("Init audio buffer, container:"+l.container+", codecs[parsed]=["+l.codec+"]"),this.hls.trigger(O.Events.BUFFER_CODECS,o);var T=l.initSegment;if(T!=null&&T.byteLength){var I={type:"audio",frag:i,part:null,chunkMeta:g,parent:i.type,data:T};this.hls.trigger(O.Events.BUFFER_APPENDING,I)}this.tick()},d.loadFragment=function(o,i,g){var l=this.fragmentTracker.getState(o);this.fragCurrent=o,(this.audioSwitch||l===B.FragmentState.NOT_LOADED||l===B.FragmentState.PARTIAL)&&(o.sn==="initSegment"?this._loadInitSegment(o):i.live&&!Object(Z.isFiniteNumber)(this.initPTS[o.cc])?(this.log("Waiting for video PTS in continuity counter "+o.cc+" of live stream before loading audio fragment "+o.sn+" of level "+this.trackId),this.state=U.State.WAITING_INIT_PTS):(this.startFragRequested=!0,_.prototype.loadFragment.call(this,o,i,g)))},d.completeAudioSwitch=function(){var o=this.hls,i=this.media,g=this.trackId;i&&(this.log("Switching audio track : flushing all audio"),_.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,o.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:g})},x}(U.default);X.default=m},"./src/controller/audio-track-controller.ts":function(ce,X,R){"use strict";R.r(X);var Z=R("./src/events.ts"),U=R("./src/errors.ts"),O=R("./src/controller/base-playlist-controller.ts"),j=R("./src/types/loader.ts");function B(P,w){for(var y=0;y<w.length;y++){var b=w[y];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(P,b.key,b)}}function k(P,w,y){return w&&B(P.prototype,w),y&&B(P,y),P}function D(P,w){P.prototype=Object.create(w.prototype),P.prototype.constructor=P,E(P,w)}function E(P,w){return E=Object.setPrototypeOf||function(b,c){return b.__proto__=c,b},E(P,w)}var A=function(P){D(w,P);function w(b){var c;return c=P.call(this,b,"[audio-track-controller]")||this,c.tracks=[],c.groupId=null,c.tracksInGroup=[],c.trackId=-1,c.trackName="",c.selectDefaultTrack=!0,c.registerListeners(),c}var y=w.prototype;return y.registerListeners=function(){var c=this.hls;c.on(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),c.on(Z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),c.on(Z.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){var c=this.hls;c.off(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),c.off(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),c.off(Z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),c.off(Z.Events.ERROR,this.onError,this)},y.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,P.prototype.destroy.call(this)},y.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},y.onManifestParsed=function(c,s){this.tracks=s.audioTracks||[]},y.onAudioTrackLoaded=function(c,s){var u=s.id,f=s.details,C=this.tracksInGroup[u];if(!C){this.warn("Invalid audio track id "+u);return}var v=C.details;C.details=s.details,this.log("audioTrack "+u+" loaded ["+f.startSN+"-"+f.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,s,v))},y.onLevelLoading=function(c,s){this.switchLevel(s.level)},y.onLevelSwitching=function(c,s){this.switchLevel(s.level)},y.switchLevel=function(c){var s=this.hls.levels[c];if(!(s!=null&&s.audioGroupIds))return;var u=s.audioGroupIds[s.urlId];if(this.groupId!==u){this.groupId=u;var f=this.tracks.filter(function(v){return!u||v.groupId===u});this.selectDefaultTrack&&!f.some(function(v){return v.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=f;var C={audioTracks:f};this.log("Updating audio tracks, "+f.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(Z.Events.AUDIO_TRACKS_UPDATED,C),this.selectInitialTrack()}},y.onError=function(c,s){if(P.prototype.onError.call(this,c,s),s.fatal||!s.context)return;s.context.type===j.PlaylistContextType.AUDIO_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},y.setAudioTrack=function(c){var s=this.tracksInGroup;if(c<0||c>=s.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var u=s[this.trackId];this.log("Now switching to audio-track index "+c);var f=s[c],C=f.id,v=f.groupId,m=v===void 0?"":v,_=f.name,x=f.type,d=f.url;if(this.trackId=c,this.trackName=_,this.selectDefaultTrack=!1,this.hls.trigger(Z.Events.AUDIO_TRACK_SWITCHING,{id:C,groupId:m,name:_,type:x,url:d}),f.details&&!f.details.live)return;var h=this.switchParams(f.url,u==null?void 0:u.details);this.loadPlaylist(h)},y.selectInitialTrack=function(){var c=this.tracksInGroup;console.assert(c.length,"Initial audio track should be selected when tracks are known");var s=this.trackName,u=this.findTrackId(s)||this.findTrackId();u!==-1?this.setAudioTrack(u):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},y.findTrackId=function(c){for(var s=this.tracksInGroup,u=0;u<s.length;u++){var f=s[u];if((!this.selectDefaultTrack||f.default)&&(!c||c===f.name))return f.id}return-1},y.loadPlaylist=function(c){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var u=s.id,f=s.groupId,C=s.url;if(c)try{C=c.addDirectives(C)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("loading audio-track playlist for id: "+u),this.clearTimer(),this.hls.trigger(Z.Events.AUDIO_TRACK_LOADING,{url:C,id:u,groupId:f,deliveryDirectives:c||null})}},k(w,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(c){this.selectDefaultTrack=!1,this.setAudioTrack(c)}}]),w}(O.default);X.default=A},"./src/controller/base-playlist-controller.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"default",function(){return k});var Z=R("./src/polyfills/number.ts"),U=R("./src/types/level.ts"),O=R("./src/controller/level-helper.ts"),j=R("./src/utils/logger.ts"),B=R("./src/errors.ts"),k=function(){function D(A,P){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=j.logger.log.bind(j.logger,P+":"),this.warn=j.logger.warn.bind(j.logger,P+":"),this.hls=A}var E=D.prototype;return E.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},E.onError=function(P,w){w.fatal&&w.type===B.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},E.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},E.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},E.stopLoad=function(){this.canLoad=!1,this.clearTimer()},E.switchParams=function(P,w){var y=w==null?void 0:w.renditionReports;if(y)for(var b=0;b<y.length;b++){var c=y[b],s=""+c.URI;if(s===P.substr(-s.length)){var u=parseInt(c["LAST-MSN"]),f=parseInt(c["LAST-PART"]);if(w&&this.hls.config.lowLatencyMode){var C=Math.min(w.age-w.partTarget,w.targetduration);f!==void 0&&C>w.partTarget&&(f+=1)}if(Object(Z.isFiniteNumber)(u))return new U.HlsUrlParameters(u,Object(Z.isFiniteNumber)(f)?f:void 0,U.HlsSkip.No)}}},E.loadPlaylist=function(P){},E.shouldLoadTrack=function(P){return this.canLoad&&P&&!!P.url&&(!P.details||P.details.live)},E.playlistLoaded=function(P,w,y){var b=this,c=w.details,s=w.stats,u=s.loading.end?Math.max(0,self.performance.now()-s.loading.end):0;if(c.advancedDateTime=Date.now()-u,c.live||y!=null&&y.live){if(c.reloaded(y),y&&this.log("live playlist "+P+" "+(c.advanced?"REFRESHED "+c.lastPartSn+"-"+c.lastPartIndex:"MISSED")),y&&c.fragments.length>0&&Object(O.mergeDetails)(y,c),!this.canLoad||!c.live)return;var f,C=void 0,v=void 0;if(c.canBlockReload&&c.endSN&&c.advanced){var m=this.hls.config.lowLatencyMode,_=c.lastPartSn,x=c.endSN,d=c.lastPartIndex,h=d!==-1,o=_===x,i=m?0:d;h?(C=o?x+1:_,v=o?i:d+1):C=x+1;var g=c.age,l=g+c.ageHeader,T=Math.min(l-c.partTarget,c.targetduration*1.5);if(T>0){if(y&&T>y.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+y.tuneInGoal+" to: "+T+" with playlist age: "+c.age),T=0;else{var I=Math.floor(T/c.targetduration);if(C+=I,v!==void 0){var F=Math.round(T%c.targetduration/c.partTarget);v+=F}this.log("CDN Tune-in age: "+c.ageHeader+"s last advanced "+g.toFixed(2)+"s goal: "+T+" skip sn "+I+" to part "+v)}c.tuneInGoal=T}if(f=this.getDeliveryDirectives(c,w.deliveryDirectives,C,v),m||!o){this.loadPlaylist(f);return}}else f=this.getDeliveryDirectives(c,w.deliveryDirectives,C,v);var W=Object(O.computeReloadInterval)(c,s);C!==void 0&&c.canBlockReload&&(W-=c.partTarget||1),this.log("reload live playlist "+P+" in "+Math.round(W)+" ms"),this.timer=self.setTimeout(function(){return b.loadPlaylist(f)},W)}else this.clearTimer()},E.getDeliveryDirectives=function(P,w,y,b){var c=Object(U.getSkipValue)(P,y);return w!=null&&w.skip&&P.deltaUpdateFailed&&(y=w.msn,b=w.part,c=U.HlsSkip.No),new U.HlsUrlParameters(y,b,c)},E.retryLoadingOrFail=function(P){var w=this,y=this.hls.config,b=this.retryCount<y.levelLoadingMaxRetry;if(b){var c;if(this.retryCount++,P.details.indexOf("LoadTimeOut")>-1&&(c=P.context)!==null&&c!==void 0&&c.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+P.details+'"'),this.loadPlaylist();else{var s=Math.min(Math.pow(2,this.retryCount)*y.levelLoadingRetryDelay,y.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return w.loadPlaylist()},s),this.warn("retry playlist loading #"+this.retryCount+" in "+s+' ms after "'+P.details+'"')}}else this.warn('cannot recover from error "'+P.details+'"'),this.clearTimer(),P.fatal=!0;return b},D}()},"./src/controller/base-stream-controller.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"State",function(){return x}),R.d(X,"default",function(){return d});var Z=R("./src/polyfills/number.ts"),U=R("./src/task-loop.ts"),O=R("./src/controller/fragment-tracker.ts"),j=R("./src/utils/buffer-helper.ts"),B=R("./src/utils/logger.ts"),k=R("./src/events.ts"),D=R("./src/errors.ts"),E=R("./src/types/transmuxer.ts"),A=R("./src/utils/mp4-tools.ts"),P=R("./src/utils/discontinuities.ts"),w=R("./src/controller/fragment-finders.ts"),y=R("./src/controller/level-helper.ts"),b=R("./src/loader/fragment-loader.ts"),c=R("./src/crypt/decrypter.ts"),s=R("./src/utils/time-ranges.ts"),u=R("./src/types/loader.ts");function f(h,o){for(var i=0;i<o.length;i++){var g=o[i];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(h,g.key,g)}}function C(h,o,i){return o&&f(h.prototype,o),i&&f(h,i),h}function v(h){if(h===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return h}function m(h,o){h.prototype=Object.create(o.prototype),h.prototype.constructor=h,_(h,o)}function _(h,o){return _=Object.setPrototypeOf||function(g,l){return g.__proto__=l,g},_(h,o)}var x={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"},d=function(h){m(o,h);function o(g,l,T){var I;return I=h.call(this)||this,I.hls=void 0,I.fragPrevious=null,I.fragCurrent=null,I.fragmentTracker=void 0,I.transmuxer=null,I._state=x.STOPPED,I.media=void 0,I.mediaBuffer=void 0,I.config=void 0,I.bitrateTest=!1,I.lastCurrentTime=0,I.nextLoadPosition=0,I.startPosition=0,I.loadedmetadata=!1,I.fragLoadError=0,I.retryDate=0,I.levels=null,I.fragmentLoader=void 0,I.levelLastLoaded=null,I.startFragRequested=!1,I.decrypter=void 0,I.initPTS=[],I.onvseeking=null,I.onvended=null,I.logPrefix="",I.log=void 0,I.warn=void 0,I.logPrefix=T,I.log=B.logger.log.bind(B.logger,T+":"),I.warn=B.logger.warn.bind(B.logger,T+":"),I.hls=g,I.fragmentLoader=new b.default(g.config),I.fragmentTracker=l,I.config=g.config,I.decrypter=new c.default(g,g.config),g.on(k.Events.KEY_LOADED,I.onKeyLoaded,v(I)),I}var i=o.prototype;return i.doTick=function(){this.onTickEnd()},i.onTickEnd=function(){},i.startLoad=function(l){},i.stopLoad=function(){this.fragmentLoader.abort();var l=this.fragCurrent;l&&this.fragmentTracker.removeFragment(l),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=x.STOPPED},i._streamEnded=function(l,T){var I=this.fragCurrent,F=this.fragmentTracker;if(!T.live&&I&&I.sn===T.endSN&&!l.nextStart){var W=F.getState(I);return W===O.FragmentState.PARTIAL||W===O.FragmentState.OK}return!1},i.onMediaAttached=function(l,T){var I=this.media=this.mediaBuffer=T.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),I.addEventListener("seeking",this.onvseeking),I.addEventListener("ended",this.onvended);var F=this.config;this.levels&&F.autoStartLoad&&this.state===x.STOPPED&&this.startLoad(F.startPosition)},i.onMediaDetaching=function(){var l=this.media;l!=null&&l.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),l&&(l.removeEventListener("seeking",this.onvseeking),l.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},i.onMediaSeeking=function(){var l=this.config,T=this.fragCurrent,I=this.media,F=this.mediaBuffer,W=this.state,V=I?I.currentTime:0,M=j.BufferHelper.bufferInfo(F||I,V,l.maxBufferHole);if(this.log("media seeking to "+(Object(Z.isFiniteNumber)(V)?V.toFixed(3):V)+", state: "+W),W===x.ENDED)this.resetLoadingState();else if(T&&!M.len){var N=l.maxFragLookUpTolerance,J=T.start-N,ae=T.start+T.duration+N,ue=V>ae;(V<J||ue)&&(ue&&T.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),T.loader.abort()),this.resetLoadingState())}I&&(this.lastCurrentTime=V),!this.loadedmetadata&&!M.len&&(this.nextLoadPosition=this.startPosition=V),this.tickImmediate()},i.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},i.onKeyLoaded=function(l,T){if(this.state!==x.KEY_LOADING||T.frag!==this.fragCurrent||!this.levels)return;this.state=x.IDLE;var I=this.levels[T.frag.level].details;I&&this.loadFragment(T.frag,I,T.frag.start)},i.onHandlerDestroying=function(){this.stopLoad(),h.prototype.onHandlerDestroying.call(this)},i.onHandlerDestroyed=function(){this.state=x.STOPPED,this.hls.off(k.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,h.prototype.onHandlerDestroyed.call(this)},i.loadKey=function(l,T){this.log("Loading key for "+l.sn+" of ["+T.startSN+"-"+T.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+l.level),this.state=x.KEY_LOADING,this.fragCurrent=l,this.hls.trigger(k.Events.KEY_LOADING,{frag:l})},i.loadFragment=function(l,T,I){this._loadFragForPlayback(l,T,I)},i._loadFragForPlayback=function(l,T,I){var F=this,W=function(M){if(F.fragContextChanged(l)){F.warn("Fragment "+l.sn+(M.part?" p: "+M.part.index:"")+" of level "+l.level+" was dropped during download."),F.fragmentTracker.removeFragment(l);return}l.stats.chunkCount++,F._handleFragmentLoadProgress(M)};this._doFragLoad(l,T,I,W).then(function(V){if(!V)return;F.fragLoadError=0;var M=F.state;if(F.fragContextChanged(l)){(M===x.FRAG_LOADING||M===x.BACKTRACKING||!F.fragCurrent&&M===x.PARSING)&&(F.fragmentTracker.removeFragment(l),F.state=x.IDLE);return}if("payload"in V&&(F.log("Loaded fragment "+l.sn+" of level "+l.level),F.hls.trigger(k.Events.FRAG_LOADED,V),F.state===x.BACKTRACKING)){F.fragmentTracker.backtrack(l,V),F.resetFragmentLoading(l);return}F._handleFragmentLoadComplete(V)}).catch(function(V){F.warn(V),F.resetFragmentLoading(l)})},i.flushMainBuffer=function(l,T,I){if(I===void 0&&(I=null),!(l-T))return;var F={startOffset:l,endOffset:T,type:I};this.fragLoadError=0,this.hls.trigger(k.Events.BUFFER_FLUSHING,F)},i._loadInitSegment=function(l){var T=this;this._doFragLoad(l).then(function(I){if(!I||T.fragContextChanged(l)||!T.levels)throw new Error("init load aborted");return I}).then(function(I){var F=T.hls,W=I.payload,V=l.decryptdata;if(W&&W.byteLength>0&&V&&V.key&&V.iv&&V.method==="AES-128"){var M=self.performance.now();return T.decrypter.webCryptoDecrypt(new Uint8Array(W),V.key.buffer,V.iv.buffer).then(function(N){var J=self.performance.now();return F.trigger(k.Events.FRAG_DECRYPTED,{frag:l,payload:N,stats:{tstart:M,tdecrypt:J}}),I.payload=N,I})}return I}).then(function(I){var F=T.fragCurrent,W=T.hls,V=T.levels;if(!V)throw new Error("init load aborted, missing levels");var M=V[l.level].details;console.assert(M,"Level details are defined when init segment is loaded");var N=l.stats;T.state=x.IDLE,T.fragLoadError=0,l.data=new Uint8Array(I.payload),N.parsing.start=N.buffering.start=self.performance.now(),N.parsing.end=N.buffering.end=self.performance.now(),I.frag===F&&W.trigger(k.Events.FRAG_BUFFERED,{stats:N,frag:F,part:null,id:l.type}),T.tick()}).catch(function(I){T.warn(I),T.resetFragmentLoading(l)})},i.fragContextChanged=function(l){var T=this.fragCurrent;return!l||!T||l.level!==T.level||l.sn!==T.sn||l.urlId!==T.urlId},i.fragBufferedComplete=function(l,T){var I=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+l.type+" sn: "+l.sn+(T?" part: "+T.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+l.level+" "+s.default.toString(j.BufferHelper.getBuffered(I))),this.state=x.IDLE,this.tick()},i._handleFragmentLoadComplete=function(l){var T=this.transmuxer;if(!T)return;var I=l.frag,F=l.part,W=l.partsLoaded,V=!W||W.length===0||W.some(function(N){return!N}),M=new E.ChunkMetadata(I.level,I.sn,I.stats.chunkCount+1,0,F?F.index:-1,!V);T.flush(M)},i._handleFragmentLoadProgress=function(l){},i._doFragLoad=function(l,T,I,F){var W=this;if(I===void 0&&(I=null),!this.levels)throw new Error("frag load aborted, missing levels");if(I=Math.max(l.start,I||0),this.config.lowLatencyMode&&T){var V=T.partList;if(V&&F){I>l.end&&T.fragmentHint&&(l=T.fragmentHint);var M=this.getNextPart(V,l,I);if(M>-1){var N=V[M];return this.log("Loading part sn: "+l.sn+" p: "+N.index+" cc: "+l.cc+" of playlist ["+T.startSN+"-"+T.endSN+"] parts [0-"+M+"-"+(V.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+l.level+", target: "+parseFloat(I.toFixed(3))),this.nextLoadPosition=N.start+N.duration,this.state=x.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:l,part:V[M],targetBufferTime:I}),this.doFragPartsLoad(l,V,M,F).catch(function(J){return W.handleFragLoadError(J)})}else if(!l.url||this.loadedEndOfParts(V,I))return Promise.resolve(null)}}return this.log("Loading fragment "+l.sn+" cc: "+l.cc+" "+(T?"of ["+T.startSN+"-"+T.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+l.level+", target: "+parseFloat(I.toFixed(3))),Object(Z.isFiniteNumber)(l.sn)&&!this.bitrateTest&&(this.nextLoadPosition=l.start+l.duration),this.state=x.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:l,targetBufferTime:I}),this.fragmentLoader.load(l,F).catch(function(J){return W.handleFragLoadError(J)})},i.doFragPartsLoad=function(l,T,I,F){var W=this;return new Promise(function(V,M){var N=[],J=function ae(ue){var ve=T[ue];W.fragmentLoader.loadPart(l,ve,F).then(function(Te){N[ve.index]=Te;var _e=Te.part;W.hls.trigger(k.Events.FRAG_LOADED,Te);var fe=T[ue+1];if(fe&&fe.fragment===l)ae(ue+1);else return V({frag:l,part:_e,partsLoaded:N})}).catch(M)};J(I)})},i.handleFragLoadError=function(l){var T=l.data;return T&&T.details===D.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(T.frag,T.part):this.hls.trigger(k.Events.ERROR,T),null},i._handleTransmuxerFlush=function(l){var T=this.getCurrentContext(l);if(!T||this.state!==x.PARSING){this.fragCurrent||(this.state=x.IDLE);return}var I=T.frag,F=T.part,W=T.level,V=self.performance.now();I.stats.parsing.end=V,F&&(F.stats.parsing.end=V),this.updateLevelTiming(I,F,W,l.partial)},i.getCurrentContext=function(l){var T=this.levels,I=l.level,F=l.sn,W=l.part;if(!T||!T[I])return this.warn("Levels object was unset while buffering fragment "+F+" of level "+I+". The current chunk will not be buffered."),null;var V=T[I],M=W>-1?Object(y.getPartWith)(V,F,W):null,N=M?M.fragment:Object(y.getFragmentWithSN)(V,F,this.fragCurrent);return N?{frag:N,part:M,level:V}:null},i.bufferFragmentData=function(l,T,I,F){if(!l||this.state!==x.PARSING)return;var W=l.data1,V=l.data2,M=W;if(W&&V&&(M=Object(A.appendUint8Array)(W,V)),!M||!M.length)return;var N={type:l.type,frag:T,part:I,chunkMeta:F,parent:T.type,data:M};this.hls.trigger(k.Events.BUFFER_APPENDING,N),l.dropped&&l.independent&&!I&&this.flushBufferGap(T)},i.flushBufferGap=function(l){var T=this.media;if(!T)return;if(!j.BufferHelper.isBuffered(T,T.currentTime)){this.flushMainBuffer(0,l.start);return}var I=T.currentTime,F=j.BufferHelper.bufferInfo(T,I,0),W=l.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,W*.25),M=Math.max(Math.min(l.start-V,F.end-V),I+V);l.start-M>V&&this.flushMainBuffer(M,l.start)},i.getFwdBufferInfo=function(l,T){var I=this.config,F=this.getLoadPosition();if(!Object(Z.isFiniteNumber)(F))return null;var W=j.BufferHelper.bufferInfo(l,F,I.maxBufferHole);if(W.len===0&&W.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(F,T);if(V&&W.nextStart<V.end)return j.BufferHelper.bufferInfo(l,F,Math.max(W.nextStart,I.maxBufferHole))}return W},i.getMaxBufferLength=function(l){var T=this.config,I;return l?I=Math.max(8*T.maxBufferSize/l,T.maxBufferLength):I=T.maxBufferLength,Math.min(I,T.maxMaxBufferLength)},i.reduceMaxBufferLength=function(l){var T=this.config,I=l||T.maxBufferLength;return T.maxMaxBufferLength>=I?(T.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+T.maxMaxBufferLength+"s"),!0):!1},i.getNextFragment=function(l,T){var I,F,W=T.fragments,V=W.length;if(!V)return null;var M=this.config,N=W[0].start,J;if(T.live){var ae=M.initialLiveManifestSize;if(V<ae)return this.warn("Not enough fragments to start playback (have: "+V+", need: "+ae+")"),null;!T.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(J=this.getInitialLiveFragment(T,W),this.startPosition=J?this.hls.liveSyncPosition||J.start:l)}else l<=N&&(J=W[0]);if(!J){var ue=M.lowLatencyMode?T.partEnd:T.fragmentEnd;J=this.getFragmentAtPosition(l,ue,T)}return(I=J)!==null&&I!==void 0&&I.initSegment&&!((F=J)!==null&&F!==void 0&&F.initSegment.data)&&!this.bitrateTest&&(J=J.initSegment),J},i.getNextPart=function(l,T,I){for(var F=-1,W=!1,V=!0,M=0,N=l.length;M<N;M++){var J=l[M];if(V=V&&!J.independent,F>-1&&I<J.start)break;var ae=J.loaded;!ae&&(W||J.independent||V)&&J.fragment===T&&(F=M),W=ae}return F},i.loadedEndOfParts=function(l,T){var I=l[l.length-1];return I&&T>I.start&&I.loaded},i.getInitialLiveFragment=function(l,T){var I=this.fragPrevious,F=null;if(I){if(l.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+I.programDateTime),F=Object(w.findFragmentByPDT)(T,I.endProgramDateTime,this.config.maxFragLookUpTolerance)),!F){var W=I.sn+1;if(W>=l.startSN&&W<=l.endSN){var V=T[W-l.startSN];I.cc===V.cc&&(F=V,this.log("Live playlist, switching playlist, load frag with next SN: "+F.sn))}F||(F=Object(w.findFragWithCC)(T,I.cc),F&&this.log("Live playlist, switching playlist, load frag with same CC: "+F.sn))}}else{var M=this.hls.liveSyncPosition;M!==null&&(F=this.getFragmentAtPosition(M,this.bitrateTest?l.fragmentEnd:l.edge,l))}return F},i.getFragmentAtPosition=function(l,T,I){var F=this.config,W=this.fragPrevious,V=I.fragments,M=I.endSN,N=I.fragmentHint,J=F.maxFragLookUpTolerance,ae=!!(F.lowLatencyMode&&I.partList&&N);ae&&N&&!this.bitrateTest&&(V=V.concat(N),M=N.sn);var ue;if(l<T){var ve=l>T-J?0:J;ue=Object(w.findFragmentByPTS)(W,V,l,ve)}else ue=V[V.length-1];if(ue){var Te=ue.sn-I.startSN,_e=W&&ue.level===W.level,fe=V[Te+1],ne=this.fragmentTracker.getState(ue);if(ne===O.FragmentState.BACKTRACKED){ue=null;for(var me=Te;V[me]&&this.fragmentTracker.getState(V[me])===O.FragmentState.BACKTRACKED;)W?ue=V[me--]:ue=V[--me];ue||(ue=fe)}else W&&ue.sn===W.sn&&!ae&&(_e&&(ue.sn<M&&this.fragmentTracker.getState(fe)!==O.FragmentState.OK?(this.log("SN "+ue.sn+" just loaded, load next one: "+fe.sn),ue=fe):ue=null))}return ue},i.synchronizeToLiveEdge=function(l){var T=this.config,I=this.media;if(!I)return;var F=this.hls.liveSyncPosition,W=I.currentTime,V=l.fragments[0].start,M=l.edge,N=W>=V-T.maxFragLookUpTolerance&&W<=M;if(F!==null&&I.duration>F&&(W<F||!N)){var J=T.liveMaxLatencyDuration!==void 0?T.liveMaxLatencyDuration:T.liveMaxLatencyDurationCount*l.targetduration;(!N&&I.readyState<4||W<M-J)&&(this.loadedmetadata||(this.nextLoadPosition=F),I.readyState&&(this.warn("Playback: "+W.toFixed(3)+" is located too far from the end of live sliding playlist: "+M+", reset currentTime to : "+F.toFixed(3)),I.currentTime=F))}},i.alignPlaylists=function(l,T){var I=this.levels,F=this.levelLastLoaded,W=this.fragPrevious,V=F!==null?I[F]:null,M=l.fragments.length;if(!M)return this.warn("No fragments in live playlist"),0;var N=l.fragments[0].start,J=!T,ae=l.alignedSliding&&Object(Z.isFiniteNumber)(N);if(J||!ae&&!N){Object(P.alignStream)(W,V,l);var ue=l.fragments[0].start;return this.log("Live playlist sliding: "+ue.toFixed(2)+" start-sn: "+(T?T.startSN:"na")+"->"+l.startSN+" prev-sn: "+(W?W.sn:"na")+" fragments: "+M),ue}return N},i.waitForCdnTuneIn=function(l){var T=3;return l.live&&l.canBlockReload&&l.tuneInGoal>Math.max(l.partHoldBack,l.partTarget*T)},i.setStartPosition=function(l,T){var I=this.startPosition;if(I<T&&(I=-1),I===-1||this.lastCurrentTime===-1){var F=l.startTimeOffset;Object(Z.isFiniteNumber)(F)?(I=T+F,F<0&&(I+=l.totalduration),I=Math.min(Math.max(T,I),T+l.totalduration),this.log("Start time offset "+F+" found in playlist, adjust startPosition to "+I),this.startPosition=I):l.live?I=this.hls.liveSyncPosition||T:this.startPosition=I=0,this.lastCurrentTime=I}this.nextLoadPosition=I},i.getLoadPosition=function(){var l=this.media,T=0;return this.loadedmetadata&&l?T=l.currentTime:this.nextLoadPosition&&(T=this.nextLoadPosition),T},i.handleFragLoadAborted=function(l,T){this.transmuxer&&l.sn!=="initSegment"&&l.stats.aborted&&(this.warn("Fragment "+l.sn+(T?" part"+T.index:"")+" of level "+l.level+" was aborted"),this.resetFragmentLoading(l))},i.resetFragmentLoading=function(l){(!this.fragCurrent||!this.fragContextChanged(l))&&(this.state=x.IDLE)},i.onFragmentOrKeyLoadError=function(l,T){if(T.fatal)return;var I=T.frag;if(!I||I.type!==l)return;var F=this.fragCurrent;console.assert(F&&I.sn===F.sn&&I.level===F.level&&I.urlId===F.urlId,"Frag load error must match current frag to retry");var W=this.config;if(this.fragLoadError+1<=W.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(I.level))return;var V=Math.min(Math.pow(2,this.fragLoadError)*W.fragLoadingRetryDelay,W.fragLoadingMaxRetryTimeout);this.warn("Fragment "+I.sn+" of "+l+" "+I.level+" failed to load, retrying in "+V+"ms"),this.retryDate=self.performance.now()+V,this.fragLoadError++,this.state=x.FRAG_LOADING_WAITING_RETRY}else T.levelRetry?(l===u.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=x.IDLE):(B.logger.error(T.details+" reaches max retry, redispatch as fatal ..."),T.fatal=!0,this.hls.stopLoad(),this.state=x.ERROR)},i.afterBufferFlushed=function(l,T,I){if(!l)return;var F=j.BufferHelper.getBuffered(l);this.fragmentTracker.detectEvictedFragments(T,F,I),this.state===x.ENDED&&this.resetLoadingState()},i.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=x.IDLE},i.resetLiveStartWhenNotLoaded=function(l){if(!this.loadedmetadata){this.startFragRequested=!1;var T=this.levels?this.levels[l].details:null;if(T!=null&&T.live)return this.startPosition=-1,this.setStartPosition(T,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},i.updateLevelTiming=function(l,T,I,F){var W=this,V=I.details;console.assert(!!V,"level.details must be defined");var M=Object.keys(l.elementaryStreams).reduce(function(N,J){var ae=l.elementaryStreams[J];if(ae){var ue=ae.endPTS-ae.startPTS;if(ue<=0)return W.warn("Could not parse fragment "+l.sn+" "+J+" duration reliably ("+ue+") resetting transmuxer to fallback to playlist timing"),W.resetTransmuxer(),N||!1;var ve=F?0:Object(y.updateFragPTSDTS)(V,l,ae.startPTS,ae.endPTS,ae.startDTS,ae.endDTS);return W.hls.trigger(k.Events.LEVEL_PTS_UPDATED,{details:V,level:I,drift:ve,type:J,frag:l,start:ae.startPTS,end:ae.endPTS}),!0}return N},!1);M?(this.state=x.PARSED,this.hls.trigger(k.Events.FRAG_PARSED,{frag:l,part:T})):this.resetLoadingState()},i.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},C(o,[{key:"state",get:function(){return this._state},set:function(l){var T=this._state;T!==l&&(this._state=l,this.log(T+"->"+l))}}]),o}(U.default)},"./src/controller/buffer-controller.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"default",function(){return w});var Z=R("./src/polyfills/number.ts"),U=R("./src/events.ts"),O=R("./src/utils/logger.ts"),j=R("./src/errors.ts"),B=R("./src/utils/buffer-helper.ts"),k=R("./src/utils/mediasource-helper.ts"),D=R("./src/loader/fragment.ts"),E=R("./src/controller/buffer-operation-queue.ts"),A=Object(k.getMediaSource)(),P=/([ha]vc.)(?:\.[^.,]+)+/,w=function(){function y(c){var s=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var u=s.hls,f=s.media,C=s.mediaSource;O.logger.log("[buffer-controller]: Media source opened"),f&&(s.updateMediaElementDuration(),u.trigger(U.Events.MEDIA_ATTACHED,{media:f})),C&&C.removeEventListener("sourceopen",s._onMediaSourceOpen),s.checkPendingTracks()},this._onMediaSourceClose=function(){O.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){O.logger.log("[buffer-controller]: Media source ended")},this.hls=c,this._initSourceBuffer(),this.registerListeners()}var b=y.prototype;return b.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},b.destroy=function(){this.unregisterListeners(),this.details=null},b.registerListeners=function(){var s=this.hls;s.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.on(U.Events.BUFFER_RESET,this.onBufferReset,this),s.on(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),s.on(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),s.on(U.Events.BUFFER_EOS,this.onBufferEos,this),s.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),s.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),s.on(U.Events.FRAG_PARSED,this.onFragParsed,this),s.on(U.Events.FRAG_CHANGED,this.onFragChanged,this)},b.unregisterListeners=function(){var s=this.hls;s.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.off(U.Events.BUFFER_RESET,this.onBufferReset,this),s.off(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),s.off(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),s.off(U.Events.BUFFER_EOS,this.onBufferEos,this),s.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),s.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),s.off(U.Events.FRAG_PARSED,this.onFragParsed,this),s.off(U.Events.FRAG_CHANGED,this.onFragChanged,this)},b._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new E.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},b.onManifestParsed=function(s,u){var f=2;(u.audio&&!u.video||!u.altAudio)&&(f=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=f,this.details=null,O.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},b.onMediaAttaching=function(s,u){var f=this.media=u.media;if(f&&A){var C=this.mediaSource=new A;C.addEventListener("sourceopen",this._onMediaSourceOpen),C.addEventListener("sourceended",this._onMediaSourceEnded),C.addEventListener("sourceclose",this._onMediaSourceClose),f.src=self.URL.createObjectURL(C),this._objectUrl=f.src}},b.onMediaDetaching=function(){var s=this.media,u=this.mediaSource,f=this._objectUrl;if(u){if(O.logger.log("[buffer-controller]: media source detaching"),u.readyState==="open")try{u.endOfStream()}catch(C){O.logger.warn("[buffer-controller]: onMediaDetaching: "+C.message+" while calling endOfStream")}this.onBufferReset(),u.removeEventListener("sourceopen",this._onMediaSourceOpen),u.removeEventListener("sourceended",this._onMediaSourceEnded),u.removeEventListener("sourceclose",this._onMediaSourceClose),s&&(f&&self.URL.revokeObjectURL(f),s.src===f?(s.removeAttribute("src"),s.load()):O.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(U.Events.MEDIA_DETACHED,void 0)},b.onBufferReset=function(){var s=this;this.getSourceBufferTypes().forEach(function(u){var f=s.sourceBuffer[u];try{f&&(s.removeBufferListeners(u),s.mediaSource&&s.mediaSource.removeSourceBuffer(f),s.sourceBuffer[u]=void 0)}catch(C){O.logger.warn("[buffer-controller]: Failed to reset the "+u+" buffer",C)}}),this._initSourceBuffer()},b.onBufferCodecs=function(s,u){var f=this,C=this.getSourceBufferTypes().length;if(Object.keys(u).forEach(function(v){if(C){var m=f.tracks[v];if(m&&typeof m.buffer.changeType=="function"){var _=u[v],x=_.codec,d=_.levelCodec,h=_.container,o=(m.levelCodec||m.codec).replace(P,"$1"),i=(d||x).replace(P,"$1");if(o!==i){var g=h+";codecs="+(d||x);f.appendChangeType(v,g)}}}else f.pendingTracks[v]=u[v]}),C)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},b.appendChangeType=function(s,u){var f=this,C=this.operationQueue,v={execute:function(){var _=f.sourceBuffer[s];_&&(O.logger.log("[buffer-controller]: changing "+s+" sourceBuffer type to "+u),_.changeType(u)),C.shiftAndExecuteNext(s)},onStart:function(){},onComplete:function(){},onError:function(_){O.logger.warn("[buffer-controller]: Failed to change "+s+" SourceBuffer type",_)}};C.append(v,s)},b.onBufferAppending=function(s,u){var f=this,C=this.hls,v=this.operationQueue,m=this.tracks,_=u.data,x=u.type,d=u.frag,h=u.part,o=u.chunkMeta,i=o.buffering[x],g=self.performance.now();i.start=g;var l=d.stats.buffering,T=h?h.stats.buffering:null;l.start===0&&(l.start=g),T&&T.start===0&&(T.start=g);var I=m.audio,F=x==="audio"&&o.id===1&&(I==null?void 0:I.container)==="audio/mpeg",W={execute:function(){if(i.executeStart=self.performance.now(),F){var M=f.sourceBuffer[x];if(M){var N=d.start-M.timestampOffset;Math.abs(N)>=.1&&(O.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+d.start+" (delta: "+N+") sn: "+d.sn+")"),M.timestampOffset=d.start)}}f.appendExecutor(_,x)},onStart:function(){},onComplete:function(){var M=self.performance.now();i.executeEnd=i.end=M,l.first===0&&(l.first=M),T&&T.first===0&&(T.first=M);var N=f.sourceBuffer,J={};for(var ae in N)J[ae]=B.BufferHelper.getBuffered(N[ae]);f.appendError=0,f.hls.trigger(U.Events.BUFFER_APPENDED,{type:x,frag:d,part:h,chunkMeta:o,parent:d.type,timeRanges:J})},onError:function(M){O.logger.error("[buffer-controller]: Error encountered while trying to append to the "+x+" SourceBuffer",M);var N={type:j.ErrorTypes.MEDIA_ERROR,parent:d.type,details:j.ErrorDetails.BUFFER_APPEND_ERROR,err:M,fatal:!1};M.code===DOMException.QUOTA_EXCEEDED_ERR?N.details=j.ErrorDetails.BUFFER_FULL_ERROR:(f.appendError++,N.details=j.ErrorDetails.BUFFER_APPEND_ERROR,f.appendError>C.config.appendErrorMaxRetry&&(O.logger.error("[buffer-controller]: Failed "+C.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),N.fatal=!0)),C.trigger(U.Events.ERROR,N)}};v.append(W,x)},b.onBufferFlushing=function(s,u){var f=this,C=this.operationQueue,v=function(_){return{execute:f.removeExecutor.bind(f,_,u.startOffset,u.endOffset),onStart:function(){},onComplete:function(){f.hls.trigger(U.Events.BUFFER_FLUSHED,{type:_})},onError:function(d){O.logger.warn("[buffer-controller]: Failed to remove from "+_+" SourceBuffer",d)}}};u.type?C.append(v(u.type),u.type):this.getSourceBufferTypes().forEach(function(m){C.append(v(m),m)})},b.onFragParsed=function(s,u){var f=this,C=u.frag,v=u.part,m=[],_=v?v.elementaryStreams:C.elementaryStreams;_[D.ElementaryStreamTypes.AUDIOVIDEO]?m.push("audiovideo"):(_[D.ElementaryStreamTypes.AUDIO]&&m.push("audio"),_[D.ElementaryStreamTypes.VIDEO]&&m.push("video"));var x=function(){var h=self.performance.now();C.stats.buffering.end=h,v&&(v.stats.buffering.end=h);var o=v?v.stats:C.stats;f.hls.trigger(U.Events.FRAG_BUFFERED,{frag:C,part:v,stats:o,id:C.type})};m.length===0&&O.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+C.type+" level: "+C.level+" sn: "+C.sn),this.blockBuffers(x,m)},b.onFragChanged=function(s,u){this.flushBackBuffer()},b.onBufferEos=function(s,u){var f=this,C=this.getSourceBufferTypes().reduce(function(v,m){var _=f.sourceBuffer[m];return(!u.type||u.type===m)&&(_&&!_.ended&&(_.ended=!0,O.logger.log("[buffer-controller]: "+m+" sourceBuffer now EOS"))),v&&!!(!_||_.ended)},!0);C&&this.blockBuffers(function(){var v=f.mediaSource;if(!v||v.readyState!=="open")return;v.endOfStream()})},b.onLevelUpdated=function(s,u){var f=u.details;if(!f.fragments.length)return;this.details=f,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},b.flushBackBuffer=function(){var s=this.hls,u=this.details,f=this.media,C=this.sourceBuffer;if(!f||u===null)return;var v=this.getSourceBufferTypes();if(!v.length)return;var m=u.live&&s.config.liveBackBufferLength!==null?s.config.liveBackBufferLength:s.config.backBufferLength;if(!Object(Z.isFiniteNumber)(m)||m<0)return;var _=f.currentTime,x=u.levelTargetDuration,d=Math.max(m,x),h=Math.floor(_/x)*x-d;v.forEach(function(o){var i=C[o];if(i){var g=B.BufferHelper.getBuffered(i);g.length>0&&h>g.start(0)&&(s.trigger(U.Events.BACK_BUFFER_REACHED,{bufferEnd:h}),u.live&&s.trigger(U.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:h}),s.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:h,type:o}))}})},b.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var s=this.details,u=this.hls,f=this.media,C=this.mediaSource,v=s.fragments[0].start+s.totalduration,m=f.duration,_=Object(Z.isFiniteNumber)(C.duration)?C.duration:0;s.live&&u.config.liveDurationInfinity?(O.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),C.duration=Infinity,this.updateSeekableRange(s)):(v>_&&v>m||!Object(Z.isFiniteNumber)(m))&&(O.logger.log("[buffer-controller]: Updating Media Source duration to "+v.toFixed(3)),C.duration=v)},b.updateSeekableRange=function(s){var u=this.mediaSource,f=s.fragments,C=f.length;if(C&&s.live&&u!==null&&u!==void 0&&u.setLiveSeekableRange){var v=Math.max(0,f[0].start),m=Math.max(v,v+s.totalduration);u.setLiveSeekableRange(v,m)}},b.checkPendingTracks=function(){var s=this.bufferCodecEventsExpected,u=this.operationQueue,f=this.pendingTracks,C=Object.keys(f).length;if(C&&!s||C===2){this.createSourceBuffers(f),this.pendingTracks={};var v=this.getSourceBufferTypes();if(v.length===0){this.hls.trigger(U.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}v.forEach(function(m){u.executeNext(m)})}},b.createSourceBuffers=function(s){var u=this.sourceBuffer,f=this.mediaSource;if(!f)throw Error("createSourceBuffers called when mediaSource was null");var C=0;for(var v in s)if(!u[v]){var m=s[v];if(!m)throw Error("source buffer exists for track "+v+", however track does not");var _=m.levelCodec||m.codec,x=m.container+";codecs="+_;O.logger.log("[buffer-controller]: creating sourceBuffer("+x+")");try{var d=u[v]=f.addSourceBuffer(x),h=v;this.addBufferListener(h,"updatestart",this._onSBUpdateStart),this.addBufferListener(h,"updateend",this._onSBUpdateEnd),this.addBufferListener(h,"error",this._onSBUpdateError),this.tracks[v]={buffer:d,codec:_,container:m.container,levelCodec:m.levelCodec,id:m.id},C++}catch(o){O.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+o.message),this.hls.trigger(U.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:o,mimeType:x})}}C&&this.hls.trigger(U.Events.BUFFER_CREATED,{tracks:this.tracks})},b._onSBUpdateStart=function(s){var u=this.operationQueue,f=u.current(s);f.onStart()},b._onSBUpdateEnd=function(s){var u=this.operationQueue,f=u.current(s);f.onComplete(),u.shiftAndExecuteNext(s)},b._onSBUpdateError=function(s,u){O.logger.error("[buffer-controller]: "+s+" SourceBuffer error",u),this.hls.trigger(U.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var f=this.operationQueue.current(s);f&&f.onError(u)},b.removeExecutor=function(s,u,f){var C=this.media,v=this.mediaSource,m=this.operationQueue,_=this.sourceBuffer,x=_[s];if(!C||!v||!x){O.logger.warn("[buffer-controller]: Attempting to remove from the "+s+" SourceBuffer, but it does not exist"),m.shiftAndExecuteNext(s);return}var d=Object(Z.isFiniteNumber)(C.duration)?C.duration:Infinity,h=Object(Z.isFiniteNumber)(v.duration)?v.duration:Infinity,o=Math.max(0,u),i=Math.min(f,d,h);i>o?(O.logger.log("[buffer-controller]: Removing ["+o+","+i+"] from the "+s+" SourceBuffer"),console.assert(!x.updating,s+" sourceBuffer must not be updating"),x.remove(o,i)):m.shiftAndExecuteNext(s)},b.appendExecutor=function(s,u){var f=this.operationQueue,C=this.sourceBuffer,v=C[u];if(!v){O.logger.warn("[buffer-controller]: Attempting to append to the "+u+" SourceBuffer, but it does not exist"),f.shiftAndExecuteNext(u);return}v.ended=!1,console.assert(!v.updating,u+" sourceBuffer must not be updating"),v.appendBuffer(s)},b.blockBuffers=function(s,u){var f=this;if(u===void 0&&(u=this.getSourceBufferTypes()),!u.length){O.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(s);return}var C=this.operationQueue,v=u.map(function(m){return C.appendBlocker(m)});Promise.all(v).then(function(){s(),u.forEach(function(m){var _=f.sourceBuffer[m];(!_||!_.updating)&&C.shiftAndExecuteNext(m)})})},b.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},b.addBufferListener=function(s,u,f){var C=this.sourceBuffer[s];if(!C)return;var v=f.bind(this,s);this.listeners[s].push({event:u,listener:v}),C.addEventListener(u,v)},b.removeBufferListeners=function(s){var u=this.sourceBuffer[s];if(!u)return;this.listeners[s].forEach(function(f){u.removeEventListener(f.event,f.listener)})},y}()},"./src/controller/buffer-operation-queue.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"default",function(){return U});var Z=R("./src/utils/logger.ts"),U=function(){function O(B){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=B}var j=O.prototype;return j.append=function(k,D){var E=this.queues[D];E.push(k),E.length===1&&this.buffers[D]&&this.executeNext(D)},j.insertAbort=function(k,D){var E=this.queues[D];E.unshift(k),this.executeNext(D)},j.appendBlocker=function(k){var D,E=new Promise(function(P){D=P}),A={execute:D,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(A,k),E},j.executeNext=function(k){var D=this.buffers,E=this.queues,A=D[k],P=E[k];if(P.length){var w=P[0];try{w.execute()}catch(y){Z.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),w.onError(y),(!A||!A.updating)&&(P.shift(),this.executeNext(k))}}},j.shiftAndExecuteNext=function(k){this.queues[k].shift(),this.executeNext(k)},j.current=function(k){return this.queues[k][0]},O}()},"./src/controller/cap-level-controller.ts":function(ce,X,R){"use strict";R.r(X);var Z=R("./src/events.ts");function U(B,k){for(var D=0;D<k.length;D++){var E=k[D];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(B,E.key,E)}}function O(B,k,D){return k&&U(B.prototype,k),D&&U(B,D),B}var j=function(){function B(D){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=D,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var k=B.prototype;return k.setStreamController=function(E){this.streamController=E},k.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},k.registerListeners=function(){var E=this.hls;E.on(Z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),E.on(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),E.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.on(Z.Events.BUFFER_CODECS,this.onBufferCodecs,this),E.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.unregisterListener=function(){var E=this.hls;E.off(Z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),E.off(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),E.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.off(Z.Events.BUFFER_CODECS,this.onBufferCodecs,this),E.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.onFpsDropLevelCapping=function(E,A){B.isLevelAllowed(A.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(A.droppedLevel)},k.onMediaAttaching=function(E,A){this.media=A.media instanceof HTMLVideoElement?A.media:null},k.onManifestParsed=function(E,A){var P=this.hls;this.restrictedLevels=[],this.firstLevel=A.firstLevel,P.config.capLevelToPlayerSize&&A.video&&this.startCapping()},k.onBufferCodecs=function(E,A){var P=this.hls;P.config.capLevelToPlayerSize&&A.video&&this.startCapping()},k.onMediaDetaching=function(){this.stopCapping()},k.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var E=this.hls.levels;if(E.length){var A=this.hls;A.autoLevelCapping=this.getMaxLevel(E.length-1),A.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=A.autoLevelCapping}}},k.getMaxLevel=function(E){var A=this,P=this.hls.levels;if(!P.length)return-1;var w=P.filter(function(y,b){return B.isLevelAllowed(b,A.restrictedLevels)&&b<=E});return this.clientRect=null,B.getMaxLevelByMediaSize(w,this.mediaWidth,this.mediaHeight)},k.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()},k.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},k.getDimensions=function(){if(this.clientRect)return this.clientRect;var E=this.media,A={width:0,height:0};if(E){var P=E.getBoundingClientRect();A.width=P.width,A.height=P.height,!A.width&&!A.height&&(A.width=P.right-P.left||E.width||0,A.height=P.bottom-P.top||E.height||0)}return this.clientRect=A,A},B.isLevelAllowed=function(E,A){return A===void 0&&(A=[]),A.indexOf(E)===-1},B.getMaxLevelByMediaSize=function(E,A,P){if(!E||!E.length)return-1;for(var w=function(u,f){return f?u.width!==f.width||u.height!==f.height:!0},y=E.length-1,b=0;b<E.length;b+=1){var c=E[b];if((c.width>=A||c.height>=P)&&w(c,E[b+1])){y=b;break}}return y},O(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 E=1;try{E=self.devicePixelRatio}catch(A){}return E}}]),B}();X.default=j},"./src/controller/cmcd-controller.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"default",function(){return w});var Z=R("./src/events.ts"),U=R("./src/types/cmcd.ts"),O=R("./src/utils/buffer-helper.ts"),j=R("./src/utils/logger.ts");function B(y,b){for(var c=0;c<b.length;c++){var s=b[c];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(y,s.key,s)}}function k(y,b,c){return b&&B(y.prototype,b),c&&B(y,c),y}function D(y,b){var c=typeof Symbol!="undefined"&&y[Symbol.iterator]||y["@@iterator"];if(c)return(c=c.call(y)).next.bind(c);if(Array.isArray(y)||(c=E(y))||b&&y&&typeof y.length=="number"){c&&(y=c);var s=0;return function(){return s>=y.length?{done:!0}:{done:!1,value:y[s++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function E(y,b){if(!y)return;if(typeof y=="string")return A(y,b);var c=Object.prototype.toString.call(y).slice(8,-1);if(c==="Object"&&y.constructor&&(c=y.constructor.name),c==="Map"||c==="Set")return Array.from(y);if(c==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return A(y,b)}function A(y,b){(b==null||b>y.length)&&(b=y.length);for(var c=0,s=new Array(b);c<b;c++)s[c]=y[c];return s}function P(){return P=Object.assign||function(y){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var s in c)Object.prototype.hasOwnProperty.call(c,s)&&(y[s]=c[s])}return y},P.apply(this,arguments)}var w=function(){function y(c){var s=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(){s.initialized&&(s.starved=!0),s.buffering=!0},this.onPlaying=function(){s.initialized||(s.initialized=!0),s.buffering=!1},this.applyPlaylistData=function(C){try{s.apply(C,{ot:U.CMCDObjectType.MANIFEST,su:!s.initialized})}catch(v){j.logger.warn("Could not generate manifest CMCD data.",v)}},this.applyFragmentData=function(C){try{var v=C.frag,m=s.hls.levels[v.level],_=s.getObjectType(v),x={d:v.duration*1e3,ot:_};(_===U.CMCDObjectType.VIDEO||_===U.CMCDObjectType.AUDIO||_==U.CMCDObjectType.MUXED)&&(x.br=m.bitrate/1e3,x.tb=s.getTopBandwidth(_),x.bl=s.getBufferLength(_)),s.apply(C,x)}catch(d){j.logger.warn("Could not generate segment CMCD data.",d)}},this.hls=c;var u=this.config=c.config,f=u.cmcd;f!=null&&(u.pLoader=this.createPlaylistLoader(),u.fLoader=this.createFragmentLoader(),this.sid=f.sessionId||y.uuid(),this.cid=f.contentId,this.useHeaders=f.useHeaders===!0,this.registerListeners())}var b=y.prototype;return b.registerListeners=function(){var s=this.hls;s.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.on(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),s.on(Z.Events.BUFFER_CREATED,this.onBufferCreated,this)},b.unregisterListeners=function(){var s=this.hls;s.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.off(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),s.off(Z.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},b.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},b.onMediaAttached=function(s,u){this.media=u.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},b.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},b.onBufferCreated=function(s,u){var f,C;this.audioBuffer=(f=u.tracks.audio)===null||f===void 0?void 0:f.buffer,this.videoBuffer=(C=u.tracks.video)===null||C===void 0?void 0:C.buffer},b.createData=function(){var s;return{v:U.CMCDVersion,sf:U.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(s=this.media)===null||s===void 0?void 0:s.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},b.apply=function(s,u){u===void 0&&(u={}),P(u,this.createData());var f=u.ot===U.CMCDObjectType.INIT||u.ot===U.CMCDObjectType.VIDEO||u.ot===U.CMCDObjectType.MUXED;if(this.starved&&f&&(u.bs=!0,u.su=!0,this.starved=!1),u.su==null&&(u.su=this.buffering),this.useHeaders){var C=y.toHeaders(u);if(!Object.keys(C).length)return;s.headers||(s.headers={}),P(s.headers,C)}else{var v=y.toQuery(u);if(!v)return;s.url=y.appendQueryToUri(s.url,v)}},b.getObjectType=function(s){var u=s.type;return u==="subtitle"?U.CMCDObjectType.TIMED_TEXT:s.sn==="initSegment"?U.CMCDObjectType.INIT:u==="audio"?U.CMCDObjectType.AUDIO:u==="main"?this.hls.audioTracks.length?U.CMCDObjectType.VIDEO:U.CMCDObjectType.MUXED:void 0},b.getTopBandwidth=function(s){for(var u=0,f=s===U.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,C=D(f),v;!(v=C()).done;){var m=v.value;m.bitrate>u&&(u=m.bitrate)}return u>0?u:NaN},b.getBufferLength=function(s){var u=this.hls.media,f=s===U.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!f||!u)return NaN;var C=O.BufferHelper.bufferInfo(f,u.currentTime,this.config.maxBufferHole);return C.len*1e3},b.createPlaylistLoader=function(){var s=this.config.pLoader,u=this.applyPlaylistData,f=s||this.config.loader;return function(){function C(m){this.loader=void 0,this.loader=new f(m)}var v=C.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(_,x,d){u(_),this.loader.load(_,x,d)},k(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},b.createFragmentLoader=function(){var s=this.config.fLoader,u=this.applyFragmentData,f=s||this.config.loader;return function(){function C(m){this.loader=void 0,this.loader=new f(m)}var v=C.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(_,x,d){u(_),this.loader.load(_,x,d)},k(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},y.uuid=function(){var s=URL.createObjectURL(new Blob),u=s.toString();return URL.revokeObjectURL(s),u.substr(u.lastIndexOf("/")+1)},y.serialize=function(s){for(var u=[],f=function(F){return!Number.isNaN(F)&&F!=null&&F!==""&&F!==!1},C=function(F){return Math.round(F)},v=function(F){return C(F/100)*100},m=function(F){return encodeURIComponent(F)},_={br:C,d:C,bl:v,dl:v,mtp:v,nor:m,rtp:v,tb:C},x=Object.keys(s||{}).sort(),d=D(x),h;!(h=d()).done;){var o=h.value,i=s[o];if(!f(i))continue;if(o==="v"&&i===1)continue;if(o=="pr"&&i===1)continue;var g=_[o];g&&(i=g(i));var l=typeof i,T=void 0;o==="ot"||o==="sf"||o==="st"?T=o+"="+i:l==="boolean"?T=o:l==="number"?T=o+"="+i:T=o+"="+JSON.stringify(i),u.push(T)}return u.join(",")},y.toHeaders=function(s){for(var u=Object.keys(s),f={},C=["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},_=0,x=u;_<x.length;_++){var d=x[_],h=m[d]!=null?m[d]:1;v[h][d]=s[d]}for(var o=0;o<v.length;o++){var i=y.serialize(v[o]);i&&(f["CMCD-"+C[o]]=i)}return f},y.toQuery=function(s){return"CMCD="+encodeURIComponent(y.serialize(s))},y.appendQueryToUri=function(s,u){if(!u)return s;var f=s.includes("?")?"&":"?";return""+s+f+u},y}()},"./src/controller/eme-controller.ts":function(ce,X,R){"use strict";R.r(X);var Z=R("./src/events.ts"),U=R("./src/errors.ts"),O=R("./src/utils/logger.ts"),j=R("./src/utils/mediakeys-helper.ts");function B(w,y){for(var b=0;b<y.length;b++){var c=y[b];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(w,c.key,c)}}function k(w,y,b){return y&&B(w.prototype,y),b&&B(w,b),w}var D=3,E=function(y,b,c){var s={audioCapabilities:[],videoCapabilities:[]};return y.forEach(function(u){s.audioCapabilities.push({contentType:'audio/mp4; codecs="'+u+'"',robustness:c.audioRobustness||""})}),b.forEach(function(u){s.videoCapabilities.push({contentType:'video/mp4; codecs="'+u+'"',robustness:c.videoRobustness||""})}),[s]},A=function(y,b,c,s){switch(y){case j.KeySystems.WIDEVINE:return E(b,c,s);default:throw new Error("Unknown key-system: "+y)}},P=function(){function w(b){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=b,this._config=b.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 y=w.prototype;return y.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},y._registerListeners=function(){this.hls.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},y._unregisterListeners=function(){this.hls.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},y.getLicenseServerUrl=function(c){switch(c){case j.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+c+'"')},y._attemptKeySystemAccess=function(c,s,u){var f=this,C=A(c,s,u,this._drmSystemOptions);O.logger.log("Requesting encrypted media key-system access");var v=this.requestMediaKeySystemAccess(c,C);this.mediaKeysPromise=v.then(function(m){return f._onMediaKeySystemAccessObtained(c,m)}),v.catch(function(m){O.logger.error('Failed to obtain key-system "'+c+'" access:',m)})},y._onMediaKeySystemAccessObtained=function(c,s){var u=this;O.logger.log('Access for key-system "'+c+'" obtained');var f={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:s,mediaKeySystemDomain:c};this._mediaKeysList.push(f);var C=Promise.resolve().then(function(){return s.createMediaKeys()}).then(function(v){return f.mediaKeys=v,O.logger.log('Media-keys created for key-system "'+c+'"'),u._onMediaKeysCreated(),v});return C.catch(function(v){O.logger.error("Failed to create media-keys:",v)}),C},y._onMediaKeysCreated=function(){var c=this;this._mediaKeysList.forEach(function(s){s.mediaKeysSession||(s.mediaKeysSession=s.mediaKeys.createSession(),c._onNewMediaKeySession(s.mediaKeysSession))})},y._onNewMediaKeySession=function(c){var s=this;O.logger.log("New key-system session "+c.sessionId),c.addEventListener("message",function(u){s._onKeySessionMessage(c,u.message)},!1)},y._onKeySessionMessage=function(c,s){O.logger.log("Got EME message event, creating license request"),this._requestLicense(s,function(u){O.logger.log("Received license data (length: "+(u&&u.byteLength)+"), updating key-session"),c.update(u)})},y.onMediaEncrypted=function(c){var s=this;if(O.logger.log('Media is encrypted using "'+c.initDataType+'" init data type'),!this.mediaKeysPromise){O.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var u=function(C){if(!s._media)return;s._attemptSetMediaKeys(C),s._generateRequestWithPreferredKeySession(c.initDataType,c.initData)};this.mediaKeysPromise.then(u).catch(u)},y._attemptSetMediaKeys=function(c){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var s=this._mediaKeysList[0];if(!s||!s.mediaKeys){O.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}O.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(s.mediaKeys),this._hasSetMediaKeys=!0}},y._generateRequestWithPreferredKeySession=function(c,s){var u=this,f=this._mediaKeysList[0];if(!f){O.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(f.mediaKeysSessionInitialized){O.logger.warn("Key-Session already initialized but requested again");return}var C=f.mediaKeysSession;if(!C){O.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!s){O.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}O.logger.log('Generating key-session request for "'+c+'" init data type'),f.mediaKeysSessionInitialized=!0,C.generateRequest(c,s).then(function(){O.logger.debug("Key-session generation succeeded")}).catch(function(v){O.logger.error("Error generating key-session request:",v),u.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},y._createLicenseXhr=function(c,s,u){var f=new XMLHttpRequest;f.responseType="arraybuffer",f.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,f,c,s,u);var C=this._licenseXhrSetup;if(C)try{C.call(this.hls,f,c),C=void 0}catch(v){O.logger.error(v)}try{f.readyState||f.open("POST",c,!0),C&&C.call(this.hls,f,c)}catch(v){throw new Error("issue setting up KeySystem license XHR "+v)}return f},y._onLicenseRequestReadyStageChange=function(c,s,u,f){switch(c.readyState){case 4:if(c.status===200){this._requestLicenseFailureCount=0,O.logger.log("License request succeeded");var C=c.response,v=this._licenseResponseCallback;if(v)try{C=v.call(this.hls,c,s)}catch(_){O.logger.error(_)}f(C)}else{if(O.logger.error("License Request XHR failed ("+s+"). Status: "+c.status+" ("+c.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>D){this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var m=D-this._requestLicenseFailureCount+1;O.logger.warn("Retrying license request, "+m+" attempts left"),this._requestLicense(u,f)}break}},y._generateLicenseRequestChallenge=function(c,s){switch(c.mediaKeySystemDomain){case j.KeySystems.WIDEVINE:return s}throw new Error("unsupported key-system: "+c.mediaKeySystemDomain)},y._requestLicense=function(c,s){O.logger.log("Requesting content license for key-system");var u=this._mediaKeysList[0];if(!u){O.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var f=this.getLicenseServerUrl(u.mediaKeySystemDomain),C=this._createLicenseXhr(f,c,s);O.logger.log("Sending license request to URL: "+f);var v=this._generateLicenseRequestChallenge(u,c);C.send(v)}catch(m){O.logger.error("Failure requesting DRM license: "+m),this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},y.onMediaAttached=function(c,s){if(!this._emeEnabled)return;var u=s.media;this._media=u,u.addEventListener("encrypted",this._onMediaEncrypted)},y.onMediaDetached=function(){var c=this._media,s=this._mediaKeysList;if(!c)return;c.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(s.map(function(u){if(u.mediaKeysSession)return u.mediaKeysSession.close().catch(function(){})})).then(function(){return c.setMediaKeys(null)}).catch(function(){})},y.onManifestParsed=function(c,s){if(!this._emeEnabled)return;var u=s.levels.map(function(C){return C.audioCodec}).filter(function(C){return!!C}),f=s.levels.map(function(C){return C.videoCodec}).filter(function(C){return!!C});this._attemptKeySystemAccess(j.KeySystems.WIDEVINE,u,f)},k(w,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),w}();X.default=P},"./src/controller/fps-controller.ts":function(ce,X,R){"use strict";R.r(X);var Z=R("./src/events.ts"),U=R("./src/utils/logger.ts"),O=function(){function j(k){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=k,this.registerListeners()}var B=j.prototype;return B.setStreamController=function(D){this.streamController=D},B.registerListeners=function(){this.hls.on(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},B.unregisterListeners=function(){this.hls.off(Z.Events.MEDIA_ATTACHING,this.onMediaAttaching)},B.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},B.onMediaAttaching=function(D,E){var A=this.hls.config;if(A.capLevelOnFPSDrop){var P=E.media instanceof self.HTMLVideoElement?E.media:null;this.media=P,P&&typeof P.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),A.fpsDroppedMonitoringPeriod)}},B.checkFPS=function(D,E,A){var P=performance.now();if(E){if(this.lastTime){var w=P-this.lastTime,y=A-this.lastDroppedFrames,b=E-this.lastDecodedFrames,c=1e3*y/w,s=this.hls;if(s.trigger(Z.Events.FPS_DROP,{currentDropped:y,currentDecoded:b,totalDroppedFrames:A}),c>0&&y>s.config.fpsDroppedMonitoringThreshold*b){var u=s.currentLevel;U.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(s.autoLevelCapping===-1||s.autoLevelCapping>=u)&&(u=u-1,s.trigger(Z.Events.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:s.currentLevel}),s.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=P,this.lastDroppedFrames=A,this.lastDecodedFrames=E}},B.checkFPSInterval=function(){var D=this.media;if(D)if(this.isVideoPlaybackQualityAvailable){var E=D.getVideoPlaybackQuality();this.checkFPS(D,E.totalVideoFrames,E.droppedVideoFrames)}else this.checkFPS(D,D.webkitDecodedFrameCount,D.webkitDroppedFrameCount)},j}();X.default=O},"./src/controller/fragment-finders.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"findFragmentByPDT",function(){return O}),R.d(X,"findFragmentByPTS",function(){return j}),R.d(X,"fragmentWithinToleranceTest",function(){return B}),R.d(X,"pdtWithinToleranceTest",function(){return k}),R.d(X,"findFragWithCC",function(){return D});var Z=R("./src/polyfills/number.ts"),U=R("./src/utils/binary-search.ts");function O(E,A,P){if(A===null||!Array.isArray(E)||!E.length||!Object(Z.isFiniteNumber)(A))return null;var w=E[0].programDateTime;if(A<(w||0))return null;var y=E[E.length-1].endProgramDateTime;if(A>=(y||0))return null;P=P||0;for(var b=0;b<E.length;++b){var c=E[b];if(k(A,P,c))return c}return null}function j(E,A,P,w){P===void 0&&(P=0),w===void 0&&(w=0);var y=null;if(E?y=A[E.sn-A[0].sn+1]||null:P===0&&A[0].start===0&&(y=A[0]),y&&B(P,w,y)===0)return y;var b=U.default.search(A,B.bind(null,P,w));return b||y}function B(E,A,P){E===void 0&&(E=0),A===void 0&&(A=0);var w=Math.min(A,P.duration+(P.deltaPTS?P.deltaPTS:0));return P.start+P.duration-w<=E?1:P.start-w>E&&P.start?-1:0}function k(E,A,P){var w=Math.min(A,P.duration+(P.deltaPTS?P.deltaPTS:0))*1e3,y=P.endProgramDateTime||0;return y-w>E}function D(E,A){return U.default.search(E,function(P){return P.cc<A?1:P.cc>A?-1:0})}},"./src/controller/fragment-tracker.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"FragmentState",function(){return O}),R.d(X,"FragmentTracker",function(){return j});var Z=R("./src/events.ts"),U=R("./src/types/loader.ts"),O;(function(D){D.NOT_LOADED="NOT_LOADED",D.BACKTRACKED="BACKTRACKED",D.APPENDING="APPENDING",D.PARTIAL="PARTIAL",D.OK="OK"})(O||(O={}));var j=function(){function D(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 E=D.prototype;return E._registerListeners=function(){var P=this.hls;P.on(Z.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.on(Z.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.on(Z.Events.FRAG_LOADED,this.onFragLoaded,this)},E._unregisterListeners=function(){var P=this.hls;P.off(Z.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.off(Z.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.off(Z.Events.FRAG_LOADED,this.onFragLoaded,this)},E.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},E.getAppendedFrag=function(P,w){if(w===U.PlaylistLevelType.MAIN){var y=this.activeFragment,b=this.activeParts;if(!y)return null;if(b)for(var c=b.length;c--;){var s=b[c],u=s?s.end:y.appendedPTS;if(s.start<=P&&u!==void 0&&P<=u)return c>9&&(this.activeParts=b.slice(c-9)),s}else if(y.start<=P&&y.appendedPTS!==void 0&&P<=y.appendedPTS)return y}return this.getBufferedFrag(P,w)},E.getBufferedFrag=function(P,w){for(var y=this.fragments,b=Object.keys(y),c=b.length;c--;){var s=y[b[c]];if((s==null?void 0:s.body.type)===w&&s.buffered){var u=s.body;if(u.start<=P&&P<=u.end)return u}}return null},E.detectEvictedFragments=function(P,w,y){var b=this;Object.keys(this.fragments).forEach(function(c){var s=b.fragments[c];if(!s)return;if(!s.buffered){s.body.type===y&&b.removeFragment(s.body);return}var u=s.range[P];if(!u)return;u.time.some(function(f){var C=!b.isTimeBuffered(f.startPTS,f.endPTS,w);return C&&b.removeFragment(s.body),C})})},E.detectPartialFragments=function(P){var w=this,y=this.timeRanges,b=P.frag,c=P.part;if(!y||b.sn==="initSegment")return;var s=k(b),u=this.fragments[s];if(!u)return;Object.keys(y).forEach(function(f){var C=b.elementaryStreams[f];if(!C)return;var v=y[f],m=c!==null||C.partial===!0;u.range[f]=w.getBufferedTimes(b,c,m,v)}),u.backtrack=u.loaded=null,Object.keys(u.range).length?u.buffered=!0:this.removeFragment(u.body)},E.fragBuffered=function(P){var w=k(P),y=this.fragments[w];y&&(y.backtrack=y.loaded=null,y.buffered=!0)},E.getBufferedTimes=function(P,w,y,b){for(var c={time:[],partial:y},s=w?w.start:P.start,u=w?w.end:P.end,f=P.minEndPTS||u,C=P.maxStartPTS||s,v=0;v<b.length;v++){var m=b.start(v)-this.bufferPadding,_=b.end(v)+this.bufferPadding;if(C>=m&&f<=_){c.time.push({startPTS:Math.max(s,b.start(v)),endPTS:Math.min(u,b.end(v))});break}else if(s<_&&u>m)c.partial=!0,c.time.push({startPTS:Math.max(s,b.start(v)),endPTS:Math.min(u,b.end(v))});else if(u<=m)break}return c},E.getPartialFragment=function(P){var w=null,y,b,c,s=0,u=this.bufferPadding,f=this.fragments;return Object.keys(f).forEach(function(C){var v=f[C];if(!v)return;B(v)&&(b=v.body.start-u,c=v.body.end+u,P>=b&&P<=c&&(y=Math.min(P-b,c-P),s<=y&&(w=v.body,s=y)))}),w},E.getState=function(P){var w=k(P),y=this.fragments[w];return y?y.buffered?B(y)?O.PARTIAL:O.OK:y.backtrack?O.BACKTRACKED:O.APPENDING:O.NOT_LOADED},E.backtrack=function(P,w){var y=k(P),b=this.fragments[y];if(!b||b.backtrack)return null;var c=b.backtrack=w||b.loaded;return b.loaded=null,c},E.getBacktrackData=function(P){var w=k(P),y=this.fragments[w];if(y){var b,c=y.backtrack;if(c!=null&&(b=c.payload)!==null&&b!==void 0&&b.byteLength)return c;this.removeFragment(P)}return null},E.isTimeBuffered=function(P,w,y){for(var b,c,s=0;s<y.length;s++){if(b=y.start(s)-this.bufferPadding,c=y.end(s)+this.bufferPadding,P>=b&&w<=c)return!0;if(w<=b)return!1}return!1},E.onFragLoaded=function(P,w){var y=w.frag,b=w.part;if(y.sn==="initSegment"||y.bitrateTest||b)return;var c=k(y);this.fragments[c]={body:y,loaded:w,backtrack:null,buffered:!1,range:Object.create(null)}},E.onBufferAppended=function(P,w){var y=this,b=w.frag,c=w.part,s=w.timeRanges;if(b.type===U.PlaylistLevelType.MAIN)if(this.activeFragment=b,c){var u=this.activeParts;u||(this.activeParts=u=[]),u.push(c)}else this.activeParts=null;this.timeRanges=s,Object.keys(s).forEach(function(f){var C=s[f];if(y.detectEvictedFragments(f,C),!c)for(var v=0;v<C.length;v++)b.appendedPTS=Math.max(C.end(v),b.appendedPTS||0)})},E.onFragBuffered=function(P,w){this.detectPartialFragments(w)},E.hasFragment=function(P){var w=k(P);return!!this.fragments[w]},E.removeFragmentsInRange=function(P,w,y){var b=this;Object.keys(this.fragments).forEach(function(c){var s=b.fragments[c];if(!s)return;if(s.buffered){var u=s.body;u.type===y&&u.start<w&&u.end>P&&b.removeFragment(u)}})},E.removeFragment=function(P){var w=k(P);P.stats.loaded=0,P.clearElementaryStreamInfo(),delete this.fragments[w]},E.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},D}();function B(D){var E,A;return D.buffered&&(((E=D.range.video)===null||E===void 0?void 0:E.partial)||((A=D.range.audio)===null||A===void 0?void 0:A.partial))}function k(D){return D.type+"_"+D.level+"_"+D.urlId+"_"+D.sn}},"./src/controller/gap-controller.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"STALL_MINIMUM_DURATION_MS",function(){return B}),R.d(X,"MAX_START_GAP_JUMP",function(){return k}),R.d(X,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return D}),R.d(X,"SKIP_BUFFER_RANGE_START",function(){return E}),R.d(X,"default",function(){return A});var Z=R("./src/utils/buffer-helper.ts"),U=R("./src/errors.ts"),O=R("./src/events.ts"),j=R("./src/utils/logger.ts"),B=250,k=2,D=.1,E=.05,A=function(){function P(y,b,c,s){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=y,this.media=b,this.fragmentTracker=c,this.hls=s}var w=P.prototype;return w.destroy=function(){this.hls=this.fragmentTracker=this.media=null},w.poll=function(b){var c=this.config,s=this.media,u=this.stalled,f=s.currentTime,C=s.seeking,v=this.seeking&&!C,m=!this.seeking&&C;if(this.seeking=C,f!==b){if(this.moved=!0,u!==null){if(this.stallReported){var _=self.performance.now()-u;j.logger.warn("playback not stuck anymore @"+f+", after "+Math.round(_)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((m||v)&&(this.stalled=null),s.paused||s.ended||s.playbackRate===0||!Z.BufferHelper.getBuffered(s).length)return;var x=Z.BufferHelper.bufferInfo(s,f,0),d=x.len>0,h=x.nextStart||0;if(!d&&!h)return;if(C){var o=x.len>k,i=!h||h-f>k&&!this.fragmentTracker.getPartialFragment(f);if(o||i)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var g,l=Math.max(h,x.start||0)-f,T=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,I=T==null||((g=T.details)===null||g===void 0)?void 0:g.live,F=I?T.details.targetduration*2:k;if(l>0&&l<=F){this._trySkipBufferHole(null);return}}var W=self.performance.now();if(u===null){this.stalled=W;return}var V=W-u;!C&&V>=B&&this._reportStall(x.len);var M=Z.BufferHelper.bufferInfo(s,f,c.maxBufferHole);this._tryFixBufferStall(M,V)},w._tryFixBufferStall=function(b,c){var s=this.config,u=this.fragmentTracker,f=this.media,C=f.currentTime,v=u.getPartialFragment(C);if(v){var m=this._trySkipBufferHole(v);if(m)return}b.len>s.maxBufferHole&&c>s.highBufferWatchdogPeriod*1e3&&(j.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},w._reportStall=function(b){var c=this.hls,s=this.media,u=this.stallReported;u||(this.stallReported=!0,j.logger.warn("Playback stalling at @"+s.currentTime+" due to low buffer (buffer="+b+")"),c.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:b}))},w._trySkipBufferHole=function(b){for(var c=this.config,s=this.hls,u=this.media,f=u.currentTime,C=0,v=Z.BufferHelper.getBuffered(u),m=0;m<v.length;m++){var _=v.start(m);if(f+c.maxBufferHole>=C&&f<_){var x=Math.max(_+E,u.currentTime+D);return j.logger.warn("skipping hole, adjusting currentTime from "+f+" to "+x),this.moved=!0,this.stalled=null,u.currentTime=x,b&&s.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+f+" to "+x,frag:b}),x}C=v.end(m)}return 0},w._tryNudgeBuffer=function(){var b=this.config,c=this.hls,s=this.media,u=s.currentTime,f=(this.nudgeRetry||0)+1;if(this.nudgeRetry=f,f<b.nudgeMaxRetry){var C=u+f*b.nudgeOffset;j.logger.warn("Nudging 'currentTime' from "+u+" to "+C),s.currentTime=C,c.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else j.logger.error("Playhead still not moving while enough data buffered @"+u+" after "+b.nudgeMaxRetry+" nudges"),c.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},P}()},"./src/controller/id3-track-controller.ts":function(ce,X,R){"use strict";R.r(X);var Z=R("./src/events.ts"),U=R("./src/utils/texttrack-utils.ts"),O=R("./src/demux/id3.ts"),j=.25,B=function(){function k(E){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=E,this._registerListeners()}var D=k.prototype;return D.destroy=function(){this._unregisterListeners()},D._registerListeners=function(){var A=this.hls;A.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(Z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.on(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D._unregisterListeners=function(){var A=this.hls;A.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(Z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.off(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D.onMediaAttached=function(A,P){this.media=P.media},D.onMediaDetaching=function(){if(!this.id3Track)return;Object(U.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},D.getID3Track=function(A){if(!this.media)return;for(var P=0;P<A.length;P++){var w=A[P];if(w.kind==="metadata"&&w.label==="id3")return Object(U.sendAddTrackEvent)(w,this.media),w}return this.media.addTextTrack("metadata","id3")},D.onFragParsingMetadata=function(A,P){if(!this.media)return;var w=P.frag,y=P.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var b=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,c=0;c<y.length;c++){var s=O.getID3Frames(y[c].data);if(s){var u=y[c].pts,f=c<y.length-1?y[c+1].pts:w.end,C=f-u;C<=0&&(f=u+j);for(var v=0;v<s.length;v++){var m=s[v];if(!O.isTimeStampFrame(m)){var _=new b(u,f,"");_.value=m,this.id3Track.addCue(_)}}}}},D.onBufferFlushing=function(A,P){var w=P.startOffset,y=P.endOffset,b=P.type;if(!b||b==="audio"){var c=this.id3Track;c&&Object(U.removeCuesInRange)(c,w,y)}},k}();X.default=B},"./src/controller/latency-controller.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"default",function(){return k});var Z=R("./src/errors.ts"),U=R("./src/events.ts"),O=R("./src/utils/logger.ts");function j(D,E){for(var A=0;A<E.length;A++){var P=E[A];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(D,P.key,P)}}function B(D,E,A){return E&&j(D.prototype,E),A&&j(D,A),D}var k=function(){function D(A){var P=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return P.timeupdate()},this.hls=A,this.config=A.config,this.registerListeners()}var E=D.prototype;return E.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},E.registerListeners=function(){this.hls.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(U.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){this.hls.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(U.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(U.Events.ERROR,this.onError)},E.onMediaAttached=function(P,w){this.media=w.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},E.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},E.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},E.onLevelUpdated=function(P,w){var y=w.details;this.levelDetails=y,y.advanced&&this.timeupdate(),!y.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},E.onError=function(P,w){if(w.details!==Z.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,O.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},E.timeupdate=function(){var P=this.media,w=this.levelDetails;if(!P||!w)return;this.currentTime=P.currentTime;var y=this.computeLatency();if(y===null)return;this._latency=y;var b=this.config,c=b.lowLatencyMode,s=b.maxLiveSyncPlaybackRate;if(!c||s===1)return;var u=this.targetLatency;if(u===null)return;var f=y-u,C=Math.min(this.maxLatency,u+w.targetduration),v=f<C;if(w.live&&v&&f>.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,s)),_=Math.round(2/(1+Math.exp(-.75*f-this.edgeStalled))*20)/20;P.playbackRate=Math.min(m,Math.max(1,_))}else P.playbackRate!==1&&P.playbackRate!==0&&(P.playbackRate=1)},E.estimateLiveEdge=function(){var P=this.levelDetails;return P===null?null:P.edge+P.age},E.computeLatency=function(){var P=this.estimateLiveEdge();return P===null?null:P-this.currentTime},B(D,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var P=this.config,w=this.levelDetails;return P.liveMaxLatencyDuration!==void 0?P.liveMaxLatencyDuration:w?P.liveMaxLatencyDurationCount*w.targetduration:0}},{key:"targetLatency",get:function(){var P=this.levelDetails;if(P===null)return null;var w=P.holdBack,y=P.partHoldBack,b=P.targetduration,c=this.config,s=c.liveSyncDuration,u=c.liveSyncDurationCount,f=c.lowLatencyMode,C=this.hls.userConfig,v=f&&y||w;(C.liveSyncDuration||C.liveSyncDurationCount||v===0)&&(v=s!==void 0?s:u*b);var m=b,_=1;return v+Math.min(this.stallCount*_,m)}},{key:"liveSyncPosition",get:function(){var P=this.estimateLiveEdge(),w=this.targetLatency,y=this.levelDetails;if(P===null||w===null||y===null)return null;var b=y.edge,c=P-w-this.edgeStalled,s=b-y.totalduration,u=b-(this.config.lowLatencyMode&&y.partTarget||y.targetduration);return Math.min(Math.max(s,c),u)}},{key:"drift",get:function(){var P=this.levelDetails;return P===null?1:P.drift}},{key:"edgeStalled",get:function(){var P=this.levelDetails;if(P===null)return 0;var w=(this.config.lowLatencyMode&&P.partTarget||P.targetduration)*3;return Math.max(P.age-w,0)}},{key:"forwardBufferLength",get:function(){var P=this.media,w=this.levelDetails;if(!P||!w)return 0;var y=P.buffered.length;return y?P.buffered.end(y-1):w.edge-this.currentTime}}]),D}()},"./src/controller/level-controller.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"default",function(){return c});var Z=R("./src/types/level.ts"),U=R("./src/events.ts"),O=R("./src/errors.ts"),j=R("./src/utils/codecs.ts"),B=R("./src/controller/level-helper.ts"),k=R("./src/controller/base-playlist-controller.ts"),D=R("./src/types/loader.ts");function E(){return E=Object.assign||function(s){for(var u=1;u<arguments.length;u++){var f=arguments[u];for(var C in f)Object.prototype.hasOwnProperty.call(f,C)&&(s[C]=f[C])}return s},E.apply(this,arguments)}function A(s,u){for(var f=0;f<u.length;f++){var C=u[f];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(s,C.key,C)}}function P(s,u,f){return u&&A(s.prototype,u),f&&A(s,f),s}function w(s,u){s.prototype=Object.create(u.prototype),s.prototype.constructor=s,y(s,u)}function y(s,u){return y=Object.setPrototypeOf||function(C,v){return C.__proto__=v,C},y(s,u)}var b=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),c=function(s){w(u,s);function u(C){var v;return v=s.call(this,C,"[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 f=u.prototype;return f._registerListeners=function(){var v=this.hls;v.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.on(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),v.on(U.Events.ERROR,this.onError,this)},f._unregisterListeners=function(){var v=this.hls;v.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.off(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),v.off(U.Events.ERROR,this.onError,this)},f.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,s.prototype.destroy.call(this)},f.startLoad=function(){var v=this._levels;v.forEach(function(m){m.loadError=0}),s.prototype.startLoad.call(this)},f.onManifestLoaded=function(v,m){var _=[],x=[],d=[],h,o={},i,g=!1,l=!1,T=!1;if(m.levels.forEach(function(V){var M=V.attrs;g=g||!!(V.width&&V.height),l=l||!!V.videoCodec,T=T||!!V.audioCodec,b&&V.audioCodec&&V.audioCodec.indexOf("mp4a.40.34")!==-1&&(V.audioCodec=void 0);var N=V.bitrate+"-"+V.attrs.RESOLUTION+"-"+V.attrs.CODECS;i=o[N],i?i.url.push(V.url):(i=new Z.Level(V),o[N]=i,_.push(i)),M&&(M.AUDIO&&Object(B.addGroupId)(i,"audio",M.AUDIO),M.SUBTITLES&&Object(B.addGroupId)(i,"text",M.SUBTITLES))}),(g||l)&&T&&(_=_.filter(function(V){var M=V.videoCodec,N=V.width,J=V.height;return!!M||!!(N&&J)})),_=_.filter(function(V){var M=V.audioCodec,N=V.videoCodec;return(!M||Object(j.isCodecSupportedInMp4)(M,"audio"))&&(!N||Object(j.isCodecSupportedInMp4)(N,"video"))}),m.audioTracks&&(x=m.audioTracks.filter(function(V){return!V.audioCodec||Object(j.isCodecSupportedInMp4)(V.audioCodec,"audio")}),Object(B.assignTrackIdsByGroup)(x)),m.subtitles&&(d=m.subtitles,Object(B.assignTrackIdsByGroup)(d)),_.length>0){h=_[0].bitrate,_.sort(function(V,M){return V.bitrate-M.bitrate}),this._levels=_;for(var I=0;I<_.length;I++)if(_[I].bitrate===h){this._firstLevel=I,this.log("manifest loaded, "+_.length+" level(s) found, first bitrate: "+h);break}var F=T&&!l,W={levels:_,audioTracks:x,subtitleTracks:d,firstLevel:this._firstLevel,stats:m.stats,audio:T,video:l,altAudio:!F&&x.some(function(V){return!!V.url})};this.hls.trigger(U.Events.MANIFEST_PARSED,W),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(U.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:m.url,reason:"no level with compatible codecs found in manifest"})},f.onError=function(v,m){if(s.prototype.onError.call(this,v,m),m.fatal)return;var _=m.context,x=this._levels[this.currentLevelIndex];if(_&&(_.type===D.PlaylistContextType.AUDIO_TRACK&&x.audioGroupIds&&_.groupId===x.audioGroupIds[x.urlId]||_.type===D.PlaylistContextType.SUBTITLE_TRACK&&x.textGroupIds&&_.groupId===x.textGroupIds[x.urlId])){this.redundantFailover(this.currentLevelIndex);return}var d=!1,h=!0,o;switch(m.details){case O.ErrorDetails.FRAG_LOAD_ERROR:case O.ErrorDetails.FRAG_LOAD_TIMEOUT:case O.ErrorDetails.KEY_LOAD_ERROR:case O.ErrorDetails.KEY_LOAD_TIMEOUT:if(m.frag){var i=this._levels[m.frag.level];i?(i.fragmentError++,i.fragmentError>this.hls.config.fragLoadingMaxRetry&&(o=m.frag.level)):o=m.frag.level}break;case O.ErrorDetails.LEVEL_LOAD_ERROR:case O.ErrorDetails.LEVEL_LOAD_TIMEOUT:_&&(_.deliveryDirectives&&(h=!1),o=_.level),d=!0;break;case O.ErrorDetails.REMUX_ALLOC_ERROR:o=m.level,d=!0;break}o!==void 0&&this.recoverLevel(m,o,d,h)},f.recoverLevel=function(v,m,_,x){var d=v.details,h=this._levels[m];if(h.loadError++,_){var o=this.retryLoadingOrFail(v);if(o)v.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(x){var i=h.url.length;if(i>1&&h.loadError<i)v.levelRetry=!0,this.redundantFailover(m);else if(this.manualLevelIndex===-1){var g=m===0?this._levels.length-1:m-1;this.currentLevelIndex!==g&&this._levels[g].loadError===0&&(this.warn(d+": switch to "+g),v.levelRetry=!0,this.hls.nextAutoLevel=g)}}},f.redundantFailover=function(v){var m=this._levels[v],_=m.url.length;if(_>1){var x=(m.urlId+1)%_;this.warn("Switching to redundant URL-id "+x),this._levels.forEach(function(d){d.urlId=x}),this.level=v}},f.onFragLoaded=function(v,m){var _=m.frag;if(_!==void 0&&_.type===D.PlaylistLevelType.MAIN){var x=this._levels[_.level];x!==void 0&&(x.fragmentError=0,x.loadError=0)}},f.onLevelLoaded=function(v,m){var _,x=m.level,d=m.details,h=this._levels[x];if(!h){var o;this.warn("Invalid level index "+x),(o=m.deliveryDirectives)!==null&&o!==void 0&&o.skip&&(d.deltaUpdateFailed=!0);return}x===this.currentLevelIndex?(h.fragmentError===0&&(h.loadError=0,this.retryCount=0),this.playlistLoaded(x,m,h.details)):(_=m.deliveryDirectives)!==null&&_!==void 0&&_.skip&&(d.deltaUpdateFailed=!0)},f.onAudioTrackSwitched=function(v,m){var _=this.hls.levels[this.currentLevelIndex];if(!_)return;if(_.audioGroupIds){for(var x=-1,d=this.hls.audioTracks[m.id].groupId,h=0;h<_.audioGroupIds.length;h++)if(_.audioGroupIds[h]===d){x=h;break}x!==_.urlId&&(_.urlId=x,this.startLoad())}},f.loadPlaylist=function(v){var m=this.currentLevelIndex,_=this._levels[m];if(this.canLoad&&_&&_.url.length>0){var x=_.urlId,d=_.url[x];if(v)try{d=v.addDirectives(d)}catch(h){this.warn("Could not construct new URL with HLS Delivery Directives: "+h)}this.log("Attempt loading level index "+m+(v?" at sn "+v.msn+" part "+v.part:"")+" with URL-id "+x+" "+d),this.clearTimer(),this.hls.trigger(U.Events.LEVEL_LOADING,{url:d,level:m,id:x,deliveryDirectives:v||null})}},f.removeLevel=function(v,m){var _=function(h,o){return o!==m},x=this._levels.filter(function(d,h){return h!==v?!0:d.url.length>1&&m!==void 0?(d.url=d.url.filter(_),d.audioGroupIds&&(d.audioGroupIds=d.audioGroupIds.filter(_)),d.textGroupIds&&(d.textGroupIds=d.textGroupIds.filter(_)),d.urlId=0,!0):!1}).map(function(d,h){var o=d.details;return o!=null&&o.fragments&&o.fragments.forEach(function(i){i.level=h}),d});this._levels=x,this.hls.trigger(U.Events.LEVELS_UPDATED,{levels:x})},P(u,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(v){var m,_=this._levels;if(_.length===0)return;if(this.currentLevelIndex===v&&(m=_[v])!==null&&m!==void 0&&m.details)return;if(v<0||v>=_.length){var x=v<0;if(this.hls.trigger(U.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.LEVEL_SWITCH_ERROR,level:v,fatal:x,reason:"invalid level idx"}),x)return;v=Math.min(v,_.length-1)}this.clearTimer();var d=this.currentLevelIndex,h=_[d],o=_[v];this.log("switching to level "+v+" from "+d),this.currentLevelIndex=v;var i=E({},o,{level:v,maxBitrate:o.maxBitrate,uri:o.uri,urlId:o.urlId});delete i._urlId,this.hls.trigger(U.Events.LEVEL_SWITCHING,i);var g=o.details;if(!g||g.live){var l=this.switchParams(o.uri,h==null?void 0:h.details);this.loadPlaylist(l)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(v){this.manualLevelIndex=v,this._startLevel===void 0&&(this._startLevel=v),v!==-1&&(this.level=v)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(v){this._firstLevel=v}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var v=this.hls.config.startLevel;return v!==void 0?v:this._firstLevel}else return this._startLevel},set:function(v){this._startLevel=v}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(v){this.level=v,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=v)}}]),u}(k.default)},"./src/controller/level-helper.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"addGroupId",function(){return O}),R.d(X,"assignTrackIdsByGroup",function(){return j}),R.d(X,"updatePTS",function(){return B}),R.d(X,"updateFragPTSDTS",function(){return D}),R.d(X,"mergeDetails",function(){return E}),R.d(X,"mapPartIntersection",function(){return A}),R.d(X,"mapFragmentIntersection",function(){return P}),R.d(X,"adjustSliding",function(){return w}),R.d(X,"addSliding",function(){return y}),R.d(X,"computeReloadInterval",function(){return b}),R.d(X,"getFragmentWithSN",function(){return c}),R.d(X,"getPartWith",function(){return s});var Z=R("./src/polyfills/number.ts"),U=R("./src/utils/logger.ts");function O(u,f,C){switch(f){case"audio":u.audioGroupIds||(u.audioGroupIds=[]),u.audioGroupIds.push(C);break;case"text":u.textGroupIds||(u.textGroupIds=[]),u.textGroupIds.push(C);break}}function j(u){var f={};u.forEach(function(C){var v=C.groupId||"";C.id=f[v]=f[v]||0,f[v]++})}function B(u,f,C){var v=u[f],m=u[C];k(v,m)}function k(u,f){var C=f.startPTS;if(Object(Z.isFiniteNumber)(C)){var v=0,m;f.sn>u.sn?(v=C-u.start,m=u):(v=u.start-C,m=f),m.duration!==v&&(m.duration=v)}else if(f.sn>u.sn){var _=u.cc===f.cc;_&&u.minEndPTS?f.start=u.start+(u.minEndPTS-u.start):f.start=u.start+u.duration}else f.start=Math.max(u.start-f.duration,0)}function D(u,f,C,v,m,_){var x=v-C;x<=0&&(U.logger.warn("Fragment should have a positive duration",f),v=C+f.duration,_=m+f.duration);var d=C,h=v,o=f.startPTS,i=f.endPTS;if(Object(Z.isFiniteNumber)(o)){var g=Math.abs(o-C);Object(Z.isFiniteNumber)(f.deltaPTS)?f.deltaPTS=Math.max(g,f.deltaPTS):f.deltaPTS=g,d=Math.max(C,o),C=Math.min(C,o),m=Math.min(m,f.startDTS),h=Math.min(v,i),v=Math.max(v,i),_=Math.max(_,f.endDTS)}f.duration=v-C;var l=C-f.start;f.appendedPTS=v,f.start=f.startPTS=C,f.maxStartPTS=d,f.startDTS=m,f.endPTS=v,f.minEndPTS=h,f.endDTS=_;var T=f.sn;if(!u||T<u.startSN||T>u.endSN)return 0;var I,F=T-u.startSN,W=u.fragments;for(W[F]=f,I=F;I>0;I--)k(W[I],W[I-1]);for(I=F;I<W.length-1;I++)k(W[I],W[I+1]);return u.fragmentHint&&k(W[W.length-1],u.fragmentHint),u.PTSKnown=u.alignedSliding=!0,l}function E(u,f){for(var C=null,v=u.fragments,m=v.length-1;m>=0;m--){var _=v[m].initSegment;if(_){C=_;break}}u.fragmentHint&&delete u.fragmentHint.endPTS;var x=0,d;if(P(u,f,function(I,F){I.relurl&&(x=I.cc-F.cc),Object(Z.isFiniteNumber)(I.startPTS)&&Object(Z.isFiniteNumber)(I.endPTS)&&(F.start=F.startPTS=I.startPTS,F.startDTS=I.startDTS,F.appendedPTS=I.appendedPTS,F.maxStartPTS=I.maxStartPTS,F.endPTS=I.endPTS,F.endDTS=I.endDTS,F.minEndPTS=I.minEndPTS,F.duration=I.endPTS-I.startPTS,F.duration&&(d=F),f.PTSKnown=f.alignedSliding=!0),F.elementaryStreams=I.elementaryStreams,F.loader=I.loader,F.stats=I.stats,F.urlId=I.urlId,I.initSegment&&(F.initSegment=I.initSegment,C=I.initSegment)}),C){var h=f.fragmentHint?f.fragments.concat(f.fragmentHint):f.fragments;h.forEach(function(I){var F;(!I.initSegment||I.initSegment.relurl===((F=C)===null||F===void 0?void 0:F.relurl))&&(I.initSegment=C)})}if(f.skippedSegments&&(f.deltaUpdateFailed=f.fragments.some(function(I){return!I}),f.deltaUpdateFailed)){U.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var o=f.skippedSegments;o--;)f.fragments.shift();f.startSN=f.fragments[0].sn,f.startCC=f.fragments[0].cc}var i=f.fragments;if(x){U.logger.warn("discontinuity sliding from playlist, take drift into account");for(var g=0;g<i.length;g++)i[g].cc+=x}f.skippedSegments&&(f.startCC=f.fragments[0].cc),A(u.partList,f.partList,function(I,F){F.elementaryStreams=I.elementaryStreams,F.stats=I.stats}),d?D(f,d,d.startPTS,d.endPTS,d.startDTS,d.endDTS):w(u,f),i.length&&(f.totalduration=f.edge-i[0].start),f.driftStartTime=u.driftStartTime,f.driftStart=u.driftStart;var l=f.advancedDateTime;if(f.advanced&&l){var T=f.edge;f.driftStart||(f.driftStartTime=l,f.driftStart=T),f.driftEndTime=l,f.driftEnd=T}else f.driftEndTime=u.driftEndTime,f.driftEnd=u.driftEnd,f.advancedDateTime=u.advancedDateTime}function A(u,f,C){if(u&&f)for(var v=0,m=0,_=u.length;m<=_;m++){var x=u[m],d=f[m+v];x&&d&&x.index===d.index&&x.fragment.sn===d.fragment.sn?C(x,d):v--}}function P(u,f,C){for(var v=f.skippedSegments,m=Math.max(u.startSN,f.startSN)-f.startSN,_=(u.fragmentHint?1:0)+(v?f.endSN:Math.min(u.endSN,f.endSN))-f.startSN,x=f.startSN-u.startSN,d=f.fragmentHint?f.fragments.concat(f.fragmentHint):f.fragments,h=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,o=m;o<=_;o++){var i=h[x+o],g=d[o];v&&!g&&o<v&&(g=f.fragments[o]=i),i&&g&&C(i,g)}}function w(u,f){var C=f.startSN+f.skippedSegments-u.startSN,v=u.fragments;if(C<0||C>=v.length)return;y(f,v[C].start)}function y(u,f){if(f){for(var C=u.fragments,v=u.skippedSegments;v<C.length;v++)C[v].start+=f;u.fragmentHint&&(u.fragmentHint.start+=f)}}function b(u,f){var C=1e3*u.levelTargetDuration,v=C/2,m=u.age,_=m>0&&m<C*3,x=f.loading.end-f.loading.start,d,h=u.availabilityDelay;if(u.updated===!1)if(_){var o=333*u.misses;d=Math.max(Math.min(v,x*2),o),u.availabilityDelay=(u.availabilityDelay||0)+d}else d=v;else _?(h=Math.min(h||C/2,m),u.availabilityDelay=h,d=h+C-m):d=C-x;return Math.round(d)}function c(u,f,C){if(!u||!u.details)return null;var v=u.details,m=v.fragments[f-v.startSN];return m||(m=v.fragmentHint,m&&m.sn===f?m:f<v.startSN&&C&&C.sn===f?C:null)}function s(u,f,C){if(!u||!u.details)return null;var v=u.details.partList;if(v)for(var m=v.length;m--;){var _=v[m];if(_.index===C&&_.fragment.sn===f)return _}return null}},"./src/controller/stream-controller.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"default",function(){return v});var Z=R("./src/polyfills/number.ts"),U=R("./src/controller/base-stream-controller.ts"),O=R("./src/is-supported.ts"),j=R("./src/events.ts"),B=R("./src/utils/buffer-helper.ts"),k=R("./src/controller/fragment-tracker.ts"),D=R("./src/types/loader.ts"),E=R("./src/loader/fragment.ts"),A=R("./src/demux/transmuxer-interface.ts"),P=R("./src/types/transmuxer.ts"),w=R("./src/controller/gap-controller.ts"),y=R("./src/errors.ts"),b=R("./src/utils/logger.ts");function c(m,_){for(var x=0;x<_.length;x++){var d=_[x];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(m,d.key,d)}}function s(m,_,x){return _&&c(m.prototype,_),x&&c(m,x),m}function u(m,_){m.prototype=Object.create(_.prototype),m.prototype.constructor=m,f(m,_)}function f(m,_){return f=Object.setPrototypeOf||function(d,h){return d.__proto__=h,d},f(m,_)}var C=100,v=function(m){u(_,m);function _(d,h){var o;return o=m.call(this,d,h,"[stream-controller]")||this,o.audioCodecSwap=!1,o.gapController=null,o.level=-1,o._forceStartLoad=!1,o.altAudio=!1,o.audioOnly=!1,o.fragPlaying=null,o.onvplaying=null,o.onvseeked=null,o.fragLastKbps=0,o.stalled=!1,o.couldBacktrack=!1,o.audioCodecSwitch=!1,o.videoBuffer=null,o._registerListeners(),o}var x=_.prototype;return x._registerListeners=function(){var h=this.hls;h.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.on(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(j.Events.LEVEL_LOADING,this.onLevelLoading,this),h.on(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(j.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),h.on(j.Events.ERROR,this.onError,this),h.on(j.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.on(j.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),h.on(j.Events.BUFFER_CREATED,this.onBufferCreated,this),h.on(j.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.on(j.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),h.on(j.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x._unregisterListeners=function(){var h=this.hls;h.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(j.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),h.off(j.Events.ERROR,this.onError,this),h.off(j.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.off(j.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),h.off(j.Events.BUFFER_CREATED,this.onBufferCreated,this),h.off(j.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.off(j.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),h.off(j.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},x.startLoad=function(h){if(this.levels){var o=this.lastCurrentTime,i=this.hls;if(this.stopLoad(),this.setInterval(C),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var g=i.startLevel;g===-1&&(i.config.testBandwidth?(g=0,this.bitrateTest=!0):g=i.nextAutoLevel),this.level=i.nextLoadLevel=g,this.loadedmetadata=!1}o>0&&h===-1&&(this.log("Override startPosition with lastCurrentTime @"+o.toFixed(3)),h=o),this.state=U.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=h,this.tick()}else this._forceStartLoad=!0,this.state=U.State.STOPPED},x.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},x.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_LEVEL:{var h,o=this.levels,i=this.level,g=o==null||((h=o[i])===null||h===void 0)?void 0:h.details;if(g&&(!g.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(g))break;this.state=U.State.IDLE;break}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var l,T=self.performance.now(),I=this.retryDate;(!I||T>=I||(l=this.media)!==null&&l!==void 0&&l.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=U.State.IDLE)}break;default:break}this.onTickEnd()},x.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},x.doTickIdle=function(){var h,o,i=this.hls,g=this.levelLastLoaded,l=this.levels,T=this.media,I=i.config,F=i.nextLoadLevel;if(g===null||!T&&(this.startFragRequested||!I.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!l||!l[F])return;var W=l[F];this.level=i.nextLoadLevel=F;var V=W.details;if(!V||this.state===U.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==F){this.state=U.State.WAITING_LEVEL;return}var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:T,D.PlaylistLevelType.MAIN);if(M===null)return;var N=M.len,J=this.getMaxBufferLength(W.maxBitrate);if(N>=J)return;if(this._streamEnded(M,V)){var ae={};this.altAudio&&(ae.type="video"),this.hls.trigger(j.Events.BUFFER_EOS,ae),this.state=U.State.ENDED;return}var ue=M.end,ve=this.getNextFragment(ue,V);if(this.couldBacktrack&&!this.fragPrevious&&ve&&ve.sn!=="initSegment"){var Te=ve.sn-V.startSN;Te>1&&(ve=V.fragments[Te-1],this.fragmentTracker.removeFragment(ve))}if(ve&&this.fragmentTracker.getState(ve)===k.FragmentState.OK&&this.nextLoadPosition>ue){var _e=this.audioOnly&&!this.altAudio?E.ElementaryStreamTypes.AUDIO:E.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(T,_e,D.PlaylistLevelType.MAIN),ve=this.getNextFragment(this.nextLoadPosition,V)}if(!ve)return;ve.initSegment&&!ve.initSegment.data&&!this.bitrateTest&&(ve=ve.initSegment),((h=ve.decryptdata)===null||h===void 0?void 0:h.keyFormat)==="identity"&&!((o=ve.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(ve,V):this.loadFragment(ve,V,ue)},x.loadFragment=function(h,o,i){var g,l=this.fragmentTracker.getState(h);if(this.fragCurrent=h,l===k.FragmentState.BACKTRACKED){var T=this.fragmentTracker.getBacktrackData(h);if(T){this._handleFragmentLoadProgress(T),this._handleFragmentLoadComplete(T);return}else l=k.FragmentState.NOT_LOADED}l===k.FragmentState.NOT_LOADED||l===k.FragmentState.PARTIAL?h.sn==="initSegment"?this._loadInitSegment(h):this.bitrateTest?(h.bitrateTest=!0,this.log("Fragment "+h.sn+" of level "+h.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(h)):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,h,o,i)):l===k.FragmentState.APPENDING?this.reduceMaxBufferLength(h.duration)&&this.fragmentTracker.removeFragment(h):((g=this.media)===null||g===void 0?void 0:g.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},x.getAppendedFrag=function(h){var o=this.fragmentTracker.getAppendedFrag(h,D.PlaylistLevelType.MAIN);return o&&"fragment"in o?o.fragment:o},x.getBufferedFrag=function(h){return this.fragmentTracker.getBufferedFrag(h,D.PlaylistLevelType.MAIN)},x.followingBufferedFrag=function(h){return h?this.getBufferedFrag(h.end+.5):null},x.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},x.nextLevelSwitch=function(){var h=this.levels,o=this.media;if(o!=null&&o.readyState){var i,g=this.getAppendedFrag(o.currentTime);if(g&&g.start>1&&this.flushMainBuffer(0,g.start-1),!o.paused&&h){var l=this.hls.nextLoadLevel,T=h[l],I=this.fragLastKbps;I&&this.fragCurrent?i=this.fragCurrent.duration*T.maxBitrate/(1e3*I)+1:i=0}else i=0;var F=this.getBufferedFrag(o.currentTime+i);if(F){var W=this.followingBufferedFrag(F);if(W){this.abortCurrentFrag();var V=W.maxStartPTS?W.maxStartPTS:W.start,M=W.duration,N=Math.max(F.end,V+Math.min(Math.max(M-this.config.maxFragLookUpTolerance,M*.5),M*.75));this.flushMainBuffer(N,Number.POSITIVE_INFINITY)}}}},x.abortCurrentFrag=function(){var h=this.fragCurrent;this.fragCurrent=null,h!=null&&h.loader&&h.loader.abort(),this.state===U.State.KEY_LOADING&&(this.state=U.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},x.flushMainBuffer=function(h,o){m.prototype.flushMainBuffer.call(this,h,o,this.altAudio?"video":null)},x.onMediaAttached=function(h,o){m.prototype.onMediaAttached.call(this,h,o);var i=o.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),i.addEventListener("playing",this.onvplaying),i.addEventListener("seeked",this.onvseeked),this.gapController=new w.default(this.config,i,this.fragmentTracker,this.hls)},x.onMediaDetaching=function(){var h=this.media;h&&(h.removeEventListener("playing",this.onvplaying),h.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)},x.onMediaPlaying=function(){this.tick()},x.onMediaSeeked=function(){var h=this.media,o=h?h.currentTime:null;Object(Z.isFiniteNumber)(o)&&this.log("Media seeked to "+o.toFixed(3)),this.tick()},x.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(j.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},x.onManifestParsed=function(h,o){var i=!1,g=!1,l;o.levels.forEach(function(T){l=T.audioCodec,l&&(l.indexOf("mp4a.40.2")!==-1&&(i=!0),l.indexOf("mp4a.40.5")!==-1&&(g=!0))}),this.audioCodecSwitch=i&&g&&!Object(O.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=o.levels,this.startFragRequested=!1},x.onLevelLoading=function(h,o){var i=this.levels;if(!i||this.state!==U.State.IDLE)return;var g=i[o.level];(!g.details||g.details.live&&this.levelLastLoaded!==o.level||this.waitForCdnTuneIn(g.details))&&(this.state=U.State.WAITING_LEVEL)},x.onLevelLoaded=function(h,o){var i,g=this.levels,l=o.level,T=o.details,I=T.totalduration;if(!g){this.warn("Levels were reset while loading level "+l);return}this.log("Level "+l+" loaded ["+T.startSN+","+T.endSN+"], cc ["+T.startCC+", "+T.endCC+"] duration:"+I);var F=this.fragCurrent;F&&(this.state===U.State.FRAG_LOADING||this.state===U.State.FRAG_LOADING_WAITING_RETRY)&&(F.level!==o.level&&F.loader&&(this.state=U.State.IDLE,F.loader.abort()));var W=g[l],V=0;if(T.live||(i=W.details)!==null&&i!==void 0&&i.live){if(T.fragments[0]||(T.deltaUpdateFailed=!0),T.deltaUpdateFailed)return;V=this.alignPlaylists(T,W.details)}if(W.details=T,this.levelLastLoaded=l,this.hls.trigger(j.Events.LEVEL_UPDATED,{details:T,level:l}),this.state===U.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(T))return;this.state=U.State.IDLE}this.startFragRequested?T.live&&this.synchronizeToLiveEdge(T):this.setStartPosition(T,V),this.tick()},x._handleFragmentLoadProgress=function(h){var o,i=h.frag,g=h.part,l=h.payload,T=this.levels;if(!T){this.warn("Levels were reset while fragment load was in progress. Fragment "+i.sn+" of level "+i.level+" will not be buffered");return}var I=T[i.level],F=I.details;if(!F){this.warn("Dropping fragment "+i.sn+" of level "+i.level+" after level details were reset");return}var W=I.videoCodec,V=F.PTSKnown||!F.live,M=(o=i.initSegment)===null||o===void 0?void 0:o.data,N=this._getAudioCodec(I),J=this.transmuxer=this.transmuxer||new A.default(this.hls,D.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ae=g?g.index:-1,ue=ae!==-1,ve=new P.ChunkMetadata(i.level,i.sn,i.stats.chunkCount,l.byteLength,ae,ue),Te=this.initPTS[i.cc];J.push(l,M,N,W,i,g,F.totalduration,V,ve,Te)},x.onAudioTrackSwitching=function(h,o){var i=this.altAudio,g=!!o.url,l=o.id;if(!g){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var 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 I=this.hls;i&&I.trigger(j.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),I.trigger(j.Events.AUDIO_TRACK_SWITCHED,{id:l})}},x.onAudioTrackSwitched=function(h,o){var i=o.id,g=!!this.hls.audioTracks[i].url;if(g){var l=this.videoBuffer;l&&this.mediaBuffer!==l&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=l)}this.altAudio=g,this.tick()},x.onBufferCreated=function(h,o){var i=o.tracks,g,l,T=!1;for(var I in i){var F=i[I];if(F.id==="main"){if(l=I,g=F,I==="video"){var W=i[I];W&&(this.videoBuffer=W.buffer)}}else T=!0}T&&g?(this.log("Alternate track found, use "+l+".buffered to schedule main fragment loading"),this.mediaBuffer=g.buffer):this.mediaBuffer=this.media},x.onFragBuffered=function(h,o){var i=o.frag,g=o.part;if(i&&i.type!==D.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(i)){this.warn("Fragment "+i.sn+(g?" p: "+g.index:"")+" of level "+i.level+" finished buffering, but was aborted. state: "+this.state),this.state===U.State.PARSED&&(this.state=U.State.IDLE);return}var l=g?g.stats:i.stats;this.fragLastKbps=Math.round(8*l.total/(l.buffering.end-l.loading.first)),i.sn!=="initSegment"&&(this.fragPrevious=i),this.fragBufferedComplete(i,g)},x.onError=function(h,o){switch(o.details){case y.ErrorDetails.FRAG_LOAD_ERROR:case y.ErrorDetails.FRAG_LOAD_TIMEOUT:case y.ErrorDetails.KEY_LOAD_ERROR:case y.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.MAIN,o);break;case y.ErrorDetails.LEVEL_LOAD_ERROR:case y.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==U.State.ERROR&&(o.fatal?(this.warn(""+o.details),this.state=U.State.ERROR):!o.levelRetry&&this.state===U.State.WAITING_LEVEL&&(this.state=U.State.IDLE));break;case y.ErrorDetails.BUFFER_FULL_ERROR:if(o.parent==="main"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var i=!0,g=this.getFwdBufferInfo(this.media,D.PlaylistLevelType.MAIN);g&&g.len>.5&&(i=!this.reduceMaxBufferLength(g.len)),i&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},x.checkBuffer=function(){var h=this.media,o=this.gapController;if(!h||!o||!h.readyState)return;var i=B.BufferHelper.getBuffered(h);!this.loadedmetadata&&i.length?(this.loadedmetadata=!0,this.seekToStartPos()):o.poll(this.lastCurrentTime),this.lastCurrentTime=h.currentTime},x.onFragLoadEmergencyAborted=function(){this.state=U.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},x.onBufferFlushed=function(h,o){var i=o.type;if(i!==E.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var g=(i===E.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(g,i,D.PlaylistLevelType.MAIN)}},x.onLevelsUpdated=function(h,o){this.levels=o.levels},x.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},x.seekToStartPos=function(){var h=this.media,o=h.currentTime,i=this.startPosition;if(i>=0&&o<i){if(h.seeking){b.logger.log("could not seek to "+i+", already seeking at "+o);return}var g=B.BufferHelper.getBuffered(h),l=g.length?g.start(0):0,T=l-i;T>0&&(T<this.config.maxBufferHole||T<this.config.maxFragLookUpTolerance)&&(b.logger.log("adjusting start position by "+T+" to match buffer start"),i+=T,this.startPosition=i),this.log("seek to target start position "+i+" from current time "+o),h.currentTime=i}},x._getAudioCodec=function(h){var o=this.config.defaultAudioCodec||h.audioCodec;return this.audioCodecSwap&&o&&(this.log("Swapping audio codec"),o.indexOf("mp4a.40.5")!==-1?o="mp4a.40.2":o="mp4a.40.5"),o},x._loadBitrateTestFrag=function(h){var o=this;this._doFragLoad(h).then(function(i){var g=o.hls;if(!i||g.nextLoadLevel||o.fragContextChanged(h))return;o.fragLoadError=0,o.state=U.State.IDLE,o.startFragRequested=!1,o.bitrateTest=!1;var l=h.stats;l.parsing.start=l.parsing.end=l.buffering.start=l.buffering.end=self.performance.now(),g.trigger(j.Events.FRAG_LOADED,i)})},x._handleTransmuxComplete=function(h){var o,i="main",g=this.hls,l=h.remuxResult,T=h.chunkMeta,I=this.getCurrentContext(T);if(!I){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 F=I.frag,W=I.part,V=I.level,M=l.video,N=l.text,J=l.id3,ae=l.initSegment,ue=this.altAudio?void 0:l.audio;if(this.fragContextChanged(F))return;if(this.state=U.State.PARSING,ae){ae.tracks&&(this._bufferInitSegment(V,ae.tracks,F,T),g.trigger(j.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:i,tracks:ae.tracks}));var ve=ae.initPTS,Te=ae.timescale;Object(Z.isFiniteNumber)(ve)&&(this.initPTS[F.cc]=ve,g.trigger(j.Events.INIT_PTS_FOUND,{frag:F,id:i,initPTS:ve,timescale:Te}))}if(M&&l.independent!==!1){if(V.details){var _e=M.startPTS,fe=M.endPTS,ne=M.startDTS,me=M.endDTS;if(W)W.elementaryStreams[M.type]={startPTS:_e,endPTS:fe,startDTS:ne,endDTS:me};else if(M.firstKeyFrame&&M.independent&&(this.couldBacktrack=!0),M.dropped&&M.independent){var ie=this.getLoadPosition()+this.config.maxBufferHole;if(ie<_e){this.backtrack(F);return}F.setElementaryStreamInfo(M.type,F.start,fe,F.start,me,!0)}F.setElementaryStreamInfo(M.type,_e,fe,ne,me),this.bufferFragmentData(M,F,W,T)}}else if(l.independent===!1){this.backtrack(F);return}if(ue){var le=ue.startPTS,q=ue.endPTS,re=ue.startDTS,oe=ue.endDTS;W&&(W.elementaryStreams[E.ElementaryStreamTypes.AUDIO]={startPTS:le,endPTS:q,startDTS:re,endDTS:oe}),F.setElementaryStreamInfo(E.ElementaryStreamTypes.AUDIO,le,q,re,oe),this.bufferFragmentData(ue,F,W,T)}if(J!=null&&(o=J.samples)!==null&&o!==void 0&&o.length){var ge={frag:F,id:i,samples:J.samples};g.trigger(j.Events.FRAG_PARSING_METADATA,ge)}if(N){var Se={frag:F,id:i,samples:N.samples};g.trigger(j.Events.FRAG_PARSING_USERDATA,Se)}},x._bufferInitSegment=function(h,o,i,g){var l=this;if(this.state!==U.State.PARSING)return;this.audioOnly=!!o.audio&&!o.video,this.altAudio&&!this.audioOnly&&delete o.audio;var T=o.audio,I=o.video,F=o.audiovideo;if(T){var W=h.audioCodec,V=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(W&&(W.indexOf("mp4a.40.5")!==-1?W="mp4a.40.2":W="mp4a.40.5"),T.metadata.channelCount!==1&&V.indexOf("firefox")===-1&&(W="mp4a.40.5")),V.indexOf("android")!==-1&&T.container!=="audio/mpeg"&&(W="mp4a.40.2",this.log("Android: force audio codec to "+W)),h.audioCodec&&h.audioCodec!==W&&this.log('Swapping manifest audio codec "'+h.audioCodec+'" for "'+W+'"'),T.levelCodec=W,T.id="main",this.log("Init audio buffer, container:"+T.container+", codecs[selected/level/parsed]=["+(W||"")+"/"+(h.audioCodec||"")+"/"+T.codec+"]")}I&&(I.levelCodec=h.videoCodec,I.id="main",this.log("Init video buffer, container:"+I.container+", codecs[level/parsed]=["+(h.videoCodec||"")+"/"+I.codec+"]")),F&&this.log("Init audiovideo buffer, container:"+F.container+", codecs[level/parsed]=["+(h.attrs.CODECS||"")+"/"+F.codec+"]"),this.hls.trigger(j.Events.BUFFER_CODECS,o),Object.keys(o).forEach(function(M){var N=o[M],J=N.initSegment;J!=null&&J.byteLength&&l.hls.trigger(j.Events.BUFFER_APPENDING,{type:M,data:J,frag:i,part:null,chunkMeta:g,parent:i.type})}),this.tick()},x.backtrack=function(h){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(h);var o=this.fragmentTracker.backtrack(h);this.fragPrevious=null,this.nextLoadPosition=h.start,o?this.resetFragmentLoading(h):this.state=U.State.BACKTRACKING},x.checkFragmentChanged=function(){var h=this.media,o=null;if(h&&h.readyState>1&&h.seeking===!1){var i=h.currentTime;if(B.BufferHelper.isBuffered(h,i)?o=this.getAppendedFrag(i):B.BufferHelper.isBuffered(h,i+.1)&&(o=this.getAppendedFrag(i+.1)),o){var g=this.fragPlaying,l=o.level;(!g||o.sn!==g.sn||g.level!==l||o.urlId!==g.urlId)&&(this.hls.trigger(j.Events.FRAG_CHANGED,{frag:o}),(!g||g.level!==l)&&this.hls.trigger(j.Events.LEVEL_SWITCHED,{level:l}),this.fragPlaying=o)}}},s(_,[{key:"nextLevel",get:function(){var h=this.nextBufferedFrag;return h?h.level:-1}},{key:"currentLevel",get:function(){var h=this.media;if(h){var o=this.getAppendedFrag(h.currentTime);if(o)return o.level}return-1}},{key:"nextBufferedFrag",get:function(){var h=this.media;if(h){var o=this.getAppendedFrag(h.currentTime);return this.followingBufferedFrag(o)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),_}(U.default)},"./src/controller/subtitle-stream-controller.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"SubtitleStreamController",function(){return u});var Z=R("./src/events.ts"),U=R("./src/utils/logger.ts"),O=R("./src/utils/buffer-helper.ts"),j=R("./src/controller/fragment-finders.ts"),B=R("./src/utils/discontinuities.ts"),k=R("./src/controller/level-helper.ts"),D=R("./src/controller/fragment-tracker.ts"),E=R("./src/controller/base-stream-controller.ts"),A=R("./src/types/loader.ts"),P=R("./src/types/level.ts");function w(f,C){for(var v=0;v<C.length;v++){var m=C[v];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(f,m.key,m)}}function y(f,C,v){return C&&w(f.prototype,C),v&&w(f,v),f}function b(f,C){f.prototype=Object.create(C.prototype),f.prototype.constructor=f,c(f,C)}function c(f,C){return c=Object.setPrototypeOf||function(m,_){return m.__proto__=_,m},c(f,C)}var s=500,u=function(f){b(C,f);function C(m,_){var x;return x=f.call(this,m,_,"[subtitle-stream-controller]")||this,x.levels=[],x.currentTrackId=-1,x.tracksBuffered=[],x.mainDetails=null,x._registerListeners(),x}var v=C.prototype;return v.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},v._registerListeners=function(){var _=this.hls;_.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.on(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),_.on(Z.Events.LEVEL_LOADED,this.onLevelLoaded,this),_.on(Z.Events.ERROR,this.onError,this),_.on(Z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),_.on(Z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),_.on(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),_.on(Z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),_.on(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v._unregisterListeners=function(){var _=this.hls;_.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.off(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),_.off(Z.Events.LEVEL_LOADED,this.onLevelLoaded,this),_.off(Z.Events.ERROR,this.onError,this),_.off(Z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),_.off(Z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),_.off(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),_.off(Z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),_.off(Z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v.startLoad=function(){this.stopLoad(),this.state=E.State.IDLE,this.setInterval(s),this.tick()},v.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},v.onLevelLoaded=function(_,x){this.mainDetails=x.details},v.onSubtitleFragProcessed=function(_,x){var d=x.frag,h=x.success;if(this.fragPrevious=d,this.state=E.State.IDLE,!h)return;var o=this.tracksBuffered[this.currentTrackId];if(!o)return;for(var i,g=d.start,l=0;l<o.length;l++)if(g>=o[l].start&&g<=o[l].end){i=o[l];break}var T=d.start+d.duration;i?i.end=T:(i={start:g,end:T},o.push(i)),this.fragmentTracker.fragBuffered(d)},v.onBufferFlushing=function(_,x){var d=x.startOffset,h=x.endOffset;if(d===0&&h!==Number.POSITIVE_INFINITY){var o=this.currentTrackId,i=this.levels;if(!i.length||!i[o]||!i[o].details)return;var g=i[o].details,l=g.targetduration,T=h-l;if(T<=0)return;x.endOffsetSubtitles=Math.max(0,T),this.tracksBuffered.forEach(function(I){for(var F=0;F<I.length;){if(I[F].end<=T){I.shift();continue}else if(I[F].start<T)I[F].start=T;else break;F++}}),this.fragmentTracker.removeFragmentsInRange(d,T,A.PlaylistLevelType.SUBTITLE)}},v.onError=function(_,x){var d,h=x.frag;if(!h||h.type!==A.PlaylistLevelType.SUBTITLE)return;(d=this.fragCurrent)!==null&&d!==void 0&&d.loader&&this.fragCurrent.loader.abort(),this.state=E.State.IDLE},v.onSubtitleTracksUpdated=function(_,x){var d=this,h=x.subtitleTracks;this.tracksBuffered=[],this.levels=h.map(function(o){return new P.Level(o)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(o){d.tracksBuffered[o.id]=[]}),this.mediaBuffer=null},v.onSubtitleTrackSwitch=function(_,x){if(this.currentTrackId=x.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var d=this.levels[this.currentTrackId];d!=null&&d.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,d&&this.setInterval(s)},v.onSubtitleTrackLoaded=function(_,x){var d,h=x.details,o=x.id,i=this.currentTrackId,g=this.levels;if(!g.length)return;var l=g[i];if(o>=g.length||o!==i||!l)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,h.live||(d=l.details)!==null&&d!==void 0&&d.live){var T=this.mainDetails;if(h.deltaUpdateFailed||!T)return;var I=T.fragments[0];if(!l.details)h.hasProgramDateTime&&T.hasProgramDateTime?Object(B.alignMediaPlaylistByPDT)(h,T):I&&Object(k.addSliding)(h,I.start);else{var F=this.alignPlaylists(h,l.details);F===0&&I&&Object(k.addSliding)(h,I.start)}}if(l.details=h,this.levelLastLoaded=o,this.tick(),h.live&&!this.fragCurrent&&this.media&&this.state===E.State.IDLE){var W=Object(j.findFragmentByPTS)(null,h.fragments,this.media.currentTime,0);W||(this.warn("Subtitle playlist not aligned with playback"),l.details=void 0)}},v._handleFragmentLoadComplete=function(_){var x=_.frag,d=_.payload,h=x.decryptdata,o=this.hls;if(this.fragContextChanged(x))return;if(d&&d.byteLength>0&&h&&h.key&&h.iv&&h.method==="AES-128"){var i=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(d),h.key.buffer,h.iv.buffer).then(function(g){var l=performance.now();o.trigger(Z.Events.FRAG_DECRYPTED,{frag:x,payload:g,stats:{tstart:i,tdecrypt:l}})})}},v.doTick=function(){if(!this.media){this.state=E.State.IDLE;return}if(this.state===E.State.IDLE){var _,x=this.currentTrackId,d=this.levels;if(!d.length||!d[x]||!d[x].details)return;var h=d[x].details,o=h.targetduration,i=this.config,g=this.media,l=O.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,g.currentTime-o,i.maxBufferHole),T=l.end,I=l.len,F=this.getMaxBufferLength()+o;if(I>F)return;console.assert(h,"Subtitle track details are defined on idle subtitle stream controller tick");var W=h.fragments,V=W.length,M=h.edge,N,J=this.fragPrevious;if(T<M){var ae=i.maxFragLookUpTolerance;J&&h.hasProgramDateTime&&(N=Object(j.findFragmentByPDT)(W,J.endProgramDateTime,ae)),N||(N=Object(j.findFragmentByPTS)(J,W,T,ae),!N&&J&&J.start<W[0].start&&(N=W[0]))}else N=W[V-1];(_=N)!==null&&_!==void 0&&_.encrypted?(U.logger.log("Loading key for "+N.sn),this.state=E.State.KEY_LOADING,this.hls.trigger(Z.Events.KEY_LOADING,{frag:N})):N&&this.fragmentTracker.getState(N)===D.FragmentState.NOT_LOADED&&this.loadFragment(N,h,T)}},v.loadFragment=function(_,x,d){this.fragCurrent=_,f.prototype.loadFragment.call(this,_,x,d)},y(C,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),C}(E.default)},"./src/controller/subtitle-track-controller.ts":function(ce,X,R){"use strict";R.r(X);var Z=R("./src/events.ts"),U=R("./src/utils/texttrack-utils.ts"),O=R("./src/controller/base-playlist-controller.ts"),j=R("./src/types/loader.ts");function B(w,y){for(var b=0;b<y.length;b++){var c=y[b];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(w,c.key,c)}}function k(w,y,b){return y&&B(w.prototype,y),b&&B(w,b),w}function D(w,y){w.prototype=Object.create(y.prototype),w.prototype.constructor=w,E(w,y)}function E(w,y){return E=Object.setPrototypeOf||function(c,s){return c.__proto__=s,c},E(w,y)}var A=function(w){D(y,w);function y(c){var s;return s=w.call(this,c,"[subtitle-track-controller]")||this,s.media=null,s.tracks=[],s.groupId=null,s.tracksInGroup=[],s.trackId=-1,s.selectDefaultTrack=!0,s.queuedDefaultTrack=-1,s.trackChangeListener=function(){return s.onTextTracksChanged()},s.asyncPollTrackChange=function(){return s.pollTrackChange(0)},s.useTextTrackPolling=!1,s.subtitlePollingInterval=-1,s.subtitleDisplay=!0,s.registerListeners(),s}var b=y.prototype;return b.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,w.prototype.destroy.call(this)},b.registerListeners=function(){var s=this.hls;s.on(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.on(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.on(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),s.on(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.on(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),s.on(Z.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var s=this.hls;s.off(Z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.off(Z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(Z.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(Z.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.off(Z.Events.LEVEL_LOADING,this.onLevelLoading,this),s.off(Z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.off(Z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),s.off(Z.Events.ERROR,this.onError,this)},b.onMediaAttached=function(s,u){if(this.media=u.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},b.pollTrackChange=function(s){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,s)},b.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 s=P(this.media.textTracks);s.forEach(function(u){Object(U.clearCurrentCues)(u)}),this.subtitleTrack=-1,this.media=null},b.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},b.onManifestParsed=function(s,u){this.tracks=u.subtitleTracks},b.onSubtitleTrackLoaded=function(s,u){var f=u.id,C=u.details,v=this.trackId,m=this.tracksInGroup[v];if(!m){this.warn("Invalid subtitle track id "+f);return}var _=m.details;m.details=u.details,this.log("subtitle track "+f+" loaded ["+C.startSN+"-"+C.endSN+"]"),f===this.trackId&&(this.retryCount=0,this.playlistLoaded(f,u,_))},b.onLevelLoading=function(s,u){this.switchLevel(u.level)},b.onLevelSwitching=function(s,u){this.switchLevel(u.level)},b.switchLevel=function(s){var u=this.hls.levels[s];if(!(u!=null&&u.textGroupIds))return;var f=u.textGroupIds[u.urlId];if(this.groupId!==f){var C=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,v=this.tracks.filter(function(x){return!f||x.groupId===f});this.tracksInGroup=v;var m=this.findTrackId(C==null?void 0:C.name)||this.findTrackId();this.groupId=f;var _={subtitleTracks:v};this.log("Updating subtitle tracks, "+v.length+' track(s) found in "'+f+'" group-id'),this.hls.trigger(Z.Events.SUBTITLE_TRACKS_UPDATED,_),m!==-1&&this.setSubtitleTrack(m,C)}},b.findTrackId=function(s){for(var u=this.tracksInGroup,f=0;f<u.length;f++){var C=u[f];if((!this.selectDefaultTrack||C.default)&&(!s||s===C.name))return C.id}return-1},b.onError=function(s,u){if(w.prototype.onError.call(this,s,u),u.fatal||!u.context)return;u.context.type===j.PlaylistContextType.SUBTITLE_TRACK&&u.context.id===this.trackId&&u.context.groupId===this.groupId&&this.retryLoadingOrFail(u)},b.loadPlaylist=function(s){var u=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(u)){var f=u.id,C=u.groupId,v=u.url;if(s)try{v=s.addDirectives(v)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("Loading subtitle playlist for id "+f),this.hls.trigger(Z.Events.SUBTITLE_TRACK_LOADING,{url:v,id:f,groupId:C,deliveryDirectives:s||null})}},b.toggleTrackModes=function(s){var u=this,f=this.media,C=this.subtitleDisplay,v=this.trackId;if(!f)return;var m=P(f.textTracks),_=m.filter(function(h){return h.groupId===u.groupId});if(s===-1)[].slice.call(m).forEach(function(h){h.mode="disabled"});else{var x=_[v];x&&(x.mode="disabled")}var d=_[s];d&&(d.mode=C?"showing":"hidden")},b.setSubtitleTrack=function(s,u){var f,C=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=s;return}if(this.trackId!==s&&this.toggleTrackModes(s),this.trackId===s&&(s===-1||(f=C[s])!==null&&f!==void 0&&f.details)||s<-1||s>=C.length)return;this.clearTimer();var v=C[s];if(this.log("Switching to subtitle track "+s),this.trackId=s,v){var m=v.id,_=v.groupId,x=_===void 0?"":_,d=v.name,h=v.type,o=v.url;this.hls.trigger(Z.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:x,name:d,type:h,url:o});var i=this.switchParams(v.url,u==null?void 0:u.details);this.loadPlaylist(i)}else this.hls.trigger(Z.Events.SUBTITLE_TRACK_SWITCH,{id:s})},b.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var s=-1,u=P(this.media.textTracks),f=0;f<u.length;f++)if(u[f].mode==="hidden")s=f;else if(u[f].mode==="showing"){s=f;break}this.subtitleTrack!==s&&(this.subtitleTrack=s)},k(y,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(s){this.selectDefaultTrack=!1;var u=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(s,u)}}]),y}(O.default);function P(w){for(var y=[],b=0;b<w.length;b++){var c=w[b];c.kind==="subtitles"&&c.label&&y.push(w[b])}return y}X.default=A},"./src/controller/timeline-controller.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"TimelineController",function(){return P});var Z=R("./src/polyfills/number.ts"),U=R("./src/events.ts"),O=R("./src/utils/cea-608-parser.ts"),j=R("./src/utils/output-filter.ts"),B=R("./src/utils/webvtt-parser.ts"),k=R("./src/utils/texttrack-utils.ts"),D=R("./src/utils/imsc1-ttml-parser.ts"),E=R("./src/types/loader.ts"),A=R("./src/utils/logger.ts"),P=function(){function c(u){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=b(),this.captionsProperties=void 0,this.hls=u,this.config=u.config,this.Cues=u.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var f=new j.default(this,"textTrack1"),C=new j.default(this,"textTrack2"),v=new j.default(this,"textTrack3"),m=new j.default(this,"textTrack4");this.cea608Parser1=new O.default(1,f,C),this.cea608Parser2=new O.default(3,v,m)}u.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.on(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.on(U.Events.FRAG_LOADING,this.onFragLoading,this),u.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.on(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.on(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var s=c.prototype;return s.destroy=function(){var f=this.hls;f.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),f.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.off(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),f.off(U.Events.FRAG_LOADING,this.onFragLoading,this),f.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),f.off(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),f.off(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),f.off(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),f.off(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),f.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},s.addCues=function(f,C,v,m,_){for(var x=!1,d=_.length;d--;){var h=_[d],o=y(h[0],h[1],C,v);if(o>=0&&(h[0]=Math.min(h[0],C),h[1]=Math.max(h[1],v),x=!0,o/(v-C)>.5))return}if(x||_.push([C,v]),this.config.renderTextTracksNatively){var i=this.captionsTracks[f];this.Cues.newCue(i,C,v,m)}else{var g=this.Cues.newCue(null,C,v,m);this.hls.trigger(U.Events.CUES_PARSED,{type:"captions",cues:g,track:f})}},s.onInitPtsFound=function(f,C){var v=this,m=C.frag,_=C.id,x=C.initPTS,d=C.timescale,h=this.unparsedVttFrags;_==="main"&&(this.initPTS[m.cc]=x,this.timescale[m.cc]=d),h.length&&(this.unparsedVttFrags=[],h.forEach(function(o){v.onFragLoaded(U.Events.FRAG_LOADED,o)}))},s.getExistingTrack=function(f){var C=this.media;if(C)for(var v=0;v<C.textTracks.length;v++){var m=C.textTracks[v];if(m[f])return m}return null},s.createCaptionsTrack=function(f){this.config.renderTextTracksNatively?this.createNativeTrack(f):this.createNonNativeTrack(f)},s.createNativeTrack=function(f){if(this.captionsTracks[f])return;var C=this.captionsProperties,v=this.captionsTracks,m=this.media,_=C[f],x=_.label,d=_.languageCode,h=this.getExistingTrack(f);if(h)v[f]=h,Object(k.clearCurrentCues)(v[f]),Object(k.sendAddTrackEvent)(v[f],m);else{var o=this.createTextTrack("captions",x,d);o&&(o[f]=!0,v[f]=o)}},s.createNonNativeTrack=function(f){if(this.nonNativeCaptionsTracks[f])return;var C=this.captionsProperties[f];if(!C)return;var v=C.label,m={_id:f,label:v,kind:"captions",default:C.media?!!C.media.default:!1,closedCaptions:C.media};this.nonNativeCaptionsTracks[f]=m,this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[m]})},s.createTextTrack=function(f,C,v){var m=this.media;return m?m.addTextTrack(f,C,v):void 0},s.onMediaAttaching=function(f,C){this.media=C.media,this._cleanTracks()},s.onMediaDetaching=function(){var f=this.captionsTracks;Object.keys(f).forEach(function(C){Object(k.clearCurrentCues)(f[C]),delete f[C]}),this.nonNativeCaptionsTracks={}},s.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=b(),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())},s._cleanTracks=function(){var f=this.media;if(!f)return;var C=f.textTracks;if(C)for(var v=0;v<C.length;v++)Object(k.clearCurrentCues)(C[v])},s.onSubtitleTracksUpdated=function(f,C){var v=this;this.textTracks=[];var m=C.subtitleTracks||[],_=m.some(function(o){return o.textCodec===D.IMSC1_CODEC});if(this.config.enableWebVTT||_&&this.config.enableIMSC1){var x=this.tracks&&m&&this.tracks.length===m.length;if(this.tracks=m||[],this.config.renderTextTracksNatively){var d=this.media?this.media.textTracks:[];this.tracks.forEach(function(o,i){var g;if(i<d.length){for(var l=null,T=0;T<d.length;T++)if(w(d[T],o)){l=d[T];break}l&&(g=l)}g?Object(k.clearCurrentCues)(g):(g=v.createTextTrack("subtitles",o.name,o.lang),g&&(g.mode="disabled")),g&&(g.groupId=o.groupId,v.textTracks.push(g))})}else if(!x&&this.tracks&&this.tracks.length){var h=this.tracks.map(function(o){return{label:o.name,kind:o.type.toLowerCase(),default:o.default,subtitleTrack:o}});this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:h})}}},s.onManifestLoaded=function(f,C){var v=this;this.config.enableCEA708Captions&&C.captions&&C.captions.forEach(function(m){var _=/(?:CC|SERVICE)([1-4])/.exec(m.instreamId);if(!_)return;var x="textTrack"+_[1],d=v.captionsProperties[x];if(!d)return;d.label=m.name,m.lang&&(d.languageCode=m.lang),d.media=m})},s.onFragLoading=function(f,C){var v=this.cea608Parser1,m=this.cea608Parser2,_=this.lastSn,x=this.lastPartIndex;if(!this.enabled||!(v&&m))return;if(C.frag.type===E.PlaylistLevelType.MAIN){var d,h,o=C.frag.sn,i=(d=C==null||((h=C.part)===null||h===void 0)?void 0:h.index)!=null?d:-1;o===_+1||o===_&&i===x+1||(v.reset(),m.reset()),this.lastSn=o,this.lastPartIndex=i}},s.onFragLoaded=function(f,C){var v=C.frag,m=C.payload,_=this.initPTS,x=this.unparsedVttFrags;if(v.type===E.PlaylistLevelType.SUBTITLE)if(m.byteLength){if(!Object(Z.isFiniteNumber)(_[v.cc])){x.push(C),_.length&&this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Missing initial subtitle PTS")});return}var d=v.decryptdata;if(d==null||d.key==null||d.method!=="AES-128"){var h=this.tracks[v.level],o=this.vttCCs;o[v.cc]||(o[v.cc]={start:v.start,prevCC:this.prevCC,new:!0},this.prevCC=v.cc),h&&h.textCodec===D.IMSC1_CODEC?this._parseIMSC1(v,m):this._parseVTTs(v,m,o)}}else this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Empty subtitle payload")})},s._parseIMSC1=function(f,C){var v=this,m=this.hls;Object(D.parseIMSC1)(C,this.initPTS[f.cc],this.timescale[f.cc],function(_){v._appendCues(_,f.level),m.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:f})},function(_){A.logger.log("Failed to parse IMSC1: "+_),m.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:_})})},s._parseVTTs=function(f,C,v){var m=this,_=this.hls;Object(B.parseWebVTT)(C,this.initPTS[f.cc],this.timescale[f.cc],v,f.cc,f.start,function(x){m._appendCues(x,f.level),_.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:f})},function(x){m._fallbackToIMSC1(f,C),A.logger.log("Failed to parse VTT cue: "+x),_.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:x})})},s._fallbackToIMSC1=function(f,C){var v=this,m=this.tracks[f.level];m.textCodec||Object(D.parseIMSC1)(C,this.initPTS[f.cc],this.timescale[f.cc],function(){m.textCodec=D.IMSC1_CODEC,v._parseIMSC1(f,C)},function(){m.textCodec="wvtt"})},s._appendCues=function(f,C){var v=this.hls;if(this.config.renderTextTracksNatively){var m=this.textTracks[C];if(m.mode==="disabled")return;f.forEach(function(d){return Object(k.addCueToTrack)(m,d)})}else{var _=this.tracks[C],x=_.default?"default":"subtitles"+C;v.trigger(U.Events.CUES_PARSED,{type:"subtitles",cues:f,track:x})}},s.onFragDecrypted=function(f,C){var v=C.frag;if(v.type===E.PlaylistLevelType.SUBTITLE){if(!Object(Z.isFiniteNumber)(this.initPTS[v.cc])){this.unparsedVttFrags.push(C);return}this.onFragLoaded(U.Events.FRAG_LOADED,C)}},s.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},s.onFragParsingUserdata=function(f,C){var v=this.cea608Parser1,m=this.cea608Parser2;if(!this.enabled||!(v&&m))return;for(var _=0;_<C.samples.length;_++){var x=C.samples[_].bytes;if(x){var d=this.extractCea608Data(x);v.addData(C.samples[_].pts,d[0]),m.addData(C.samples[_].pts,d[1])}}},s.onBufferFlushing=function(f,C){var v=C.startOffset,m=C.endOffset,_=C.endOffsetSubtitles,x=C.type,d=this.media;if(!d||d.currentTime<m)return;if(!x||x==="video"){var h=this.captionsTracks;Object.keys(h).forEach(function(i){return Object(k.removeCuesInRange)(h[i],v,m)})}if(this.config.renderTextTracksNatively&&(v===0&&_!==void 0)){var o=this.textTracks;Object.keys(o).forEach(function(i){return Object(k.removeCuesInRange)(o[i],v,_)})}},s.extractCea608Data=function(f){for(var C=f[0]&31,v=2,m=[[],[]],_=0;_<C;_++){var x=f[v++],d=127&f[v++],h=127&f[v++],o=(4&x)!==0,i=3&x;if(d===0&&h===0)continue;o&&((i===0||i===1)&&(m[i].push(d),m[i].push(h)))}return m},c}();function w(c,s){return c&&c.label===s.name&&!(c.textTrack1||c.textTrack2)}function y(c,s,u,f){return Math.min(s,f)-Math.max(c,u)}function b(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"default",function(){return Z});var Z=function(){function U(j,B){this.subtle=void 0,this.aesIV=void 0,this.subtle=j,this.aesIV=B}var O=U.prototype;return O.decrypt=function(B,k){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},k,B)},U}()},"./src/crypt/aes-decryptor.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"removePadding",function(){return U}),R.d(X,"default",function(){return O});var Z=R("./src/utils/typed-array.ts");function U(j){var B=j.byteLength,k=B&&new DataView(j.buffer).getUint8(B-1);return k?Object(Z.sliceUint8)(j,0,B-k):j}var O=function(){function j(){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=j.prototype;return B.uint8ArrayToUint32Array_=function(D){for(var E=new DataView(D),A=new Uint32Array(4),P=0;P<4;P++)A[P]=E.getUint32(P*4);return A},B.initTable=function(){var D=this.sBox,E=this.invSBox,A=this.subMix,P=A[0],w=A[1],y=A[2],b=A[3],c=this.invSubMix,s=c[0],u=c[1],f=c[2],C=c[3],v=new Uint32Array(256),m=0,_=0,x=0;for(x=0;x<256;x++)x<128?v[x]=x<<1:v[x]=x<<1^283;for(x=0;x<256;x++){var d=_^_<<1^_<<2^_<<3^_<<4;d=d>>>8^d&255^99,D[m]=d,E[d]=m;var h=v[m],o=v[h],i=v[o],g=v[d]*257^d*16843008;P[m]=g<<24|g>>>8,w[m]=g<<16|g>>>16,y[m]=g<<8|g>>>24,b[m]=g,g=i*16843009^o*65537^h*257^m*16843008,s[d]=g<<24|g>>>8,u[d]=g<<16|g>>>16,f[d]=g<<8|g>>>24,C[d]=g,m?(m=h^v[v[v[i^h]]],_^=v[v[_]]):m=_=1}},B.expandKey=function(D){for(var E=this.uint8ArrayToUint32Array_(D),A=!0,P=0;P<E.length&&A;)A=E[P]===this.key[P],P++;if(A)return;this.key=E;var w=this.keySize=E.length;if(w!==4&&w!==6&&w!==8)throw new Error("Invalid aes key size="+w);var y=this.ksRows=(w+6+1)*4,b,c,s=this.keySchedule=new Uint32Array(y),u=this.invKeySchedule=new Uint32Array(y),f=this.sBox,C=this.rcon,v=this.invSubMix,m=v[0],_=v[1],x=v[2],d=v[3],h,o;for(b=0;b<y;b++){if(b<w){h=s[b]=E[b];continue}o=h,b%w===0?(o=o<<8|o>>>24,o=f[o>>>24]<<24|f[o>>>16&255]<<16|f[o>>>8&255]<<8|f[o&255],o^=C[b/w|0]<<24):w>6&&b%w===4&&(o=f[o>>>24]<<24|f[o>>>16&255]<<16|f[o>>>8&255]<<8|f[o&255]),s[b]=h=(s[b-w]^o)>>>0}for(c=0;c<y;c++)b=y-c,c&3?o=s[b]:o=s[b-4],c<4||b<=4?u[c]=o:u[c]=m[f[o>>>24]]^_[f[o>>>16&255]]^x[f[o>>>8&255]]^d[f[o&255]],u[c]=u[c]>>>0},B.networkToHostOrderSwap=function(D){return D<<24|(D&65280)<<8|(D&16711680)>>8|D>>>24},B.decrypt=function(D,E,A){for(var P=this.keySize+6,w=this.invKeySchedule,y=this.invSBox,b=this.invSubMix,c=b[0],s=b[1],u=b[2],f=b[3],C=this.uint8ArrayToUint32Array_(A),v=C[0],m=C[1],_=C[2],x=C[3],d=new Int32Array(D),h=new Int32Array(d.length),o,i,g,l,T,I,F,W,V,M,N,J,ae,ue,ve=this.networkToHostOrderSwap;E<d.length;){for(V=ve(d[E]),M=ve(d[E+1]),N=ve(d[E+2]),J=ve(d[E+3]),T=V^w[0],I=J^w[1],F=N^w[2],W=M^w[3],ae=4,ue=1;ue<P;ue++)o=c[T>>>24]^s[I>>16&255]^u[F>>8&255]^f[W&255]^w[ae],i=c[I>>>24]^s[F>>16&255]^u[W>>8&255]^f[T&255]^w[ae+1],g=c[F>>>24]^s[W>>16&255]^u[T>>8&255]^f[I&255]^w[ae+2],l=c[W>>>24]^s[T>>16&255]^u[I>>8&255]^f[F&255]^w[ae+3],T=o,I=i,F=g,W=l,ae=ae+4;o=y[T>>>24]<<24^y[I>>16&255]<<16^y[F>>8&255]<<8^y[W&255]^w[ae],i=y[I>>>24]<<24^y[F>>16&255]<<16^y[W>>8&255]<<8^y[T&255]^w[ae+1],g=y[F>>>24]<<24^y[W>>16&255]<<16^y[T>>8&255]<<8^y[I&255]^w[ae+2],l=y[W>>>24]<<24^y[T>>16&255]<<16^y[I>>8&255]<<8^y[F&255]^w[ae+3],h[E]=ve(o^v),h[E+1]=ve(l^m),h[E+2]=ve(g^_),h[E+3]=ve(i^x),v=V,m=M,_=N,x=J,E=E+4}return h.buffer},j}()},"./src/crypt/decrypter.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"default",function(){return E});var Z=R("./src/crypt/aes-crypto.ts"),U=R("./src/crypt/fast-aes-key.ts"),O=R("./src/crypt/aes-decryptor.ts"),j=R("./src/utils/logger.ts"),B=R("./src/utils/mp4-tools.ts"),k=R("./src/utils/typed-array.ts"),D=16,E=function(){function A(w,y,b){var c=b===void 0?{}:b,s=c.removePKCS7Padding,u=s===void 0?!0:s;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=w,this.config=y,this.removePKCS7Padding=u,u)try{var f=self.crypto;f&&(this.subtle=f.subtle||f.webkitSubtle)}catch(C){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var P=A.prototype;return P.destroy=function(){this.observer=null},P.isSync=function(){return this.config.enableSoftwareAES},P.flush=function(){var y=this.currentResult;if(!y){this.reset();return}var b=new Uint8Array(y);return this.reset(),this.removePKCS7Padding?Object(O.removePadding)(b):b},P.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},P.decrypt=function(y,b,c,s){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(y),b,c);var u=this.flush();u&&s(u.buffer)}else this.webCryptoDecrypt(new Uint8Array(y),b,c).then(s)},P.softwareDecrypt=function(y,b,c){var s=this.currentIV,u=this.currentResult,f=this.remainderData;this.logOnce("JS AES decrypt"),f&&(y=Object(B.appendUint8Array)(f,y),this.remainderData=null);var C=this.getValidChunk(y);if(!C.length)return null;s&&(c=s);var v=this.softwareDecrypter;v||(v=this.softwareDecrypter=new O.default),v.expandKey(b);var m=u;return this.currentResult=v.decrypt(C.buffer,0,c),this.currentIV=Object(k.sliceUint8)(C,-16).buffer,m||null},P.webCryptoDecrypt=function(y,b,c){var s=this,u=this.subtle;return(this.key!==b||!this.fastAesKey)&&(this.key=b,this.fastAesKey=new U.default(u,b)),this.fastAesKey.expandKey().then(function(f){if(!u)return Promise.reject(new Error("web crypto not initialized"));var C=new Z.default(u,c);return C.decrypt(y.buffer,f)}).catch(function(f){return s.onWebCryptoError(f,y,b,c)})},P.onWebCryptoError=function(y,b,c,s){return j.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",y),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(b,c,s)},P.getValidChunk=function(y){var b=y,c=y.length-y.length%D;return c!==y.length&&(b=Object(k.sliceUint8)(y,0,c),this.remainderData=Object(k.sliceUint8)(y,c)),b},P.logOnce=function(y){if(!this.logEnabled)return;j.logger.log("[decrypter.ts]: "+y),this.logEnabled=!1},A}()},"./src/crypt/fast-aes-key.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"default",function(){return Z});var Z=function(){function U(j,B){this.subtle=void 0,this.key=void 0,this.subtle=j,this.key=B}var O=U.prototype;return O.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},U}()},"./src/demux/aacdemuxer.ts":function(ce,X,R){"use strict";R.r(X);var Z=R("./src/demux/base-audio-demuxer.ts"),U=R("./src/demux/adts.ts"),O=R("./src/utils/logger.ts"),j=R("./src/demux/id3.ts");function B(E,A){E.prototype=Object.create(A.prototype),E.prototype.constructor=E,k(E,A)}function k(E,A){return k=Object.setPrototypeOf||function(w,y){return w.__proto__=y,w},k(E,A)}var D=function(E){B(A,E);function A(w,y){var b;return b=E.call(this)||this,b.observer=void 0,b.config=void 0,b.observer=w,b.config=y,b}var P=A.prototype;return P.resetInitSegment=function(y,b,c){E.prototype.resetInitSegment.call(this,y,b,c),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:y,duration:c,inputTimeScale:9e4,dropped:0}},A.probe=function(y){if(!y)return!1;for(var b=j.getID3Data(y,0)||[],c=b.length,s=y.length;c<s;c++)if(U.probe(y,c))return O.logger.log("ADTS sync word found !"),!0;return!1},P.canParse=function(y,b){return U.canParse(y,b)},P.appendFrame=function(y,b,c){U.initTrackConfig(y,this.observer,b,c,y.manifestCodec);var s=U.appendFrame(y,b,c,this.initPTS,this.frameIndex);if(s&&s.missing===0)return s},A}(Z.default);D.minProbeByteLength=9,X.default=D},"./src/demux/adts.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"getAudioConfig",function(){return j}),R.d(X,"isHeaderPattern",function(){return B}),R.d(X,"getHeaderLength",function(){return k}),R.d(X,"getFullFrameLength",function(){return D}),R.d(X,"canGetFrameLength",function(){return E}),R.d(X,"isHeader",function(){return A}),R.d(X,"canParse",function(){return P}),R.d(X,"probe",function(){return w}),R.d(X,"initTrackConfig",function(){return y}),R.d(X,"getFrameDuration",function(){return b}),R.d(X,"parseFrameHeader",function(){return c}),R.d(X,"appendFrame",function(){return s});var Z=R("./src/utils/logger.ts"),U=R("./src/errors.ts"),O=R("./src/events.ts");function j(u,f,C,v){var m,_,x,d,h=navigator.userAgent.toLowerCase(),o=v,i=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];m=((f[C+2]&192)>>>6)+1;var g=(f[C+2]&60)>>>2;if(g>i.length-1){u.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+g});return}return x=(f[C+2]&1)<<2,x|=(f[C+3]&192)>>>6,Z.logger.log("manifest codec:"+v+", ADTS type:"+m+", samplingIndex:"+g),/firefox/i.test(h)?g>=6?(m=5,d=new Array(4),_=g-3):(m=2,d=new Array(2),_=g):h.indexOf("android")!==-1?(m=2,d=new Array(2),_=g):(m=5,d=new Array(4),v&&(v.indexOf("mp4a.40.29")!==-1||v.indexOf("mp4a.40.5")!==-1)||!v&&g>=6?_=g-3:((v&&v.indexOf("mp4a.40.2")!==-1&&(g>=6&&x===1||/vivaldi/i.test(h))||!v&&x===1)&&(m=2,d=new Array(2)),_=g)),d[0]=m<<3,d[0]|=(g&14)>>1,d[1]|=(g&1)<<7,d[1]|=x<<3,m===5&&(d[1]|=(_&14)>>1,d[2]=(_&1)<<7,d[2]|=2<<2,d[3]=0),{config:d,samplerate:i[g],channelCount:x,codec:"mp4a.40."+m,manifestCodec:o}}function B(u,f){return u[f]===255&&(u[f+1]&246)===240}function k(u,f){return u[f+1]&1?7:9}function D(u,f){return(u[f+3]&3)<<11|u[f+4]<<3|(u[f+5]&224)>>>5}function E(u,f){return f+5<u.length}function A(u,f){return f+1<u.length&&B(u,f)}function P(u,f){return E(u,f)&&B(u,f)&&D(u,f)<=u.length-f}function w(u,f){if(A(u,f)){var C=k(u,f);if(f+C>=u.length)return!1;var v=D(u,f);if(v<=C)return!1;var m=f+v;return m===u.length||A(u,m)}return!1}function y(u,f,C,v,m){if(!u.samplerate){var _=j(f,C,v,m);if(!_)return;u.config=_.config,u.samplerate=_.samplerate,u.channelCount=_.channelCount,u.codec=_.codec,u.manifestCodec=_.manifestCodec,Z.logger.log("parsed codec:"+u.codec+", rate:"+_.samplerate+", channels:"+_.channelCount)}}function b(u){return 1024*9e4/u}function c(u,f,C,v,m){var _=k(u,f),x=D(u,f);if(x-=_,x>0){var d=C+v*m;return{headerLength:_,frameLength:x,stamp:d}}}function s(u,f,C,v,m){var _=b(u.samplerate),x=c(f,C,v,m,_);if(x){var d=x.frameLength,h=x.headerLength,o=x.stamp,i=h+d,g=Math.max(0,C+i-f.length),l;g?(l=new Uint8Array(i-h),l.set(f.subarray(C+h,f.length),0)):l=f.subarray(C+h,C+i);var T={unit:l,pts:o};return g||u.samples.push(T),{sample:T,length:i,missing:g}}}},"./src/demux/base-audio-demuxer.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"initPTSFn",function(){return D});var Z=R("./src/polyfills/number.ts"),U=R("./src/demux/id3.ts"),O=R("./src/demux/dummy-demuxed-track.ts"),j=R("./src/utils/mp4-tools.ts"),B=R("./src/utils/typed-array.ts"),k=function(){function E(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var A=E.prototype;return A.resetInitSegment=function(w,y,b){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},A.resetTimeStamp=function(){},A.resetContiguity=function(){},A.canParse=function(w,y){return!1},A.appendFrame=function(w,y,b){},A.demux=function(w,y){this.cachedData&&(w=Object(j.appendUint8Array)(this.cachedData,w),this.cachedData=null);var b=U.getID3Data(w,0),c=b?b.length:0,s,u,f=this._audioTrack,C=this._id3Track,v=b?U.getTimeStamp(b):void 0,m=w.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=D(v,y)),b&&b.length>0&&C.samples.push({pts:this.initPTS,dts:this.initPTS,data:b}),u=this.initPTS;c<m;){if(this.canParse(w,c)){var _=this.appendFrame(f,w,c);_?(this.frameIndex++,u=_.sample.pts,c+=_.length,s=c):c=m}else U.canParse(w,c)?(b=U.getID3Data(w,c),C.samples.push({pts:u,dts:u,data:b}),c+=b.length,s=c):c++;if(c===m&&s!==m){var x=Object(B.sliceUint8)(w,s);this.cachedData?this.cachedData=Object(j.appendUint8Array)(this.cachedData,x):this.cachedData=x}}return{audioTrack:f,avcTrack:Object(O.dummyTrack)(),id3Track:C,textTrack:Object(O.dummyTrack)()}},A.demuxSampleAes=function(w,y,b){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},A.flush=function(w){var y=this.cachedData;return y&&(this.cachedData=null,this.demux(y,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(O.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(O.dummyTrack)()}},A.destroy=function(){},E}(),D=function(A,P){return Object(Z.isFiniteNumber)(A)?A*90:P*9e4};X.default=k},"./src/demux/chunk-cache.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"default",function(){return Z});var Z=function(){function O(){this.chunks=[],this.dataLength=0}var j=O.prototype;return j.push=function(k){this.chunks.push(k),this.dataLength+=k.length},j.flush=function(){var k=this.chunks,D=this.dataLength,E;if(k.length)k.length===1?E=k[0]:E=U(k,D);else return new Uint8Array(0);return this.reset(),E},j.reset=function(){this.chunks.length=0,this.dataLength=0},O}();function U(O,j){for(var B=new Uint8Array(j),k=0,D=0;D<O.length;D++){var E=O[D];B.set(E,k),k+=E.length}return B}},"./src/demux/dummy-demuxed-track.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"dummyTrack",function(){return Z});function Z(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ce,X,R){"use strict";R.r(X);var Z=R("./src/utils/logger.ts"),U=function(){function O(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 j=O.prototype;return j.loadWord=function(){var k=this.data,D=this.bytesAvailable,E=k.byteLength-D,A=new Uint8Array(4),P=Math.min(4,D);if(P===0)throw new Error("no bytes available");A.set(k.subarray(E,E+P)),this.word=new DataView(A.buffer).getUint32(0),this.bitsAvailable=P*8,this.bytesAvailable-=P},j.skipBits=function(k){var D;this.bitsAvailable>k?(this.word<<=k,this.bitsAvailable-=k):(k-=this.bitsAvailable,D=k>>3,k-=D>>3,this.bytesAvailable-=D,this.loadWord(),this.word<<=k,this.bitsAvailable-=k)},j.readBits=function(k){var D=Math.min(this.bitsAvailable,k),E=this.word>>>32-D;return k>32&&Z.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=D,this.bitsAvailable>0?this.word<<=D:this.bytesAvailable>0&&this.loadWord(),D=k-D,D>0&&this.bitsAvailable?E<<D|this.readBits(D):E},j.skipLZ=function(){var k;for(k=0;k<this.bitsAvailable;++k)if((this.word&2147483648>>>k)!==0)return this.word<<=k,this.bitsAvailable-=k,k;return this.loadWord(),k+this.skipLZ()},j.skipUEG=function(){this.skipBits(1+this.skipLZ())},j.skipEG=function(){this.skipBits(1+this.skipLZ())},j.readUEG=function(){var k=this.skipLZ();return this.readBits(k+1)-1},j.readEG=function(){var k=this.readUEG();return 1&k?1+k>>>1:-1*(k>>>1)},j.readBoolean=function(){return this.readBits(1)===1},j.readUByte=function(){return this.readBits(8)},j.readUShort=function(){return this.readBits(16)},j.readUInt=function(){return this.readBits(32)},j.skipScalingList=function(k){for(var D=8,E=8,A,P=0;P<k;P++)E!==0&&(A=this.readEG(),E=(D+A+256)%256),D=E===0?D:E},j.readSPS=function(){var k=0,D=0,E=0,A=0,P,w,y,b=this.readUByte.bind(this),c=this.readBits.bind(this),s=this.readUEG.bind(this),u=this.readBoolean.bind(this),f=this.skipBits.bind(this),C=this.skipEG.bind(this),v=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);b();var _=b();if(c(5),f(3),b(),v(),_===100||_===110||_===122||_===244||_===44||_===83||_===86||_===118||_===128){var x=s();if(x===3&&f(1),v(),v(),f(1),u())for(w=x!==3?8:12,y=0;y<w;y++)u()&&(y<6?m(16):m(64))}v();var d=s();if(d===0)s();else if(d===1)for(f(1),C(),C(),P=s(),y=0;y<P;y++)C();v(),f(1);var h=s(),o=s(),i=c(1);i===0&&f(1),f(1),u()&&(k=s(),D=s(),E=s(),A=s());var g=[1,1];if(u()&&u()){var l=b();switch(l){case 1:g=[1,1];break;case 2:g=[12,11];break;case 3:g=[10,11];break;case 4:g=[16,11];break;case 5:g=[40,33];break;case 6:g=[24,11];break;case 7:g=[20,11];break;case 8:g=[32,11];break;case 9:g=[80,33];break;case 10:g=[18,11];break;case 11:g=[15,11];break;case 12:g=[64,33];break;case 13:g=[160,99];break;case 14:g=[4,3];break;case 15:g=[3,2];break;case 16:g=[2,1];break;case 255:{g=[b()<<8|b(),b()<<8|b()];break}}}return{width:Math.ceil((h+1)*16-k*2-D*2),height:(2-i)*(o+1)*16-(i?2:4)*(E+A),pixelRatio:g}},j.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},O}();X.default=U},"./src/demux/id3.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"isHeader",function(){return Z}),R.d(X,"isFooter",function(){return U}),R.d(X,"getID3Data",function(){return O}),R.d(X,"canParse",function(){return B}),R.d(X,"getTimeStamp",function(){return k}),R.d(X,"isTimeStampFrame",function(){return D}),R.d(X,"getID3Frames",function(){return A}),R.d(X,"decodeFrame",function(){return P}),R.d(X,"utf8ArrayToStr",function(){return s}),R.d(X,"testables",function(){return u});var Z=function(m,_){return _+10<=m.length&&(m[_]===73&&m[_+1]===68&&m[_+2]===51&&(m[_+3]<255&&m[_+4]<255&&(m[_+6]<128&&m[_+7]<128&&m[_+8]<128&&m[_+9]<128)))},U=function(m,_){return _+10<=m.length&&(m[_]===51&&m[_+1]===68&&m[_+2]===73&&(m[_+3]<255&&m[_+4]<255&&(m[_+6]<128&&m[_+7]<128&&m[_+8]<128&&m[_+9]<128)))},O=function(m,_){for(var x=_,d=0;Z(m,_);){d+=10;var h=j(m,_+6);d+=h,U(m,_+10)&&(d+=10),_+=d}return d>0?m.subarray(x,x+d):void 0},j=function(m,_){var x=0;return x=(m[_]&127)<<21,x|=(m[_+1]&127)<<14,x|=(m[_+2]&127)<<7,x|=m[_+3]&127,x},B=function(m,_){return Z(m,_)&&j(m,_+6)+10<=m.length-_},k=function(m){for(var _=A(m),x=0;x<_.length;x++){var d=_[x];if(D(d))return c(d)}return},D=function(m){return m&&m.key==="PRIV"&&m.info==="com.apple.streaming.transportStreamTimestamp"},E=function(m){var _=String.fromCharCode(m[0],m[1],m[2],m[3]),x=j(m,4),d=10;return{type:_,size:x,data:m.subarray(d,d+x)}},A=function(m){for(var _=0,x=[];Z(m,_);){var d=j(m,_+6);_+=10;for(var h=_+d;_+8<h;){var o=E(m.subarray(_)),i=P(o);i&&x.push(i),_+=o.size+10}U(m,_)&&(_+=10)}return x},P=function(m){return m.type==="PRIV"?w(m):m.type[0]==="W"?b(m):y(m)},w=function(m){if(m.size<2)return;var _=s(m.data,!0),x=new Uint8Array(m.data.subarray(_.length+1));return{key:m.type,info:_,data:x.buffer}},y=function(m){if(m.size<2)return;if(m.type==="TXXX"){var _=1,x=s(m.data.subarray(_),!0);_+=x.length+1;var d=s(m.data.subarray(_));return{key:m.type,info:x,data:d}}var h=s(m.data.subarray(1));return{key:m.type,data:h}},b=function(m){if(m.type==="WXXX"){if(m.size<2)return;var _=1,x=s(m.data.subarray(_),!0);_+=x.length+1;var d=s(m.data.subarray(_));return{key:m.type,info:x,data:d}}var h=s(m.data);return{key:m.type,data:h}},c=function(m){if(m.data.byteLength===8){var _=new Uint8Array(m.data),x=_[3]&1,d=(_[4]<<23)+(_[5]<<15)+(_[6]<<7)+_[7];return d/=45,x&&(d+=4772185884e-2),Math.round(d)}return},s=function(m,_){_===void 0&&(_=!1);var x=C();if(x){var d=x.decode(m);if(_){var h=d.indexOf("\0");return h!==-1?d.substring(0,h):d}return d.replace(/\0/g,"")}for(var o=m.length,i,g,l,T="",I=0;I<o;){if(i=m[I++],i===0&&_)return T;if(i===0||i===3)continue;switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:T+=String.fromCharCode(i);break;case 12:case 13:g=m[I++],T+=String.fromCharCode((i&31)<<6|g&63);break;case 14:g=m[I++],l=m[I++],T+=String.fromCharCode((i&15)<<12|(g&63)<<6|(l&63)<<0);break;default:}}return T},u={decodeTextFrame:y},f;function C(){return!f&&typeof self.TextDecoder!="undefined"&&(f=new self.TextDecoder("utf-8")),f}},"./src/demux/mp3demuxer.ts":function(ce,X,R){"use strict";R.r(X);var Z=R("./src/demux/base-audio-demuxer.ts"),U=R("./src/demux/id3.ts"),O=R("./src/utils/logger.ts"),j=R("./src/demux/mpegaudio.ts");function B(E,A){E.prototype=Object.create(A.prototype),E.prototype.constructor=E,k(E,A)}function k(E,A){return k=Object.setPrototypeOf||function(w,y){return w.__proto__=y,w},k(E,A)}var D=function(E){B(A,E);function A(){return E.apply(this,arguments)||this}var P=A.prototype;return P.resetInitSegment=function(y,b,c){E.prototype.resetInitSegment.call(this,y,b,c),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:y,duration:c,inputTimeScale:9e4,dropped:0}},A.probe=function(y){if(!y)return!1;for(var b=U.getID3Data(y,0)||[],c=b.length,s=y.length;c<s;c++)if(j.probe(y,c))return O.logger.log("MPEG Audio sync word found !"),!0;return!1},P.canParse=function(y,b){return j.canParse(y,b)},P.appendFrame=function(y,b,c){return this.initPTS===null?void 0:j.appendFrame(y,b,c,this.initPTS,this.frameIndex)},A}(Z.default);D.minProbeByteLength=4,X.default=D},"./src/demux/mp4demuxer.ts":function(ce,X,R){"use strict";R.r(X);var Z=R("./src/utils/mp4-tools.ts"),U=R("./src/demux/dummy-demuxed-track.ts"),O=function(){function j(k,D){this.remainderData=null,this.config=void 0,this.config=D}var B=j.prototype;return B.resetTimeStamp=function(){},B.resetInitSegment=function(){},B.resetContiguity=function(){},j.probe=function(D){return Object(Z.findBox)({data:D,start:0,end:Math.min(D.length,16384)},["moof"]).length>0},B.demux=function(D){var E=D,A=Object(U.dummyTrack)();if(this.config.progressive){this.remainderData&&(E=Object(Z.appendUint8Array)(this.remainderData,D));var P=Object(Z.segmentValidRange)(E);this.remainderData=P.remainder,A.samples=P.valid||new Uint8Array}else A.samples=E;return{audioTrack:Object(U.dummyTrack)(),avcTrack:A,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},B.flush=function(){var D=Object(U.dummyTrack)();return D.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(U.dummyTrack)(),avcTrack:D,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},B.demuxSampleAes=function(D,E,A){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},B.destroy=function(){},j}();O.minProbeByteLength=1024,X.default=O},"./src/demux/mpegaudio.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"appendFrame",function(){return k}),R.d(X,"parseHeader",function(){return D}),R.d(X,"isHeaderPattern",function(){return E}),R.d(X,"isHeader",function(){return A}),R.d(X,"canParse",function(){return P}),R.d(X,"probe",function(){return w});var Z=null,U=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],O=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],j=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],B=[0,1,1,4];function k(y,b,c,s,u){if(c+24>b.length)return;var f=D(b,c);if(f&&c+f.frameLength<=b.length){var C=f.samplesPerFrame*9e4/f.sampleRate,v=s+u*C,m={unit:b.subarray(c,c+f.frameLength),pts:v,dts:v};return y.config=[],y.channelCount=f.channelCount,y.samplerate=f.sampleRate,y.samples.push(m),{sample:m,length:f.frameLength,missing:0}}}function D(y,b){var c=y[b+1]>>3&3,s=y[b+1]>>1&3,u=y[b+2]>>4&15,f=y[b+2]>>2&3;if(c!==1&&u!==0&&u!==15&&f!==3){var C=y[b+2]>>1&1,v=y[b+3]>>6,m=c===3?3-s:s===3?3:4,_=U[m*14+u-1]*1e3,x=c===3?0:c===2?1:2,d=O[x*3+f],h=v===3?1:2,o=j[c][s],i=B[s],g=o*8*i,l=Math.floor(o*_/d+C)*i;if(Z===null){var T=navigator.userAgent||"",I=T.match(/Chrome\/(\d+)/i);Z=I?parseInt(I[1]):0}var F=!!Z&&Z<=87;return F&&s===2&&_>=224e3&&v===0&&(y[b+3]=y[b+3]|128),{sampleRate:d,channelCount:h,frameLength:l,samplesPerFrame:g}}}function E(y,b){return y[b]===255&&(y[b+1]&224)===224&&(y[b+1]&6)!==0}function A(y,b){return b+1<y.length&&E(y,b)}function P(y,b){var c=4;return E(y,b)&&c<=y.length-b}function w(y,b){if(b+1<y.length&&E(y,b)){var c=4,s=D(y,b),u=c;s!=null&&s.frameLength&&(u=s.frameLength);var f=b+u;return f===y.length||A(y,f)}return!1}},"./src/demux/sample-aes.ts":function(ce,X,R){"use strict";R.r(X);var Z=R("./src/crypt/decrypter.ts"),U=R("./src/demux/tsdemuxer.ts"),O=function(){function j(k,D,E){this.keyData=void 0,this.decrypter=void 0,this.keyData=E,this.decrypter=new Z.default(k,D,{removePKCS7Padding:!1})}var B=j.prototype;return B.decryptBuffer=function(D,E){this.decrypter.decrypt(D,this.keyData.key.buffer,this.keyData.iv.buffer,E)},B.decryptAacSample=function(D,E,A,P){var w=D[E].unit,y=w.subarray(16,w.length-w.length%16),b=y.buffer.slice(y.byteOffset,y.byteOffset+y.length),c=this;this.decryptBuffer(b,function(s){var u=new Uint8Array(s);w.set(u,16),P||c.decryptAacSamples(D,E+1,A)})},B.decryptAacSamples=function(D,E,A){for(;;E++){if(E>=D.length){A();return}if(D[E].unit.length<32)continue;var P=this.decrypter.isSync();if(this.decryptAacSample(D,E,A,P),!P)return}},B.getAvcEncryptedData=function(D){for(var E=Math.floor((D.length-48)/160)*16+16,A=new Int8Array(E),P=0,w=32;w<=D.length-16;w+=160,P+=16)A.set(D.subarray(w,w+16),P);return A},B.getAvcDecryptedUnit=function(D,E){for(var A=new Uint8Array(E),P=0,w=32;w<=D.length-16;w+=160,P+=16)D.set(A.subarray(P,P+16),w);return D},B.decryptAvcSample=function(D,E,A,P,w,y){var b=Object(U.discardEPB)(w.data),c=this.getAvcEncryptedData(b),s=this;this.decryptBuffer(c.buffer,function(u){w.data=s.getAvcDecryptedUnit(b,u),y||s.decryptAvcSamples(D,E,A+1,P)})},B.decryptAvcSamples=function(D,E,A,P){if(D instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;E++,A=0){if(E>=D.length){P();return}for(var w=D[E].units;!(A>=w.length);A++){var y=w[A];if(y.data.length<=48||y.type!==1&&y.type!==5)continue;var b=this.decrypter.isSync();if(this.decryptAvcSample(D,E,A,P,y,b),!b)return}}},j}();X.default=O},"./src/demux/transmuxer-interface.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"default",function(){return w});var Z=R("./node_modules/webworkify-webpack/index.js"),U=R.n(Z),O=R("./src/events.ts"),j=R("./src/demux/transmuxer.ts"),B=R("./src/utils/logger.ts"),k=R("./src/errors.ts"),D=R("./src/utils/mediasource-helper.ts"),E=R("./node_modules/eventemitter3/index.js"),A=R.n(E),P=Object(D.getMediaSource)()||{isTypeSupported:function(){return!1}},w=function(){function y(c,s,u,f){var C=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=c,this.id=s,this.onTransmuxComplete=u,this.onFlush=f;var v=c.config,m=function(o,i){i=i||{},i.frag=C.frag,i.id=C.id,c.trigger(o,i)};this.observer=new E.EventEmitter,this.observer.on(O.Events.FRAG_DECRYPTED,m),this.observer.on(O.Events.ERROR,m);var _={mp4:P.isTypeSupported("video/mp4"),mpeg:P.isTypeSupported("audio/mpeg"),mp3:P.isTypeSupported('audio/mp4; codecs="mp3"')},x=navigator.vendor;if(v.enableWorker&&typeof Worker!="undefined"){B.logger.log("demuxing in webworker");var d;try{d=this.worker=Z("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),d.addEventListener("message",this.onwmsg),d.onerror=function(h){c.trigger(O.Events.ERROR,{type:k.ErrorTypes.OTHER_ERROR,details:k.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(h.message+" ("+h.filename+":"+h.lineno+")")})},d.postMessage({cmd:"init",typeSupported:_,vendor:x,id:s,config:JSON.stringify(v)})}catch(h){B.logger.warn("Error in worker:",h),B.logger.error("Error while initializing DemuxerWorker, fallback to inline"),d&&self.URL.revokeObjectURL(d.objectURL),this.transmuxer=new j.default(this.observer,_,v,x,s),this.worker=null}}else this.transmuxer=new j.default(this.observer,_,v,x,s)}var b=y.prototype;return b.destroy=function(){var s=this.worker;if(s)s.removeEventListener("message",this.onwmsg),s.terminate(),this.worker=null;else{var u=this.transmuxer;u&&(u.destroy(),this.transmuxer=null)}var f=this.observer;f&&f.removeAllListeners(),this.observer=null},b.push=function(s,u,f,C,v,m,_,x,d,h){var o=this;d.transmuxing.start=self.performance.now();var i=this.transmuxer,g=this.worker,l=m?m.start:v.start,T=v.decryptdata,I=this.frag,F=!(I&&v.cc===I.cc),W=!(I&&d.level===I.level),V=I?d.sn-I.sn:-1,M=this.part?d.part-this.part.index:1,N=!W&&(V===1||V===0&&M===1),J=self.performance.now();(W||V||v.stats.parsing.start===0)&&(v.stats.parsing.start=J),m&&(M||!N)&&(m.stats.parsing.start=J);var ae=new j.TransmuxState(F,N,x,W,l);if(!N||F){B.logger.log("[transmuxer-interface, "+v.type+"]: Starting new transmux session for sn: "+d.sn+" p: "+d.part+" level: "+d.level+" id: "+d.id+`
|
|
discontinuity: `+F+`
|
|
trackSwitch: `+W+`
|
|
contiguous: `+N+`
|
|
accurateTimeOffset: `+x+`
|
|
timeOffset: `+l);var ue=new j.TransmuxConfig(f,C,u,_,h);this.configureTransmuxer(ue)}if(this.frag=v,this.part=m,g)g.postMessage({cmd:"demux",data:s,decryptdata:T,chunkMeta:d,state:ae},s instanceof ArrayBuffer?[s]:[]);else if(i){var ve=i.push(s,T,d,ae);Object(j.isPromise)(ve)?ve.then(function(Te){o.handleTransmuxComplete(Te)}):this.handleTransmuxComplete(ve)}},b.flush=function(s){var u=this;s.transmuxing.start=self.performance.now();var f=this.transmuxer,C=this.worker;if(C)C.postMessage({cmd:"flush",chunkMeta:s});else if(f){var v=f.flush(s);Object(j.isPromise)(v)?v.then(function(m){u.handleFlushResult(m,s)}):this.handleFlushResult(v,s)}},b.handleFlushResult=function(s,u){var f=this;s.forEach(function(C){f.handleTransmuxComplete(C)}),this.onFlush(u)},b.onWorkerMessage=function(s){var u=s.data,f=this.hls;switch(u.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}default:{u.data=u.data||{},u.data.frag=this.frag,u.data.id=this.id,f.trigger(u.event,u.data);break}}},b.configureTransmuxer=function(s){var u=this.worker,f=this.transmuxer;u?u.postMessage({cmd:"configure",config:s}):f&&f.configure(s)},b.handleTransmuxComplete=function(s){s.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(s)},y}()},"./src/demux/transmuxer-worker.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"default",function(){return k});var Z=R("./src/demux/transmuxer.ts"),U=R("./src/events.ts"),O=R("./src/utils/logger.ts"),j=R("./node_modules/eventemitter3/index.js"),B=R.n(j);function k(w){var y=new j.EventEmitter,b=function(s,u){w.postMessage({event:s,data:u})};y.on(U.Events.FRAG_DECRYPTED,b),y.on(U.Events.ERROR,b),w.addEventListener("message",function(c){var s=c.data;switch(s.cmd){case"init":{var u=JSON.parse(s.config);w.transmuxer=new Z.default(y,s.typeSupported,u,s.vendor,s.id),Object(O.enableLogs)(u.debug),b("init",null);break}case"configure":{w.transmuxer.configure(s.config);break}case"demux":{var f=w.transmuxer.push(s.data,s.decryptdata,s.chunkMeta,s.state);Object(Z.isPromise)(f)?f.then(function(m){D(w,m)}):D(w,f);break}case"flush":{var C=s.chunkMeta,v=w.transmuxer.flush(C);Object(Z.isPromise)(v)?v.then(function(m){A(w,m,C)}):A(w,v,C);break}default:break}})}function D(w,y){if(P(y.remuxResult))return;var b=[],c=y.remuxResult,s=c.audio,u=c.video;s&&E(b,s),u&&E(b,u),w.postMessage({event:"transmuxComplete",data:y},b)}function E(w,y){y.data1&&w.push(y.data1.buffer),y.data2&&w.push(y.data2.buffer)}function A(w,y,b){y.forEach(function(c){D(w,c)}),w.postMessage({event:"flush",data:b})}function P(w){return!w.audio&&!w.video&&!w.text&&!w.id3&&!w.initSegment}},"./src/demux/transmuxer.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"default",function(){return u}),R.d(X,"isPromise",function(){return v}),R.d(X,"TransmuxConfig",function(){return m}),R.d(X,"TransmuxState",function(){return _});var Z=R("./src/events.ts"),U=R("./src/errors.ts"),O=R("./src/crypt/decrypter.ts"),j=R("./src/demux/aacdemuxer.ts"),B=R("./src/demux/mp4demuxer.ts"),k=R("./src/demux/tsdemuxer.ts"),D=R("./src/demux/mp3demuxer.ts"),E=R("./src/remux/mp4-remuxer.ts"),A=R("./src/remux/passthrough-remuxer.ts"),P=R("./src/demux/chunk-cache.ts"),w=R("./src/utils/mp4-tools.ts"),y=R("./src/utils/logger.ts"),b;try{b=self.performance.now.bind(self.performance)}catch(x){y.logger.debug("Unable to use Performance API on this environment"),b=self.Date.now}var c=[{demux:k.default,remux:E.default},{demux:B.default,remux:A.default},{demux:j.default,remux:E.default},{demux:D.default,remux:E.default}],s=1024;c.forEach(function(x){var d=x.demux;s=Math.max(s,d.minProbeByteLength)});var u=function(){function x(h,o,i,g,l){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new P.default,this.observer=h,this.typeSupported=o,this.config=i,this.vendor=g,this.id=l}var d=x.prototype;return d.configure=function(o){this.transmuxConfig=o,this.decrypter&&this.decrypter.reset()},d.push=function(o,i,g,l){var T=this,I=g.transmuxing;I.executeStart=b();var F=new Uint8Array(o),W=this.cache,V=this.config,M=this.currentTransmuxState,N=this.transmuxConfig;l&&(this.currentTransmuxState=l);var J=f(F,i);if(J&&J.method==="AES-128"){var ae=this.getDecrypter();if(V.enableSoftwareAES){var ue=ae.softwareDecrypt(F,J.key.buffer,J.iv.buffer);if(!ue)return I.executeEnd=b(),C(g);F=new Uint8Array(ue)}else return this.decryptionPromise=ae.webCryptoDecrypt(F,J.key.buffer,J.iv.buffer).then(function(Re){var Pe=T.push(Re,null,g);return T.decryptionPromise=null,Pe}),this.decryptionPromise}var ve=l||M,Te=ve.contiguous,_e=ve.discontinuity,fe=ve.trackSwitch,ne=ve.accurateTimeOffset,me=ve.timeOffset,ie=N.audioCodec,le=N.videoCodec,q=N.defaultInitPts,re=N.duration,oe=N.initSegmentData;if((_e||fe)&&this.resetInitSegment(oe,ie,le,re),_e&&this.resetInitialTimestamp(q),Te||this.resetContiguity(),this.needsProbing(F,_e,fe)){if(W.dataLength){var ge=W.flush();F=Object(w.appendUint8Array)(ge,F)}this.configureTransmuxer(F,N)}var Se=this.transmux(F,J,me,ne,g),Ee=this.currentTransmuxState;return Ee.contiguous=!0,Ee.discontinuity=!1,Ee.trackSwitch=!1,I.executeEnd=b(),Se},d.flush=function(o){var i=this,g=o.transmuxing;g.executeStart=b();var l=this.decrypter,T=this.cache,I=this.currentTransmuxState,F=this.decryptionPromise;if(F)return F.then(function(){return i.flush(o)});var W=[],V=I.timeOffset;if(l){var M=l.flush();M&&W.push(this.push(M,null,o))}var N=T.dataLength;T.reset();var J=this.demuxer,ae=this.remuxer;if(!J||!ae)return N>=s&&this.observer.emit(Z.Events.ERROR,Z.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),g.executeEnd=b(),[C(o)];var ue=J.flush(V);return v(ue)?ue.then(function(ve){return i.flushRemux(W,ve,o),W}):(this.flushRemux(W,ue,o),W)},d.flushRemux=function(o,i,g){var l=i.audioTrack,T=i.avcTrack,I=i.id3Track,F=i.textTrack,W=this.currentTransmuxState,V=W.accurateTimeOffset,M=W.timeOffset;y.logger.log("[transmuxer.ts]: Flushed fragment "+g.sn+(g.part>-1?" p: "+g.part:"")+" of level "+g.level);var N=this.remuxer.remux(l,T,I,F,M,V,!0,this.id);o.push({remuxResult:N,chunkMeta:g}),g.transmuxing.executeEnd=b()},d.resetInitialTimestamp=function(o){var i=this.demuxer,g=this.remuxer;if(!i||!g)return;i.resetTimeStamp(o),g.resetTimeStamp(o)},d.resetContiguity=function(){var o=this.demuxer,i=this.remuxer;if(!o||!i)return;o.resetContiguity(),i.resetNextTimestamp()},d.resetInitSegment=function(o,i,g,l){var T=this.demuxer,I=this.remuxer;if(!T||!I)return;T.resetInitSegment(i,g,l),I.resetInitSegment(o,i,g)},d.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},d.transmux=function(o,i,g,l,T){var I;return i&&i.method==="SAMPLE-AES"?I=this.transmuxSampleAes(o,i,g,l,T):I=this.transmuxUnencrypted(o,g,l,T),I},d.transmuxUnencrypted=function(o,i,g,l){var T=this.demuxer.demux(o,i,!1,!this.config.progressive),I=T.audioTrack,F=T.avcTrack,W=T.id3Track,V=T.textTrack,M=this.remuxer.remux(I,F,W,V,i,g,!1,this.id);return{remuxResult:M,chunkMeta:l}},d.transmuxSampleAes=function(o,i,g,l,T){var I=this;return this.demuxer.demuxSampleAes(o,i,g).then(function(F){var W=I.remuxer.remux(F.audioTrack,F.avcTrack,F.id3Track,F.textTrack,g,l,!1,I.id);return{remuxResult:W,chunkMeta:T}})},d.configureTransmuxer=function(o,i){for(var g=this.config,l=this.observer,T=this.typeSupported,I=this.vendor,F=i.audioCodec,W=i.defaultInitPts,V=i.duration,M=i.initSegmentData,N=i.videoCodec,J,ae=0,ue=c.length;ae<ue;ae++)if(c[ae].demux.probe(o)){J=c[ae];break}J||(y.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),J={demux:B.default,remux:A.default});var ve=this.demuxer,Te=this.remuxer,_e=J.remux,fe=J.demux;(!Te||!(Te instanceof _e))&&(this.remuxer=new _e(l,g,T,I)),(!ve||!(ve instanceof fe))&&(this.demuxer=new fe(l,g,T),this.probe=fe.probe),this.resetInitSegment(M,F,N,V),this.resetInitialTimestamp(W)},d.needsProbing=function(o,i,g){return!this.demuxer||!this.remuxer||i||g},d.getDecrypter=function(){var o=this.decrypter;return o||(o=this.decrypter=new O.default(this.observer,this.config)),o},x}();function f(x,d){var h=null;return x.byteLength>0&&d!=null&&d.key!=null&&d.iv!==null&&d.method!=null&&(h=d),h}var C=function(d){return{remuxResult:{},chunkMeta:d}};function v(x){return"then"in x&&x.then instanceof Function}var m=function(d,h,o,i,g){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=d,this.videoCodec=h,this.initSegmentData=o,this.duration=i,this.defaultInitPts=g},_=function(d,h,o,i,g){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=d,this.contiguous=h,this.accurateTimeOffset=o,this.trackSwitch=i,this.timeOffset=g}},"./src/demux/tsdemuxer.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"discardEPB",function(){return C});var Z=R("./src/demux/adts.ts"),U=R("./src/demux/mpegaudio.ts"),O=R("./src/demux/exp-golomb.ts"),j=R("./src/demux/id3.ts"),B=R("./src/demux/sample-aes.ts"),k=R("./src/events.ts"),D=R("./src/utils/mp4-tools.ts"),E=R("./src/utils/logger.ts"),A=R("./src/errors.ts"),P={video:1,audio:2,id3:3,text:4},w=function(){function v(_,x,d){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=_,this.config=x,this.typeSupported=d}v.probe=function(x){var d=v.syncOffset(x);return d<0?!1:(d&&E.logger.warn("MPEG2-TS detected but first sync word found @ offset "+d+", junk ahead ?"),!0)},v.syncOffset=function(x){for(var d=Math.min(1e3,x.length-3*188),h=0;h<d;){if(x[h]===71&&x[h+188]===71&&x[h+2*188]===71)return h;h++}return-1},v.createTrack=function(x,d){return{container:x==="video"||x==="audio"?"video/mp2t":void 0,type:x,id:P[x],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:x==="audio"?d:void 0}};var m=v.prototype;return m.resetInitSegment=function(x,d,h){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=v.createTrack("video",h),this._audioTrack=v.createTrack("audio",h),this._id3Track=v.createTrack("id3",h),this._txtTrack=v.createTrack("text",h),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=x,this.videoCodec=d,this._duration=h},m.resetTimeStamp=function(){},m.resetContiguity=function(){var x=this._audioTrack,d=this._avcTrack,h=this._id3Track;x&&(x.pesData=null),d&&(d.pesData=null),h&&(h.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},m.demux=function(x,d,h,o){h===void 0&&(h=!1),o===void 0&&(o=!1),h||(this.sampleAes=null);var i,g=this._avcTrack,l=this._audioTrack,T=this._id3Track,I=g.pid,F=g.pesData,W=l.pid,V=T.pid,M=l.pesData,N=T.pesData,J=!1,ae=this.pmtParsed,ue=this._pmtId,ve=x.length;if(this.remainderData&&(x=Object(D.appendUint8Array)(this.remainderData,x),ve=x.length,this.remainderData=null),ve<188&&!o)return this.remainderData=x,{audioTrack:l,avcTrack:g,id3Track:T,textTrack:this._txtTrack};var Te=Math.max(0,v.syncOffset(x));ve-=(ve+Te)%188,ve<x.byteLength&&!o&&(this.remainderData=new Uint8Array(x.buffer,ve,x.buffer.byteLength-ve));for(var _e=Te;_e<ve;_e+=188)if(x[_e]===71){var fe=!!(x[_e+1]&64),ne=((x[_e+1]&31)<<8)+x[_e+2],me=(x[_e+3]&48)>>4,ie=void 0;if(me>1){if(ie=_e+5+x[_e+4],ie===_e+188)continue}else ie=_e+4;switch(ne){case I:fe&&(F&&(i=s(F))&&this.parseAVCPES(i,!1),F={data:[],size:0}),F&&(F.data.push(x.subarray(ie,_e+188)),F.size+=_e+188-ie);break;case W:fe&&(M&&(i=s(M))&&(l.isAAC?this.parseAACPES(i):this.parseMPEGPES(i)),M={data:[],size:0}),M&&(M.data.push(x.subarray(ie,_e+188)),M.size+=_e+188-ie);break;case V:fe&&(N&&(i=s(N))&&this.parseID3PES(i),N={data:[],size:0}),N&&(N.data.push(x.subarray(ie,_e+188)),N.size+=_e+188-ie);break;case 0:fe&&(ie+=x[ie]+1),ue=this._pmtId=b(x,ie);break;case ue:{fe&&(ie+=x[ie]+1);var le=c(x,ie,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,h);I=le.avc,I>0&&(g.pid=I),W=le.audio,W>0&&(l.pid=W,l.isAAC=le.isAAC),V=le.id3,V>0&&(T.pid=V),J&&!ae&&(E.logger.log("reparse from beginning"),J=!1,_e=Te-188),ae=this.pmtParsed=!0;break}case 17:case 8191:break;default:J=!0;break}}else this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});g.pesData=F,l.pesData=M,T.pesData=N;var q={audioTrack:l,avcTrack:g,id3Track:T,textTrack:this._txtTrack};return o&&this.extractRemainingSamples(q),q},m.flush=function(){var x=this.remainderData;this.remainderData=null;var d;return x?d=this.demux(x,-1,!1,!0):d={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(d),this.sampleAes?this.decrypt(d,this.sampleAes):d},m.extractRemainingSamples=function(x){var d=x.audioTrack,h=x.avcTrack,o=x.id3Track,i=h.pesData,g=d.pesData,l=o.pesData,T;i&&(T=s(i))?(this.parseAVCPES(T,!0),h.pesData=null):h.pesData=i,g&&(T=s(g))?(d.isAAC?this.parseAACPES(T):this.parseMPEGPES(T),d.pesData=null):(g!=null&&g.size&&E.logger.log("last AAC PES packet truncated,might overlap between fragments"),d.pesData=g),l&&(T=s(l))?(this.parseID3PES(T),o.pesData=null):o.pesData=l},m.demuxSampleAes=function(x,d,h){var o=this.demux(x,h,!0,!this.config.progressive),i=this.sampleAes=new B.default(this.observer,this.config,d);return this.decrypt(o,i)},m.decrypt=function(x,d){return new Promise(function(h){var o=x.audioTrack,i=x.avcTrack;o.samples&&o.isAAC?d.decryptAacSamples(o.samples,0,function(){i.samples?d.decryptAvcSamples(i.samples,0,0,function(){h(x)}):h(x)}):i.samples&&d.decryptAvcSamples(i.samples,0,0,function(){h(x)})})},m.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},m.parseAVCPES=function(x,d){var h=this,o=this._avcTrack,i=this.parseAVCNALu(x.data),g=!1,l=this.avcSample,T,I=!1;x.data=null,l&&i.length&&!o.audFound&&(u(l,o),l=this.avcSample=y(!1,x.pts,x.dts,"")),i.forEach(function(F){switch(F.type){case 1:{T=!0,l||(l=h.avcSample=y(!0,x.pts,x.dts,"")),g&&(l.debug+="NDR "),l.frame=!0;var W=F.data;if(I&&W.length>4){var V=new O.default(W).readSliceType();(V===2||V===4||V===7||V===9)&&(l.key=!0)}break}case 5:T=!0,l||(l=h.avcSample=y(!0,x.pts,x.dts,"")),g&&(l.debug+="IDR "),l.key=!0,l.frame=!0;break;case 6:{T=!0,g&&l&&(l.debug+="SEI ");var M=new O.default(C(F.data));M.readUByte();for(var N=0,J=0,ae=!1,ue=0;!ae&&M.bytesAvailable>1;){N=0;do ue=M.readUByte(),N+=ue;while(ue===255);J=0;do ue=M.readUByte(),J+=ue;while(ue===255);if(N===4&&M.bytesAvailable!==0){ae=!0;var ve=M.readUByte();if(ve===181){var Te=M.readUShort();if(Te===49){var _e=M.readUInt();if(_e===1195456820){var fe=M.readUByte();if(fe===3){for(var ne=M.readUByte(),me=M.readUByte(),ie=31&ne,le=[ne,me],q=0;q<ie;q++)le.push(M.readUByte()),le.push(M.readUByte()),le.push(M.readUByte());f(h._txtTrack.samples,{type:3,pts:x.pts,bytes:le})}}}}}else if(N===5&&M.bytesAvailable!==0){if(ae=!0,J>16){for(var re=[],oe=0;oe<16;oe++)re.push(M.readUByte().toString(16)),(oe===3||oe===5||oe===7||oe===9)&&re.push("-");for(var ge=J-16,Se=new Uint8Array(ge),Ee=0;Ee<ge;Ee++)Se[Ee]=M.readUByte();f(h._txtTrack.samples,{pts:x.pts,payloadType:N,uuid:re.join(""),userData:Object(j.utf8ArrayToStr)(Se),userDataBytes:Se})}}else if(J<M.bytesAvailable)for(var Re=0;Re<J;Re++)M.readUByte()}break}case 7:if(T=!0,I=!0,g&&l&&(l.debug+="SPS "),!o.sps){var Pe=new O.default(F.data),Ue=Pe.readSPS();o.width=Ue.width,o.height=Ue.height,o.pixelRatio=Ue.pixelRatio,o.sps=[F.data],o.duration=h._duration;for(var He=F.data.subarray(1,4),Fe="avc1.",Ne=0;Ne<3;Ne++){var qe=He[Ne].toString(16);qe.length<2&&(qe="0"+qe),Fe+=qe}o.codec=Fe}break;case 8:T=!0,g&&l&&(l.debug+="PPS "),o.pps||(o.pps=[F.data]);break;case 9:T=!1,o.audFound=!0,l&&u(l,o),l=h.avcSample=y(!1,x.pts,x.dts,g?"AUD ":"");break;case 12:T=!1;break;default:T=!1,l&&(l.debug+="unknown NAL "+F.type+" ");break}if(l&&T){var Je=l.units;Je.push(F)}}),d&&l&&(u(l,o),this.avcSample=null)},m.getLastNalUnit=function(){var x,d=this.avcSample,h;if(!d||d.units.length===0){var o=this._avcTrack.samples;d=o[o.length-1]}if((x=d)!==null&&x!==void 0&&x.units){var i=d.units;h=i[i.length-1]}return h},m.parseAVCNALu=function(x){var d=x.byteLength,h=this._avcTrack,o=h.naluState||0,i=o,g=[],l=0,T,I,F,W=-1,V=0;for(o===-1&&(W=0,V=x[0]&31,o=0,l=1);l<d;){if(T=x[l++],!o){o=T?0:1;continue}if(o===1){o=T?0:2;continue}if(!T)o=3;else if(T===1){if(W>=0){var M={data:x.subarray(W,l-o-1),type:V};g.push(M)}else{var N=this.getLastNalUnit();if(N&&(i&&l<=4-i&&(N.state&&(N.data=N.data.subarray(0,N.data.byteLength-i))),I=l-o-1,I>0)){var J=new Uint8Array(N.data.byteLength+I);J.set(N.data,0),J.set(x.subarray(0,I),N.data.byteLength),N.data=J,N.state=0}}l<d?(F=x[l]&31,W=l,V=F,o=0):o=-1}else o=0}if(W>=0&&o>=0){var ae={data:x.subarray(W,d),type:V,state:o};g.push(ae)}if(g.length===0){var ue=this.getLastNalUnit();if(ue){var ve=new Uint8Array(ue.data.byteLength+x.byteLength);ve.set(ue.data,0),ve.set(x,ue.data.byteLength),ue.data=ve}}return h.naluState=o,g},m.parseAACPES=function(x){var d=0,h=this._audioTrack,o=this.aacOverFlow,i=x.data;if(o){this.aacOverFlow=null;var g=o.sample.unit.byteLength,l=Math.min(o.missing,g),T=g-l;o.sample.unit.set(i.subarray(0,l),T),h.samples.push(o.sample),d=o.missing}var I,F;for(I=d,F=i.length;I<F-1&&!Z.isHeader(i,I);I++);if(I!==d){var W,V;if(I<F-1?(W="AAC PES did not start with ADTS header,offset:"+I,V=!1):(W="no ADTS header found in AAC PES",V=!0),E.logger.warn("parsing error:"+W),this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:V,reason:W}),V)return}Z.initTrackConfig(h,this.observer,i,I,this.audioCodec);var M;if(x.pts!==void 0)M=x.pts;else if(o){var N=Z.getFrameDuration(h.samplerate);M=o.sample.pts+N}else{E.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var J=0;I<F;)if(Z.isHeader(i,I)){if(I+5<F){var ae=Z.appendFrame(h,i,I,M,J);if(ae)if(ae.missing)this.aacOverFlow=ae;else{I+=ae.length,J++;continue}}break}else I++},m.parseMPEGPES=function(x){var d=x.data,h=d.length,o=0,i=0,g=x.pts;if(g===void 0){E.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;i<h;)if(U.isHeader(d,i)){var l=U.appendFrame(this._audioTrack,d,i,g,o);if(l)i+=l.length,o++;else break}else i++},m.parseID3PES=function(x){if(x.pts===void 0){E.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(x)},v}();w.minProbeByteLength=188;function y(v,m,_,x){return{key:v,frame:!1,pts:m,dts:_,units:[],debug:x,length:0}}function b(v,m){return(v[m+10]&31)<<8|v[m+11]}function c(v,m,_,x){var d={audio:-1,avc:-1,id3:-1,isAAC:!0},h=(v[m+1]&15)<<8|v[m+2],o=m+3+h-4,i=(v[m+10]&15)<<8|v[m+11];for(m+=12+i;m<o;){var g=(v[m+1]&31)<<8|v[m+2];switch(v[m]){case 207:if(!x){E.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:d.audio===-1&&(d.audio=g);break;case 21:d.id3===-1&&(d.id3=g);break;case 219:if(!x){E.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:d.avc===-1&&(d.avc=g);break;case 3:case 4:_?d.audio===-1&&(d.audio=g,d.isAAC=!1):E.logger.log("MPEG audio found, not supported in this browser");break;case 36:E.logger.warn("Unsupported HEVC stream type found");break;default:break}m+=((v[m+3]&15)<<8|v[m+4])+5}return d}function s(v){var m=0,_,x,d,h,o,i=v.data;if(!v||v.size===0)return null;for(;i[0].length<19&&i.length>1;){var g=new Uint8Array(i[0].length+i[1].length);g.set(i[0]),g.set(i[1],i[0].length),i[0]=g,i.splice(1,1)}_=i[0];var l=(_[0]<<16)+(_[1]<<8)+_[2];if(l===1){if(x=(_[4]<<8)+_[5],x&&x>v.size-6)return null;var T=_[7];T&192&&(h=(_[9]&14)*536870912+(_[10]&255)*4194304+(_[11]&254)*16384+(_[12]&255)*128+(_[13]&254)/2,T&64?(o=(_[14]&14)*536870912+(_[15]&255)*4194304+(_[16]&254)*16384+(_[17]&255)*128+(_[18]&254)/2,h-o>60*9e4&&(E.logger.warn(Math.round((h-o)/9e4)+"s delta between PTS and DTS, align them"),h=o)):o=h),d=_[8];var I=d+9;if(v.size<=I)return null;v.size-=I;for(var F=new Uint8Array(v.size),W=0,V=i.length;W<V;W++){_=i[W];var M=_.byteLength;if(I)if(I>M){I-=M;continue}else _=_.subarray(I),M-=I,I=0;F.set(_,m),m+=M}return x&&(x-=d+3),{data:F,pts:h,dts:o,len:x}}return null}function u(v,m){if(v.units.length&&v.frame){if(v.pts===void 0){var _=m.samples,x=_.length;if(x){var d=_[x-1];v.pts=d.pts,v.dts=d.dts}else{m.dropped++;return}}m.samples.push(v)}v.debug.length&&E.logger.log(v.pts+"/"+v.dts+":"+v.debug)}function f(v,m){var _=v.length;if(_>0){if(m.pts>=v[_-1].pts)v.push(m);else for(var x=_-1;x>=0;x--)if(m.pts<v[x].pts){v.splice(x,0,m);break}}else v.push(m)}function C(v){for(var m=v.byteLength,_=[],x=1;x<m-2;)v[x]===0&&v[x+1]===0&&v[x+2]===3?(_.push(x+2),x+=2):x++;if(_.length===0)return v;var d=m-_.length,h=new Uint8Array(d),o=0;for(x=0;x<d;o++,x++)o===_[0]&&(o++,_.shift()),h[x]=v[o];return h}X.default=w},"./src/errors.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"ErrorTypes",function(){return Z}),R.d(X,"ErrorDetails",function(){return U});var Z;(function(O){O.NETWORK_ERROR="networkError",O.MEDIA_ERROR="mediaError",O.KEY_SYSTEM_ERROR="keySystemError",O.MUX_ERROR="muxError",O.OTHER_ERROR="otherError"})(Z||(Z={}));var U;(function(O){O.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",O.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",O.KEY_SYSTEM_NO_SESSION="keySystemNoSession",O.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",O.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",O.MANIFEST_LOAD_ERROR="manifestLoadError",O.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",O.MANIFEST_PARSING_ERROR="manifestParsingError",O.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",O.LEVEL_EMPTY_ERROR="levelEmptyError",O.LEVEL_LOAD_ERROR="levelLoadError",O.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",O.LEVEL_SWITCH_ERROR="levelSwitchError",O.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",O.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",O.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",O.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",O.FRAG_LOAD_ERROR="fragLoadError",O.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",O.FRAG_DECRYPT_ERROR="fragDecryptError",O.FRAG_PARSING_ERROR="fragParsingError",O.REMUX_ALLOC_ERROR="remuxAllocError",O.KEY_LOAD_ERROR="keyLoadError",O.KEY_LOAD_TIMEOUT="keyLoadTimeOut",O.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",O.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",O.BUFFER_APPEND_ERROR="bufferAppendError",O.BUFFER_APPENDING_ERROR="bufferAppendingError",O.BUFFER_STALLED_ERROR="bufferStalledError",O.BUFFER_FULL_ERROR="bufferFullError",O.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",O.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",O.INTERNAL_EXCEPTION="internalException",O.INTERNAL_ABORTED="aborted",O.UNKNOWN="unknown"})(U||(U={}))},"./src/events.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"Events",function(){return Z});var Z;(function(U){U.MEDIA_ATTACHING="hlsMediaAttaching",U.MEDIA_ATTACHED="hlsMediaAttached",U.MEDIA_DETACHING="hlsMediaDetaching",U.MEDIA_DETACHED="hlsMediaDetached",U.BUFFER_RESET="hlsBufferReset",U.BUFFER_CODECS="hlsBufferCodecs",U.BUFFER_CREATED="hlsBufferCreated",U.BUFFER_APPENDING="hlsBufferAppending",U.BUFFER_APPENDED="hlsBufferAppended",U.BUFFER_EOS="hlsBufferEos",U.BUFFER_FLUSHING="hlsBufferFlushing",U.BUFFER_FLUSHED="hlsBufferFlushed",U.MANIFEST_LOADING="hlsManifestLoading",U.MANIFEST_LOADED="hlsManifestLoaded",U.MANIFEST_PARSED="hlsManifestParsed",U.LEVEL_SWITCHING="hlsLevelSwitching",U.LEVEL_SWITCHED="hlsLevelSwitched",U.LEVEL_LOADING="hlsLevelLoading",U.LEVEL_LOADED="hlsLevelLoaded",U.LEVEL_UPDATED="hlsLevelUpdated",U.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",U.LEVELS_UPDATED="hlsLevelsUpdated",U.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",U.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",U.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",U.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",U.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",U.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",U.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",U.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",U.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",U.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",U.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",U.CUES_PARSED="hlsCuesParsed",U.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",U.INIT_PTS_FOUND="hlsInitPtsFound",U.FRAG_LOADING="hlsFragLoading",U.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",U.FRAG_LOADED="hlsFragLoaded",U.FRAG_DECRYPTED="hlsFragDecrypted",U.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",U.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",U.FRAG_PARSING_METADATA="hlsFragParsingMetadata",U.FRAG_PARSED="hlsFragParsed",U.FRAG_BUFFERED="hlsFragBuffered",U.FRAG_CHANGED="hlsFragChanged",U.FPS_DROP="hlsFpsDrop",U.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",U.ERROR="hlsError",U.DESTROYING="hlsDestroying",U.KEY_LOADING="hlsKeyLoading",U.KEY_LOADED="hlsKeyLoaded",U.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",U.BACK_BUFFER_REACHED="hlsBackBufferReached"})(Z||(Z={}))},"./src/hls.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"default",function(){return v});var Z=R("./node_modules/url-toolkit/src/url-toolkit.js"),U=R.n(Z),O=R("./src/loader/playlist-loader.ts"),j=R("./src/loader/key-loader.ts"),B=R("./src/controller/id3-track-controller.ts"),k=R("./src/controller/latency-controller.ts"),D=R("./src/controller/level-controller.ts"),E=R("./src/controller/fragment-tracker.ts"),A=R("./src/controller/stream-controller.ts"),P=R("./src/is-supported.ts"),w=R("./src/utils/logger.ts"),y=R("./src/config.ts"),b=R("./node_modules/eventemitter3/index.js"),c=R.n(b),s=R("./src/events.ts"),u=R("./src/errors.ts");function f(m,_){for(var x=0;x<_.length;x++){var d=_[x];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(m,d.key,d)}}function C(m,_,x){return _&&f(m.prototype,_),x&&f(m,x),m}var v=function(){m.isSupported=function(){return Object(P.isSupported)()};function m(x){x===void 0&&(x={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new b.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 d=this.config=Object(y.mergeConfig)(m.DefaultConfig,x);this.userConfig=x,Object(w.enableLogs)(d.debug),this._autoLevelCapping=-1,d.progressive&&Object(y.enableStreamingMode)(d);var h=d.abrController,o=d.bufferController,i=d.capLevelController,g=d.fpsController,l=this.abrController=new h(this),T=this.bufferController=new o(this),I=this.capLevelController=new i(this),F=new g(this),W=new O.default(this),V=new j.default(this),M=new B.default(this),N=this.levelController=new D.default(this),J=new E.FragmentTracker(this),ae=this.streamController=new A.default(this,J);I.setStreamController(ae),F.setStreamController(ae);var ue=[N,ae];this.networkControllers=ue;var ve=[W,V,l,T,I,F,M,J];this.audioTrackController=this.createController(d.audioTrackController,null,ue),this.createController(d.audioStreamController,J,ue),this.subtitleTrackController=this.createController(d.subtitleTrackController,null,ue),this.createController(d.subtitleStreamController,J,ue),this.createController(d.timelineController,null,ve),this.emeController=this.createController(d.emeController,null,ve),this.cmcdController=this.createController(d.cmcdController,null,ve),this.latencyController=this.createController(k.default,null,ve),this.coreComponents=ve}var _=m.prototype;return _.createController=function(d,h,o){if(d){var i=h?new d(this,h):new d(this);return o&&o.push(i),i}return null},_.on=function(d,h,o){o===void 0&&(o=this),this._emitter.on(d,h,o)},_.once=function(d,h,o){o===void 0&&(o=this),this._emitter.once(d,h,o)},_.removeAllListeners=function(d){this._emitter.removeAllListeners(d)},_.off=function(d,h,o,i){o===void 0&&(o=this),this._emitter.off(d,h,o,i)},_.listeners=function(d){return this._emitter.listeners(d)},_.emit=function(d,h,o){return this._emitter.emit(d,h,o)},_.trigger=function(d,h){if(this.config.debug)return this.emit(d,d,h);try{return this.emit(d,d,h)}catch(o){w.logger.error("An internal error happened while handling event "+d+'. Error message: "'+o.message+'". Here is a stacktrace:',o),this.trigger(s.Events.ERROR,{type:u.ErrorTypes.OTHER_ERROR,details:u.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:d,error:o})}return!1},_.listenerCount=function(d){return this._emitter.listenerCount(d)},_.destroy=function(){w.logger.log("destroy"),this.trigger(s.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(d){return d.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(d){return d.destroy()}),this.coreComponents.length=0},_.attachMedia=function(d){w.logger.log("attachMedia"),this._media=d,this.trigger(s.Events.MEDIA_ATTACHING,{media:d})},_.detachMedia=function(){w.logger.log("detachMedia"),this.trigger(s.Events.MEDIA_DETACHING,void 0),this._media=null},_.loadSource=function(d){this.stopLoad();var h=this.media,o=this.url,i=this.url=Z.buildAbsoluteURL(self.location.href,d,{alwaysNormalize:!0});w.logger.log("loadSource:"+i),h&&o&&o!==i&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(h)),this.trigger(s.Events.MANIFEST_LOADING,{url:d})},_.startLoad=function(d){d===void 0&&(d=-1),w.logger.log("startLoad("+d+")"),this.networkControllers.forEach(function(h){h.startLoad(d)})},_.stopLoad=function(){w.logger.log("stopLoad"),this.networkControllers.forEach(function(d){d.stopLoad()})},_.swapAudioCodec=function(){w.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},_.recoverMediaError=function(){w.logger.log("recoverMediaError");var d=this._media;this.detachMedia(),d&&this.attachMedia(d)},_.removeLevel=function(d,h){h===void 0&&(h=0),this.levelController.removeLevel(d,h)},C(m,[{key:"levels",get:function(){var d=this.levelController.levels;return d||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(d){w.logger.log("set currentLevel:"+d),this.loadLevel=d,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(d){w.logger.log("set nextLevel:"+d),this.levelController.manualLevel=d,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(d){w.logger.log("set loadLevel:"+d),this.levelController.manualLevel=d}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(d){this.levelController.nextLoadLevel=d}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(d){w.logger.log("set firstLevel:"+d),this.levelController.firstLevel=d}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(d){w.logger.log("set startLevel:"+d),d!==-1&&(d=Math.max(d,this.minAutoLevel)),this.levelController.startLevel=d}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(d){var h=!!d;h!==this.config.capLevelToPlayerSize&&(h?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=h)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(d){this._autoLevelCapping!==d&&(w.logger.log("set autoLevelCapping:"+d),this._autoLevelCapping=d)}},{key:"bandwidthEstimate",get:function(){var d=this.abrController.bwEstimator;return d?d.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var d=this.levels,h=this.config.minAutoBitrate;if(!d)return 0;for(var o=d.length,i=0;i<o;i++)if(d[i].maxBitrate>h)return i;return 0}},{key:"maxAutoLevel",get:function(){var d=this.levels,h=this.autoLevelCapping,o;return h===-1&&d&&d.length?o=d.length-1:o=h,o}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(d){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,d)}},{key:"audioTracks",get:function(){var d=this.audioTrackController;return d?d.audioTracks:[]}},{key:"audioTrack",get:function(){var d=this.audioTrackController;return d?d.audioTrack:-1},set:function(d){var h=this.audioTrackController;h&&(h.audioTrack=d)}},{key:"subtitleTracks",get:function(){var d=this.subtitleTrackController;return d?d.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var d=this.subtitleTrackController;return d?d.subtitleTrack:-1},set:function(d){var h=this.subtitleTrackController;h&&(h.subtitleTrack=d)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var d=this.subtitleTrackController;return d?d.subtitleDisplay:!1},set:function(d){var h=this.subtitleTrackController;h&&(h.subtitleDisplay=d)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(d){this.config.lowLatencyMode=d}},{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 s.Events}},{key:"ErrorTypes",get:function(){return u.ErrorTypes}},{key:"ErrorDetails",get:function(){return u.ErrorDetails}},{key:"DefaultConfig",get:function(){return m.defaultConfig?m.defaultConfig:y.hlsDefaultConfig},set:function(d){m.defaultConfig=d}}]),m}();v.defaultConfig=void 0},"./src/is-supported.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"isSupported",function(){return O}),R.d(X,"changeTypeSupported",function(){return j});var Z=R("./src/utils/mediasource-helper.ts");function U(){return self.SourceBuffer||self.WebKitSourceBuffer}function O(){var B=Object(Z.getMediaSource)();if(!B)return!1;var k=U(),D=B&&typeof B.isTypeSupported=="function"&&B.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),E=!k||k.prototype&&typeof k.prototype.appendBuffer=="function"&&typeof k.prototype.remove=="function";return!!D&&!!E}function j(){var B,k=U();return typeof(k==null||((B=k.prototype)===null||B===void 0)?void 0:B.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"default",function(){return w}),R.d(X,"LoadError",function(){return b});var Z=R("./src/polyfills/number.ts"),U=R("./src/errors.ts");function O(c,s){c.prototype=Object.create(s.prototype),c.prototype.constructor=c,E(c,s)}function j(c){var s=typeof Map=="function"?new Map:void 0;return j=function(f){if(f===null||!D(f))return f;if(typeof f!="function")throw new TypeError("Super expression must either be null or a function");if(typeof s!="undefined"){if(s.has(f))return s.get(f);s.set(f,C)}function C(){return B(f,arguments,A(this).constructor)}return C.prototype=Object.create(f.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),E(C,f)},j(c)}function B(c,s,u){return k()?B=Reflect.construct:B=function(C,v,m){var _=[null];_.push.apply(_,v);var x=Function.bind.apply(C,_),d=new x;return m&&E(d,m.prototype),d},B.apply(null,arguments)}function k(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(c){return!1}}function D(c){return Function.toString.call(c).indexOf("[native code]")!==-1}function E(c,s){return E=Object.setPrototypeOf||function(f,C){return f.__proto__=C,f},E(c,s)}function A(c){return A=Object.setPrototypeOf?Object.getPrototypeOf:function(u){return u.__proto__||Object.getPrototypeOf(u)},A(c)}var P=Math.pow(2,17),w=function(){function c(u){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=u}var s=c.prototype;return s.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},s.abort=function(){this.loader&&this.loader.abort()},s.load=function(f,C){var v=this,m=f.url;if(!m)return Promise.reject(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:f,networkDetails:null},"Fragment does not have a "+(m?"part list":"url")));this.abort();var _=this.config,x=_.fLoader,d=_.loader;return new Promise(function(h,o){v.loader&&v.loader.destroy();var i=v.loader=f.loader=x?new x(_):new d(_),g=y(f),l={timeout:_.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:_.fragLoadingMaxRetryTimeout,highWaterMark:P};f.stats=i.stats,i.load(g,l,{onSuccess:function(I,F,W,V){v.resetLoader(f,i),h({frag:f,part:null,payload:I.data,networkDetails:V})},onError:function(I,F,W){v.resetLoader(f,i),o(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:f,response:I,networkDetails:W}))},onAbort:function(I,F,W){v.resetLoader(f,i),o(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:f,networkDetails:W}))},onTimeout:function(I,F,W){v.resetLoader(f,i),o(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:f,networkDetails:W}))},onProgress:function(I,F,W,V){C&&C({frag:f,part:null,payload:W,networkDetails:V})}})})},s.loadPart=function(f,C,v){var m=this;this.abort();var _=this.config,x=_.fLoader,d=_.loader;return new Promise(function(h,o){m.loader&&m.loader.destroy();var i=m.loader=f.loader=x?new x(_):new d(_),g=y(f,C),l={timeout:_.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:_.fragLoadingMaxRetryTimeout,highWaterMark:P};C.stats=i.stats,i.load(g,l,{onSuccess:function(I,F,W,V){m.resetLoader(f,i),m.updateStatsFromPart(f,C);var M={frag:f,part:C,payload:I.data,networkDetails:V};v(M),h(M)},onError:function(I,F,W){m.resetLoader(f,i),o(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:f,part:C,response:I,networkDetails:W}))},onAbort:function(I,F,W){f.stats.aborted=C.stats.aborted,m.resetLoader(f,i),o(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:f,part:C,networkDetails:W}))},onTimeout:function(I,F,W){m.resetLoader(f,i),o(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:f,part:C,networkDetails:W}))}})})},s.updateStatsFromPart=function(f,C){var v=f.stats,m=C.stats,_=m.total;if(v.loaded+=m.loaded,_){var x=Math.round(f.duration/C.duration),d=Math.min(Math.round(v.loaded/_),x),h=x-d,o=h*Math.round(v.loaded/d);v.total=v.loaded+o}else v.total=Math.max(v.loaded,v.total);var i=v.loading,g=m.loading;i.start?i.first+=g.first-g.start:(i.start=g.start,i.first=g.first),i.end=g.end},s.resetLoader=function(f,C){f.loader=null,this.loader===C&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),C.destroy()},c}();function y(c,s){s===void 0&&(s=null);var u=s||c,f={frag:c,part:s,responseType:"arraybuffer",url:u.url,headers:{},rangeStart:0,rangeEnd:0},C=u.byteRangeStartOffset,v=u.byteRangeEndOffset;return Object(Z.isFiniteNumber)(C)&&Object(Z.isFiniteNumber)(v)&&(f.rangeStart=C,f.rangeEnd=v),f}var b=function(c){O(s,c);function s(u){for(var f,C=arguments.length,v=new Array(C>1?C-1:0),m=1;m<C;m++)v[m-1]=arguments[m];return f=c.call.apply(c,[this].concat(v))||this,f.data=void 0,f.data=u,f}return s}(j(Error))},"./src/loader/fragment.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"ElementaryStreamTypes",function(){return w}),R.d(X,"BaseSegment",function(){return y}),R.d(X,"Fragment",function(){return b}),R.d(X,"Part",function(){return c});var Z=R("./src/polyfills/number.ts"),U=R("./node_modules/url-toolkit/src/url-toolkit.js"),O=R.n(U),j=R("./src/utils/logger.ts"),B=R("./src/loader/level-key.ts"),k=R("./src/loader/load-stats.ts");function D(s,u){s.prototype=Object.create(u.prototype),s.prototype.constructor=s,E(s,u)}function E(s,u){return E=Object.setPrototypeOf||function(C,v){return C.__proto__=v,C},E(s,u)}function A(s,u){for(var f=0;f<u.length;f++){var C=u[f];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(s,C.key,C)}}function P(s,u,f){return u&&A(s.prototype,u),f&&A(s,f),s}var w;(function(s){s.AUDIO="audio",s.VIDEO="video",s.AUDIOVIDEO="audiovideo"})(w||(w={}));var y=function(){function s(f){var C;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(C={},C[w.AUDIO]=null,C[w.VIDEO]=null,C[w.AUDIOVIDEO]=null,C),this.baseurl=f}var u=s.prototype;return u.setByteRange=function(C,v){var m=C.split("@",2),_=[];m.length===1?_[0]=v?v.byteRangeEndOffset:0:_[0]=parseInt(m[1]),_[1]=parseInt(m[0])+_[0],this._byteRange=_},P(s,[{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(U.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(C){this._url=C}}]),s}(),b=function(s){D(u,s);function u(C,v){var m;return m=s.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 k.LoadStats,m.urlId=0,m.data=void 0,m.bitrateTest=!1,m.title=null,m.initSegment=null,m.type=C,m}var f=u.prototype;return f.createInitializationVector=function(v){for(var m=new Uint8Array(16),_=12;_<16;_++)m[_]=v>>8*(15-_)&255;return m},f.setDecryptDataFromLevelKey=function(v,m){var _=v;return(v==null?void 0:v.method)==="AES-128"&&v.uri&&!v.iv&&(_=B.LevelKey.fromURI(v.uri),_.method=v.method,_.iv=this.createInitializationVector(m),_.keyFormat="identity"),_},f.setElementaryStreamInfo=function(v,m,_,x,d,h){h===void 0&&(h=!1);var o=this.elementaryStreams,i=o[v];if(!i){o[v]={startPTS:m,endPTS:_,startDTS:x,endDTS:d,partial:h};return}i.startPTS=Math.min(i.startPTS,m),i.endPTS=Math.max(i.endPTS,_),i.startDTS=Math.min(i.startDTS,x),i.endDTS=Math.max(i.endDTS,d)},f.clearElementaryStreamInfo=function(){var v=this.elementaryStreams;v[w.AUDIO]=null,v[w.VIDEO]=null,v[w.AUDIOVIDEO]=null},P(u,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var v=this.sn;typeof v!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&j.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(Z.isFiniteNumber)(this.programDateTime))return null;var v=Object(Z.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+v*1e3}},{key:"encrypted",get:function(){var v;return!!((v=this.decryptdata)!==null&&v!==void 0&&v.keyFormat&&this.decryptdata.uri)}}]),u}(y),c=function(s){D(u,s);function u(f,C,v,m,_){var x;x=s.call(this,v)||this,x.fragOffset=0,x.duration=0,x.gap=!1,x.independent=!1,x.relurl=void 0,x.fragment=void 0,x.index=void 0,x.stats=new k.LoadStats,x.duration=f.decimalFloatingPoint("DURATION"),x.gap=f.bool("GAP"),x.independent=f.bool("INDEPENDENT"),x.relurl=f.enumeratedString("URI"),x.fragment=C,x.index=m;var d=f.enumeratedString("BYTERANGE");return d&&x.setByteRange(d,_),_&&(x.fragOffset=_.fragOffset+_.duration),x}return P(u,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var C=this.elementaryStreams;return!!(C.audio||C.video||C.audiovideo)}}]),u}(y)},"./src/loader/key-loader.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"default",function(){return j});var Z=R("./src/events.ts"),U=R("./src/errors.ts"),O=R("./src/utils/logger.ts"),j=function(){function B(D){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=D,this._registerListeners()}var k=B.prototype;return k._registerListeners=function(){this.hls.on(Z.Events.KEY_LOADING,this.onKeyLoading,this)},k._unregisterListeners=function(){this.hls.off(Z.Events.KEY_LOADING,this.onKeyLoading)},k.destroy=function(){this._unregisterListeners();for(var E in this.loaders){var A=this.loaders[E];A&&A.destroy()}this.loaders={}},k.onKeyLoading=function(E,A){var P=A.frag,w=P.type,y=this.loaders[w];if(!P.decryptdata){O.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var b=P.decryptdata.uri;if(b!==this.decrypturl||this.decryptkey===null){var c=this.hls.config;if(y&&(O.logger.warn("abort previous key loader for type:"+w),y.abort()),!b){O.logger.warn("key uri is falsy");return}var s=c.loader,u=P.loader=this.loaders[w]=new s(c);this.decrypturl=b,this.decryptkey=null;var f={url:b,frag:P,responseType:"arraybuffer"},C={timeout:c.fragLoadingTimeOut,maxRetry:0,retryDelay:c.fragLoadingRetryDelay,maxRetryDelay:c.fragLoadingMaxRetryTimeout,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(f,C,v)}else this.decryptkey&&(P.decryptdata.key=this.decryptkey,this.hls.trigger(Z.Events.KEY_LOADED,{frag:P}))},k.loadsuccess=function(E,A,P){var w=P.frag;if(!w.decryptdata){O.logger.error("after key load, decryptdata unset");return}this.decryptkey=w.decryptdata.key=new Uint8Array(E.data),w.loader=null,delete this.loaders[w.type],this.hls.trigger(Z.Events.KEY_LOADED,{frag:w})},k.loaderror=function(E,A){var P=A.frag,w=P.loader;w&&w.abort(),delete this.loaders[P.type],this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:P,response:E})},k.loadtimeout=function(E,A){var P=A.frag,w=P.loader;w&&w.abort(),delete this.loaders[P.type],this.hls.trigger(Z.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:P})},B}()},"./src/loader/level-details.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"LevelDetails",function(){return B});var Z=R("./src/polyfills/number.ts");function U(k,D){for(var E=0;E<D.length;E++){var A=D[E];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(k,A.key,A)}}function O(k,D,E){return D&&U(k.prototype,D),E&&U(k,E),k}var j=10,B=function(){function k(E){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=E}var D=k.prototype;return D.reloaded=function(A){if(!A){this.advanced=!0,this.updated=!0;return}var P=this.lastPartSn-A.lastPartSn,w=this.lastPartIndex-A.lastPartIndex;this.updated=this.endSN!==A.endSN||!!w||!!P,this.advanced=this.endSN>A.endSN||P>0||P===0&&w>0,this.updated||this.advanced?this.misses=Math.floor(A.misses*.6):this.misses=A.misses+1,this.availabilityDelay=A.availabilityDelay},O(k,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Z.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||j}},{key:"drift",get:function(){var A=this.driftEndTime-this.driftStartTime;if(A>0){var P=this.driftEnd-this.driftStart;return P*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}}]),k}()},"./src/loader/level-key.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"LevelKey",function(){return B});var Z=R("./node_modules/url-toolkit/src/url-toolkit.js"),U=R.n(Z);function O(k,D){for(var E=0;E<D.length;E++){var A=D[E];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(k,A.key,A)}}function j(k,D,E){return D&&O(k.prototype,D),E&&O(k,E),k}var B=function(){k.fromURL=function(E,A){return new k(E,A)},k.fromURI=function(E){return new k(E)};function k(D,E){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,E?this._uri=Object(Z.buildAbsoluteURL)(D,E,{alwaysNormalize:!0}):this._uri=D}return j(k,[{key:"uri",get:function(){return this._uri}}]),k}()},"./src/loader/load-stats.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"LoadStats",function(){return Z});var Z=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(ce,X,R){"use strict";R.r(X),R.d(X,"default",function(){return u});var Z=R("./src/polyfills/number.ts"),U=R("./node_modules/url-toolkit/src/url-toolkit.js"),O=R.n(U),j=R("./src/loader/fragment.ts"),B=R("./src/loader/level-details.ts"),k=R("./src/loader/level-key.ts"),D=R("./src/utils/attr-list.ts"),E=R("./src/utils/logger.ts"),A=R("./src/utils/codecs.ts"),P=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,w=/#EXT-X-MEDIA:(.*)/g,y=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),b=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),c=/\.(mp4|m4s|m4v|m4a)$/i;function s(_){var x,d;return c.test((x=(d=U.parseURL(_))===null||d===void 0?void 0:d.path)!=null?x:"")}var u=function(){function _(){}return _.findGroup=function(d,h){for(var o=0;o<d.length;o++){var i=d[o];if(i.id===h)return i}},_.convertAVC1ToAVCOTI=function(d){var h=d.split(".");if(h.length>2){var o=h.shift()+".";return o+=parseInt(h.shift()).toString(16),o+=("000"+parseInt(h.shift()).toString(16)).substr(-4),o}return d},_.resolve=function(d,h){return U.buildAbsoluteURL(h,d,{alwaysNormalize:!0})},_.parseMasterPlaylist=function(d,h){var o=[],i={},g=!1;P.lastIndex=0;for(var l;(l=P.exec(d))!=null;)if(l[1]){var T=new D.AttrList(l[1]),I={attrs:T,bitrate:T.decimalInteger("AVERAGE-BANDWIDTH")||T.decimalInteger("BANDWIDTH"),name:T.NAME,url:_.resolve(l[2],h)},F=T.decimalResolution("RESOLUTION");F&&(I.width=F.width,I.height=F.height),f((T.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),I),I.videoCodec&&I.videoCodec.indexOf("avc1")!==-1&&(I.videoCodec=_.convertAVC1ToAVCOTI(I.videoCodec)),o.push(I)}else if(l[3]){var W=new D.AttrList(l[3]);W["DATA-ID"]&&(g=!0,i[W["DATA-ID"]]=W)}return{levels:o,sessionData:g?i:null}},_.parseMasterPlaylistMedia=function(d,h,o,i){i===void 0&&(i=[]);var g,l=[],T=0;for(w.lastIndex=0;(g=w.exec(d))!==null;){var I=new D.AttrList(g[1]);if(I.TYPE===o){var F={attrs:I,bitrate:0,id:T++,groupId:I["GROUP-ID"],instreamId:I["INSTREAM-ID"],name:I.NAME||I.LANGUAGE||"",type:o,default:I.bool("DEFAULT"),autoselect:I.bool("AUTOSELECT"),forced:I.bool("FORCED"),lang:I.LANGUAGE,url:I.URI?_.resolve(I.URI,h):""};if(i.length){var W=_.findGroup(i,F.groupId)||i[0];C(F,W,"audioCodec"),C(F,W,"textCodec")}l.push(F)}}return l},_.parseLevelPlaylist=function(d,h,o,i,g){var l=new B.LevelDetails(h),T=l.fragments,I=null,F=0,W=0,V=0,M=0,N=null,J=new j.Fragment(i,h),ae,ue,ve,Te=-1,_e=!1;for(y.lastIndex=0,l.m3u8=d;(ae=y.exec(d))!==null;){_e&&(_e=!1,J=new j.Fragment(i,h),J.start=V,J.sn=F,J.cc=M,J.level=o,I&&(J.initSegment=I,J.rawProgramDateTime=I.rawProgramDateTime));var fe=ae[1];if(fe){J.duration=parseFloat(fe);var ne=(" "+ae[2]).slice(1);J.title=ne||null,J.tagList.push(ne?["INF",fe,ne]:["INF",fe])}else if(ae[3])Object(Z.isFiniteNumber)(J.duration)&&(J.start=V,ve&&(J.levelkey=ve),J.sn=F,J.level=o,J.cc=M,J.urlId=g,T.push(J),J.relurl=(" "+ae[3]).slice(1),m(J,N),N=J,V+=J.duration,F++,W=0,_e=!0);else if(ae[4]){var me=(" "+ae[4]).slice(1);N?J.setByteRange(me,N):J.setByteRange(me)}else if(ae[5])J.rawProgramDateTime=(" "+ae[5]).slice(1),J.tagList.push(["PROGRAM-DATE-TIME",J.rawProgramDateTime]),Te===-1&&(Te=T.length);else{if(ae=ae[0].match(b),!ae){E.logger.warn("No matches on slow regex match for level playlist!");continue}for(ue=1;ue<ae.length&&!(typeof ae[ue]!="undefined");ue++);var ie=(" "+ae[ue]).slice(1),le=(" "+ae[ue+1]).slice(1),q=ae[ue+2]?(" "+ae[ue+2]).slice(1):"";switch(ie){case"PLAYLIST-TYPE":l.type=le.toUpperCase();break;case"MEDIA-SEQUENCE":F=l.startSN=parseInt(le);break;case"SKIP":{var re=new D.AttrList(le),oe=re.decimalInteger("SKIPPED-SEGMENTS");if(Object(Z.isFiniteNumber)(oe)){l.skippedSegments=oe;for(var ge=oe;ge--;)T.unshift(null);F+=oe}var Se=re.enumeratedString("RECENTLY-REMOVED-DATERANGES");Se&&(l.recentlyRemovedDateranges=Se.split(" "));break}case"TARGETDURATION":l.targetduration=parseFloat(le);break;case"VERSION":l.version=parseInt(le);break;case"EXTM3U":break;case"ENDLIST":l.live=!1;break;case"#":(le||q)&&J.tagList.push(q?[le,q]:[le]);break;case"DIS":M++;case"GAP":J.tagList.push([ie]);break;case"BITRATE":J.tagList.push([ie,le]);break;case"DISCONTINUITY-SEQ":M=parseInt(le);break;case"KEY":{var Ee,Re=new D.AttrList(le),Pe=Re.enumeratedString("METHOD"),Ue=Re.URI,He=Re.hexadecimalInteger("IV"),Fe=Re.enumeratedString("KEYFORMATVERSIONS"),Ne=Re.enumeratedString("KEYID"),qe=(Ee=Re.enumeratedString("KEYFORMAT"))!=null?Ee:"identity",Je=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Je.indexOf(qe)>-1){E.logger.warn("Keyformat "+qe+" is not supported from the manifest");continue}else if(qe!=="identity")continue;Pe&&(ve=k.LevelKey.fromURL(h,Ue),Ue&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Pe)>=0&&(ve.method=Pe,ve.keyFormat=qe,Ne&&(ve.keyID=Ne),Fe&&(ve.keyFormatVersions=Fe),ve.iv=He));break}case"START":{var it=new D.AttrList(le),rt=it.decimalFloatingPoint("TIME-OFFSET");Object(Z.isFiniteNumber)(rt)&&(l.startTimeOffset=rt);break}case"MAP":{var ht=new D.AttrList(le);J.relurl=ht.URI,ht.BYTERANGE&&J.setByteRange(ht.BYTERANGE),J.level=o,J.sn="initSegment",ve&&(J.levelkey=ve),J.initSegment=null,I=J,_e=!0;break}case"SERVER-CONTROL":{var ft=new D.AttrList(le);l.canBlockReload=ft.bool("CAN-BLOCK-RELOAD"),l.canSkipUntil=ft.optionalFloat("CAN-SKIP-UNTIL",0),l.canSkipDateRanges=l.canSkipUntil>0&&ft.bool("CAN-SKIP-DATERANGES"),l.partHoldBack=ft.optionalFloat("PART-HOLD-BACK",0),l.holdBack=ft.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var ke=new D.AttrList(le);l.partTarget=ke.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Le=l.partList;Le||(Le=l.partList=[]);var Ge=W>0?Le[Le.length-1]:void 0,Ke=W++,Me=new j.Part(new D.AttrList(le),J,h,Ke,Ge);Le.push(Me),J.duration+=Me.duration;break}case"PRELOAD-HINT":{var je=new D.AttrList(le);l.preloadHint=je;break}case"RENDITION-REPORT":{var xe=new D.AttrList(le);l.renditionReports=l.renditionReports||[],l.renditionReports.push(xe);break}default:E.logger.warn("line parsed but not handled: "+ae);break}}}N&&!N.relurl?(T.pop(),V-=N.duration,l.partList&&(l.fragmentHint=N)):l.partList&&(m(J,N),J.cc=M,l.fragmentHint=J);var pe=T.length,be=T[0],te=T[pe-1];if(V+=l.skippedSegments*l.targetduration,V>0&&pe&&te){l.averagetargetduration=V/pe;var de=te.sn;l.endSN=de!=="initSegment"?de:0,be&&(l.startCC=be.cc,be.initSegment||l.fragments.every(function(he){return he.relurl&&s(he.relurl)})&&(E.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),J=new j.Fragment(i,h),J.relurl=te.relurl,J.level=o,J.sn="initSegment",be.initSegment=J,l.needSidxRanges=!0))}else l.endSN=0,l.startCC=0;return l.fragmentHint&&(V+=l.fragmentHint.duration),l.totalduration=V,l.endCC=M,Te>0&&v(T,Te),l},_}();function f(_,x){["video","audio","text"].forEach(function(d){var h=_.filter(function(i){return Object(A.isCodecType)(i,d)});if(h.length){var o=h.filter(function(i){return i.lastIndexOf("avc1",0)===0||i.lastIndexOf("mp4a",0)===0});x[d+"Codec"]=o.length>0?o[0]:h[0],_=_.filter(function(i){return h.indexOf(i)===-1})}}),x.unknownCodecs=_}function C(_,x,d){var h=x[d];h&&(_[d]=h)}function v(_,x){for(var d=_[x],h=x;h--;){var o=_[h];if(!o)return;o.programDateTime=d.programDateTime-o.duration*1e3,d=o}}function m(_,x){_.rawProgramDateTime?_.programDateTime=Date.parse(_.rawProgramDateTime):x!=null&&x.programDateTime&&(_.programDateTime=x.endProgramDateTime),Object(Z.isFiniteNumber)(_.programDateTime)||(_.programDateTime=null,_.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ce,X,R){"use strict";R.r(X);var Z=R("./src/polyfills/number.ts"),U=R("./src/events.ts"),O=R("./src/errors.ts"),j=R("./src/utils/logger.ts"),B=R("./src/utils/mp4-tools.ts"),k=R("./src/loader/m3u8-parser.ts"),D=R("./src/types/loader.ts"),E=R("./src/utils/attr-list.ts");function A(y){var b=y.type;switch(b){case D.PlaylistContextType.AUDIO_TRACK:return D.PlaylistLevelType.AUDIO;case D.PlaylistContextType.SUBTITLE_TRACK:return D.PlaylistLevelType.SUBTITLE;default:return D.PlaylistLevelType.MAIN}}function P(y,b){var c=y.url;return(c===void 0||c.indexOf("data:")===0)&&(c=b.url),c}var w=function(){function y(c){this.hls=void 0,this.loaders=Object.create(null),this.hls=c,this.registerListeners()}var b=y.prototype;return b.registerListeners=function(){var s=this.hls;s.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(U.Events.LEVEL_LOADING,this.onLevelLoading,this),s.on(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),s.on(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},b.unregisterListeners=function(){var s=this.hls;s.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(U.Events.LEVEL_LOADING,this.onLevelLoading,this),s.off(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),s.off(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},b.createInternalLoader=function(s){var u=this.hls.config,f=u.pLoader,C=u.loader,v=f||C,m=new v(u);return s.loader=m,this.loaders[s.type]=m,m},b.getInternalLoader=function(s){return this.loaders[s.type]},b.resetInternalLoader=function(s){this.loaders[s]&&delete this.loaders[s]},b.destroyInternalLoaders=function(){for(var s in this.loaders){var u=this.loaders[s];u&&u.destroy(),this.resetInternalLoader(s)}},b.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},b.onManifestLoading=function(s,u){var f=u.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:D.PlaylistContextType.MANIFEST,url:f,deliveryDirectives:null})},b.onLevelLoading=function(s,u){var f=u.id,C=u.level,v=u.url,m=u.deliveryDirectives;this.load({id:f,groupId:null,level:C,responseType:"text",type:D.PlaylistContextType.LEVEL,url:v,deliveryDirectives:m})},b.onAudioTrackLoading=function(s,u){var f=u.id,C=u.groupId,v=u.url,m=u.deliveryDirectives;this.load({id:f,groupId:C,level:null,responseType:"text",type:D.PlaylistContextType.AUDIO_TRACK,url:v,deliveryDirectives:m})},b.onSubtitleTrackLoading=function(s,u){var f=u.id,C=u.groupId,v=u.url,m=u.deliveryDirectives;this.load({id:f,groupId:C,level:null,responseType:"text",type:D.PlaylistContextType.SUBTITLE_TRACK,url:v,deliveryDirectives:m})},b.load=function(s){var u,f=this.hls.config,C=this.getInternalLoader(s);if(C){var v=C.context;if(v&&v.url===s.url){j.logger.trace("[playlist-loader]: playlist request ongoing");return}j.logger.log("[playlist-loader]: aborting previous loader for type: "+s.type),C.abort()}var m,_,x,d;switch(s.type){case D.PlaylistContextType.MANIFEST:m=f.manifestLoadingMaxRetry,_=f.manifestLoadingTimeOut,x=f.manifestLoadingRetryDelay,d=f.manifestLoadingMaxRetryTimeout;break;case D.PlaylistContextType.LEVEL:case D.PlaylistContextType.AUDIO_TRACK:case D.PlaylistContextType.SUBTITLE_TRACK:m=0,_=f.levelLoadingTimeOut;break;default:m=f.levelLoadingMaxRetry,_=f.levelLoadingTimeOut,x=f.levelLoadingRetryDelay,d=f.levelLoadingMaxRetryTimeout;break}if(C=this.createInternalLoader(s),(u=s.deliveryDirectives)!==null&&u!==void 0&&u.part){var h;if(s.type===D.PlaylistContextType.LEVEL&&s.level!==null?h=this.hls.levels[s.level].details:s.type===D.PlaylistContextType.AUDIO_TRACK&&s.id!==null?h=this.hls.audioTracks[s.id].details:s.type===D.PlaylistContextType.SUBTITLE_TRACK&&s.id!==null&&(h=this.hls.subtitleTracks[s.id].details),h){var o=h.partTarget,i=h.targetduration;o&&i&&(_=Math.min(Math.max(o*3,i*.8)*1e3,_))}}var g={timeout:_,maxRetry:m,retryDelay:x,maxRetryDelay:d,highWaterMark:0},l={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};C.load(s,g,l)},b.loadsuccess=function(s,u,f,C){if(C===void 0&&(C=null),f.isSidxRequest){this.handleSidxRequest(s,f),this.handlePlaylistLoaded(s,u,f,C);return}this.resetInternalLoader(f.type);var v=s.data;if(v.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(s,f,"no EXTM3U delimiter",C);return}u.parsing.start=performance.now(),v.indexOf("#EXTINF:")>0||v.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(s,u,f,C):this.handleMasterPlaylist(s,u,f,C)},b.loaderror=function(s,u,f){f===void 0&&(f=null),this.handleNetworkError(u,f,!1,s)},b.loadtimeout=function(s,u,f){f===void 0&&(f=null),this.handleNetworkError(u,f,!0)},b.handleMasterPlaylist=function(s,u,f,C){var v=this.hls,m=s.data,_=P(s,f),x=k.default.parseMasterPlaylist(m,_),d=x.levels,h=x.sessionData;if(!d.length){this.handleManifestParsingError(s,f,"no level found in manifest",C);return}var o=d.map(function(F){return{id:F.attrs.AUDIO,audioCodec:F.audioCodec}}),i=d.map(function(F){return{id:F.attrs.SUBTITLES,textCodec:F.textCodec}}),g=k.default.parseMasterPlaylistMedia(m,_,"AUDIO",o),l=k.default.parseMasterPlaylistMedia(m,_,"SUBTITLES",i),T=k.default.parseMasterPlaylistMedia(m,_,"CLOSED-CAPTIONS");if(g.length){var I=g.some(function(F){return!F.url});!I&&d[0].audioCodec&&!d[0].attrs.AUDIO&&(j.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new E.AttrList({}),bitrate:0,url:""}))}v.trigger(U.Events.MANIFEST_LOADED,{levels:d,audioTracks:g,subtitles:l,captions:T,url:_,stats:u,networkDetails:C,sessionData:h})},b.handleTrackOrLevelPlaylist=function(s,u,f,C){var v=this.hls,m=f.id,_=f.level,x=f.type,d=P(s,f),h=Object(Z.isFiniteNumber)(m)?m:0,o=Object(Z.isFiniteNumber)(_)?_:h,i=A(f),g=k.default.parseLevelPlaylist(s.data,d,o,i,h);if(!g.fragments.length){v.trigger(U.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:d,reason:"no fragments found in level",level:typeof f.level=="number"?f.level:void 0});return}if(x===D.PlaylistContextType.MANIFEST){var l={attrs:new E.AttrList({}),bitrate:0,details:g,name:"",url:d};v.trigger(U.Events.MANIFEST_LOADED,{levels:[l],audioTracks:[],url:d,stats:u,networkDetails:C,sessionData:null})}if(u.parsing.end=performance.now(),g.needSidxRanges){var T,I=(T=g.fragments[0].initSegment)===null||T===void 0?void 0:T.url;this.load({url:I,isSidxRequest:!0,type:x,level:_,levelDetails:g,id:m,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}f.levelDetails=g,this.handlePlaylistLoaded(s,u,f,C)},b.handleSidxRequest=function(s,u){var f=Object(B.parseSegmentIndex)(new Uint8Array(s.data));if(!f)return;var C=f.references,v=u.levelDetails;C.forEach(function(m,_){var x=m.info,d=v.fragments[_];d.byteRange.length===0&&d.setByteRange(String(1+x.end-x.start)+"@"+String(x.start)),d.initSegment&&d.initSegment.setByteRange(String(f.moovEndOffset)+"@0")})},b.handleManifestParsingError=function(s,u,f,C){this.hls.trigger(U.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:u.type===D.PlaylistContextType.MANIFEST,url:s.url,reason:f,response:s,context:u,networkDetails:C})},b.handleNetworkError=function(s,u,f,C){f===void 0&&(f=!1),j.logger.warn("[playlist-loader]: A network "+(f?"timeout":"error")+" occurred while loading "+s.type+" level: "+s.level+" id: "+s.id+' group-id: "'+s.groupId+'"');var v=O.ErrorDetails.UNKNOWN,m=!1,_=this.getInternalLoader(s);switch(s.type){case D.PlaylistContextType.MANIFEST:v=f?O.ErrorDetails.MANIFEST_LOAD_TIMEOUT:O.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case D.PlaylistContextType.LEVEL:v=f?O.ErrorDetails.LEVEL_LOAD_TIMEOUT:O.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case D.PlaylistContextType.AUDIO_TRACK:v=f?O.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:O.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case D.PlaylistContextType.SUBTITLE_TRACK:v=f?O.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:O.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}_&&this.resetInternalLoader(s.type);var x={type:O.ErrorTypes.NETWORK_ERROR,details:v,fatal:m,url:s.url,loader:_,context:s,networkDetails:u};C&&(x.response=C),this.hls.trigger(U.Events.ERROR,x)},b.handlePlaylistLoaded=function(s,u,f,C){var v=f.type,m=f.level,_=f.id,x=f.groupId,d=f.loader,h=f.levelDetails,o=f.deliveryDirectives;if(!(h!=null&&h.targetduration)){this.handleManifestParsingError(s,f,"invalid target duration",C);return}if(!d)return;h.live&&(d.getCacheAge&&(h.ageHeader=d.getCacheAge()||0),(!d.getCacheAge||isNaN(h.ageHeader))&&(h.ageHeader=0));switch(v){case D.PlaylistContextType.MANIFEST:case D.PlaylistContextType.LEVEL:this.hls.trigger(U.Events.LEVEL_LOADED,{details:h,level:m||0,id:_||0,stats:u,networkDetails:C,deliveryDirectives:o});break;case D.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(U.Events.AUDIO_TRACK_LOADED,{details:h,id:_||0,groupId:x||"",stats:u,networkDetails:C,deliveryDirectives:o});break;case D.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(U.Events.SUBTITLE_TRACK_LOADED,{details:h,id:_||0,groupId:x||"",stats:u,networkDetails:C,deliveryDirectives:o});break}},y}();X.default=w},"./src/polyfills/number.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"isFiniteNumber",function(){return Z}),R.d(X,"MAX_SAFE_INTEGER",function(){return U});var Z=Number.isFinite||function(O){return typeof O=="number"&&isFinite(O)},U=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ce,X,R){"use strict";R.r(X);var Z=function(){function U(){}return U.getSilentFrame=function(j,B){switch(j){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},U}();X.default=Z},"./src/remux/mp4-generator.ts":function(ce,X,R){"use strict";R.r(X);var Z=Math.pow(2,32)-1,U=function(){function O(){}return O.init=function(){O.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 O.types)O.types.hasOwnProperty(B)&&(O.types[B]=[B.charCodeAt(0),B.charCodeAt(1),B.charCodeAt(2),B.charCodeAt(3)]);var k=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),D=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);O.HDLR_TYPES={video:k,audio:D};var E=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),A=new Uint8Array([0,0,0,0,0,0,0,0]);O.STTS=O.STSC=O.STCO=A,O.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),O.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),O.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),O.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var P=new Uint8Array([105,115,111,109]),w=new Uint8Array([97,118,99,49]),y=new Uint8Array([0,0,0,1]);O.FTYP=O.box(O.types.ftyp,P,y,P,w),O.DINF=O.box(O.types.dinf,O.box(O.types.dref,E))},O.box=function(B){for(var k=8,D=arguments.length,E=new Array(D>1?D-1:0),A=1;A<D;A++)E[A-1]=arguments[A];for(var P=E.length,w=P;P--;)k+=E[P].byteLength;var y=new Uint8Array(k);for(y[0]=k>>24&255,y[1]=k>>16&255,y[2]=k>>8&255,y[3]=k&255,y.set(B,4),P=0,k=8;P<w;P++)y.set(E[P],k),k+=E[P].byteLength;return y},O.hdlr=function(B){return O.box(O.types.hdlr,O.HDLR_TYPES[B])},O.mdat=function(B){return O.box(O.types.mdat,B)},O.mdhd=function(B,k){k*=B;var D=Math.floor(k/(Z+1)),E=Math.floor(k%(Z+1));return O.box(O.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,D>>24,D>>16&255,D>>8&255,D&255,E>>24,E>>16&255,E>>8&255,E&255,85,196,0,0]))},O.mdia=function(B){return O.box(O.types.mdia,O.mdhd(B.timescale,B.duration),O.hdlr(B.type),O.minf(B))},O.mfhd=function(B){return O.box(O.types.mfhd,new Uint8Array([0,0,0,0,B>>24,B>>16&255,B>>8&255,B&255]))},O.minf=function(B){return B.type==="audio"?O.box(O.types.minf,O.box(O.types.smhd,O.SMHD),O.DINF,O.stbl(B)):O.box(O.types.minf,O.box(O.types.vmhd,O.VMHD),O.DINF,O.stbl(B))},O.moof=function(B,k,D){return O.box(O.types.moof,O.mfhd(B),O.traf(D,k))},O.moov=function(B){for(var k=B.length,D=[];k--;)D[k]=O.trak(B[k]);return O.box.apply(null,[O.types.moov,O.mvhd(B[0].timescale,B[0].duration)].concat(D).concat(O.mvex(B)))},O.mvex=function(B){for(var k=B.length,D=[];k--;)D[k]=O.trex(B[k]);return O.box.apply(null,[O.types.mvex].concat(D))},O.mvhd=function(B,k){k*=B;var D=Math.floor(k/(Z+1)),E=Math.floor(k%(Z+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,D>>24,D>>16&255,D>>8&255,D&255,E>>24,E>>16&255,E>>8&255,E&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return O.box(O.types.mvhd,A)},O.sdtp=function(B){var k=B.samples||[],D=new Uint8Array(4+k.length),E,A;for(E=0;E<k.length;E++)A=k[E].flags,D[E+4]=A.dependsOn<<4|A.isDependedOn<<2|A.hasRedundancy;return O.box(O.types.sdtp,D)},O.stbl=function(B){return O.box(O.types.stbl,O.stsd(B),O.box(O.types.stts,O.STTS),O.box(O.types.stsc,O.STSC),O.box(O.types.stsz,O.STSZ),O.box(O.types.stco,O.STCO))},O.avc1=function(B){var k=[],D=[],E,A,P;for(E=0;E<B.sps.length;E++)A=B.sps[E],P=A.byteLength,k.push(P>>>8&255),k.push(P&255),k=k.concat(Array.prototype.slice.call(A));for(E=0;E<B.pps.length;E++)A=B.pps[E],P=A.byteLength,D.push(P>>>8&255),D.push(P&255),D=D.concat(Array.prototype.slice.call(A));var w=O.box(O.types.avcC,new Uint8Array([1,k[3],k[4],k[5],252|3,224|B.sps.length].concat(k).concat([B.pps.length]).concat(D))),y=B.width,b=B.height,c=B.pixelRatio[0],s=B.pixelRatio[1];return O.box(O.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,y>>8&255,y&255,b>>8&255,b&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),w,O.box(O.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),O.box(O.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,c&255,s>>24,s>>16&255,s>>8&255,s&255])))},O.esds=function(B){var k=B.config.length;return new Uint8Array([0,0,0,0,3,23+k,0,1,0,4,15+k,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([k]).concat(B.config).concat([6,1,2]))},O.mp4a=function(B){var k=B.samplerate;return O.box(O.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,k>>8&255,k&255,0,0]),O.box(O.types.esds,O.esds(B)))},O.mp3=function(B){var k=B.samplerate;return O.box(O.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,k>>8&255,k&255,0,0]))},O.stsd=function(B){return B.type==="audio"?!B.isAAC&&B.codec==="mp3"?O.box(O.types.stsd,O.STSD,O.mp3(B)):O.box(O.types.stsd,O.STSD,O.mp4a(B)):O.box(O.types.stsd,O.STSD,O.avc1(B))},O.tkhd=function(B){var k=B.id,D=B.duration*B.timescale,E=B.width,A=B.height,P=Math.floor(D/(Z+1)),w=Math.floor(D%(Z+1));return O.box(O.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,w>>24,w>>16&255,w>>8&255,w&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,E>>8&255,E&255,0,0,A>>8&255,A&255,0,0]))},O.traf=function(B,k){var D=O.sdtp(B),E=B.id,A=Math.floor(k/(Z+1)),P=Math.floor(k%(Z+1));return O.box(O.types.traf,O.box(O.types.tfhd,new Uint8Array([0,0,0,0,E>>24,E>>16&255,E>>8&255,E&255])),O.box(O.types.tfdt,new Uint8Array([1,0,0,0,A>>24,A>>16&255,A>>8&255,A&255,P>>24,P>>16&255,P>>8&255,P&255])),O.trun(B,D.length+16+20+8+16+8+8),D)},O.trak=function(B){return B.duration=B.duration||4294967295,O.box(O.types.trak,O.tkhd(B),O.mdia(B))},O.trex=function(B){var k=B.id;return O.box(O.types.trex,new Uint8Array([0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},O.trun=function(B,k){var D=B.samples||[],E=D.length,A=12+16*E,P=new Uint8Array(A),w,y,b,c,s,u;for(k+=8+A,P.set([0,0,15,1,E>>>24&255,E>>>16&255,E>>>8&255,E&255,k>>>24&255,k>>>16&255,k>>>8&255,k&255],0),w=0;w<E;w++)y=D[w],b=y.duration,c=y.size,s=y.flags,u=y.cts,P.set([b>>>24&255,b>>>16&255,b>>>8&255,b&255,c>>>24&255,c>>>16&255,c>>>8&255,c&255,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.paddingValue<<1|s.isNonSync,s.degradPrio&240<<8,s.degradPrio&15,u>>>24&255,u>>>16&255,u>>>8&255,u&255],12+16*w);return O.box(O.types.trun,P)},O.initSegment=function(B){O.types||O.init();var k=O.moov(B),D=new Uint8Array(O.FTYP.byteLength+k.byteLength);return D.set(O.FTYP),D.set(k,O.FTYP.byteLength),D},O}();U.types=void 0,U.HDLR_TYPES=void 0,U.STTS=void 0,U.STSC=void 0,U.STCO=void 0,U.STSZ=void 0,U.VMHD=void 0,U.SMHD=void 0,U.STSD=void 0,U.FTYP=void 0,U.DINF=void 0,X.default=U},"./src/remux/mp4-remuxer.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"default",function(){return u}),R.d(X,"normalizePts",function(){return f});var Z=R("./src/polyfills/number.ts"),U=R("./src/remux/aac-helper.ts"),O=R("./src/remux/mp4-generator.ts"),j=R("./src/events.ts"),B=R("./src/errors.ts"),k=R("./src/utils/logger.ts"),D=R("./src/types/loader.ts"),E=R("./src/utils/timescale-conversion.ts");function A(){return A=Object.assign||function(_){for(var x=1;x<arguments.length;x++){var d=arguments[x];for(var h in d)Object.prototype.hasOwnProperty.call(d,h)&&(_[h]=d[h])}return _},A.apply(this,arguments)}var P=10*1e3,w=1024,y=1152,b=null,c=null,s=!1,u=function(){function _(d,h,o,i){if(i===void 0&&(i=""),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=d,this.config=h,this.typeSupported=o,this.ISGenerated=!1,b===null){var g=navigator.userAgent||"",l=g.match(/Chrome\/(\d+)/i);b=l?parseInt(l[1]):0}if(c===null){var T=navigator.userAgent.match(/Safari\/(\d+)/i);c=T?parseInt(T[1]):0}s=!!b&&b<75||!!c&&c<600}var x=_.prototype;return x.destroy=function(){},x.resetTimeStamp=function(h){k.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=h},x.resetNextTimestamp=function(){k.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},x.resetInitSegment=function(){k.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},x.getVideoStartPts=function(h){var o=!1,i=h.reduce(function(g,l){var T=l.pts-g;return T<-4294967296?(o=!0,f(g,l.pts)):T>0?g:l.pts},h[0].pts);return o&&k.logger.debug("PTS rollover detected"),i},x.remux=function(h,o,i,g,l,T,I,F){var W,V,M,N,J,ae,ue=l,ve=l,Te=h.pid>-1,_e=o.pid>-1,fe=o.samples.length,ne=h.samples.length>0,me=fe>1,ie=(!Te||ne)&&(!_e||me)||this.ISGenerated||I;if(ie){this.ISGenerated||(M=this.generateIS(h,o,l));var le=this.isVideoContiguous,q=-1;if(me&&(q=C(o.samples),!le&&this.config.forceKeyFrameOnDiscontinuity))if(ae=!0,q>0){k.logger.warn("[mp4-remuxer]: Dropped "+q+" out of "+fe+" video samples due to a missing keyframe");var re=this.getVideoStartPts(o.samples);o.samples=o.samples.slice(q),o.dropped+=q,ve+=(o.samples[0].pts-re)/(o.timescale||9e4)}else q===-1&&(k.logger.warn("[mp4-remuxer]: No keyframe found out of "+fe+" video samples"),ae=!1);if(this.ISGenerated){if(ne&&me){var oe=this.getVideoStartPts(o.samples),ge=f(h.samples[0].pts,oe)-oe,Se=ge/o.inputTimeScale;ue+=Math.max(0,Se),ve+=Math.max(0,-Se)}if(ne){if(h.samplerate||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),M=this.generateIS(h,o,l)),V=this.remuxAudio(h,ue,this.isAudioContiguous,T,_e||me||F===D.PlaylistLevelType.AUDIO?ve:void 0),me){var Ee=V?V.endPTS-V.startPTS:0;o.inputTimeScale||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),M=this.generateIS(h,o,l)),W=this.remuxVideo(o,ve,le,Ee)}}else me&&(W=this.remuxVideo(o,ve,le,0));W&&(W.firstKeyFrame=q,W.independent=q!==-1)}}return this.ISGenerated&&(i.samples.length&&(J=this.remuxID3(i,l)),g.samples.length&&(N=this.remuxText(g,l))),{audio:V,video:W,initSegment:M,independent:ae,text:N,id3:J}},x.generateIS=function(h,o,i){var g=h.samples,l=o.samples,T=this.typeSupported,I={},F=!Object(Z.isFiniteNumber)(this._initPTS),W="audio/mp4",V,M,N;if(F&&(V=M=Infinity),h.config&&g.length&&(h.timescale=h.samplerate,h.isAAC||(T.mpeg?(W="audio/mpeg",h.codec=""):T.mp3&&(h.codec="mp3")),I.audio={id:"audio",container:W,codec:h.codec,initSegment:!h.isAAC&&T.mpeg?new Uint8Array(0):O.default.initSegment([h]),metadata:{channelCount:h.channelCount}},F&&(N=h.inputTimeScale,V=M=g[0].pts-Math.round(N*i))),o.sps&&o.pps&&l.length&&(o.timescale=o.inputTimeScale,I.video={id:"main",container:"video/mp4",codec:o.codec,initSegment:O.default.initSegment([o]),metadata:{width:o.width,height:o.height}},F)){N=o.inputTimeScale;var J=this.getVideoStartPts(l),ae=Math.round(N*i);M=Math.min(M,f(l[0].dts,J)-ae),V=Math.min(V,J-ae)}if(Object.keys(I).length)return this.ISGenerated=!0,F&&(this._initPTS=V,this._initDTS=M),{tracks:I,initPTS:V,timescale:N}},x.remuxVideo=function(h,o,i,g){var l=h.inputTimeScale,T=h.samples,I=[],F=T.length,W=this._initPTS,V=this.nextAvcDts,M=8,N,J,ae,ue=Number.POSITIVE_INFINITY,ve=Number.NEGATIVE_INFINITY,Te=0,_e=!1;if(!i||V===null){var fe=o*l,ne=T[0].pts-f(T[0].dts,T[0].pts);V=fe-ne}for(var me=0;me<F;me++){var ie=T[me];if(ie.pts=f(ie.pts-W,V),ie.dts=f(ie.dts-W,V),ie.dts>ie.pts){var le=9e4*.2;Te=Math.max(Math.min(Te,ie.pts-ie.dts),-1*le)}ie.dts<T[me>0?me-1:me].dts&&(_e=!0)}_e&&T.sort(function(dt,ct){var at=dt.dts-ct.dts,Dt=dt.pts-ct.pts;return at||Dt}),J=T[0].dts,ae=T[T.length-1].dts;var q=Math.round((ae-J)/(F-1));if(Te<0){if(Te<q*-2){k.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(E.toMsFromMpegTsClock)(-q,!0)+" ms");for(var re=Te,oe=0;oe<F;oe++)T[oe].dts=re=Math.max(re,T[oe].pts-q),T[oe].pts=Math.max(re,T[oe].pts)}else{k.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(E.toMsFromMpegTsClock)(Te,!0)+" ms to overcome this issue");for(var ge=0;ge<F;ge++)T[ge].dts=T[ge].dts+Te}J=T[0].dts}if(i){var Se=J-V,Ee=Se>q,Re=Se<-1;if(Ee||Re){Ee?k.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(Se,!0)+" ms ("+Se+"dts) hole between fragments detected, filling it"):k.logger.warn("AVC: "+Object(E.toMsFromMpegTsClock)(-Se,!0)+" ms ("+Se+"dts) overlapping between fragments detected"),J=V;var Pe=T[0].pts-Se;T[0].dts=J,T[0].pts=Pe,k.logger.log("Video: First PTS/DTS adjusted: "+Object(E.toMsFromMpegTsClock)(Pe,!0)+"/"+Object(E.toMsFromMpegTsClock)(J,!0)+", delta: "+Object(E.toMsFromMpegTsClock)(Se,!0)+" ms")}}s&&(J=Math.max(0,J));for(var Ue=0,He=0,Fe=0;Fe<F;Fe++){for(var Ne=T[Fe],qe=Ne.units,Je=qe.length,it=0,rt=0;rt<Je;rt++)it+=qe[rt].data.length;He+=it,Ue+=Je,Ne.length=it,Ne.dts=Math.max(Ne.dts,J),Ne.pts=Math.max(Ne.pts,Ne.dts,0),ue=Math.min(Ne.pts,ue),ve=Math.max(Ne.pts,ve)}ae=T[F-1].dts;var ht=He+4*Ue+8,ft;try{ft=new Uint8Array(ht)}catch(dt){this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:B.ErrorTypes.MUX_ERROR,details:B.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ht,reason:"fail allocating video mdat "+ht});return}var ke=new DataView(ft.buffer);ke.setUint32(0,ht),ft.set(O.default.types.mdat,4);for(var Le=0;Le<F;Le++){for(var Ge=T[Le],Ke=Ge.units,Me=0,je=0,xe=Ke.length;je<xe;je++){var pe=Ke[je],be=pe.data,te=pe.data.byteLength;ke.setUint32(M,te),M+=4,ft.set(be,M),M+=te,Me+=4+te}if(Le<F-1)N=T[Le+1].dts-Ge.dts;else{var de=this.config,he=Ge.dts-T[Le>0?Le-1:Le].dts;if(de.stretchShortVideoTrack&&this.nextAudioPts!==null){var ye=Math.floor(de.maxBufferHole*l),De=(g?ue+g*l:this.nextAudioPts)-Ge.pts;De>ye?(N=De-he,N<0&&(N=he),k.logger.log("[mp4-remuxer]: It is approximately "+De/90+" ms to the next segment; using duration "+N/90+" ms for the last video frame.")):N=he}else N=he}var we=Math.round(Ge.pts-Ge.dts);I.push(new v(Ge.key,N,Me,we))}if(I.length&&b&&b<70){var We=I[0].flags;We.dependsOn=2,We.isNonSync=0}console.assert(N!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=ae+N,this.isVideoContiguous=!0;var Qe=O.default.moof(h.sequenceNumber++,J,A({},h,{samples:I})),nt="video",Ve={data1:Qe,data2:ft,startPTS:ue/l,endPTS:(ve+N)/l,startDTS:J/l,endDTS:V/l,type:nt,hasAudio:!1,hasVideo:!0,nb:I.length,dropped:h.dropped};return h.samples=[],h.dropped=0,console.assert(ft.length,"MDAT length must not be zero"),Ve},x.remuxAudio=function(h,o,i,g,l){var T=h.inputTimeScale,I=h.samplerate?h.samplerate:T,F=T/I,W=h.isAAC?w:y,V=W*F,M=this._initPTS,N=!h.isAAC&&this.typeSupported.mpeg,J=[],ae=h.samples,ue=N?0:8,ve=this.nextAudioPts||-1,Te=o*T;if(this.isAudioContiguous=i=i||ae.length&&ve>0&&(g&&Math.abs(Te-ve)<9e3||Math.abs(f(ae[0].pts-M,Te)-ve)<20*V),ae.forEach(function(be){be.pts=f(be.pts-M,Te)}),!i||ve<0){if(ae=ae.filter(function(be){return be.pts>=0}),!ae.length)return;l===0?ve=0:g?ve=Math.max(0,Te):ve=ae[0].pts}if(h.isAAC)for(var _e=l!==void 0,fe=this.config.maxAudioFramesDrift,ne=0,me=ve;ne<ae.length;ne++){var ie=ae[ne],le=ie.pts,q=le-me,re=Math.abs(1e3*q/T);if(q<=-fe*V&&_e)ne===0&&(k.logger.warn("Audio frame @ "+(le/T).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*q/T)+" ms."),this.nextAudioPts=ve=me=le);else if(q>=fe*V&&re<P&&_e){var oe=Math.round(q/V);me=le-oe*V,me<0&&(oe--,me+=V),ne===0&&(this.nextAudioPts=ve=me),k.logger.warn("[mp4-remuxer]: Injecting "+oe+" audio frame @ "+(me/T).toFixed(3)+"s due to "+Math.round(1e3*q/T)+" ms gap.");for(var ge=0;ge<oe;ge++){var Se=Math.max(me,0),Ee=U.default.getSilentFrame(h.manifestCodec||h.codec,h.channelCount);Ee||(k.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Ee=ie.unit.subarray()),ae.splice(ne,0,{unit:Ee,pts:Se}),me+=V,ne++}}ie.pts=me,me+=V}for(var Re=null,Pe=null,Ue,He=0,Fe=ae.length;Fe--;)He+=ae[Fe].unit.byteLength;for(var Ne=0,qe=ae.length;Ne<qe;Ne++){var Je=ae[Ne],it=Je.unit,rt=Je.pts;if(Pe!==null){var ht=J[Ne-1];ht.duration=Math.round((rt-Pe)/F)}else if(i&&h.isAAC&&(rt=ve),Re=rt,He>0){He+=ue;try{Ue=new Uint8Array(He)}catch(be){this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:B.ErrorTypes.MUX_ERROR,details:B.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:He,reason:"fail allocating audio mdat "+He});return}if(!N){var ft=new DataView(Ue.buffer);ft.setUint32(0,He),Ue.set(O.default.types.mdat,4)}}else return;Ue.set(it,ue);var ke=it.byteLength;ue+=ke,J.push(new v(!0,W,ke,0)),Pe=rt}var Le=J.length;if(!Le)return;var Ge=J[J.length-1];this.nextAudioPts=ve=Pe+F*Ge.duration;var Ke=N?new Uint8Array(0):O.default.moof(h.sequenceNumber++,Re/F,A({},h,{samples:J}));h.samples=[];var Me=Re/T,je=ve/T,xe="audio",pe={data1:Ke,data2:Ue,startPTS:Me,endPTS:je,startDTS:Me,endDTS:je,type:xe,hasAudio:!0,hasVideo:!1,nb:Le};return this.isAudioContiguous=!0,console.assert(Ue.length,"MDAT length must not be zero"),pe},x.remuxEmptyAudio=function(h,o,i,g){var l=h.inputTimeScale,T=h.samplerate?h.samplerate:l,I=l/T,F=this.nextAudioPts,W=(F!==null?F:g.startDTS*l)+this._initDTS,V=g.endDTS*l+this._initDTS,M=I*w,N=Math.ceil((V-W)/M),J=U.default.getSilentFrame(h.manifestCodec||h.codec,h.channelCount);if(k.logger.warn("[mp4-remuxer]: remux empty Audio"),!J){k.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ae=[],ue=0;ue<N;ue++){var ve=W+ue*M;ae.push({unit:J,pts:ve,dts:ve})}return h.samples=ae,this.remuxAudio(h,o,i,!1)},x.remuxID3=function(h,o){var i=h.samples.length;if(!i)return;for(var g=h.inputTimeScale,l=this._initPTS,T=this._initDTS,I=0;I<i;I++){var F=h.samples[I];F.pts=f(F.pts-l,o*g)/g,F.dts=f(F.dts-T,o*g)/g}var W=h.samples;return h.samples=[],{samples:W}},x.remuxText=function(h,o){var i=h.samples.length;if(!i)return;for(var g=h.inputTimeScale,l=this._initPTS,T=0;T<i;T++){var I=h.samples[T];I.pts=f(I.pts-l,o*g)/g}h.samples.sort(function(W,V){return W.pts-V.pts});var F=h.samples;return h.samples=[],{samples:F}},_}();function f(_,x){var d;if(x===null)return _;for(x<_?d=-8589934592:d=8589934592;Math.abs(_-x)>4294967296;)_+=d;return _}function C(_){for(var x=0;x<_.length;x++)if(_[x].key)return x;return-1}var v=function(x,d,h,o){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=d,this.size=h,this.cts=o,this.flags=new m(x)},m=function(x){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=x?2:1,this.isNonSync=x?0:1}},"./src/remux/passthrough-remuxer.ts":function(ce,X,R){"use strict";R.r(X);var Z=R("./src/polyfills/number.ts"),U=R("./src/utils/mp4-tools.ts"),O=R("./src/loader/fragment.ts"),j=R("./src/utils/logger.ts"),B=function(){function E(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var A=E.prototype;return A.destroy=function(){},A.resetTimeStamp=function(w){this.initPTS=w,this.lastEndDTS=null},A.resetNextTimestamp=function(){this.lastEndDTS=null},A.resetInitSegment=function(w,y,b){this.audioCodec=y,this.videoCodec=b,this.generateInitSegment(w),this.emitInitSegment=!0},A.generateInitSegment=function(w){var y=this.audioCodec,b=this.videoCodec;if(!w||!w.byteLength){this.initTracks=void 0,this.initData=void 0;return}var c=this.initData=Object(U.parseInitSegment)(w);y||(y=D(c.audio,O.ElementaryStreamTypes.AUDIO)),b||(b=D(c.video,O.ElementaryStreamTypes.VIDEO));var s={};c.audio&&c.video?s.audiovideo={container:"video/mp4",codec:y+","+b,initSegment:w,id:"main"}:c.audio?s.audio={container:"audio/mp4",codec:y,initSegment:w,id:"audio"}:c.video?s.video={container:"video/mp4",codec:b,initSegment:w,id:"main"}:j.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=s},A.remux=function(w,y,b,c,s){var u=this.initPTS,f=this.lastEndDTS,C={audio:void 0,video:void 0,text:c,id3:b,initSegment:void 0};Object(Z.isFiniteNumber)(f)||(f=this.lastEndDTS=s||0);var v=y.samples;if(!v||!v.length)return C;var m={initPTS:void 0,timescale:1},_=this.initData;if((!_||!_.length)&&(this.generateInitSegment(v),_=this.initData),!_||!_.length)return j.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),C;this.emitInitSegment&&(m.tracks=this.initTracks,this.emitInitSegment=!1),Object(Z.isFiniteNumber)(u)||(this.initPTS=m.initPTS=u=k(_,v,f));var x=Object(U.getDuration)(v,_),d=f,h=x+d;Object(U.offsetStartDTS)(_,v,u),x>0?this.lastEndDTS=h:(j.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var o=!!_.audio,i=!!_.video,g="";o&&(g+="audio"),i&&(g+="video");var l={data1:v,startPTS:d,startDTS:d,endPTS:h,endDTS:h,type:g,hasAudio:o,hasVideo:i,nb:1,dropped:0};return C.audio=l.type==="audio"?l:void 0,C.video=l.type!=="audio"?l:void 0,C.text=c,C.id3=b,C.initSegment=m,C},E}(),k=function(A,P,w){return Object(U.getStartDTS)(A,P)-w};function D(E,A){var P=E==null?void 0:E.codec;return P&&P.length>4?P:P==="hvc1"?"hvc1.1.c.L120.90":P==="av01"?"av01.0.04M.08":P==="avc1"||A===O.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}X.default=B},"./src/task-loop.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"default",function(){return Z});var Z=function(){function U(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var O=U.prototype;return O.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},O.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},O.onHandlerDestroyed=function(){},O.hasInterval=function(){return!!this._tickInterval},O.hasNextTick=function(){return!!this._tickTimer},O.setInterval=function(B){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,B),!0)},O.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},O.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},O.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},O.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},O.doTick=function(){},U}()},"./src/types/cmcd.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"CMCDVersion",function(){return Z}),R.d(X,"CMCDObjectType",function(){return U}),R.d(X,"CMCDStreamingFormat",function(){return O}),R.d(X,"CMCDStreamType",function(){return j});var Z=1,U;(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"})(U||(U={}));var O;(function(B){B.DASH="d",B.HLS="h",B.SMOOTH="s",B.OTHER="o"})(O||(O={}));var j;(function(B){B.VOD="v",B.LIVE="l"})(j||(j={}))},"./src/types/level.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"HlsSkip",function(){return O}),R.d(X,"getSkipValue",function(){return j}),R.d(X,"HlsUrlParameters",function(){return B}),R.d(X,"Level",function(){return k});function Z(D,E){for(var A=0;A<E.length;A++){var P=E[A];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(D,P.key,P)}}function U(D,E,A){return E&&Z(D.prototype,E),A&&Z(D,A),D}var O;(function(D){D.No="",D.Yes="YES",D.v2="v2"})(O||(O={}));function j(D,E){var A=D.canSkipUntil,P=D.canSkipDateRanges,w=D.endSN,y=E!==void 0?E-w:0;return A&&y<A?P?O.v2:O.Yes:O.No}var B=function(){function D(A,P,w){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=A,this.part=P,this.skip=w}var E=D.prototype;return E.addDirectives=function(P){var w=new self.URL(P);return this.msn!==void 0&&w.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&w.searchParams.set("_HLS_part",this.part.toString()),this.skip&&w.searchParams.set("_HLS_skip",this.skip),w.toString()},D}(),k=function(){function D(E){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[E.url],this.attrs=E.attrs,this.bitrate=E.bitrate,E.details&&(this.details=E.details),this.id=E.id||0,this.name=E.name,this.width=E.width||0,this.height=E.height||0,this.audioCodec=E.audioCodec,this.videoCodec=E.videoCodec,this.unknownCodecs=E.unknownCodecs,this.codecSet=[E.videoCodec,E.audioCodec].filter(function(A){return A}).join(",").replace(/\.[^.,]+/g,"")}return U(D,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(A){var P=A%this.url.length;this._urlId!==P&&(this.details=void 0,this._urlId=P)}}]),D}()},"./src/types/loader.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"PlaylistContextType",function(){return Z}),R.d(X,"PlaylistLevelType",function(){return U});var Z;(function(O){O.MANIFEST="manifest",O.LEVEL="level",O.AUDIO_TRACK="audioTrack",O.SUBTITLE_TRACK="subtitleTrack"})(Z||(Z={}));var U;(function(O){O.MAIN="main",O.AUDIO="audio",O.SUBTITLE="subtitle"})(U||(U={}))},"./src/types/transmuxer.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"ChunkMetadata",function(){return Z});var Z=function(j,B,k,D,E,A){D===void 0&&(D=0),E===void 0&&(E=-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=U(),this.buffering={audio:U(),video:U(),audiovideo:U()},this.level=j,this.sn=B,this.id=k,this.size=D,this.part=E,this.partial=A};function U(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"AttrList",function(){return O});var Z=/^(\d+)x(\d+)$/,U=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,O=function(){function j(k){typeof k=="string"&&(k=j.parseAttrList(k));for(var D in k)k.hasOwnProperty(D)&&(this[D]=k[D])}var B=j.prototype;return B.decimalInteger=function(D){var E=parseInt(this[D],10);return E>Number.MAX_SAFE_INTEGER?Infinity:E},B.hexadecimalInteger=function(D){if(this[D]){var E=(this[D]||"0x").slice(2);E=(E.length&1?"0":"")+E;for(var A=new Uint8Array(E.length/2),P=0;P<E.length/2;P++)A[P]=parseInt(E.slice(P*2,P*2+2),16);return A}else return null},B.hexadecimalIntegerAsNumber=function(D){var E=parseInt(this[D],16);return E>Number.MAX_SAFE_INTEGER?Infinity:E},B.decimalFloatingPoint=function(D){return parseFloat(this[D])},B.optionalFloat=function(D,E){var A=this[D];return A?parseFloat(A):E},B.enumeratedString=function(D){return this[D]},B.bool=function(D){return this[D]==="YES"},B.decimalResolution=function(D){var E=Z.exec(this[D]);return E===null?void 0:{width:parseInt(E[1],10),height:parseInt(E[2],10)}},j.parseAttrList=function(D){var E,A={},P='"';for(U.lastIndex=0;(E=U.exec(D))!==null;){var w=E[2];w.indexOf(P)===0&&w.lastIndexOf(P)===w.length-1&&(w=w.slice(1,-1)),A[E[1]]=w}return A},j}()},"./src/utils/binary-search.ts":function(ce,X,R){"use strict";R.r(X);var Z={search:function(O,j){for(var B=0,k=O.length-1,D=null,E=null;B<=k;){D=(B+k)/2|0,E=O[D];var A=j(E);if(A>0)B=D+1;else if(A<0)k=D-1;else return E}return null}};X.default=Z},"./src/utils/buffer-helper.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"BufferHelper",function(){return O});var Z=R("./src/utils/logger.ts"),U={length:0,start:function(){return 0},end:function(){return 0}},O=function(){function j(){}return j.isBuffered=function(k,D){try{if(k){for(var E=j.getBuffered(k),A=0;A<E.length;A++)if(D>=E.start(A)&&D<=E.end(A))return!0}}catch(P){}return!1},j.bufferInfo=function(k,D,E){try{if(k){var A=j.getBuffered(k),P=[],w;for(w=0;w<A.length;w++)P.push({start:A.start(w),end:A.end(w)});return this.bufferedInfo(P,D,E)}}catch(y){}return{len:0,start:D,end:D,nextStart:void 0}},j.bufferedInfo=function(k,D,E){D=Math.max(0,D),k.sort(function(m,_){var x=m.start-_.start;return x||_.end-m.end});var A=[];if(E)for(var P=0;P<k.length;P++){var w=A.length;if(w){var y=A[w-1].end;k[P].start-y<E?k[P].end>y&&(A[w-1].end=k[P].end):A.push(k[P])}else A.push(k[P])}else A=k;for(var b=0,c,s=D,u=D,f=0;f<A.length;f++){var C=A[f].start,v=A[f].end;if(D+E>=C&&D<v)s=C,u=v,b=u-D;else if(D+E<C){c=C;break}}return{len:b,start:s||0,end:u||0,nextStart:c}},j.getBuffered=function(k){try{return k.buffered}catch(D){return Z.logger.log("failed to get media.buffered",D),U}},j}()},"./src/utils/cea-608-parser.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"Row",function(){return u}),R.d(X,"CaptionScreen",function(){return f});var Z=R("./src/utils/logger.ts"),U={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},O=function(h){var o=h;return U.hasOwnProperty(h)&&(o=U[h]),String.fromCharCode(o)},j=15,B=100,k={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},D={17:2,18:4,21:6,22:8,23:10,19:13,20:15},E={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},A={25:2,26:4,29:6,30:8,31:10,27:13,28:15},P=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],w;(function(d){d[d.ERROR=0]="ERROR",d[d.TEXT=1]="TEXT",d[d.WARNING=2]="WARNING",d[d.INFO=2]="INFO",d[d.DEBUG=3]="DEBUG",d[d.DATA=3]="DATA"})(w||(w={}));var y=function(){function d(){this.time=null,this.verboseLevel=w.ERROR}var h=d.prototype;return h.log=function(i,g){this.verboseLevel>=i&&Z.logger.log(this.time+" ["+i+"] "+g)},d}(),b=function(h){for(var o=[],i=0;i<h.length;i++)o.push(h[i].toString(16));return o},c=function(){function d(o,i,g,l,T){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=o||"white",this.underline=i||!1,this.italics=g||!1,this.background=l||"black",this.flash=T||!1}var h=d.prototype;return h.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},h.setStyles=function(i){for(var g=["foreground","underline","italics","background","flash"],l=0;l<g.length;l++){var T=g[l];i.hasOwnProperty(T)&&(this[T]=i[T])}},h.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},h.equals=function(i){return this.foreground===i.foreground&&this.underline===i.underline&&this.italics===i.italics&&this.background===i.background&&this.flash===i.flash},h.copy=function(i){this.foreground=i.foreground,this.underline=i.underline,this.italics=i.italics,this.background=i.background,this.flash=i.flash},h.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},d}(),s=function(){function d(o,i,g,l,T,I){this.uchar=void 0,this.penState=void 0,this.uchar=o||" ",this.penState=new c(i,g,l,T,I)}var h=d.prototype;return h.reset=function(){this.uchar=" ",this.penState.reset()},h.setChar=function(i,g){this.uchar=i,this.penState.copy(g)},h.setPenState=function(i){this.penState.copy(i)},h.equals=function(i){return this.uchar===i.uchar&&this.penState.equals(i.penState)},h.copy=function(i){this.uchar=i.uchar,this.penState.copy(i.penState)},h.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},d}(),u=function(){function d(o){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var i=0;i<B;i++)this.chars.push(new s);this.logger=o,this.pos=0,this.currPenState=new c}var h=d.prototype;return h.equals=function(i){for(var g=!0,l=0;l<B;l++)if(!this.chars[l].equals(i.chars[l])){g=!1;break}return g},h.copy=function(i){for(var g=0;g<B;g++)this.chars[g].copy(i.chars[g])},h.isEmpty=function(){for(var i=!0,g=0;g<B;g++)if(!this.chars[g].isEmpty()){i=!1;break}return i},h.setCursor=function(i){this.pos!==i&&(this.pos=i),this.pos<0?(this.logger.log(w.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>B&&(this.logger.log(w.DEBUG,"Too large cursor position "+this.pos),this.pos=B)},h.moveCursor=function(i){var g=this.pos+i;if(i>1)for(var l=this.pos+1;l<g+1;l++)this.chars[l].setPenState(this.currPenState);this.setCursor(g)},h.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},h.insertChar=function(i){i>=144&&this.backSpace();var g=O(i);if(this.pos>=B){this.logger.log(w.ERROR,"Cannot insert "+i.toString(16)+" ("+g+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(g,this.currPenState),this.moveCursor(1)},h.clearFromPos=function(i){var g;for(g=i;g<B;g++)this.chars[g].reset()},h.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},h.clearToEndOfRow=function(){this.clearFromPos(this.pos)},h.getTextString=function(){for(var i=[],g=!0,l=0;l<B;l++){var T=this.chars[l].uchar;T!==" "&&(g=!1),i.push(T)}return g?"":i.join("")},h.setPenStyles=function(i){this.currPenState.setStyles(i);var g=this.chars[this.pos];g.setPenState(this.currPenState)},d}(),f=function(){function d(o){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var i=0;i<j;i++)this.rows.push(new u(o));this.logger=o,this.currRow=j-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var h=d.prototype;return h.reset=function(){for(var i=0;i<j;i++)this.rows[i].clear();this.currRow=j-1},h.equals=function(i){for(var g=!0,l=0;l<j;l++)if(!this.rows[l].equals(i.rows[l])){g=!1;break}return g},h.copy=function(i){for(var g=0;g<j;g++)this.rows[g].copy(i.rows[g])},h.isEmpty=function(){for(var i=!0,g=0;g<j;g++)if(!this.rows[g].isEmpty()){i=!1;break}return i},h.backSpace=function(){var i=this.rows[this.currRow];i.backSpace()},h.clearToEndOfRow=function(){var i=this.rows[this.currRow];i.clearToEndOfRow()},h.insertChar=function(i){var g=this.rows[this.currRow];g.insertChar(i)},h.setPen=function(i){var g=this.rows[this.currRow];g.setPenStyles(i)},h.moveCursor=function(i){var g=this.rows[this.currRow];g.moveCursor(i)},h.setCursor=function(i){this.logger.log(w.INFO,"setCursor: "+i);var g=this.rows[this.currRow];g.setCursor(i)},h.setPAC=function(i){this.logger.log(w.INFO,"pacData = "+JSON.stringify(i));var g=i.row-1;if(this.nrRollUpRows&&g<this.nrRollUpRows-1&&(g=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==g){for(var l=0;l<j;l++)this.rows[l].clear();var T=this.currRow+1-this.nrRollUpRows,I=this.lastOutputScreen;if(I){var F=I.rows[T].cueStartTime,W=this.logger.time;if(F&&W!==null&&F<W)for(var V=0;V<this.nrRollUpRows;V++)this.rows[g-this.nrRollUpRows+V+1].copy(I.rows[T+V])}}this.currRow=g;var M=this.rows[this.currRow];if(i.indent!==null){var N=i.indent,J=Math.max(N-1,0);M.setCursor(i.indent),i.color=M.chars[J].penState.foreground}var ae={foreground:i.color,underline:i.underline,italics:i.italics,background:"black",flash:!1};this.setPen(ae)},h.setBkgData=function(i){this.logger.log(w.INFO,"bkgData = "+JSON.stringify(i)),this.backSpace(),this.setPen(i),this.insertChar(32)},h.setRollUpRows=function(i){this.nrRollUpRows=i},h.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(w.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(w.TEXT,this.getDisplayText());var i=this.currRow+1-this.nrRollUpRows,g=this.rows.splice(i,1)[0];g.clear(),this.rows.splice(this.currRow,0,g),this.logger.log(w.INFO,"Rolling up")},h.getDisplayText=function(i){i=i||!1;for(var g=[],l="",T=-1,I=0;I<j;I++){var F=this.rows[I].getTextString();F&&(T=I+1,i?g.push("Row "+T+": '"+F+"'"):g.push(F.trim()))}return g.length>0&&(i?l="["+g.join(" | ")+"]":l=g.join(`
|
|
`)),l},h.getTextAndFormat=function(){return this.rows},d}(),C=function(){function d(o,i,g){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=o,this.outputFilter=i,this.mode=null,this.verbose=0,this.displayedMemory=new f(g),this.nonDisplayedMemory=new f(g),this.lastOutputScreen=new f(g),this.currRollUpRow=this.displayedMemory.rows[j-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=g}var h=d.prototype;return h.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[j-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},h.getHandler=function(){return this.outputFilter},h.setHandler=function(i){this.outputFilter=i},h.setPAC=function(i){this.writeScreen.setPAC(i)},h.setBkgData=function(i){this.writeScreen.setBkgData(i)},h.setMode=function(i){if(i===this.mode)return;this.mode=i,this.logger.log(w.INFO,"MODE="+i),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=i},h.insertChars=function(i){for(var g=0;g<i.length;g++)this.writeScreen.insertChar(i[g]);var l=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(w.INFO,l+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(w.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},h.ccRCL=function(){this.logger.log(w.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},h.ccBS=function(){if(this.logger.log(w.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},h.ccAOF=function(){},h.ccAON=function(){},h.ccDER=function(){this.logger.log(w.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},h.ccRU=function(i){this.logger.log(w.INFO,"RU("+i+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(i)},h.ccFON=function(){this.logger.log(w.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},h.ccRDC=function(){this.logger.log(w.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},h.ccTR=function(){this.logger.log(w.INFO,"TR"),this.setMode("MODE_TEXT")},h.ccRTD=function(){this.logger.log(w.INFO,"RTD"),this.setMode("MODE_TEXT")},h.ccEDM=function(){this.logger.log(w.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},h.ccCR=function(){this.logger.log(w.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},h.ccENM=function(){this.logger.log(w.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},h.ccEOC=function(){if(this.logger.log(w.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var i=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=i,this.writeScreen=this.nonDisplayedMemory,this.logger.log(w.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},h.ccTO=function(i){this.logger.log(w.INFO,"TO("+i+") - Tab Offset"),this.writeScreen.moveCursor(i)},h.ccMIDROW=function(i){var g={flash:!1};if(g.underline=i%2===1,g.italics=i>=46,g.italics)g.foreground="white";else{var l=Math.floor(i/2)-16,T=["white","green","blue","cyan","red","yellow","magenta"];g.foreground=T[l]}this.logger.log(w.INFO,"MIDROW: "+JSON.stringify(g)),this.writeScreen.setPen(g)},h.outputDataUpdate=function(i){i===void 0&&(i=!1);var g=this.logger.time;if(g===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=g:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,g,this.lastOutputScreen),i&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:g),this.lastOutputScreen.copy(this.displayedMemory))},h.cueSplitAtTime=function(i){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,i,this.displayedMemory),this.cueStartTime=i))},d}(),v=function(){function d(o,i,g){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var l=new y;this.channels=[null,new C(o,i,l),new C(o+1,g,l)],this.cmdHistory=x(),this.logger=l}var h=d.prototype;return h.getHandler=function(i){return this.channels[i].getHandler()},h.setHandler=function(i,g){this.channels[i].setHandler(g)},h.addData=function(i,g){var l,T,I,F=!1;this.logger.time=i;for(var W=0;W<g.length;W+=2){if(T=g[W]&127,I=g[W+1]&127,T===0&&I===0)continue;if(this.logger.log(w.DATA,"["+b([g[W],g[W+1]])+"] -> ("+b([T,I])+")"),l=this.parseCmd(T,I),l||(l=this.parseMidrow(T,I)),l||(l=this.parsePAC(T,I)),l||(l=this.parseBackgroundAttributes(T,I)),!l&&(F=this.parseChars(T,I),F)){var V=this.currentChannel;if(V&&V>0){var M=this.channels[V];M.insertChars(F)}else this.logger.log(w.WARNING,"No channel found yet. TEXT-MODE?")}!l&&!F&&this.logger.log(w.WARNING,"Couldn't parse cleaned data "+b([T,I])+" orig: "+b([g[W],g[W+1]]))}},h.parseCmd=function(i,g){var l=this.cmdHistory,T=(i===20||i===28||i===21||i===29)&&g>=32&&g<=47,I=(i===23||i===31)&&g>=33&&g<=35;if(!(T||I))return!1;if(_(i,g,l))return m(null,null,l),this.logger.log(w.DEBUG,"Repeated command ("+b([i,g])+") is dropped"),!0;var F=i===20||i===21||i===23?1:2,W=this.channels[F];return i===20||i===21||i===28||i===29?g===32?W.ccRCL():g===33?W.ccBS():g===34?W.ccAOF():g===35?W.ccAON():g===36?W.ccDER():g===37?W.ccRU(2):g===38?W.ccRU(3):g===39?W.ccRU(4):g===40?W.ccFON():g===41?W.ccRDC():g===42?W.ccTR():g===43?W.ccRTD():g===44?W.ccEDM():g===45?W.ccCR():g===46?W.ccENM():g===47&&W.ccEOC():W.ccTO(g-32),m(i,g,l),this.currentChannel=F,!0},h.parseMidrow=function(i,g){var l=0;if((i===17||i===25)&&g>=32&&g<=47){if(i===17?l=1:l=2,l!==this.currentChannel)return this.logger.log(w.ERROR,"Mismatch channel in midrow parsing"),!1;var T=this.channels[l];return T?(T.ccMIDROW(g),this.logger.log(w.DEBUG,"MIDROW ("+b([i,g])+")"),!0):!1}return!1},h.parsePAC=function(i,g){var l,T=this.cmdHistory,I=(i>=17&&i<=23||i>=25&&i<=31)&&g>=64&&g<=127,F=(i===16||i===24)&&g>=64&&g<=95;if(!(I||F))return!1;if(_(i,g,T))return m(null,null,T),!0;var W=i<=23?1:2;g>=64&&g<=95?l=W===1?k[i]:E[i]:l=W===1?D[i]:A[i];var V=this.channels[W];return V?(V.setPAC(this.interpretPAC(l,g)),m(i,g,T),this.currentChannel=W,!0):!1},h.interpretPAC=function(i,g){var l,T={color:null,italics:!1,indent:null,underline:!1,row:i};return g>95?l=g-96:l=g-64,T.underline=(l&1)===1,l<=13?T.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(l/2)]:l<=15?(T.italics=!0,T.color="white"):T.indent=Math.floor((l-16)/2)*4,T},h.parseChars=function(i,g){var l,T=null,I=null;if(i>=25?(l=2,I=i-8):(l=1,I=i),I>=17&&I<=19){var F;I===17?F=g+80:I===18?F=g+112:F=g+144,this.logger.log(w.INFO,"Special char '"+O(F)+"' in channel "+l),T=[F]}else i>=32&&i<=127&&(T=g===0?[i]:[i,g]);if(T){var W=b(T);this.logger.log(w.DEBUG,"Char codes = "+W.join(",")),m(i,g,this.cmdHistory)}return T},h.parseBackgroundAttributes=function(i,g){var l=(i===16||i===24)&&g>=32&&g<=47,T=(i===23||i===31)&&g>=45&&g<=47;if(!(l||T))return!1;var I,F={};i===16||i===24?(I=Math.floor((g-32)/2),F.background=P[I],g%2===1&&(F.background=F.background+"_semi")):g===45?F.background="transparent":(F.foreground="black",g===47&&(F.underline=!0));var W=i<=23?1:2,V=this.channels[W];return V.setBkgData(F),m(i,g,this.cmdHistory),!0},h.reset=function(){for(var i=0;i<Object.keys(this.channels).length;i++){var g=this.channels[i];g&&g.reset()}this.cmdHistory=x()},h.cueSplitAtTime=function(i){for(var g=0;g<this.channels.length;g++){var l=this.channels[g];l&&l.cueSplitAtTime(i)}},d}();function m(d,h,o){o.a=d,o.b=h}function _(d,h,o){return o.a===d&&o.b===h}function x(){return{a:null,b:null}}X.default=v},"./src/utils/codecs.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"isCodecType",function(){return U}),R.d(X,"isCodecSupportedInMp4",function(){return O});var Z={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 U(j,B){var k=Z[B];return!!k&&k[j.slice(0,4)]===!0}function O(j,B){return MediaSource.isTypeSupported((B||"video")+'/mp4;codecs="'+j+'"')}},"./src/utils/cues.ts":function(ce,X,R){"use strict";R.r(X);var Z=R("./src/utils/vttparser.ts"),U=R("./src/utils/webvtt-parser.ts"),O=R("./src/utils/texttrack-utils.ts"),j=/\s/,B={newCue:function(D,E,A,P){for(var w=[],y,b,c,s,u,f=self.VTTCue||self.TextTrackCue,C=0;C<P.rows.length;C++)if(y=P.rows[C],c=!0,s=0,u="",!y.isEmpty()){for(var v=0;v<y.chars.length;v++)j.test(y.chars[v].uchar)&&c?s++:(u+=y.chars[v].uchar,c=!1);y.cueStartTime=E,E===A&&(A+=1e-4),s>=16?s--:s++;var m=Object(Z.fixLineBreaks)(u.trim()),_=Object(U.generateCueId)(E,A,m);(!D||!D.cues||!D.cues.getCueById(_))&&(b=new f(E,A,m),b.id=_,b.line=C+1,b.align="left",b.position=10+Math.min(80,Math.floor(s*8/32)*10),w.push(b))}return D&&w.length&&(w.sort(function(x,d){return x.line==="auto"||d.line==="auto"?0:x.line>8&&d.line>8?d.line-x.line:x.line-d.line}),w.forEach(function(x){return Object(O.addCueToTrack)(D,x)})),w}};X.default=B},"./src/utils/discontinuities.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"findFirstFragWithCC",function(){return j}),R.d(X,"shouldAlignOnDiscontinuities",function(){return B}),R.d(X,"findDiscontinuousReferenceFrag",function(){return k}),R.d(X,"adjustSlidingStart",function(){return E}),R.d(X,"alignStream",function(){return A}),R.d(X,"alignPDT",function(){return w}),R.d(X,"alignFragmentByPDTDelta",function(){return y}),R.d(X,"alignMediaPlaylistByPDT",function(){return b});var Z=R("./src/polyfills/number.ts"),U=R("./src/utils/logger.ts"),O=R("./src/controller/level-helper.ts");function j(c,s){for(var u=null,f=0,C=c.length;f<C;f++){var v=c[f];if(v&&v.cc===s){u=v;break}}return u}function B(c,s,u){return!!(s.details&&(u.endCC>u.startCC||c&&c.cc<u.startCC))}function k(c,s){var u=c.fragments,f=s.fragments;if(!f.length||!u.length){U.logger.log("No fragments to align");return}var C=j(u,f[0].cc);if(!C||C&&!C.startPTS){U.logger.log("No frag in previous level to align on");return}return C}function D(c,s){if(c){var u=c.start+s;c.start=c.startPTS=u,c.endPTS=u+c.duration}}function E(c,s){for(var u=s.fragments,f=0,C=u.length;f<C;f++)D(u[f],c);s.fragmentHint&&D(s.fragmentHint,c),s.alignedSliding=!0}function A(c,s,u){if(!s)return;P(c,u,s),!u.alignedSliding&&s.details&&w(u,s.details),!u.alignedSliding&&s.details&&!u.skippedSegments&&Object(O.adjustSliding)(s.details,u)}function P(c,s,u){if(B(c,u,s)){var f=k(u.details,s);f&&Object(Z.isFiniteNumber)(f.start)&&(U.logger.log("Adjusting PTS using last level due to CC increase within current level "+s.url),E(f.start,s))}}function w(c,s){if(!s.fragments.length||!c.hasProgramDateTime||!s.hasProgramDateTime)return;var u=s.fragments[0].programDateTime,f=c.fragments[0].programDateTime,C=(f-u)/1e3+s.fragments[0].start;C&&Object(Z.isFiniteNumber)(C)&&(U.logger.log("Adjusting PTS using programDateTime delta "+(f-u)+"ms, sliding:"+C.toFixed(3)+" "+c.url+" "),E(C,c))}function y(c,s){var u=c.programDateTime;if(!u)return;var f=(u-s)/1e3;c.start=c.startPTS=f,c.endPTS=f+c.duration}function b(c,s){if(!s.fragments.length||!c.hasProgramDateTime||!s.hasProgramDateTime)return;var u=s.fragments[0].programDateTime,f=s.fragments[0].start,C=u-f*1e3;c.fragments.forEach(function(v){y(v,C)}),c.fragmentHint&&y(c.fragmentHint,C),c.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ce,X,R){"use strict";R.r(X);var Z=R("./src/utils/ewma.ts"),U=function(){function O(B,k,D){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=D,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Z.default(B),this.fast_=new Z.default(k)}var j=O.prototype;return j.update=function(k,D){var E=this.slow_,A=this.fast_;this.slow_.halfLife!==k&&(this.slow_=new Z.default(k,E.getEstimate(),E.getTotalWeight())),this.fast_.halfLife!==D&&(this.fast_=new Z.default(D,A.getEstimate(),A.getTotalWeight()))},j.sample=function(k,D){k=Math.max(k,this.minDelayMs_);var E=8*D,A=k/1e3,P=E/A;this.fast_.sample(A,P),this.slow_.sample(A,P)},j.canEstimate=function(){var k=this.fast_;return k&&k.getTotalWeight()>=this.minWeight_},j.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},j.destroy=function(){},O}();X.default=U},"./src/utils/ewma.ts":function(ce,X,R){"use strict";R.r(X);var Z=function(){function U(j,B,k){B===void 0&&(B=0),k===void 0&&(k=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=j,this.alpha_=j?Math.exp(Math.log(.5)/j):0,this.estimate_=B,this.totalWeight_=k}var O=U.prototype;return O.sample=function(B,k){var D=Math.pow(this.alpha_,B);this.estimate_=k*(1-D)+D*this.estimate_,this.totalWeight_+=B},O.getTotalWeight=function(){return this.totalWeight_},O.getEstimate=function(){if(this.alpha_){var B=1-Math.pow(this.alpha_,this.totalWeight_);if(B)return this.estimate_/B}return this.estimate_},U}();X.default=Z},"./src/utils/fetch-loader.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"fetchSupported",function(){return y});var Z=R("./src/polyfills/number.ts"),U=R("./src/loader/load-stats.ts"),O=R("./src/demux/chunk-cache.ts");function j(f,C){f.prototype=Object.create(C.prototype),f.prototype.constructor=f,A(f,C)}function B(f){var C=typeof Map=="function"?new Map:void 0;return B=function(m){if(m===null||!E(m))return m;if(typeof m!="function")throw new TypeError("Super expression must either be null or a function");if(typeof C!="undefined"){if(C.has(m))return C.get(m);C.set(m,_)}function _(){return k(m,arguments,P(this).constructor)}return _.prototype=Object.create(m.prototype,{constructor:{value:_,enumerable:!1,writable:!0,configurable:!0}}),A(_,m)},B(f)}function k(f,C,v){return D()?k=Reflect.construct:k=function(_,x,d){var h=[null];h.push.apply(h,x);var o=Function.bind.apply(_,h),i=new o;return d&&A(i,d.prototype),i},k.apply(null,arguments)}function D(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(f){return!1}}function E(f){return Function.toString.call(f).indexOf("[native code]")!==-1}function A(f,C){return A=Object.setPrototypeOf||function(m,_){return m.__proto__=_,m},A(f,C)}function P(f){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(v){return v.__proto__||Object.getPrototypeOf(v)},P(f)}function w(){return w=Object.assign||function(f){for(var C=1;C<arguments.length;C++){var v=arguments[C];for(var m in v)Object.prototype.hasOwnProperty.call(v,m)&&(f[m]=v[m])}return f},w.apply(this,arguments)}function y(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(f){}return!1}var b=function(){function f(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||s,this.controller=new self.AbortController,this.stats=new U.LoadStats}var C=f.prototype;return C.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},C.abortInternal=function(){var m=this.response;(!m||!m.ok)&&(this.stats.aborted=!0,this.controller.abort())},C.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},C.load=function(m,_,x){var d=this,h=this.stats;if(h.loading.start)throw new Error("Loader can only be used once.");h.loading.start=self.performance.now();var o=c(m,this.controller.signal),i=x.onProgress,g=m.responseType==="arraybuffer",l=g?"byteLength":"length";this.context=m,this.config=_,this.callbacks=x,this.request=this.fetchSetup(m,o),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){d.abortInternal(),x.onTimeout(h,m,d.response)},_.timeout),self.fetch(this.request).then(function(T){if(d.response=d.loader=T,!T.ok){var I=T.status,F=T.statusText;throw new u(F||"fetch, bad network response",I,T)}return h.loading.first=Math.max(self.performance.now(),h.loading.start),h.total=parseInt(T.headers.get("Content-Length")||"0"),i&&Object(Z.isFiniteNumber)(_.highWaterMark)?d.loadProgressively(T,h,m,_.highWaterMark,i):g?T.arrayBuffer():T.text()}).then(function(T){var I=d.response;self.clearTimeout(d.requestTimeout),h.loading.end=Math.max(self.performance.now(),h.loading.first),h.loaded=h.total=T[l];var F={url:I.url,data:T};i&&!Object(Z.isFiniteNumber)(_.highWaterMark)&&i(h,m,T,I),x.onSuccess(F,h,m,I)}).catch(function(T){if(self.clearTimeout(d.requestTimeout),h.aborted)return;var I=T.code||0;x.onError({code:I,text:T.message},m,T.details)})},C.getCacheAge=function(){var m=null;if(this.response){var _=this.response.headers.get("age");m=_?parseFloat(_):null}return m},C.loadProgressively=function(m,_,x,d,h){d===void 0&&(d=0);var o=new O.default,i=m.body.getReader(),g=function l(){return i.read().then(function(T){if(T.done)return o.dataLength&&h(_,x,o.flush(),m),Promise.resolve(new ArrayBuffer(0));var I=T.value,F=I.length;return _.loaded+=F,F<d||o.dataLength?(o.push(I),o.dataLength>=d&&h(_,x,o.flush(),m)):h(_,x,I,m),l()}).catch(function(){return Promise.reject()})};return g()},f}();function c(f,C){var v={method:"GET",mode:"cors",credentials:"same-origin",signal:C,headers:new self.Headers(w({},f.headers))};return f.rangeEnd&&v.headers.set("Range","bytes="+f.rangeStart+"-"+String(f.rangeEnd-1)),v}function s(f,C){return new self.Request(f.url,C)}var u=function(f){j(C,f);function C(v,m,_){var x;return x=f.call(this,v)||this,x.code=void 0,x.details=void 0,x.code=m,x.details=_,x}return C}(B(Error));X.default=b},"./src/utils/imsc1-ttml-parser.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"IMSC1_CODEC",function(){return E}),R.d(X,"parseIMSC1",function(){return y});var Z=R("./src/utils/mp4-tools.ts"),U=R("./src/utils/vttparser.ts"),O=R("./src/utils/vttcue.ts"),j=R("./src/demux/id3.ts"),B=R("./src/utils/timescale-conversion.ts"),k=R("./src/utils/webvtt-parser.ts");function D(){return D=Object.assign||function(d){for(var h=1;h<arguments.length;h++){var o=arguments[h];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(d[i]=o[i])}return d},D.apply(this,arguments)}var E="stpp.ttml.im1t",A=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,P=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,w={left:"start",center:"center",right:"end",start:"start",end:"end"};function y(d,h,o,i,g){var l=Object(Z.findBox)(new Uint8Array(d),["mdat"]);if(l.length===0){g(new Error("Could not parse IMSC1 mdat"));return}var T=l[0],I=Object(j.utf8ArrayToStr)(new Uint8Array(d,T.start,T.end-T.start)),F=Object(B.toTimescaleFromScale)(h,1,o);try{i(b(I,F))}catch(W){g(W)}}function b(d,h){var o=new DOMParser,i=o.parseFromString(d,"text/xml"),g=i.getElementsByTagName("tt")[0];if(!g)throw new Error("Invalid ttml");var l={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},T=Object.keys(l).reduce(function(M,N){return M[N]=g.getAttribute("ttp:"+N)||l[N],M},{}),I=g.getAttribute("xml:space")!=="preserve",F=s(c(g,"styling","style")),W=s(c(g,"layout","region")),V=c(g,"body","[begin]");return[].map.call(V,function(M){var N=u(M,I);if(!N||!M.hasAttribute("begin"))return null;var J=m(M.getAttribute("begin"),T),ae=m(M.getAttribute("dur"),T),ue=m(M.getAttribute("end"),T);if(J===null)throw v(M);if(ue===null){if(ae===null)throw v(M);ue=J+ae}var ve=new O.default(J-h,ue-h,N);ve.id=Object(k.generateCueId)(ve.startTime,ve.endTime,ve.text);var Te=W[M.getAttribute("region")],_e=F[M.getAttribute("style")];ve.position=10,ve.size=80;var fe=f(Te,_e),ne=fe.textAlign;if(ne){var me=w[ne];me&&(ve.lineAlign=me),ve.align=ne}return D(ve,fe),ve}).filter(function(M){return M!==null})}function c(d,h,o){var i=d.getElementsByTagName(h)[0];return i?[].slice.call(i.querySelectorAll(o)):[]}function s(d){return d.reduce(function(h,o){var i=o.getAttribute("xml:id");return i&&(h[i]=o),h},{})}function u(d,h){return[].slice.call(d.childNodes).reduce(function(o,i,g){var l;return i.nodeName==="br"&&g?o+`
|
|
`:(l=i.childNodes)!==null&&l!==void 0&&l.length?u(i,h):h?o+i.textContent.trim().replace(/\s+/g," "):o+i.textContent},"")}function f(d,h){var o="http://www.w3.org/ns/ttml#styling",i=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return i.reduce(function(g,l){var T=C(h,o,l)||C(d,o,l);return T&&(g[l]=T),g},{})}function C(d,h,o){return d.hasAttributeNS(h,o)?d.getAttributeNS(h,o):null}function v(d){return new Error("Could not parse ttml timestamp "+d)}function m(d,h){if(!d)return null;var o=Object(U.parseTimeStamp)(d);return o===null&&(A.test(d)?o=_(d,h):P.test(d)&&(o=x(d,h))),o}function _(d,h){var o=A.exec(d),i=(o[4]|0)+(o[5]|0)/h.subFrameRate;return(o[1]|0)*3600+(o[2]|0)*60+(o[3]|0)+i/h.frameRate}function x(d,h){var o=P.exec(d),i=Number(o[1]),g=o[2];switch(g){case"h":return i*3600;case"m":return i*60;case"ms":return i*1e3;case"f":return i/h.frameRate;case"t":return i/h.tickRate}return i}},"./src/utils/logger.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"enableLogs",function(){return k}),R.d(X,"logger",function(){return D});var Z=function(){},U={trace:Z,debug:Z,log:Z,warn:Z,info:Z,error:Z},O=U;function j(E){var A=self.console[E];return A?A.bind(self.console,"["+E+"] >"):Z}function B(E){for(var A=arguments.length,P=new Array(A>1?A-1:0),w=1;w<A;w++)P[w-1]=arguments[w];P.forEach(function(y){O[y]=E[y]?E[y].bind(E):j(y)})}function k(E){if(self.console&&E===!0||typeof E=="object"){B(E,"debug","log","info","warn","error");try{O.log()}catch(A){O=U}}else O=U}var D=O},"./src/utils/mediakeys-helper.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"KeySystems",function(){return Z}),R.d(X,"requestMediaKeySystemAccess",function(){return U});var Z;(function(O){O.WIDEVINE="com.widevine.alpha",O.PLAYREADY="com.microsoft.playready"})(Z||(Z={}));var U=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"getMediaSource",function(){return Z});function Z(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"bin2str",function(){return B}),R.d(X,"readUint16",function(){return k}),R.d(X,"readUint32",function(){return D}),R.d(X,"writeUint32",function(){return E}),R.d(X,"findBox",function(){return A}),R.d(X,"parseSegmentIndex",function(){return P}),R.d(X,"parseInitSegment",function(){return w}),R.d(X,"getStartDTS",function(){return y}),R.d(X,"getDuration",function(){return b}),R.d(X,"computeRawDurationFromSamples",function(){return c}),R.d(X,"offsetStartDTS",function(){return s}),R.d(X,"segmentValidRange",function(){return u}),R.d(X,"appendUint8Array",function(){return f});var Z=R("./src/utils/typed-array.ts"),U=R("./src/loader/fragment.ts"),O=Math.pow(2,32)-1,j=[].push;function B(C){return String.fromCharCode.apply(null,C)}function k(C,v){"data"in C&&(v+=C.start,C=C.data);var m=C[v]<<8|C[v+1];return m<0?65536+m:m}function D(C,v){"data"in C&&(v+=C.start,C=C.data);var m=C[v]<<24|C[v+1]<<16|C[v+2]<<8|C[v+3];return m<0?4294967296+m:m}function E(C,v,m){"data"in C&&(v+=C.start,C=C.data),C[v]=m>>24,C[v+1]=m>>16&255,C[v+2]=m>>8&255,C[v+3]=m&255}function A(C,v){var m=[];if(!v.length)return m;var _,x,d;"data"in C?(_=C.data,x=C.start,d=C.end):(_=C,x=0,d=_.byteLength);for(var h=x;h<d;){var o=D(_,h),i=B(_.subarray(h+4,h+8)),g=o>1?h+o:d;if(i===v[0])if(v.length===1)m.push({data:_,start:h+8,end:g});else{var l=A({data:_,start:h+8,end:g},v.slice(1));l.length&&j.apply(m,l)}h=g}return m}function P(C){var v=A(C,["moov"]),m=v[0],_=m?m.end:null,x=A(C,["sidx"]);if(!x||!x[0])return null;var d=[],h=x[0],o=h.data[0],i=o===0?8:16,g=D(h,i);i+=4;var l=0,T=0;o===0?i+=8:i+=16,i+=2;var I=h.end+T,F=k(h,i);i+=2;for(var W=0;W<F;W++){var V=i,M=D(h,V);V+=4;var N=M&2147483647,J=(M&2147483648)>>>31;if(J===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ae=D(h,V);V+=4,d.push({referenceSize:N,subsegmentDuration:ae,info:{duration:ae/g,start:I,end:I+N-1}}),I+=N,V+=4,i=V}return{earliestPresentationTime:l,timescale:g,version:o,referencesCount:F,references:d,moovEndOffset:_}}function w(C){for(var v=[],m=A(C,["moov","trak"]),_=0;_<m.length;_++){var x=m[_],d=A(x,["tkhd"])[0];if(d){var h=d.data[d.start],o=h===0?12:20,i=D(d,o),g=A(x,["mdia","mdhd"])[0];if(g){h=g.data[g.start],o=h===0?12:20;var l=D(g,o),T=A(x,["mdia","hdlr"])[0];if(T){var I=B(T.data.subarray(T.start+8,T.start+12)),F={soun:U.ElementaryStreamTypes.AUDIO,vide:U.ElementaryStreamTypes.VIDEO}[I];if(F){var W=A(x,["mdia","minf","stbl","stsd"])[0],V=void 0;W&&(V=B(W.data.subarray(W.start+12,W.start+16))),v[i]={timescale:l,type:F},v[F]={timescale:l,id:i,codec:V}}}}}}var M=A(C,["moov","mvex","trex"]);return M.forEach(function(N){var J=D(N,4),ae=v[J];ae&&(ae.default={duration:D(N,12),flags:D(N,20)})}),v}function y(C,v){return A(v,["moof","traf"]).reduce(function(m,_){var x=A(_,["tfdt"])[0],d=x.data[x.start],h=A(_,["tfhd"]).reduce(function(o,i){var g=D(i,4),l=C[g];if(l){var T=D(x,4);d===1&&(T*=Math.pow(2,32),T+=D(x,8));var I=l.timescale||9e4,F=T/I;if(isFinite(F)&&(o===null||F<o))return F}return o},null);return h!==null&&isFinite(h)&&(m===null||h<m)?h:m},null)||0}function b(C,v){for(var m=0,_=0,x=0,d=A(C,["moof","traf"]),h=0;h<d.length;h++){var o=d[h],i=A(o,["tfhd"])[0],g=D(i,4),l=v[g];if(!l)continue;var T=l.default,I=D(i,0)|(T==null?void 0:T.flags),F=T==null?void 0:T.duration;I&8&&(I&2?F=D(i,12):F=D(i,8));for(var W=l.timescale||9e4,V=A(o,["trun"]),M=0;M<V.length;M++){if(F){var N=D(V[M],4);m=F*N}else m=c(V[M]);l.type===U.ElementaryStreamTypes.VIDEO?_+=m/W:l.type===U.ElementaryStreamTypes.AUDIO&&(x+=m/W)}}if(_===0&&x===0){var J=P(C);if(J!=null&&J.references)return J.references.reduce(function(ae,ue){return ae+ue.info.duration||0},0)}return _||x}function c(C){var v=D(C,0),m=8;v&1&&(m+=4),v&4&&(m+=4);for(var _=0,x=D(C,4),d=0;d<x;d++){if(v&256){var h=D(C,m);_+=h,m+=4}v&512&&(m+=4),v&1024&&(m+=4),v&2048&&(m+=4)}return _}function s(C,v,m){A(v,["moof","traf"]).forEach(function(_){A(_,["tfhd"]).forEach(function(x){var d=D(x,4),h=C[d];if(!h)return;var o=h.timescale||9e4;A(_,["tfdt"]).forEach(function(i){var g=i.data[i.start],l=D(i,4);if(g===0)E(i,4,l-m*o);else{l*=Math.pow(2,32),l+=D(i,8),l-=m*o,l=Math.max(l,0);var T=Math.floor(l/(O+1)),I=Math.floor(l%(O+1));E(i,4,T),E(i,8,I)}})})})}function u(C){var v={valid:null,remainder:null},m=A(C,["moof"]);if(m){if(m.length<2)return v.remainder=C,v}else return v;var _=m[m.length-1];return v.valid=Object(Z.sliceUint8)(C,0,_.start-8),v.remainder=Object(Z.sliceUint8)(C,_.start-8),v}function f(C,v){var m=new Uint8Array(C.length+v.length);return m.set(C),m.set(v,C.length),m}},"./src/utils/output-filter.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"default",function(){return Z});var Z=function(){function U(j,B){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=j,this.trackName=B}var O=U.prototype;return O.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},O.newCue=function(B,k,D){(this.startTime===null||this.startTime>B)&&(this.startTime=B),this.endTime=k,this.screen=D,this.timelineController.createCaptionsTrack(this.trackName)},O.reset=function(){this.cueRanges=[]},U}()},"./src/utils/texttrack-utils.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"sendAddTrackEvent",function(){return U}),R.d(X,"addCueToTrack",function(){return O}),R.d(X,"clearCurrentCues",function(){return j}),R.d(X,"removeCuesInRange",function(){return B}),R.d(X,"getCuesInRange",function(){return D});var Z=R("./src/utils/logger.ts");function U(E,A){var P;try{P=new Event("addtrack")}catch(w){P=document.createEvent("Event"),P.initEvent("addtrack",!1,!1)}P.track=E,A.dispatchEvent(P)}function O(E,A){var P=E.mode;if(P==="disabled"&&(E.mode="hidden"),E.cues&&!E.cues.getCueById(A.id))try{if(E.addCue(A),!E.cues.getCueById(A.id))throw new Error("addCue is failed for: "+A)}catch(y){Z.logger.debug("[texttrack-utils]: "+y);var w=new self.TextTrackCue(A.startTime,A.endTime,A.text);w.id=A.id,E.addCue(w)}P==="disabled"&&(E.mode=P)}function j(E){var A=E.mode;if(A==="disabled"&&(E.mode="hidden"),E.cues)for(var P=E.cues.length;P--;)E.removeCue(E.cues[P]);A==="disabled"&&(E.mode=A)}function B(E,A,P){var w=E.mode;if(w==="disabled"&&(E.mode="hidden"),E.cues&&E.cues.length>0)for(var y=D(E.cues,A,P),b=0;b<y.length;b++)E.removeCue(y[b]);w==="disabled"&&(E.mode=w)}function k(E,A){if(A<E[0].startTime)return 0;var P=E.length-1;if(A>E[P].endTime)return-1;for(var w=0,y=P;w<=y;){var b=Math.floor((y+w)/2);if(A<E[b].startTime)y=b-1;else if(A>E[b].startTime&&w<P)w=b+1;else return b}return E[w].startTime-A<A-E[y].startTime?w:y}function D(E,A,P){var w=[],y=k(E,A);if(y>-1)for(var b=y,c=E.length;b<c;b++){var s=E[b];if(s.startTime>=A&&s.endTime<=P)w.push(s);else if(s.startTime>P)return w}return w}},"./src/utils/time-ranges.ts":function(ce,X,R){"use strict";R.r(X);var Z={toString:function(O){for(var j="",B=O.length,k=0;k<B;k++)j+="["+O.start(k).toFixed(3)+","+O.end(k).toFixed(3)+"]";return j}};X.default=Z},"./src/utils/timescale-conversion.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"toTimescaleFromBase",function(){return U}),R.d(X,"toTimescaleFromScale",function(){return O}),R.d(X,"toMsFromMpegTsClock",function(){return j}),R.d(X,"toMpegTsClockFromTimescale",function(){return B});var Z=9e4;function U(k,D,E,A){E===void 0&&(E=1),A===void 0&&(A=!1);var P=k*D*E;return A?Math.round(P):P}function O(k,D,E,A){return E===void 0&&(E=1),A===void 0&&(A=!1),U(k,D,1/E,A)}function j(k,D){return D===void 0&&(D=!1),U(k,1e3,1/Z,D)}function B(k,D){return D===void 0&&(D=1),U(k,Z,1/D)}},"./src/utils/typed-array.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"sliceUint8",function(){return Z});function Z(U,O,j){return Uint8Array.prototype.slice?U.slice(O,j):new Uint8Array(Array.prototype.slice.call(U,O,j))}},"./src/utils/vttcue.ts":function(ce,X,R){"use strict";R.r(X),X.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Z=["","lr","rl"],U=["start","middle","end","left","right"];function O(E,A){if(typeof A!="string")return!1;if(!Array.isArray(E))return!1;var P=A.toLowerCase();return~E.indexOf(P)?P:!1}function j(E){return O(Z,E)}function B(E){return O(U,E)}function k(E){for(var A=arguments.length,P=new Array(A>1?A-1:0),w=1;w<A;w++)P[w-1]=arguments[w];for(var y=1;y<arguments.length;y++){var b=arguments[y];for(var c in b)E[c]=b[c]}return E}function D(E,A,P){var w=this,y={enumerable:!0};w.hasBeenReset=!1;var b="",c=!1,s=E,u=A,f=P,C=null,v="",m=!0,_="auto",x="start",d=50,h="middle",o=50,i="middle";Object.defineProperty(w,"id",k({},y,{get:function(){return b},set:function(l){b=""+l}})),Object.defineProperty(w,"pauseOnExit",k({},y,{get:function(){return c},set:function(l){c=!!l}})),Object.defineProperty(w,"startTime",k({},y,{get:function(){return s},set:function(l){if(typeof l!="number")throw new TypeError("Start time must be set to a number.");s=l,this.hasBeenReset=!0}})),Object.defineProperty(w,"endTime",k({},y,{get:function(){return u},set:function(l){if(typeof l!="number")throw new TypeError("End time must be set to a number.");u=l,this.hasBeenReset=!0}})),Object.defineProperty(w,"text",k({},y,{get:function(){return f},set:function(l){f=""+l,this.hasBeenReset=!0}})),Object.defineProperty(w,"region",k({},y,{get:function(){return C},set:function(l){C=l,this.hasBeenReset=!0}})),Object.defineProperty(w,"vertical",k({},y,{get:function(){return v},set:function(l){var T=j(l);if(T===!1)throw new SyntaxError("An invalid or illegal string was specified.");v=T,this.hasBeenReset=!0}})),Object.defineProperty(w,"snapToLines",k({},y,{get:function(){return m},set:function(l){m=!!l,this.hasBeenReset=!0}})),Object.defineProperty(w,"line",k({},y,{get:function(){return _},set:function(l){if(typeof l!="number"&&l!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");_=l,this.hasBeenReset=!0}})),Object.defineProperty(w,"lineAlign",k({},y,{get:function(){return x},set:function(l){var T=B(l);if(!T)throw new SyntaxError("An invalid or illegal string was specified.");x=T,this.hasBeenReset=!0}})),Object.defineProperty(w,"position",k({},y,{get:function(){return d},set:function(l){if(l<0||l>100)throw new Error("Position must be between 0 and 100.");d=l,this.hasBeenReset=!0}})),Object.defineProperty(w,"positionAlign",k({},y,{get:function(){return h},set:function(l){var T=B(l);if(!T)throw new SyntaxError("An invalid or illegal string was specified.");h=T,this.hasBeenReset=!0}})),Object.defineProperty(w,"size",k({},y,{get:function(){return o},set:function(l){if(l<0||l>100)throw new Error("Size must be between 0 and 100.");o=l,this.hasBeenReset=!0}})),Object.defineProperty(w,"align",k({},y,{get:function(){return i},set:function(l){var T=B(l);if(!T)throw new SyntaxError("An invalid or illegal string was specified.");i=T,this.hasBeenReset=!0}})),w.displayState=void 0}return D.prototype.getCueAsHTML=function(){var E=self.WebVTT;return E.convertCueToDOMTree(self,this.text)},D}()},"./src/utils/vttparser.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"parseTimeStamp",function(){return O}),R.d(X,"fixLineBreaks",function(){return A}),R.d(X,"VTTParser",function(){return P});var Z=R("./src/utils/vttcue.ts"),U=function(){function w(){}var y=w.prototype;return y.decode=function(c,s){if(!c)return"";if(typeof c!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(c))},w}();function O(w){function y(c,s,u,f){return(c|0)*3600+(s|0)*60+(u|0)+parseFloat(f||0)}var b=w.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return b?parseFloat(b[2])>59?y(b[2],b[3],0,b[4]):y(b[1],b[2],b[3],b[4]):null}var j=function(){function w(){this.values=Object.create(null)}var y=w.prototype;return y.set=function(c,s){!this.get(c)&&s!==""&&(this.values[c]=s)},y.get=function(c,s,u){return u?this.has(c)?this.values[c]:s[u]:this.has(c)?this.values[c]:s},y.has=function(c){return c in this.values},y.alt=function(c,s,u){for(var f=0;f<u.length;++f)if(s===u[f]){this.set(c,s);break}},y.integer=function(c,s){/^-?\d+$/.test(s)&&this.set(c,parseInt(s,10))},y.percent=function(c,s){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(s)){var u=parseFloat(s);if(u>=0&&u<=100)return this.set(c,u),!0}return!1},w}();function B(w,y,b,c){var s=c?w.split(c):[w];for(var u in s){if(typeof s[u]!="string")continue;var f=s[u].split(b);if(f.length!==2)continue;var C=f[0],v=f[1];y(C,v)}}var k=new Z.default(0,0,""),D=k.align==="middle"?"middle":"center";function E(w,y,b){var c=w;function s(){var C=O(w);if(C===null)throw new Error("Malformed timestamp: "+c);return w=w.replace(/^[^\sa-zA-Z-]+/,""),C}function u(C,v){var m=new j;B(C,function(d,h){var o;switch(d){case"region":for(var i=b.length-1;i>=0;i--)if(b[i].id===h){m.set(d,b[i].region);break}break;case"vertical":m.alt(d,h,["rl","lr"]);break;case"line":o=h.split(","),m.integer(d,o[0]),m.percent(d,o[0])&&m.set("snapToLines",!1),m.alt(d,o[0],["auto"]),o.length===2&&m.alt("lineAlign",o[1],["start",D,"end"]);break;case"position":o=h.split(","),m.percent(d,o[0]),o.length===2&&m.alt("positionAlign",o[1],["start",D,"end","line-left","line-right","auto"]);break;case"size":m.percent(d,h);break;case"align":m.alt(d,h,["start",D,"end","left","right"]);break}},/:/,/\s/),v.region=m.get("region",null),v.vertical=m.get("vertical","");var _=m.get("line","auto");_==="auto"&&k.line===-1&&(_=-1),v.line=_,v.lineAlign=m.get("lineAlign","start"),v.snapToLines=m.get("snapToLines",!0),v.size=m.get("size",100),v.align=m.get("align",D);var x=m.get("position","auto");x==="auto"&&k.position===50&&(x=v.align==="start"||v.align==="left"?0:v.align==="end"||v.align==="right"?100:50),v.position=x}function f(){w=w.replace(/^\s+/,"")}if(f(),y.startTime=s(),f(),w.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+c);w=w.substr(3),f(),y.endTime=s(),f(),u(w,y)}function A(w){return w.replace(/<br(?: \/)?>/gi,`
|
|
`)}var P=function(){function w(){this.state="INITIAL",this.buffer="",this.decoder=new U,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var y=w.prototype;return y.parse=function(c){var s=this;c&&(s.buffer+=s.decoder.decode(c,{stream:!0}));function u(){var x=s.buffer,d=0;for(x=A(x);d<x.length&&x[d]!=="\r"&&x[d]!==`
|
|
`;)++d;var h=x.substr(0,d);return x[d]==="\r"&&++d,x[d]===`
|
|
`&&++d,s.buffer=x.substr(d),h}function f(x){B(x,function(d,h){},/:/)}try{var C="";if(s.state==="INITIAL"){if(!/\r\n|\n/.test(s.buffer))return this;C=u();var v=C.match(/^()?WEBVTT([ \t].*)?$/);if(!v||!v[0])throw new Error("Malformed WebVTT signature.");s.state="HEADER"}for(var m=!1;s.buffer;){if(!/\r\n|\n/.test(s.buffer))return this;m?m=!1:C=u();switch(s.state){case"HEADER":/:/.test(C)?f(C):C||(s.state="ID");continue;case"NOTE":C||(s.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(C)){s.state="NOTE";break}if(!C)continue;if(s.cue=new Z.default(0,0,""),s.state="CUE",C.indexOf("-->")===-1){s.cue.id=C;continue}case"CUE":if(!s.cue){s.state="BADCUE";continue}try{E(C,s.cue,s.regionList)}catch(x){s.cue=null,s.state="BADCUE";continue}s.state="CUETEXT";continue;case"CUETEXT":{var _=C.indexOf("-->")!==-1;if(!C||_&&(m=!0)){s.oncue&&s.cue&&s.oncue(s.cue),s.cue=null,s.state="ID";continue}if(s.cue===null)continue;s.cue.text&&(s.cue.text+=`
|
|
`),s.cue.text+=C}continue;case"BADCUE":C||(s.state="ID")}}}catch(x){s.state==="CUETEXT"&&s.cue&&s.oncue&&s.oncue(s.cue),s.cue=null,s.state=s.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},y.flush=function(){var c=this;try{if((c.cue||c.state==="HEADER")&&(c.buffer+=`
|
|
|
|
`,c.parse()),c.state==="INITIAL"||c.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(s){c.onparsingerror&&c.onparsingerror(s)}return c.onflush&&c.onflush(),this},w}()},"./src/utils/webvtt-parser.ts":function(ce,X,R){"use strict";R.r(X),R.d(X,"generateCueId",function(){return P}),R.d(X,"parseWebVTT",function(){return y});var Z=R("./src/polyfills/number.ts"),U=R("./src/utils/vttparser.ts"),O=R("./src/demux/id3.ts"),j=R("./src/utils/timescale-conversion.ts"),B=R("./src/remux/mp4-remuxer.ts"),k=/\r\n|\n\r|\n|\r/g,D=function(c,s,u){return u===void 0&&(u=0),c.substr(u,s.length)===s},E=function(c){var s=parseInt(c.substr(-3)),u=parseInt(c.substr(-6,2)),f=parseInt(c.substr(-9,2)),C=c.length>9?parseInt(c.substr(0,c.indexOf(":"))):0;if(!Object(Z.isFiniteNumber)(s)||!Object(Z.isFiniteNumber)(u)||!Object(Z.isFiniteNumber)(f)||!Object(Z.isFiniteNumber)(C))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+c);return s+=1e3*u,s+=60*1e3*f,s+=60*60*1e3*C,s},A=function(c){for(var s=5381,u=c.length;u;)s=s*33^c.charCodeAt(--u);return(s>>>0).toString()};function P(b,c,s){return A(b.toString())+A(c.toString())+A(s)}var w=function(c,s,u){var f=c[s],C=c[f.prevCC];if(!C||!C.new&&f.new){c.ccOffset=c.presentationOffset=f.start,f.new=!1;return}for(;(v=C)!==null&&v!==void 0&&v.new;){var v;c.ccOffset+=f.start-C.start,f.new=!1,f=C,C=c[f.prevCC]}c.presentationOffset=u};function y(b,c,s,u,f,C,v,m){var _=new U.VTTParser,x=Object(O.utf8ArrayToStr)(new Uint8Array(b)).trim().replace(k,`
|
|
`).split(`
|
|
`),d=[],h=Object(j.toMpegTsClockFromTimescale)(c,s),o="00:00.000",i=0,g=0,l,T=!0,I=!1;_.oncue=function(F){var W=u[f],V=u.ccOffset,M=(i-h)/9e4;if(W!=null&&W.new&&(g!==void 0?V=u.ccOffset=W.start:w(u,f,M)),M&&(V=M-u.presentationOffset),I){var N=F.endTime-F.startTime,J=Object(B.normalizePts)((F.startTime+V-g)*9e4,C*9e4)/9e4;F.startTime=J,F.endTime=J+N}var ae=F.text.trim();F.text=decodeURIComponent(encodeURIComponent(ae)),F.id||(F.id=P(F.startTime,F.endTime,ae)),F.endTime>0&&d.push(F)},_.onparsingerror=function(F){l=F},_.onflush=function(){if(l){m(l);return}v(d)},x.forEach(function(F){if(T)if(D(F,"X-TIMESTAMP-MAP=")){T=!1,I=!0,F.substr(16).split(",").forEach(function(W){D(W,"LOCAL:")?o=W.substr(6):D(W,"MPEGTS:")&&(i=parseInt(W.substr(7)))});try{g=E(o)/1e3}catch(W){I=!1,l=W}return}else F===""&&(T=!1);_.parse(F+`
|
|
`)}),_.flush()}},"./src/utils/xhr-loader.ts":function(ce,X,R){"use strict";R.r(X);var Z=R("./src/utils/logger.ts"),U=R("./src/loader/load-stats.ts"),O=/^age:\s*[\d.]+\s*$/m,j=function(){function B(D){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=D?D.xhrSetup:null,this.stats=new U.LoadStats,this.retryDelay=0}var k=B.prototype;return k.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},k.abortInternal=function(){var E=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),E&&(E.onreadystatechange=null,E.onprogress=null,E.readyState!==4&&(this.stats.aborted=!0,E.abort()))},k.abort=function(){var E;this.abortInternal(),(E=this.callbacks)!==null&&E!==void 0&&E.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},k.load=function(E,A,P){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=E,this.config=A,this.callbacks=P,this.retryDelay=A.retryDelay,this.loadInternal()},k.loadInternal=function(){var E=this.config,A=this.context;if(!E)return;var P=this.loader=new self.XMLHttpRequest,w=this.stats;w.loading.first=0,w.loaded=0;var y=this.xhrSetup;try{if(y)try{y(P,A.url)}catch(s){P.open("GET",A.url,!0),y(P,A.url)}P.readyState||P.open("GET",A.url,!0);var b=this.context.headers;if(b)for(var c in b)P.setRequestHeader(c,b[c])}catch(s){this.callbacks.onError({code:P.status,text:s.message},A,P);return}A.rangeEnd&&P.setRequestHeader("Range","bytes="+A.rangeStart+"-"+(A.rangeEnd-1)),P.onreadystatechange=this.readystatechange.bind(this),P.onprogress=this.loadprogress.bind(this),P.responseType=A.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),E.timeout),P.send()},k.readystatechange=function(){var E=this.context,A=this.loader,P=this.stats;if(!E||!A)return;var w=A.readyState,y=this.config;if(P.aborted)return;if(w>=2)if(self.clearTimeout(this.requestTimeout),P.loading.first===0&&(P.loading.first=Math.max(self.performance.now(),P.loading.start)),w===4){A.onreadystatechange=null,A.onprogress=null;var b=A.status;if(b>=200&&b<300){P.loading.end=Math.max(self.performance.now(),P.loading.first);var c,s;if(E.responseType==="arraybuffer"?(c=A.response,s=c.byteLength):(c=A.responseText,s=c.length),P.loaded=P.total=s,!this.callbacks)return;var u=this.callbacks.onProgress;if(u&&u(P,E,c,A),!this.callbacks)return;var f={url:A.responseURL,data:c};this.callbacks.onSuccess(f,P,E,A)}else P.retry>=y.maxRetry||b>=400&&b<499?(Z.logger.error(b+" while loading "+E.url),this.callbacks.onError({code:b,text:A.statusText},E,A)):(Z.logger.warn(b+" while loading "+E.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,y.maxRetryDelay),P.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout)},k.loadtimeout=function(){Z.logger.warn("timeout while loading "+this.context.url);var E=this.callbacks;E&&(this.abortInternal(),E.onTimeout(this.stats,this.context,this.loader))},k.loadprogress=function(E){var A=this.stats;A.loaded=E.loaded,E.lengthComputable&&(A.total=E.total)},k.getCacheAge=function(){var E=null;if(this.loader&&O.test(this.loader.getAllResponseHeaders())){var A=this.loader.getResponseHeader("age");E=A?parseFloat(A):null}return E},B}();X.default=j}}).default})},vHTk:function(gt,ze,Y){gt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wCXF:function(gt,ze,Y){"use strict";Y.d(ze,"a",function(){return it});var ce=Y("rePB"),X=Y("VTBJ"),R=Y("KQm4"),Z=Y("U8pU"),U=Y("ODXe"),O=Y("q1tI"),j=Y("TSYQ"),B=Y.n(j),k=Y("Gytx"),D=Y.n(k),E=Y("Kwbf"),A=Y("t23M"),P=Y("qx4F"),w=Y("6eGT"),y=Y("IBYe"),b=Y("Ff2n"),c=Y("c+Xe"),s=Y("fyJ8"),u=Y("biw7");function f(ke,Le,Ge,Ke,Me){var je=Ge[ke]||{},xe=Ge[Le]||{},pe,be;je.fixed==="left"?pe=Ke.left[ke]:xe.fixed==="right"&&(be=Ke.right[Le]);var te=!1,de=!1,he=!1,ye=!1,De=Ge[Le+1],we=Ge[ke-1];if(Me==="rtl"){if(pe!==void 0){var We=we&&we.fixed==="left";ye=!We}else if(be!==void 0){var Qe=De&&De.fixed==="right";he=!Qe}}else if(pe!==void 0){var nt=De&&De.fixed==="left";te=!nt}else if(be!==void 0){var Ve=we&&we.fixed==="right";de=!Ve}return{fixLeft:pe,fixRight:be,lastFixLeft:te,firstFixRight:de,lastFixRight:he,firstFixLeft:ye,isSticky:Ke.isSticky}}var C=Y("sR1s");function v(ke){var Le=ke.cells,Ge=ke.stickyOffsets,Ke=ke.flattenColumns,Me=ke.rowComponent,je=ke.cellComponent,xe=ke.onHeaderRow,pe=ke.index,be=O.useContext(u.a),te=be.prefixCls,de=be.direction,he;xe&&(he=xe(Le.map(function(De){return De.column}),pe));var ye=Object(C.a)(Le.map(function(De){return De.column}));return O.createElement(Me,Object.assign({},he),Le.map(function(De,we){var We=De.column,Qe=f(De.colStart,De.colEnd,Ke,Ge,de),nt;return We&&We.onHeaderCell&&(nt=De.column.onHeaderCell(We)),O.createElement(s.a,Object.assign({},De,{ellipsis:We.ellipsis,align:We.align,component:je,prefixCls:te,key:ye[we]},Qe,{additionalProps:nt,rowType:"header"}))}))}v.displayName="HeaderRow";var m=v;function _(ke){var Le=[];function Ge(xe,pe){var be=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;Le[be]=Le[be]||[];var te=pe,de=xe.filter(Boolean).map(function(he){var ye={key:he.key,className:he.className||"",children:he.title,column:he,colStart:te},De=1,we=he.children;return we&&we.length>0&&(De=Ge(we,te,be+1).reduce(function(We,Qe){return We+Qe},0),ye.hasSubColumns=!0),"colSpan"in he&&(De=he.colSpan),"rowSpan"in he&&(ye.rowSpan=he.rowSpan),ye.colSpan=De,ye.colEnd=ye.colStart+De-1,Le[be].push(ye),te+=De,De});return de}Ge(ke,0);for(var Ke=Le.length,Me=function(pe){Le[pe].forEach(function(be){!("rowSpan"in be)&&!be.hasSubColumns&&(be.rowSpan=Ke-pe)})},je=0;je<Ke;je+=1)Me(je);return Le}function x(ke){var Le=ke.stickyOffsets,Ge=ke.columns,Ke=ke.flattenColumns,Me=ke.onHeaderRow,je=O.useContext(u.a),xe=je.prefixCls,pe=je.getComponent,be=O.useMemo(function(){return _(Ge)},[Ge]),te=pe(["header","wrapper"],"thead"),de=pe(["header","row"],"tr"),he=pe(["header","cell"],"th");return O.createElement(te,{className:"".concat(xe,"-thead")},be.map(function(ye,De){var we=O.createElement(m,{key:De,flattenColumns:Ke,cells:ye,stickyOffsets:Le,rowComponent:de,cellComponent:he,onHeaderRow:Me,index:De});return we}))}var d=x,h=Y("hW8S");function o(ke){for(var Le=ke.colWidths,Ge=ke.columns,Ke=ke.columCount,Me=[],je=Ke||Ge.length,xe=!1,pe=je-1;pe>=0;pe-=1){var be=Le[pe],te=Ge&&Ge[pe],de=te&&te[h.a];(be||de||xe)&&(Me.unshift(O.createElement("col",Object.assign({key:pe,style:{width:be,minWidth:be}},de))),xe=!0)}return O.createElement("colgroup",null,Me)}var i=o;function g(ke,Le){return Object(O.useMemo)(function(){for(var Ge=[],Ke=0;Ke<Le;Ke+=1){var Me=ke[Ke];if(Me!==void 0)Ge[Ke]=Me;else return null}return Ge},[ke.join("_"),Le])}var l=O.forwardRef(function(ke,Le){var Ge=ke.noData,Ke=ke.columns,Me=ke.flattenColumns,je=ke.colWidths,xe=ke.columCount,pe=ke.stickyOffsets,be=ke.direction,te=ke.fixHeader,de=ke.offsetHeader,he=ke.stickyClassName,ye=ke.onScroll,De=Object(b.a)(ke,["noData","columns","flattenColumns","colWidths","columCount","stickyOffsets","direction","fixHeader","offsetHeader","stickyClassName","onScroll"]),we=O.useContext(u.a),We=we.prefixCls,Qe=we.scrollbarSize,nt=we.isSticky,Ve=nt&&!te?0:Qe,dt=O.useRef(null),ct=O.useCallback(function(Mt){Object(c.b)(Le,Mt),Object(c.b)(dt,Mt)},[]);O.useEffect(function(){var Mt;function Rt(Xe){var bt=Xe.currentTarget,ot=Xe.deltaX;ot&&(ye({currentTarget:bt,scrollLeft:bt.scrollLeft+ot}),Xe.preventDefault())}return(Mt=dt.current)===null||Mt===void 0||Mt.addEventListener("wheel",Rt),function(){var Xe;(Xe=dt.current)===null||Xe===void 0||Xe.removeEventListener("wheel",Rt)}},[]);var at=Me[Me.length-1],Dt={fixed:at?at.fixed:null,onHeaderCell:function(){return{className:"".concat(We,"-cell-scrollbar")}}},wt=Object(O.useMemo)(function(){return Ve?[].concat(Object(R.a)(Ke),[Dt]):Ke},[Ve,Ke]),xt=Object(O.useMemo)(function(){return Ve?[].concat(Object(R.a)(Me),[Dt]):Me},[Ve,Me]),kt=Object(O.useMemo)(function(){var Mt=pe.right,Rt=pe.left;return Object(X.a)(Object(X.a)({},pe),{},{left:be==="rtl"?[].concat(Object(R.a)(Rt.map(function(Xe){return Xe+Ve})),[0]):Rt,right:be==="rtl"?Mt:[].concat(Object(R.a)(Mt.map(function(Xe){return Xe+Ve})),[0]),isSticky:nt})},[Ve,pe,nt]),Et=g(je,xe);return O.createElement("div",{style:Object(X.a)({overflow:"hidden"},nt?{top:de}:{}),ref:ct,className:B()("".concat(We,"-header"),Object(ce.a)({},he,!!he))},O.createElement("table",{style:{tableLayout:"fixed",visibility:Ge||Et?null:"hidden"}},O.createElement(i,{colWidths:Et?[].concat(Object(R.a)(Et),[Ve]):[],columCount:xe+1,columns:xt}),O.createElement(d,Object.assign({},De,{stickyOffsets:kt,columns:wt,flattenColumns:xt}))))});l.displayName="FixedHeader";var T=l,I=O.createContext(null),F=I;function W(ke){var Le=ke.prefixCls,Ge=ke.children,Ke=ke.component,Me=ke.cellComponent,je=ke.fixHeader,xe=ke.fixColumn,pe=ke.horizonScroll,be=ke.className,te=ke.expanded,de=ke.componentWidth,he=ke.colSpan,ye=O.useContext(u.a),De=ye.scrollbarSize;return O.useMemo(function(){var we=Ge;return xe&&(we=O.createElement("div",{style:{width:de-(je?De:0),position:"sticky",left:0,overflow:"hidden"},className:"".concat(Le,"-expanded-row-fixed")},we)),O.createElement(Ke,{className:be,style:{display:te?null:"none"}},O.createElement(s.a,{component:Me,prefixCls:Le,colSpan:he},we))},[Ge,Ke,je,pe,be,te,de,he,De])}var V=W;function M(ke){var Le=ke.className,Ge=ke.style,Ke=ke.record,Me=ke.index,je=ke.rowKey,xe=ke.getRowKey,pe=ke.rowExpandable,be=ke.expandedKeys,te=ke.onRow,de=ke.indent,he=de===void 0?0:de,ye=ke.rowComponent,De=ke.cellComponent,we=ke.childrenColumnName,We=O.useContext(u.a),Qe=We.prefixCls,nt=We.fixedInfoList,Ve=O.useContext(F),dt=Ve.fixHeader,ct=Ve.fixColumn,at=Ve.horizonScroll,Dt=Ve.componentWidth,wt=Ve.flattenColumns,xt=Ve.expandableType,kt=Ve.expandRowByClick,Et=Ve.onTriggerExpand,Mt=Ve.rowClassName,Rt=Ve.expandedRowClassName,Xe=Ve.indentSize,bt=Ve.expandIcon,ot=Ve.expandedRowRender,lt=Ve.expandIconColumnIndex,st=O.useState(!1),zt=Object(U.a)(st,2),Wt=zt[0],St=zt[1],ut=be&&be.has(ke.recordKey);O.useEffect(function(){ut&&St(!0)},[ut]);var or=xt==="row"&&(!pe||pe(Ke)),$t=xt==="nest",Tt=we&&Ke&&Ke[we],Ot=or||$t,Gt;te&&(Gt=te(Ke,Me));var ir=function(p){if(kt&&Ot&&Et(Ke,p),Gt&&Gt.onClick){for(var S,K=arguments.length,$=new Array(K>1?K-1:0),G=1;G<K;G++)$[G-1]=arguments[G];(S=Gt).onClick.apply(S,[p].concat($))}},Dr;typeof Mt=="string"?Dr=Mt:typeof Mt=="function"&&(Dr=Mt(Ke,Me,he));var et=Object(C.a)(wt),Ct=O.createElement(ye,Object.assign({},Gt,{"data-row-key":je,className:B()(Le,"".concat(Qe,"-row"),"".concat(Qe,"-row-level-").concat(he),Dr,Gt&&Gt.className),style:Object(X.a)(Object(X.a)({},Ge),Gt?Gt.style:null),onClick:ir}),wt.map(function(H,p){var S=H.render,K=H.dataIndex,$=H.className,G=et[p],Ae=nt[p],$e;p===(lt||0)&&$t&&($e=O.createElement(O.Fragment,null,O.createElement("span",{style:{paddingLeft:"".concat(Xe*he,"px")},className:"".concat(Qe,"-row-indent indent-level-").concat(he)}),bt({prefixCls:Qe,expanded:ut,expandable:Tt,record:Ke,onExpand:Et})));var pt;return H.onCell&&(pt=H.onCell(Ke,Me)),O.createElement(s.a,Object.assign({className:$,ellipsis:H.ellipsis,align:H.align,component:De,prefixCls:Qe,key:G,record:Ke,index:Me,dataIndex:K,render:S,shouldCellUpdate:H.shouldCellUpdate},Ae,{appendNode:$e,additionalProps:pt}))})),Ut;if(or&&(Wt||ut)){var nr=ot(Ke,Me,he+1,ut),mr=Rt&&Rt(Ke,Me,he);Ut=O.createElement(V,{expanded:ut,className:B()("".concat(Qe,"-expanded-row"),"".concat(Qe,"-expanded-row-level-").concat(he+1),mr),prefixCls:Qe,fixHeader:dt,fixColumn:ct,horizonScroll:at,component:ye,componentWidth:Dt,cellComponent:De,colSpan:wt.length},nr)}var Cr;return Tt&&ut&&(Cr=(Ke[we]||[]).map(function(H,p){var S=xe(H,p);return O.createElement(M,Object.assign({},ke,{key:S,rowKey:S,record:H,recordKey:S,index:p,indent:he+1}))})),O.createElement(O.Fragment,null,Ct,Ut,Cr)}M.displayName="BodyRow";var N=M,J=O.createContext(null),ae=J;function ue(ke){var Le=ke.columnKey,Ge=ke.onColumnResize,Ke=O.useRef();return O.useEffect(function(){Ke.current&&Ge(Le,Ke.current.offsetWidth)},[]),O.createElement(A.a,{onResize:function(je){var xe=je.offsetWidth;Ge(Le,xe)}},O.createElement("td",{ref:Ke,style:{padding:0,border:0,height:0}},O.createElement("div",{style:{height:0,overflow:"hidden"}},"\xA0")))}function ve(ke){var Le=ke.data,Ge=ke.getRowKey,Ke=ke.measureColumnWidth,Me=ke.expandedKeys,je=ke.onRow,xe=ke.rowExpandable,pe=ke.emptyNode,be=ke.childrenColumnName,te=O.useContext(ae),de=te.onColumnResize,he=O.useContext(u.a),ye=he.prefixCls,De=he.getComponent,we=O.useContext(F),We=we.fixHeader,Qe=we.horizonScroll,nt=we.flattenColumns,Ve=we.componentWidth;return O.useMemo(function(){var dt=De(["body","wrapper"],"tbody"),ct=De(["body","row"],"tr"),at=De(["body","cell"],"td"),Dt;Le.length?Dt=Le.map(function(xt,kt){var Et=Ge(xt,kt);return O.createElement(N,{key:Et,rowKey:Et,record:xt,recordKey:Et,index:kt,rowComponent:ct,cellComponent:at,expandedKeys:Me,onRow:je,getRowKey:Ge,rowExpandable:xe,childrenColumnName:be})}):Dt=O.createElement(V,{expanded:!0,className:"".concat(ye,"-placeholder"),prefixCls:ye,fixHeader:We,fixColumn:Qe,horizonScroll:Qe,component:ct,componentWidth:Ve,cellComponent:at,colSpan:nt.length},pe);var wt=Object(C.a)(nt);return O.createElement(dt,{className:"".concat(ye,"-tbody")},Ke&&O.createElement("tr",{"aria-hidden":"true",className:"".concat(ye,"-measure-row"),style:{height:0}},wt.map(function(xt){return O.createElement(ue,{key:xt,columnKey:xt,onColumnResize:de})})),Dt)},[Le,ye,je,Ke,Me,Ge,De,Ve,pe,nt])}var Te=O.memo(ve);Te.displayName="Body";var _e=Te,fe=Y("wRmb"),ne=Y("xEkU"),me=Y.n(ne);function ie(ke){var Le=Object(O.useRef)(ke),Ge=Object(O.useState)({}),Ke=Object(U.a)(Ge,2),Me=Ke[1],je=Object(O.useRef)(null),xe=Object(O.useRef)([]);function pe(be){je.current===null&&(xe.current=[],je.current=me()(function(){xe.current.forEach(function(te){Le.current=te(Le.current)}),je.current=null,Me({})})),xe.current.push(be)}return Object(O.useEffect)(function(){return function(){me.a.cancel(je.current)}},[]),[Le.current,pe]}function le(ke){var Le=Object(O.useRef)(ke),Ge=Object(O.useRef)(null);function Ke(){window.clearTimeout(Ge.current)}function Me(xe){Le.current=xe,Ke(),Ge.current=window.setTimeout(function(){Le.current=null,Ge.current=null},100)}function je(){return Le.current}return Object(O.useEffect)(function(){return Ke},[]),[Me,je]}function q(ke,Le,Ge){var Ke=Object(O.useMemo)(function(){for(var Me=[],je=[],xe=0,pe=0,be=0;be<Le;be+=1)if(Ge==="rtl"){je[be]=pe,pe+=ke[be]||0;var te=Le-be-1;Me[te]=xe,xe+=ke[te]||0}else{Me[be]=xe,xe+=ke[be]||0;var de=Le-be-1;je[de]=pe,pe+=ke[de]||0}return{left:Me,right:je}},[ke,Le,Ge]);return Ke}var re=q;function oe(ke){var Le=ke.className,Ge=ke.children;return O.createElement("div",{className:Le},Ge)}var ge=oe,Se=Y("n6Qo");function Ee(ke){var Le,Ge=ke.prefixCls,Ke=ke.record,Me=ke.onExpand,je=ke.expanded,xe=ke.expandable,pe="".concat(Ge,"-row-expand-icon");if(!xe)return O.createElement("span",{className:B()(pe,"".concat(Ge,"-row-spaced"))});var be=function(de){Me(Ke,de),de.stopPropagation()};return O.createElement("span",{className:B()(pe,(Le={},Object(ce.a)(Le,"".concat(Ge,"-row-expanded"),je),Object(ce.a)(Le,"".concat(Ge,"-row-collapsed"),!je),Le)),onClick:be})}function Re(ke,Le,Ge){var Ke=[];function Me(je){(je||[]).forEach(function(xe,pe){Ke.push(Le(xe,pe)),Me(xe[Ge])})}return Me(ke),Ke}var Pe=Y("zT1h"),Ue=Y("y0+3"),He=function(Le,Ge){var Ke,Me,je=Le.scrollBodyRef,xe=Le.onScroll,pe=Le.offsetScroll,be=O.useContext(u.a),te=be.prefixCls,de=((Ke=je.current)===null||Ke===void 0?void 0:Ke.scrollWidth)||0,he=((Me=je.current)===null||Me===void 0?void 0:Me.clientWidth)||0,ye=de&&he*(he/de),De=O.useRef(),we=ie({scrollLeft:0,isHiddenScrollBar:!1}),We=Object(U.a)(we,2),Qe=We[0],nt=We[1],Ve=O.useRef({delta:0,x:0}),dt=O.useState(!1),ct=Object(U.a)(dt,2),at=ct[0],Dt=ct[1],wt=function(){Dt(!1)},xt=function(Xe){Xe.persist(),Ve.current.delta=Xe.pageX-Qe.scrollLeft,Ve.current.x=0,Dt(!0),Xe.preventDefault()},kt=function(Xe){var bt,ot=Xe||((bt=window)===null||bt===void 0?void 0:bt.event),lt=ot.buttons;if(!at||lt===0){at&&Dt(!1);return}var st=Ve.current.x+Xe.pageX-Ve.current.x-Ve.current.delta;st<=0&&(st=0),st+ye>=he&&(st=he-ye),xe({scrollLeft:st/he*(de+2)}),Ve.current.x=Xe.pageX},Et=function(){var Xe=Object(Ue.b)(je.current).top,bt=Xe+je.current.offsetHeight,ot=document.documentElement.scrollTop+window.innerHeight;bt-Object(P.a)()<=ot||Xe>=ot-pe?nt(function(lt){return Object(X.a)(Object(X.a)({},lt),{},{isHiddenScrollBar:!0})}):nt(function(lt){return Object(X.a)(Object(X.a)({},lt),{},{isHiddenScrollBar:!1})})},Mt=function(Xe){nt(function(bt){return Object(X.a)(Object(X.a)({},bt),{},{scrollLeft:Xe/de*he||0})})};return O.useImperativeHandle(Ge,function(){return{setScrollLeft:Mt}}),O.useEffect(function(){var Rt=Object(Pe.a)(document.body,"mouseup",wt,!1),Xe=Object(Pe.a)(document.body,"mousemove",kt,!1);return Et(),function(){Rt.remove(),Xe.remove()}},[ye,at]),O.useEffect(function(){var Rt=Object(Pe.a)(window,"scroll",Et,!1),Xe=Object(Pe.a)(window,"resize",Et,!1);return function(){Rt.remove(),Xe.remove()}},[]),O.useEffect(function(){Qe.isHiddenScrollBar||nt(function(Rt){var Xe,bt;return Object(X.a)(Object(X.a)({},Rt),{},{scrollLeft:je.current.scrollLeft/((Xe=je.current)===null||Xe===void 0?void 0:Xe.scrollWidth)*((bt=je.current)===null||bt===void 0?void 0:bt.clientWidth)})})},[Qe.isHiddenScrollBar]),de<=he||!ye||Qe.isHiddenScrollBar?null:O.createElement("div",{style:{height:Object(P.a)(),width:he,bottom:pe},className:"".concat(te,"-sticky-scroll")},O.createElement("div",{onMouseDown:xt,ref:De,className:B()("".concat(te,"-sticky-scroll-bar"),Object(ce.a)({},"".concat(te,"-sticky-scroll-bar-active"),at)),style:{width:"".concat(ye,"px"),transform:"translate3d(".concat(Qe.scrollLeft,"px, 0, 0)")}}))},Fe=O.forwardRef(He);function Ne(ke,Le){return O.useMemo(function(){var Ge=!!ke;return{isSticky:Ge,stickyClassName:Ge?"".concat(Le,"-sticky-header"):"",offsetHeader:Object(Z.a)(ke)==="object"&&ke.offsetHeader||0,offsetScroll:Object(Z.a)(ke)==="object"&&ke.offsetScroll||0}},[ke,Le])}var qe=[],Je={},it="rc-table-internal-hook",rt=O.memo(function(ke){var Le=ke.children;return Le},function(ke,Le){return D()(ke.props,Le.props)?ke.pingLeft!==Le.pingLeft||ke.pingRight!==Le.pingRight:!1});function ht(ke){var Le,Ge=ke.prefixCls,Ke=ke.className,Me=ke.rowClassName,je=ke.style,xe=ke.data,pe=ke.rowKey,be=ke.scroll,te=ke.tableLayout,de=ke.direction,he=ke.title,ye=ke.footer,De=ke.summary,we=ke.id,We=ke.showHeader,Qe=ke.components,nt=ke.emptyText,Ve=ke.onRow,dt=ke.onHeaderRow,ct=ke.internalHooks,at=ke.transformColumns,Dt=ke.internalRefs,wt=ke.sticky,xt=xe||qe,kt=!!xt.length,Et=O.useState(0),Mt=Object(U.a)(Et,2),Rt=Mt[0],Xe=Mt[1];O.useEffect(function(){Xe(Object(P.a)())});var bt=O.useMemo(function(){return Object(C.c)(Qe,{})},[Qe]),ot=O.useCallback(function(dr,cr){return Object(C.b)(bt,dr)||cr},[bt]),lt=O.useMemo(function(){return typeof pe=="function"?pe:function(dr){var cr=dr&&dr[pe];return cr}},[pe]),st=Object(h.c)(ke),zt=st.expandIcon,Wt=st.expandedRowKeys,St=st.defaultExpandedRowKeys,ut=st.defaultExpandAllRows,or=st.expandedRowRender,$t=st.onExpand,Tt=st.onExpandedRowsChange,Ot=st.expandRowByClick,Gt=st.rowExpandable,ir=st.expandIconColumnIndex,Dr=st.expandedRowClassName,et=st.childrenColumnName,Ct=st.indentSize,Ut=zt||Ee,nr=et||"children",mr=O.useMemo(function(){return or?"row":ke.expandable&&ct===it&&ke.expandable.__PARENT_RENDER_ICON__||xt.some(function(dr){return dr&&Object(Z.a)(dr)==="object"&&dr[nr]})?"nest":!1},[!!or,xt]),Cr=O.useState(function(){return St||(ut?Re(xt,lt,nr):[])}),H=Object(U.a)(Cr,2),p=H[0],S=H[1],K=O.useMemo(function(){return new Set(Wt||p||[])},[Wt,p]),$=O.useCallback(function(dr){var cr=lt(dr,xt.indexOf(dr)),pr,gn=K.has(cr);gn?(K.delete(cr),pr=Object(R.a)(K)):pr=[].concat(Object(R.a)(K),[cr]),S(pr),$t&&$t(!gn,dr),Tt&&Tt(pr)},[lt,K,xt,$t,Tt]),G=O.useState(0),Ae=Object(U.a)(G,2),$e=Ae[0],pt=Ae[1],_t=Object(fe.b)(Object(X.a)(Object(X.a)(Object(X.a)({},ke),st),{},{expandable:!!or,expandedKeys:K,getRowKey:lt,onTriggerExpand:$,expandIcon:Ut,expandIconColumnIndex:ir,direction:de}),ct===it?at:null),Ze=Object(U.a)(_t,2),Bt=Ze[0],It=Ze[1],hr=O.useMemo(function(){return{columns:Bt,flattenColumns:It}},[Bt,It]),Wr=O.useRef(),Hr=O.useRef(),br=O.useRef(),Jr=O.useState(!1),Sn=Object(U.a)(Jr,2),Fr=Sn[0],Jt=Sn[1],jt=O.useState(!1),Xt=Object(U.a)(jt,2),Zt=Xt[0],sr=Xt[1],qt=ie(new Map),Sr=Object(U.a)(qt,2),Ir=Sr[0],Or=Sr[1],wr=Object(C.a)(It),Zr=wr.map(function(dr){return Ir.get(dr)}),on=O.useMemo(function(){return Zr},[Zr.join("_")]),hn=re(on,It.length,de),lr=be&&Object(C.d)(be.y),Yt=be&&Object(C.d)(be.x),Tr=Yt&&It.some(function(dr){var cr=dr.fixed;return cr}),tr=O.useRef(),Er=Ne(wt,Ge),Vt=Er.isSticky,en=Er.offsetHeader,_r=Er.offsetScroll,Xr=Er.stickyClassName,vr,bn,tn;lr&&(bn={overflowY:"scroll",maxHeight:be.y}),Yt&&(vr={overflowX:"auto"},lr||(bn={overflowY:"hidden"}),tn={width:be.x===!0?"auto":be.x,minWidth:"100%"});var Xn=O.useCallback(function(dr,cr){Or(function(pr){var gn=new Map(pr);return gn.set(dr,cr),gn})},[]),rn=le(null),In=Object(U.a)(rn,2),En=In[0],Rn=In[1];function Nn(dr,cr){if(!cr)return;typeof cr=="function"?cr(dr):cr.scrollLeft!==dr&&(cr.scrollLeft=dr)}var fn=function(cr){var pr=cr.currentTarget,gn=cr.scrollLeft,Un=typeof gn=="number"?gn:pr.scrollLeft,Bn=pr||Je;if(!Rn()||Rn()===Bn){var Si;En(Bn),Nn(Un,Hr.current),Nn(Un,br.current),Nn(Un,(Si=tr.current)===null||Si===void 0?void 0:Si.setScrollLeft)}if(pr){var Xi=pr.scrollWidth,ga=pr.clientWidth;Jt(Un>0),sr(Un<Xi-ga)}},ii=function(){br.current&&fn({currentTarget:br.current})},Ci=function(cr){var pr=cr.width;ii(),pt(Wr.current?Wr.current.offsetWidth:pr)};O.useEffect(function(){return ii},[]),O.useEffect(function(){Yt&&ii()},[Yt]),O.useEffect(function(){ct===it&&Dt&&(Dt.body.current=br.current)});var Pt=ot(["table"],"table"),Ht=O.useMemo(function(){return te||(Tr?be.x==="max-content"?"auto":"fixed":lr||It.some(function(dr){var cr=dr.ellipsis;return cr})?"fixed":"auto")},[lr,Tr,It,te]),Nt,Qt={colWidths:on,columCount:It.length,stickyOffsets:hn,onHeaderRow:dt,fixHeader:lr},fr=O.useMemo(function(){return kt?null:typeof nt=="function"?nt():nt},[kt,nt]),gr=O.createElement(_e,{data:xt,measureColumnWidth:lr||Yt||Vt,expandedKeys:K,rowExpandable:Gt,getRowKey:lt,onRow:Ve,emptyNode:fr,childrenColumnName:nr}),ar=O.createElement(i,{colWidths:It.map(function(dr){var cr=dr.width;return cr}),columns:It}),Rr=De&&O.createElement(Se.b,null,De(xt)),Yr=ot(["body"]);if(lr||Vt){var er;typeof Yr=="function"?(er=Yr(xt,{scrollbarSize:Rt,ref:br,onScroll:fn}),Qt.colWidths=It.map(function(dr,cr){var pr=dr.width,gn=cr===Bt.length-1?pr-Rt:pr;return typeof gn=="number"&&!Number.isNaN(gn)?gn:(Object(E.a)(!1,"When use `components.body` with render props. Each column should have a fixed value."),0)})):er=O.createElement("div",{style:Object(X.a)(Object(X.a)({},vr),bn),onScroll:fn,ref:br,className:B()("".concat(Ge,"-body"))},O.createElement(Pt,{style:Object(X.a)(Object(X.a)({},tn),{},{tableLayout:Ht})},ar,gr,Rr),Vt&&O.createElement(Fe,{ref:tr,offsetScroll:_r,scrollBodyRef:br,onScroll:fn})),Nt=O.createElement(O.Fragment,null,We!==!1&&O.createElement(T,Object.assign({noData:!xt.length},Qt,hr,{direction:de,offsetHeader:en,stickyClassName:Xr,ref:Hr,onScroll:fn})),er)}else Nt=O.createElement("div",{style:Object(X.a)(Object(X.a)({},vr),bn),className:B()("".concat(Ge,"-content")),onScroll:fn,ref:br},O.createElement(Pt,{style:Object(X.a)(Object(X.a)({},tn),{},{tableLayout:Ht})},ar,We!==!1&&O.createElement(d,Object.assign({},Qt,hr)),gr,Rr));var An=Object(h.b)(ke),ur=O.createElement("div",Object.assign({className:B()(Ge,Ke,(Le={},Object(ce.a)(Le,"".concat(Ge,"-rtl"),de==="rtl"),Object(ce.a)(Le,"".concat(Ge,"-ping-left"),Fr),Object(ce.a)(Le,"".concat(Ge,"-ping-right"),Zt),Object(ce.a)(Le,"".concat(Ge,"-layout-fixed"),te==="fixed"),Object(ce.a)(Le,"".concat(Ge,"-fixed-header"),lr),Object(ce.a)(Le,"".concat(Ge,"-fixed-column"),Tr),Object(ce.a)(Le,"".concat(Ge,"-scroll-horizontal"),Yt),Object(ce.a)(Le,"".concat(Ge,"-has-fix-left"),It[0]&&It[0].fixed),Object(ce.a)(Le,"".concat(Ge,"-has-fix-right"),It[It.length-1]&&It[It.length-1].fixed==="right"),Le)),style:je,id:we,ref:Wr},An),O.createElement(rt,{pingLeft:Fr,pingRight:Zt,props:Object(X.a)(Object(X.a)({},ke),{},{stickyOffsets:hn,mergedExpandedKeys:K})},he&&O.createElement(ge,{className:"".concat(Ge,"-title")},he(xt)),O.createElement("div",{className:"".concat(Ge,"-container")},Nt),ye&&O.createElement(ge,{className:"".concat(Ge,"-footer")},ye(xt))));Yt&&(ur=O.createElement(A.a,{onResize:Ci},ur));var Nr=O.useMemo(function(){return{prefixCls:Ge,getComponent:ot,scrollbarSize:Rt,direction:de,fixedInfoList:It.map(function(dr,cr){return f(cr,cr,It,hn,de)}),isSticky:Vt}},[Ge,ot,Rt,de,It,hn,de,Vt]),pn=O.useMemo(function(){return Object(X.a)(Object(X.a)({},hr),{},{tableLayout:Ht,rowClassName:Me,expandedRowClassName:Dr,componentWidth:$e,fixHeader:lr,fixColumn:Tr,horizonScroll:Yt,expandIcon:Ut,expandableType:mr,expandRowByClick:Ot,expandedRowRender:or,onTriggerExpand:$,expandIconColumnIndex:ir,indentSize:Ct})},[hr,Ht,Me,Dr,$e,lr,Tr,Yt,Ut,mr,Ot,or,$,ir,Ct]),mn=O.useMemo(function(){return{onColumnResize:Xn}},[Xn]);return O.createElement(u.a.Provider,{value:Nr},O.createElement(F.Provider,{value:pn},O.createElement(ae.Provider,{value:mn},ur)))}ht.Column=y.a,ht.ColumnGroup=w.a,ht.Summary=Se.a,ht.defaultProps={rowKey:"key",prefixCls:"rc-table",emptyText:function(){return"No Data"}};var ft=ze.b=ht},wRmb:function(gt,ze,Y){"use strict";Y.d(ze,"a",function(){return D});var ce=Y("rePB"),X=Y("KQm4"),R=Y("VTBJ"),Z=Y("Ff2n"),U=Y("q1tI"),O=Y.n(U),j=Y("Kwbf"),B=Y("Zm9Q"),k=Y("hW8S");function D(y){return Object(B.a)(y).filter(function(b){return U.isValidElement(b)}).map(function(b){var c=b.key,s=b.props,u=s.children,f=Object(Z.a)(s,["children"]),C=Object(R.a)({key:c},f);return u&&(C.children=D(u)),C})}function E(y){return y.reduce(function(b,c){var s=c.fixed,u=s===!0?"left":s,f=c.children;return f&&f.length>0?[].concat(Object(X.a)(b),Object(X.a)(E(f).map(function(C){return Object(R.a)({fixed:u},C)}))):[].concat(Object(X.a)(b),[Object(R.a)(Object(R.a)({},c),{},{fixed:u})])},[])}function A(y){for(var b=!0,c=0;c<y.length;c+=1){var s=y[c];if(b&&s.fixed!=="left")b=!1;else if(!b&&s.fixed==="left"){Object(j.a)(!1,"Index ".concat(c-1," of `columns` missing `fixed='left'` prop."));break}}for(var u=!0,f=y.length-1;f>=0;f-=1){var C=y[f];if(u&&C.fixed!=="right")u=!1;else if(!u&&C.fixed==="right"){Object(j.a)(!1,"Index ".concat(f+1," of `columns` missing `fixed='right'` prop."));break}}}function P(y){return y.map(function(b){var c=b.fixed,s=Object(Z.a)(b,["fixed"]),u=c;return c==="left"?u="right":c==="right"&&(u="left"),Object(R.a)({fixed:u},s)})}function w(y,b){var c=y.prefixCls,s=y.columns,u=y.children,f=y.expandable,C=y.expandedKeys,v=y.getRowKey,m=y.onTriggerExpand,_=y.expandIcon,x=y.rowExpandable,d=y.expandIconColumnIndex,h=y.direction,o=y.expandRowByClick,i=U.useMemo(function(){return s||D(u)},[s,u]),g=U.useMemo(function(){if(f){var I,F=d||0,W=i[F],V=(I={},Object(ce.a)(I,k.a,{className:"".concat(c,"-expand-icon-col")}),Object(ce.a)(I,"title",""),Object(ce.a)(I,"fixed",W?W.fixed:null),Object(ce.a)(I,"className","".concat(c,"-row-expand-icon-cell")),Object(ce.a)(I,"render",function(J,ae,ue){var ve=v(ae,ue),Te=C.has(ve),_e=x?x(ae):!0,fe=_({prefixCls:c,expanded:Te,expandable:_e,record:ae,onExpand:m});return o?U.createElement("span",{onClick:function(me){return me.stopPropagation()}},fe):fe}),I),M=i.slice();return F>=0&&M.splice(F,0,V),M}return i},[f,i,v,C,_,h]),l=U.useMemo(function(){var I=g;return b&&(I=b(I)),I.length||(I=[{render:function(){return null}}]),I},[b,g,h]),T=U.useMemo(function(){return h==="rtl"?P(E(l)):E(l)},[l,h]);return[l,T]}ze.b=w},"y0+3":function(gt,ze,Y){"use strict";Y.d(ze,"a",function(){return E}),Y.d(ze,"b",function(){return P});var ce=/margin|padding|width|height|max|min|offset/,X={left:!0,top:!0},R={cssFloat:1,styleFloat:1,float:1};function Z(w){return w.nodeType===1?w.ownerDocument.defaultView.getComputedStyle(w,null):{}}function U(w,y,b){if(y=y.toLowerCase(),b==="auto"){if(y==="height")return w.offsetHeight;if(y==="width")return w.offsetWidth}return y in X||(X[y]=ce.test(y)),X[y]?parseFloat(b)||0:b}function O(w,y){var b=arguments.length,c=Z(w);return y=R[y]?"cssFloat"in w.style?"cssFloat":"styleFloat":y,b===1?c:U(w,y,c[y]||w.style[y])}function j(w,y,b){var c=arguments.length;if(y=R[y]?"cssFloat"in w.style?"cssFloat":"styleFloat":y,c===3)return typeof b=="number"&&ce.test(y)&&(b="".concat(b,"px")),w.style[y]=b,b;for(var s in y)y.hasOwnProperty(s)&&j(w,s,y[s]);return Z(w)}function B(w){return w===document.body?document.documentElement.clientWidth:w.offsetWidth}function k(w){return w===document.body?window.innerHeight||document.documentElement.clientHeight:w.offsetHeight}function D(){var w=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),y=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);return{width:w,height:y}}function E(){var w=document.documentElement.clientWidth,y=window.innerHeight||document.documentElement.clientHeight;return{width:w,height:y}}function A(){return{scrollLeft:Math.max(document.documentElement.scrollLeft,document.body.scrollLeft),scrollTop:Math.max(document.documentElement.scrollTop,document.body.scrollTop)}}function P(w){var y=w.getBoundingClientRect(),b=document.documentElement;return{left:y.left+(window.pageXOffset||b.scrollLeft)-(b.clientLeft||document.body.clientLeft||0),top:y.top+(window.pageYOffset||b.scrollTop)-(b.clientTop||document.body.clientTop||0)}}},yFVG:function(gt,ze,Y){gt.exports={bg:"bg___239CK",main:"main___rgkgN",formWrap:"formWrap___18Cpt",knowledgeWrap:"knowledgeWrap___rGX80",knowledgeIcon:"knowledgeIcon___2ajWi",knowledgeContent:"knowledgeContent___Qaosn",knowledgeItem:"knowledgeItem___1db86",knowledgeItemName:"knowledgeItemName___34_4x",knowledgeItemIcon:"knowledgeItemIcon___1O9dB",button:"button___3a82z",buttonFixed:"buttonFixed___2PTyf",buttonWrap:"buttonWrap___2c5Pc",topicWrap:"topicWrap____aMgV"}}}]);
|