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.
437 lines
1.2 MiB
437 lines
1.2 MiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[207,5,6,7,8,20],{"+NIl":function(ut,Ke,$){(function(ce){ce($("VrN/"))})(function(ce){"use strict";ce.defineMode("stex",function(Y,N){"use strict";function Q(u,r){u.cmdState.push(r)}function F(u){return u.cmdState.length>0?u.cmdState[u.cmdState.length-1]:null}function D(u){var r=u.cmdState.pop();r&&r.closeBracket()}function G(u){for(var r=u.cmdState,c=r.length-1;c>=0;c--){var s=r[c];if(s.name=="DEFAULT")continue;return s}return{styleIdentifier:function(){return null}}}function B(u,r,c){return function(){this.name=u,this.bracketNo=0,this.style=r,this.styles=c,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var 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 R(u,r){u.f=r}function b(u,r){var c;if(u.match(/^\\[a-zA-Z@]+/)){var s=u.current().slice(1);return c=k.hasOwnProperty(s)?k[s]:k.DEFAULT,c=new c,Q(r,c),R(r,m),c.style}if(u.match(/^\\[$&%#{}_]/))return"tag";if(u.match(/^\\[,;!\/\\]/))return"tag";if(u.match("\\["))return R(r,function(o,h){return v(o,h,"\\]")}),"keyword";if(u.match("\\("))return R(r,function(o,h){return v(o,h,"\\)")}),"keyword";if(u.match("$$"))return R(r,function(o,h){return v(o,h,"$$")}),"keyword";if(u.match("$"))return R(r,function(o,h){return v(o,h,"$")}),"keyword";var a=u.next();if(a=="%")return u.skipToEnd(),"comment";if(a=="}"||a=="]"){if(c=F(r),c)c.closeBracket(a),R(r,m);else return"error";return"bracket"}else return a=="{"||a=="["?(c=k.DEFAULT,c=new c,Q(r,c),"bracket"):/\d/.test(a)?(u.eatWhile(/[\w.%]/),"atom"):(u.eatWhile(/[\w\-_]/),c=G(r),c.name=="begin"&&(c.argument=u.current()),c.styleIdentifier())}function v(u,r,c){if(u.eatSpace())return null;if(c&&u.match(c))return R(r,b),"keyword";if(u.match(/^\\[a-zA-Z@]+/))return"tag";if(u.match(/^[a-zA-Z]+/))return"variable-2";if(u.match(/^\\[$&%#{}_]/))return"tag";if(u.match(/^\\[,;!\/]/))return"tag";if(u.match(/^[\^_&]/))return"tag";if(u.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(u.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var s=u.next();return s=="{"||s=="}"||s=="["||s=="]"||s=="("||s==")"?"bracket":s=="%"?(u.skipToEnd(),"comment"):"error"}function m(u,r){var c=u.peek(),s;return c=="{"||c=="["?(s=F(r),s.openBracket(c),u.eat(c),R(r,b),"bracket"):/[ \t\r]/.test(c)?(u.eat(c),null):(R(r,b),D(r),b(u,r))}return{startState:function(){var u=N.inMathMode?function(r,c){return v(r,c)}:b;return{cmdState:[],f:u}},copyState:function(u){return{cmdState:u.cmdState.slice(),f:u.f}},token:function(u,r){return r.f(u,r)},blankLine:function(u){u.f=b,u.cmdState.length=0},lineComment:"%"}}),ce.defineMIME("text/x-stex","stex"),ce.defineMIME("text/x-latex","stex")})},"+ua5":function(ut,Ke,$){},"0dNJ":function(ut,Ke,$){"use strict";$.r(Ke);var ce=$("g9YV"),Y=$("wCAj"),N=$("+L6B"),Q=$("2/Rp"),F=$("BoS7"),D=$("Sdc0"),G=$("6UJt"),B=$("DFOY"),k=$("7Kak"),R=$("9yH6"),b=$("sPJy"),v=$("bE4q"),m=$("2qtc"),u=$("kLXV"),r=$("9og8"),c=$("oBTY"),s=$("k1fw"),a=$("miYZ"),o=$("tsqr"),h=$("y8nQ"),O=$("Vl3Y"),w=$("tJVT"),x=$("PpiC"),A=$("OaEy"),S=$("2fM7"),y=$("DZo9"),_=$("8z0m"),p=$("WmNS"),d=$.n(p),g=$("q1tI"),l=$.n(g),E=$("9kvl"),U=$("m3rI"),P=$("yFVG"),j=$.n(P),H=$("5Dmo"),I=$("3S7+"),T=$("Ot1p"),K=$("9Bee"),J=$("EgHG"),ie=$.n(J),pe=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],_e=function(be,ve){var ge=be.problemset,le=be.globalSetting,ue=be.loading,ye=be.dispatch,xe=be.isEdit,we=Object(g.useState)([]),ke=Object(w.a)(we,2),We=ke[0],Je=ke[1],Qe=Object(g.useState)(),Ze=Object(w.a)(Qe,2),bt=Ze[0],yt=Ze[1],lt=Object(g.useState)([]),wt=Object(w.a)(lt,2),xt=wt[0],Ct=wt[1],Mt=Object(g.useState)(""),Ot=Object(w.a)(Mt,2),Lt=Ot[0],gt=Ot[1],je=Object(g.useState)(""),rt=Object(w.a)(je,2),it=rt[0],et=rt[1];Object(g.useEffect)(function(){Je(["","","",""])},[]),Object(g.useEffect)(function(){var Dt,vt,dt,Vt;if(!ge.editData||!xe)return;gt((Dt=ge.editData)===null||Dt===void 0?void 0:Dt.name),et((vt=ge.editData)===null||vt===void 0?void 0:vt.analysis),Je((dt=ge.editData)===null||dt===void 0?void 0:dt.choices.map(function(gn){return gn.choice_text}));var sn=[];(Vt=ge.editData)===null||Vt===void 0||Vt.choices.map(function(gn,Kt){gn.is_answer&&sn.push(Kt)}),Ct(sn)},[ge.editData]),Object(g.useImperativeHandle)(ve,function(){return{onSave:Tt,Clear:kt}});var Tt=function(){if(!Lt)return o.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;var vt=We.findIndex(function(Vt){return!Vt});if(vt>-1)return o.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(pe[vt]," \u9009\u9879\u7684\u5185\u5BB9")),!1;if(!xt.length)return o.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 dt=We.map(function(Vt,sn){return{choice_text:Vt,is_answer:xt.includes(sn)?1:0}});return{item_type:xt.length>1?"MULTIPLE":"SINGLE",name:Lt,choices:dt,analysis:it}},kt=function(){Je(["","","",""]),gt(""),et(""),Ct([])};return l.a.createElement("section",{className:ie.a.wrap},l.a.createElement("p",{className:ie.a.titleWrap},l.a.createElement("span",{className:ie.a.required},"*"),l.a.createElement("span",{className:ie.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(T.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Lt,onChange:function(vt){return gt(vt)}}),l.a.createElement("p",{className:ie.a.titleWrap},l.a.createElement("span",{className:ie.a.required},"*"),l.a.createElement("span",{className:ie.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",l.a.createElement("span",{className:ie.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),We.map(function(Dt,vt){return l.a.createElement("div",{className:ie.a.choiceWrap,key:vt},l.a.createElement(I.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},l.a.createElement("div",{className:"".concat(ie.a.answer," ").concat(xt.includes(vt)?ie.a.activeAnswer:""),onClick:function(){xt.includes(vt)?Ct(xt.filter(function(Vt){return Vt!==vt})):Ct([].concat(Object(c.a)(xt),[vt]))}},pe[vt])),l.a.createElement("div",{className:ie.a.editorWrap},bt===vt?l.a.createElement(T.a,{id:"single-question-option-".concat(vt),watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:Dt,onChange:function(Vt){We[vt]=Vt,Je(We)}}):l.a.createElement("div",{className:ie.a.htmlWrap,onClick:function(){return yt(vt)}},l.a.createElement(K.a,{value:Dt}))),vt>1&&l.a.createElement(I.a,{title:"\u5220\u9664"},l.a.createElement("i",{className:"".concat(ie.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return Je(We.filter(function(Vt,sn){return sn!==vt}))}})),vt<7&&vt===We.length-1&&l.a.createElement(I.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},l.a.createElement("i",{className:"".concat(ie.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return Je([].concat(Object(c.a)(We),[""]))}})))}),l.a.createElement("p",{className:ie.a.titleWrap},l.a.createElement("span",{className:ie.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(T.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:it,onChange:function(vt){return et(vt)}}))},Te=Object(E.a)(function(Me){var be=Me.problemset,ve=Me.loading,ge=Me.globalSetting;return{problemset:be,globalSetting:ge,loading:ve.effects}},null,null,{forwardRef:!0})(Object(g.forwardRef)(_e)),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"],re=function(be,ve){var ge=be.problemset,le=be.globalSetting,ue=be.loading,ye=be.dispatch,xe=be.onRef,we=xe===void 0?function(){}:xe,ke=be.isEdit,We=Object(x.a)(be,["problemset","globalSetting","loading","dispatch","onRef","isEdit"]),Je=Object(g.useState)(),Qe=Object(w.a)(Je,2),Ze=Qe[0],bt=Qe[1],yt=Object(g.useState)(""),lt=Object(w.a)(yt,2),wt=lt[0],xt=lt[1],Ct=Object(g.useState)(""),Mt=Object(w.a)(Ct,2),Ot=Mt[0],Lt=Mt[1];Object(g.useEffect)(function(){var rt,it,et;if(!ge.editData||!ke)return;xt((rt=ge.editData)===null||rt===void 0?void 0:rt.name),Lt((it=ge.editData)===null||it===void 0?void 0:it.analysis);var Tt=(et=ge.editData)===null||et===void 0?void 0:et.choices.find(function(kt){return kt.is_answer});bt(Tt.choice_text==="\u6B63\u786E"?"0":"1")},[ge.editData]),Object(g.useImperativeHandle)(ve,function(){return{onSave:gt,Clear:je}});var gt=function(){if(!wt)return o.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;if(!Ze)return o.b.info("\u8BF7\u5148\u70B9\u51FB\u9009\u62E9\u672C\u9009\u62E9\u9898\u7684\u6B63\u786E\u9009\u9879"),!1;var it=[{choice_text:"\u6B63\u786E",is_answer:Ze==="0"?1:0},{choice_text:"\u9519\u8BEF",is_answer:Ze==="1"?1:0}];return{name:wt,choices:it,analysis:Ot}},je=function(){xt(""),Lt(""),bt("")};return l.a.createElement("section",{className:ie.a.wrap},l.a.createElement("p",{className:ie.a.titleWrap},l.a.createElement("span",{className:ie.a.required},"*"),l.a.createElement("span",{className:ie.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(T.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:wt,onChange:function(it){return xt(it)}}),l.a.createElement("p",{className:ie.a.titleWrap},l.a.createElement("span",{className:ie.a.required},"*"),l.a.createElement("span",{className:ie.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",l.a.createElement("span",{className:ie.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),l.a.createElement(R.a.Group,{buttonStyle:"solid",value:Ze,onChange:function(it){return bt(it.target.value)}},l.a.createElement(R.a.Button,{value:"0",className:"".concat(ie.a.radio," mr40")},"\u6B63\u786E"),l.a.createElement(R.a.Button,{value:"1",className:ie.a.radio},"\u9519\u8BEF")),l.a.createElement("p",{className:ie.a.titleWrap},l.a.createElement("span",{className:ie.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(T.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Ot,onChange:function(it){return Lt(it)}}))},fe=Object(E.a)(function(Me){var be=Me.problemset,ve=Me.loading,ge=Me.globalSetting;return{problemset:be,globalSetting:ge,loading:ve.effects}},null,null,{forwardRef:!0})(Object(g.forwardRef)(re)),ae=$("Z9P2"),oe=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Z=function(be,ve){var ge=be.problemset,le=be.globalSetting,ue=be.loading,ye=be.dispatch,xe=be.onRef,we=xe===void 0?function(){}:xe,ke=be.isEdit,We=Object(x.a)(be,["problemset","globalSetting","loading","dispatch","onRef","isEdit"]),Je=Object(g.useState)(""),Qe=Object(w.a)(Je,2),Ze=Qe[0],bt=Qe[1],yt=Object(g.useState)(""),lt=Object(w.a)(yt,2),wt=lt[0],xt=lt[1],Ct=Object(g.useState)(""),Mt=Object(w.a)(Ct,2),Ot=Mt[0],Lt=Mt[1],gt=Object(g.useState)([[],[]]),je=Object(w.a)(gt,2),rt=je[0],it=je[1];Object(g.useEffect)(function(){var kt,Dt,vt,dt,Vt,sn;if(!ge.editData||!ke)return;bt((kt=ge.editData)===null||kt===void 0?void 0:kt.name),xt((Dt=ge.editData)===null||Dt===void 0?void 0:Dt.analysis),Lt((vt=ge.editData)===null||vt===void 0||((dt=vt.answer_texts)===null||dt===void 0)?void 0:dt[0]),it([(Vt=ge.editData)===null||Vt===void 0?void 0:Vt.normal_keywords,(sn=ge.editData)===null||sn===void 0?void 0:sn.main_keywords])},[ge.editData]),Object(g.useImperativeHandle)(ve,function(){return{onSave:et,Clear:Tt}});var et=function(){return Ze?{name:Ze,answer_texts:[Ot],analysis:wt,normal_keywords:rt[0],main_keywords:rt[1]}:(o.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1)},Tt=function(){bt(""),xt(""),Lt(""),it([[],[]])};return l.a.createElement("section",{className:ie.a.wrap},l.a.createElement("p",{className:ie.a.titleWrap},l.a.createElement("span",{className:ie.a.required},"*"),l.a.createElement("span",{className:ie.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(T.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Ze,onChange:function(Dt){return bt(Dt)}}),l.a.createElement("p",{className:ie.a.titleWrap},l.a.createElement("span",{className:ie.a.title},"\u53C2\u8003\u7B54\u6848\uFF1A")),l.a.createElement(T.a,{id:"single-question-reference-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848",defaultValue:Ot,onChange:function(Dt){return Lt(Dt)}}),l.a.createElement(ae.a,{value:rt,onChange:it}),l.a.createElement("p",{className:ie.a.titleWrap},l.a.createElement("span",{className:ie.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(T.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:wt,onChange:function(Dt){return xt(Dt)}}))},ne=Object(E.a)(function(Me){var be=Me.problemset,ve=Me.loading,ge=Me.globalSetting;return{problemset:be,globalSetting:ge,loading:ve.effects}},null,null,{forwardRef:!0})(Object(g.forwardRef)(Z)),se=$("sRBo"),me=$("kaz8"),Se=$("kqOp"),Ee=$("7qnI"),Le=$("1vsH"),Pe=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Be=function(be,ve){var ge=be.problemset,le=be.globalSetting,ue=be.loading,ye=be.dispatch,xe=be.isEdit,we=Object(x.a)(be,["problemset","globalSetting","loading","dispatch","isEdit"]),ke=Object(g.useState)(""),We=Object(w.a)(ke,2),Je=We[0],Qe=We[1],Ze=Object(g.useState)(""),bt=Object(w.a)(Ze,2),yt=bt[0],lt=bt[1],wt=Object(g.useState)([]),xt=Object(w.a)(wt,2),Ct=xt[0],Mt=xt[1],Ot=Object(g.useState)(""),Lt=Object(w.a)(Ot,2),gt=Lt[0],je=Lt[1],rt=Object(g.useState)(),it=Object(w.a)(rt,2),et=it[0],Tt=it[1],kt=Object(g.useState)(!1),Dt=Object(w.a)(kt,2),vt=Dt[0],dt=Dt[1];Object(g.useEffect)(function(){var $e,ct,Jt;if(!ge.editData||!xe)return;Qe(($e=ge.editData)===null||$e===void 0?void 0:$e.name),lt((ct=ge.editData)===null||ct===void 0?void 0:ct.analysis),Tt((Jt=ge.editData)===null||Jt===void 0?void 0:Jt.is_ordered),dt(!0)},[ge.editData]),Object(g.useEffect)(function(){var $e;if(!vt)return;var ct=($e=ge.editData)===null||$e===void 0?void 0:$e.standard_answer.map(function(Jt){return Jt.answer_text});Mt(ct),dt(!1)},[vt]),Object(g.useImperativeHandle)(ve,function(){return{onSave:Vt,Clear:sn}});var Vt=function(){var ct=[],Jt=!1;return Ct.forEach(function(hn,_n){ct.push({position:_n+1,answer_text:[]}),hn.forEach(function(cn,V){ct[_n].answer_text.push(cn),(!cn||!Object(Le.db)(cn,1e4))&&(je("".concat(_n,"-").concat(V)),o.b.info(cn?"\u7B54\u6848\u4E0D\u80FD\u8D85\u8FC710000\u5B57\u7B26":"\u7B54\u6848\uFF1A\u4E0D\u80FD\u4E3A\u7A7A"),Jt=!0)})}),Jt?!1:(ct==null?void 0:ct.length)>20?(o.b.warn("\u586B\u7A7A\u9898\u6807\u51C6\u7B54\u6848\u4E0D\u80FD\u4E3A\u7A7A/\u4E0D\u80FD\u8D85\u8FC720\u4E2A\uFF01"),!1):{name:Je,analysis:yt,standard_answers:ct,is_ordered:et}},sn=function(){Qe(""),lt(""),Mt([]),Tt(!1)},gn=function(ct,Jt,hn){var _n=Ct.slice();if(Jt&&_n.splice(ct,Jt),hn)for(var cn=0;cn<hn;cn++)_n.splice(ct+cn,0,[""]);Mt(_n)},Kt=function(ct,Jt,hn){je("");var _n=Ct.slice();_n[ct][Jt]=hn,Mt(_n)},vn=function(ct){var Jt=Ct.slice();Jt[ct]=[].concat(Object(c.a)(Jt[ct]),[""]),Mt(Jt)},Mn=function(ct,Jt){var hn=Ct.slice();if(!hn[ct][Jt]){hn[ct]=hn[ct].filter(function(_n,cn){return cn!==Jt}),Mt(hn);return}u.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",className:ie.a.modal,onOk:function(){hn[ct]=hn[ct].filter(function(cn,V){return V!==Jt}),Mt(hn)}})},Wn=function(ct){u.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:"\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u4E2A\u53C2\u8003\u7B54\u6848\u5417\uFF1F",className:ie.a.modal,onOk:function(){var hn=Ct.slice();hn=Ct.filter(function(_n,cn){return ct!==cn}),Mt(hn)}})};return l.a.createElement("section",{className:ie.a.wrap},l.a.createElement("p",{className:ie.a.titleWrap},l.a.createElement("span",{className:ie.a.required},"*"),l.a.createElement("span",{className:ie.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement("div",null,l.a.createElement(Se.a,{id:"completion-question-tittle",placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE",height:155,defaultValue:Je,onChange:function(ct){return Qe(ct)},showNullButton:!0,onPlaceholderChange:gn})),l.a.createElement("div",{className:"mt20"},Ct.map(function($e,ct){return l.a.createElement(Ee.a,{key:ct,answers:$e,index:ct,is_md:!0,activeOptionErrorIndex:gt,onAnswerChange:Kt,addChildAnswer:vn,deleteChildAnswer:Mn,deleteChildAnswermain:Wn})})),l.a.createElement("div",{className:"mt20"},Ct.length>1&&l.a.createElement("span",null,l.a.createElement(me.a,{checked:et,onChange:function(ct){return Tt(ct.target.checked)},className:"".concat(ie.a.color333," font14")},"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"),l.a.createElement("span",{className:"".concat(ie.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:ie.a.titleWrap},l.a.createElement("span",{className:ie.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(T.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:yt,onChange:function(ct){return lt(ct)}}))},He=Object(E.a)(function(Me){var be=Me.problemset,ve=Me.loading,ge=Me.globalSetting;return{problemset:be,globalSetting:ge,loading:ve.effects}},null,null,{forwardRef:!0})(Object(g.forwardRef)(Be)),Ge=$("LvDl"),Ue=["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"],tt=function(be,ve){var ge=be.problemset,le=be.globalSetting,ue=be.loading,ye=be.dispatch,xe=be.onRef,we=xe===void 0?function(){}:xe,ke=be.isEdit,We=Object(x.a)(be,["problemset","globalSetting","loading","dispatch","onRef","isEdit"]),Je=Object(g.useState)(""),Qe=Object(w.a)(Je,2),Ze=Qe[0],bt=Qe[1],yt=Object(g.useState)([]),lt=Object(w.a)(yt,2),wt=lt[0],xt=lt[1];Object(g.useEffect)(function(){var gt,je,rt;if(!ge.editData||!ke)return;bt((gt=ge.editData)===null||gt===void 0?void 0:gt.name);var it=ge==null||((je=ge.editData)===null||je===void 0||((rt=je.sub_item_banks)===null||rt===void 0))?void 0:rt.map(function(et){var Tt,kt,Dt;return Object(s.a)(Object(s.a)({},et),{},{id:et.id,open:!1,qusList:et==null||((Tt=et.choices)===null||Tt===void 0)?void 0:Tt.map(function(vt){return vt.choice_text}),activeQusEditor:null,qusAnswer:(kt=[et==null||((Dt=et.choices)===null||Dt===void 0)?void 0:Dt.findIndex(function(vt){return vt.is_answer})])===null||kt===void 0?void 0:kt.filter(function(vt){return vt!==-1})})});xt(it)},[ge.editData]),Object(g.useImperativeHandle)(ve,function(){return{onSave:Ct,Clear:Mt}});var Ct=function(){if(!Ze)return o.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;if(wt.length===0)return o.b.info("\u8BF7\u60A8\u6DFB\u52A0\u5C0F\u9898"),!1;for(var je=0;je<wt.length;je++){var rt,it=wt[je];if(!(it!=null&&it.name))return o.b.info("\u8BF7\u60A8\u8F93\u5165\u7B2C".concat(je+1,"\u5C0F\u9898\u9898\u5E72")),!1;var et=it==null||((rt=it.qusList)===null||rt===void 0)?void 0:rt.findIndex(function(kt){return!kt});if(et>-1)return o.b.info("\u8BF7\u5148\u8F93\u5165\u7B2C".concat(je+1,"\u5C0F\u9898").concat(Ue[et],"\u9009\u9879\u7684\u5185\u5BB9")),!1;if(!(it!=null&&it.qusAnswer.length))return o.b.info("\u8BF7\u8BBE\u7F6E\u7B2C".concat(je+1,"\u5C0F\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E")),!1}var Tt=wt.map(function(kt){return{id:kt.id>1?kt.id:null,name:kt.name,item_type:kt.item_type,analysis:kt.analysis,choices:kt.qusList.map(function(Dt,vt){return{choice_text:Dt,is_answer:kt.qusAnswer[0]===vt?1:0}})}});return{name:Ze,sub_item_banks:Tt}},Mt=function(){bt(""),xt([])},Ot=function(){var je={id:Math.random(),item_type:"SINGLE",open:!1,name:"",qusList:["","","",""],activeQusEditor:null,qusAnswer:[],analysis:""};xt(wt.concat(je))},Lt=function(je,rt,it){var et=Object(Ge.cloneDeep)(wt);if(je==="open"&&(et[rt].open=!et[rt].open),je==="delete"&&et.splice(rt,1),je==="value"&&(et[rt].name=it),je==="answer"&&(et[rt].qusAnswer=[it]),je==="edit"&&(et[rt].activeQusEditor=it),je==="details"&&(et[rt].qusList[et[rt].activeQusEditor]=it),je==="addQus"&&(et[rt].qusList=et[rt].qusList.concat("")),je==="deleteQus"){var Tt;et[rt].qusList=et[rt].qusList.filter(function(kt,Dt){return Dt!==it}),et[rt].qusAnswer=(Tt=et[rt].qusAnswer)===null||Tt===void 0?void 0:Tt.filter(function(kt){return kt!==it})}je==="analysis"&&(et[rt].analysis=it),xt(et)};return l.a.createElement("section",{className:ie.a.wrap},l.a.createElement("p",{className:ie.a.titleWrap},l.a.createElement("span",{className:ie.a.required},"*"),l.a.createElement("span",{className:ie.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(T.a,{id:"combination-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Ze,onChange:function(je){return bt(je)}}),wt==null?void 0:wt.map(function(gt,je){var rt;return l.a.createElement("div",{className:ie.a.fold,key:gt.id},l.a.createElement("div",{onClick:function(){return Lt("open",je)},className:ie.a.head},l.a.createElement("i",{className:"iconfont icon-sanjiaoxing",style:{transform:gt.open?"initial":"rotate(270deg) translate(2px, 4px)"}}),l.a.createElement("span",null,"\u7B2C",je+1,"\u5C0F\u9898\uFF08\u5355\u9009\u9898\uFF09"),l.a.createElement("b",{onClick:function(et){et.stopPropagation(),Lt("delete",je)},className:"iconfont icon-shanchu8"})),l.a.createElement("div",{className:"mb10",style:{display:gt.open?"block":"none"}},l.a.createElement(T.a,{watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:gt==null?void 0:gt.name,onChange:function(et){return Lt("value",je,et)}}),l.a.createElement("p",{className:ie.a.titleWrap},l.a.createElement("span",{className:ie.a.required},"*"),l.a.createElement("span",{className:ie.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",l.a.createElement("span",{className:ie.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),gt==null||((rt=gt.qusList)===null||rt===void 0)?void 0:rt.map(function(it,et){var Tt,kt;return l.a.createElement("div",{className:ie.a.choiceWrap,key:et},l.a.createElement(I.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},l.a.createElement("div",{className:"".concat(ie.a.answer," ").concat(gt!=null&&(Tt=gt.qusAnswer)!==null&&Tt!==void 0&&Tt.includes(et)?ie.a.activeAnswer:""),onClick:function(){return Lt("answer",je,et)}},Ue[et])),l.a.createElement("div",{className:ie.a.editorWrap},(gt==null?void 0:gt.activeQusEditor)===et?l.a.createElement(T.a,{id:"single-question-option-".concat(et),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:it,onChange:function(vt){return Lt("details",je,vt)}}):l.a.createElement("div",{className:ie.a.htmlWrap,onClick:function(){return Lt("edit",je,et)}},l.a.createElement(K.a,{value:it}))),et>1&&l.a.createElement(I.a,{title:"\u5220\u9664"},l.a.createElement("i",{className:"".concat(ie.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return Lt("deleteQus",je,et)}})),et<7&&et===(gt==null||((kt=gt.qusList)===null||kt===void 0)?void 0:kt.length)-1&&l.a.createElement(I.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},l.a.createElement("i",{className:"".concat(ie.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return Lt("addQus",je)}})))}),l.a.createElement("p",{className:"mb10 mt10"},l.a.createElement("span",{className:ie.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(T.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:gt.analysis,onChange:function(et){return Lt("analysis",je,et)}})))}),wt.length<20&&l.a.createElement(Q.a,{type:"primary",onClick:Ot},l.a.createElement("i",{className:"iconfont icon-tianjiatimu mr5 font14"}),"\u6DFB\u52A0\u5C0F\u9898"))},nt=Object(E.a)(function(Me){var be=Me.problemset,ve=Me.loading,ge=Me.globalSetting;return{problemset:be,globalSetting:ge,loading:ve.effects}},null,null,{forwardRef:!0})(Object(g.forwardRef)(tt)),ot=$("ErOA"),st=$("u2Z1"),mt=$("xvlK"),ht=$("P/tu"),Ie=_.a.Dragger,Re=S.a.Option,ze=function(be){return be==="SINGLE"||be==="MULTIPLE"?"SELECT":be},Ve=function(be){var ve,ge,le,ue=be.problemset,ye=be.globalSetting,xe=be.loading,we=be.dispatch,ke=Object(x.a)(be,["problemset","globalSetting","loading","dispatch"]),We=O.a.useForm(),Je=Object(w.a)(We,1),Qe=Je[0],Ze=Object(g.useState)({}),bt=Object(w.a)(Ze,2),yt=bt[0],lt=bt[1],wt=Object(g.useState)(),xt=Object(w.a)(wt,2),Ct=xt[0],Mt=xt[1],Ot=Object(g.useState)(!1),Lt=Object(w.a)(Ot,2),gt=Lt[0],je=Lt[1],rt=Object(g.useState)([]),it=Object(w.a)(rt,2),et=it[0],Tt=it[1],kt=Object(g.useRef)(),Dt=Object(g.useRef)(),vt=Object(g.useState)([]),dt=Object(w.a)(vt,2),Vt=dt[0],sn=dt[1],gn=Object(g.useState)(1),Kt=Object(w.a)(gn,2),vn=Kt[0],Mn=Kt[1],Wn=Object(g.useState)([]),$e=Object(w.a)(Wn,2),ct=$e[0],Jt=$e[1],hn=Object(g.useState)(),_n=Object(w.a)(hn,2),cn=_n[0],V=_n[1],C=Object(g.useState)(!1),L=Object(w.a)(C,2),W=L[0],te=L[1],X=Object(g.useState)(),Oe=Object(w.a)(X,2),Ye=Oe[0],ft=Oe[1];Object(g.useEffect)(function(){return we({type:"globalSetting/footerToggle",payload:!1}),function(){we({type:"globalSetting/footerToggle",payload:!0})}},[]),Object(g.useEffect)(function(){if(ue!=null&&ue.editData){var Ht;ft(!(ue!=null&&(Ht=ue.editData)!==null&&Ht!==void 0&&Ht.repeat_answer))}},[ue==null?void 0:ue.editData]);var At={onRemove:function(){Jt([])},beforeUpload:function(Bt){if(console.log(Bt),(Bt==null?void 0:Bt.size)>1024*1024*50)return o.b.info("\u6587\u4EF6\u8D85\u8FC750M\uFF0C\u4E0D\u7B26\u5408\u4E0A\u4F20\u8981\u6C42"),!1;var Gt=[];return Gt.push(Bt),Jt([].concat(Gt)),!1},fileList:ct,accept:".xls,.xlsx"};Object(g.useEffect)(function(){return window.addEventListener("beforeunload",qe),function(){window.removeEventListener("beforeunload",qe)}},[]),Object(g.useEffect)(function(){var Ht,Bt,Gt=(Ht=ke.location.query)===null||Ht===void 0?void 0:Ht.pages;Mt(Gt);var Yt=(Bt=ke.match.params)===null||Bt===void 0?void 0:Bt.id;je(!!Yt),kt.current=Yt},[]),Object(g.useEffect)(function(){we({type:"problemset/getEditDisciplines",payload:{source:"new_question"}}),kt.current&&we({type:"problemset/getEditData",payload:{id:kt.current}})},[]),Object(g.useEffect)(function(){var Ht;Qe.setFieldsValue({itemType:"SELECT"}),Qe.setFieldsValue({difficulty:1});var Bt=((Ht=ke.location.query)===null||Ht===void 0?void 0:Ht.group_id)||0;if(Qe.setFieldsValue({item_banks_group_id:[Number(Bt)]}),!ue.editData||!kt.current)return;var Gt=(ue==null?void 0:ue.editData)||{},Yt=Gt.discipline,Qt=Gt.sub_discipline,tn=Gt.tag_disciplines,bn=Gt.item_type,Dn=Gt.difficulty,Un=Gt.item_banks_group_id;Qe.setFieldsValue({course:[Yt==null?void 0:Yt.id,Qt==null?void 0:Qt.id]}),Qe.setFieldsValue({itemType:ze(bn)}),Qe.setFieldsValue({difficulty:Dn}),Qe.setFieldsValue({item_banks_group_id:Un}),Qe.setFieldsValue({knowledge:tn==null?void 0:tn.map(function(Sn){return Sn.id})}),lt({course:[Yt==null?void 0:Yt.id,Qt==null?void 0:Qt.id],itemType:ze(bn),difficulty:Dn,item_banks_group_id:Un,knowledge:tn==null?void 0:tn.map(function(Sn){return Sn.id})}),Pt(Yt==null?void 0:Yt.id,Qt==null?void 0:Qt.id)},[ue.editData,ue.disciplinesData]);var qe=function(Bt){Bt.preventDefault(),Bt.returnValue=""},Pt=function(Bt,Gt){var Yt,Qt,tn,bn,Dn,Un=(Yt=ue.disciplinesData)===null||Yt===void 0||((Qt=Yt.disciplines)===null||Qt===void 0||((tn=Qt.find(function(Sn){return Sn.id===Bt}))===null||tn===void 0||((bn=tn.sub_disciplines)===null||bn===void 0||((Dn=bn.find(function(Sn){return Sn.id===Gt}))===null||Dn===void 0))))?void 0:Dn.tag_disciplines;ei(Gt)},Ft=function(Bt){if(Bt!=null&&Bt.course){var Gt,Yt,Qt,tn,bn=Object(w.a)(Bt.course,2),Dn=bn[0],Un=bn[1],Sn=(Gt=ue.disciplinesData.disciplines)===null||Gt===void 0||((Yt=Gt.find(function(Fn){return Fn.id===Dn}))===null||Yt===void 0||((Qt=Yt.sub_disciplines)===null||Qt===void 0||((tn=Qt.find(function(Fn){return Fn.id===Un}))===null||tn===void 0)))?void 0:tn.tag_disciplines;ei(Un),Qe.setFieldsValue({knowledge:[]}),lt(Object(s.a)(Object(s.a)({},Qe.getFieldsValue()),{},{knowledge:[]}))}else lt(Object(s.a)({},Qe.getFieldsValue()))},fn=function(Bt){Tt([].concat(Object(c.a)(et),[Object(s.a)({},Bt)]))},Nn=function(){var Ht=Object(r.a)(d.a.mark(function Bt(){var Gt,Yt,Qt,tn,bn,Dn,Un,Sn,Fn,ti,Ei,ni,ln,zt,wn,Xt,nn,rn,ii;return d.a.wrap(function(en){for(;;)switch(en.prev=en.next){case 0:if(Gt=yt||{},Yt=Gt.course,Qt=Gt.itemType,tn=Gt.difficulty,bn=Gt.item_banks_group_id,Dn=Gt.knowledge,Un=Dn===void 0?[]:Dn,Sn=Object(w.a)(Yt,2),Fn=Sn[0],ti=Sn[1],!(vn===1)){en.next=24;break}if(!(Qt==="PROGRAM")){en.next=7;break}return ni=Un==null?void 0:Un.join(","),Object(Le.S)("/problems/new?difficult=".concat(tn,"&sub_discipline_id=").concat(ti,"&newoj=1&pages=").concat(Ct,"&tagIds=").concat(ni,"&banksIds=").concat(bn!=null&&bn[0]?bn==null?void 0:bn[0]:0)),en.abrupt("return");case 7:if(ln=(Ei=Dt.current)===null||Ei===void 0?void 0:Ei.onSave(),ln){en.next=10;break}return en.abrupt("return");case 10:if(zt=Object(s.a)({discipline_id:Fn,sub_discipline_id:ti,item_banks_group_ids:bn,tag_discipline_ids:Un,item_type:Qt,difficulty:tn},ln||{}),console.log(zt,"postData"),!gt){en.next=18;break}return en.next=15,we({type:"problemset/editProblemset",payload:Object(s.a)(Object(s.a)({},zt),{},{repeat_answer:!Ye,id:kt.current})});case 15:wn=en.sent,en.next=21;break;case 18:return en.next=20,we({type:"problemset/addProblemset",payload:zt});case 20:wn=en.sent;case 21:wn.status===0&&(gt?E.d.replace("/problemset?group_id=".concat(bn)):u.a.confirm({title:null,icon:null,content:"\u521B\u5EFA\u6210\u529F",okText:"\u7EE7\u7EED\u65B0\u589E",cancelText:"\u8FD4\u56DE\u5217\u8868",onOk:function(){var Qn;(Qn=Dt.current)===null||Qn===void 0||Qn.Clear()},onCancel:function(){E.d.replace("/problemset?group_id=".concat(bn))}})),en.next=44;break;case 24:if(!((ct==null?void 0:ct.length)<=0)){en.next=27;break}return o.b.info("\u8BF7\u4E0A\u4F20\u8BD5\u9898\u6587\u4EF6"),en.abrupt("return");case 27:return te(!0),Xt=new FormData,Xt.append("file",ct[0]),Xt.append("sub_discipline_id",ti),en.next=33,Object(ot.a)("/api/item_banks/file_import.json",{method:"post",body:Xt},!0);case 33:if(nn=en.sent,te(!1),!((nn==null?void 0:nn.status)===0)){en.next=44;break}if(!((nn==null||((rn=nn.fail)===null||rn===void 0)?void 0:rn.length)>0)){en.next=40;break}return V(nn==null?void 0:nn.fail),o.b.error("\u4E0A\u4F20\u5931\u8D25\u9898\u6570\u4E3A"+(nn==null||((ii=nn.fail)===null||ii===void 0)?void 0:ii.length)+"\uFF0C\u53EF\u5728\u5E95\u90E8\u8BD5\u9898\u5217\u8868\u67E5\u770B\u9519\u8BEF\u539F\u56E0\u3002"),en.abrupt("return");case 40:Qe.setFieldsValue({course:[]}),Jt([]),V([]),o.b.info("\u4E0A\u4F20\u6210\u529F");case 44:case"end":return en.stop()}},Bt)}));return function(){return Ht.apply(this,arguments)}}();Object(g.useEffect)(function(){function Ht(){return Bt.apply(this,arguments)}function Bt(){return Bt=Object(r.a)(d.a.mark(function Gt(){var Yt;return d.a.wrap(function(tn){for(;;)switch(tn.prev=tn.next){case 0:return tn.next=2,Object(ot.c)("item_banks_groups/mine.json");case 2:Yt=tn.sent,sn(Yt);case 4:case"end":return tn.stop()}},Gt)})),Bt.apply(this,arguments)}Ht()},[]);var In=function(){var Bt=yt||{itemType:"SELECT"},Gt=Bt.itemType,Yt={SELECT:l.a.createElement(Te,{ref:Dt,isEdit:gt}),JUDGMENT:l.a.createElement(fe,{ref:Dt,isEdit:gt}),COMPLETION:l.a.createElement(He,{ref:Dt,isEdit:gt}),SUBJECTIVE:l.a.createElement(ne,{ref:Dt,isEdit:gt}),COMBINATION:l.a.createElement(nt,{ref:Dt,isEdit:gt})};return Yt[Gt||"SELECT"]},Tn=function(Bt){var Gt=Object(w.a)(Bt,2),Yt=Gt[0],Qt=Gt[1]},ei=function(){var Ht=Object(r.a)(d.a.mark(function Bt(Gt){var Yt;return d.a.wrap(function(tn){for(;;)switch(tn.prev=tn.next){case 0:return tn.next=2,we({type:"exercise/getTagDiscipline",payload:{sub_discipline_id:Gt}});case 2:Yt=tn.sent,Tt(Yt.tag_disciplines);case 4:case"end":return tn.stop()}},Bt)}));return function(Gt){return Ht.apply(this,arguments)}}(),_i=[{title:"\u9898\u76EE\u540D\u79F0",dataIndex:"name",key:"name"},{title:"\u9519\u8BEF\u539F\u56E0",dataIndex:"message",key:"message"}];return l.a.createElement("section",{className:j.a.bg},l.a.createElement(v.a,{className:"mb20 mt30",separator:">"},l.a.createElement(v.a.Item,{href:"/problemset"},"\u8BD5\u9898\u5E93"),l.a.createElement(v.a.Item,null,gt?"\u7F16\u8F91":"\u65B0\u589E","\u8BD5\u9898")),l.a.createElement("div",{className:j.a.main},l.a.createElement("span",{style:{fontSize:"18px"}},"\u6DFB\u52A0\u7C7B\u578B"),l.a.createElement("br",null),l.a.createElement(R.a.Group,{style:{marginTop:"5px"},onChange:function(Bt){Mn(Bt.target.value),Qe.setFieldsValue({course:[]}),Jt([]),V([])},value:vn},l.a.createElement(R.a,{value:1},"\u5355\u4E2A\u6DFB\u52A0"),l.a.createElement(R.a,{value:2},"\u6279\u91CF\u5BFC\u5165")),vn===1&&l.a.createElement(O.a,{form:Qe,style:{marginTop:"10px"},className:j.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:Ft,onFinish:Nn},l.a.createElement(O.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:ue.courseOptions,onChange:Tn})),l.a.createElement(O.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(st.a,{selectvalues:yt==null?void 0:yt.knowledge,subId:(ve=yt.course)===null||ve===void 0?void 0:ve[1],knowledgeOptions:et,onAddKnowledgeFinish:fn})),l.a.createElement(O.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(ht.a,null)),l.a.createElement(O.a.Item,{label:"\u9898\u578B\uFF1A",name:"itemType",wrapperCol:{span:5},rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u9898\u578B"}]},l.a.createElement(S.a,{placeholder:"\u8BF7\u9009\u62E9...",disabled:gt},l.a.createElement(Re,{value:"SELECT"},"\u9009\u62E9\u9898"),l.a.createElement(Re,{value:"PROGRAM"},"\u7F16\u7A0B\u9898"),l.a.createElement(Re,{value:"JUDGMENT"},"\u5224\u65AD\u9898"),l.a.createElement(Re,{value:"COMPLETION"},"\u586B\u7A7A\u9898"),l.a.createElement(Re,{value:"SUBJECTIVE"},"\u7B80\u7B54\u9898"),l.a.createElement(Re,{value:"COMBINATION"},"\u7EC4\u5408\u9898"))),l.a.createElement(O.a.Item,{label:"\u96BE\u5EA6\uFF1A",name:"difficulty",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u96BE\u5EA6"}]},l.a.createElement(R.a.Group,null,l.a.createElement(R.a.Button,{value:1},"\u7B80\u5355"),l.a.createElement(R.a.Button,{value:2},"\u9002\u4E2D"),l.a.createElement(R.a.Button,{value:3},"\u56F0\u96BE"))),gt&&(ue==null||((ge=ue.editData)===null||ge===void 0)?void 0:ge.item_type)!="PROGRAM"&&(ue==null||((le=ue.editData)===null||le===void 0)?void 0:le.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(D.a,{checked:Ye,onChange:function(Bt){ft(Bt)}}))),vn===2&&l.a.createElement("div",null,l.a.createElement(O.a,{form:Qe,style:{marginTop:"20px"},className:j.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:Ft,onFinish:Nn},l.a.createElement(O.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:ue.courseOptions,onChange:Tn})),l.a.createElement("span",null,"\u4E0B\u8F7DExcel\u683C\u5F0F ",l.a.createElement("a",{onClick:Object(r.a)(d.a.mark(function Ht(){return d.a.wrap(function(Gt){for(;;)switch(Gt.prev=Gt.next){case 0:Object(Le.v)("",Object(Le.Y)({url:U.a.API_SERVER+"/api/item_banks/down_template",query:{}}));case 1:case"end":return Gt.stop()}},Ht)}))},"\u8BD5\u9898\u6A21\u677F"),", \u6BCF\u6B21\u6700\u591A\u5BFC\u5165300\u9898\u3002"),l.a.createElement("br",null),l.a.createElement(_.a,At,l.a.createElement(Q.a,{className:j.a.upload,style:{marginTop:"20px"},type:"primary",icon:l.a.createElement(mt.a,null)},"\u9009\u62E9\u6587\u4EF6"))),l.a.createElement("br",null),(cn==null?void 0:cn.length)>0&&l.a.createElement("span",{style:{fontSize:"18px",display:"flex",width:"100%",justifyContent:"center"}},"\u9519\u8BEF\u5217\u8868"),(cn==null?void 0:cn.length)>0&&l.a.createElement(Y.a,{style:{marginTop:"10px"},dataSource:cn,columns:_i}))),vn===1&&l.a.createElement("div",{className:j.a.topicWrap},In()),l.a.createElement("div",{className:j.a.buttonFixed},l.a.createElement("div",{className:j.a.buttonWrap},l.a.createElement(Q.a,{size:"large",className:"".concat(j.a.button," mr20"),onClick:function(){return E.d.push("/problemset")}},"\u53D6\u6D88"),l.a.createElement(Q.a,{size:"large",type:"primary",className:"".concat(j.a.button," mr20"),onClick:function(){return Qe.submit()},loading:xe["problemset/editProblemset"]||xe["problemset/addProblemset"]||W},yt.itemType==="PROGRAM"?"\u521B\u5EFA":"\u4FDD\u5B58"))))},De=Ke.default=Object(E.a)(function(Me){var be=Me.problemset,ve=Me.loading,ge=Me.globalSetting;return{problemset:be,globalSetting:ge,loading:ve.effects}})(Ve)},"19Vz":function(ut,Ke,$){(function(ce){ce($("VrN/"))})(function(ce){ce.defineOption("placeholder","",function(B,k,R){var b=R&&R!=ce.Init;if(k&&!b)B.on("blur",F),B.on("change",D),B.on("swapDoc",D),ce.on(B.getInputField(),"compositionupdate",B.state.placeholderCompose=function(){Q(B)}),D(B);else if(!k&&b){B.off("blur",F),B.off("change",D),B.off("swapDoc",D),ce.off(B.getInputField(),"compositionupdate",B.state.placeholderCompose),Y(B);var v=B.getWrapperElement();v.className=v.className.replace(" CodeMirror-empty","")}k&&!B.hasFocus()&&F(B)});function Y(B){B.state.placeholder&&(B.state.placeholder.parentNode.removeChild(B.state.placeholder),B.state.placeholder=null)}function N(B){Y(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 R=B.getOption("placeholder");typeof R=="string"&&(R=document.createTextNode(R)),k.appendChild(R),B.display.lineSpace.insertBefore(k,B.display.lineSpace.firstChild)}function Q(B){setTimeout(function(){var k=!1,R=B.getInputField();R.nodeName=="TEXTAREA"?k=!R.value:B.lineCount()==1&&(k=!/[^\u200b]/.test(R.querySelector(".CodeMirror-line").textContent)),k?N(B):Y(B)},20)}function F(B){G(B)&&N(B)}function D(B){var k=B.getWrapperElement(),R=G(B);k.className=k.className.replace(" CodeMirror-empty","")+(R?" CodeMirror-empty":""),R?N(B):Y(B)}function G(B){return B.lineCount()===1&&B.getLine(0)===""}})},"1eCo":function(ut,Ke,$){(function(ce){ce($("VrN/"))})(function(ce){"use strict";var Y={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},N={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ce.defineMode("xml",function(Q,F){var D=Q.indentUnit,G={},B=F.htmlMode?Y:N;for(var k in B)G[k]=B[k];for(var k in F)G[k]=F[k];var R,b;function v(d,g){function l(P){return g.tokenize=P,P(d,g)}var E=d.next();if(E=="<")return d.eat("!")?d.eat("[")?d.match("CDATA[")?l(r("atom","]]>")):null:d.match("--")?l(r("comment","-->")):d.match("DOCTYPE",!0,!0)?(d.eatWhile(/[\w\._\-]/),l(c(1))):null:d.eat("?")?(d.eatWhile(/[\w\._\-]/),g.tokenize=r("meta","?>"),"meta"):(R=d.eat("/")?"closeTag":"openTag",g.tokenize=m,"tag bracket");if(E=="&"){var U;return d.eat("#")?d.eat("x")?U=d.eatWhile(/[a-fA-F\d]/)&&d.eat(";"):U=d.eatWhile(/[\d]/)&&d.eat(";"):U=d.eatWhile(/[\w\.\-:]/)&&d.eat(";"),U?"atom":"error"}else return d.eatWhile(/[^&<]/),null}v.isInText=!0;function m(d,g){var l=d.next();if(l==">"||l=="/"&&d.eat(">"))return g.tokenize=v,R=l==">"?"endTag":"selfcloseTag","tag bracket";if(l=="=")return R="equals",null;if(l=="<"){g.tokenize=v,g.state=h,g.tagName=g.tagStart=null;var E=g.tokenize(d,g);return E?E+" tag error":"tag error"}else return/[\'\"]/.test(l)?(g.tokenize=u(l),g.stringStartCol=d.column(),g.tokenize(d,g)):(d.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function u(d){var g=function(l,E){for(;!l.eol();)if(l.next()==d){E.tokenize=m;break}return"string"};return g.isInAttribute=!0,g}function r(d,g){return function(l,E){for(;!l.eol();){if(l.match(g)){E.tokenize=v;break}l.next()}return d}}function c(d){return function(g,l){for(var E;(E=g.next())!=null;){if(E=="<")return l.tokenize=c(d+1),l.tokenize(g,l);if(E==">")if(d==1){l.tokenize=v;break}else return l.tokenize=c(d-1),l.tokenize(g,l)}return"meta"}}function s(d,g,l){this.prev=d.context,this.tagName=g,this.indent=d.indented,this.startOfLine=l,(G.doNotIndent.hasOwnProperty(g)||d.context&&d.context.noIndent)&&(this.noIndent=!0)}function a(d){d.context&&(d.context=d.context.prev)}function o(d,g){for(var l;;){if(!d.context)return;if(l=d.context.tagName,!G.contextGrabbers.hasOwnProperty(l)||!G.contextGrabbers[l].hasOwnProperty(g))return;a(d)}}function h(d,g,l){return d=="openTag"?(l.tagStart=g.column(),O):d=="closeTag"?w:h}function O(d,g,l){return d=="word"?(l.tagName=g.current(),b="tag",S):G.allowMissingTagName&&d=="endTag"?(b="tag bracket",S(d,g,l)):(b="error",O)}function w(d,g,l){if(d=="word"){var E=g.current();return l.context&&l.context.tagName!=E&&G.implicitlyClosed.hasOwnProperty(l.context.tagName)&&a(l),l.context&&l.context.tagName==E||G.matchClosing===!1?(b="tag",x):(b="tag error",A)}else return G.allowMissingTagName&&d=="endTag"?(b="tag bracket",x(d,g,l)):(b="error",A)}function x(d,g,l){return d!="endTag"?(b="error",x):(a(l),h)}function A(d,g,l){return b="error",x(d,g,l)}function S(d,g,l){if(d=="word")return b="attribute",y;if(d=="endTag"||d=="selfcloseTag"){var E=l.tagName,U=l.tagStart;return l.tagName=l.tagStart=null,d=="selfcloseTag"||G.autoSelfClosers.hasOwnProperty(E)?o(l,E):(o(l,E),l.context=new s(l,E,U==l.indented)),h}return b="error",S}function y(d,g,l){return d=="equals"?_:(G.allowMissing||(b="error"),S(d,g,l))}function _(d,g,l){return d=="string"?p:d=="word"&&G.allowUnquoted?(b="string",S):(b="error",S(d,g,l))}function p(d,g,l){return d=="string"?p:S(d,g,l)}return{startState:function(d){var g={tokenize:v,state:h,indented:d||0,tagName:null,tagStart:null,context:null};return d!=null&&(g.baseIndent=d),g},token:function(d,g){if(!g.tagName&&d.sol()&&(g.indented=d.indentation()),d.eatSpace())return null;R=null;var l=g.tokenize(d,g);return(l||R)&&l!="comment"&&(b=null,g.state=g.state(R||l,d,g),b&&(l=b=="error"?l+" error":b)),l},indent:function(d,g,l){var E=d.context;if(d.tokenize.isInAttribute)return d.tagStart==d.indented?d.stringStartCol+1:d.indented+D;if(E&&E.noIndent)return ce.Pass;if(d.tokenize!=m&&d.tokenize!=v)return l?l.match(/^(\s*)/)[0].length:0;if(d.tagName)return G.multilineTagIndentPastTag!==!1?d.tagStart+d.tagName.length+2:d.tagStart+D*(G.multilineTagIndentFactor||1);if(G.alignCDATA&&/<!\[CDATA\[/.test(g))return 0;var U=g&&/^<(\/)?([\w_:\.-]*)/.exec(g);if(U&&U[1])for(;E;)if(E.tagName==U[2]){E=E.prev;break}else if(G.implicitlyClosed.hasOwnProperty(E.tagName))E=E.prev;else break;else if(U)for(;E;){var P=G.contextGrabbers[E.tagName];if(P&&P.hasOwnProperty(U[2]))E=E.prev;else break}for(;E&&E.prev&&!E.startOfLine;)E=E.prev;return E?E.indent+D:d.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:G.htmlMode?"html":"xml",helperType:G.htmlMode?"html":"xml",skipAttribute:function(d){d.state==_&&(d.state=S)},xmlCurrentTag:function(d){return d.tagName?{name:d.tagName,close:d.type=="closeTag"}:null},xmlCurrentContext:function(d){for(var g=[],l=d.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})})},"5VLF":function(ut,Ke,$){"use strict";var ce,Y;function N(Q,F,D){var G=function(B,k){return Q.js_beautify(B,k)};return G.js=Q.js_beautify,G.css=F.css_beautify,G.html=D.html_beautify,G.js_beautify=Q.js_beautify,G.css_beautify=F.css_beautify,G.html_beautify=D.html_beautify,G}!(ce=[$("6UM0"),$("TXwP"),$("psGv")],Y=function(Q,F,D){return N(Q,F,D)}.apply(Ke,ce),Y!==void 0&&(ut.exports=Y))},"6+eU":function(ut,Ke,$){"use strict";$.d(Ke,"a",function(){return x});var ce=$("wx14"),Y=$("rePB"),N=$("VTBJ"),Q=$("1OyB"),F=$("vuIU"),D=$("Ji7U"),G=$("LK+K"),B=$("q1tI"),k=$.n(B),R=$("TSYQ"),b=$.n(R),v=function(S){var y,_="".concat(S.rootPrefixCls,"-item"),p=b()(_,"".concat(_,"-").concat(S.page),(y={},Object(Y.a)(y,"".concat(_,"-active"),S.active),Object(Y.a)(y,S.className,!!S.className),Object(Y.a)(y,"".concat(_,"-disabled"),!S.page),y)),d=function(){S.onClick(S.page)},g=function(E){S.onKeyPress(E,S.onClick,S.page)};return k.a.createElement("li",{title:S.showTitle?S.page:null,className:p,onClick:d,onKeyPress:g,tabIndex:"0"},S.itemRender(S.page,"page",k.a.createElement("a",{rel:"nofollow"},S.page)))},m=v,u={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},r=function(A){Object(D.a)(y,A);var S=Object(G.a)(y);function y(){var _;Object(Q.a)(this,y);for(var p=arguments.length,d=new Array(p),g=0;g<p;g++)d[g]=arguments[g];return _=S.call.apply(S,[this].concat(d)),_.state={goInputText:""},_.buildOptionText=function(l){return"".concat(l," ").concat(_.props.locale.items_per_page)},_.changeSize=function(l){_.props.changeSize(Number(l))},_.handleChange=function(l){_.setState({goInputText:l.target.value})},_.handleBlur=function(l){var E=_.props,U=E.goButton,P=E.quickGo,j=E.rootPrefixCls,H=_.state.goInputText;if(U||H==="")return;if(l.relatedTarget&&(l.relatedTarget.className.indexOf("".concat(j,"-prev"))>=0||l.relatedTarget.className.indexOf("".concat(j,"-next"))>=0))return;_.setState({goInputText:""}),P(_.getValidValue())},_.go=function(l){var E=_.state.goInputText;if(E==="")return;(l.keyCode===u.ENTER||l.type==="click")&&(_.setState({goInputText:""}),_.props.quickGo(_.getValidValue()))},_}return Object(F.a)(y,[{key:"getValidValue",value:function(){var p=this.state,d=p.goInputText,g=p.current;return!d||isNaN(d)?g:Number(d)}},{key:"getPageSizeOptions",value:function(){var p=this.props,d=p.pageSize,g=p.pageSizeOptions;return g.some(function(l){return l.toString()===d.toString()})?g:g.concat([d.toString()]).sort(function(l,E){var U=isNaN(Number(l))?0:Number(l),P=isNaN(Number(E))?0:Number(E);return U-P})}},{key:"render",value:function(){var p=this,d=this.props,g=d.pageSize,l=d.locale,E=d.rootPrefixCls,U=d.changeSize,P=d.quickGo,j=d.goButton,H=d.selectComponentClass,I=d.buildOptionText,T=d.selectPrefixCls,K=d.disabled,J=this.state.goInputText,ie="".concat(E,"-options"),pe=H,_e=null,Te=null,he=null;if(!U&&!P)return null;var re=this.getPageSizeOptions();if(U&&pe){var fe=re.map(function(ae,oe){return k.a.createElement(pe.Option,{key:oe,value:ae.toString()},(I||p.buildOptionText)(ae))});_e=k.a.createElement(pe,{disabled:K,prefixCls:T,showSearch:!1,className:"".concat(ie,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(g||re[0]).toString(),onChange:this.changeSize,getPopupContainer:function(oe){return oe.parentNode}},fe)}return P&&(j&&(he=typeof j=="boolean"?k.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:K,className:"".concat(ie,"-quick-jumper-button")},l.jump_to_confirm):k.a.createElement("span",{onClick:this.go,onKeyUp:this.go},j)),Te=k.a.createElement("div",{className:"".concat(ie,"-quick-jumper")},l.jump_to,k.a.createElement("input",{disabled:K,type:"text",value:J,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),l.page,he)),k.a.createElement("li",{className:"".concat(ie)},_e,Te)}}]),y}(k.a.Component);r.defaultProps={pageSizeOptions:["10","20","50","100"]};var c=r,s=$("N2Kk");function a(){}function o(A){return typeof A=="number"&&isFinite(A)&&Math.floor(A)===A}function h(A,S,y){return y}function O(A,S,y){var _=typeof A=="undefined"?S.pageSize:A;return Math.floor((y.total-1)/_)+1}var w=function(A){Object(D.a)(y,A);var S=Object(G.a)(y);function y(_){var p;Object(Q.a)(this,y),p=S.call(this,_),p.getJumpPrevPage=function(){return Math.max(1,p.state.current-(p.props.showLessItems?3:5))},p.getJumpNextPage=function(){return Math.min(O(void 0,p.state,p.props),p.state.current+(p.props.showLessItems?3:5))},p.getItemIcon=function(U,P){var j=p.props.prefixCls,H=U||k.a.createElement("button",{type:"button","aria-label":P,className:"".concat(j,"-item-link")});return typeof U=="function"&&(H=k.a.createElement(U,Object(N.a)({},p.props))),H},p.savePaginationNode=function(U){p.paginationNode=U},p.isValid=function(U){return o(U)&&U!==p.state.current},p.shouldDisplayQuickJumper=function(){var U=p.props,P=U.showQuickJumper,j=U.pageSize,H=U.total;return H<=j?!1:P},p.handleKeyDown=function(U){(U.keyCode===u.ARROW_UP||U.keyCode===u.ARROW_DOWN)&&U.preventDefault()},p.handleKeyUp=function(U){var P=p.getValidValue(U),j=p.state.currentInputValue;P!==j&&p.setState({currentInputValue:P}),U.keyCode===u.ENTER?p.handleChange(P):U.keyCode===u.ARROW_UP?p.handleChange(P-1):U.keyCode===u.ARROW_DOWN&&p.handleChange(P+1)},p.changePageSize=function(U){var P=p.state.current,j=O(U,p.state,p.props);P=P>j?j:P,j===0&&(P=p.state.current),typeof U=="number"&&("pageSize"in p.props||p.setState({pageSize:U}),"current"in p.props||p.setState({current:P,currentInputValue:P})),p.props.onShowSizeChange(P,U),"onChange"in p.props&&p.props.onChange&&p.props.onChange(P,U)},p.handleChange=function(U){var P=p.props.disabled,j=U;if(p.isValid(j)&&!P){var H=O(void 0,p.state,p.props);j>H?j=H:j<1&&(j=1),"current"in p.props||p.setState({current:j,currentInputValue:j});var I=p.state.pageSize;return p.props.onChange(j,I),j}return p.state.current},p.prev=function(){p.hasPrev()&&p.handleChange(p.state.current-1)},p.next=function(){p.hasNext()&&p.handleChange(p.state.current+1)},p.jumpPrev=function(){p.handleChange(p.getJumpPrevPage())},p.jumpNext=function(){p.handleChange(p.getJumpNextPage())},p.hasPrev=function(){return p.state.current>1},p.hasNext=function(){return p.state.current<O(void 0,p.state,p.props)},p.runIfEnter=function(U,P){if(U.key==="Enter"||U.charCode===13){for(var j=arguments.length,H=new Array(j>2?j-2:0),I=2;I<j;I++)H[I-2]=arguments[I];P.apply(void 0,H)}},p.runIfEnterPrev=function(U){p.runIfEnter(U,p.prev)},p.runIfEnterNext=function(U){p.runIfEnter(U,p.next)},p.runIfEnterJumpPrev=function(U){p.runIfEnter(U,p.jumpPrev)},p.runIfEnterJumpNext=function(U){p.runIfEnter(U,p.jumpNext)},p.handleGoTO=function(U){(U.keyCode===u.ENTER||U.type==="click")&&p.handleChange(p.state.currentInputValue)};var d=_.onChange!==a,g="current"in _;g&&!d&&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=_.defaultCurrent;"current"in _&&(l=_.current);var E=_.defaultPageSize;return"pageSize"in _&&(E=_.pageSize),l=Math.min(l,O(E,void 0,_)),p.state={current:l,currentInputValue:l,pageSize:E},p}return Object(F.a)(y,[{key:"componentDidUpdate",value:function(p,d){var g=this.props.prefixCls;if(d.current!==this.state.current&&this.paginationNode){var l=this.paginationNode.querySelector(".".concat(g,"-item-").concat(d.current));l&&document.activeElement===l&&l.blur()}}},{key:"getValidValue",value:function(p){var d=p.target.value,g=O(void 0,this.state,this.props),l=this.state.currentInputValue,E;return d===""?E=d:isNaN(Number(d))?E=l:d>=g?E=g:E=Number(d),E}},{key:"getShowSizeChanger",value:function(){var p=this.props,d=p.showSizeChanger,g=p.total,l=p.totalBoundaryShowSizeChanger;return typeof d!="undefined"?d:g>l}},{key:"renderPrev",value:function(p){var d=this.props,g=d.prevIcon,l=d.itemRender,E=l(p,"prev",this.getItemIcon(g,"prev page")),U=!this.hasPrev();return Object(B.isValidElement)(E)?Object(B.cloneElement)(E,{disabled:U}):E}},{key:"renderNext",value:function(p){var d=this.props,g=d.nextIcon,l=d.itemRender,E=l(p,"next",this.getItemIcon(g,"next page")),U=!this.hasNext();return Object(B.isValidElement)(E)?Object(B.cloneElement)(E,{disabled:U}):E}},{key:"render",value:function(){var p=this,d=this.props,g=d.prefixCls,l=d.className,E=d.style,U=d.disabled,P=d.hideOnSinglePage,j=d.total,H=d.locale,I=d.showQuickJumper,T=d.showLessItems,K=d.showTitle,J=d.showTotal,ie=d.simple,pe=d.itemRender,_e=d.showPrevNextJumpers,Te=d.jumpPrevIcon,he=d.jumpNextIcon,re=d.selectComponentClass,fe=d.selectPrefixCls,ae=d.pageSizeOptions,oe=this.state,Z=oe.current,ne=oe.pageSize,se=oe.currentInputValue;if(P===!0&&j<=ne)return null;var me=O(void 0,this.state,this.props),Se=[],Ee=null,Le=null,Pe=null,Be=null,He=null,Ge=I&&I.goButton,Ue=T?1:2,tt=Z-1>0?Z-1:0,nt=Z+1<me?Z+1:me,ot=Object.keys(this.props).reduce(function(le,ue){return(ue.substr(0,5)==="data-"||ue.substr(0,5)==="aria-"||ue==="role")&&(le[ue]=p.props[ue]),le},{});if(ie)return Ge&&(typeof Ge=="boolean"?He=k.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},H.jump_to_confirm):He=k.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},Ge),He=k.a.createElement("li",{title:K?"".concat(H.jump_to).concat(Z,"/").concat(me):null,className:"".concat(g,"-simple-pager")},He)),k.a.createElement("ul",Object(ce.a)({className:b()(g,"".concat(g,"-simple"),Object(Y.a)({},"".concat(g,"-disabled"),U),l),style:E,ref:this.savePaginationNode},ot),k.a.createElement("li",{title:K?H.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:b()("".concat(g,"-prev"),Object(Y.a)({},"".concat(g,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(tt)),k.a.createElement("li",{title:K?"".concat(Z,"/").concat(me):null,className:"".concat(g,"-simple-pager")},k.a.createElement("input",{type:"text",value:se,disabled:U,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),k.a.createElement("span",{className:"".concat(g,"-slash")},"/"),me),k.a.createElement("li",{title:K?H.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:b()("".concat(g,"-next"),Object(Y.a)({},"".concat(g,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(nt)),He);if(me<=3+Ue*2){var st={locale:H,rootPrefixCls:g,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:K,itemRender:pe};me||Se.push(k.a.createElement(m,Object(ce.a)({},st,{key:"noPager",page:me,className:"".concat(g,"-disabled")})));for(var mt=1;mt<=me;mt+=1){var ht=Z===mt;Se.push(k.a.createElement(m,Object(ce.a)({},st,{key:mt,page:mt,active:ht})))}}else{var Ie=T?H.prev_3:H.prev_5,Re=T?H.next_3:H.next_5;_e&&(Ee=k.a.createElement("li",{title:K?Ie:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:b()("".concat(g,"-jump-prev"),Object(Y.a)({},"".concat(g,"-jump-prev-custom-icon"),!!Te))},pe(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(Te,"prev page"))),Le=k.a.createElement("li",{title:K?Re:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:b()("".concat(g,"-jump-next"),Object(Y.a)({},"".concat(g,"-jump-next-custom-icon"),!!he))},pe(this.getJumpNextPage(),"jump-next",this.getItemIcon(he,"next page")))),Be=k.a.createElement(m,{locale:H,last:!0,rootPrefixCls:g,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:me,page:me,active:!1,showTitle:K,itemRender:pe}),Pe=k.a.createElement(m,{locale:H,rootPrefixCls:g,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:K,itemRender:pe});var ze=Math.max(1,Z-Ue),Ve=Math.min(Z+Ue,me);Z-1<=Ue&&(Ve=1+Ue*2),me-Z<=Ue&&(ze=me-Ue*2);for(var De=ze;De<=Ve;De+=1){var Me=Z===De;Se.push(k.a.createElement(m,{locale:H,rootPrefixCls:g,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:De,page:De,active:Me,showTitle:K,itemRender:pe}))}Z-1>=Ue*2&&Z!==1+2&&(Se[0]=Object(B.cloneElement)(Se[0],{className:"".concat(g,"-item-after-jump-prev")}),Se.unshift(Ee)),me-Z>=Ue*2&&Z!==me-2&&(Se[Se.length-1]=Object(B.cloneElement)(Se[Se.length-1],{className:"".concat(g,"-item-before-jump-next")}),Se.push(Le)),ze!==1&&Se.unshift(Pe),Ve!==me&&Se.push(Be)}var be=null;J&&(be=k.a.createElement("li",{className:"".concat(g,"-total-text")},J(j,[j===0?0:(Z-1)*ne+1,Z*ne>j?j:Z*ne])));var ve=!this.hasPrev()||!me,ge=!this.hasNext()||!me;return k.a.createElement("ul",Object(ce.a)({className:b()(g,l,Object(Y.a)({},"".concat(g,"-disabled"),U)),style:E,unselectable:"unselectable",ref:this.savePaginationNode},ot),be,k.a.createElement("li",{title:K?H.prev_page:null,onClick:this.prev,tabIndex:ve?null:0,onKeyPress:this.runIfEnterPrev,className:b()("".concat(g,"-prev"),Object(Y.a)({},"".concat(g,"-disabled"),ve)),"aria-disabled":ve},this.renderPrev(tt)),Se,k.a.createElement("li",{title:K?H.next_page:null,onClick:this.next,tabIndex:ge?null:0,onKeyPress:this.runIfEnterNext,className:b()("".concat(g,"-next"),Object(Y.a)({},"".concat(g,"-disabled"),ge)),"aria-disabled":ge},this.renderNext(nt)),k.a.createElement(c,{disabled:U,locale:H,rootPrefixCls:g,selectComponentClass:re,selectPrefixCls:fe,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:Z,pageSize:ne,pageSizeOptions:ae,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:Ge}))}}],[{key:"getDerivedStateFromProps",value:function(p,d){var g={};if("current"in p&&(g.current=p.current,p.current!==d.current&&(g.currentInputValue=g.current)),"pageSize"in p&&p.pageSize!==d.pageSize){var l=d.current,E=O(p.pageSize,d,p);l=l>E?E:l,"current"in p||(g.current=l,g.currentInputValue=l),g.pageSize=p.pageSize}return g}}]),y}(k.a.Component);w.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:a,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:a,locale:s.a,style:{},itemRender:h,totalBoundaryShowSizeChanger:50};var x=w},"6RRn":function(ut,Ke,$){"use strict";var ce=$("wCXF"),Y=$("n6Qo");$.d(Ke,"b",function(){return Y.a});var N=$("IBYe"),Q=$("6eGT"),F=$("hW8S");$.d(Ke,"a",function(){return F.a}),Ke.c=ce.b},"6UM0":function(ut,Ke,$){var ce,Y;(function(){var N;(function(){"use strict";var F=[function(k,R,b){var v=b(1).Beautifier,m=b(5).Options;function u(r,c){var s=new v(r,c);return s.beautify()}k.exports=u,k.exports.defaultOptions=function(){return new m}},function(k,R,b){var v=b(2).Output,m=b(3).Token,u=b(4),r=b(5).Options,c=b(7).Tokenizer,s=b(7).line_starters,a=b(7).positionable_operators,o=b(7).TOKEN;function h(T,K){return K.indexOf(T)!==-1}function O(T){return T.replace(/^\s+/g,"")}function w(T){for(var K={},J=0;J<T.length;J++)K[T[J].replace(/-/g,"_")]=T[J];return K}function x(T,K){return T&&T.type===o.RESERVED&&T.text===K}function A(T,K){return T&&T.type===o.RESERVED&&h(T.text,K)}var S=["case","return","do","if","throw","else","await","break","continue","async"],y=["before-newline","after-newline","preserve-newline"],_=w(y),p=[_.before_newline,_.preserve_newline],d={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function g(T,K){if(K.multiline_frame||K.mode===d.ForInitializer||K.mode===d.Conditional)return;T.remove_indent(K.start_line_index)}function l(T){T=T.replace(u.allLineBreaks,`
|
|
`);for(var K=[],J=T.indexOf(`
|
|
`);J!==-1;)K.push(T.substring(0,J)),T=T.substring(J+1),J=T.indexOf(`
|
|
`);return T.length&&K.push(T),K}function E(T){return T===d.ArrayLiteral}function U(T){return h(T,[d.Expression,d.ForInitializer,d.Conditional])}function P(T,K){for(var J=0;J<T.length;J++){var ie=T[J].trim();if(ie.charAt(0)!==K)return!1}return!0}function j(T,K){for(var J=0,ie=T.length,pe;J<ie;J++)if(pe=T[J],pe&&pe.indexOf(K)!==0)return!1;return!0}function H(T,K){K=K||{},this._source_text=T||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new r(K)}H.prototype.create_flags=function(T,K){var J=0;T&&(J=T.indentation_level,!this._output.just_added_newline()&&T.line_indent_level>J&&(J=T.line_indent_level));var ie={mode:K,parent:T,last_token:T?T.last_token:new m(o.START_BLOCK,""),last_word:T?T.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,class_start_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,case_block:!1,indentation_level:J,alignment:0,line_indent_level:T?T.line_indent_level:J,start_line_index:this._output.get_line_number(),ternary_depth:0};return ie},H.prototype._reset=function(T){var K=T.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new v(this._options,K),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(d.BlockStatement);var J=new c(T,this._options);return this._tokens=J.tokenize(),T},H.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var T,K=this._reset(this._source_text),J=this._options.eol;this._options.eol==="auto"&&(J=`
|
|
`,K&&u.lineBreak.test(K||"")&&(J=K.match(u.lineBreak)[0]));for(var ie=this._tokens.next();ie;)this.handle_token(ie),this._last_last_text=this._flags.last_token.text,this._flags.last_token=ie,ie=this._tokens.next();return T=this._output.get_code(J),T},H.prototype.handle_token=function(T,K){T.type===o.START_EXPR?this.handle_start_expr(T):T.type===o.END_EXPR?this.handle_end_expr(T):T.type===o.START_BLOCK?this.handle_start_block(T):T.type===o.END_BLOCK?this.handle_end_block(T):T.type===o.WORD?this.handle_word(T):T.type===o.RESERVED?this.handle_word(T):T.type===o.SEMICOLON?this.handle_semicolon(T):T.type===o.STRING?this.handle_string(T):T.type===o.EQUALS?this.handle_equals(T):T.type===o.OPERATOR?this.handle_operator(T):T.type===o.COMMA?this.handle_comma(T):T.type===o.BLOCK_COMMENT?this.handle_block_comment(T,K):T.type===o.COMMENT?this.handle_comment(T,K):T.type===o.DOT?this.handle_dot(T):T.type===o.EOF?this.handle_eof(T):T.type===o.UNKNOWN?this.handle_unknown(T,K):this.handle_unknown(T,K)},H.prototype.handle_whitespace_and_comments=function(T,K){var J=T.newlines,ie=this._options.keep_array_indentation&&E(this._flags.mode);if(T.comments_before)for(var pe=T.comments_before.next();pe;)this.handle_whitespace_and_comments(pe,K),this.handle_token(pe,K),pe=T.comments_before.next();if(ie)for(var _e=0;_e<J;_e+=1)this.print_newline(_e>0,K);else if(this._options.max_preserve_newlines&&J>this._options.max_preserve_newlines&&(J=this._options.max_preserve_newlines),this._options.preserve_newlines&&J>1){this.print_newline(!1,K);for(var Te=1;Te<J;Te+=1)this.print_newline(!0,K)}};var I=["async","break","continue","return","throw","yield"];H.prototype.allow_wrap_or_preserved_newline=function(T,K){if(K=K===void 0?!1:K,this._output.just_added_newline())return;var J=this._options.preserve_newlines&&T.newlines||K,ie=h(this._flags.last_token.text,a)||h(T.text,a);if(ie){var pe=h(this._flags.last_token.text,a)&&h(this._options.operator_position,p)||h(T.text,a);J=J&&pe}if(J)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(A(this._flags.last_token,I))return;this._output.set_wrap_point()}},H.prototype.print_newline=function(T,K){if(!K&&(this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==o.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")))for(var J=this._tokens.peek();this._flags.mode===d.Statement&&!(this._flags.if_block&&x(J,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(T)&&(this._flags.multiline_frame=!0)},H.prototype.print_token_line_indentation=function(T){this._output.just_added_newline()&&(this._options.keep_array_indentation&&T.newlines&&(T.text==="["||E(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(T.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},H.prototype.print_token=function(T){if(this._output.raw){this._output.add_raw_token(T);return}if(this._options.comma_first&&T.previous&&T.previous.type===o.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var K=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(K),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(T),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(T),this._output.non_breaking_space=!0,this._output.add_token(T.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},H.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},H.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},H.prototype.set_mode=function(T){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,T),this._flags=this.create_flags(this._previous_flags,T),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},H.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===d.Statement&&g(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},H.prototype.start_of_object_property=function(){return this._flags.parent.mode===d.ObjectLiteral&&this._flags.mode===d.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||A(this._flags.last_token,["get","set"]))},H.prototype.start_of_statement=function(T){var K=!1;return K=K||A(this._flags.last_token,["var","let","const"])&&T.type===o.WORD,K=K||x(this._flags.last_token,"do"),K=K||!(this._flags.parent.mode===d.ObjectLiteral&&this._flags.mode===d.Statement)&&A(this._flags.last_token,I)&&!T.newlines,K=K||x(this._flags.last_token,"else")&&!(x(T,"if")&&!T.comments_before),K=K||this._flags.last_token.type===o.END_EXPR&&(this._previous_flags.mode===d.ForInitializer||this._previous_flags.mode===d.Conditional),K=K||this._flags.last_token.type===o.WORD&&this._flags.mode===d.BlockStatement&&!this._flags.in_case&&!(T.text==="--"||T.text==="++")&&this._last_last_text!=="function"&&T.type!==o.WORD&&T.type!==o.RESERVED,K=K||this._flags.mode===d.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||A(this._flags.last_token,["get","set"])),K?(this.set_mode(d.Statement),this.indent(),this.handle_whitespace_and_comments(T,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(T,A(T,["do","for","if","while"])),!0):!1},H.prototype.handle_start_expr=function(T){this.start_of_statement(T)||this.handle_whitespace_and_comments(T);var K=d.Expression;if(T.text==="["){if(this._flags.last_token.type===o.WORD||this._flags.last_token.text===")"){A(this._flags.last_token,s)&&(this._output.space_before_token=!0),this.print_token(T),this.set_mode(K),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}K=d.ArrayLiteral,E(this._flags.mode)&&((this._flags.last_token.text==="["||this._flags.last_token.text===","&&(this._last_last_text==="]"||this._last_last_text==="}"))&&(this._options.keep_array_indentation||this.print_newline())),h(this._flags.last_token.type,[o.START_EXPR,o.END_EXPR,o.WORD,o.OPERATOR,o.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===o.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,K=d.ForInitializer):h(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,K=d.Conditional):h(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&T.whitespace_before===""?this._output.space_before_token=!1:(h(this._flags.last_token.text,s)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===o.EQUALS||this._flags.last_token.type===o.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(T);else if(this._flags.last_token.type===o.WORD){this._output.space_before_token=!1;var J=this._tokens.peek(-3);if(this._options.space_after_named_function&&J){var ie=this._tokens.peek(-4);A(J,["async","function"])||J.text==="*"&&A(ie,["async","function"])?this._output.space_before_token=!0:this._flags.mode===d.ObjectLiteral?(J.text==="{"||J.text===","||J.text==="*"&&(ie.text==="{"||ie.text===","))&&(this._output.space_before_token=!0):this._flags.parent&&this._flags.parent.class_start_block&&(this._output.space_before_token=!0)}}else this.allow_wrap_or_preserved_newline(T);(this._flags.last_token.type===o.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(h(this._last_last_text,["function","yield"])||this._flags.mode===d.ObjectLiteral&&h(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}this._flags.last_token.text===";"||this._flags.last_token.type===o.START_BLOCK?this.print_newline():(this._flags.last_token.type===o.END_EXPR||this._flags.last_token.type===o.START_EXPR||this._flags.last_token.type===o.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===o.COMMA)&&this.allow_wrap_or_preserved_newline(T,T.newlines),this.print_token(T),this.set_mode(K),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},H.prototype.handle_end_expr=function(T){for(;this._flags.mode===d.Statement;)this.restore_mode();this.handle_whitespace_and_comments(T),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(T,T.text==="]"&&E(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===o.START_EXPR&&!this._options.space_in_empty_paren?(this._output.trim(),this._output.space_before_token=!1):this._output.space_before_token=!0),this.deindent(),this.print_token(T),this.restore_mode(),g(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===d.Conditional&&(this._previous_flags.mode=d.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},H.prototype.handle_start_block=function(T){this.handle_whitespace_and_comments(T);var K=this._tokens.peek(),J=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===o.END_EXPR?(this.set_mode(d.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(d.BlockStatement):J&&(h(J.text,[":",","])&&h(K.type,[o.STRING,o.WORD,o.RESERVED])||h(K.text,["get","set","..."])&&h(J.type,[o.WORD,o.RESERVED]))?h(this._last_last_text,["class","interface"])&&!h(J.text,[":",","])?this.set_mode(d.BlockStatement):this.set_mode(d.ObjectLiteral):this._flags.last_token.type===o.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(d.BlockStatement):h(this._flags.last_token.type,[o.EQUALS,o.START_EXPR,o.COMMA,o.OPERATOR])||A(this._flags.last_token,["return","throw","import","default"])?this.set_mode(d.ObjectLiteral):this.set_mode(d.BlockStatement),this._flags.last_token&&(A(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var ie=!K.comments_before&&K.text==="}",pe=ie&&this._flags.last_word==="function"&&this._flags.last_token.type===o.END_EXPR;if(this._options.brace_preserve_inline){var _e=0,Te=null;this._flags.inline_frame=!0;do if(_e+=1,Te=this._tokens.peek(_e-1),Te.newlines){this._flags.inline_frame=!1;break}while(Te.type!==o.EOF&&!(Te.type===o.END_BLOCK&&Te.opened===T))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&T.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==o.OPERATOR&&(pe||this._flags.last_token.type===o.EQUALS||A(this._flags.last_token,S)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(E(this._previous_flags.mode)&&(this._flags.last_token.type===o.START_EXPR||this._flags.last_token.type===o.COMMA)&&((this._flags.last_token.type===o.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===o.COMMA||this._flags.last_token.type===o.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(T),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==o.OPERATOR&&this._flags.last_token.type!==o.START_EXPR&&(this._flags.last_token.type===o.START_BLOCK&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(T),this.indent(),!ie&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},H.prototype.handle_end_block=function(T){for(this.handle_whitespace_and_comments(T);this._flags.mode===d.Statement;)this.restore_mode();var K=this._flags.last_token.type===o.START_BLOCK;this._flags.inline_frame&&!K?this._output.space_before_token=!0:this._options.brace_style==="expand"?K||this.print_newline():K||(E(this._flags.mode)&&this._options.keep_array_indentation?(this._options.keep_array_indentation=!1,this.print_newline(),this._options.keep_array_indentation=!0):this.print_newline()),this.restore_mode(),this.print_token(T)},H.prototype.handle_word=function(T){if(T.type===o.RESERVED){if(h(T.text,["set","get"])&&this._flags.mode!==d.ObjectLiteral)T.type=o.WORD;else if(T.text==="import"&&h(this._tokens.peek().text,["(","."]))T.type=o.WORD;else if(h(T.text,["as","from"])&&!this._flags.import_block)T.type=o.WORD;else if(this._flags.mode===d.ObjectLiteral){var K=this._tokens.peek();K.text===":"&&(T.type=o.WORD)}}if(this.start_of_statement(T)?A(this._flags.last_token,["var","let","const"])&&T.type===o.WORD&&(this._flags.declaration_statement=!0):T.newlines&&!U(this._flags.mode)&&(this._flags.last_token.type!==o.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==o.EQUALS&&(this._options.preserve_newlines||!A(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(T),this.print_newline()):this.handle_whitespace_and_comments(T),this._flags.do_block&&!this._flags.do_while)if(x(T,"while")){this._output.space_before_token=!0,this.print_token(T),this._output.space_before_token=!0,this._flags.do_while=!0;return}else this.print_newline(),this._flags.do_block=!1;if(this._flags.if_block)if(!this._flags.else_block&&x(T,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===d.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&A(T,["case","default"])){this.print_newline(),!this._flags.case_block&&(this._flags.case_body||this._options.jslint_happy)&&this.deindent(),this._flags.case_body=!1,this.print_token(T),this._flags.in_case=!0;return}if((this._flags.last_token.type===o.COMMA||this._flags.last_token.type===o.START_EXPR||this._flags.last_token.type===o.EQUALS||this._flags.last_token.type===o.OPERATOR)&&(this.start_of_object_property()||this.allow_wrap_or_preserved_newline(T)),x(T,"function")){(h(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(h(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===o.OPERATOR))&&(!this._output.just_added_blankline()&&!T.comments_before&&(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===o.RESERVED||this._flags.last_token.type===o.WORD?A(this._flags.last_token,["get","set","new","export"])||A(this._flags.last_token,I)?this._output.space_before_token=!0:x(this._flags.last_token,"default")&&this._last_last_text==="export"?this._output.space_before_token=!0:this._flags.last_token.text==="declare"?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===o.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(U(this._flags.mode)||E(this._flags.mode))||this.print_newline(),this.print_token(T),this._flags.last_word=T.text;return}var J="NONE";if(this._flags.last_token.type===o.END_BLOCK?this._previous_flags.inline_frame?J="SPACE":A(T,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&T.newlines?J="NEWLINE":(J="SPACE",this._output.space_before_token=!0):J="NEWLINE":this._flags.last_token.type===o.SEMICOLON&&this._flags.mode===d.BlockStatement?J="NEWLINE":this._flags.last_token.type===o.SEMICOLON&&U(this._flags.mode)?J="SPACE":this._flags.last_token.type===o.STRING?J="NEWLINE":this._flags.last_token.type===o.RESERVED||this._flags.last_token.type===o.WORD||this._flags.last_token.text==="*"&&(h(this._last_last_text,["function","yield"])||this._flags.mode===d.ObjectLiteral&&h(this._last_last_text,["{",","]))?J="SPACE":this._flags.last_token.type===o.START_BLOCK?this._flags.inline_frame?J="SPACE":J="NEWLINE":this._flags.last_token.type===o.END_EXPR&&(this._output.space_before_token=!0,J="NEWLINE"),A(T,s)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?J="SPACE":J="NEWLINE"),A(T,["else","catch","finally"]))if((!(this._flags.last_token.type===o.END_BLOCK&&this._previous_flags.mode===d.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&T.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var ie=this._output.current_line;ie.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else J==="NEWLINE"?A(this._flags.last_token,S)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&A(T,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==o.END_EXPR?(this._flags.last_token.type!==o.START_EXPR||!A(T,["var","let","const"]))&&this._flags.last_token.text!==":"&&(x(T,"if")&&x(T.previous,"else")?this._output.space_before_token=!0:this.print_newline()):A(T,s)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&E(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():J==="SPACE"&&(this._output.space_before_token=!0);T.previous&&(T.previous.type===o.WORD||T.previous.type===o.RESERVED)&&(this._output.space_before_token=!0),this.print_token(T),this._flags.last_word=T.text,T.type===o.RESERVED&&(T.text==="do"?this._flags.do_block=!0:T.text==="if"?this._flags.if_block=!0:T.text==="import"?this._flags.import_block=!0:this._flags.import_block&&x(T,"from")&&(this._flags.import_block=!1))},H.prototype.handle_semicolon=function(T){this.start_of_statement(T)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(T);for(var K=this._tokens.peek();this._flags.mode===d.Statement&&!(this._flags.if_block&&x(K,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(T)},H.prototype.handle_string=function(T){T.text.startsWith("`")&&T.newlines===0&&T.whitespace_before===""&&(T.previous.text===")"||this._flags.last_token.type===o.WORD)||(this.start_of_statement(T)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(T),this._flags.last_token.type===o.RESERVED||this._flags.last_token.type===o.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===o.COMMA||this._flags.last_token.type===o.START_EXPR||this._flags.last_token.type===o.EQUALS||this._flags.last_token.type===o.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(T):T.text.startsWith("`")&&this._flags.last_token.type===o.END_EXPR&&(T.previous.text==="]"||T.previous.text===")")&&T.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(T)},H.prototype.handle_equals=function(T){this.start_of_statement(T)||this.handle_whitespace_and_comments(T),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(T),this._output.space_before_token=!0},H.prototype.handle_comma=function(T){this.handle_whitespace_and_comments(T,!0),this.print_token(T),this._output.space_before_token=!0,this._flags.declaration_statement?(U(this._flags.parent.mode)&&(this._flags.declaration_assignment=!1),this._flags.declaration_assignment?(this._flags.declaration_assignment=!1,this.print_newline(!1,!0)):this._options.comma_first&&this.allow_wrap_or_preserved_newline(T)):this._flags.mode===d.ObjectLiteral||this._flags.mode===d.Statement&&this._flags.parent.mode===d.ObjectLiteral?(this._flags.mode===d.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(T)},H.prototype.handle_operator=function(T){var K=T.text==="*"&&(A(this._flags.last_token,["function","yield"])||h(this._flags.last_token.type,[o.START_BLOCK,o.COMMA,o.END_BLOCK,o.SEMICOLON])),J=h(T.text,["-","+"])&&(h(this._flags.last_token.type,[o.START_BLOCK,o.START_EXPR,o.EQUALS,o.OPERATOR])||h(this._flags.last_token.text,s)||this._flags.last_token.text===",");if(!this.start_of_statement(T)){var ie=!K;this.handle_whitespace_and_comments(T,ie)}if(T.text==="*"&&this._flags.last_token.type===o.DOT){this.print_token(T);return}if(T.text==="::"){this.print_token(T);return}if(this._flags.last_token.type===o.OPERATOR&&h(this._options.operator_position,p)&&this.allow_wrap_or_preserved_newline(T),T.text===":"&&this._flags.in_case){this.print_token(T),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==o.START_BLOCK?(this.indent(),this.print_newline(),this._flags.case_block=!1):(this._flags.case_block=!0,this._output.space_before_token=!0);return}var pe=!0,_e=!0,Te=!1;if(T.text===":"?this._flags.ternary_depth===0?pe=!1:(this._flags.ternary_depth-=1,Te=!0):T.text==="?"&&(this._flags.ternary_depth+=1),!J&&!K&&this._options.preserve_newlines&&h(T.text,a)){var he=T.text===":",re=he&&Te,fe=he&&!Te;switch(this._options.operator_position){case _.before_newline:this._output.space_before_token=!fe,this.print_token(T),(!he||re)&&this.allow_wrap_or_preserved_newline(T),this._output.space_before_token=!0;return;case _.after_newline:this._output.space_before_token=!0,!he||re?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(T):this._output.space_before_token=!1,this.print_token(T),this._output.space_before_token=!0;return;case _.preserve_newline:fe||this.allow_wrap_or_preserved_newline(T),pe=!(this._output.just_added_newline()||fe),this._output.space_before_token=pe,this.print_token(T),this._output.space_before_token=!0;return}}if(K){this.allow_wrap_or_preserved_newline(T),pe=!1;var ae=this._tokens.peek();_e=ae&&h(ae.type,[o.WORD,o.RESERVED])}else if(T.text==="...")this.allow_wrap_or_preserved_newline(T),pe=this._flags.last_token.type===o.START_BLOCK,_e=!1;else if(h(T.text,["--","++","!","~"])||J){if((this._flags.last_token.type===o.COMMA||this._flags.last_token.type===o.START_EXPR)&&this.allow_wrap_or_preserved_newline(T),pe=!1,_e=!1,T.newlines&&(T.text==="--"||T.text==="++"||T.text==="~")){var oe=A(this._flags.last_token,S)&&T.newlines;oe&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(oe,!0)}this._flags.last_token.text===";"&&U(this._flags.mode)&&(pe=!0),this._flags.last_token.type===o.RESERVED?pe=!0:this._flags.last_token.type===o.END_EXPR?pe=!(this._flags.last_token.text==="]"&&(T.text==="--"||T.text==="++")):this._flags.last_token.type===o.OPERATOR&&(pe=h(T.text,["--","-","++","+"])&&h(this._flags.last_token.text,["--","-","++","+"]),h(T.text,["+","-"])&&h(this._flags.last_token.text,["--","++"])&&(_e=!0)),(this._flags.mode===d.BlockStatement&&!this._flags.inline_frame||this._flags.mode===d.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||pe,this.print_token(T),this._output.space_before_token=_e},H.prototype.handle_block_comment=function(T,K){if(this._output.raw){this._output.add_raw_token(T),T.directives&&T.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(T.directives){this.print_newline(!1,K),this.print_token(T),T.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!u.newline.test(T.text)&&!T.newlines){this._output.space_before_token=!0,this.print_token(T),this._output.space_before_token=!0;return}else this.print_block_commment(T,K)},H.prototype.print_block_commment=function(T,K){var J=l(T.text),ie,pe=!1,_e=!1,Te=T.whitespace_before,he=Te.length;if(this.print_newline(!1,K),this.print_token_line_indentation(T),this._output.add_token(J[0]),this.print_newline(!1,K),J.length>1){for(J=J.slice(1),pe=P(J,"*"),_e=j(J,Te),pe&&(this._flags.alignment=1),ie=0;ie<J.length;ie++)pe?(this.print_token_line_indentation(T),this._output.add_token(O(J[ie]))):_e&&J[ie]?(this.print_token_line_indentation(T),this._output.add_token(J[ie].substring(he))):(this._output.current_line.set_indent(-1),this._output.add_token(J[ie])),this.print_newline(!1,K);this._flags.alignment=0}},H.prototype.handle_comment=function(T,K){T.newlines?this.print_newline(!1,K):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(T),this.print_newline(!1,K)},H.prototype.handle_dot=function(T){this.start_of_statement(T)||this.handle_whitespace_and_comments(T,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),A(this._flags.last_token,S)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(T,this._flags.last_token.text===")"&&this._options.break_chained_methods),this._options.unindent_chained_methods&&this._output.just_added_newline()&&this.deindent(),this.print_token(T)},H.prototype.handle_unknown=function(T,K){this.print_token(T),T.text[T.text.length-1]===`
|
|
`&&this.print_newline(!1,K)},H.prototype.handle_eof=function(T){for(;this._flags.mode===d.Statement;)this.restore_mode();this.handle_whitespace_and_comments(T)},k.exports.Beautifier=H},function(k){function R(m){this.__parent=m,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}R.prototype.clone_empty=function(){var m=new R(this.__parent);return m.set_indent(this.__indent_count,this.__alignment_count),m},R.prototype.item=function(m){return m<0?this.__items[this.__items.length+m]:this.__items[m]},R.prototype.has_match=function(m){for(var u=this.__items.length-1;u>=0;u--)if(this.__items[u].match(m))return!0;return!1},R.prototype.set_indent=function(m,u){this.is_empty()&&(this.__indent_count=m||0,this.__alignment_count=u||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},R.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},R.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},R.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var m=this.__parent.current_line;return m.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),m.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),m.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,m.__items[0]===" "&&(m.__items.splice(0,1),m.__character_count-=1),!0}return!1},R.prototype.is_empty=function(){return this.__items.length===0},R.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},R.prototype.push=function(m){this.__items.push(m);var u=m.lastIndexOf(`
|
|
`);u!==-1?this.__character_count=m.length-u:this.__character_count+=m.length},R.prototype.pop=function(){var m=null;return this.is_empty()||(m=this.__items.pop(),this.__character_count-=m.length),m},R.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},R.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},R.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},R.prototype.toString=function(){var m="";return this.is_empty()?this.__parent.indent_empty_lines&&(m=this.__parent.get_indent_string(this.__indent_count)):(m=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),m+=this.__items.join("")),m};function b(m,u){this.__cache=[""],this.__indent_size=m.indent_size,this.__indent_string=m.indent_char,m.indent_with_tabs||(this.__indent_string=new Array(m.indent_size+1).join(m.indent_char)),u=u||"",m.indent_level>0&&(u=new Array(m.indent_level+1).join(this.__indent_string)),this.__base_string=u,this.__base_string_length=u.length}b.prototype.get_indent_size=function(m,u){var r=this.__base_string_length;return u=u||0,m<0&&(r=0),r+=m*this.__indent_size,r+=u,r},b.prototype.get_indent_string=function(m,u){var r=this.__base_string;return u=u||0,m<0&&(m=0,r=""),u+=m*this.__indent_size,this.__ensure_cache(u),r+=this.__cache[u],r},b.prototype.__ensure_cache=function(m){for(;m>=this.__cache.length;)this.__add_column()},b.prototype.__add_column=function(){var m=this.__cache.length,u=0,r="";this.__indent_size&&m>=this.__indent_size&&(u=Math.floor(m/this.__indent_size),m-=u*this.__indent_size,r=new Array(u+1).join(this.__indent_string)),m&&(r+=new Array(m+1).join(" ")),this.__cache.push(r)};function v(m,u){this.__indent_cache=new b(m,u),this.raw=!1,this._end_with_newline=m.end_with_newline,this.indent_size=m.indent_size,this.wrap_line_length=m.wrap_line_length,this.indent_empty_lines=m.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new R(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}v.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},v.prototype.get_line_number=function(){return this.__lines.length},v.prototype.get_indent_string=function(m,u){return this.__indent_cache.get_indent_string(m,u)},v.prototype.get_indent_size=function(m,u){return this.__indent_cache.get_indent_size(m,u)},v.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},v.prototype.add_new_line=function(m){return this.is_empty()||!m&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},v.prototype.get_code=function(m){this.trim(!0);var u=this.current_line.pop();u&&(u[u.length-1]===`
|
|
`&&(u=u.replace(/\n+$/g,"")),this.current_line.push(u)),this._end_with_newline&&this.__add_outputline();var r=this.__lines.join(`
|
|
`);return m!==`
|
|
`&&(r=r.replace(/[\n]/g,m)),r},v.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},v.prototype.set_indent=function(m,u){return m=m||0,u=u||0,this.next_line.set_indent(m,u),this.__lines.length>1?(this.current_line.set_indent(m,u),!0):(this.current_line.set_indent(),!1)},v.prototype.add_raw_token=function(m){for(var u=0;u<m.newlines;u++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(m.whitespace_before),this.current_line.push(m.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},v.prototype.add_token=function(m){this.__add_space_before_token(),this.current_line.push(m),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},v.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},v.prototype.remove_indent=function(m){for(var u=this.__lines.length;m<u;)this.__lines[m]._remove_indent(),m++;this.current_line._remove_wrap_indent()},v.prototype.trim=function(m){for(m=m===void 0?!1:m,this.current_line.trim();m&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},v.prototype.just_added_newline=function(){return this.current_line.is_empty()},v.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},v.prototype.ensure_empty_line_above=function(m,u){for(var r=this.__lines.length-2;r>=0;){var c=this.__lines[r];if(c.is_empty())break;if(c.item(0).indexOf(m)!==0&&c.item(-1)!==u){this.__lines.splice(r+1,0,new R(this)),this.previous_line=this.__lines[this.__lines.length-2];break}r--}},k.exports.Output=v},function(k){function R(b,v,m,u){this.type=b,this.text=v,this.comments_before=null,this.newlines=m||0,this.whitespace_before=u||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}k.exports.Token=R},function(k,R){var b="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",v="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",m="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc",u="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f",r="(?:\\\\u[0-9a-fA-F]{4}|["+b+m+"])",c="(?:\\\\u[0-9a-fA-F]{4}|["+v+m+u+"])*";R.identifier=new RegExp(r+c,"g"),R.identifierStart=new RegExp(r),R.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+v+m+u+"])+");var s=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;R.newline=/[\n\r\u2028\u2029]/,R.lineBreak=new RegExp(`\r
|
|
|`+R.newline.source),R.allLineBreaks=new RegExp(R.lineBreak.source,"g")},function(k,R,b){var v=b(6).Options,m=["before-newline","after-newline","preserve-newline"];function u(r){v.call(this,r,"js");var c=this.raw_options.brace_style||null;c==="expand-strict"?this.raw_options.brace_style="expand":c==="collapse-preserve-inline"?this.raw_options.brace_style="collapse,preserve-inline":this.raw_options.braces_on_own_line!==void 0&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var s=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var a=0;a<s.length;a++)s[a]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=s[a];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",m),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}u.prototype=new v,k.exports.Options=u},function(k){function R(m,u){this.raw_options=b(m,u),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}R.prototype._get_array=function(m,u){var r=this.raw_options[m],c=u||[];return typeof r=="object"?r!==null&&typeof r.concat=="function"&&(c=r.concat()):typeof r=="string"&&(c=r.split(/[^a-zA-Z0-9_\/\-]+/)),c},R.prototype._get_boolean=function(m,u){var r=this.raw_options[m],c=r===void 0?!!u:!!r;return c},R.prototype._get_characters=function(m,u){var r=this.raw_options[m],c=u||"";return typeof r=="string"&&(c=r.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),c},R.prototype._get_number=function(m,u){var r=this.raw_options[m];u=parseInt(u,10),isNaN(u)&&(u=0);var c=parseInt(r,10);return isNaN(c)&&(c=u),c},R.prototype._get_selection=function(m,u,r){var c=this._get_selection_list(m,u,r);if(c.length!==1)throw new Error("Invalid Option Value: The option '"+m+`' can only be one of the following values:
|
|
`+u+`
|
|
You passed in: '`+this.raw_options[m]+"'");return c[0]},R.prototype._get_selection_list=function(m,u,r){if(!u||u.length===0)throw new Error("Selection list cannot be empty.");if(r=r||[u[0]],!this._is_valid_selection(r,u))throw new Error("Invalid Default Value!");var c=this._get_array(m,r);if(!this._is_valid_selection(c,u))throw new Error("Invalid Option Value: The option '"+m+`' can contain only the following values:
|
|
`+u+`
|
|
You passed in: '`+this.raw_options[m]+"'");return c},R.prototype._is_valid_selection=function(m,u){return m.length&&u.length&&!m.some(function(r){return u.indexOf(r)===-1})};function b(m,u){var r={};m=v(m);var c;for(c in m)c!==u&&(r[c]=m[c]);if(u&&m[u])for(c in m[u])r[c]=m[u][c];return r}function v(m){var u={},r;for(r in m){var c=r.replace(/-/g,"_");u[c]=m[r]}return u}k.exports.Options=R,k.exports.normalizeOpts=v,k.exports.mergeOpts=b},function(k,R,b){var v=b(8).InputScanner,m=b(9).Tokenizer,u=b(9).TOKEN,r=b(13).Directives,c=b(4),s=b(12).Pattern,a=b(14).TemplatablePattern;function o(P,j){return j.indexOf(P)!==-1}var h={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:u.START,RAW:u.RAW,EOF:u.EOF},O=new r(/\/\*/,/\*\//),w=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,x=/[0-9]/,A=/[^\d\.]/,S=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),y=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";y=y.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),y="\\?\\.(?!\\d) "+y,y=y.replace(/ /g,"|");var _=new RegExp(y),p="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),d=p.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),g=new RegExp("^(?:"+d.join("|")+")$"),l,E=function(P,j){m.call(this,P,j),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var H=new s(this._input),I=new a(this._input).read_options(this._options);this.__patterns={template:I,identifier:I.starting_with(c.identifier).matching(c.identifierMatch),number:H.matching(w),punct:H.matching(_),comment:H.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:H.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:H.matching(/<!--/),html_comment_end:H.matching(/-->/),include:H.starting_with(/#include/).until_after(c.lineBreak),shebang:H.starting_with(/#!/).until_after(c.lineBreak),xml:H.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),single_quote:I.until(/['\\\n\r\u2028\u2029]/),double_quote:I.until(/["\\\n\r\u2028\u2029]/),template_text:I.until(/[`\\$]/),template_expression:I.until(/[`}\\]/)}};E.prototype=new m,E.prototype._is_comment=function(P){return P.type===h.COMMENT||P.type===h.BLOCK_COMMENT||P.type===h.UNKNOWN},E.prototype._is_opening=function(P){return P.type===h.START_BLOCK||P.type===h.START_EXPR},E.prototype._is_closing=function(P,j){return(P.type===h.END_BLOCK||P.type===h.END_EXPR)&&j&&(P.text==="]"&&j.text==="["||P.text===")"&&j.text==="("||P.text==="}"&&j.text==="{")},E.prototype._reset=function(){l=!1},E.prototype._get_next_token=function(P,j){var H=null;this._readWhitespace();var I=this._input.peek();return I===null?this._create_token(h.EOF,""):(H=H||this._read_non_javascript(I),H=H||this._read_string(I),H=H||this._read_word(P),H=H||this._read_singles(I),H=H||this._read_comment(I),H=H||this._read_regexp(I,P),H=H||this._read_xml(I,P),H=H||this._read_punctuation(),H=H||this._create_token(h.UNKNOWN,this._input.next()),H)},E.prototype._read_word=function(P){var j;if(j=this.__patterns.identifier.read(),j!=="")return j=j.replace(c.allLineBreaks,`
|
|
`),!(P.type===h.DOT||P.type===h.RESERVED&&(P.text==="set"||P.text==="get"))&&g.test(j)?(j==="in"||j==="of")&&(P.type===h.WORD||P.type===h.STRING)?this._create_token(h.OPERATOR,j):this._create_token(h.RESERVED,j):this._create_token(h.WORD,j);if(j=this.__patterns.number.read(),j!=="")return this._create_token(h.WORD,j)},E.prototype._read_singles=function(P){var j=null;return P==="("||P==="["?j=this._create_token(h.START_EXPR,P):P===")"||P==="]"?j=this._create_token(h.END_EXPR,P):P==="{"?j=this._create_token(h.START_BLOCK,P):P==="}"?j=this._create_token(h.END_BLOCK,P):P===";"?j=this._create_token(h.SEMICOLON,P):P==="."&&A.test(this._input.peek(1))?j=this._create_token(h.DOT,P):P===","&&(j=this._create_token(h.COMMA,P)),j&&this._input.next(),j},E.prototype._read_punctuation=function(){var P=this.__patterns.punct.read();if(P!=="")return P==="="?this._create_token(h.EQUALS,P):P==="?."?this._create_token(h.DOT,P):this._create_token(h.OPERATOR,P)},E.prototype._read_non_javascript=function(P){var j="";if(P==="#"){if(this._is_first_token()&&(j=this.__patterns.shebang.read(),j))return this._create_token(h.UNKNOWN,j.trim()+`
|
|
`);if(j=this.__patterns.include.read(),j)return this._create_token(h.UNKNOWN,j.trim()+`
|
|
`);P=this._input.next();var H="#";if(this._input.hasNext()&&this._input.testChar(x)){do P=this._input.next(),H+=P;while(this._input.hasNext()&&P!=="#"&&P!=="=");return P==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(H+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(H+="{}",this._input.next(),this._input.next())),this._create_token(h.WORD,H)}this._input.back()}else if(P==="<"&&this._is_first_token()){if(j=this.__patterns.html_comment_start.read(),j){for(;this._input.hasNext()&&!this._input.testChar(c.newline);)j+=this._input.next();return l=!0,this._create_token(h.COMMENT,j)}}else if(l&&P==="-"&&(j=this.__patterns.html_comment_end.read(),j))return l=!1,this._create_token(h.COMMENT,j);return null},E.prototype._read_comment=function(P){var j=null;if(P==="/"){var H="";if(this._input.peek(1)==="*"){H=this.__patterns.block_comment.read();var I=O.get_directives(H);I&&I.ignore==="start"&&(H+=O.readIgnored(this._input)),H=H.replace(c.allLineBreaks,`
|
|
`),j=this._create_token(h.BLOCK_COMMENT,H),j.directives=I}else this._input.peek(1)==="/"&&(H=this.__patterns.comment.read(),j=this._create_token(h.COMMENT,H))}return j},E.prototype._read_string=function(P){if(P==="`"||P==="'"||P==='"'){var j=this._input.next();return this.has_char_escapes=!1,P==="`"?j+=this._read_string_recursive("`",!0,"${"):j+=this._read_string_recursive(P),this.has_char_escapes&&this._options.unescape_strings&&(j=U(j)),this._input.peek()===P&&(j+=this._input.next()),j=j.replace(c.allLineBreaks,`
|
|
`),this._create_token(h.STRING,j)}return null},E.prototype._allow_regexp_or_xml=function(P){return P.type===h.RESERVED&&o(P.text,["return","case","throw","else","do","typeof","yield"])||P.type===h.END_EXPR&&P.text===")"&&P.opened.previous.type===h.RESERVED&&o(P.opened.previous.text,["if","while","for"])||o(P.type,[h.COMMENT,h.START_EXPR,h.START_BLOCK,h.START,h.END_BLOCK,h.OPERATOR,h.EQUALS,h.EOF,h.SEMICOLON,h.COMMA])},E.prototype._read_regexp=function(P,j){if(P==="/"&&this._allow_regexp_or_xml(j)){for(var H=this._input.next(),I=!1,T=!1;this._input.hasNext()&&(I||T||this._input.peek()!==P)&&!this._input.testChar(c.newline);)H+=this._input.peek(),I?I=!1:(I=this._input.peek()==="\\",this._input.peek()==="["?T=!0:this._input.peek()==="]"&&(T=!1)),this._input.next();return this._input.peek()===P&&(H+=this._input.next(),H+=this._input.read(c.identifier)),this._create_token(h.STRING,H)}return null},E.prototype._read_xml=function(P,j){if(this._options.e4x&&P==="<"&&this._allow_regexp_or_xml(j)){var H="",I=this.__patterns.xml.read_match();if(I){for(var T=I[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),K=T.indexOf("{")===0,J=0;I;){var ie=!!I[1],pe=I[2],_e=!!I[I.length-1]||pe.slice(0,8)==="![CDATA[";if(!_e&&(pe===T||K&&pe.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(ie?--J:++J),H+=I[0],J<=0)break;I=this.__patterns.xml.read_match()}return I||(H+=this._input.match(/[\s\S]*/g)[0]),H=H.replace(c.allLineBreaks,`
|
|
`),this._create_token(h.STRING,H)}}return null};function U(P){for(var j="",H=0,I=new v(P),T=null;I.hasNext();)if(T=I.match(/([\s]|[^\\]|\\\\)+/g),T&&(j+=T[0]),I.peek()==="\\"){if(I.next(),I.peek()==="x")T=I.match(/x([0-9A-Fa-f]{2})/g);else if(I.peek()==="u")T=I.match(/u([0-9A-Fa-f]{4})/g);else{j+="\\",I.hasNext()&&(j+=I.next());continue}if(!T)return P;if(H=parseInt(T[1],16),H>126&&H<=255&&T[0].indexOf("x")===0)return P;if(H>=0&&H<32){j+="\\"+T[0];continue}else H===34||H===39||H===92?j+="\\"+String.fromCharCode(H):j+=String.fromCharCode(H)}return j}E.prototype._read_string_recursive=function(P,j,H){var I,T;P==="'"?T=this.__patterns.single_quote:P==='"'?T=this.__patterns.double_quote:P==="`"?T=this.__patterns.template_text:P==="}"&&(T=this.__patterns.template_expression);for(var K=T.read(),J="";this._input.hasNext();){if(J=this._input.next(),J===P||!j&&c.newline.test(J)){this._input.back();break}else J==="\\"&&this._input.hasNext()?(I=this._input.peek(),I==="x"||I==="u"?this.has_char_escapes=!0:I==="\r"&&this._input.peek(1)===`
|
|
`&&this._input.next(),J+=this._input.next()):H&&(H==="${"&&J==="$"&&this._input.peek()==="{"&&(J+=this._input.next()),H===J&&(P==="`"?J+=this._read_string_recursive("}",j,"`"):J+=this._read_string_recursive("`",j,"${"),this._input.hasNext()&&(J+=this._input.next())));J+=T.read(),K+=J}return K},k.exports.Tokenizer=E,k.exports.TOKEN=h,k.exports.positionable_operators=S.slice(),k.exports.line_starters=p.slice()},function(k){var R=RegExp.prototype.hasOwnProperty("sticky");function b(v){this.__input=v||"",this.__input_length=this.__input.length,this.__position=0}b.prototype.restart=function(){this.__position=0},b.prototype.back=function(){this.__position>0&&(this.__position-=1)},b.prototype.hasNext=function(){return this.__position<this.__input_length},b.prototype.next=function(){var v=null;return this.hasNext()&&(v=this.__input.charAt(this.__position),this.__position+=1),v},b.prototype.peek=function(v){var m=null;return v=v||0,v+=this.__position,v>=0&&v<this.__input_length&&(m=this.__input.charAt(v)),m},b.prototype.__match=function(v,m){v.lastIndex=m;var u=v.exec(this.__input);return u&&!(R&&v.sticky)&&(u.index!==m&&(u=null)),u},b.prototype.test=function(v,m){return m=m||0,m+=this.__position,m>=0&&m<this.__input_length?!!this.__match(v,m):!1},b.prototype.testChar=function(v,m){var u=this.peek(m);return v.lastIndex=0,u!==null&&v.test(u)},b.prototype.match=function(v){var m=this.__match(v,this.__position);return m?this.__position+=m[0].length:m=null,m},b.prototype.read=function(v,m,u){var r="",c;return v&&(c=this.match(v),c&&(r+=c[0])),m&&(c||!v)&&(r+=this.readUntil(m,u)),r},b.prototype.readUntil=function(v,m){var u="",r=this.__position;v.lastIndex=this.__position;var c=v.exec(this.__input);return c?(r=c.index,m&&(r+=c[0].length)):r=this.__input_length,u=this.__input.substring(this.__position,r),this.__position=r,u},b.prototype.readUntilAfter=function(v){return this.readUntil(v,!0)},b.prototype.get_regexp=function(v,m){var u=null,r="g";return m&&R&&(r="y"),typeof v=="string"&&v!==""?u=new RegExp(v,r):v&&(u=new RegExp(v.source,r)),u},b.prototype.get_literal_regexp=function(v){return RegExp(v.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},b.prototype.peekUntilAfter=function(v){var m=this.__position,u=this.readUntilAfter(v);return this.__position=m,u},b.prototype.lookBack=function(v){var m=this.__position-1;return m>=v.length&&this.__input.substring(m-v.length,m).toLowerCase()===v},k.exports.InputScanner=b},function(k,R,b){var v=b(8).InputScanner,m=b(3).Token,u=b(10).TokenStream,r=b(11).WhitespacePattern,c={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},s=function(a,o){this._input=new v(a),this._options=o||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new r(this._input)};s.prototype.tokenize=function(){this._input.restart(),this.__tokens=new u,this._reset();for(var a,o=new m(c.START,""),h=null,O=[],w=new u;o.type!==c.EOF;){for(a=this._get_next_token(o,h);this._is_comment(a);)w.add(a),a=this._get_next_token(o,h);w.isEmpty()||(a.comments_before=w,w=new u),a.parent=h,this._is_opening(a)?(O.push(h),h=a):h&&this._is_closing(a,h)&&(a.opened=h,h.closed=a,h=O.pop(),a.parent=h),a.previous=o,o.next=a,this.__tokens.add(a),o=a}return this.__tokens},s.prototype._is_first_token=function(){return this.__tokens.isEmpty()},s.prototype._reset=function(){},s.prototype._get_next_token=function(a,o){this._readWhitespace();var h=this._input.read(/.+/g);return h?this._create_token(c.RAW,h):this._create_token(c.EOF,"")},s.prototype._is_comment=function(a){return!1},s.prototype._is_opening=function(a){return!1},s.prototype._is_closing=function(a,o){return!1},s.prototype._create_token=function(a,o){var h=new m(a,o,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return h},s.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},k.exports.Tokenizer=s,k.exports.TOKEN=c},function(k){function R(b){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=b}R.prototype.restart=function(){this.__position=0},R.prototype.isEmpty=function(){return this.__tokens_length===0},R.prototype.hasNext=function(){return this.__position<this.__tokens_length},R.prototype.next=function(){var b=null;return this.hasNext()&&(b=this.__tokens[this.__position],this.__position+=1),b},R.prototype.peek=function(b){var v=null;return b=b||0,b+=this.__position,b>=0&&b<this.__tokens_length&&(v=this.__tokens[b]),v},R.prototype.add=function(b){this.__parent_token&&(b.parent=this.__parent_token),this.__tokens.push(b),this.__tokens_length+=1},k.exports.TokenStream=R},function(k,R,b){var v=b(12).Pattern;function m(u,r){v.call(this,u,r),r?this._line_regexp=this._input.get_regexp(r._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}m.prototype=new v,m.prototype.__set_whitespace_patterns=function(u,r){u+="\\t ",r+="\\n\\r",this._match_pattern=this._input.get_regexp("["+u+r+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+r+"]")},m.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var u=this._input.read(this._match_pattern);if(u===" ")this.whitespace_before_token=" ";else if(u){var r=this.__split(this._newline_regexp,u);this.newline_count=r.length-1,this.whitespace_before_token=r[this.newline_count]}return u},m.prototype.matching=function(u,r){var c=this._create();return c.__set_whitespace_patterns(u,r),c._update(),c},m.prototype._create=function(){return new m(this._input,this)},m.prototype.__split=function(u,r){u.lastIndex=0;for(var c=0,s=[],a=u.exec(r);a;)s.push(r.substring(c,a.index)),c=a.index+a[0].length,a=u.exec(r);return c<r.length?s.push(r.substring(c,r.length)):s.push(""),s},k.exports.WhitespacePattern=m},function(k){function R(b,v){this._input=b,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,v&&(this._starting_pattern=this._input.get_regexp(v._starting_pattern,!0),this._match_pattern=this._input.get_regexp(v._match_pattern,!0),this._until_pattern=this._input.get_regexp(v._until_pattern),this._until_after=v._until_after)}R.prototype.read=function(){var b=this._input.read(this._starting_pattern);return(!this._starting_pattern||b)&&(b+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),b},R.prototype.read_match=function(){return this._input.match(this._match_pattern)},R.prototype.until_after=function(b){var v=this._create();return v._until_after=!0,v._until_pattern=this._input.get_regexp(b),v._update(),v},R.prototype.until=function(b){var v=this._create();return v._until_after=!1,v._until_pattern=this._input.get_regexp(b),v._update(),v},R.prototype.starting_with=function(b){var v=this._create();return v._starting_pattern=this._input.get_regexp(b,!0),v._update(),v},R.prototype.matching=function(b){var v=this._create();return v._match_pattern=this._input.get_regexp(b,!0),v._update(),v},R.prototype._create=function(){return new R(this._input,this)},R.prototype._update=function(){},k.exports.Pattern=R},function(k){function R(b,v){b=typeof b=="string"?b:b.source,v=typeof v=="string"?v:v.source,this.__directives_block_pattern=new RegExp(b+/ beautify( \w+[:]\w+)+ /.source+v,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(b+/\sbeautify\signore:end\s/.source+v,"g")}R.prototype.get_directives=function(b){if(!b.match(this.__directives_block_pattern))return null;var v={};this.__directive_pattern.lastIndex=0;for(var m=this.__directive_pattern.exec(b);m;)v[m[1]]=m[2],m=this.__directive_pattern.exec(b);return v},R.prototype.readIgnored=function(b){return b.readUntilAfter(this.__directives_end_ignore_pattern)},k.exports.Directives=R},function(k,R,b){var v=b(12).Pattern,m={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function u(r,c){v.call(this,r,c),this.__template_pattern=null,this._disabled=Object.assign({},m),this._excluded=Object.assign({},m),c&&(this.__template_pattern=this._input.get_regexp(c.__template_pattern),this._excluded=Object.assign(this._excluded,c._excluded),this._disabled=Object.assign(this._disabled,c._disabled));var s=new v(r);this.__patterns={handlebars_comment:s.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:s.starting_with(/{{{/).until_after(/}}}/),handlebars:s.starting_with(/{{/).until_after(/}}/),php:s.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:s.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:s.starting_with(/{%/).until_after(/%}/),django_value:s.starting_with(/{{/).until_after(/}}/),django_comment:s.starting_with(/{#/).until_after(/#}/),smarty:s.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:s.starting_with(/{\*/).until_after(/\*}/),smarty_literal:s.starting_with(/{literal}/).until_after(/{\/literal}/)}}u.prototype=new v,u.prototype._create=function(){return new u(this._input,this)},u.prototype._update=function(){this.__set_templated_pattern()},u.prototype.disable=function(r){var c=this._create();return c._disabled[r]=!0,c._update(),c},u.prototype.read_options=function(r){var c=this._create();for(var s in m)c._disabled[s]=r.templating.indexOf(s)===-1;return c._update(),c},u.prototype.exclude=function(r){var c=this._create();return c._excluded[r]=!0,c._update(),c},u.prototype.read=function(){var r="";this._match_pattern?r=this._input.read(this._starting_pattern):r=this._input.read(this._starting_pattern,this.__template_pattern);for(var c=this._read_template();c;)this._match_pattern?c+=this._input.read(this._match_pattern):c+=this._input.readUntil(this.__template_pattern),r+=c,c=this._read_template();return this._until_after&&(r+=this._input.readUntilAfter(this._until_pattern)),r},u.prototype.__set_templated_pattern=function(){var r=[];this._disabled.php||r.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||r.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||r.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(r.push(this.__patterns.django._starting_pattern.source),r.push(this.__patterns.django_value._starting_pattern.source),r.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||r.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&r.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+r.join("|")+")")},u.prototype._read_template=function(){var r="",c=this._input.peek();if(c==="<"){var s=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&s==="?"&&(r=r||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&s==="%"&&(r=r||this.__patterns.erb.read())}else c==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(r=r||this.__patterns.handlebars_comment.read(),r=r||this.__patterns.handlebars_unescaped.read(),r=r||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(r=r||this.__patterns.django_value.read()),this._excluded.django||(r=r||this.__patterns.django_comment.read(),r=r||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(r=r||this.__patterns.smarty_comment.read(),r=r||this.__patterns.smarty_literal.read(),r=r||this.__patterns.smarty.read()));return r},k.exports.TemplatablePattern=u}],D={};function G(k){var R=D[k];if(R!==void 0)return R.exports;var b=D[k]={exports:{}};return F[k](b,b.exports,G),b.exports}var B=G(0);N=B})();var Q=N;!(ce=[],Y=function(){return{js_beautify:Q}}.apply(Ke,ce),Y!==void 0&&(ut.exports=Y))})()},"6eGT":function(ut,Ke,$){"use strict";function ce(Y){return null}Ke.a=ce},"7Cbv":function(ut,Ke,$){"use strict";var ce=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Y=new Uint8Array(16);function N(){if(!ce)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ce(Y)}var Q=/^(?:[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 F(m){return typeof m=="string"&&Q.test(m)}for(var D=F,G=[],B=0;B<256;++B)G.push((B+256).toString(16).substr(1));function k(m){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=(G[m[u+0]]+G[m[u+1]]+G[m[u+2]]+G[m[u+3]]+"-"+G[m[u+4]]+G[m[u+5]]+"-"+G[m[u+6]]+G[m[u+7]]+"-"+G[m[u+8]]+G[m[u+9]]+"-"+G[m[u+10]]+G[m[u+11]]+G[m[u+12]]+G[m[u+13]]+G[m[u+14]]+G[m[u+15]]).toLowerCase();if(!D(r))throw TypeError("Stringified UUID is invalid");return r}var R=k;function b(m,u,r){m=m||{};var c=m.random||(m.rng||N)();if(c[6]=c[6]&15|64,c[8]=c[8]&63|128,u){r=r||0;for(var s=0;s<16;++s)u[r+s]=c[s];return u}return R(c)}var v=Ke.a=b},"7ahc":function(ut,Ke,$){"use strict";$.d(Ke,"a",function(){return O});var ce=$("k1fw"),Y=$("0Owb"),N=$("+L6B"),Q=$("2/Rp"),F=$("y8nQ"),D=$("Vl3Y"),G=$("tJVT"),B=$("OaEy"),k=$("2fM7"),R=$("q1tI"),b=$.n(R),v=$("VrN/"),m=$.n(v),u=$("p77/"),r=$.n(u),c=$("c5Ni"),s=$.n(c),a=k.a.Option,o={labelCol:{span:4},wrapperCol:{span:20}},h={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"]};Ke.b=function(w){var x=w.callback,A=w.onCancel,S=Object(R.useState)("python"),y=Object(G.a)(S,2),_=y[0],p=y[1];function d(l){p(h[l][1])}function g(l){x(l)}return b.a.createElement(D.a,Object(Y.a)({},o,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:g}),b.a.createElement(D.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},b.a.createElement(k.a,{onChange:d},Object.keys(h).map(function(l){return b.a.createElement(a,{key:l,value:l},h[l][0])}))),b.a.createElement(D.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},b.a.createElement(O,{mode:_})),b.a.createElement("div",{className:"flex-container flex-end"},b.a.createElement(Q.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(Q.a,{type:"ghost",onClick:A},"\u53D6\u6D88")))};function O(w){var x=w.value,A=w.onChange,S=w.mode,y=w.options,_=y===void 0?{}:y,p=Object(R.useRef)(),d=Object(R.useState)(),g=Object(G.a)(d,2),l=g[0],E=g[1];return Object(R.useEffect)(function(){if(l){function U(P){var j=P.getValue();A&&A(j)}return l.on("change",U),function(){l.off("change",U)}}},[l,A]),Object(R.useEffect)(function(){l&&l.setOption("mode",S)},[l,S]),Object(R.useEffect)(function(){l&&((x!==l.getValue()||x==="")&&setTimeout(function(){l.setValue(x||" ")},300))},[l,x]),Object(R.useEffect)(function(){if(p.current&&!l){var U=m.a.fromTextArea(p.current,Object(ce.a)({mode:S,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},_));E(U)}},[p.current,l]),b.a.createElement("div",{className:"my-codemirror-container"},b.a.createElement("textarea",{ref:p}))}},"7qnI":function(ut,Ke,$){"use strict";var ce=$("5Dmo"),Y=$("3S7+"),N=$("fWQN"),Q=$("mtLc"),F=$("yKVA"),D=$("879j"),G=$("5NDa"),B=$("5rEg"),k=$("q1tI"),R=$.n(k),b=$("O2Wb"),v=$.n(b),m=B.a.TextArea,u=function(r){Object(F.a)(s,r);var c=Object(D.a)(s);function s(){return Object(N.a)(this,s),c.apply(this,arguments)}return Object(Q.a)(s,[{key:"render",value:function(){var o=this,h=this.props,O=h.index,w=h.onAnswerChange,x=h.addChildAnswer,A=h.exerciseIsPublish,S=h.answers,y=h.activeOptionErrorIndex,_=h.flex,p=_===void 0?"0 0 1000px":_;return R.a.createElement("div",{className:v.a.flex},R.a.createElement("div",{className:"".concat(v.a.color666," mb5 mt6"),style:{flex:"0 0 90px"}},"\u7B54\u6848(\u586B\u7A7A",O+1,"):"),R.a.createElement("div",{className:"".concat(v.a.flex," ").concat(v.a.flex1),style:{flexDirection:"column"}},S.map(function(d,g){var l="".concat(O,"-").concat(g);return R.a.createElement("div",{className:"".concat(v.a.flex," ").concat(v.a.flex1),key:g},R.a.createElement("div",{className:v.a.flex1,style:{flex:p}},R.a.createElement("div",null,R.a.createElement(m,{className:l===y?v.a.error:"",spellCheck:!1,rows:4,value:d||"",defaultValue:"\u8BF7\u8F93\u5165\u53C2\u8003\u7B54\u6848".concat(g==0?"":"(\u53EF\u9009)"),onChange:function(U){return w(O,g,U.target.value)},style:{minHeight:95}}))),!A&&R.a.createElement(R.a.Fragment,null,g!=0&&R.a.createElement(Y.a,{title:"\u5220\u9664"},R.a.createElement("i",{className:"".concat(v.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return o.props.deleteChildAnswer(O,g)},style:{float:"right"}})),g===0&&R.a.createElement(Y.a,{title:"\u5220\u9664"},R.a.createElement("i",{className:"".concat(v.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return o.props.deleteChildAnswermain(O,g)},style:{float:"right"}})),R.a.createElement(Y.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},R.a.createElement("i",{className:"".concat(v.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return x(O)},style:{float:"right",visibility:g==S.length-1?"":"hidden"}}))))})))}}]),s}(k.Component);Ke.a=u},"815F":function(ut,Ke,$){"use strict";$.d(Ke,"e",function(){return G}),$.d(Ke,"c",function(){return k}),$.d(Ke,"d",function(){return R}),$.d(Ke,"a",function(){return v}),$.d(Ke,"f",function(){return m}),$.d(Ke,"b",function(){return u});var ce=$("KQm4"),Y=$("VTBJ"),N=$("Ff2n"),Q=$("Zm9Q"),F=$("Kwbf"),D=$("OZM5");function G(r,c){return r!=null?r:c}function B(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],c=new Map;function s(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(a||[]).forEach(function(h){var O=h.key,w=h.children;Object(F.a)(O!=null,"Tree node must have a certain key: [".concat(o).concat(O,"]"));var x=String(O);Object(F.a)(!c.has(x)||O===null||O===void 0,"Same 'key' exist in the Tree: ".concat(x)),c.set(x,!0),s(w,"".concat(o).concat(x," > "))})}s(r)}function k(r){function c(s){var a=Object(Q.a)(s);return a.map(function(o){if(!Object(D.i)(o))return Object(F.a)(!o,"Tree/TreeNode can only accept TreeNode as children."),null;var h=o.key,O=o.props,w=O.children,x=Object(N.a)(O,["children"]),A=Object(Y.a)({key:h},x),S=c(w);return S.length&&(A.children=S),A}).filter(function(o){return o})}return c(r)}function R(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],s=new Set(c===!0?[]:c),a=[];function o(h){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return h.map(function(w,x){var A=Object(D.h)(O?O.pos:"0",x),S=G(w.key,A),y=Object(Y.a)(Object(Y.a)({},w),{},{parent:O,pos:A,children:null,data:w,isStart:[].concat(Object(ce.a)(O?O.isStart:[]),[x===0]),isEnd:[].concat(Object(ce.a)(O?O.isEnd:[]),[x===h.length-1])});return a.push(y),c===!0||s.has(S)?y.children=o(w.children||[],y):y.children=[],y})}return o(r),a}function b(r,c,s){var a;s?typeof s=="string"?a=function(O){return O[s]}:typeof s=="function"&&(a=function(O){return s(O)}):a=function(O,w){return G(O.key,w)};function o(h,O,w){var x=h?h.children:r,A=h?Object(D.h)(w.pos,O):"0";if(h){var S=a(h,A),y={node:h,index:O,pos:A,key:S,parentPos:w.node?w.pos:null,level:w.level+1};c(y)}x&&x.forEach(function(_,p){o(_,p,{node:h,pos:A,level:w?w.level+1:-1})})}o(null)}function v(r){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=c.initWrapper,a=c.processEntity,o=c.onProcessFinished,h=arguments.length>2?arguments[2]:void 0,O={},w={},x={posEntities:O,keyEntities:w};return s&&(x=s(x)||x),b(r,function(A){var S=A.node,y=A.index,_=A.pos,p=A.key,d=A.parentPos,g=A.level,l={node:S,index:y,key:p,pos:_,level:g},E=G(p,_);O[_]=l,w[E]=l,l.parent=O[d],l.parent&&(l.parent.children=l.parent.children||[],l.parent.children.push(l)),a&&a(l,x)},h),o&&o(x),x}function m(r,c){var s=c.expandedKeys,a=c.selectedKeys,o=c.loadedKeys,h=c.loadingKeys,O=c.checkedKeys,w=c.halfCheckedKeys,x=c.dragOverNodeKey,A=c.dropPosition,S=c.keyEntities,y=S[r],_={eventKey:r,expanded:s.indexOf(r)!==-1,selected:a.indexOf(r)!==-1,loaded:o.indexOf(r)!==-1,loading:h.indexOf(r)!==-1,checked:O.indexOf(r)!==-1,halfChecked:w.indexOf(r)!==-1,pos:String(y?y.pos:""),dragOver:x===r&&A===0,dragOverGapTop:x===r&&A===-1,dragOverGapBottom:x===r&&A===1};return _}function u(r){var c=r.data,s=r.expanded,a=r.selected,o=r.checked,h=r.loaded,O=r.loading,w=r.halfChecked,x=r.dragOver,A=r.dragOverGapTop,S=r.dragOverGapBottom,y=r.pos,_=r.active,p=Object(Y.a)(Object(Y.a)({},c),{},{expanded:s,selected:a,checked:o,loaded:h,loading:O,halfChecked:w,dragOver:x,dragOverGapTop:A,dragOverGapBottom:S,pos:y,active:_});return"props"in p||Object.defineProperty(p,"props",{get:function(){return Object(F.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),r}}),p}},"8EBN":function(ut,Ke,$){(function(ce){ce($("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 Y=0;Y<ce.modeInfo.length;Y++){var N=ce.modeInfo[Y];N.mimes&&(N.mime=N.mimes[0])}ce.findModeByMIME=function(Q){Q=Q.toLowerCase();for(var F=0;F<ce.modeInfo.length;F++){var D=ce.modeInfo[F];if(D.mime==Q)return D;if(D.mimes){for(var G=0;G<D.mimes.length;G++)if(D.mimes[G]==Q)return D}}if(/\+xml$/.test(Q))return ce.findModeByMIME("application/xml");if(/\+json$/.test(Q))return ce.findModeByMIME("application/json")},ce.findModeByExtension=function(Q){Q=Q.toLowerCase();for(var F=0;F<ce.modeInfo.length;F++){var D=ce.modeInfo[F];if(D.ext){for(var G=0;G<D.ext.length;G++)if(D.ext[G]==Q)return D}}},ce.findModeByFileName=function(Q){for(var F=0;F<ce.modeInfo.length;F++){var D=ce.modeInfo[F];if(D.file&&D.file.test(Q))return D}var G=Q.lastIndexOf("."),B=G>-1&&Q.substring(G+1,Q.length);if(B)return ce.findModeByExtension(B)},ce.findModeByName=function(Q){Q=Q.toLowerCase();for(var F=0;F<ce.modeInfo.length;F++){var D=ce.modeInfo[F];if(D.name.toLowerCase()==Q)return D;if(D.alias){for(var G=0;G<D.alias.length;G++)if(D.alias[G].toLowerCase()==Q)return D}}}})},"8hTe":function(ut,Ke,$){ut.exports={button:"button___1wy9m"}},"9Bee":function(ut,Ke,$){"use strict";var ce=$("DYRE"),Y=$("zeV3"),N=$("+L6B"),Q=$("2/Rp"),F=$("k1fw"),D=$("9og8"),G=$("tJVT"),B=$("WmNS"),k=$.n(B),R=$("q1tI"),b=$.n(R),v=$("vg9a"),m=$("DlQD"),u=$.n(m),r=$("rUJ1");function c(V,C){var L=V.match(/^(\s+)(?:```)/);if(L===null)return C;var W=L[1];return C.split(`
|
|
`).map(function(te){var X=te.match(/^\s+/);if(X===null)return te;var Oe=Object(G.a)(X,1),Ye=Oe[0];return Ye.length>=W.length?te.slice(W.length):te}).join(`
|
|
`)}var s=[],a=["<ul>"],o=new u.a.Renderer,h=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function O(){s.length=0,a=["<ul>"]}var w={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function x(V,C,L,W){if(C>=V.length||V[C].level<=L)return C;var te=V[C];W.push("<li><a href='#"+te.anchor+"'>"+te.text+"</a>"),C++;var X=[];return C=x(V,C,te.level,X),X.length>0&&(W.push("<ul>"),X.forEach(function(Oe){W.push(Oe)}),W.push("</ul>")),W.push("</li>"),C=x(V,C,L,W),C}function A(){return x(s,0,0,a),a.push("</ul>"),a.join("")}var S={heading:function(C){var L=h.exec(C);if(L)return{type:"heading",raw:L[0],depth:L[1].length,text:L[2]}},fences:function(C){var L=this.rules.block.fences.exec(C);if(L){var W=L[0],te=c(W,L[3]||""),X=L[2]?L[2].trim():L[2];if(["latex","katex","math"].indexOf(X)>=0){var Oe=p(),Ye=te;te=Oe,d[Oe]={type:"block",expression:Ye}}return{type:"code",raw:W,lang:X,text:te}}}},y=/(?:\${2})([^\n`]+?)(?:\${2})/gi,_=0,p=function(){return"__special_katext_id_".concat(_++,"__")},d={};function g(){return d}function l(){_=0,d={}}function E(V){return V=V.replace(y,function(C,L){var W=p();return d[W]={type:"inline",expression:L},W}),V}var U=o.listitem;o.listitem=function(V){return U(E(V))};var P=o.paragraph;o.paragraph=function(V){return P(E(V))};var j=o.tablecell;o.tablecell=function(V,C){return j(E(V),C)},o.code=function(V,C,L){var W=(C||"").match(/\S*/)[0];return W?["latex","katex","math"].indexOf(W)>=0?"<p class='editormd-tex'>".concat(V,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(C,'">').concat(L?V:Object(r.escape)(V,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(L?V:Object(r.escape)(V,!0))+"</code></pre>"},o.heading=function(V,C,L){var W=this.options.headerPrefix+L.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return s.push({anchor:W,level:C,text:V}),"<h"+C+' id="'+W+'">'+V+"</h"+C+">"},u.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),u.a.use({tokenizer:S,renderer:o});var H=u.a,I=$("SJMd"),T=$("ulZh"),K=$.n(T),J=$("m3rI"),ie=$("Oy/b"),pe=$("p5ED"),_e=$("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 Te=function(V,C){return(Te=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(L,W){L.__proto__=W}||function(L,W){for(var te in W)Object.prototype.hasOwnProperty.call(W,te)&&(L[te]=W[te])})(V,C)};function he(V,C){function L(){this.constructor=V}Te(V,C),V.prototype=C===null?Object.create(C):(L.prototype=C.prototype,new L)}function re(V,C,L,W){return new(L||(L=Promise))(function(te,X){function Oe(At){try{ft(W.next(At))}catch(qe){X(qe)}}function Ye(At){try{ft(W.throw(At))}catch(qe){X(qe)}}function ft(At){var qe;At.done?te(At.value):(qe=At.value,qe instanceof L?qe:new L(function(Pt){Pt(qe)})).then(Oe,Ye)}ft((W=W.apply(V,C||[])).next())})}function fe(V,C){var L,W,te,X,Oe={label:0,sent:function(){if(1&te[0])throw te[1];return te[1]},trys:[],ops:[]};return X={next:Ye(0),throw:Ye(1),return:Ye(2)},typeof Symbol=="function"&&(X[Symbol.iterator]=function(){return this}),X;function Ye(ft){return function(At){return function(qe){if(L)throw new TypeError("Generator is already executing.");for(;Oe;)try{if(L=1,W&&(te=2&qe[0]?W.return:qe[0]?W.throw||((te=W.return)&&te.call(W),0):W.next)&&!(te=te.call(W,qe[1])).done)return te;switch(W=0,te&&(qe=[2&qe[0],te.value]),qe[0]){case 0:case 1:te=qe;break;case 4:return Oe.label++,{value:qe[1],done:!1};case 5:Oe.label++,W=qe[1],qe=[0];continue;case 7:qe=Oe.ops.pop(),Oe.trys.pop();continue;default:if(!(te=Oe.trys,(te=te.length>0&&te[te.length-1])||qe[0]!==6&&qe[0]!==2)){Oe=0;continue}if(qe[0]===3&&(!te||qe[1]>te[0]&&qe[1]<te[3])){Oe.label=qe[1];break}if(qe[0]===6&&Oe.label<te[1]){Oe.label=te[1],te=qe;break}if(te&&Oe.label<te[2]){Oe.label=te[2],Oe.ops.push(qe);break}te[2]&&Oe.ops.pop(),Oe.trys.pop();continue}qe=C.call(V,Oe)}catch(Pt){qe=[6,Pt],W=0}finally{L=te=0}if(5&qe[0])throw qe[1];return{value:qe[0]?qe[1]:void 0,done:!0}}([ft,At])}}}function ae(){for(var V=0,C=0,L=arguments.length;C<L;C++)V+=arguments[C].length;var W=Array(V),te=0;for(C=0;C<L;C++)for(var X=arguments[C],Oe=0,Ye=X.length;Oe<Ye;Oe++,te++)W[te]=X[Oe];return W}var oe=function(){function V(){}return V.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},V.setAttributes=function(C,L){for(var W=0,te=L;W<te.length;W++){var X=te[W],Oe=X[0],Ye=X[1];C.setAttribute(Oe,Ye)}},V.createRect=function(C,L,W){var te=document.createElementNS("http://www.w3.org/2000/svg","rect");return te.setAttribute("width",C.toString()),te.setAttribute("height",L.toString()),W&&V.setAttributes(te,W),te},V.createLine=function(C,L,W,te,X){var Oe=document.createElementNS("http://www.w3.org/2000/svg","line");return Oe.setAttribute("x1",C.toString()),Oe.setAttribute("y1",L.toString()),Oe.setAttribute("x2",W.toString()),Oe.setAttribute("y2",te.toString()),X&&V.setAttributes(Oe,X),Oe},V.createPolygon=function(C,L){var W=document.createElementNS("http://www.w3.org/2000/svg","polygon");return W.setAttribute("points",C),L&&V.setAttributes(W,L),W},V.createCircle=function(C,L){var W=document.createElementNS("http://www.w3.org/2000/svg","circle");return W.setAttribute("cx",(C/2).toString()),W.setAttribute("cy",(C/2).toString()),W.setAttribute("r",C.toString()),L&&V.setAttributes(W,L),W},V.createEllipse=function(C,L,W){var te=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return te.setAttribute("cx",(C/2).toString()),te.setAttribute("cy",(L/2).toString()),te.setAttribute("rx",(C/2).toString()),te.setAttribute("ry",(L/2).toString()),W&&V.setAttributes(te,W),te},V.createGroup=function(C){var L=document.createElementNS("http://www.w3.org/2000/svg","g");return C&&V.setAttributes(L,C),L},V.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},V.createMarker=function(C,L,W,te,X,Oe,Ye){var ft=document.createElementNS("http://www.w3.org/2000/svg","marker");return V.setAttributes(ft,[["id",C],["orient",L],["markerWidth",W.toString()],["markerHeight",te.toString()],["refX",X.toString()],["refY",Oe.toString()]]),ft.appendChild(Ye),ft},V.createText=function(C){var L=document.createElementNS("http://www.w3.org/2000/svg","text");return L.setAttribute("x","0"),L.setAttribute("y","0"),C&&V.setAttributes(L,C),L},V.createTSpan=function(C,L){var W=document.createElementNS("http://www.w3.org/2000/svg","tspan");return W.textContent=C,L&&V.setAttributes(W,L),W},V.createImage=function(C){var L=document.createElementNS("http://www.w3.org/2000/svg","image");return C&&V.setAttributes(L,C),L},V.createPoint=function(C,L){var W=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return W.x=C,W.y=L,W},V.createPath=function(C,L){var W=document.createElementNS("http://www.w3.org/2000/svg","path");return W.setAttribute("d",C),L&&V.setAttributes(W,L),W},V}(),Z=function(){function V(){}return V.addKey=function(C){V.key=C},Object.defineProperty(V,"isLicensed",{get:function(){return!!V.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(V.key)},enumerable:!1,configurable:!0}),V}(),ne=function(){function V(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return V.prototype.rasterize=function(C,L,W){var te=this;return new Promise(function(X){var Oe=W!==void 0?W:document.createElement("canvas");C===null&&(te.markersOnly=!0,te.naturalSize=!1);var Ye=document.createElementNS("http://www.w3.org/2000/svg","svg");Ye.setAttribute("xmlns","http://www.w3.org/2000/svg"),Ye.setAttribute("width",L.width.baseVal.valueAsString),Ye.setAttribute("height",L.height.baseVal.valueAsString),Ye.setAttribute("viewBox","0 0 "+L.viewBox.baseVal.width.toString()+" "+L.viewBox.baseVal.height.toString()),Ye.innerHTML=L.innerHTML,te.naturalSize===!0?(Ye.width.baseVal.value=C.naturalWidth,Ye.height.baseVal.value=C.naturalHeight):te.width!==void 0&&te.height!==void 0&&(Ye.width.baseVal.value=te.width,Ye.height.baseVal.value=te.height),Oe.width=Ye.width.baseVal.value,Oe.height=Ye.height.baseVal.value;var ft=Ye.outerHTML,At=Oe.getContext("2d");te.markersOnly!==!0&&At.drawImage(C,0,0,Oe.width,Oe.height);var qe=window.URL,Pt=new Image(Oe.width,Oe.height);Pt.setAttribute("crossOrigin","anonymous");var Ft=new Blob([ft],{type:"image/svg+xml"}),fn=qe.createObjectURL(Ft);Pt.onload=function(){At.drawImage(Pt,0,0),qe.revokeObjectURL(fn);var Nn=Oe.toDataURL(te.imageType,te.imageQuality);X(Nn)},Pt.src=fn})},V}(),se=function(){},me=function(){function V(C){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+C+"_"}return Object.defineProperty(V.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(V.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(V.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),V.prototype.addClass=function(C){return this.styleSheet===void 0&&this.addStyleSheet(),C.name=""+this.classNamePrefix+C.localName,this.classes.push(C),this.styleSheet.sheet.insertRule("."+C.name+" {"+C.style+"}",this.styleSheet.sheet.cssRules.length),C},V.prototype.addRule=function(C){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(C),this.styleSheet.sheet.insertRule(C.selector+" {"+C.style+"}",this.styleSheet.sheet.cssRules.length)},V.prototype.addStyleSheet=function(){var C;this.styleSheet=document.createElement("style"),((C=this.styleSheetRoot)!==null&&C!==void 0?C: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;
|
|
`))},V.prototype.removeStyleSheet=function(){var C;this.styleSheet&&(((C=this.styleSheetRoot)!==null&&C!==void 0?C:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},V}(),Se=function(V,C){this.selector=V,this.style=C},Ee=function(V,C){this.localName=V,this.style=C},Le=function(){function V(C,L,W,te,X){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=C,this.displayMode=L,this.markerItems=W,this.uiStyleSettings=te,this.styles=X,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return V.prototype.show=function(C){var L=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=C,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var W=document.createElement("div");W.className=this.toolbarBlockStyleClass.name,W.style.whiteSpace="nowrap",this.uiContainer.appendChild(W),this.addActionButton(W,'<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(W,'<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(W,'<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(W,'<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(W,'<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(W,'<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(W,'<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(W,'<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(X){var Oe=document.createElement("div");Oe.className=""+L.toolbarButtonStyleClass.name,Oe.setAttribute("data-type-name",X.typeName),Oe.innerHTML=X.icon,Oe.addEventListener("click",function(){L.markerToolbarButtonClicked(Oe,X)}),L.buttons.push(Oe),L.markerButtons.push(Oe)}),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 te=document.createElement("div");te.className=this.toolbarBlockStyleClass.name,te.style.whiteSpace="nowrap",te.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(te),this.addActionButton(te,'<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(te,'<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()},V.prototype.addButtonClickListener=function(C){this.buttonClickListeners.push(C)},V.prototype.removeButtonClickListener=function(C){this.buttonClickListeners.indexOf(C)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(C),1)},V.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},V.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var C=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var L=0;L<this.markerButtons.length;L++)L<C||L===C&&this.markerButtons.length-1===C?this.markerButtonBlock.appendChild(this.markerButtons[L]):(L===C&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[L]))}},V.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")},V.prototype.resetButtonStyles=function(){var C=this;this.buttons.forEach(function(L){L.className=L.className.replace(C.uiStyleSettings.toolbarButtonStyleColorsClassName?C.uiStyleSettings.toolbarButtonStyleColorsClassName:C.toolbarButtonStyleColorsClass.name,"").trim(),L.className=L.className.replace(C.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?C.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:C.toolbarActiveButtonStyleColorsClass.name,"").trim(),L.className+=" "+(C.uiStyleSettings.toolbarButtonStyleColorsClassName?C.uiStyleSettings.toolbarButtonStyleColorsClassName:C.toolbarButtonStyleColorsClass.name)})},V.prototype.addActionButton=function(C,L,W){var te=this,X=document.createElement("div");switch(X.className=""+this.toolbarButtonStyleClass.name,X.innerHTML=L,X.setAttribute("data-action",W),X.addEventListener("click",function(){te.actionToolbarButtonClicked(X,W)}),W){case"select":X.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":X.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":X.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":X.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":X.style.fill=this.uiStyleSettings.closeButtonColor}C.appendChild(X),this.buttons.push(X)},V.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 C=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Ee("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*C)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*C)+`px;
|
|
padding: `+C+`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+`
|
|
`))},V.prototype.markerToolbarButtonClicked=function(C,L){this.setActiveButton(C),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(W){return W("marker",L)}),this.markerButtonOverflowBlock.style.display="none"},V.prototype.actionToolbarButtonClicked=function(C,L){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(W){return W("action",L)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},V.prototype.setActiveButton=function(C){this.resetButtonStyles(),C.className=C.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),C.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},V.prototype.setActiveMarkerButton=function(C){var L=this.markerButtons.find(function(W){return W.getAttribute("data-type-name")===C});L&&this.setActiveButton(L)},V.prototype.setCurrentMarker=function(C){var L=this;this.currentMarker=C,this.buttons.filter(function(W){return/delete|notes/.test(W.getAttribute("data-action"))}).forEach(function(W){L.currentMarker===void 0?(W.style.fillOpacity="0.4",W.style.pointerEvents="none"):(W.style.fillOpacity="1",W.style.pointerEvents="all")})},V}(),Pe=function(){function V(C,L,W,te){this.panels=[],this.panelButtons=[],this.markerjsContainer=C,this.displayMode=L,this.uiStyleSettings=W,this.styles=te,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return V.prototype.addStyles=function(){var C;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 L=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: `+((C=this.uiStyleSettings.toolboxBackgroundColor)!==null&&C!==void 0?C:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new Ee("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*L)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*L)+`px;
|
|
padding: `+L+`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;
|
|
`))},V.prototype.show=function(C){var L;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=C,this.uiContainer.className=this.toolboxStyleClass.name+" "+((L=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&L!==void 0?L:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},V.prototype.setPanelButtons=function(C){var L,W,te=this;this.panels=C,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((L=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&L!==void 0?L:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((W=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&W!==void 0?W:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(X){var Oe;X.uiStyleSettings=te.uiStyleSettings;var Ye=document.createElement("div");Ye.className=te.toolboxButtonStyleClass.name+" "+((Oe=te.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Oe!==void 0?Oe:te.toolboxButtonStyleColorsClass.name),Ye.innerHTML=X.icon,Ye.title=X.title,Ye.addEventListener("click",function(){te.panelButtonClick(X)}),te.panelButtons.push(Ye),te.buttonRow.appendChild(Ye)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},V.prototype.panelButtonClick=function(C){var L=this,W=-1;if(C!==this.activePanel){W=this.panels.indexOf(C),this.panelRow.innerHTML="";var te=C.getUi();te.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(te),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=C}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){L.displayMode==="inline"?L.panelRow.style.display="none":L.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(X,Oe){var Ye,ft;X.className=L.toolboxButtonStyleClass.name+" "+(Oe===W?""+((Ye=L.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Ye!==void 0?Ye:L.toolboxActiveButtonStyleColorsClass.name):""+((ft=L.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ft!==void 0?ft:L.toolboxButtonStyleColorsClass.name))})},V}(),Be=function(V,C){this.title=V,this.icon=C},He=function(V){function C(L,W,te,X){var Oe=V.call(this,L,X||'<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 Oe.colors=[],Oe.addTransparent=!1,Oe.colorBoxes=[],Oe.colors=W,Oe.currentColor=te,Oe.setCurrentColor=Oe.setCurrentColor.bind(Oe),Oe.getColorBox=Oe.getColorBox.bind(Oe),Oe}return he(C,V),C.prototype.getUi=function(){var L=this,W=document.createElement("div");return W.style.overflow="hidden",W.style.whiteSpace="nowrap",this.colors.forEach(function(te){var X=L.getColorBox(te);W.appendChild(X),L.colorBoxes.push(X)}),W},C.prototype.getColorBox=function(L){var W=this,te=this.uiStyleSettings.toolbarHeight/4,X=this.uiStyleSettings.toolbarHeight-te,Oe=document.createElement("div");Oe.style.display="inline-block",Oe.style.boxSizing="content-box",Oe.style.width=X-2+"px",Oe.style.height=X-2+"px",Oe.style.padding="1px",Oe.style.marginRight="2px",Oe.style.marginBottom="2px",Oe.style.borderWidth="2px",Oe.style.borderStyle="solid",Oe.style.borderRadius=(X+2)/2+"px",Oe.style.borderColor=L===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",Oe.addEventListener("click",function(){W.setCurrentColor(L,Oe)});var Ye=document.createElement("div");return Ye.style.display="inline-block",Ye.style.width=X-2+"px",Ye.style.height=X-2+"px",Ye.style.backgroundColor=L,Ye.style.borderRadius=X/2+"px",L==="transparent"&&(Ye.style.fill=this.uiStyleSettings.toolboxAccentColor,Ye.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>`),Oe.appendChild(Ye),Oe},C.prototype.setCurrentColor=function(L,W){var te=this;this.currentColor=L,this.colorBoxes.forEach(function(X){X.style.borderColor=X===W?te.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(L)},C}(Be),Ge=function(){function V(C,L,W){this._state="new",this._isSelected=!1,this._container=C,this._overlayContainer=L,this.globalSettings=W,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(V.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),V.prototype.ownsTarget=function(C){return!1},Object.defineProperty(V.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),V.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},V.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},V.prototype.pointerDown=function(C,L){},V.prototype.dblClick=function(C,L){},V.prototype.manipulate=function(C){},V.prototype.pointerUp=function(C){this.stateChanged()},V.prototype.dispose=function(){},V.prototype.addMarkerVisualToContainer=function(C){this.container.childNodes.length>0?this.container.insertBefore(C,this.container.childNodes[0]):this.container.appendChild(C)},V.prototype.getState=function(){return{typeName:V.typeName,state:this.state,notes:this.notes}},V.prototype.restoreState=function(C){this._state=C.state,this.notes=C.notes},V.prototype.scale=function(C,L){},V.prototype.colorChanged=function(C){this.onColorChanged&&this.onColorChanged(C),this.stateChanged()},V.prototype.fillColorChanged=function(C){this.onFillColorChanged&&this.onFillColorChanged(C),this.stateChanged()},V.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var C=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),C.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(C)&&this.onStateChanged(this)}},V.typeName="MarkerBase",V}(),Ue=function(){function V(){this.findGripByVisual=this.findGripByVisual.bind(this)}return V.prototype.findGripByVisual=function(C){return this.topLeft.ownsTarget(C)?this.topLeft:this.topCenter.ownsTarget(C)?this.topCenter:this.topRight.ownsTarget(C)?this.topRight:this.centerLeft.ownsTarget(C)?this.centerLeft:this.centerRight.ownsTarget(C)?this.centerRight:this.bottomLeft.ownsTarget(C)?this.bottomLeft:this.bottomCenter.ownsTarget(C)?this.bottomCenter:this.bottomRight.ownsTarget(C)?this.bottomRight:void 0},V}(),tt=function(){function V(){this.GRIP_SIZE=10,this.visual=oe.createGroup(),this.visual.appendChild(oe.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(oe.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return V.prototype.ownsTarget=function(C){return C===this.visual||C===this.visual.childNodes[0]||C===this.visual.childNodes[1]},V}(),nt=function(){function V(){}return V.toITransformMatrix=function(C){return{a:C.a,b:C.b,c:C.c,d:C.d,e:C.e,f:C.f}},V.toSVGMatrix=function(C,L){return C.a=L.a,C.b=L.b,C.c=L.c,C.d=L.d,C.e=L.e,C.f=L.f,C},V}(),ot=function(V){function C(L,W,te){var X=V.call(this,L,W,te)||this;return X.left=0,X.top=0,X.width=0,X.height=0,X.defaultSize={x:50,y:20},X.offsetX=0,X.offsetY=0,X.rotationAngle=0,X.CB_DISTANCE=10,X._suppressMarkerCreateEvent=!1,X.container.transform.baseVal.appendItem(oe.createTransform()),X.setupControlBox(),X}return he(C,V),Object.defineProperty(C.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(C.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(C.prototype,"visual",{get:function(){return this._visual},set:function(L){this._visual=L;var W=oe.createTransform();this._visual.transform.baseVal.appendItem(W)},enumerable:!1,configurable:!0}),C.prototype.ownsTarget=function(L){return!!V.prototype.ownsTarget.call(this,L)||!!(this.controlGrips.findGripByVisual(L)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(L))},C.prototype.pointerDown=function(L,W){V.prototype.pointerDown.call(this,L,W),this.state==="new"&&(this.left=L.x,this.top=L.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var te=this.unrotatePoint(L);if(this.manipulationStartX=te.x,this.manipulationStartY=te.y,this.offsetX=te.x-this.left,this.offsetY=te.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(W),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(W)){this.activeGrip=this.rotatorGrip;var X=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=X.x-this.width/2,this.top=X.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var Oe=this.container.transform.baseVal.getItem(0);Oe.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(Oe,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},C.prototype.pointerUp=function(L){var W=this.state;V.prototype.pointerUp.call(this,L),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(L),this._state="select",W==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},C.prototype.moveVisual=function(L){this.visual.style.transform="translate("+L.x+"px, "+L.y+"px)"},C.prototype.manipulate=function(L){var W=this.unrotatePoint(L);this.state==="creating"?this.resize(L):this.state==="move"?(this.left=this.manipulationStartLeft+(W.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(W.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(W):this.state==="rotate"&&this.rotate(L)},C.prototype.resize=function(L){var W=this.manipulationStartLeft,te=this.manipulationStartWidth,X=this.manipulationStartTop,Oe=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:W=this.manipulationStartLeft+L.x-this.manipulationStartX,te=this.manipulationStartWidth+this.manipulationStartLeft-W;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:te=this.manipulationStartWidth+L.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:X=this.manipulationStartTop+L.y-this.manipulationStartY,Oe=this.manipulationStartHeight+this.manipulationStartTop-X;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:Oe=this.manipulationStartHeight+L.y-this.manipulationStartY}te>=0?(this.left=W,this.width=te):(this.left=W+te,this.width=-te),Oe>=0?(this.top=X,this.height=Oe):(this.top=X+Oe,this.height=-Oe),this.setSize()},C.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},C.prototype.rotate=function(L){if(Math.abs(L.x-this.centerX)>.1){var W=Math.sign(L.x-this.centerX);this.rotationAngle=180*Math.atan((L.y-this.centerY)/(L.x-this.centerX))/Math.PI+90*W,this.applyRotation()}},C.prototype.applyRotation=function(){var L=this.container.transform.baseVal.getItem(0);L.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(L,0)},C.prototype.rotatePoint=function(L){if(this.rotationAngle===0)return L;var W=this.container.getCTM(),te=oe.createPoint(L.x,L.y);return{x:(te=te.matrixTransform(W)).x,y:te.y}},C.prototype.unrotatePoint=function(L){if(this.rotationAngle===0)return L;var W=this.container.getCTM();W=W.inverse();var te=oe.createPoint(L.x,L.y);return{x:(te=te.matrixTransform(W)).x,y:te.y}},C.prototype.select=function(){V.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},C.prototype.deselect=function(){V.prototype.deselect.call(this),this.controlBox.style.display="none"},C.prototype.setupControlBox=function(){this.controlBox=oe.createGroup();var L=oe.createTransform();L.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(L),this.container.appendChild(this.controlBox),this.controlRect=oe.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=oe.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 Ue,this.addControlGrips(),this.controlBox.style.display="none"},C.prototype.adjustControlBox=function(){var L=this.controlBox.transform.baseVal.getItem(0);L.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(L,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()},C.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()},C.prototype.createGrip=function(){var L=new tt;return L.visual.transform.baseVal.appendItem(oe.createTransform()),this.controlBox.appendChild(L.visual),L},C.prototype.positionGrips=function(){var L=this.controlGrips.topLeft.GRIP_SIZE,W=-L/2,te=W,X=(this.width+this.CB_DISTANCE)/2-L/2,Oe=(this.height+this.CB_DISTANCE)/2-L/2,Ye=this.height+this.CB_DISTANCE-L/2,ft=this.width+this.CB_DISTANCE-L/2;this.positionGrip(this.controlGrips.topLeft.visual,W,te),this.positionGrip(this.controlGrips.topCenter.visual,X,te),this.positionGrip(this.controlGrips.topRight.visual,ft,te),this.positionGrip(this.controlGrips.centerLeft.visual,W,Oe),this.positionGrip(this.controlGrips.centerRight.visual,ft,Oe),this.positionGrip(this.controlGrips.bottomLeft.visual,W,Ye),this.positionGrip(this.controlGrips.bottomCenter.visual,X,Ye),this.positionGrip(this.controlGrips.bottomRight.visual,ft,Ye),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,X,te-3*this.CB_DISTANCE)},C.prototype.positionGrip=function(L,W,te){var X=L.transform.baseVal.getItem(0);X.setTranslate(W,te),L.transform.baseVal.replaceItem(X,0)},C.prototype.hideControlBox=function(){this.controlBox.style.display="none"},C.prototype.showControlBox=function(){this.controlBox.style.display=""},C.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:nt.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:nt.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},V.prototype.getState.call(this))},C.prototype.restoreState=function(L){V.prototype.restoreState.call(this,L);var W=L;this.left=W.left,this.top=W.top,this.width=W.width,this.height=W.height,this.rotationAngle=W.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(nt.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,W.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(nt.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,W.containerTransformMatrix))},C.prototype.scale=function(L,W){V.prototype.scale.call(this,L,W);var te=this.rotatePoint({x:this.left,y:this.top}),X=this.unrotatePoint({x:te.x*L,y:te.y*W});this.left=X.x,this.top=X.y,this.width=this.width*L,this.height=this.height*W,this.adjustControlBox()},C}(Ge),st=function(V){function C(L,W,te){var X=V.call(this,L,W,te)||this;return X.fillColor="transparent",X.strokeColor="transparent",X.strokeWidth=0,X.strokeDasharray="",X.opacity=1,X.setStrokeColor=X.setStrokeColor.bind(X),X.setFillColor=X.setFillColor.bind(X),X.setStrokeWidth=X.setStrokeWidth.bind(X),X.setStrokeDasharray=X.setStrokeDasharray.bind(X),X.createVisual=X.createVisual.bind(X),X}return he(C,V),C.prototype.ownsTarget=function(L){return!(!V.prototype.ownsTarget.call(this,L)&&L!==this.visual)},C.prototype.createVisual=function(){this.visual=oe.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)},C.prototype.pointerDown=function(L,W){V.prototype.pointerDown.call(this,L,W),this.state==="new"&&(this.createVisual(),this.moveVisual(L),this._state="creating")},C.prototype.manipulate=function(L){V.prototype.manipulate.call(this,L)},C.prototype.resize=function(L){V.prototype.resize.call(this,L),this.setSize()},C.prototype.setSize=function(){V.prototype.setSize.call(this),oe.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},C.prototype.pointerUp=function(L){V.prototype.pointerUp.call(this,L),this.setSize()},C.prototype.setStrokeColor=function(L){this.strokeColor=L,this.visual&&oe.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(L),this.stateChanged()},C.prototype.setFillColor=function(L){this.fillColor=L,this.visual&&oe.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},C.prototype.setStrokeWidth=function(L){this.strokeWidth=L,this.visual&&oe.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},C.prototype.setStrokeDasharray=function(L){this.strokeDasharray=L,this.visual&&oe.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},C.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},V.prototype.getState.call(this))},C.prototype.restoreState=function(L){var W=L;this.fillColor=W.fillColor,this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.opacity=W.opacity,this.createVisual(),V.prototype.restoreState.call(this,L),this.setSize()},C.prototype.scale=function(L,W){V.prototype.scale.call(this,L,W),this.setSize()},C.title="Rectangle marker",C}(ot),mt=function(V){function C(L,W,te,X){var Oe=V.call(this,L,X||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return Oe.widths=[],Oe.widthBoxes=[],Oe.widths=W,Oe.currentWidth=te,Oe.setCurrentWidth=Oe.setCurrentWidth.bind(Oe),Oe}return he(C,V),C.prototype.getUi=function(){var L=this,W=document.createElement("div");return W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2",this.widths.forEach(function(te){var X=document.createElement("div");X.style.display="flex",X.style.flexGrow="2",X.style.alignItems="center",X.style.justifyContent="space-between",X.style.padding="5px",X.style.borderWidth="2px",X.style.borderStyle="solid",X.style.borderColor=te===L.currentWidth?L.uiStyleSettings.toolboxAccentColor:"transparent",X.addEventListener("click",function(){L.setCurrentWidth(te,X)}),W.appendChild(X);var Oe=document.createElement("div");Oe.innerText=te.toString(),Oe.style.marginRight="5px",X.appendChild(Oe);var Ye=document.createElement("div");Ye.style.minHeight="20px",Ye.style.flexGrow="2",Ye.style.display="flex",Ye.style.alignItems="center";var ft=document.createElement("hr");ft.style.minWidth="20px",ft.style.border="0px",ft.style.borderTop=te+"px solid "+L.uiStyleSettings.toolboxColor,ft.style.flexGrow="2",Ye.appendChild(ft),X.appendChild(Ye),L.widthBoxes.push(X)}),W},C.prototype.setCurrentWidth=function(L,W){var te=this;this.currentWidth=L,this.widthBoxes.forEach(function(X){X.style.borderColor=X===W?te.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},C}(Be),ht=function(V){function C(L,W,te,X){var Oe=V.call(this,L,X||'<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 Oe.styles=[],Oe.styleBoxes=[],Oe.styles=W,Oe.currentStyle=te,Oe.setCurrentStyle=Oe.setCurrentStyle.bind(Oe),Oe}return he(C,V),C.prototype.getUi=function(){var L=this,W=document.createElement("div");return W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2",this.styles.forEach(function(te){var X=document.createElement("div");X.style.display="flex",X.style.alignItems="center",X.style.justifyContent="space-between",X.style.padding="5px",X.style.borderWidth="2px",X.style.borderStyle="solid",X.style.overflow="hidden",X.style.maxWidth=100/L.styles.length-5+"%",X.style.borderColor=te===L.currentStyle?L.uiStyleSettings.toolboxAccentColor:"transparent",X.addEventListener("click",function(){L.setCurrentStyle(te,X)}),W.appendChild(X);var Oe=document.createElement("div");Oe.style.minHeight="20px",Oe.style.flexGrow="2",Oe.style.overflow="hidden";var Ye=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+L.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(te!==""?'stroke-dasharray="'+te+'"':"")+` />
|
|
</svg>`;Oe.innerHTML=Ye,X.appendChild(Oe),L.styleBoxes.push(X)}),W},C.prototype.setCurrentStyle=function(L,W){var te=this;this.currentStyle=L,this.styleBoxes.forEach(function(X){X.style.borderColor=X===W?te.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},C}(Be),Ie=function(V){function C(L,W,te){var X=V.call(this,L,W,te)||this;return X.strokeColor=te.defaultColor,X.strokeWidth=te.defaultStrokeWidth,X.strokeDasharray=te.defaultStrokeDasharray,X.strokePanel=new He("Line color",te.defaultColorSet,te.defaultColor),X.strokePanel.onColorChanged=X.setStrokeColor,X.strokeWidthPanel=new mt("Line width",te.defaultStrokeWidths,te.defaultStrokeWidth),X.strokeWidthPanel.onWidthChanged=X.setStrokeWidth,X.strokeStylePanel=new ht("Line style",te.defaultStrokeDasharrays,te.defaultStrokeDasharray),X.strokeStylePanel.onStyleChanged=X.setStrokeDasharray,X}return he(C,V),Object.defineProperty(C.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),C.prototype.getState=function(){var L=V.prototype.getState.call(this);return L.typeName=C.typeName,L},C.typeName="FrameMarker",C.title="Frame marker",C.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',C}(st),Re=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},ze=function(V){function C(L,W,te){var X=V.call(this,L,W,te)||this;return X.x1=0,X.y1=0,X.x2=0,X.y2=0,X.defaultLength=50,X.manipulationStartX=0,X.manipulationStartY=0,X.manipulationStartX1=0,X.manipulationStartY1=0,X.manipulationStartX2=0,X.manipulationStartY2=0,X.setupControlBox(),X}return he(C,V),C.prototype.ownsTarget=function(L){return!!V.prototype.ownsTarget.call(this,L)||!(!this.grip1.ownsTarget(L)&&!this.grip2.ownsTarget(L))},C.prototype.pointerDown=function(L,W){V.prototype.pointerDown.call(this,L,W),this.manipulationStartX=L.x,this.manipulationStartY=L.y,this.state==="new"&&(this.x1=L.x,this.y1=L.y,this.x2=L.x,this.y2=L.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(W)?this.activeGrip=this.grip1:this.grip2.ownsTarget(W)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},C.prototype.pointerUp=function(L){var W=this.state;V.prototype.pointerUp.call(this,L),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(L),this._state="select",W==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},C.prototype.adjustVisual=function(){},C.prototype.manipulate=function(L){this.state==="creating"?this.resize(L):this.state==="move"?(this.x1=this.manipulationStartX1+L.x-this.manipulationStartX,this.y1=this.manipulationStartY1+L.y-this.manipulationStartY,this.x2=this.manipulationStartX2+L.x-this.manipulationStartX,this.y2=this.manipulationStartY2+L.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(L)},C.prototype.resize=function(L){switch(this.activeGrip){case this.grip1:this.x1=L.x,this.y1=L.y;break;case this.grip2:case void 0:this.x2=L.x,this.y2=L.y}this.adjustVisual(),this.adjustControlBox()},C.prototype.select=function(){V.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},C.prototype.deselect=function(){V.prototype.deselect.call(this),this.controlBox.style.display="none"},C.prototype.setupControlBox=function(){this.controlBox=oe.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},C.prototype.adjustControlBox=function(){this.positionGrips()},C.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},C.prototype.createGrip=function(){var L=new tt;return L.visual.transform.baseVal.appendItem(oe.createTransform()),this.controlBox.appendChild(L.visual),L},C.prototype.positionGrips=function(){var L=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-L/2,this.y1-L/2),this.positionGrip(this.grip2.visual,this.x2-L/2,this.y2-L/2)},C.prototype.positionGrip=function(L,W,te){var X=L.transform.baseVal.getItem(0);X.setTranslate(W,te),L.transform.baseVal.replaceItem(X,0)},C.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},V.prototype.getState.call(this))},C.prototype.restoreState=function(L){V.prototype.restoreState.call(this,L);var W=L;this.x1=W.x1,this.y1=W.y1,this.x2=W.x2,this.y2=W.y2},C.prototype.scale=function(L,W){V.prototype.scale.call(this,L,W),this.x1=this.x1*L,this.y1=this.y1*W,this.x2=this.x2*L,this.y2=this.y2*W,this.adjustVisual(),this.adjustControlBox()},C}(Ge),Ve=function(V){function C(L,W,te){var X=V.call(this,L,W,te)||this;return X.strokeColor="transparent",X.strokeWidth=0,X.strokeDasharray="",X.setStrokeColor=X.setStrokeColor.bind(X),X.setStrokeWidth=X.setStrokeWidth.bind(X),X.setStrokeDasharray=X.setStrokeDasharray.bind(X),X.strokeColor=te.defaultColor,X.strokeWidth=te.defaultStrokeWidth,X.strokeDasharray=te.defaultStrokeDasharray,X.strokePanel=new He("Line color",te.defaultColorSet,te.defaultColor),X.strokePanel.onColorChanged=X.setStrokeColor,X.strokeWidthPanel=new mt("Line width",te.defaultStrokeWidths,te.defaultStrokeWidth),X.strokeWidthPanel.onWidthChanged=X.setStrokeWidth,X.strokeStylePanel=new ht("Line style",te.defaultStrokeDasharrays,te.defaultStrokeDasharray),X.strokeStylePanel.onStyleChanged=X.setStrokeDasharray,X}return he(C,V),C.prototype.ownsTarget=function(L){return!(!V.prototype.ownsTarget.call(this,L)&&L!==this.visual&&L!==this.selectorLine&&L!==this.visibleLine)},C.prototype.createVisual=function(){this.visual=oe.createGroup(),this.selectorLine=oe.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=oe.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)},C.prototype.pointerDown=function(L,W){V.prototype.pointerDown.call(this,L,W),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},C.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()),oe.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),oe.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),oe.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},C.prototype.setStrokeColor=function(L){this.strokeColor=L,this.adjustVisual(),this.colorChanged(L)},C.prototype.setStrokeWidth=function(L){this.strokeWidth=L,this.adjustVisual()},C.prototype.setStrokeDasharray=function(L){this.strokeDasharray=L,this.adjustVisual(),this.stateChanged()},Object.defineProperty(C.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),C.prototype.getState=function(){var L=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},V.prototype.getState.call(this));return L.typeName=C.typeName,L},C.prototype.restoreState=function(L){V.prototype.restoreState.call(this,L);var W=L;this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.createVisual(),this.adjustVisual()},C.typeName="LineMarker",C.title="Line marker",C.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',C}(ze),De=function(V){function C(L,W,te,X){var Oe=V.call(this,L,X||'<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 Oe.fonts=[],Oe.fontBoxes=[],Oe.fonts=W,Oe.currentFont=te,Oe.setCurrentFont=Oe.setCurrentFont.bind(Oe),Oe}return he(C,V),C.prototype.getUi=function(){var L=this,W=document.createElement("div");return W.style.overflow="hidden",W.style.flexGrow="2",this.fonts.forEach(function(te){var X=document.createElement("div");X.style.display="inline-block",X.style.alignItems="center",X.style.justifyContent="space-between",X.style.padding="5px",X.style.borderWidth="2px",X.style.borderStyle="solid",X.style.overflow="hidden",X.style.maxWidth=100/L.fonts.length-5+"%",X.style.borderColor=te===L.currentFont?L.uiStyleSettings.toolboxAccentColor:"transparent",X.addEventListener("click",function(){L.setCurrentFont(te,X)}),W.appendChild(X);var Oe=document.createElement("div");Oe.style.display="flex",Oe.style.minHeight="20px",Oe.style.flexGrow="2",Oe.style.fontFamily=te,Oe.style.overflow="hidden";var Ye=document.createElement("div");Ye.style.whiteSpace="nowrap",Ye.style.overflow="hidden",Ye.style.textOverflow="ellipsis",Ye.innerHTML="The quick brown fox jumps over the lazy dog",Oe.appendChild(Ye),X.appendChild(Oe),L.fontBoxes.push(X)}),W},C.prototype.setCurrentFont=function(L,W){var te=this;this.currentFont=L,this.fontBoxes.forEach(function(X){X.style.borderColor=X===W?te.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},C}(Be),Me=function(V){function C(L,W,te){var X=V.call(this,L,W,te)||this;return X.color="transparent",X.padding=5,X.DEFAULT_TEXT="your text here",X.text=X.DEFAULT_TEXT,X.isMoved=!1,X.color=te.defaultColor,X.fontFamily=te.defaultFontFamily,X.defaultSize={x:100,y:30},X.setColor=X.setColor.bind(X),X.setFont=X.setFont.bind(X),X.renderText=X.renderText.bind(X),X.sizeText=X.sizeText.bind(X),X.textEditDivClicked=X.textEditDivClicked.bind(X),X.showTextEditor=X.showTextEditor.bind(X),X.setSize=X.setSize.bind(X),X.positionTextEditor=X.positionTextEditor.bind(X),X.colorPanel=new He("Color",te.defaultColorSet,te.defaultColor),X.colorPanel.onColorChanged=X.setColor,X.fontFamilyPanel=new De("Font",te.defaultFontFamilies,te.defaultFontFamily),X.fontFamilyPanel.onFontChanged=X.setFont,X}return he(C,V),C.prototype.ownsTarget=function(L){if(V.prototype.ownsTarget.call(this,L)||L===this.visual||L===this.textElement||L===this.bgRectangle)return!0;var W=!1;return this.textElement.childNodes.forEach(function(te){te===L&&(W=!0)}),W},C.prototype.createVisual=function(){this.visual=oe.createGroup(),this.bgRectangle=oe.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=oe.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(oe.createTransform()),this.textElement.transform.baseVal.appendItem(oe.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},C.prototype.pointerDown=function(L,W){V.prototype.pointerDown.call(this,L,W),this.isMoved=!1,this.pointerDownPoint=L,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(L),this._state="creating")},C.prototype.renderText=function(){var L=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(W){L.textElement.appendChild(oe.createTSpan(W.trim()===""?" ":W.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},C.prototype.getTextScale=function(){var L=this.textElement.getBBox(),W=1;if(L.width>0&&L.height>0){var te=(1*this.width-this.width*this.padding*2/100)/L.width,X=(1*this.height-this.height*this.padding*2/100)/L.height;W=Math.min(te,X)}return W},C.prototype.getTextPosition=function(L){var W=this.textElement.getBBox(),te=0,X=0;return W.width>0&&W.height>0&&(te=(this.width-W.width*L)/2,X=this.height/2-W.height*L/2),{x:te,y:X}},C.prototype.sizeText=function(){var L=this.textElement.getBBox(),W=this.getTextScale(),te=this.getTextPosition(W);te.y-=L.y*W,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+te.x+"px, "+te.y+"px) scale("+W+", "+W+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(te.x,te.y),this.textElement.transform.baseVal.getItem(1).setScale(W,W))},C.prototype.manipulate=function(L){V.prototype.manipulate.call(this,L),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(L.x-this.pointerDownPoint.x)>5||Math.abs(L.y-this.pointerDownPoint.y)>5)},C.prototype.resize=function(L){V.prototype.resize.call(this,L),this.isMoved=!0,this.setSize(),this.sizeText()},C.prototype.setSize=function(){V.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(oe.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),oe.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},C.prototype.pointerUp=function(L){var W=this.state;W==="creating"&&(this._suppressMarkerCreateEvent=!0),V.prototype.pointerUp.call(this,L),this.setSize(),(W==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},C.prototype.showTextEditor=function(){var L=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(W){W.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var W=Number.parseFloat(L.textEditor.style.fontSize);L.textEditor.clientWidth>=Number.parseInt(L.textEditor.style.maxWidth)&&W>.9;)W-=.1,L.textEditor.style.fontSize=Math.max(W,.9)+"em"}),this.textEditor.addEventListener("keyup",function(W){W.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(W){if(W.clipboardData){var te=W.clipboardData.getData("text"),X=window.getSelection();if(!X.rangeCount)return!1;X.deleteFromDocument(),X.getRangeAt(0).insertNode(document.createTextNode(te)),W.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){L.textEditDivClicked(L.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},C.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var L=this.getTextScale(),W=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),te=this.textElement.getBBox(),X={x:te.width*L,y:te.height*L};W.x-=X.x/2,W.y-=X.y/2,this.textEditor.style.top=W.y+"px",this.textEditor.style.left=W.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-W.x+"px",this.textEditor.style.fontSize=Math.max(16*L,12)+"px",this.textElement.style.display="none"}},C.prototype.textEditDivClicked=function(L){this.text=L.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},C.prototype.select=function(){V.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},C.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),V.prototype.deselect.call(this)},C.prototype.dblClick=function(L,W){V.prototype.dblClick.call(this,L,W),this.showTextEditor()},C.prototype.setColor=function(L){this.textElement&&oe.setAttributes(this.textElement,[["fill",L]]),this.color=L,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(L)},C.prototype.setFont=function(L){this.textElement&&oe.setAttributes(this.textElement,[["font-family",L]]),this.fontFamily=L,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},C.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},C.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(C.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),C.prototype.getState=function(){var L=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},V.prototype.getState.call(this));return L.typeName=C.typeName,L},C.prototype.restoreState=function(L){var W=L;this.color=W.color,this.fontFamily=W.fontFamily,this.padding=W.padding,this.text=W.text,this.createVisual(),V.prototype.restoreState.call(this,L),this.setSize()},C.prototype.scale=function(L,W){V.prototype.scale.call(this,L,W),this.setSize(),this.sizeText(),this.positionTextEditor()},C.typeName="TextMarker",C.title="Text marker",C.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>',C}(ot),be=function(V){function C(L,W,te){var X=V.call(this,L,W,te)||this;return X.color="transparent",X.lineWidth=3,X.drawing=!1,X.pixelRatio=1,X.color=te.defaultColor,X.lineWidth=te.defaultStrokeWidth,X.pixelRatio=te.freehandPixelRatio,X.setColor=X.setColor.bind(X),X.addCanvas=X.addCanvas.bind(X),X.finishCreation=X.finishCreation.bind(X),X.setLineWidth=X.setLineWidth.bind(X),X.colorPanel=new He("Color",te.defaultColorSet,te.defaultColor),X.colorPanel.onColorChanged=X.setColor,X.lineWidthPanel=new mt("Line width",te.defaultStrokeWidths,te.defaultStrokeWidth),X.lineWidthPanel.onWidthChanged=X.setLineWidth,X}return he(C,V),C.prototype.ownsTarget=function(L){return!(!V.prototype.ownsTarget.call(this,L)&&L!==this.visual&&L!==this.drawingImage)},C.prototype.createVisual=function(){this.visual=oe.createGroup(),this.drawingImage=oe.createImage(),this.visual.appendChild(this.drawingImage);var L=oe.createTransform();this.visual.transform.baseVal.appendItem(L),this.addMarkerVisualToContainer(this.visual)},C.prototype.pointerDown=function(L,W){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(L.x,L.y),this.drawing=!0):V.prototype.pointerDown.call(this,L,W)},C.prototype.manipulate=function(L){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(L.x,L.y),this.canvasContext.stroke()):V.prototype.manipulate.call(this,L)},C.prototype.resize=function(L){V.prototype.resize.call(this,L),oe.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),oe.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},C.prototype.pointerUp=function(L){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):V.prototype.pointerUp.call(this,L)},C.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)},C.prototype.select=function(){this.state==="creating"&&this.finishCreation(),V.prototype.select.call(this)},C.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),V.prototype.deselect.call(this)},C.prototype.finishCreation=function(){for(var L=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),W=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],te=W[0],X=W[1],Oe=W[2],Ye=W[3],ft=!1,At=0;At<this.canvasElement.height;At++)for(var qe=0;qe<this.canvasElement.width;qe++)L.data[At*this.canvasElement.width*4+4*qe+3]>0&&(ft=!0,At<X&&(X=At),qe<te&&(te=qe),At>Ye&&(Ye=At),qe>Oe&&(Oe=qe));if(ft){this.left=te/this.pixelRatio,this.top=X/this.pixelRatio,this.width=(Oe-te)/this.pixelRatio,this.height=(Ye-X)/this.pixelRatio;var Pt=document.createElement("canvas");Pt.width=Oe-te,Pt.height=Ye-X,Pt.getContext("2d").putImageData(this.canvasContext.getImageData(te,X,Oe-te,Ye-X),0,0),this.drawingImgUrl=Pt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},C.prototype.setDrawingImage=function(){oe.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),oe.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},C.prototype.setColor=function(L){this.color=L,this.colorChanged(L)},C.prototype.setLineWidth=function(L){this.lineWidth=L},Object.defineProperty(C.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),C.prototype.getState=function(){var L=Object.assign({drawingImgUrl:this.drawingImgUrl},V.prototype.getState.call(this));return L.typeName=C.typeName,L},C.prototype.restoreState=function(L){this.createVisual(),V.prototype.restoreState.call(this,L),this.drawingImgUrl=L.drawingImgUrl,this.setDrawingImage()},C.prototype.scale=function(L,W){V.prototype.scale.call(this,L,W),this.setDrawingImage()},C.typeName="FreehandMarker",C.title="Freehand marker",C.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>',C}(ot),ve=function(V){function C(L,W,te){var X=V.call(this,L,te||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return X.typeBoxes=[],X.currentType=W,X.setCurrentType=X.setCurrentType.bind(X),X}return he(C,V),C.prototype.getUi=function(){var L=this,W=document.createElement("div");W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2";for(var te=function(Ye){var ft="both";switch(Ye){case 0:ft="both";break;case 1:ft="start";break;case 2:ft="end";break;case 3:ft="none"}var At=document.createElement("div");if(At.style.display="flex",At.style.flexGrow="2",At.style.alignItems="center",At.style.justifyContent="space-between",At.style.padding="5px",At.style.borderWidth="2px",At.style.borderStyle="solid",At.style.borderColor=ft===X.currentType?X.uiStyleSettings.toolboxAccentColor:"transparent",At.addEventListener("click",function(){L.setCurrentType(ft,At)}),W.appendChild(At),ft==="both"||ft==="start"){var qe=document.createElement("div");qe.style.display="flex",qe.style.alignItems="center",qe.style.minHeight="20px",qe.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="`+(X.uiStyleSettings!==void 0?X.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,qe.style.marginLeft="5px",At.appendChild(qe)}var Pt=document.createElement("div");Pt.style.display="flex",Pt.style.alignItems="center",Pt.style.minHeight="20px",Pt.style.flexGrow="2";var Ft=document.createElement("hr");if(Ft.style.minWidth="20px",Ft.style.border="0px",Ft.style.borderTop="3px solid "+(X.uiStyleSettings!==void 0?X.uiStyleSettings.toolboxColor:"#eeeeee"),Ft.style.flexGrow="2",Pt.appendChild(Ft),At.appendChild(Pt),ft==="both"||ft==="end"){var fn=document.createElement("div");fn.style.display="flex",fn.style.alignItems="center",fn.style.minHeight="20px",fn.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="`+(X.uiStyleSettings!==void 0?X.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,fn.style.marginRight="5px",At.appendChild(fn)}X.typeBoxes.push(At)},X=this,Oe=0;Oe<4;Oe++)te(Oe);return W},C.prototype.setCurrentType=function(L,W){var te=this;this.currentType=L,this.typeBoxes.forEach(function(X){X.style.borderColor=X===W?te.uiStyleSettings!==void 0?te.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},C}(Be),ge=function(V){function C(L,W,te){var X=V.call(this,L,W,te)||this;return X.arrowType="end",X.arrowBaseHeight=10,X.arrowBaseWidth=10,X.getArrowPoints=X.getArrowPoints.bind(X),X.setArrowType=X.setArrowType.bind(X),X.arrowTypePanel=new ve("Arrow type","end"),X.arrowTypePanel.onArrowTypeChanged=X.setArrowType,X}return he(C,V),C.prototype.ownsTarget=function(L){return!(!V.prototype.ownsTarget.call(this,L)&&L!==this.arrow1&&L!==this.arrow2)},C.prototype.getArrowPoints=function(L,W){var te=this.arrowBaseWidth+2*this.strokeWidth,X=this.arrowBaseHeight+2*this.strokeWidth;return L-te/2+","+(W+X/2)+" "+L+","+(W-X/2)+" "+(L+te/2)+","+(W+X/2)},C.prototype.createTips=function(){this.arrow1=oe.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(oe.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=oe.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(oe.createTransform()),this.visual.appendChild(this.arrow2)},C.prototype.pointerDown=function(L,W){V.prototype.pointerDown.call(this,L,W),this.state==="creating"&&this.createTips()},C.prototype.adjustVisual=function(){if(V.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",oe.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),oe.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var L=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),W=this.arrow1.transform.baseVal.getItem(0);W.setRotate(L,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(W,0);var te=this.arrow2.transform.baseVal.getItem(0);te.setRotate(L+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(te,0)}},C.prototype.setArrowType=function(L){this.arrowType=L,this.adjustVisual(),this.stateChanged()},Object.defineProperty(C.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),C.prototype.getState=function(){var L=Object.assign({arrowType:this.arrowType},V.prototype.getState.call(this));return L.typeName=C.typeName,L},C.prototype.restoreState=function(L){V.prototype.restoreState.call(this,L);var W=L;this.arrowType=W.arrowType,this.createTips(),this.adjustVisual()},C.typeName="ArrowMarker",C.title="Arrow marker",C.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',C}(Ve),le=function(V){function C(L,W,te){var X=V.call(this,L,W,te)||this;return X.fillColor=te.defaultFillColor,X.strokeWidth=0,X.fillPanel=new He("Color",te.defaultColorSet,te.defaultFillColor),X.fillPanel.onColorChanged=X.setFillColor,X}return he(C,V),Object.defineProperty(C.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),C.prototype.getState=function(){var L=V.prototype.getState.call(this);return L.typeName=C.typeName,L},C.typeName="CoverMarker",C.title="Cover marker",C.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',C}(st),ue=function(V){function C(L,W,te,X){var Oe=V.call(this,L,X||'<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 Oe.opacities=[],Oe.opacityBoxes=[],Oe.opacities=W,Oe.currentOpacity=te,Oe.setCurrentOpacity=Oe.setCurrentOpacity.bind(Oe),Oe}return he(C,V),C.prototype.getUi=function(){var L=this,W=document.createElement("div");return W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2",W.style.justifyContent="space-between",this.opacities.forEach(function(te){var X=document.createElement("div");X.style.display="flex",X.style.alignItems="center",X.style.justifyContent="center",X.style.padding="5px",X.style.borderWidth="2px",X.style.borderStyle="solid",X.style.borderColor=te===L.currentOpacity?L.uiStyleSettings.toolboxAccentColor:"transparent",X.addEventListener("click",function(){L.setCurrentOpacity(te,X)}),W.appendChild(X);var Oe=document.createElement("div");Oe.innerText=100*te+"%",X.appendChild(Oe),L.opacityBoxes.push(X)}),W},C.prototype.setCurrentOpacity=function(L,W){var te=this;this.currentOpacity=L,this.opacityBoxes.forEach(function(X){X.style.borderColor=X===W?te.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},C}(Be),ye=function(V){function C(L,W,te){var X=V.call(this,L,W,te)||this;return X.setOpacity=X.setOpacity.bind(X),X.fillColor=te.defaultHighlightColor,X.strokeWidth=0,X.opacity=te.defaultHighlightOpacity,X.fillPanel=new He("Color",te.defaultColorSet,X.fillColor),X.fillPanel.onColorChanged=X.setFillColor,X.opacityPanel=new ue("Opacity",te.defaultOpacitySteps,X.opacity),X.opacityPanel.onOpacityChanged=X.setOpacity,X}return he(C,V),C.prototype.setOpacity=function(L){this.opacity=L,this.visual&&oe.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(C.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),C.prototype.getState=function(){var L=V.prototype.getState.call(this);return L.typeName=C.typeName,L},C.typeName="HighlightMarker",C.title="Highlight marker",C.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>',C}(le),xe='<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>',we=function(V){function C(L,W,te){var X=V.call(this,L,W,te)||this;return X.bgColor="transparent",X.tipPosition={x:0,y:0},X.tipBase1Position={x:0,y:0},X.tipBase2Position={x:0,y:0},X.tipMoving=!1,X.color=te.defaultStrokeColor,X.bgColor=te.defaultFillColor,X.fontFamily=te.defaultFontFamily,X.defaultSize={x:100,y:30},X.setBgColor=X.setBgColor.bind(X),X.getTipPoints=X.getTipPoints.bind(X),X.positionTip=X.positionTip.bind(X),X.setTipPoints=X.setTipPoints.bind(X),X.colorPanel=new He("Text color",te.defaultColorSet,X.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>'),X.colorPanel.onColorChanged=X.setColor,X.bgColorPanel=new He("Fill color",te.defaultColorSet,X.bgColor,xe),X.bgColorPanel.onColorChanged=X.setBgColor,X.fontFamilyPanel=new De("Font",te.defaultFontFamilies,te.defaultFontFamily),X.fontFamilyPanel.onFontChanged=X.setFont,X.tipGrip=new tt,X.tipGrip.visual.transform.baseVal.appendItem(oe.createTransform()),X.controlBox.appendChild(X.tipGrip.visual),X}return he(C,V),C.prototype.ownsTarget=function(L){return V.prototype.ownsTarget.call(this,L)||this.tipGrip.ownsTarget(L)||this.tip===L},C.prototype.createTip=function(){oe.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=oe.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},C.prototype.pointerDown=function(L,W){this.state==="new"&&V.prototype.pointerDown.call(this,L,W),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(W)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):V.prototype.pointerDown.call(this,L,W)},C.prototype.pointerUp=function(L){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,V.prototype.pointerUp.call(this,L);else{var W=this.state==="creating";V.prototype.pointerUp.call(this,L),this.setTipPoints(W),this.positionTip()}},C.prototype.manipulate=function(L){if(this.tipMoving){var W=this.unrotatePoint(L);this.tipPosition={x:W.x-this.manipulationStartLeft,y:W.y-this.manipulationStartTop},this.positionTip()}else V.prototype.manipulate.call(this,L)},C.prototype.setBgColor=function(L){this.bgRectangle&&this.tip&&(oe.setAttributes(this.bgRectangle,[["fill",L]]),oe.setAttributes(this.tip,[["fill",L]])),this.bgColor=L,this.fillColorChanged(L)},C.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},C.prototype.setTipPoints=function(L){L===void 0&&(L=!1);var W=Math.min(this.height/2,15),te=this.height/5;L&&(this.tipPosition={x:W+te/2,y:this.height+20});var X=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?X<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(te=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:W,y:0},this.tipBase2Position={x:W+te,y:0}):(this.tipBase1Position={x:0,y:W},this.tipBase2Position={x:0,y:W+te}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?X<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(te=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-W-te,y:0},this.tipBase2Position={x:this.width-W,y:0}):(this.tipBase1Position={x:this.width,y:W},this.tipBase2Position={x:this.width,y:W+te}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?X<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(te=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-W-te,y:this.height},this.tipBase2Position={x:this.width-W,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-W-te},this.tipBase2Position={x:this.width,y:this.height-W}):X<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(te=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:W,y:this.height},this.tipBase2Position={x:W+te,y:this.height}):(this.tipBase1Position={x:0,y:this.height-W},this.tipBase2Position={x:0,y:this.height-W-te})},C.prototype.resize=function(L){V.prototype.resize.call(this,L),this.positionTip()},C.prototype.positionTip=function(){oe.setAttributes(this.tip,[["points",this.getTipPoints()]]);var L=this.tipGrip.visual.transform.baseVal.getItem(0);L.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(L,0)},Object.defineProperty(C.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),C.prototype.select=function(){this.positionTip(),V.prototype.select.call(this)},C.prototype.getState=function(){var L=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},V.prototype.getState.call(this));return L.typeName=C.typeName,L},C.prototype.restoreState=function(L){var W=L;this.bgColor=W.bgColor,this.tipPosition=W.tipPosition,V.prototype.restoreState.call(this,L),this.createTip(),this.setTipPoints()},C.prototype.scale=function(L,W){V.prototype.scale.call(this,L,W),this.tipPosition={x:this.tipPosition.x*L,y:this.tipPosition.y*W},this.positionTip()},C.typeName="CalloutMarker",C.title="Callout marker",C.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>',C}(Me),ke=function(V){function C(L,W,te){var X=V.call(this,L,W,te)||this;return X.fillColor="transparent",X.strokeColor="transparent",X.strokeWidth=0,X.strokeDasharray="",X.opacity=1,X.strokeColor=te.defaultColor,X.strokeWidth=te.defaultStrokeWidth,X.strokeDasharray=te.defaultStrokeDasharray,X.fillColor=te.defaultFillColor,X.setStrokeColor=X.setStrokeColor.bind(X),X.setFillColor=X.setFillColor.bind(X),X.setStrokeWidth=X.setStrokeWidth.bind(X),X.setStrokeDasharray=X.setStrokeDasharray.bind(X),X.setOpacity=X.setOpacity.bind(X),X.createVisual=X.createVisual.bind(X),X.strokePanel=new He("Line color",ae(te.defaultColorSet,["transparent"]),te.defaultColor),X.strokePanel.onColorChanged=X.setStrokeColor,X.fillPanel=new He("Fill color",ae(te.defaultColorSet,["transparent"]),X.fillColor,xe),X.fillPanel.onColorChanged=X.setFillColor,X.strokeWidthPanel=new mt("Line width",te.defaultStrokeWidths,te.defaultStrokeWidth),X.strokeWidthPanel.onWidthChanged=X.setStrokeWidth,X.strokeStylePanel=new ht("Line style",te.defaultStrokeDasharrays,te.defaultStrokeDasharray),X.strokeStylePanel.onStyleChanged=X.setStrokeDasharray,X.opacityPanel=new ue("Opacity",te.defaultOpacitySteps,X.opacity),X.opacityPanel.onOpacityChanged=X.setOpacity,X}return he(C,V),C.prototype.ownsTarget=function(L){return!(!V.prototype.ownsTarget.call(this,L)&&L!==this.visual)},C.prototype.createVisual=function(){this.visual=oe.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)},C.prototype.pointerDown=function(L,W){V.prototype.pointerDown.call(this,L,W),this.state==="new"&&(this.createVisual(),this.moveVisual(L),this._state="creating")},C.prototype.manipulate=function(L){V.prototype.manipulate.call(this,L)},C.prototype.resize=function(L){V.prototype.resize.call(this,L),this.setSize()},C.prototype.setSize=function(){V.prototype.setSize.call(this),oe.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},C.prototype.pointerUp=function(L){V.prototype.pointerUp.call(this,L),this.setSize()},C.prototype.setStrokeColor=function(L){this.strokeColor=L,this.visual&&oe.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(L),this.stateChanged()},C.prototype.setFillColor=function(L){this.fillColor=L,this.visual&&oe.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(L),this.stateChanged()},C.prototype.setStrokeWidth=function(L){this.strokeWidth=L,this.visual&&oe.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},C.prototype.setStrokeDasharray=function(L){this.strokeDasharray=L,this.visual&&oe.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},C.prototype.setOpacity=function(L){this.opacity=L,this.visual&&oe.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(C.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),C.prototype.getState=function(){var L=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},V.prototype.getState.call(this));return L.typeName=C.typeName,L},C.prototype.restoreState=function(L){var W=L;this.fillColor=W.fillColor,this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.opacity=W.opacity,this.createVisual(),V.prototype.restoreState.call(this,L),this.setSize()},C.prototype.scale=function(L,W){V.prototype.scale.call(this,L,W),this.setSize()},C.typeName="EllipseMarker",C.title="Ellipse marker",C.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>',C}(ot),We=function(V){function C(L,W,te){return V.call(this,L,W,te)||this}return he(C,V),Object.defineProperty(C.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),C.prototype.ownsTarget=function(L){return!(!V.prototype.ownsTarget.call(this,L)&&L!==this.tip1&&L!==this.tip2)},C.prototype.createTips=function(){this.tip1=oe.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(oe.createTransform()),this.visual.appendChild(this.tip1),this.tip2=oe.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(oe.createTransform()),this.visual.appendChild(this.tip2)},C.prototype.pointerDown=function(L,W){V.prototype.pointerDown.call(this,L,W),this.state==="creating"&&this.createTips()},C.prototype.adjustVisual=function(){if(V.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(oe.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()]]),oe.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 L=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),W=this.tip1.transform.baseVal.getItem(0);W.setRotate(L,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(W,0);var te=this.tip2.transform.baseVal.getItem(0);te.setRotate(L+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(te,0)}},Object.defineProperty(C.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),C.prototype.getState=function(){var L=V.prototype.getState.call(this);return L.typeName=C.typeName,L},C.prototype.restoreState=function(L){V.prototype.restoreState.call(this,L),this.createTips(),this.adjustVisual()},C.typeName="MeasurementMarker",C.title="Measurement marker",C.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>',C}(Ve),Je=function(V){function C(L,W,te){var X=V.call(this,L,W,te)||this;return X.strokePanel.colors=te.defaultColorSet,X.fillColor="transparent",X}return he(C,V),Object.defineProperty(C.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),C.prototype.getState=function(){var L=V.prototype.getState.call(this);return L.typeName=C.typeName,L},C.typeName="EllipseFrameMarker",C.title="Ellipse frame marker",C.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>',C}(ke),Qe=function(){function V(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(V.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),V.prototype.addUndoStep=function(C){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(C)||(this.undoStack.push(C),JSON.stringify(this.lastRedoStep)!==JSON.stringify(C)&&this.redoStack.splice(0,this.redoStack.length))},V.prototype.replaceLastUndoStep=function(C){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=C)},V.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},V.prototype.undo=function(){if(this.undoStack.length>1){var C=this.undoStack.pop();return C!==void 0&&this.redoStack.push(C),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},V.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},V}(),Ze=function(V){function C(L,W,te){var X=V.call(this,L,W,te)||this;return X.strokeColor="transparent",X.strokeWidth=0,X.strokeDasharray="",X.curveX=0,X.curveY=0,X.manipulationStartCurveX=0,X.manipulationStartCurveY=0,X.setStrokeColor=X.setStrokeColor.bind(X),X.setStrokeWidth=X.setStrokeWidth.bind(X),X.setStrokeDasharray=X.setStrokeDasharray.bind(X),X.positionGrips=X.positionGrips.bind(X),X.addControlGrips=X.addControlGrips.bind(X),X.adjustVisual=X.adjustVisual.bind(X),X.setupControlBox=X.setupControlBox.bind(X),X.resize=X.resize.bind(X),X.strokeColor=te.defaultColor,X.strokeWidth=te.defaultStrokeWidth,X.strokeDasharray=te.defaultStrokeDasharray,X.strokePanel=new He("Line color",te.defaultColorSet,te.defaultColor),X.strokePanel.onColorChanged=X.setStrokeColor,X.strokeWidthPanel=new mt("Line width",te.defaultStrokeWidths,te.defaultStrokeWidth),X.strokeWidthPanel.onWidthChanged=X.setStrokeWidth,X.strokeStylePanel=new ht("Line style",te.defaultStrokeDasharrays,te.defaultStrokeDasharray),X.strokeStylePanel.onStyleChanged=X.setStrokeDasharray,X}return he(C,V),C.prototype.ownsTarget=function(L){return!(!V.prototype.ownsTarget.call(this,L)&&L!==this.visual&&L!==this.selectorCurve&&L!==this.visibleCurve&&!this.curveGrip.ownsTarget(L))},C.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},C.prototype.createVisual=function(){this.visual=oe.createGroup(),this.selectorCurve=oe.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=oe.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)},C.prototype.pointerDown=function(L,W){V.prototype.pointerDown.call(this,L,W),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=L.x,this.curveY=L.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(W)&&(this.activeGrip=this.curveGrip,this._state="resize")},C.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),oe.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),oe.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),oe.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},C.prototype.setupControlBox=function(){V.prototype.setupControlBox.call(this),this.curveControlLine1=oe.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=oe.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)},C.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,V.prototype.addControlGrips.call(this)},C.prototype.positionGrips=function(){V.prototype.positionGrips.call(this);var L=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-L/2,this.curveY-L/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()))},C.prototype.manipulate=function(L){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+L.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+L.y-this.manipulationStartY),V.prototype.manipulate.call(this,L)},C.prototype.resize=function(L){this.activeGrip===this.curveGrip&&(this.curveX=L.x,this.curveY=L.y),V.prototype.resize.call(this,L),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},C.prototype.setStrokeColor=function(L){this.strokeColor=L,this.adjustVisual(),this.colorChanged(L)},C.prototype.setStrokeWidth=function(L){this.strokeWidth=L,this.adjustVisual()},C.prototype.setStrokeDasharray=function(L){this.strokeDasharray=L,this.adjustVisual()},C.prototype.scale=function(L,W){this.curveX=this.curveX*L,this.curveY=this.curveY*W,V.prototype.scale.call(this,L,W)},Object.defineProperty(C.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),C.prototype.getState=function(){var L=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},V.prototype.getState.call(this));return L.typeName=C.typeName,L},C.prototype.restoreState=function(L){V.prototype.restoreState.call(this,L);var W=L;this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.curveX=W.curveX,this.curveY=W.curveY,this.createVisual(),this.adjustVisual()},C.typeName="CurveMarker",C.title="Curve marker",C.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>',C}(ze),bt=function(){function V(C,L){L===void 0&&(L=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=C,this.cancelable=L}return Object.defineProperty(V.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),V.prototype.preventDefault=function(){this._defaultPrevented=!0},V}(),yt=function(V){function C(L,W,te){var X=V.call(this,L,!1)||this;return X.dataUrl=W,X.state=te,X}return he(C,V),C}(bt),lt=function(V){function C(L,W,te){te===void 0&&(te=!1);var X=V.call(this,L,te)||this;return X.marker=W,X}return he(C,V),C}(bt),wt=function(){function V(){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 V.prototype.addEventListener=function(C,L){this[C].push(L)},V.prototype.removeEventListener=function(C,L){var W=this[C].indexOf(L);W>-1&&this[C].splice(W,1)},V}(),xt=function(){function V(C){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Re,this._isOpen=!1,this.undoRedoManager=new Qe,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 wt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=V.instanceCounter++,this.styles=new me(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=C,this.targetRoot=document.body,this.width=C.clientWidth,this.height=C.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(V.prototype,"ALL_MARKER_TYPES",{get:function(){return[Ie,be,ge,Me,Je,ke,ye,we,We,le,Ve,Ze]},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Ie,be,ge,Me,ke,ye,we]},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Ie,be,ge,Me,ye]},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(C){var L=this;this._availableMarkerTypes.splice(0),C.forEach(function(W){if(typeof W=="string"){var te=L.ALL_MARKER_TYPES.find(function(X){return X.typeName===W});te!==void 0&&L._availableMarkerTypes.push(te)}else L._availableMarkerTypes.push(W)})},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(C){this._zoomLevel=C,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(V.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),V.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),Z.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},V.prototype.show=function(){var C=this;this.styles.styleSheetRoot===void 0&&se.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=se.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(L){return L(new bt(C))})},V.prototype.render=function(){return re(this,void 0,void 0,function(){var C;return fe(this,function(L){switch(L.label){case 0:return this.setCurrentMarker(),(C=new ne).naturalSize=this.renderAtNaturalSize,C.imageType=this.renderImageType,C.imageQuality=this.renderImageQuality,C.markersOnly=this.renderMarkersOnly,C.width=this.renderWidth,C.height=this.renderHeight,[4,C.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return L.sent(),[4,C.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,L.sent()]}})})},V.prototype.close=function(C){var L=this;if(C===void 0&&(C=!1),this.isOpen){var W=!1;C||this.eventListeners.beforeclose.forEach(function(te){var X=new bt(L,!0);te(X),X.defaultPrevented&&(W=!0)}),W||(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(te){return te(new bt(L))}),this.detachEvents(),this._isOpen=!1)}},V.prototype.addMarkersToToolbar=function(){for(var C,L=[],W=0;W<arguments.length;W++)L[W]=arguments[W];(C=this._availableMarkerTypes).push.apply(C,L)},V.prototype.addRenderEventListener=function(C){this.addEventListener("render",function(L){C(L.dataUrl,L.state)})},V.prototype.removeRenderEventListener=function(C){},V.prototype.addCloseEventListener=function(C){this.addEventListener("close",function(){C()})},V.prototype.removeCloseEventListener=function(C){},V.prototype.setupResizeObserver=function(){var C=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){C.resize(C.target.clientWidth,C.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return C.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},V.prototype.onPopupTargetResize=function(){var C=1*this.target.clientWidth/this.target.clientHeight,L=this.editorCanvas.clientWidth/C>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*C:this.editorCanvas.clientWidth,W=L<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/C;this.resize(L,W)},V.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},V.prototype.resize=function(C,L){this._isResizing=!0;var W=C/this.imageWidth,te=L/this.imageHeight;this.imageWidth=Math.round(C),this.imageHeight=Math.round(L),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(W,te),this._isResizing=!1},V.prototype.scaleMarkers=function(C,L){var W,te=this;this._currentMarker&&this._currentMarker instanceof Me?this._currentMarker.scale(C,L):(W=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(X){X!==te._currentMarker&&X.scale(C,L)}),W!==void 0&&this.setCurrentMarker(W)},V.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"},V.prototype.setTopLeft=function(){var C=this.editingTarget.getBoundingClientRect(),L=this.editorCanvas.getBoundingClientRect();this.left=C.left-L.left,this.top=C.top-L.top},V.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)},V.prototype.addDefs=function(){for(var C,L=[],W=0;W<arguments.length;W++)L[W]=arguments[W];this.defs=oe.createDefs(),this.addDefsToImage(),(C=this.defs).append.apply(C,L)},V.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},V.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)},V.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},V.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},V.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)},V.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},V.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)},V.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 C=document.createElement("a");C.href="https://markerjs.com/",C.target="_blank",C.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>',C.title="Powered by marker.js",C.style.display="grid",C.style.alignItems="center",C.style.justifyItems="center",C.style.padding="3px",C.style.width="20px",C.style.height="20px",this.logoUI.appendChild(C),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},V.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")},V.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"},V.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},V.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 C=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=C+"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 Le(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")},V.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},V.prototype.removeMarker=function(C){this.markerImage.removeChild(C.container),this.markers.indexOf(C)>-1&&this.markers.splice(this.markers.indexOf(C),1),C.dispose()},V.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())},V.prototype.toolbarButtonClicked=function(C,L){if(C==="marker"&&L!==void 0)this.createNewMarker(L);else if(C==="action")switch(L){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()}},V.prototype.deleteSelectedMarker=function(){var C=this;if(this._currentMarker!==void 0){var L=!1;if(this.eventListeners.markerbeforedelete.forEach(function(te){var X=new lt(C,C._currentMarker,!0);te(X),X.defaultPrevented&&(L=!0)}),!L){var W=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(te){return te(new lt(C,W))})}}},V.prototype.clear=function(){var C=this,L=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(Oe){var Ye=new lt(C,void 0,!0);Oe(Ye),Ye.defaultPrevented&&(L=!0)}),!L)){this.setCurrentMarker();for(var W=function(Oe){var Ye=te.markers[Oe];te.setCurrentMarker(te.markers[Oe]),te._currentMarker.dispose(),te.markerImage.removeChild(te._currentMarker.container),te.markers.splice(te.markers.indexOf(te._currentMarker),1),te.eventListeners.markerdelete.forEach(function(ft){return ft(new lt(C,Ye))})},te=this,X=this.markers.length-1;X>=0;X--)W(X);this.addUndoStep()}},Object.defineProperty(V.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),V.prototype.showNotesEditor=function(){var C;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=(C=this._currentMarker.notes)!==null&&C!==void 0?C:"",this.overlayContainer.appendChild(this.notesArea))},V.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)},V.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},V.prototype.addUndoStep=function(){var C=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var L=this.getState(),W=this.undoRedoManager.getLastUndoStep();if(!W||W.width===L.width&&W.height===L.height){var te=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(L),te<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(X){return X(new bt(C))})}else this.undoRedoManager.replaceLastUndoStep(L),this.eventListeners.statechange.forEach(function(X){return X(new bt(C))})}},V.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},V.prototype.undoStep=function(){var C=this,L=this.undoRedoManager.undo();L!==void 0&&(this.restoreState(L),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(W){return W(new bt(C))}))},V.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},V.prototype.redoStep=function(){var C=this,L=this.undoRedoManager.redo();L!==void 0&&(this.restoreState(L),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(W){return W(new bt(C))}))},V.prototype.stepZoom=function(){var C=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=C<this.zoomSteps.length-1?this.zoomSteps[C+1]:this.zoomSteps[0]},V.prototype.panTo=function(C){this.contentDiv.scrollBy({left:this.prevPanPoint.x-C.x,top:this.prevPanPoint.y-C.y}),this.prevPanPoint=C},V.prototype.startRenderAndClose=function(){return re(this,void 0,void 0,function(){var C,L,W=this;return fe(this,function(te){switch(te.label){case 0:return[4,this.render()];case 1:return C=te.sent(),L=this.getState(),this.eventListeners.render.forEach(function(X){return X(new yt(W,C,L))}),this.close(!0),[2]}})})},V.prototype.getState=function(C){C===!0&&this.setCurrentMarker();var L={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(W){return L.markers.push(W.getState())}),L},V.prototype.restoreState=function(C){var L=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);C.markers.forEach(function(W){var te=L._availableMarkerTypes.find(function(Oe){return Oe.typeName===W.typeName});if(te!==void 0){var X=L.addNewMarker(te);X.restoreState(W),L.markers.push(X)}}),C.width&&C.height&&(C.width!==this.imageWidth||C.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/C.width,this.imageHeight/C.height),this.eventListeners.restorestate.forEach(function(W){return W(new bt(L))})},V.prototype.addNewMarker=function(C){var L=oe.createGroup();return this.markerImage.appendChild(L),new C(L,this.overlayContainer,this.settings)},V.prototype.createNewMarker=function(C){var L,W=this;(L=typeof C=="string"?this._availableMarkerTypes.find(function(te){return te.typeName===C}):C)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(L),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(L.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(te){return te(new lt(W,W._currentMarker))}))},V.prototype.markerCreated=function(C){var L=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(C),this.setCurrentMarker(C),C instanceof be&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(be):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(W){return W(new lt(L,L._currentMarker))})},V.prototype.colorChanged=function(C){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=C,this.settings.defaultStrokeColor=C)},V.prototype.fillColorChanged=function(C){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=C)},V.prototype.markerStateChanged=function(C){var L=this;this.eventListeners.markerchange.forEach(function(W){return W(new lt(L,C))})},V.prototype.setCurrentMarker=function(C){var L=this;this._currentMarker!==C&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(W){return W(new lt(L,L._currentMarker))})),this._currentMarker=C,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(W){return W(new lt(L,L._currentMarker))}))},V.prototype.onPointerDown=function(C){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||C.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var L=this.markers.find(function(W){return W.ownsTarget(C.target)});L!==void 0?(this.setCurrentMarker(L),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(C.clientX,C.clientY),C.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:C.clientX,y:C.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(C.clientX,C.clientY))},V.prototype.onDblClick=function(C){if(this._isFocused||this.focus(),this.mode==="select"){var L=this.markers.find(function(W){return W.ownsTarget(C.target)});L!==void 0&&L!==this._currentMarker&&this.setCurrentMarker(L),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(C.clientX,C.clientY),C.target):this.setCurrentMarker()}},V.prototype.onPointerMove=function(C){this.touchPoints!==1&&C.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||C.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(C.clientX,C.clientY)):this.zoomLevel>1&&this.panTo({x:C.clientX,y:C.clientY}))},V.prototype.onPointerUp=function(C){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(C.clientX,C.clientY)),this.isDragging=!1,this.addUndoStep()},V.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},V.prototype.onKeyUp=function(C){this._currentMarker===void 0||this.notesArea!==void 0||C.key!=="Delete"&&C.key!=="Backspace"||this.deleteSelectedMarker()},V.prototype.clientToLocalCoordinates=function(C,L){var W=this.markerImage.getBoundingClientRect();return{x:(C-W.left)/this.zoomLevel,y:(L-W.top)/this.zoomLevel}},V.prototype.onWindowResize=function(){this.positionUI()},V.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var C=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=C+"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()},V.prototype.addLicenseKey=function(C){Z.addKey(C)},V.prototype.addEventListener=function(C,L){this.eventListeners.addEventListener(C,L)},V.prototype.removeEventListener=function(C,L){this.eventListeners.removeEventListener(C,L)},V.prototype.renderState=function(C){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(C),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(V.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),V.prototype.focus=function(){var C=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(L){return L(new bt(C))}))},V.prototype.blur=function(){var C=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(L){return L(new bt(C))}))},V.instanceCounter=0,V}();/* **********************************
|
|
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 Ct=function(V,C){return(Ct=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(L,W){L.__proto__=W}||function(L,W){for(var te in W)Object.prototype.hasOwnProperty.call(W,te)&&(L[te]=W[te])})(V,C)};function Mt(V,C){if(typeof C!="function"&&C!==null)throw new TypeError("Class extends value "+String(C)+" is not a constructor or null");function L(){this.constructor=V}Ct(V,C),V.prototype=C===null?Object.create(C):(L.prototype=C.prototype,new L)}function Ot(V,C,L,W){return new(L||(L=Promise))(function(te,X){function Oe(At){try{ft(W.next(At))}catch(qe){X(qe)}}function Ye(At){try{ft(W.throw(At))}catch(qe){X(qe)}}function ft(At){var qe;At.done?te(At.value):(qe=At.value,qe instanceof L?qe:new L(function(Pt){Pt(qe)})).then(Oe,Ye)}ft((W=W.apply(V,C||[])).next())})}function Lt(V,C){var L,W,te,X,Oe={label:0,sent:function(){if(1&te[0])throw te[1];return te[1]},trys:[],ops:[]};return X={next:Ye(0),throw:Ye(1),return:Ye(2)},typeof Symbol=="function"&&(X[Symbol.iterator]=function(){return this}),X;function Ye(ft){return function(At){return function(qe){if(L)throw new TypeError("Generator is already executing.");for(;Oe;)try{if(L=1,W&&(te=2&qe[0]?W.return:qe[0]?W.throw||((te=W.return)&&te.call(W),0):W.next)&&!(te=te.call(W,qe[1])).done)return te;switch(W=0,te&&(qe=[2&qe[0],te.value]),qe[0]){case 0:case 1:te=qe;break;case 4:return Oe.label++,{value:qe[1],done:!1};case 5:Oe.label++,W=qe[1],qe=[0];continue;case 7:qe=Oe.ops.pop(),Oe.trys.pop();continue;default:if(!(te=Oe.trys,(te=te.length>0&&te[te.length-1])||qe[0]!==6&&qe[0]!==2)){Oe=0;continue}if(qe[0]===3&&(!te||qe[1]>te[0]&&qe[1]<te[3])){Oe.label=qe[1];break}if(qe[0]===6&&Oe.label<te[1]){Oe.label=te[1],te=qe;break}if(te&&Oe.label<te[2]){Oe.label=te[2],Oe.ops.push(qe);break}te[2]&&Oe.ops.pop(),Oe.trys.pop();continue}qe=C.call(V,Oe)}catch(Pt){qe=[6,Pt],W=0}finally{L=te=0}if(5&qe[0])throw qe[1];return{value:qe[0]?qe[1]:void 0,done:!0}}([ft,At])}}}var gt=function(){function V(){}return V.addKey=function(C){V.key=C},Object.defineProperty(V,"isLicensed",{get:function(){return!!V.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(V.key)},enumerable:!1,configurable:!0}),V}(),je=function(){function V(){}return V.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},V.setAttributes=function(C,L){for(var W=0,te=L;W<te.length;W++){var X=te[W],Oe=X[0],Ye=X[1];C.setAttribute(Oe,Ye)}},V.createRect=function(C,L,W){var te=document.createElementNS("http://www.w3.org/2000/svg","rect");return te.setAttribute("width",C.toString()),te.setAttribute("height",L.toString()),W&&V.setAttributes(te,W),te},V.createLine=function(C,L,W,te,X){var Oe=document.createElementNS("http://www.w3.org/2000/svg","line");return Oe.setAttribute("x1",C.toString()),Oe.setAttribute("y1",L.toString()),Oe.setAttribute("x2",W.toString()),Oe.setAttribute("y2",te.toString()),X&&V.setAttributes(Oe,X),Oe},V.createPolygon=function(C,L){var W=document.createElementNS("http://www.w3.org/2000/svg","polygon");return W.setAttribute("points",C),L&&V.setAttributes(W,L),W},V.createCircle=function(C,L){var W=document.createElementNS("http://www.w3.org/2000/svg","circle");return W.setAttribute("cx",(C/2).toString()),W.setAttribute("cy",(C/2).toString()),W.setAttribute("r",C.toString()),L&&V.setAttributes(W,L),W},V.createEllipse=function(C,L,W){var te=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return te.setAttribute("cx",(C/2).toString()),te.setAttribute("cy",(L/2).toString()),te.setAttribute("rx",(C/2).toString()),te.setAttribute("ry",(L/2).toString()),W&&V.setAttributes(te,W),te},V.createGroup=function(C){var L=document.createElementNS("http://www.w3.org/2000/svg","g");return C&&V.setAttributes(L,C),L},V.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},V.createMarker=function(C,L,W,te,X,Oe,Ye){var ft=document.createElementNS("http://www.w3.org/2000/svg","marker");return V.setAttributes(ft,[["id",C],["orient",L],["markerWidth",W.toString()],["markerHeight",te.toString()],["refX",X.toString()],["refY",Oe.toString()]]),ft.appendChild(Ye),ft},V.createText=function(C){var L=document.createElementNS("http://www.w3.org/2000/svg","text");return L.setAttribute("x","0"),L.setAttribute("y","0"),C&&V.setAttributes(L,C),L},V.createTSpan=function(C,L){var W=document.createElementNS("http://www.w3.org/2000/svg","tspan");return W.textContent=C,L&&V.setAttributes(W,L),W},V.createImage=function(C){var L=document.createElementNS("http://www.w3.org/2000/svg","image");return C&&V.setAttributes(L,C),L},V.createPoint=function(C,L){var W=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return W.x=C,W.y=L,W},V.createPath=function(C,L){var W=document.createElementNS("http://www.w3.org/2000/svg","path");return W.setAttribute("d",C),L&&V.setAttributes(W,L),W},V.createElement=function(C,L){var W=document.createElementNS("http://www.w3.org/2000/svg",C);return L&&V.setAttributes(W,L),W},V.getHollowRectanglePath=function(C,L,W,te,X,Oe,Ye,ft){return"M"+C+","+L+"V"+(L+te)+"H"+(C+W)+"V"+L+"H"+X+"V"+Oe+"H"+(X+Ye)+"V"+(Oe+ft)+"H"+X+"V"+L+"Z"},V}(),rt=function(){function V(C){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+C+"_"}return Object.defineProperty(V.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(V.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(V.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),V.prototype.addClass=function(C){return this.styleSheet===void 0&&this.addStyleSheet(),C.name=""+this.classNamePrefix+C.localName,this.classes.push(C),this.styleSheet.sheet.insertRule("."+C.name+" {"+C.style+"}",this.styleSheet.sheet.cssRules.length),C},V.prototype.addRule=function(C){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(C),this.styleSheet.sheet.insertRule(C.selector+" {"+C.style+"}",this.styleSheet.sheet.cssRules.length)},V.prototype.addStyleSheet=function(){var C;this.styleSheet=document.createElement("style"),((C=this.styleSheetRoot)!==null&&C!==void 0?C:document.head).appendChild(this.styleSheet),this.addRule(new it("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new it("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new it("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new et("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new et("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},V.prototype.removeStyleSheet=function(){var C;this.styleSheet&&(((C=this.styleSheetRoot)!==null&&C!==void 0?C:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},V}(),it=function(V,C){this.selector=V,this.style=C},et=function(V,C){this.localName=V,this.style=C},Tt=function(){function V(){this.blocks=[],this.display=""}return V.prototype.addButtonBlock=function(C){C.className=this.blockClassName,C.buttonClassName=this.buttonClassName,C.buttonColorsClassName=this.buttonColorsClassName,C.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(C)},V.prototype.addElementBlock=function(C){C.className===void 0&&(C.className=this.blockClassName),this.blocks.push(C)},V.prototype.getUI=function(){var C=document.createElement("div");return C.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,C.style.display=this.display,this.blocks.forEach(function(L){return C.appendChild(L.getUI())}),C},V}(),kt=function(){function V(){}return V.prototype.getUI=function(){var C=document.createElement("div");if(C.className=this.className,this.minWidth!==void 0&&(C.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":C.style.justifyContent="flex-start";break;case"center":C.style.justifyContent="center";break;case"end":C.style.justifyContent="flex-end"}return C.style.whiteSpace="nowrap",C},V}(),Dt=function(V){function C(){var L=V!==null&&V.apply(this,arguments)||this;return L.buttons=[],L}return Mt(C,V),C.prototype.addButton=function(L){L.className=this.buttonClassName,L.colorsClassName=this.buttonColorsClassName,L.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(L)},C.prototype.getUI=function(){var L=V.prototype.getUI.call(this);return this.buttons.forEach(function(W){return L.appendChild(W.getUI())}),L},C}(kt),vt=function(){function V(C,L){this._isActive=!1,this._isHidden=!1,this._icon=C,this.title=L,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(V.prototype,"icon",{get:function(){return this._icon},set:function(C){this._icon=C,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isActive",{get:function(){return this._isActive},set:function(C){this._isActive=C,this.adjustClassName()},enumerable:!1,configurable:!0}),V.prototype.getUI=function(){var C=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 C.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},V.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,"")))},V.prototype.hide=function(){this._isHidden=!0},V}(),dt=function(V){function C(){var L=V!==null&&V.apply(this,arguments)||this;return L.elements=[],L}return Mt(C,V),C.prototype.addElement=function(L){this.elements.push(L)},C.prototype.getUI=function(){var L=V.prototype.getUI.call(this);return this.elements.forEach(function(W){return L.appendChild(W)}),L},C}(kt),Vt=function(){function V(C,L){this.horizontal=C,this.vertical=L}return Object.defineProperty(V.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),V.prototype.getVerticalLength=function(C){return C/this.ratio},V.prototype.getHorizontalLength=function(C){return C*this.ratio},V}(),sn=function(){function V(){}return V.getIcon=function(C,L){if(C>0&&L>0){var W=new Vt(C,L),te=W.ratio>=1?20:W.getHorizontalLength(20),X=W.ratio<1?20:W.getVerticalLength(20),Oe=document.createElementNS("http://www.w3.org/2000/svg","svg");Oe.setAttribute("xmlns","http://www.w3.org/2000/svg"),Oe.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(Oe);var Ye=je.createDefs();Oe.appendChild(Ye);var ft=je.createElement("clipPath",[["id","text-bg-clip"]]);Ye.appendChild(ft);var At=je.createPath(je.getHollowRectanglePath((24-te)/2,(24-X)/2,te,X,(24-te)/2+2,(24-X)/2+2,te-4,X-4));Oe.appendChild(At);var qe=je.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);qe.appendChild(je.createTSpan(C+":"+L)),Oe.appendChild(qe);var Pt=qe.getBBox();je.setAttributes(qe,[["x",((24-Pt.width)/2).toString()],["y",((24-Pt.height)/2-Pt.y).toString()]]);var Ft=je.createPath(je.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Pt.width))/2,(24-Math.ceil(Pt.height))/2,Math.ceil(Pt.width),Math.ceil(Pt.height)));return ft.appendChild(Ft),je.setAttributes(At,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(Oe),Oe.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>'},V}(),gn=function(V){function C(L,W,te){var X=V.call(this,L,W)||this;return X.isDropdownOpen=!1,X.onClick=X.dropdownButtonClicked,X.dropdownButtons=te,X}return Mt(C,V),C.prototype.setupDropdown=function(){var L=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(W){W.className=L.className,W.colorsClassName=L.colorsClassName,L.dropdownBlock.appendChild(W.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},C.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},C.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},C.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},C.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},C.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},C}(vt),Kt=function(){function V(C,L){this.GRIP_SIZE=10,this.color=C,this.fillColor=L,this.visual=je.createGroup(),this.visual.appendChild(je.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(je.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return V.prototype.ownsTarget=function(C){return C===this.visual||C===this.visual.childNodes[0]||C===this.visual.childNodes[1]},V.prototype.setCenter=function(C,L){this.visual.childNodes.forEach(function(W){return je.setAttributes(W,[["cx",C.toString()],["cy",L.toString()]])})},V}(),vn=function(){function V(C,L,W,te){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=C,this.canvasHeight=L,this.margin=W,this.container=te,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(V.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(C){this._aspectRatio=C,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(C){this._isGridVisible=C,this.gridContainer&&je.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(C){this._zoomFactor=C,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),V.prototype.open=function(){var C=this;this.cropShadeElement=je.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=je.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var L=0;L<this.numberOfGridLines;L++)this.horizontalGridLines.push(je.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(je.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(W){return C.gridContainer.appendChild(W)}),this.verticalGridLines.forEach(function(W){return C.gridContainer.appendChild(W)}),this.cropRectElement=je.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Kt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Kt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Kt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Kt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},V.prototype.setCropRectangle=function(C){this.cropRect=C;var L=Object.assign({},this.cropRect);this.zoomFactor!==1&&(L.width=this.cropRect.width*this.zoomFactor,L.height=this.cropRect.height*this.zoomFactor,L.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-L.width/2,L.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-L.height/2),je.setAttributes(this.cropRectElement,[["x",L.x.toString()],["y",L.y.toString()],["width",L.width.toString()],["height",L.height.toString()]]);var W=L.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(X,Oe){var Ye=L.y+W*(Oe+1);je.setAttributes(X,[["x1",""+L.x],["y1",""+Ye],["x2",""+(L.x+L.width)],["y2",""+Ye]])});var te=L.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(X,Oe){var Ye=L.x+te*(Oe+1);je.setAttributes(X,[["x1",""+Ye],["y1",""+L.y],["x2",""+Ye],["y2",""+(L.y+L.height)]])}),je.setAttributes(this.cropShadeElement,[["d",je.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,L.x,L.y,L.width,L.height)]]),this.topLeftGrip.setCenter(L.x,L.y),this.topRightGrip.setCenter(L.x+L.width,L.y),this.bottomLeftGrip.setCenter(L.x,L.y+L.height),this.bottomRightGrip.setCenter(L.x+L.width,L.y+L.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},V.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)},V.prototype.clientToLocalCoordinates=function(C,L){var W=this.container.getBoundingClientRect();return{x:C-W.left+this.margin,y:L-W.top+this.margin}},V.prototype.onPointerDown=function(C){this.container.setPointerCapture(C.pointerId),this.previousPoint=this.clientToLocalCoordinates(C.clientX,C.clientY),this.cropRectElement===C.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(C.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(C.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(C.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(C.target)&&(this.activeGrip=this.bottomRightGrip)},V.prototype.onPointerMove=function(C){if(this.isMoving)this.move(this.clientToLocalCoordinates(C.clientX,C.clientY));else if(this.activeGrip){var L=this.clientToLocalCoordinates(C.clientX,C.clientY);this.resize(L)}C.preventDefault()},V.prototype.onPointerUp=function(C){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(C.pointerId)},V.prototype.move=function(C){var L=C.x-this.previousPoint.x,W=C.y-this.previousPoint.y;this.zoomFactor!==1&&(L=-L/this.zoomFactor,W=-W/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+L),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+W),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=C},V.prototype.resize=function(C){var L=Object.assign({},this.cropRect),W=C.x-this.previousPoint.x,te=C.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:L.x+W<this.margin&&(W=this.margin-L.x),L.x+=W,L.width=this.cropRect.x+this.cropRect.width-L.x;break;case this.bottomRightGrip:case this.topRightGrip:L.width+W>this.canvasWidth*this.zoomFactor&&(W=this.canvasWidth*this.zoomFactor-L.width),L.width+=W}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(L.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(W),L.height=this.aspectRatio.getVerticalLength(L.width)):(L.y+=te,L.height=this.cropRect.y+this.cropRect.height-L.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?L.height=this.aspectRatio.getVerticalLength(L.width):L.height+=te}L.width<10&&(L.x=this.cropRect.x,L.width=10),L.height<10&&(L.y=this.cropRect.y,L.height=10),this.previousPoint=C,L.x>=this.margin&&L.y>=this.margin&&L.x-this.margin+L.width<=this.canvasWidth&&L.y-this.margin+L.height<=this.canvasHeight&&(this.cropRect=L,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},V.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var C=this.cropRect.x+this.cropRect.width/2,L=this.cropRect.y+this.cropRect.height/2,W=this.aspectRatio.getHorizontalLength(this.cropRect.height),te=this.aspectRatio.getVerticalLength(this.cropRect.width);W/this.canvasWidth<te/this.canvasHeight?this.cropRect.width=W:this.cropRect.height=te,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=C-this.cropRect.width/2,this.cropRect.y=L-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)}},V.prototype.getRescaledRect=function(C,L,W,te,X,Oe){var Ye=W/C,ft=te/L;return{x:(X.x-Oe)*Ye+Oe,y:(X.y-Oe)*ft+Oe,width:X.width*Ye,height:X.height*ft}},V.prototype.scaleCanvas=function(C,L){var W=this.getRescaledRect(this.canvasWidth,this.canvasHeight,C,L,this.cropRect,this.margin);this.canvasWidth=C,this.canvasHeight=L,this.onCropChange&&this.onCropChange(W),this.setCropRectangle(W)},V}(),Mn=function(){function V(C){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=C,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(V.prototype,"angle",{get:function(){return this._angle},set:function(C){this._angle=C,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),V.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},V.prototype.onPointerDown=function(C){this.controlContainer.setPointerCapture(C.pointerId),this.isDragging=!0,this.previousPoint={x:C.clientX,y:C.clientY}},V.prototype.onPointerMove=function(C){this.isDragging&&(this.onAngleChange&&this.onAngleChange((C.clientX-this.previousPoint.x)/5),this.previousPoint.x=C.clientX)},V.prototype.onPointerUp=function(C){this.isDragging&&this.onAngleChange&&this.onAngleChange((C.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(C.pointerId)},V.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var C=this.angleLabelText.getBBox();je.setAttributes(this.angleLabelElement,[["x",((this.width-C.width)/2).toString()],["y",(this.height/2).toString()]])}},V.prototype.positionScaleShape=function(){if(this.scaleShape){var C=this.scaleShape.transform.baseVal.getItem(0);C.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(C,0)}},V.prototype.getVisual=function(){var C=document.createElementNS("http://www.w3.org/2000/svg","svg");C.setAttribute("xmlns","http://www.w3.org/2000/svg"),C.setAttribute("width",this.width+"px"),C.setAttribute("height",this.height+"px"),C.setAttribute("viewBox","0 0 "+this.width+" "+this.height),C.style.flexShrink="0",document.body.appendChild(C);for(var L="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,W=1;W<=this.width/5+10;W++){var te=W%5==0?this.height/3:this.height/6;L+="h4v"+-te+"h1v"+te}L+="v1H0Z",this.scaleShape=je.createPath(L);var X=je.createTransform();this.scaleShape.transform.baseVal.appendItem(X),C.appendChild(this.scaleShape),this.angleLabelElement=je.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=je.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var Oe=je.createTSpan("");return Oe.innerHTML="°",this.angleLabelElement.appendChild(Oe),C.appendChild(this.angleLabelElement),document.body.removeChild(C),C},V}(),Wn=function(){function V(){this.naturalSize=!1,this.imageType="image/png"}return V.prototype.rasterize=function(C,L,W,te,X,Oe,Ye){var ft=this;return new Promise(function(At){var qe=document.createElement("canvas");qe.width=C.width.baseVal.value-2*te,qe.height=C.height.baseVal.value-2*te;var Pt=1,Ft=1;ft.naturalSize===!0?(Pt=L.naturalWidth/(C.width.baseVal.value-2*te)/Oe,Ft=L.naturalHeight/(C.height.baseVal.value-2*te)/Ye,qe.width=L.naturalWidth/Oe,qe.height=L.naturalHeight/Ye):ft.width!==void 0&&ft.height!==void 0&&(Pt=ft.width/W.width,Ft=ft.height/W.height,qe.width*=Pt,qe.height*=Ft);var fn=qe.getContext("2d");fn.translate(qe.width/2,qe.height/2),fn.rotate(X*Math.PI/180),fn.scale(Oe,Ye),fn.translate(-qe.width/2,-qe.height/2),fn.drawImage(L,0,0,qe.width,qe.height);var Nn=document.createElement("canvas");Nn.width=W.width*Pt,Nn.height=W.height*Ft,Nn.getContext("2d").putImageData(fn.getImageData((W.x-te)*Pt,(W.y-te)*Ft,W.width*Pt,W.height*Ft),0,0),At(Nn.toDataURL(ft.imageType,ft.imageQuality))})},V}(),$e=function(){function V(C){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=V.instanceCounter++,this.styles=new rt(this.instanceNo),this.target=C,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(V.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(C){this._zoomToCropEnabled=C,C?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(C){this._isGridVisible=C,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"gridLines",{get:function(){return this._gridLines},set:function(C){this._gridLines=C,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(C){this._rotationAngle=C,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"aspectRatio",{get:function(){var C;return(C=this._aspectRatio)!==null&&C!==void 0?C:this.aspectRatios[0]},set:function(C){this._aspectRatio=C},enumerable:!1,configurable:!0}),V.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},V.prototype.show=function(){this.showUI(),this.open()},V.prototype.close=function(C){C===void 0&&(C=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),C||this.closeEventListeners.forEach(function(L){return L()}),this._isOpen=!1)},V.prototype.addRenderEventListener=function(C){this.renderEventListeners.push(C)},V.prototype.removeRenderEventListener=function(C){this.renderEventListeners.indexOf(C)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(C),1)},V.prototype.addCloseEventListener=function(C){this.closeEventListeners.push(C)},V.prototype.removeCloseEventListener=function(C){this.closeEventListeners.indexOf(C)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(C),1)},V.prototype.setupResizeObserver=function(){var C=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){C.resize(C.target.clientWidth,C.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))},V.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var C=1*this.target.clientWidth/this.target.clientHeight,L=this.contentDiv.clientWidth/C>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*C:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,W=L+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/C;this.resize(L,W)}},V.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},V.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",je.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},V.prototype.resize=function(C,L){this.imageWidth=Math.round(C),this.imageHeight=Math.round(L),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()},V.prototype.setEditingTarget=function(){var C=document.createElement("canvas");C.width=this.target.naturalWidth,C.height=this.target.naturalHeight,C.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var L=C.toDataURL();je.setAttributes(this.editingTarget,[["href",L]]),this.setEditingTargetSize()},V.prototype.setTopLeft=function(){var C=this.target.getBoundingClientRect(),L=this.editorCanvas.getBoundingClientRect();this.left=C.left-L.left-this.CANVAS_MARGIN,this.top=C.top-L.top-this.CANVAS_MARGIN},V.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=je.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=je.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=je.createGroup(),this.editingTargetRotationScaleContainer=je.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var C=je.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(C);var L=je.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(L),this.editingTargetContainer=je.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)},V.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},V.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=je.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new vn(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()},V.prototype.zoomToCrop=function(){if(this.cropRect){var C=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,L=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=C+"px "+L+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-C+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-L+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},V.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)},V.prototype.cropRectChanged=function(C){this.cropRect=C,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},V.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},V.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"},V.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},V.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 C=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,L=this.target.offsetTop>C+this.CANVAS_MARGIN?this.target.offsetTop-(C+this.CANVAS_MARGIN):0;this.coverDiv.style.top=L+"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},V.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},V.prototype.addTopToolbar=function(){var C=this;this.topToolbar=new Tt,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 L=new Dt;L.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(L);var W=[];this.aspectRatios.forEach(function(Ft){var fn=new vt(sn.getIcon(Ft.horizontal,Ft.vertical),Ft.horizontal===0&&Ft.vertical===0?"FREE":Ft.horizontal+":"+Ft.vertical);fn.onClick=function(){return C.ratioButtonClicked(Ft)},W.push(fn)}),this.aspectRatioButton=new gn(sn.getIcon(0,0),"Aspect ratio",W),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,L.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var te=new vt('<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");te.isActive=this.isGridVisible,te.onClick=function(){C.isGridVisible=!C.isGridVisible,te.isActive=C.isGridVisible},L.addButton(te);var X=new vt('<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(X.isActive=this.zoomToCropEnabled,X.onClick=function(){C.zoomToCropEnabled=!C.zoomToCropEnabled,X.isActive=C.zoomToCropEnabled},L.addButton(X),!gt.isLicensed){var Oe=new dt;this.topToolbar.addElementBlock(Oe);var Ye=document.createElement("div");Ye.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var ft=document.createElement("a");ft.style.color="currentColor",ft.href="https://markerjs.com/products/cropro",ft.target="_blank",ft.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>',Ye.appendChild(ft),Oe.addElement(Ye)}var At=new Dt;At.minWidth=3*this.toolbarHeight+"px",At.contentAlign="end",this.topToolbar.addButtonBlock(At);var qe=new vt('<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");qe.onClick=this.startRenderAndClose,At.addButton(qe),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(qe.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Pt=new vt('<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");Pt.onClick=this.close,At.addButton(Pt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Pt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},V.prototype.addBottomToolbar=function(){var C=this;this.bottomToolbar=new Tt,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 L=new Dt;L.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(L);var W=new vt('<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");W.onClick=this.rotateLeftButtonClicked,L.addButton(W);var te=new vt('<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");te.onClick=this.rotateRightButtonClicked,L.addButton(te);var X=new dt;X.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(X),this.straightener=new Mn("Straighten"),this.straightener.className=this.toolbarStraightenerStyleClass.name,this.straightener.colorsClassName=this.styles.settings.toolbarStraightenerColorsClassName?this.styles.settings.toolbarStraightenerColorsClassName:this.toolbarStraightenerStyleColorsClass.name,this.straightener.onAngleChange=function(At){C.rotateBy(At),C.straightener.angle=C.rotationAngle},X.addElement(this.straightener.getUI());var Oe=new Dt;Oe.minWidth=2*this.toolbarHeight+"px",Oe.contentAlign="end",this.bottomToolbar.addButtonBlock(Oe);var Ye=new vt('<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");Ye.onClick=this.flipHorizontallyButtonClicked,Oe.addButton(Ye);var ft=new vt('<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");ft.onClick=this.flipVerticallyButtonClicked,Oe.addButton(ft)},V.prototype.ratioButtonClicked=function(C){this.aspectRatio=C,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},V.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=sn.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},V.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Vt(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},V.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},V.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},V.prototype.restoreState=function(C){if(C){var L=this.cropLayer.getRescaledRect(C.width,C.height,this.imageWidth,this.imageHeight,C.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(L),this.cropRectChanged(L),this.flippedHorizontally=C.flippedHorizontally,this.flippedVertically=C.flippedVertically,this.applyFlip(),this.rotationAngle=C.rotationAngle,this.applyRotation()}},V.prototype.clientToLocalCoordinates=function(C,L){var W=this.cropImage.getBoundingClientRect();return{x:C-W.left,y:L-W.top}},V.prototype.onWindowResize=function(){this.positionUI()},V.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var C=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=C+"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()},V.prototype.rotateLeftButtonClicked=function(){var C=this.rotationAngle-90;this.rotationAngle%90!=0&&(C+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(C)},V.prototype.rotateRightButtonClicked=function(){var C=this.rotationAngle+90;this.rotationAngle%90!=0&&(C-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(C)},V.prototype.rotateTo=function(C){C=(C=C>180?C-360:C)<=-180?C+360:C,this.rotationAngle=C,this.applyRotation()},V.prototype.rotateBy=function(C){this.rotateTo((this.rotationAngle+C)%360)},V.prototype.applyRotation=function(){var C=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var L=this.editingTargetRotationContainer.transform.baseVal.getItem(0);L.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(L,0);var W=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/W.width,this.imageHeight/W.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=C},V.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},V.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},V.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},V.prototype.startRenderAndClose=function(){return Ot(this,void 0,void 0,function(){var C,L;return Lt(this,function(W){switch(W.label){case 0:return[4,this.render()];case 1:return C=W.sent(),L=this.getState(),this.renderEventListeners.forEach(function(te){return te(C,L)}),this.close(!0),[2]}})})},V.prototype.render=function(){return Ot(this,void 0,void 0,function(){var C;return Lt(this,function(L){switch(L.label){case 0:return(C=new Wn).naturalSize=this.renderAtNaturalSize,C.imageType=this.renderImageType,C.imageQuality=this.renderImageQuality,C.width=this.renderWidth,C.height=this.renderHeight,this.unzoomFromCrop(),je.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,C.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 L.sent(),[4,C.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,L.sent()]}})})},V.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new et("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 et("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new et("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var C=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new et("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*C)+`px;
|
|
height: `+(this.toolbarHeight-2*C)+`px;
|
|
padding: `+C+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new et("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new et("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new it("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new it("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new et("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 et("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new et("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 et("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*C)+`px;
|
|
padding: `+C+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new et("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},V.instanceCounter=0,V}(),ct=$("8hTe"),Jt=$.n(ct),hn=/<pre[^>]*>/g;function _n(V){var C=document.createElement("div");return C.innerHTML=V,C.childNodes.length===0?"":C.childNodes[0].nodeValue}var cn=Ke.a=function(V){var C=V.value,L=C===void 0?"":C,W=V.edit,te=W===void 0?!1:W,X=V.className,Oe=V.showTextOnly,Ye=V.showLines,ft=V.replaces,At=V.zoomImg,qe=V.hasMask,Pt=V.style,Ft=Pt===void 0?{}:Pt,fn=V.stylesPrev,Nn=fn===void 0?{}:fn,In=String(L),Tn=Object(R.useRef)(),ei=Object(R.useRef)(),_i=Object(R.useState)(""),Ht=Object(G.a)(_i,2),Bt=Ht[0],Gt=Ht[1],Yt=Object(R.useState)("office"),Qt=Object(G.a)(Yt,2),tn=Qt[0],bn=Qt[1],Dn=function(){var zt=new $e(ei.current);zt.displayMode="popup",zt.addRenderEventListener(function(){var wn=Object(D.a)(k.a.mark(function Xt(nn){var rn;return k.a.wrap(function(kn){for(;;)switch(kn.prev=kn.next){case 0:return Tn.current.style.display="none",kn.next=3,Object(_e.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:nn}});case 3:rn=kn.sent,rn!=null&&rn.id&&ft(ei.current.getAttribute("src").replace(J.a.API_SERVER,""),"/api/attachments/".concat(rn==null?void 0:rn.id,"?type=").concat(rn.content_type));case 5:case"end":return kn.stop()}},Xt)}));return function(Xt){return wn.apply(this,arguments)}}()),zt.show()},Un=function(){var zt=new xt(ei.current);zt.settings.displayMode="popup",zt.addEventListener("render",function(){var wn=Object(D.a)(k.a.mark(function Xt(nn){var rn;return k.a.wrap(function(kn){for(;;)switch(kn.prev=kn.next){case 0:if(Tn.current.style.display="none",!ei.current){kn.next=6;break}return kn.next=4,Object(_e.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:nn.dataUrl}});case 4:rn=kn.sent,rn!=null&&rn.id&&ft(ei.current.getAttribute("src").replace(J.a.API_SERVER,""),"/api/attachments/".concat(rn==null?void 0:rn.id,"?type=").concat(rn.content_type));case 6:case"end":return kn.stop()}},Xt)}));return function(Xt){return wn.apply(this,arguments)}}()),zt.show(),window.markerArea=zt},Sn=Object(R.useMemo)(function(){Tn.current&&(Tn.current.style.zIndex=-1);try{var ln=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,zt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,wn=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;In=In.replace(ln,"("+J.a.API_SERVER+"/api/attachments/").replace(zt,'"'+J.a.API_SERVER+"/api/attachments/").replace(wn,'"'+J.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`)}catch(ii){}var Xt=H(In),nn=g();if(In.match(/\[TOC\]/)&&(Xt=Xt.replace("<p>[TOC]</p>",A()),O()),Xt=Xt.replace(/(__special_katext_id_\d+__)/g,function(ii,kn){var en=nn[kn],xi=en.type,Qn=en.expression;return Object(ie.renderToString)(_n(Qn)||"",{displayMode:xi==="block",throwOnError:!1,output:"html"})}),Xt=Xt.replace(/▁/g,"\u2581\u2581\u2581"),l(),Oe){var rn=document.createElement("div");return rn.innerHTML=Xt,rn.innerText}return setTimeout(function(){return Ei()},500),Xt},[In]),Fn=Object(R.useRef)();w.WebkitLineClamp=Ye,Ye&&(Ft=Object(F.a)(Object(F.a)({},Ft),w));function ti(ln){var zt=ln.target;if(zt.tagName.toUpperCase()==="IMG"){if(At){var wn=zt.getAttribute("src");Gt(wn),bn("image")}}else if(zt.tagName.toUpperCase()==="A"){var Xt=zt.getAttribute("href");if(Xt.indexOf("office")>-1)ln.preventDefault(),Gt(Xt),bn("office");else if(Xt.indexOf("application/pdf")>-1)ln.preventDefault(),Gt(Xt),bn("pdf");else if(Xt.indexOf("text/html")>-1)ln.preventDefault(),Gt(Xt),bn("html");else if(Xt.startsWith("#")){ln.preventDefault();var nn=document.getElementById(Xt.replace("#",""));nn&&nn.scrollIntoView(!0)}}}var Ei=function(){var zt,wn=(zt=Fn.current)===null||zt===void 0?void 0:zt.querySelectorAll("video");wn==null||wn.forEach(function(Xt){if(Xt.oncontextmenu=function(){return!1},Xt.src.indexOf(".m3u8")>-1&&!Xt.canPlayType("application/vnd.apple.mpegurl")){if(K.a.isSupported()){var nn=new K.a;nn.loadSource(Xt.src),nn.attachMedia(Xt)}}})};Object(R.useEffect)(function(){if(Fn.current&&Sn&&(Sn.match(hn)&&window.PR.prettyPrint()),Fn.current)return Fn.current.addEventListener("click",ti),function(){Fn.current.removeEventListener("click",ti),l(),O()}},[Sn,Fn.current,ti]);var ni=function(zt){if(!te)return;zt.target.nodeName==="IMG"?(Tn.current.style.zIndex=1,Tn.current.style.display="flex",Tn.current.style.width=zt.target.clientWidth+"px",Tn.current.style.height=zt.target.clientHeight+"px",Tn.current.style.top=zt.target.offsetTop+"px",Tn.current.style.left=zt.target.offsetLeft+"px",ei.current.src=zt.target.getAttribute("src")):Tn.current.style.display="none"};return b.a.createElement("div",{style:{position:"relative"}},b.a.createElement("div",{ref:Fn,style:Object(F.a)({},Ft),className:"".concat(X||""," markdown-body ").concat(Jt.a.mdBody),onMouseOver:ni,dangerouslySetInnerHTML:{__html:Sn}}),b.a.createElement("div",{ref:Tn,className:Jt.a.button},b.a.createElement(Y.a,null,b.a.createElement(Q.a,{onClick:function(){return Dn()}},"\u88C1\u526A"),b.a.createElement(Q.a,{onClick:function(){return Un()}},"\u7F16\u8F91"))),b.a.createElement("img",{ref:ei,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),b.a.createElement(pe.a,{close:!0,data:Bt,type:Bt!=null&&Bt.length?tn:"",style:Object(F.a)({},Nn),onClose:function(){return Gt("")}}))}},"9VGf":function(ut,Ke,$){"use strict";$.d(Ke,"a",function(){return N});var ce=$("q1tI"),Y=$.n(ce);function N(Q,F){var D=Object(ce.useRef)();Object(ce.useEffect)(function(){D.current=Q}),Object(ce.useEffect)(function(){function G(){D.current()}if(F!==null){var B=setInterval(G,F);return function(){return clearInterval(B)}}},[F])}},BU3w:function(ut,Ke,$){"use strict";$.d(Ke,"a",function(){return D});var ce=$("MNnm"),Y="rc-util-key";function N(G){if(G.attachTo)return G.attachTo;var B=document.querySelector("head");return B||document.body}function Q(G){var B,k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ce.a)())return null;var R=document.createElement("style");if((B=k.csp)===null||B===void 0?void 0:B.nonce){var b;R.nonce=(b=k.csp)===null||b===void 0?void 0:b.nonce}R.innerHTML=G;var v=N(k),m=v.firstChild;return k.prepend&&v.prepend?v.prepend(R):k.prepend&&m?v.insertBefore(R,m):v.appendChild(R),R}var F=new Map;function D(G,B){var k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},R=N(k);if(!F.has(R)){var b=Q("",k),v=b.parentNode;F.set(R,v),v.removeChild(b)}var m=Array.from(F.get(R).children).find(function(a){return a.tagName==="STYLE"&&a[Y]===B});if(m){var u,r;if(((u=k.csp)===null||u===void 0?void 0:u.nonce)&&m.nonce!==((r=k.csp)===null||r===void 0?void 0:r.nonce)){var c;m.nonce=(c=k.csp)===null||c===void 0?void 0:c.nonce}return m.innerHTML!==G&&(m.innerHTML=G),m}var s=Q(G,k);return s[Y]=B,s}},Bd2K:function(ut,Ke,$){(function(ce){ce($("VrN/"),$("osHv"))})(function(ce){ce.defineOption("autoCloseTags",!1,function(k,R,b){if(b!=ce.Init&&b&&k.removeKeyMap("autoCloseTags"),!R)return;var v={name:"autoCloseTags"};(typeof R!="object"||R.whenClosing!==!1)&&(v["'/'"]=function(m){return D(m)}),(typeof R!="object"||R.whenOpening!==!1)&&(v["'>'"]=function(m){return Q(m)}),k.addKeyMap(v)});var Y=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],N=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function Q(k){if(k.getOption("disableInput"))return ce.Pass;for(var R=k.listSelections(),b=[],v=k.getOption("autoCloseTags"),m=0;m<R.length;m++){if(!R[m].empty())return ce.Pass;var u=R[m].head,r=k.getTokenAt(u),c=ce.innerMode(k.getMode(),r.state),s=c.state,a=c.mode.xmlCurrentTag&&c.mode.xmlCurrentTag(s),o=a&&a.name;if(!o)return ce.Pass;var h=c.mode.configuration=="html",O=typeof v=="object"&&v.dontCloseTags||h&&Y,w=typeof v=="object"&&v.indentTags||h&&N;r.end>u.ch&&(o=o.slice(0,o.length-r.end+u.ch));var x=o.toLowerCase();if(!o||r.type=="string"&&(r.end!=u.ch||!/[\"\']/.test(r.string.charAt(r.string.length-1))||r.string.length==1)||r.type=="tag"&&a.close||r.string.indexOf("/")==u.ch-r.start-1||O&&G(O,x)>-1||B(k,c.mode.xmlCurrentContext&&c.mode.xmlCurrentContext(s)||[],o,u,!0))return ce.Pass;var A=typeof v=="object"&&v.emptyTags;if(A&&G(A,o)>-1){b[m]={text:"/>",newPos:ce.Pos(u.line,u.ch+2)};continue}var S=w&&G(w,x)>-1;b[m]={indent:S,text:">"+(S?`
|
|
|
|
`:"")+"</"+o+">",newPos:S?ce.Pos(u.line+1,0):ce.Pos(u.line,u.ch+1)}}for(var y=typeof v=="object"&&v.dontIndentOnAutoClose,m=R.length-1;m>=0;m--){var _=b[m];k.replaceRange(_.text,R[m].head,R[m].anchor,"+insert");var p=k.listSelections().slice(0);p[m]={head:_.newPos,anchor:_.newPos},k.setSelections(p),!y&&_.indent&&(k.indentLine(_.newPos.line,null,!0),k.indentLine(_.newPos.line+1,null,!0))}}function F(k,R){for(var b=k.listSelections(),v=[],m=R?"/":"</",u=k.getOption("autoCloseTags"),r=typeof u=="object"&&u.dontIndentOnSlash,c=0;c<b.length;c++){if(!b[c].empty())return ce.Pass;var s=b[c].head,a=k.getTokenAt(s),o=ce.innerMode(k.getMode(),a.state),h=o.state;if(R&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=s.ch-1))return ce.Pass;var O,w=o.mode.name!="xml"&&k.getMode().name=="htmlmixed";if(w&&o.mode.name=="javascript")O=m+"script";else if(w&&o.mode.name=="css")O=m+"style";else{var x=o.mode.xmlCurrentContext&&o.mode.xmlCurrentContext(h);if(!x||x.length&&B(k,x,x[x.length-1],s))return ce.Pass;O=m+x[x.length-1]}k.getLine(s.line).charAt(a.end)!=">"&&(O+=">"),v[c]=O}if(k.replaceSelections(v),b=k.listSelections(),!r)for(var c=0;c<b.length;c++)(c==b.length-1||b[c].head.line<b[c+1].head.line)&&k.indentLine(b[c].head.line)}function D(k){return k.getOption("disableInput")?ce.Pass:F(k,!0)}ce.commands.closeTag=function(k){return F(k)};function G(k,R){if(k.indexOf)return k.indexOf(R);for(var b=0,v=k.length;b<v;++b)if(k[b]==R)return b;return-1}function B(k,R,b,v,m){if(!ce.scanForClosingTag)return!1;var u=Math.min(k.lastLine()+1,v.line+500),r=ce.scanForClosingTag(k,v,null,u);if(!r||r.tag!=b)return!1;for(var c=m?1:0,s=R.length-1;s>=0&&R[s]==b;s--)++c;v=r.to;for(var s=1;s<c;s++){var a=ce.scanForClosingTag(k,v,null,u);if(!a||a.tag!=b)return!1;v=a.to}return!0}})},BjJ7:function(ut,Ke,$){"use strict";$.d(Ke,"d",function(){return Y}),$.d(Ke,"c",function(){return N}),$.d(Ke,"e",function(){return Q}),$.d(Ke,"b",function(){return F}),$.d(Ke,"a",function(){return G});var ce=$("m3rI");function Y(B){var k=!0;if(B.length>0){for(var R=0;R<B.length;R++)if(B[R].compile_success==0||!B[R].compile_success){k=!1;break}}else k=!1;return k}function N(B){for(var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",R=[],b=0;b<B.length;b++){var v=B[b],m=k?"".concat(k,"/").concat(v.name):"".concat(v.name);R.push({title:v.name,isLeaf:!(v.type==="tree"),key:m})}return R}function Q(B,k,R){for(var b=0;b<B.length;b++){var v=B[b];if(v.key===k){v.children=R;break}v.children&&Q(v.children,k,R)}return B}function F(B,k,R){var b;return function(){var v=this,m=arguments,u=function(){b=null,R||B.apply(v,m)},r=R&&!b;clearTimeout(b),b=setTimeout(u,k),r&&B.apply(v,m)}}var D=!0,G=ce.a.API_SERVER},"C+DQ":function(ut,Ke,$){},DlQD:function(ut,Ke,$){(function(ce,Y){ut.exports=Y()})(this,function(){"use strict";function ce(be,ve){for(var ge=0;ge<ve.length;ge++){var le=ve[ge];le.enumerable=le.enumerable||!1,le.configurable=!0,"value"in le&&(le.writable=!0),Object.defineProperty(be,le.key,le)}}function Y(be,ve,ge){return ve&&ce(be.prototype,ve),ge&&ce(be,ge),be}function N(be,ve){if(!be)return;if(typeof be=="string")return Q(be,ve);var ge=Object.prototype.toString.call(be).slice(8,-1);if(ge==="Object"&&be.constructor&&(ge=be.constructor.name),ge==="Map"||ge==="Set")return Array.from(be);if(ge==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ge))return Q(be,ve)}function Q(be,ve){(ve==null||ve>be.length)&&(ve=be.length);for(var ge=0,le=new Array(ve);ge<ve;ge++)le[ge]=be[ge];return le}function F(be,ve){var ge;if(typeof Symbol=="undefined"||be[Symbol.iterator]==null){if(Array.isArray(be)||(ge=N(be))||ve&&be&&typeof be.length=="number"){ge&&(be=ge);var le=0;return function(){return le>=be.length?{done:!0}:{done:!1,value:be[le++]}}}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 ge=be[Symbol.iterator](),ge.next.bind(ge)}function D(be,ve){return ve={exports:{}},be(ve,ve.exports),ve.exports}var G=D(function(be){function ve(){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 ge(le){be.exports.defaults=le}be.exports={defaults:ve(),getDefaults:ve,changeDefaults:ge}}),B=G.defaults,k=G.getDefaults,R=G.changeDefaults,b=/[&<>"']/,v=/[&<>"']/g,m=/[<>"']|&(?!#?\w+;)/,u=/[<>"']|&(?!#?\w+;)/g,r={"&":"&","<":"<",">":">",'"':""","'":"'"},c=function(ve){return r[ve]};function s(be,ve){if(ve){if(b.test(be))return be.replace(v,c)}else if(m.test(be))return be.replace(u,c);return be}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function o(be){return be.replace(a,function(ve,ge){return ge=ge.toLowerCase(),ge==="colon"?":":ge.charAt(0)==="#"?ge.charAt(1)==="x"?String.fromCharCode(parseInt(ge.substring(2),16)):String.fromCharCode(+ge.substring(1)):""})}var h=/(^|[^\[])\^/g;function O(be,ve){be=be.source||be,ve=ve||"";var ge={replace:function(ue,ye){return ye=ye.source||ye,ye=ye.replace(h,"$1"),be=be.replace(ue,ye),ge},getRegex:function(){return new RegExp(be,ve)}};return ge}var w=/[^\w:]/g,x=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function A(be,ve,ge){if(be){var le;try{le=decodeURIComponent(o(ge)).replace(w,"").toLowerCase()}catch(ue){return null}if(le.indexOf("javascript:")===0||le.indexOf("vbscript:")===0||le.indexOf("data:")===0)return null}ve&&!x.test(ge)&&(ge=d(ve,ge));try{ge=encodeURI(ge).replace(/%25/g,"%")}catch(ue){return null}return ge}var S={},y=/^[^:]+:\/*[^/]*$/,_=/^([^:]+:)[\s\S]*$/,p=/^([^:]+:\/*[^/]*)[\s\S]*$/;function d(be,ve){S[" "+be]||(y.test(be)?S[" "+be]=be+"/":S[" "+be]=U(be,"/",!0)),be=S[" "+be];var ge=be.indexOf(":")===-1;return ve.substring(0,2)==="//"?ge?ve:be.replace(_,"$1")+ve:ve.charAt(0)==="/"?ge?ve:be.replace(p,"$1")+ve:be+ve}var g={exec:function(){}};function l(be){for(var ve=1,ge,le;ve<arguments.length;ve++){ge=arguments[ve];for(le in ge)Object.prototype.hasOwnProperty.call(ge,le)&&(be[le]=ge[le])}return be}function E(be,ve){var ge=be.replace(/\|/g,function(ye,xe,we){for(var ke=!1,We=xe;--We>=0&&we[We]==="\\";)ke=!ke;return ke?"|":" |"}),le=ge.split(/ \|/),ue=0;if(le.length>ve)le.splice(ve);else for(;le.length<ve;)le.push("");for(;ue<le.length;ue++)le[ue]=le[ue].trim().replace(/\\\|/g,"|");return le}function U(be,ve,ge){var le=be.length;if(le===0)return"";for(var ue=0;ue<le;){var ye=be.charAt(le-ue-1);if(ye===ve&&!ge)ue++;else if(ye!==ve&&ge)ue++;else break}return be.substr(0,le-ue)}function P(be,ve){if(be.indexOf(ve[1])===-1)return-1;for(var ge=be.length,le=0,ue=0;ue<ge;ue++)if(be[ue]==="\\")ue++;else if(be[ue]===ve[0])le++;else if(be[ue]===ve[1]&&(le--,le<0))return ue;return-1}function j(be){be&&be.sanitize&&!be.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 H={escape:s,unescape:o,edit:O,cleanUrl:A,resolveUrl:d,noopTest:g,merge:l,splitCells:E,rtrim:U,findClosingBracket:P,checkSanitizeDeprecation:j},I=G.defaults,T=H.rtrim,K=H.splitCells,J=H.escape,ie=H.findClosingBracket;function pe(be,ve,ge){var le=ve.href,ue=ve.title?J(ve.title):null,ye=be[1].replace(/\\([\[\]])/g,"$1");return be[0].charAt(0)!=="!"?{type:"link",raw:ge,href:le,title:ue,text:ye}:{type:"image",raw:ge,href:le,title:ue,text:J(ye)}}function _e(be,ve){var ge=be.match(/^(\s+)(?:```)/);if(ge===null)return ve;var le=ge[1];return ve.split(`
|
|
`).map(function(ue){var ye=ue.match(/^\s+/);if(ye===null)return ue;var xe=ye[0];return xe.length>=le.length?ue.slice(le.length):ue}).join(`
|
|
`)}var Te=function(){function be(ge){this.options=ge||I}var ve=be.prototype;return ve.space=function(le){var ue=this.rules.block.newline.exec(le);if(ue)return ue[0].length>1?{type:"space",raw:ue[0]}:{raw:`
|
|
`}},ve.code=function(le,ue){var ye=this.rules.block.code.exec(le);if(ye){var xe=ue[ue.length-1];if(xe&&xe.type==="paragraph")return{raw:ye[0],text:ye[0].trimRight()};var we=ye[0].replace(/^ {4}/gm,"");return{type:"code",raw:ye[0],codeBlockStyle:"indented",text:this.options.pedantic?we:T(we,`
|
|
`)}}},ve.fences=function(le){var ue=this.rules.block.fences.exec(le);if(ue){var ye=ue[0],xe=_e(ye,ue[3]||"");return{type:"code",raw:ye,lang:ue[2]?ue[2].trim():ue[2],text:xe}}},ve.heading=function(le){var ue=this.rules.block.heading.exec(le);if(ue)return{type:"heading",raw:ue[0],depth:ue[1].length,text:ue[2]}},ve.nptable=function(le){var ue=this.rules.block.nptable.exec(le);if(ue){var ye={type:"table",header:K(ue[1].replace(/^ *| *\| *$/g,"")),align:ue[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ue[3]?ue[3].replace(/\n$/,"").split(`
|
|
`):[],raw:ue[0]};if(ye.header.length===ye.align.length){var xe=ye.align.length,we;for(we=0;we<xe;we++)/^ *-+: *$/.test(ye.align[we])?ye.align[we]="right":/^ *:-+: *$/.test(ye.align[we])?ye.align[we]="center":/^ *:-+ *$/.test(ye.align[we])?ye.align[we]="left":ye.align[we]=null;for(xe=ye.cells.length,we=0;we<xe;we++)ye.cells[we]=K(ye.cells[we],ye.header.length);return ye}}},ve.hr=function(le){var ue=this.rules.block.hr.exec(le);if(ue)return{type:"hr",raw:ue[0]}},ve.blockquote=function(le){var ue=this.rules.block.blockquote.exec(le);if(ue){var ye=ue[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ue[0],text:ye}}},ve.list=function(le){var ue=this.rules.block.list.exec(le);if(ue){for(var ye=ue[0],xe=ue[2],we=xe.length>1,ke=xe[xe.length-1]===")",We={type:"list",raw:ye,ordered:we,start:we?+xe.slice(0,-1):"",loose:!1,items:[]},Je=ue[0].match(this.rules.block.item),Qe=!1,Ze,bt,yt,lt,wt,xt,Ct,Mt=Je.length,Ot=0;Ot<Mt;Ot++)Ze=Je[Ot],ye=Ze,bt=Ze.length,Ze=Ze.replace(/^ *([*+-]|\d+[.)]) */,""),~Ze.indexOf(`
|
|
`)&&(bt-=Ze.length,Ze=this.options.pedantic?Ze.replace(/^ {1,4}/gm,""):Ze.replace(new RegExp("^ {1,"+bt+"}","gm"),"")),Ot!==Mt-1&&(yt=this.rules.block.bullet.exec(Je[Ot+1])[0],(we?yt.length===1||!ke&&yt[yt.length-1]===")":yt.length>1||this.options.smartLists&&yt!==xe)&&(lt=Je.slice(Ot+1).join(`
|
|
`),We.raw=We.raw.substring(0,We.raw.length-lt.length),Ot=Mt-1)),wt=Qe||/\n\n(?!\s*$)/.test(Ze),Ot!==Mt-1&&(Qe=Ze.charAt(Ze.length-1)===`
|
|
`,wt||(wt=Qe)),wt&&(We.loose=!0),xt=/^\[[ xX]\] /.test(Ze),Ct=void 0,xt&&(Ct=Ze[1]!==" ",Ze=Ze.replace(/^\[[ xX]\] +/,"")),We.items.push({type:"list_item",raw:ye,task:xt,checked:Ct,loose:wt,text:Ze});return We}},ve.html=function(le){var ue=this.rules.block.html.exec(le);if(ue)return{type:this.options.sanitize?"paragraph":"html",raw:ue[0],pre:!this.options.sanitizer&&(ue[1]==="pre"||ue[1]==="script"||ue[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ue[0]):J(ue[0]):ue[0]}},ve.def=function(le){var ue=this.rules.block.def.exec(le);if(ue){ue[3]&&(ue[3]=ue[3].substring(1,ue[3].length-1));var ye=ue[1].toLowerCase().replace(/\s+/g," ");return{tag:ye,raw:ue[0],href:ue[2],title:ue[3]}}},ve.table=function(le){var ue=this.rules.block.table.exec(le);if(ue){var ye={type:"table",header:K(ue[1].replace(/^ *| *\| *$/g,"")),align:ue[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ue[3]?ue[3].replace(/\n$/,"").split(`
|
|
`):[]};if(ye.header.length===ye.align.length){ye.raw=ue[0];var xe=ye.align.length,we;for(we=0;we<xe;we++)/^ *-+: *$/.test(ye.align[we])?ye.align[we]="right":/^ *:-+: *$/.test(ye.align[we])?ye.align[we]="center":/^ *:-+ *$/.test(ye.align[we])?ye.align[we]="left":ye.align[we]=null;for(xe=ye.cells.length,we=0;we<xe;we++)ye.cells[we]=K(ye.cells[we].replace(/^ *\| *| *\| *$/g,""),ye.header.length);return ye}}},ve.lheading=function(le){var ue=this.rules.block.lheading.exec(le);if(ue)return{type:"heading",raw:ue[0],depth:ue[2].charAt(0)==="="?1:2,text:ue[1]}},ve.paragraph=function(le){var ue=this.rules.block.paragraph.exec(le);if(ue)return{type:"paragraph",raw:ue[0],text:ue[1].charAt(ue[1].length-1)===`
|
|
`?ue[1].slice(0,-1):ue[1]}},ve.text=function(le,ue){var ye=this.rules.block.text.exec(le);if(ye){var xe=ue[ue.length-1];return xe&&xe.type==="text"?{raw:ye[0],text:ye[0]}:{type:"text",raw:ye[0],text:ye[0]}}},ve.escape=function(le){var ue=this.rules.inline.escape.exec(le);if(ue)return{type:"escape",raw:ue[0],text:J(ue[1])}},ve.tag=function(le,ue,ye){var xe=this.rules.inline.tag.exec(le);if(xe)return!ue&&/^<a /i.test(xe[0])?ue=!0:ue&&/^<\/a>/i.test(xe[0])&&(ue=!1),!ye&&/^<(pre|code|kbd|script)(\s|>)/i.test(xe[0])?ye=!0:ye&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(xe[0])&&(ye=!1),{type:this.options.sanitize?"text":"html",raw:xe[0],inLink:ue,inRawBlock:ye,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(xe[0]):J(xe[0]):xe[0]}},ve.link=function(le){var ue=this.rules.inline.link.exec(le);if(ue){var ye=ie(ue[2],"()");if(ye>-1){var xe=ue[0].indexOf("!")===0?5:4,we=xe+ue[1].length+ye;ue[2]=ue[2].substring(0,ye),ue[0]=ue[0].substring(0,we).trim(),ue[3]=""}var ke=ue[2],We="";if(this.options.pedantic){var Je=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ke);Je?(ke=Je[1],We=Je[3]):We=""}else We=ue[3]?ue[3].slice(1,-1):"";ke=ke.trim().replace(/^<([\s\S]*)>$/,"$1");var Qe=pe(ue,{href:ke&&ke.replace(this.rules.inline._escapes,"$1"),title:We&&We.replace(this.rules.inline._escapes,"$1")},ue[0]);return Qe}},ve.reflink=function(le,ue){var ye;if((ye=this.rules.inline.reflink.exec(le))||(ye=this.rules.inline.nolink.exec(le))){var xe=(ye[2]||ye[1]).replace(/\s+/g," ");if(xe=ue[xe.toLowerCase()],!xe||!xe.href){var we=ye[0].charAt(0);return{type:"text",raw:we,text:we}}var ke=pe(ye,xe,ye[0]);return ke}},ve.strong=function(le,ue,ye){ye===void 0&&(ye="");var xe=this.rules.inline.strong.start.exec(le);if(xe&&(!xe[1]||xe[1]&&(ye===""||this.rules.inline.punctuation.exec(ye)))){ue=ue.slice(-1*le.length);var we=xe[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;we.lastIndex=0;for(var ke;(xe=we.exec(ue))!=null;)if(ke=this.rules.inline.strong.middle.exec(ue.slice(0,xe.index+3)),ke)return{type:"strong",raw:le.slice(0,ke[0].length),text:le.slice(2,ke[0].length-2)}}},ve.em=function(le,ue,ye){ye===void 0&&(ye="");var xe=this.rules.inline.em.start.exec(le);if(xe&&(!xe[1]||xe[1]&&(ye===""||this.rules.inline.punctuation.exec(ye)))){ue=ue.slice(-1*le.length);var we=xe[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;we.lastIndex=0;for(var ke;(xe=we.exec(ue))!=null;)if(ke=this.rules.inline.em.middle.exec(ue.slice(0,xe.index+2)),ke)return{type:"em",raw:le.slice(0,ke[0].length),text:le.slice(1,ke[0].length-1)}}},ve.codespan=function(le){var ue=this.rules.inline.code.exec(le);if(ue){var ye=ue[2].replace(/\n/g," "),xe=/[^ ]/.test(ye),we=ye.startsWith(" ")&&ye.endsWith(" ");return xe&&we&&(ye=ye.substring(1,ye.length-1)),ye=J(ye,!0),{type:"codespan",raw:ue[0],text:ye}}},ve.br=function(le){var ue=this.rules.inline.br.exec(le);if(ue)return{type:"br",raw:ue[0]}},ve.del=function(le){var ue=this.rules.inline.del.exec(le);if(ue)return{type:"del",raw:ue[0],text:ue[1]}},ve.autolink=function(le,ue){var ye=this.rules.inline.autolink.exec(le);if(ye){var xe,we;return ye[2]==="@"?(xe=J(this.options.mangle?ue(ye[1]):ye[1]),we="mailto:"+xe):(xe=J(ye[1]),we=xe),{type:"link",raw:ye[0],text:xe,href:we,tokens:[{type:"text",raw:xe,text:xe}]}}},ve.url=function(le,ue){var ye;if(ye=this.rules.inline.url.exec(le)){var xe,we;if(ye[2]==="@")xe=J(this.options.mangle?ue(ye[0]):ye[0]),we="mailto:"+xe;else{var ke;do ke=ye[0],ye[0]=this.rules.inline._backpedal.exec(ye[0])[0];while(ke!==ye[0]);xe=J(ye[0]),ye[1]==="www."?we="http://"+xe:we=xe}return{type:"link",raw:ye[0],text:xe,href:we,tokens:[{type:"text",raw:xe,text:xe}]}}},ve.inlineText=function(le,ue,ye){var xe=this.rules.inline.text.exec(le);if(xe){var we;return ue?we=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(xe[0]):J(xe[0]):xe[0]:we=J(this.options.smartypants?ye(xe[0]):xe[0]),{type:"text",raw:xe[0],text:we}}},be}(),he=H.noopTest,re=H.edit,fe=H.merge,ae={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:he,table:he,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ae._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ae._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ae.def=re(ae.def).replace("label",ae._label).replace("title",ae._title).getRegex(),ae.bullet=/(?:[*+-]|\d{1,9}[.)])/,ae.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ae.item=re(ae.item,"gm").replace(/bull/g,ae.bullet).getRegex(),ae.list=re(ae.list).replace(/bull/g,ae.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ae.def.source+")").getRegex(),ae._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",ae._comment=/<!--(?!-?>)[\s\S]*?-->/,ae.html=re(ae.html,"i").replace("comment",ae._comment).replace("tag",ae._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ae.paragraph=re(ae._paragraph).replace("hr",ae.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",ae._tag).getRegex(),ae.blockquote=re(ae.blockquote).replace("paragraph",ae.paragraph).getRegex(),ae.normal=fe({},ae),ae.gfm=fe({},ae.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*|$)"}),ae.gfm.nptable=re(ae.gfm.nptable).replace("hr",ae.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",ae._tag).getRegex(),ae.gfm.table=re(ae.gfm.table).replace("hr",ae.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",ae._tag).getRegex(),ae.pedantic=fe({},ae.normal,{html:re(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ae._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:he,paragraph:re(ae.normal._paragraph).replace("hr",ae.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ae.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var oe={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:he,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:he,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};oe._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",oe.punctuation=re(oe.punctuation).replace(/punctuation/g,oe._punctuation).getRegex(),oe._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",oe._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",oe.em.start=re(oe.em.start).replace(/punctuation/g,oe._punctuation).getRegex(),oe.em.middle=re(oe.em.middle).replace(/punctuation/g,oe._punctuation).replace(/overlapSkip/g,oe._overlapSkip).getRegex(),oe.em.endAst=re(oe.em.endAst,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.em.endUnd=re(oe.em.endUnd,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.strong.start=re(oe.strong.start).replace(/punctuation/g,oe._punctuation).getRegex(),oe.strong.middle=re(oe.strong.middle).replace(/punctuation/g,oe._punctuation).replace(/blockSkip/g,oe._blockSkip).getRegex(),oe.strong.endAst=re(oe.strong.endAst,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.strong.endUnd=re(oe.strong.endUnd,"g").replace(/punctuation/g,oe._punctuation).getRegex(),oe.blockSkip=re(oe._blockSkip,"g").getRegex(),oe.overlapSkip=re(oe._overlapSkip,"g").getRegex(),oe._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,oe._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,oe._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])?)+(?![-_])/,oe.autolink=re(oe.autolink).replace("scheme",oe._scheme).replace("email",oe._email).getRegex(),oe._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,oe.tag=re(oe.tag).replace("comment",ae._comment).replace("attribute",oe._attribute).getRegex(),oe._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,oe._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,oe._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,oe.link=re(oe.link).replace("label",oe._label).replace("href",oe._href).replace("title",oe._title).getRegex(),oe.reflink=re(oe.reflink).replace("label",oe._label).getRegex(),oe.reflinkSearch=re(oe.reflinkSearch,"g").replace("reflink",oe.reflink).replace("nolink",oe.nolink).getRegex(),oe.normal=fe({},oe),oe.pedantic=fe({},oe.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:re(/^!?\[(label)\]\((.*?)\)/).replace("label",oe._label).getRegex(),reflink:re(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",oe._label).getRegex()}),oe.gfm=fe({},oe.normal,{escape:re(oe.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),oe.gfm.url=re(oe.gfm.url,"i").replace("email",oe.gfm._extended_email).getRegex(),oe.breaks=fe({},oe.gfm,{br:re(oe.br).replace("{2,}","*").getRegex(),text:re(oe.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Z={block:ae,inline:oe},ne=G.defaults,se=Z.block,me=Z.inline;function Se(be){return be.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(be){var ve="",ge,le,ue=be.length;for(ge=0;ge<ue;ge++)le=be.charCodeAt(ge),Math.random()>.5&&(le="x"+le.toString(16)),ve+="&#"+le+";";return ve}var Le=function(){function be(ge){this.tokens=[],this.tokens.links=Object.create(null),this.options=ge||ne,this.options.tokenizer=this.options.tokenizer||new Te,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var le={block:se.normal,inline:me.normal};this.options.pedantic?(le.block=se.pedantic,le.inline=me.pedantic):this.options.gfm&&(le.block=se.gfm,this.options.breaks?le.inline=me.breaks:le.inline=me.gfm),this.tokenizer.rules=le}be.lex=function(le,ue){var ye=new be(ue);return ye.lex(le)};var ve=be.prototype;return ve.lex=function(le){return le=le.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(le,this.tokens,!0),this.inline(this.tokens),this.tokens},ve.blockTokens=function(le,ue,ye){ue===void 0&&(ue=[]),ye===void 0&&(ye=!0),le=le.replace(/^ +$/gm,"");for(var xe,we,ke,We;le;){if(xe=this.tokenizer.space(le)){le=le.substring(xe.raw.length),xe.type&&ue.push(xe);continue}if(xe=this.tokenizer.code(le,ue)){le=le.substring(xe.raw.length),xe.type?ue.push(xe):(We=ue[ue.length-1],We.raw+=`
|
|
`+xe.raw,We.text+=`
|
|
`+xe.text);continue}if(xe=this.tokenizer.fences(le)){le=le.substring(xe.raw.length),ue.push(xe);continue}if(xe=this.tokenizer.heading(le)){le=le.substring(xe.raw.length),ue.push(xe);continue}if(xe=this.tokenizer.nptable(le)){le=le.substring(xe.raw.length),ue.push(xe);continue}if(xe=this.tokenizer.hr(le)){le=le.substring(xe.raw.length),ue.push(xe);continue}if(xe=this.tokenizer.blockquote(le)){le=le.substring(xe.raw.length),xe.tokens=this.blockTokens(xe.text,[],ye),ue.push(xe);continue}if(xe=this.tokenizer.list(le)){for(le=le.substring(xe.raw.length),ke=xe.items.length,we=0;we<ke;we++)xe.items[we].tokens=this.blockTokens(xe.items[we].text,[],!1);ue.push(xe);continue}if(xe=this.tokenizer.html(le)){le=le.substring(xe.raw.length),ue.push(xe);continue}if(ye&&(xe=this.tokenizer.def(le))){le=le.substring(xe.raw.length),this.tokens.links[xe.tag]||(this.tokens.links[xe.tag]={href:xe.href,title:xe.title});continue}if(xe=this.tokenizer.table(le)){le=le.substring(xe.raw.length),ue.push(xe);continue}if(xe=this.tokenizer.lheading(le)){le=le.substring(xe.raw.length),ue.push(xe);continue}if(ye&&(xe=this.tokenizer.paragraph(le))){le=le.substring(xe.raw.length),ue.push(xe);continue}if(xe=this.tokenizer.text(le,ue)){le=le.substring(xe.raw.length),xe.type?ue.push(xe):(We=ue[ue.length-1],We.raw+=`
|
|
`+xe.raw,We.text+=`
|
|
`+xe.text);continue}if(le){var Je="Infinite loop on byte: "+le.charCodeAt(0);if(this.options.silent){console.error(Je);break}else throw new Error(Je)}}return ue},ve.inline=function(le){var ue,ye,xe,we,ke,We,Je=le.length;for(ue=0;ue<Je;ue++){We=le[ue];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:[]},we=We.header.length,ye=0;ye<we;ye++)We.tokens.header[ye]=[],this.inlineTokens(We.header[ye],We.tokens.header[ye]);for(we=We.cells.length,ye=0;ye<we;ye++)for(ke=We.cells[ye],We.tokens.cells[ye]=[],xe=0;xe<ke.length;xe++)We.tokens.cells[ye][xe]=[],this.inlineTokens(ke[xe],We.tokens.cells[ye][xe]);break}case"blockquote":{this.inline(We.tokens);break}case"list":{for(we=We.items.length,ye=0;ye<we;ye++)this.inline(We.items[ye].tokens);break}}}return le},ve.inlineTokens=function(le,ue,ye,xe,we){ue===void 0&&(ue=[]),ye===void 0&&(ye=!1),xe===void 0&&(xe=!1),we===void 0&&(we="");var ke,We=le,Je;if(this.tokens.links){var Qe=Object.keys(this.tokens.links);if(Qe.length>0)for(;(Je=this.tokenizer.rules.inline.reflinkSearch.exec(We))!=null;)Qe.includes(Je[0].slice(Je[0].lastIndexOf("[")+1,-1))&&(We=We.slice(0,Je.index)+"["+"a".repeat(Je[0].length-2)+"]"+We.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Je=this.tokenizer.rules.inline.blockSkip.exec(We))!=null;)We=We.slice(0,Je.index)+"["+"a".repeat(Je[0].length-2)+"]"+We.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;le;){if(ke=this.tokenizer.escape(le)){le=le.substring(ke.raw.length),ue.push(ke);continue}if(ke=this.tokenizer.tag(le,ye,xe)){le=le.substring(ke.raw.length),ye=ke.inLink,xe=ke.inRawBlock,ue.push(ke);continue}if(ke=this.tokenizer.link(le)){le=le.substring(ke.raw.length),ke.type==="link"&&(ke.tokens=this.inlineTokens(ke.text,[],!0,xe)),ue.push(ke);continue}if(ke=this.tokenizer.reflink(le,this.tokens.links)){le=le.substring(ke.raw.length),ke.type==="link"&&(ke.tokens=this.inlineTokens(ke.text,[],!0,xe)),ue.push(ke);continue}if(ke=this.tokenizer.strong(le,We,we)){le=le.substring(ke.raw.length),ke.tokens=this.inlineTokens(ke.text,[],ye,xe),ue.push(ke);continue}if(ke=this.tokenizer.em(le,We,we)){le=le.substring(ke.raw.length),ke.tokens=this.inlineTokens(ke.text,[],ye,xe),ue.push(ke);continue}if(ke=this.tokenizer.codespan(le)){le=le.substring(ke.raw.length),ue.push(ke);continue}if(ke=this.tokenizer.br(le)){le=le.substring(ke.raw.length),ue.push(ke);continue}if(ke=this.tokenizer.del(le)){le=le.substring(ke.raw.length),ke.tokens=this.inlineTokens(ke.text,[],ye,xe),ue.push(ke);continue}if(ke=this.tokenizer.autolink(le,Ee)){le=le.substring(ke.raw.length),ue.push(ke);continue}if(!ye&&(ke=this.tokenizer.url(le,Ee))){le=le.substring(ke.raw.length),ue.push(ke);continue}if(ke=this.tokenizer.inlineText(le,xe,Se)){le=le.substring(ke.raw.length),we=ke.raw.slice(-1),ue.push(ke);continue}if(le){var Ze="Infinite loop on byte: "+le.charCodeAt(0);if(this.options.silent){console.error(Ze);break}else throw new Error(Ze)}}return ue},Y(be,null,[{key:"rules",get:function(){return{block:se,inline:me}}}]),be}(),Pe=G.defaults,Be=H.cleanUrl,He=H.escape,Ge=function(){function be(ge){this.options=ge||Pe}var ve=be.prototype;return ve.code=function(le,ue,ye){var xe=(ue||"").match(/\S*/)[0];if(this.options.highlight){var we=this.options.highlight(le,xe);we!=null&&we!==le&&(ye=!0,le=we)}return xe?'<pre><code class="'+this.options.langPrefix+He(xe,!0)+'">'+(ye?le:He(le,!0))+`</code></pre>
|
|
`:"<pre><code>"+(ye?le:He(le,!0))+`</code></pre>
|
|
`},ve.blockquote=function(le){return`<blockquote>
|
|
`+le+`</blockquote>
|
|
`},ve.html=function(le){return le},ve.heading=function(le,ue,ye,xe){return this.options.headerIds?"<h"+ue+' id="'+this.options.headerPrefix+xe.slug(ye)+'">'+le+"</h"+ue+`>
|
|
`:"<h"+ue+">"+le+"</h"+ue+`>
|
|
`},ve.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},ve.list=function(le,ue,ye){var xe=ue?"ol":"ul",we=ue&&ye!==1?' start="'+ye+'"':"";return"<"+xe+we+`>
|
|
`+le+"</"+xe+`>
|
|
`},ve.listitem=function(le){return"<li>"+le+`</li>
|
|
`},ve.checkbox=function(le){return"<input "+(le?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ve.paragraph=function(le){return"<p>"+le+`</p>
|
|
`},ve.table=function(le,ue){return ue&&(ue="<tbody>"+ue+"</tbody>"),`<table>
|
|
<thead>
|
|
`+le+`</thead>
|
|
`+ue+`</table>
|
|
`},ve.tablerow=function(le){return`<tr>
|
|
`+le+`</tr>
|
|
`},ve.tablecell=function(le,ue){var ye=ue.header?"th":"td",xe=ue.align?"<"+ye+' align="'+ue.align+'">':"<"+ye+">";return xe+le+"</"+ye+`>
|
|
`},ve.strong=function(le){return"<strong>"+le+"</strong>"},ve.em=function(le){return"<em>"+le+"</em>"},ve.codespan=function(le){return"<code>"+le+"</code>"},ve.br=function(){return this.options.xhtml?"<br/>":"<br>"},ve.del=function(le){return"<del>"+le+"</del>"},ve.link=function(le,ue,ye){if(le=Be(this.options.sanitize,this.options.baseUrl,le),le===null)return ye;var xe='<a href="'+He(le)+'"';return ue&&(xe+=' title="'+ue+'"'),xe+=">"+ye+"</a>",xe},ve.image=function(le,ue,ye){if(le=Be(this.options.sanitize,this.options.baseUrl,le),le===null)return ye;var xe='<img src="'+le+'" alt="'+ye+'"';return ue&&(xe+=' title="'+ue+'"'),xe+=this.options.xhtml?"/>":">",xe},ve.text=function(le){return le},be}(),Ue=function(){function be(){}var ve=be.prototype;return ve.strong=function(le){return le},ve.em=function(le){return le},ve.codespan=function(le){return le},ve.del=function(le){return le},ve.html=function(le){return le},ve.text=function(le){return le},ve.link=function(le,ue,ye){return""+ye},ve.image=function(le,ue,ye){return""+ye},ve.br=function(){return""},be}(),tt=function(){function be(){this.seen={}}var ve=be.prototype;return ve.slug=function(le){var ue=le.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ue)){var ye=ue;do this.seen[ye]++,ue=ye+"-"+this.seen[ye];while(this.seen.hasOwnProperty(ue))}return this.seen[ue]=0,ue},be}(),nt=G.defaults,ot=H.unescape,st=function(){function be(ge){this.options=ge||nt,this.options.renderer=this.options.renderer||new Ge,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ue,this.slugger=new tt}be.parse=function(le,ue){var ye=new be(ue);return ye.parse(le)};var ve=be.prototype;return ve.parse=function(le,ue){ue===void 0&&(ue=!0);var ye="",xe,we,ke,We,Je,Qe,Ze,bt,yt,lt,wt,xt,Ct,Mt,Ot,Lt,gt,je,rt=le.length;for(xe=0;xe<rt;xe++){lt=le[xe];switch(lt.type){case"space":continue;case"hr":{ye+=this.renderer.hr();continue}case"heading":{ye+=this.renderer.heading(this.parseInline(lt.tokens),lt.depth,ot(this.parseInline(lt.tokens,this.textRenderer)),this.slugger);continue}case"code":{ye+=this.renderer.code(lt.text,lt.lang,lt.escaped);continue}case"table":{for(bt="",Ze="",We=lt.header.length,we=0;we<We;we++)Ze+=this.renderer.tablecell(this.parseInline(lt.tokens.header[we]),{header:!0,align:lt.align[we]});for(bt+=this.renderer.tablerow(Ze),yt="",We=lt.cells.length,we=0;we<We;we++){for(Qe=lt.tokens.cells[we],Ze="",Je=Qe.length,ke=0;ke<Je;ke++)Ze+=this.renderer.tablecell(this.parseInline(Qe[ke]),{header:!1,align:lt.align[ke]});yt+=this.renderer.tablerow(Ze)}ye+=this.renderer.table(bt,yt);continue}case"blockquote":{yt=this.parse(lt.tokens),ye+=this.renderer.blockquote(yt);continue}case"list":{for(wt=lt.ordered,xt=lt.start,Ct=lt.loose,We=lt.items.length,yt="",we=0;we<We;we++)Ot=lt.items[we],Lt=Ot.checked,gt=Ot.task,Mt="",Ot.task&&(je=this.renderer.checkbox(Lt),Ct?Ot.tokens.length>0&&Ot.tokens[0].type==="text"?(Ot.tokens[0].text=je+" "+Ot.tokens[0].text,Ot.tokens[0].tokens&&Ot.tokens[0].tokens.length>0&&Ot.tokens[0].tokens[0].type==="text"&&(Ot.tokens[0].tokens[0].text=je+" "+Ot.tokens[0].tokens[0].text)):Ot.tokens.unshift({type:"text",text:je}):Mt+=je),Mt+=this.parse(Ot.tokens,Ct),yt+=this.renderer.listitem(Mt,gt,Lt);ye+=this.renderer.list(yt,wt,xt);continue}case"html":{ye+=this.renderer.html(lt.text);continue}case"paragraph":{ye+=this.renderer.paragraph(this.parseInline(lt.tokens));continue}case"text":{for(yt=lt.tokens?this.parseInline(lt.tokens):lt.text;xe+1<rt&&le[xe+1].type==="text";)lt=le[++xe],yt+=`
|
|
`+(lt.tokens?this.parseInline(lt.tokens):lt.text);ye+=ue?this.renderer.paragraph(yt):yt;continue}default:{var it='Token with "'+lt.type+'" type was not found.';if(this.options.silent){console.error(it);return}else throw new Error(it)}}}return ye},ve.parseInline=function(le,ue){ue=ue||this.renderer;var ye="",xe,we,ke=le.length;for(xe=0;xe<ke;xe++){we=le[xe];switch(we.type){case"escape":{ye+=ue.text(we.text);break}case"html":{ye+=ue.html(we.text);break}case"link":{ye+=ue.link(we.href,we.title,this.parseInline(we.tokens,ue));break}case"image":{ye+=ue.image(we.href,we.title,we.text);break}case"strong":{ye+=ue.strong(this.parseInline(we.tokens,ue));break}case"em":{ye+=ue.em(this.parseInline(we.tokens,ue));break}case"codespan":{ye+=ue.codespan(we.text);break}case"br":{ye+=ue.br();break}case"del":{ye+=ue.del(this.parseInline(we.tokens,ue));break}case"text":{ye+=ue.text(we.text);break}default:{var We='Token with "'+we.type+'" type was not found.';if(this.options.silent){console.error(We);return}else throw new Error(We)}}}return ye},be}(),mt=H.merge,ht=H.checkSanitizeDeprecation,Ie=H.escape,Re=G.getDefaults,ze=G.changeDefaults,Ve=G.defaults;function De(be,ve,ge){if(typeof be=="undefined"||be===null)throw new Error("marked(): input parameter is undefined or null");if(typeof be!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(be)+", string expected");if(typeof ve=="function"&&(ge=ve,ve=null),ve=mt({},De.defaults,ve||{}),ht(ve),ge){var le=ve.highlight,ue;try{ue=Le.lex(be,ve)}catch(ke){return ge(ke)}var ye=function(We){var Je;if(!We)try{Je=st.parse(ue,ve)}catch(Qe){We=Qe}return ve.highlight=le,We?ge(We):ge(null,Je)};if(!le||le.length<3)return ye();if(delete ve.highlight,!ue.length)return ye();var xe=0;De.walkTokens(ue,function(ke){ke.type==="code"&&(xe++,setTimeout(function(){le(ke.text,ke.lang,function(We,Je){if(We)return ye(We);Je!=null&&Je!==ke.text&&(ke.text=Je,ke.escaped=!0),xe--,xe===0&&ye()})},0))}),xe===0&&ye();return}try{var we=Le.lex(be,ve);return ve.walkTokens&&De.walkTokens(we,ve.walkTokens),st.parse(we,ve)}catch(ke){if(ke.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,ve.silent)return"<p>An error occurred:</p><pre>"+Ie(ke.message+"",!0)+"</pre>";throw ke}}De.options=De.setOptions=function(be){return mt(De.defaults,be),ze(De.defaults),De},De.getDefaults=Re,De.defaults=Ve,De.use=function(be){var ve=mt({},be);if(be.renderer&&function(){var le=De.defaults.renderer||new Ge,ue=function(we){var ke=le[we];le[we]=function(){for(var We=arguments.length,Je=new Array(We),Qe=0;Qe<We;Qe++)Je[Qe]=arguments[Qe];var Ze=be.renderer[we].apply(le,Je);return Ze===!1&&(Ze=ke.apply(le,Je)),Ze}};for(var ye in be.renderer)ue(ye);ve.renderer=le}(),be.tokenizer&&function(){var le=De.defaults.tokenizer||new Te,ue=function(we){var ke=le[we];le[we]=function(){for(var We=arguments.length,Je=new Array(We),Qe=0;Qe<We;Qe++)Je[Qe]=arguments[Qe];var Ze=be.tokenizer[we].apply(le,Je);return Ze===!1&&(Ze=ke.apply(le,Je)),Ze}};for(var ye in be.tokenizer)ue(ye);ve.tokenizer=le}(),be.walkTokens){var ge=De.defaults.walkTokens;ve.walkTokens=function(le){be.walkTokens(le),ge&&ge(le)}}De.setOptions(ve)},De.walkTokens=function(be,ve){for(var ge=F(be),le;!(le=ge()).done;){var ue=le.value;ve(ue);switch(ue.type){case"table":{for(var ye=F(ue.tokens.header),xe;!(xe=ye()).done;){var we=xe.value;De.walkTokens(we,ve)}for(var ke=F(ue.tokens.cells),We;!(We=ke()).done;)for(var Je=We.value,Qe=F(Je),Ze;!(Ze=Qe()).done;){var bt=Ze.value;De.walkTokens(bt,ve)}break}case"list":{De.walkTokens(ue.items,ve);break}default:ue.tokens&&De.walkTokens(ue.tokens,ve)}}},De.Parser=st,De.parser=st.parse,De.Renderer=Ge,De.TextRenderer=Ue,De.Lexer=Le,De.lexer=Le.lex,De.Tokenizer=Te,De.Slugger=tt,De.parse=De;var Me=De;return Me})},ELLl:function(ut,Ke,$){(function(ce){ce($("VrN/"))})(function(ce){var Y={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},N=ce.Pos;ce.defineOption("autoCloseBrackets",!1,function(r,c,s){s&&s!=ce.Init&&(r.removeKeyMap(F),r.state.closeBrackets=null),c&&(D(Q(c,"pairs")),r.state.closeBrackets=c,r.addKeyMap(F))});function Q(r,c){return c=="pairs"&&typeof r=="string"?r:typeof r=="object"&&r[c]!=null?r[c]:Y[c]}var F={Backspace:k,Enter:R};function D(r){for(var c=0;c<r.length;c++){var s=r.charAt(c),a="'"+s+"'";F[a]||(F[a]=G(s))}}D(Y.pairs+"`");function G(r){return function(c){return v(c,r)}}function B(r){var c=r.state.closeBrackets;if(!c||c.override)return c;var s=r.getModeAt(r.getCursor());return s.closeBrackets||c}function k(r){var c=B(r);if(!c||r.getOption("disableInput"))return ce.Pass;for(var s=Q(c,"pairs"),a=r.listSelections(),o=0;o<a.length;o++){if(!a[o].empty())return ce.Pass;var h=m(r,a[o].head);if(!h||s.indexOf(h)%2!=0)return ce.Pass}for(var o=a.length-1;o>=0;o--){var O=a[o].head;r.replaceRange("",N(O.line,O.ch-1),N(O.line,O.ch+1),"+delete")}}function R(r){var c=B(r),s=c&&Q(c,"explode");if(!s||r.getOption("disableInput"))return ce.Pass;for(var a=r.listSelections(),o=0;o<a.length;o++){if(!a[o].empty())return ce.Pass;var h=m(r,a[o].head);if(!h||s.indexOf(h)%2!=0)return ce.Pass}r.operation(function(){var O=r.lineSeparator()||`
|
|
`;r.replaceSelection(O+O,null),r.execCommand("goCharLeft"),a=r.listSelections();for(var w=0;w<a.length;w++){var x=a[w].head.line;r.indentLine(x,null,!0),r.indentLine(x+1,null,!0)}})}function b(r){var c=ce.cmpPos(r.anchor,r.head)>0;return{anchor:new N(r.anchor.line,r.anchor.ch+(c?-1:1)),head:new N(r.head.line,r.head.ch+(c?1:-1))}}function v(r,c){var s=B(r);if(!s||r.getOption("disableInput"))return ce.Pass;var a=Q(s,"pairs"),o=a.indexOf(c);if(o==-1)return ce.Pass;for(var h=Q(s,"closeBefore"),O=Q(s,"triples"),w=a.charAt(o+1)==c,x=r.listSelections(),A=o%2==0,S,y=0;y<x.length;y++){var _=x[y],p=_.head,d,g=r.getRange(p,N(p.line,p.ch+1));if(A&&!_.empty())d="surround";else if((w||!A)&&g==c)w&&u(r,p)?d="both":O.indexOf(c)>=0&&r.getRange(p,N(p.line,p.ch+3))==c+c+c?d="skipThree":d="skip";else if(w&&p.ch>1&&O.indexOf(c)>=0&&r.getRange(N(p.line,p.ch-2),p)==c+c){if(p.ch>2&&/\bstring/.test(r.getTokenTypeAt(N(p.line,p.ch-2))))return ce.Pass;d="addFour"}else if(w){var l=p.ch==0?" ":r.getRange(N(p.line,p.ch-1),p);if(!ce.isWordChar(g)&&l!=c&&!ce.isWordChar(l))d="both";else return ce.Pass}else if(A&&(g.length===0||/\s/.test(g)||h.indexOf(g)>-1))d="both";else return ce.Pass;if(!S)S=d;else if(S!=d)return ce.Pass}var E=o%2?a.charAt(o-1):c,U=o%2?c:a.charAt(o+1);r.operation(function(){if(S=="skip")r.execCommand("goCharRight");else if(S=="skipThree")for(var P=0;P<3;P++)r.execCommand("goCharRight");else if(S=="surround"){for(var j=r.getSelections(),P=0;P<j.length;P++)j[P]=E+j[P]+U;r.replaceSelections(j,"around"),j=r.listSelections().slice();for(var P=0;P<j.length;P++)j[P]=b(j[P]);r.setSelections(j)}else S=="both"?(r.replaceSelection(E+U,null),r.triggerElectric(E+U),r.execCommand("goCharLeft")):S=="addFour"&&(r.replaceSelection(E+E+E+E,"before"),r.execCommand("goCharRight"))})}function m(r,c){var s=r.getRange(N(c.line,c.ch-1),N(c.line,c.ch+1));return s.length==2?s:null}function u(r,c){var s=r.getTokenAt(N(c.line,c.ch+1));return/\bstring/.test(s.type)&&s.start==c.ch&&(c.ch==0||!/\bstring/.test(r.getTokenTypeAt(c)))}})},EgHG:function(ut,Ke,$){ut.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(ut,Ke,$){"use strict";var ce=$("q1tI"),Y=$.n(ce),N=$("TSYQ"),Q=$.n(N);function F(H,I){var T="cannot "+H.method+" "+H.action+" "+I.status+"'",K=new Error(T);return K.status=I.status,K.method=H.method,K.url=H.action,K}function D(H){var I=H.responseText||H.response;if(!I)return I;try{return JSON.parse(I)}catch(T){return I}}function G(H){var I=new XMLHttpRequest;H.onProgress&&I.upload&&(I.upload.onprogress=function(ie){ie.total>0&&(ie.percent=ie.loaded/ie.total*100),H.onProgress(ie)});var T=new FormData;H.data&&Object.keys(H.data).forEach(function(J){var ie=H.data[J];if(Array.isArray(ie)){ie.forEach(function(pe){T.append(J+"[]",pe)});return}T.append(J,H.data[J])}),H.file instanceof Blob?T.append(H.filename,H.file,H.file.name):T.append(H.filename,H.file),I.onerror=function(ie){H.onError(ie)},I.onload=function(){return I.status<200||I.status>=300?H.onError(F(H,I),D(I)):H.onSuccess(D(I),I)},I.open(H.method,H.action,!0),H.withCredentials&&"withCredentials"in I&&(I.withCredentials=!0);var K=H.headers||{};return K["X-Requested-With"]!==null&&I.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(K).forEach(function(J){K[J]!==null&&I.setRequestHeader(J,K[J])}),I.send(T),{abort:function(){I.abort()}}}var B=+new Date,k=0;function R(){return"rc-upload-"+B+"-"+ ++k}function b(H,I){return H.indexOf(I,H.length-I.length)!==-1}var v=function(H,I){if(H&&I){var T=Array.isArray(I)?I:I.split(","),K=H.name||"",J=H.type||"",ie=J.replace(/\/.*$/,"");return T.some(function(pe){var _e=pe.trim();return _e.charAt(0)==="."?b(K.toLowerCase(),_e.toLowerCase()):/\/\*$/.test(_e)?ie===_e.replace(/\/.*$/,""):J===_e})}return!0};function m(H,I){var T=H.createReader(),K=[];function J(){T.readEntries(function(ie){var pe=Array.prototype.slice.apply(ie);K=K.concat(pe);var _e=!pe.length;_e?I(K):J()})}J()}var u=function(I,T,K){var J=function ie(pe,_e){_e=_e||"",pe.isFile?pe.file(function(Te){K(Te)&&(pe.fullPath&&!Te.webkitRelativePath&&(Object.defineProperties(Te,{webkitRelativePath:{writable:!0}}),Te.webkitRelativePath=pe.fullPath.replace(/^\//,""),Object.defineProperties(Te,{webkitRelativePath:{writable:!1}})),T([Te]))}):pe.isDirectory&&m(pe,function(Te){Te.forEach(function(he){ie(he,""+_e+pe.name+"/")})})};I.forEach(function(ie){J(ie.webkitGetAsEntry())})},r=u,c=Object.assign||function(H){for(var I=1;I<arguments.length;I++){var T=arguments[I];for(var K in T)Object.prototype.hasOwnProperty.call(T,K)&&(H[K]=T[K])}return H},s=function(){function H(I,T){var K=[],J=!0,ie=!1,pe=void 0;try{for(var _e=I[Symbol.iterator](),Te;!(J=(Te=_e.next()).done)&&!(K.push(Te.value),T&&K.length===T);J=!0);}catch(he){ie=!0,pe=he}finally{try{!J&&_e.return&&_e.return()}finally{if(ie)throw pe}}return K}return function(I,T){if(Array.isArray(I))return I;if(Symbol.iterator in Object(I))return H(I,T);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(){function H(I,T){for(var K=0;K<T.length;K++){var J=T[K];J.enumerable=J.enumerable||!1,J.configurable=!0,"value"in J&&(J.writable=!0),Object.defineProperty(I,J.key,J)}}return function(I,T,K){return T&&H(I.prototype,T),K&&H(I,K),I}}();function o(H,I,T){return I in H?Object.defineProperty(H,I,{value:T,enumerable:!0,configurable:!0,writable:!0}):H[I]=T,H}function h(H,I){var T={};for(var K in H){if(I.indexOf(K)>=0)continue;if(!Object.prototype.hasOwnProperty.call(H,K))continue;T[K]=H[K]}return T}function O(H,I){if(!(H instanceof I))throw new TypeError("Cannot call a class as a function")}function w(H,I){if(!H)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:H}function x(H,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);H.prototype=Object.create(I&&I.prototype,{constructor:{value:H,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(H,I):H.__proto__=I)}var A=function(I){return Object.keys(I).reduce(function(T,K){return(K.substr(0,5)==="data-"||K.substr(0,5)==="aria-"||K==="role")&&(T[K]=I[K]),T},{})},S=function(H){x(I,H);function I(){var T,K,J,ie;O(this,I);for(var pe=arguments.length,_e=Array(pe),Te=0;Te<pe;Te++)_e[Te]=arguments[Te];return ie=(K=(J=w(this,(T=I.__proto__||Object.getPrototypeOf(I)).call.apply(T,[this].concat(_e))),J),J.state={uid:R()},J.reqs={},J.onChange=function(he){var re=he.target.files;J.uploadFiles(re),J.reset()},J.onClick=function(he){var re=J.fileInput;if(!re)return;var fe=J.props,ae=fe.children,oe=fe.onClick;ae&&ae.type==="button"&&(re.parentNode.focus(),re.parentNode.querySelector("button").blur()),re.click(),oe&&oe(he)},J.onKeyDown=function(he){he.key==="Enter"&&J.onClick()},J.onFileDrop=function(he){var re=J.props.multiple;if(he.preventDefault(),he.type==="dragover")return;if(J.props.directory)r(Array.prototype.slice.call(he.dataTransfer.items),J.uploadFiles,function(ae){return v(ae,J.props.accept)});else{var fe=Array.prototype.slice.call(he.dataTransfer.files).filter(function(ae){return v(ae,J.props.accept)});re===!1&&(fe=fe.slice(0,1)),J.uploadFiles(fe)}},J.uploadFiles=function(he){var re=Array.prototype.slice.call(he);re.map(function(fe){return fe.uid=R(),fe}).forEach(function(fe){J.upload(fe,re)})},J.saveFileInput=function(he){J.fileInput=he},K),w(J,ie)}return a(I,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(K,J){var ie=this,pe=this.props;if(!pe.beforeUpload)return setTimeout(function(){return ie.post(K)},0);var _e=pe.beforeUpload(K,J);_e&&_e.then?_e.then(function(Te){var he=Object.prototype.toString.call(Te);return he==="[object File]"||he==="[object Blob]"?ie.post(Te):ie.post(K)}).catch(function(Te){console.log(Te)}):_e!==!1&&setTimeout(function(){return ie.post(K)},0);return}},{key:"post",value:function(K){var J=this;if(!this._isMounted)return;var ie=this.props,pe=ie.onStart,_e=ie.onProgress,Te=ie.transformFile,he=Te===void 0?function(re){return re}:Te;new Promise(function(re){var fe=ie.action;return typeof fe=="function"&&(fe=fe(K)),re(fe)}).then(function(re){var fe=K.uid,ae=ie.customRequest||G,oe=Promise.resolve(he(K)).then(function(Z){var ne=ie.data;return typeof ne=="function"&&(ne=ne(Z)),Promise.all([Z,ne])}).catch(function(Z){console.error(Z)});oe.then(function(Z){var ne=s(Z,2),se=ne[0],me=ne[1],Se={action:re,filename:ie.name,data:me,file:se,headers:ie.headers,withCredentials:ie.withCredentials,method:ie.method||"post",onProgress:_e?function(Ee){_e(Ee,K)}:null,onSuccess:function(Le,Pe){delete J.reqs[fe],ie.onSuccess(Le,K,Pe)},onError:function(Le,Pe){delete J.reqs[fe],ie.onError(Le,Pe,K)}};pe(K),J.reqs[fe]=ae(Se)})})}},{key:"reset",value:function(){this.setState({uid:R()})}},{key:"abort",value:function(K){var J=this.reqs;if(K){var ie=K;K&&K.uid&&(ie=K.uid),J[ie]&&J[ie].abort&&J[ie].abort(),delete J[ie]}else Object.keys(J).forEach(function(pe){J[pe]&&J[pe].abort&&J[pe].abort(),delete J[pe]})}},{key:"render",value:function(){var K,J=this.props,ie=J.component,pe=J.prefixCls,_e=J.className,Te=J.disabled,he=J.id,re=J.style,fe=J.multiple,ae=J.accept,oe=J.children,Z=J.directory,ne=J.openFileDialogOnClick,se=J.onMouseEnter,me=J.onMouseLeave,Se=h(J,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),Ee=Q()((K={},o(K,pe,!0),o(K,pe+"-disabled",Te),o(K,_e,_e),K)),Le=Te?{}:{onClick:ne?this.onClick:function(){},onKeyDown:ne?this.onKeyDown:function(){},onMouseEnter:se,onMouseLeave:me,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return Y.a.createElement(ie,c({},Le,{className:Ee,role:"button",style:re}),Y.a.createElement("input",c({},A(Se),{id:he,type:"file",ref:this.saveFileInput,onClick:function(Be){return Be.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ae,directory:Z?"directory":null,webkitdirectory:Z?"webkitdirectory":null,multiple:fe,onChange:this.onChange})),oe)}}]),I}(ce.Component),y=S,_=Object.assign||function(H){for(var I=1;I<arguments.length;I++){var T=arguments[I];for(var K in T)Object.prototype.hasOwnProperty.call(T,K)&&(H[K]=T[K])}return H},p=function(){function H(I,T){for(var K=0;K<T.length;K++){var J=T[K];J.enumerable=J.enumerable||!1,J.configurable=!0,"value"in J&&(J.writable=!0),Object.defineProperty(I,J.key,J)}}return function(I,T,K){return T&&H(I.prototype,T),K&&H(I,K),I}}();function d(H,I){if(!(H instanceof I))throw new TypeError("Cannot call a class as a function")}function g(H,I){if(!H)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:H}function l(H,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);H.prototype=Object.create(I&&I.prototype,{constructor:{value:H,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(H,I):H.__proto__=I)}function E(){}var U=function(H){l(I,H);function I(){var T,K,J,ie;d(this,I);for(var pe=arguments.length,_e=Array(pe),Te=0;Te<pe;Te++)_e[Te]=arguments[Te];return ie=(K=(J=g(this,(T=I.__proto__||Object.getPrototypeOf(I)).call.apply(T,[this].concat(_e))),J),J.saveUploader=function(he){J.uploader=he},K),g(J,ie)}return p(I,[{key:"abort",value:function(K){this.uploader.abort(K)}},{key:"render",value:function(){return Y.a.createElement(y,_({},this.props,{ref:this.saveUploader}))}}]),I}(ce.Component);U.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:E,onError:E,onSuccess:E,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var P=U,j=Ke.a=P},HmJG:function(ut,Ke,$){},IBYe:function(ut,Ke,$){"use strict";function ce(Y){return null}Ke.a=ce},LdHM:function(ut,Ke,$){"use strict";$.d(Ke,"b",function(){return h}),$.d(Ke,"a",function(){return w});var ce=$("1OyB"),Y=$("vuIU"),N=$("Ji7U"),Q=$("LK+K"),F=$("q1tI"),D=$("rePB"),G=$("Ff2n"),B=$("ODXe"),k=$("4IlW"),R=$("bX4T"),b=$("YrtM"),v=$("TSYQ"),m=$.n(v),u=$("+nKL"),r=$("8OUc"),c=function(K,J){var ie=K.prefixCls,pe=K.id,_e=K.flattenOptions,Te=K.childrenAsData,he=K.values,re=K.searchValue,fe=K.multiple,ae=K.defaultActiveFirstOption,oe=K.height,Z=K.itemHeight,ne=K.notFoundContent,se=K.open,me=K.menuItemSelectedIcon,Se=K.virtual,Ee=K.onSelect,Le=K.onToggleOpen,Pe=K.onActiveValue,Be=K.onScroll,He=K.onMouseEnter,Ge="".concat(ie,"-item"),Ue=Object(b.a)(function(){return _e},[se,_e],function(Me,be){return be[0]&&Me[1]!==be[1]}),tt=F.useRef(null),nt=function(be){be.preventDefault()},ot=function(be){tt.current&&tt.current.scrollTo({index:be})},st=function(be){for(var ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ge=Ue.length,le=0;le<ge;le+=1){var ue=(be+le*ve+ge)%ge,ye=Ue[ue],xe=ye.group,we=ye.data;if(!xe&&!we.disabled)return ue}return-1},mt=F.useState(function(){return st(0)}),ht=Object(B.a)(mt,2),Ie=ht[0],Re=ht[1],ze=function(be){Re(be);var ve=Ue[be];if(!ve){Pe(null,-1);return}Pe(ve.data.value,be)};F.useEffect(function(){ze(ae!==!1?st(0):-1)},[Ue.length,re]),F.useEffect(function(){var Me=setTimeout(function(){if(!fe&&se&&he.size===1){var be=Array.from(he)[0],ve=Ue.findIndex(function(ge){var le=ge.data;return le.value===be});ze(ve),ot(ve)}});return function(){return clearTimeout(Me)}},[se]);var Ve=function(be){be!==void 0&&Ee(be,{selected:!he.has(be)}),fe||Le(!1)};if(F.useImperativeHandle(J,function(){return{onKeyDown:function(be){var ve=be.which;switch(ve){case k.a.UP:case k.a.DOWN:{var ge=0;if(ve===k.a.UP?ge=-1:ve===k.a.DOWN&&(ge=1),ge!==0){var le=st(Ie+ge,ge);ot(le),ze(le)}break}case k.a.ENTER:{var ue=Ue[Ie];ue&&!ue.data.disabled?Ve(ue.data.value):Ve(void 0),se&&be.preventDefault();break}case k.a.ESC:Le(!1)}},onKeyUp:function(){},scrollTo:function(be){ot(be)}}}),Ue.length===0)return F.createElement("div",{role:"listbox",id:"".concat(pe,"_list"),className:"".concat(Ge,"-empty"),onMouseDown:nt},ne);function De(Me){var be=Ue[Me];if(!be)return null;var ve=be.data||{},ge=ve.value,le=ve.label,ue=ve.children,ye=Object(R.a)(ve,!0),xe=Te?ue:le;return be?F.createElement("div",Object.assign({"aria-label":typeof xe=="string"?xe:null},ye,{key:Me,role:"option",id:"".concat(pe,"_list_").concat(Me),"aria-selected":he.has(ge)}),ge):null}return F.createElement(F.Fragment,null,F.createElement("div",{role:"listbox",id:"".concat(pe,"_list"),style:{height:0,width:0,overflow:"hidden"}},De(Ie-1),De(Ie),De(Ie+1)),F.createElement(u.a,{itemKey:"key",ref:tt,data:Ue,height:oe,itemHeight:Z,fullHeight:!1,onMouseDown:nt,onScroll:Be,virtual:Se,onMouseEnter:He},function(Me,be){var ve,ge=Me.group,le=Me.groupOption,ue=Me.data,ye=ue.label,xe=ue.key;if(ge)return F.createElement("div",{className:m()(Ge,"".concat(Ge,"-group"))},ye!==void 0?ye:xe);var we=ue.disabled,ke=ue.value,We=ue.title,Je=ue.children,Qe=ue.style,Ze=ue.className,bt=Object(G.a)(ue,["disabled","value","title","children","style","className"]),yt=he.has(ke),lt="".concat(Ge,"-option"),wt=m()(Ge,lt,Ze,(ve={},Object(D.a)(ve,"".concat(lt,"-grouped"),le),Object(D.a)(ve,"".concat(lt,"-active"),Ie===be&&!we),Object(D.a)(ve,"".concat(lt,"-disabled"),we),Object(D.a)(ve,"".concat(lt,"-selected"),yt),ve)),xt=Te?Je:ye,Ct=!me||typeof me=="function"||yt;return F.createElement("div",Object.assign({},bt,{"aria-selected":yt,className:wt,title:We,onMouseMove:function(){if(Ie===be||we)return;ze(be)},onClick:function(){we||Ve(ke)},style:Qe}),F.createElement("div",{className:"".concat(lt,"-content")},xt||ke),F.isValidElement(me)||yt,Ct&&F.createElement(r.a,{className:"".concat(Ge,"-option-state"),customizeIcon:me,customizeIconProps:{isSelected:yt}},yt?"\u2713":null))}))},s=F.forwardRef(c);s.displayName="OptionList";var a=s,o=function(){return null};o.isSelectOption=!0;var h=o,O=function(){return null};O.isSelectOptGroup=!0;var w=O,x=$("VTBJ"),A=$("Zm9Q");function S(T){var K=T.key,J=T.props,ie=J.children,pe=J.value,_e=Object(G.a)(J,["children","value"]);return Object(x.a)({key:K,value:pe!==void 0?pe:K,children:ie},_e)}function y(T){var K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(A.a)(T).map(function(J,ie){if(!F.isValidElement(J)||!J.type)return null;var pe=J.type.isSelectOptGroup,_e=J.key,Te=J.props,he=Te.children,re=Object(G.a)(Te,["children"]);return K||!pe?S(J):Object(x.a)(Object(x.a)({key:"__RC_SELECT_GRP__".concat(_e===null?ie:_e,"__"),label:_e},re),{},{options:y(he)})}).filter(function(J){return J})}var _=$("2Qr1"),p=$("qNPg"),d=$("U8pU"),g=$("Kwbf"),l=$("WKfj");function E(T){var K=T.mode,J=T.options,ie=T.children,pe=T.backfill,_e=T.allowClear,Te=T.placeholder,he=T.getInputElement,re=T.showSearch,fe=T.onSearch,ae=T.defaultOpen,oe=T.autoFocus,Z=T.labelInValue,ne=T.value,se=T.inputValue,me=T.optionLabelProp,Se=K==="multiple"||K==="tags",Ee=re!==void 0?re:Se||K==="combobox",Le=J||y(ie);if(Object(g.a)(K!=="tags"||Le.every(function(Ge){return!Ge.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),K==="tags"||K==="combobox"){var Pe=Le.some(function(Ge){return Ge.options?Ge.options.some(function(Ue){return typeof("value"in Ue?Ue.value:Ue.key)=="number"}):typeof("value"in Ge?Ge.value:Ge.key)=="number"});Object(g.a)(!Pe,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(g.a)(K!=="combobox"||!me,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(g.a)(K==="combobox"||!pe,"`backfill` only works with `combobox` mode."),Object(g.a)(K==="combobox"||!he,"`getInputElement` only work with `combobox` mode."),Object(g.b)(K!=="combobox"||!he||!_e||!Te,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),fe&&!Ee&&K!=="combobox"&&K!=="tags"&&Object(g.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(g.b)(!ae||oe,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ne!=null){var Be=Object(l.d)(ne);Object(g.a)(!Z||Be.every(function(Ge){return Object(d.a)(Ge)==="object"&&("key"in Ge||"value"in Ge)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(g.a)(!Se||Array.isArray(ne),"`value` should be array when `mode` is `multiple` or `tags`")}if(ie){var He=null;Object(A.a)(ie).some(function(Ge){if(!F.isValidElement(Ge)||!Ge.type)return!1;var Ue=Ge.type;if(Ue.isSelectOption)return!1;if(Ue.isSelectOptGroup){var tt=Object(A.a)(Ge.props.children).every(function(nt){return!F.isValidElement(nt)||!Ge.type||nt.type.isSelectOption?!0:(He=nt.type,!1)});return!tt}return He=Ue,!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)(se===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var U=E,P=Object(p.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:y,flattenOptions:_.d,getLabeledValue:_.e,filterOptions:_.b,isValueDisabled:_.g,findValueOption:_.c,warningProps:U,fillOptionsWithMissingValue:_.a}),j=function(T){Object(N.a)(J,T);var K=Object(Q.a)(J);function J(){var ie;return Object(ce.a)(this,J),ie=K.apply(this,arguments),ie.selectRef=F.createRef(),ie.focus=function(){ie.selectRef.current.focus()},ie.blur=function(){ie.selectRef.current.blur()},ie}return Object(Y.a)(J,[{key:"render",value:function(){return F.createElement(P,Object.assign({ref:this.selectRef},this.props))}}]),J}(F.Component);j.Option=h,j.OptGroup=w;var H=j,I=Ke.c=H},M8RZ:function(ut,Ke,$){"use strict";$.d(Ke,"a",function(){return k});var ce=$("fWQN"),Y=$("mtLc"),N=$("yKVA"),Q=$("879j"),F=$("q1tI"),D=$.n(F),G=$("i8i4"),B=$.n(G),k=function(R){Object(N.a)(v,R);var b=Object(Q.a)(v);function v(m){var u;Object(ce.a)(this,v),u=b.call(this,m);var r=window.document;return u.node=r.createElement("div"),r.body.appendChild(u.node),u}return Object(Y.a)(v,[{key:"render",value:function(){var u=this.props.children;return Object(G.createPortal)(u,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),v}(D.a.Component)},NvD2:function(ut,Ke,$){"use strict";$.d(Ke,"a",function(){return D});var ce=$("Kwbf");function Y(G,B){var k=new Set;return G.forEach(function(R){B.has(R)||k.add(R)}),k}function N(G){var B=G||{},k=B.disabled,R=B.disableCheckbox,b=B.checkable;return!!(k||R)||b===!1}function Q(G,B,k,R){for(var b=new Set(G),v=new Set,m=0;m<=k;m+=1){var u=B.get(m)||new Set;u.forEach(function(a){var o=a.key,h=a.node,O=a.children,w=O===void 0?[]:O;b.has(o)&&!R(h)&&w.filter(function(x){return!R(x.node)}).forEach(function(x){b.add(x.key)})})}for(var r=new Set,c=k;c>=0;c-=1){var s=B.get(c)||new Set;s.forEach(function(a){var o=a.parent,h=a.node;if(R(h)||!a.parent||r.has(a.parent.key))return;if(R(a.parent.node)){r.add(o.key);return}var O=!0,w=!1;(o.children||[]).filter(function(x){return!R(x.node)}).forEach(function(x){var A=x.key,S=b.has(A);O&&!S&&(O=!1),!w&&(S||v.has(A))&&(w=!0)}),O&&b.add(o.key),w&&v.add(o.key),r.add(o.key)})}return{checkedKeys:Array.from(b),halfCheckedKeys:Array.from(Y(v,b))}}function F(G,B,k,R,b){for(var v=new Set(G),m=new Set(B),u=0;u<=R;u+=1){var r=k.get(u)||new Set;r.forEach(function(o){var h=o.key,O=o.node,w=o.children,x=w===void 0?[]:w;!v.has(h)&&!m.has(h)&&!b(O)&&x.filter(function(A){return!b(A.node)}).forEach(function(A){v.delete(A.key)})})}m=new Set;for(var c=new Set,s=R;s>=0;s-=1){var a=k.get(s)||new Set;a.forEach(function(o){var h=o.parent,O=o.node;if(b(O)||!o.parent||c.has(o.parent.key))return;if(b(o.parent.node)){c.add(h.key);return}var w=!0,x=!1;(h.children||[]).filter(function(A){return!b(A.node)}).forEach(function(A){var S=A.key,y=v.has(S);w&&!y&&(w=!1),!x&&(y||m.has(S))&&(x=!0)}),w||v.delete(h.key),x&&m.add(h.key),c.add(h.key)})}return{checkedKeys:Array.from(v),halfCheckedKeys:Array.from(Y(m,v))}}function D(G,B,k,R){var b=[],v;R?v=R:v=N;var m=new Set(G.filter(function(s){var a=!!k[s];return a||b.push(s),a})),u=new Map,r=0;Object.keys(k).forEach(function(s){var a=k[s],o=a.level,h=u.get(o);h||(h=new Set,u.set(o,h)),h.add(a),r=Math.max(r,o)}),Object(ce.a)(!b.length,"Tree missing follow keys: ".concat(b.slice(0,100).map(function(s){return"'".concat(s,"'")}).join(", ")));var c;return B===!0?c=Q(m,u,r,v):c=F(m,B.halfCheckedKeys,u,r,v),c}},O2Wb:function(ut,Ke,$){ut.exports={flex:"flex___2gmSR",flex1:"flex1___3Tu1g",color666:"color666___2uyGL",error:"error___yJ86W",deleteIcon:"deleteIcon___1D2tg",addIcon:"addIcon___2VIYB"}},OZM5:function(ut,Ke,$){"use strict";$.d(Ke,"b",function(){return R}),$.d(Ke,"a",function(){return b}),$.d(Ke,"k",function(){return v}),$.d(Ke,"h",function(){return m}),$.d(Ke,"i",function(){return u}),$.d(Ke,"g",function(){return r}),$.d(Ke,"c",function(){return c}),$.d(Ke,"d",function(){return s}),$.d(Ke,"j",function(){return h}),$.d(Ke,"e",function(){return O}),$.d(Ke,"f",function(){return w});var ce=$("KQm4"),Y=$("U8pU"),N=$("Ff2n"),Q=$("q1tI"),F=$.n(Q),D=$("Kwbf"),G=$("WaYH"),B=.25,k=2;function R(x,A){var S=x.slice(),y=S.indexOf(A);return y>=0&&S.splice(y,1),S}function b(x,A){var S=x.slice();return S.indexOf(A)===-1&&S.push(A),S}function v(x){return x.split("-")}function m(x,A){return"".concat(x,"-").concat(A)}function u(x){return x&&x.type&&x.type.isTreeNode}function r(x,A){var S=[x],y=A[x];function _(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];p.forEach(function(d){var g=d.key,l=d.children;S.push(g),_(l)})}return _(y.children),S}function c(x,A){var S=x.clientY,y=A.selectHandle.getBoundingClientRect(),_=y.top,p=y.bottom,d=y.height,g=Math.max(d*B,k);return S<=_+g?-1:S>=p-g?1:0}function s(x,A){if(!x)return;var S=A.multiple;return S?x.slice():x.length?[x[0]]:x}var a=function(A){return A};function o(x,A){if(!x)return[];var S=A||{},y=S.processProps,_=y===void 0?a:y,p=Array.isArray(x)?x:[x];return p.map(function(d){var g=d.children,l=Object(N.a)(d,["children"]),E=o(g,A);return F.a.createElement(G.a,Object.assign({},_(l)),E)})}function h(x){if(!x)return null;var A;if(Array.isArray(x))A={checkedKeys:x,halfCheckedKeys:void 0};else if(Object(Y.a)(x)==="object")A={checkedKeys:x.checked||void 0,halfCheckedKeys:x.halfChecked||void 0};else return Object(D.a)(!1,"`checkedKeys` is not an array or an object"),null;return A}function O(x,A){var S=new Set;function y(_){if(S.has(_))return;var p=A[_];if(!p)return;S.add(_);var d=p.parent,g=p.node;if(g.disabled)return;d&&y(d.key)}return(x||[]).forEach(function(_){y(_)}),Object(ce.a)(S)}function w(x){var A={};return Object.keys(x).forEach(function(S){(S.startsWith("data-")||S.startsWith("aria-"))&&(A[S]=x[S])}),A}},Ot1p:function(ut,Ke,$){"use strict";var ce=$("2qtc"),Y=$("kLXV"),N=$("rAM+"),Q=$("miYZ"),F=$("tsqr"),D=$("9og8"),G=$("tJVT"),B=$("jrin"),k=$("WmNS"),R=$.n(k),b=$("q1tI"),v=$.n(b),m=$("VrN/"),u=$.n(m),r=$("bdgK"),c=$("p77/"),s=$("Bd2K"),a=$("ELLl"),o=$("19Vz"),h=$("lZu9"),O=$("+NIl"),w=$("kSUc"),x=$("9Bee"),A=function(we){var ke=we.value,We=ke===void 0?"":ke,Je=we.className,Qe=we.showTextOnly,Ze=we.showLines,bt=we.style,yt=bt===void 0?{}:bt,lt=Object(b.useMemo)(function(){return""},[We]);return v.a.createElement(v.a.Fragment,null,v.a.createElement("div",{dangerouslySetInnerHTML:{__html:lt}}))},S=$("0Owb"),y=$("dejd"),_=$("C+DQ"),p=$("1vsH"),d=$("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 ke=we.onActionCallback,We=we.title,Je=we.icon,Qe=we.actionName,Ze=we.className,bt=Ze===void 0?"":Ze,yt=we.children;function lt(){ke(Qe)}return v.a.createElement("a",{title:We,className:bt,onClick:lt},v.a.createElement("i",{className:"md-iconfont ".concat(Je)}),yt)}var E=function(we){var ke=we.watch,We=we.showNullButton,Je=we.onActionCallback,Qe=we.fullScreen,Ze=we.insertTemp,bt=we.hidetoolBar,yt=we.uuid,lt=we.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(p.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(p.F)("_educoder_session"),"&key=").concat(yt,"&api=").concat(encodeURIComponent(d.a.PROXY_SERVER)));var wt=[].concat(g,[{title:"".concat(ke?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(ke?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return v.a.createElement("ul",{className:"markdown-toolbar-container"},!bt&&wt.map(function(xt,Ct){return v.a.createElement("li",{key:Ct},xt.actionName?v.a.createElement(l,Object(S.a)({},xt,{onActionCallback:Je})):v.a.createElement("span",{className:"v-line"}))}),We?v.a.createElement("li",null,v.a.createElement(l,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Je},v.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Ze&&v.a.createElement("li",null,v.a.createElement(l,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Ze),onActionCallback:Je},v.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),v.a.createElement("li",{className:"btn-full-screen"},v.a.createElement(l,{icon:"".concat(Qe?"icon-shrink":"icon-enlarge"),title:Qe?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Je})))},U=$("M8RZ"),P=$("+L6B"),j=$("2/Rp"),H=$("y8nQ"),I=$("Vl3Y"),T=$("5NDa"),K=$("5rEg"),J={labelCol:{span:4},wrapperCol:{span:20}},ie=function(we){var ke=we.callback,We=we.onCancel;function Je(Qe){ke(Qe)}return v.a.createElement(I.a,Object(S.a)({},J,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Je}),v.a.createElement(I.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},v.a.createElement(K.a,null)),v.a.createElement(I.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},v.a.createElement(K.a,null)),v.a.createElement("div",{className:"flex-container flex-end"},v.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(j.a,{type:"ghost",onClick:We},"\u53D6\u6D88")))},pe=$("7ahc"),_e=$("HmJG"),Te=$("BjJ7"),he=I.a.useForm,re={width:280,marginRight:10},fe={labelCol:{span:5},wrapperCol:{span:19}},ae=function(we){var ke=we.callback,We=we.onCancel,Je=he(),Qe=Object(G.a)(Je,1),Ze=Qe[0];function bt(wt){ke(wt)}function yt(wt,xt){if(wt.status===-1){F.b.error(wt.message);return}Ze.setFieldsValue({src:"/api/attachments/".concat(wt.id),type:xt.type})}function lt(wt){var xt=wt.target.files[0];Z(xt,yt)}return v.a.createElement(I.a,Object(S.a)({form:Ze},fe,{className:"upload-image-panel",onFinish:bt}),v.a.createElement(I.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},v.a.createElement("div",{className:"flex-container"},v.a.createElement(I.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},v.a.createElement(K.a,{style:re})),v.a.createElement(oe,{onFileChange:lt}))),v.a.createElement(I.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},v.a.createElement(K.a,{style:{width:264}})),v.a.createElement(I.a.Item,{style:{textAlign:"right"}},v.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(j.a,{type:"ghost",onClick:We},"\u53D6\u6D88")))};function oe(we){var ke=we.onFileChange;return v.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",v.a.createElement("input",{type:"file",onChange:ke}))}function Z(we,ke){if(!we)throw new String("\u6CA1\u6709\u6587\u4EF6");var We=new FormData;We.append("editormd-image-file",we),We.append("file_param_name","editormd-image-file"),We.append("byxhr","true");var Je=new window.XMLHttpRequest;Je.withCredentials=!0,Je.addEventListener("load",function(Qe){ke(JSON.parse(Qe.target.responseText),we)},!1),Je.addEventListener("error",function(Qe){console.error(Qe)},!1),Je.open("POST","".concat(Te.a,"/api/attachments.json")),Je.send(We)}var ne=$("giR+"),se=$("fyUT"),me=$("7Kak"),Se=$("9yH6"),Ee=Se.a.Group,Le={margin:"0 8px"},Pe=function(we){var ke=we.callback,We=we.onCancel;function Je(Qe){ke(Qe)}return v.a.createElement(I.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Je},v.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},v.a.createElement("span",{style:Le},"\u5355\u5143\u683C\u6570\uFF1A"),v.a.createElement("span",{style:Le},"\u884C\u6570"),v.a.createElement(I.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},v.a.createElement(se.a,null)),v.a.createElement("span",{style:Le},"\u5217\u6570"),v.a.createElement(I.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},v.a.createElement(se.a,null))),v.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},v.a.createElement("span",{style:Le},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),v.a.createElement(I.a.Item,{name:"align"},v.a.createElement(Ee,null,v.a.createElement(Se.a,{value:"default"},v.a.createElement("i",{className:"fa fa-align-justify"})),v.a.createElement(Se.a,{value:"left"},v.a.createElement("i",{className:"fa fa-align-left"})),v.a.createElement(Se.a,{value:"center"},v.a.createElement("i",{className:"fa fa-align-center"})),v.a.createElement(Se.a,{value:"right"},v.a.createElement("i",{className:"fa fa-align-right"}))))),v.a.createElement("div",{className:"flex-container flex-end"},v.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(j.a,{type:"ghost",onClick:We},"\u53D6\u6D88")))},Be=$("ErOA"),He=$("7Cbv"),Ge="link",Ue="upload-image",tt="code-block",nt="add-table",ot="------------",st={default:ot,left:":".concat(ot),center:":".concat(ot,":"),right:"".concat(ot,":")},mt=$("9VGf"),ht,Ie;function Re(){}var ze=0,Ve=1e4,De="\u2581",Me=`
|
|
**\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 be(we){return/^\d+$/.test(we)?"".concat(we,"px"):we}var ve=navigator.platform.toUpperCase().indexOf("MAC")>=0,ge=ve?"Cmd":"Ctrl",le=["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"],ue=(ht={},Object(B.a)(ht,ge+"-B","bold"),Object(B.a)(ht,ge+"-I","italic"),ht),ye=(Ie={},Object(B.a)(Ie,Ge,"\u6DFB\u52A0\u94FE\u63A5"),Object(B.a)(Ie,tt,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(B.a)(Ie,Ue,"\u6DFB\u52A0\u6587\u4EF6"),Object(B.a)(Ie,nt,"\u6DFB\u52A0\u8868\u683C"),Ie),xe=Ke.a=function(we){var ke=we.defaultValue,We=ke===void 0?"":ke,Je=we.onChange,Qe=we.width,Ze=Qe===void 0?"100%":Qe,bt=we.height,yt=bt===void 0?400:bt,lt=we.miniToolbar,wt=lt===void 0?!1:lt,xt=we.isFocus,Ct=xt===void 0?!1:xt,Mt=we.watch,Ot=we.insertTemp,Lt=we.mode,gt=Lt===void 0?"markdown":Lt,je=we.id,rt=je===void 0?"markdown-editor-id":je,it=we.showResizeBar,et=it===void 0?!1:it,Tt=we.noStorage,kt=Tt===void 0?!1:Tt,Dt=we.showNullButton,vt=Dt===void 0?!1:Dt,dt=we.hidetoolBar,Vt=dt===void 0?!1:dt,sn=we.fullScreen,gn=sn===void 0?!1:sn,Kt=we.onBlur,vn=we.onCMBeforeChange,Mn=we.onFullScreen,Wn=we.className,$e=Wn===void 0?"":Wn,ct=we.disablePaste,Jt=ct===void 0?!1:ct,hn=we.placeholder,_n=hn===void 0?"":hn,cn=we.values,V=cn===void 0?"":cn,C=Object(b.useState)(null),L=Object(G.a)(C,2),W=L[0],te=L[1],X=Object(b.useState)(We),Oe=Object(G.a)(X,2),Ye=Oe[0],ft=Oe[1],At=Object(b.useState)(Mt),qe=Object(G.a)(At,2),Pt=qe[0],Ft=qe[1],fn=Object(b.useState)(gn),Nn=Object(G.a)(fn,2),In=Nn[0],Tn=Nn[1],ei=Object(b.useState)(""),_i=Object(G.a)(ei,2),Ht=_i[0],Bt=_i[1],Gt=Object(b.useState)(0),Yt=Object(G.a)(Gt,2),Qt=Yt[0],tn=Yt[1],bn=Object(b.useState)(yt),Dn=Object(G.a)(bn,2),Un=Dn[0],Sn=Dn[1],Fn=Object(b.useState)(!1),ti=Object(G.a)(Fn,2),Ei=ti[0],ni=ti[1],ln=Object(b.useRef)(Object(He.a)()),zt=Object(b.useRef)(!1),wn=Object(b.useRef)(),Xt=Object(b.useRef)(),nn=Object(b.useRef)(),rn=Object(b.useRef)(),ii=Object(b.useRef)(),kn=function(){var It=Object(D.a)(R.a.mark(function Wt(){var Nt,$t;return R.a.wrap(function(En){for(;;)switch(En.prev=En.next){case 0:return En.next=2,Object(Be.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:ln.current}});case 2:$t=En.sent,$t!=null&&(Nt=$t.attachments)!==null&&Nt!==void 0&&Nt.length&&(console.log("cm:",W,Xt),$t.attachments.map(function(an){an.content_type.indexOf("image")>-1?W.replaceSelection(".concat(an.content_type,")")):an.content_type.indexOf("video")>-1?W.replaceSelection('<video width="100%" controls src="'.concat(d.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):an.content_type.indexOf("pdf")>-1?W.replaceSelection('<a href="'.concat(d.a.API_SERVER,"/api/attachments/").concat(an.id,"?type=").concat(an.content_type,'&disposition=inline" target="_blank">').concat(an.name,"</a>")):W.replaceSelection("[".concat(an.name,"](").concat(d.a.API_SERVER,"/api/attachments/").concat(an.id,"?type=").concat(an.content_type,")"))}));case 4:case"end":return En.stop()}},Wt)}));return function(){return It.apply(this,arguments)}}();Object(b.useEffect)(function(){ft(V),W==null||W.setValue(V)},[V]),Object(b.useEffect)(function(){Mn==null||Mn(In)},[In]),Object(b.useEffect)(function(){if(Xt.current){var It=u.a.fromTextArea(Xt.current,{mode:gt,lineNumbers:!wt,lineWrapping:!0,value:We,autoCloseTags:!0,autoCloseBrackets:!0});Ct&&It.focus();function Wt(Nt,$t){if(Jt){$t.preventDefault();return}var on=$t.clipboardData;if(on){var En=on.types.toString(),an=on.items;if(En==="Files"||on.types.indexOf("Files")>-1){if($t.preventDefault(),gt=="stex")return;try{var Rn,$n=an[1];((Rn=an[0])===null||Rn===void 0?void 0:Rn.kind)==="file"&&($n=an[0]);var Zt=$n.getAsFile(),vi=Zt.name.split(".").pop();Z(Zt,function(pn){if(pn.id){var Kn,Gn,hi;(Zt==null||((Kn=Zt.type)===null||Kn===void 0)?void 0:Kn.indexOf("image"))>-1?It.replaceSelection(".concat(pn.content_type,")")):(Zt==null||((Gn=Zt.type)===null||Gn===void 0)?void 0:Gn.indexOf("video"))>-1?It.replaceSelection('<video width="100%" controls src="'.concat(d.a.API_SERVER,"/api/attachments/").concat(pn.id,'"></video>')):(Zt==null||((hi=Zt.type)===null||hi===void 0)?void 0:hi.indexOf("pdf"))>-1?It.replaceSelection('<a href="'.concat(d.a.API_SERVER,"/api/attachments/").concat(pn.id,"?type=").concat(Zt.type,'&disposition=inline" target="_blank">').concat(Zt.name,"</a>")):le.includes(vi)?It.replaceSelection('<a href="'.concat(d.a.API_SERVER,"/api/attachments/").concat(pn.id,'?type=office&disposition=inline" target="_blank">').concat(Zt.name,"</a>")):It.replaceSelection("[".concat(Zt.name,"](").concat(d.a.API_SERVER,"/api/attachments/").concat(pn.id,"?type=").concat(pn.content_type,")"))}else(pn==null?void 0:pn.status)===401&&(document.location.href="/user/login")})}catch(pn){F.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return It.on("paste",Wt),It.on("dragleave",function(Nt,$t){nn.current.classList.remove("mouse-hover-md")}),It.on("dragover",function(Nt,$t){nn.current.classList.add("mouse-hover-md")}),It.on("drop",function(Nt,$t){nn.current.classList.add("mouse-hover-md");var on;if(on=$t.dataTransfer.files,on.length>0){$t.preventDefault(),$t.stopPropagation();for(var En=function($n){var Zt=on[$n],vi=Zt.name.split(".").pop();Z(Zt,function(pn){if(pn.id){var Kn,Gn,hi;(Zt==null||((Kn=Zt.type)===null||Kn===void 0)?void 0:Kn.indexOf("image"))>-1?It.replaceSelection(".concat(pn.content_type,")")):(Zt==null||((Gn=Zt.type)===null||Gn===void 0)?void 0:Gn.indexOf("video"))>-1?It.replaceSelection('<video width="100%" controls src="'.concat(d.a.API_SERVER,"/api/attachments/").concat(pn.id,'"></video>')):(Zt==null||((hi=Zt.type)===null||hi===void 0)?void 0:hi.indexOf("pdf"))>-1?It.replaceSelection('<a href="'.concat(d.a.API_SERVER,"/api/attachments/").concat(pn.id,"?type=").concat(Zt.type,'&disposition=inline" target="_blank">').concat(Zt.name,"</a>")):le.includes(vi)?It.replaceSelection('<a href="'.concat(d.a.API_SERVER,"/api/attachments/").concat(pn.id,'?type=office&disposition=inline" target="_blank">').concat(Zt.name,"</a>")):It.replaceSelection("[".concat(Zt.name,"](").concat(d.a.API_SERVER,"/api/attachments/").concat(pn.id,"?type=").concat(pn.content_type,")"))}else(pn==null?void 0:pn.status)===401&&(document.location.href="/user/login")})},an=0;an<on.length;an++)En(an)}}),te(It),function(){It.off("paste",Wt)}}},[]);var en=Object(b.useCallback)(function(){if(nn.current)try{}catch(It){console.log(It,"---- to set md editor body height")}},[Un,nn,In]);Object(b.useEffect)(function(){function It(){var Nt=new r.default(function($t){var on=Object(N.a)($t),En;try{for(on.s();!(En=on.n()).done;){var an=En.value;(an.target.offsetHeight>0||an.target.offsetWidth>0)&&(en(),W.setSize("100%","100%"),W.refresh())}}catch(Rn){on.e(Rn)}finally{on.f()}});return Nt.observe(Xt.current.parentElement),Nt}if(W){var Wt=It();return function(){Wt.unobserve(Xt.current.parentElement)}}},[W,en]),Object(b.useEffect)(function(){if(W){for(var It=[],Wt=function(){var an=$t[Nt];on=Object(G.a)(an,2);var Rn=on[0],$n=on[1],Zt=Object(B.a)({},Rn,function(){xi($n)});It.push(Zt),W.addKeyMap(Zt)},Nt=0,$t=Object.entries(ue);Nt<$t.length;Nt++){var on;Wt()}return wn.current=setInterval(function(){zt.current&&kn()},4e3),function(){clearInterval(wn.current);var En=Object(N.a)(It),an;try{for(En.s();!(an=En.n()).done;){var Rn=an.value;W.removeKeyMap(Rn)}}catch($n){En.e($n)}finally{En.f()}}}},[W]),Object(b.useEffect)(function(){gn!==In&&Tn(gn)},[gn]),Object(mt.a)(function(){if(!kt&&Qt>0){var It=new Date().getTime(),Wt=window.sessionStorage.getItem(rt);It>=Qt+Ve&&(!Wt||Wt!==Ye)&&(window.sessionStorage.setItem(rt,Ye),ni(!0))}},Ve),Object(b.useEffect)(function(){Ft(Mt)},[W,Mt]),Object(b.useEffect)(function(){W&&(Ct&&W.focus())},[W,Ct]),Object(b.useEffect)(function(){if(Pt&&W){var It=W.getScrollerElement();function Wt(Nt){var $t=Nt.target;if(ii.current){var on=$t.scrollTop/$t.scrollHeight;ii.current.scrollTop=ii.current.scrollHeight*on}}return It.addEventListener("scroll",Wt),function(){It.removeEventListener("scroll",Wt)}}},[W,Pt]),Object(b.useEffect)(function(){if(W&&vn){function It(Wt,Nt){vn(Wt,Nt)}return W.on("beforeChange",It),function(){W.off("beforeChange",It)}}},[W,vn]),Object(b.useEffect)(function(){if(W&&Kt){function It(){Kt(W.getValue())}return W.on("blur",It),function(){W.off("blur",It)}}},[W,Kt]),Object(b.useEffect)(function(){if(W){function It(Wt){var Nt=Wt.getValue();ft(Nt),tn(new Date().getTime()),Wt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Je&&Je(Nt)}return W.on("change",It),function(){W.off("change",It)}}},[W,Je]),Object(b.useEffect)(function(){W&&(We==null?(W.setValue(""),ft("")):We!==W.getValue()&&(W.setValue(We),ft(We),W.setCursor(W.lineCount(),0)))},[W,We]);var xi=Object(b.useCallback)(function(It){var Wt=W.getCursor(),Nt=W.getSelection(),$t=Nt.split(`
|
|
`);switch(It){case"bold":return W.replaceSelection("**"+Nt+"**"),Nt===""&&W.setCursor(Wt.line,Wt.ch+2),W.focus();case"italic":return W.replaceSelection("*"+Nt+"*"),Nt===""&&W.setCursor(Wt.line,Wt.ch+1),W.focus();case"code":return W.replaceSelection("`"+Nt+"`"),Nt===""&&W.setCursor(Wt.line,Wt.ch+1),W.focus();case"inline-latex":return W.replaceSelection("`$$"+Nt+"$$`"),Nt===""&&W.setCursor(Wt.line,Wt.ch+3),W.focus();case"latex":return W.replaceSelection("```latex\n"+Nt+"\n```"),W.setCursor(Wt.line+1,Nt.length+1),W.focus();case"line-break":return W.replaceSelection(`<br/>
|
|
`),W.focus();case"list-ul":return Nt===""?W.replaceSelection("- "+Nt):W.replaceSelection($t.map(function(on){return on===""?"":"- ".concat(on)}).join(`
|
|
`)),W.focus();case"list-ol":return Nt===""?W.replaceSelection("1. "+Nt):W.replaceSelection($t.map(function(on,En){return on===""?"":"".concat(En+1,". ").concat(on)}).join(`
|
|
`)),W.focus();case"add-null-ch":return Nt===""&&W.setCursor(Wt.line,Wt.ch+1),W.replaceSelection(De),W.focus();case"inster-template-1":return Nt===""&&W.setCursor(Wt.line,Wt.ch),W.replaceSelection(Me),W.focus();case"eraser":return W.setValue(""),W.focus();case"trigger-watch":return Ft(!Pt),W.focus();case"trigger-full-screen":return Tn(!In),W.focus();case Ge:Bt(Ge);return;case tt:Bt(tt);return;case Ue:Bt(Ue);return;case nt:Bt(nt);return;default:throw new Error}},[W,Pt,In]),Qn=Object(b.useCallback)(function(It){Bt("");switch(Ht){case Ge:var Wt=It.title,Nt=It.link;return W.replaceSelection("[".concat(Wt,"](").concat(Nt,")")),W.focus();case tt:var $t=It.language,on=It.content;return W.replaceSelection(["```"+$t,on,"```"].join(`
|
|
`)),W.focus();case Ue:var En=It.src,an=It.alt;return an?W.replaceSelection(".concat(En,' "').concat(an,'" )')):W.replaceSelection("")),W.focus();case nt:for(var Rn=It.row,$n=It.col,Zt=It.align,vi=`
|
|
`,pn=0;pn<Rn;pn++){for(var Kn=[],Gn=[],hi=0;hi<$n;hi++)pn===1&&Gn.push(st[Zt]),Kn.push(" ");pn===1&&(vi+="| ".concat(Gn.join(" | "),` |
|
|
`)),vi+="| ".concat(Kn.join($n===1?"":" | "),` |
|
|
`)}return W.replaceSelection(vi+`
|
|
`),W.focus();default:throw new Error}},[W,Ht]),Ii=Object(b.useMemo)(function(){switch(Ht){case Ge:return v.a.createElement(ie,{callback:Qn,onCancel:wi});case tt:return v.a.createElement(pe.b,{callback:Qn,onCancel:wi});case Ue:return v.a.createElement(ae,{callback:Qn,onCancel:wi});case nt:return v.a.createElement(Pe,{callback:Qn,onCancel:wi});default:return null}},[Ht]);function wi(){Bt("")}Object(b.useEffect)(function(){if(rn.current){var It=rn.current,Wt=!1,Nt=0;function $t(an){Wt=!0,Nt=an.pageY}function on(){Wt=!1}function En(an){if(Wt){var Rn=an.pageY-Nt;Rn<0&&(Rn=0),Rn>300&&(Rn=300);var $n=yt+Rn+"px";Sn($n)}}return It.addEventListener("mousedown",$t),document.addEventListener("mousemove",En),document.addEventListener("mouseup",on),function(){It.removeEventListener("mousedown",$t),document.removeEventListener("mousemove",En),document.removeEventListener("mouseup",on)}}},[W,rn]),Object(b.useEffect)(function(){Sn(yt)},[yt]);var Ti=be(Ze),Mi=be(Un),gi={width:Ti,height:Mi},Ni=Object(b.useMemo)(function(){if(Qt){var It=new Date(Qt),Wt=It.getHours(),Nt=It.getMinutes(),$t=It.getSeconds();return Wt=Wt<10?"0"+Wt:Wt,Nt=Nt<10?"0"+Nt:Nt,$t=$t<10?"0"+$t:$t,"".concat(Wt,":").concat(Nt,":").concat($t)}return 0},[Qt]);function Ui(){window.sessionStorage.removeItem(rt),ni(!1),tn(0)}function ci(){ni(!1),tn(0),W.setValue(window.sessionStorage.getItem(rt))}function Yi(It,Wt){var Nt=W.getValue();Nt=Nt.replace(It,Wt),ft(Nt),W==null||W.setValue(Nt)}return v.a.createElement(b.Fragment,null,v.a.createElement("div",{className:"markdown-editor-wrapper",ref:nn},v.a.createElement("div",{className:"markdown-editor-container ".concat($e," ").concat(Pt?"on-preview":""," ").concat(wt?"mini":""," ").concat(In?"full-screen":""),style:gi},v.a.createElement(E,{insertTemp:Ot,watch:Pt,fullScreen:In,showNullButton:vt,onActionCallback:xi,hidetoolBar:Vt,uuid:ln.current,setOpenPhones:function(){zt.current=!0}}),v.a.createElement("div",{className:"markdown-editor-body"},v.a.createElement("div",{className:"codemirror-container"},v.a.createElement("textarea",{ref:Xt,placeholder:_n})),Pt?v.a.createElement("div",{ref:ii,className:"preview-container"},gt==="stex"&&v.a.createElement(A,{value:Ye}),gt!=="stex"&&v.a.createElement(x.a,{edit:!0,value:Ye,replaces:Yi})):null))),et?v.a.createElement("a",{ref:rn,className:"editor-resize"}):null,v.a.createElement(U.a,null,ye[Ht]?v.a.createElement(Y.a,{centered:!0,title:ye[Ht],visible:!0,onCancel:wi,footer:null,className:"markdown-popup-form"},Ii):null))}},"P/tu":function(ut,Ke,$){"use strict";var ce=$("ozfa"),Y=$("MJZm"),N=$("0Owb"),Q=$("9og8"),F=$("tJVT"),D=$("PpiC"),G=$("WmNS"),B=$.n(G),k=$("q1tI"),R=$.n(k),b=$("WCUW"),v=$("spXi"),m=$.n(v),u=function(c){var s=c.value,a=c.onChange,o=c.defaultValue,h=c.disabled,O=Object(D.a)(c,["value","onChange","defaultValue","disabled"]),w=Object(k.useState)([]),x=Object(F.a)(w,2),A=x[0],S=x[1],y=Object(k.useState)("1"),_=Object(F.a)(y,2),p=_[0],d=_[1];Object(k.useEffect)(function(){g()},[]);var g=function(){var U=Object(Q.a)(B.a.mark(function P(){var j,H;return B.a.wrap(function(T){for(;;)switch(T.prev=T.next){case 0:return T.next=2,Object(b.A)({});case 2:j=T.sent,j!=null&&j.data&&(H=[{title:R.a.createElement("div",{title:"\u6839\u76EE\u5F55",className:m.a.name},"\u6839\u76EE\u5F55"),value:0,key:0,icon:R.a.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:l(j.data||[])}],S(H),d("2"));case 4:case"end":return T.stop()}},P)}));return function(){return U.apply(this,arguments)}}(),l=function(P){function j(H){var I=H.children,T=Array.isArray(I)&&I.length>0,K=H==null?void 0:H.group_id;return{title:R.a.createElement("div",{title:H==null?void 0:H.name,className:m.a.name},H==null?void 0:H.name),value:K,key:K,icon:R.a.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:T?I==null?void 0:I.map(function(J){return j(J)}):[]}}return P==null?void 0:P.map(function(H){return j(H)})},E=o?{defaultExpandedKeys:[0]}:{selectedKeys:s,defaultExpandedKeys:s};return R.a.createElement("div",{className:m.a.customTree},R.a.createElement(Y.a,Object(N.a)({key:p},E,{showIcon:!0,treeData:A,onSelect:a,disabled:h},O)))};Ke.a=u},RxwV:function(ut,Ke,$){"use strict";var ce=$("q1tI"),Y=$("uciX"),N=$("2W6z"),Q=$.n(N),F=$("4IlW"),D=$("uK0f"),G=$.n(D);function B(re,fe){if(re===fe)return!0;if(!re||!fe)return!1;var ae=re.length;if(fe.length!==ae)return!1;for(var oe=0;oe<ae;oe++)if(re[oe]!==fe[oe])return!1;return!0}function k(re){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?k=function(ae){return typeof ae}:k=function(ae){return ae&&typeof Symbol=="function"&&ae.constructor===Symbol&&ae!==Symbol.prototype?"symbol":typeof ae},k(re)}function R(re,fe){if(!(re instanceof fe))throw new TypeError("Cannot call a class as a function")}function b(re,fe){for(var ae=0;ae<fe.length;ae++){var oe=fe[ae];oe.enumerable=oe.enumerable||!1,oe.configurable=!0,"value"in oe&&(oe.writable=!0),Object.defineProperty(re,oe.key,oe)}}function v(re,fe,ae){return fe&&b(re.prototype,fe),ae&&b(re,ae),re}function m(re,fe){if(typeof fe!="function"&&fe!==null)throw new TypeError("Super expression must either be null or a function");re.prototype=Object.create(fe&&fe.prototype,{constructor:{value:re,writable:!0,configurable:!0}}),fe&&u(re,fe)}function u(re,fe){return u=Object.setPrototypeOf||function(oe,Z){return oe.__proto__=Z,oe},u(re,fe)}function r(re){var fe=a();return function(){var ae=o(re),oe;if(fe){var Z=o(this).constructor;oe=Reflect.construct(ae,arguments,Z)}else oe=ae.apply(this,arguments);return c(this,oe)}}function c(re,fe){return fe&&(k(fe)==="object"||typeof fe=="function")?fe:s(re)}function s(re){if(re===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return re}function a(){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(re){return!1}}function o(re){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(ae){return ae.__proto__||Object.getPrototypeOf(ae)},o(re)}var h=function(){var re=function(fe){m(oe,fe);var ae=r(oe);function oe(){var Z;return R(this,oe),Z=ae.apply(this,arguments),Z.menuItems={},Z.saveMenuItem=function(ne){return function(se){Z.menuItems[ne]=se}},Z}return v(oe,[{key:"componentDidMount",value:function(){this.scrollActiveItemToView()}},{key:"componentDidUpdate",value:function(ne){!ne.visible&&this.props.visible&&this.scrollActiveItemToView()}},{key:"getFieldName",value:function(ne){var se=this.props,me=se.fieldNames,Se=se.defaultFieldNames;return me[ne]||Se[ne]}},{key:"getOption",value:function(ne,se){var me=this.props,Se=me.prefixCls,Ee=me.expandTrigger,Le=me.expandIcon,Pe=me.loadingIcon,Be=this.props.onSelect.bind(this,ne,se),He=this.props.onItemDoubleClick.bind(this,ne,se),Ge={onClick:Be,onDoubleClick:He},Ue="".concat(Se,"-menu-item"),tt=null,nt=ne[this.getFieldName("children")]&&ne[this.getFieldName("children")].length>0;(nt||ne.isLeaf===!1)&&(Ue+=" ".concat(Se,"-menu-item-expand"),ne.loading||(tt=ce.createElement("span",{className:"".concat(Se,"-menu-item-expand-icon")},Le))),Ee==="hover"&&(nt||ne.isLeaf===!1)&&(Ge={onMouseEnter:this.delayOnSelect.bind(this,Be),onMouseLeave:this.delayOnSelect.bind(this),onClick:Be}),this.isActiveOption(ne,se)&&(Ue+=" ".concat(Se,"-menu-item-active"),Ge.ref=this.saveMenuItem(se)),ne.disabled&&(Ue+=" ".concat(Se,"-menu-item-disabled"));var ot=null;ne.loading&&(Ue+=" ".concat(Se,"-menu-item-loading"),ot=Pe||null);var st="";return"title"in ne?st=ne.title:typeof ne[this.getFieldName("label")]=="string"&&(st=ne[this.getFieldName("label")]),ce.createElement("li",Object.assign({key:ne[this.getFieldName("value")],className:Ue,title:st},Ge,{role:"menuitem",onMouseDown:function(ht){return ht.preventDefault()}}),ne[this.getFieldName("label")],tt,ot)}},{key:"getActiveOptions",value:function(ne){var se=this,me=this.props.options,Se=ne||this.props.activeValue;return G()(me,function(Ee,Le){return Ee[se.getFieldName("value")]===Se[Le]},{childrenKeyName:this.getFieldName("children")})}},{key:"getShowOptions",value:function(){var ne=this,se=this.props.options,me=this.getActiveOptions().map(function(Se){return Se[ne.getFieldName("children")]}).filter(function(Se){return!!Se});return me.unshift(se),me}},{key:"delayOnSelect",value:function(ne){for(var se=this,me=arguments.length,Se=new Array(me>1?me-1:0),Ee=1;Ee<me;Ee++)Se[Ee-1]=arguments[Ee];this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null),typeof ne=="function"&&(this.delayTimer=window.setTimeout(function(){ne(Se),se.delayTimer=null},150))}},{key:"scrollActiveItemToView",value:function(){for(var ne=this.getShowOptions().length,se=0;se<ne;se++){var me=this.menuItems[se];me&&me.parentElement&&(me.parentElement.scrollTop=me.offsetTop)}}},{key:"isActiveOption",value:function(ne,se){var me=this.props.activeValue,Se=me===void 0?[]:me;return Se[se]===ne[this.getFieldName("value")]}},{key:"render",value:function(){var ne=this,se=this.props,me=se.prefixCls,Se=se.dropdownMenuColumnStyle;return ce.createElement("div",null,this.getShowOptions().map(function(Ee,Le){return ce.createElement("ul",{className:"".concat(me,"-menu"),key:Le,style:Se},Ee.map(function(Pe){return ne.getOption(Pe,Le)}))}))}}]),oe}(ce.Component);return re.defaultProps={options:[],value:[],activeValue:[],onSelect:function(){},prefixCls:"rc-cascader-menus",visible:!1,expandTrigger:"click"},re}(),O=h,w={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}}},x=w;function A(re){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?A=function(ae){return typeof ae}:A=function(ae){return ae&&typeof Symbol=="function"&&ae.constructor===Symbol&&ae!==Symbol.prototype?"symbol":typeof ae},A(re)}function S(re,fe){if(re==null)return{};var ae=y(re,fe),oe,Z;if(Object.getOwnPropertySymbols){var ne=Object.getOwnPropertySymbols(re);for(Z=0;Z<ne.length;Z++){if(oe=ne[Z],fe.indexOf(oe)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(re,oe))continue;ae[oe]=re[oe]}}return ae}function y(re,fe){if(re==null)return{};var ae={},oe=Object.keys(re),Z,ne;for(ne=0;ne<oe.length;ne++){if(Z=oe[ne],fe.indexOf(Z)>=0)continue;ae[Z]=re[Z]}return ae}function _(re){return l(re)||g(re)||d(re)||p()}function p(){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 d(re,fe){if(!re)return;if(typeof re=="string")return E(re,fe);var ae=Object.prototype.toString.call(re).slice(8,-1);if(ae==="Object"&&re.constructor&&(ae=re.constructor.name),ae==="Map"||ae==="Set")return Array.from(re);if(ae==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ae))return E(re,fe)}function g(re){if(typeof Symbol!="undefined"&&Symbol.iterator in Object(re))return Array.from(re)}function l(re){if(Array.isArray(re))return E(re)}function E(re,fe){(fe==null||fe>re.length)&&(fe=re.length);for(var ae=0,oe=new Array(fe);ae<fe;ae++)oe[ae]=re[ae];return oe}function U(re,fe){if(!(re instanceof fe))throw new TypeError("Cannot call a class as a function")}function P(re,fe){for(var ae=0;ae<fe.length;ae++){var oe=fe[ae];oe.enumerable=oe.enumerable||!1,oe.configurable=!0,"value"in oe&&(oe.writable=!0),Object.defineProperty(re,oe.key,oe)}}function j(re,fe,ae){return fe&&P(re.prototype,fe),ae&&P(re,ae),re}function H(re,fe){if(typeof fe!="function"&&fe!==null)throw new TypeError("Super expression must either be null or a function");re.prototype=Object.create(fe&&fe.prototype,{constructor:{value:re,writable:!0,configurable:!0}}),fe&&I(re,fe)}function I(re,fe){return I=Object.setPrototypeOf||function(oe,Z){return oe.__proto__=Z,oe},I(re,fe)}function T(re){var fe=ie();return function(){var ae=pe(re),oe;if(fe){var Z=pe(this).constructor;oe=Reflect.construct(ae,arguments,Z)}else oe=ae.apply(this,arguments);return K(this,oe)}}function K(re,fe){return fe&&(A(fe)==="object"||typeof fe=="function")?fe:J(re)}function J(re){if(re===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return re}function ie(){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(re){return!1}}function pe(re){return pe=Object.setPrototypeOf?Object.getPrototypeOf:function(ae){return ae.__proto__||Object.getPrototypeOf(ae)},pe(re)}var _e=function(){var re=function(fe){H(oe,fe);var ae=T(oe);function oe(Z){var ne;U(this,oe),ne=ae.call(this,Z),ne.setPopupVisible=function(me){var Se=ne.state.value;"popupVisible"in ne.props||ne.setState({popupVisible:me}),me&&!ne.state.popupVisible&&ne.setState({activeValue:Se}),ne.props.onPopupVisibleChange(me)},ne.handleChange=function(me,Se,Ee){var Le=Se.visible;(Ee.type!=="keydown"||Ee.keyCode===F.a.ENTER)&&(ne.props.onChange(me.map(function(Pe){return Pe[ne.getFieldName("value")]}),me),ne.setPopupVisible(Le))},ne.handlePopupVisibleChange=function(me){ne.setPopupVisible(me)},ne.handleMenuSelect=function(me,Se,Ee){var Le=ne.trigger.getRootDomNode();Le&&Le.focus&&Le.focus();var Pe=ne.props,Be=Pe.changeOnSelect,He=Pe.loadData,Ge=Pe.expandTrigger;if(!me||me.disabled)return;var Ue=ne.state.activeValue;Ue=Ue.slice(0,Se+1),Ue[Se]=me[ne.getFieldName("value")];var tt=ne.getActiveOptions(Ue);if(me.isLeaf===!1&&!me[ne.getFieldName("children")]&&He){Be&&ne.handleChange(tt,{visible:!0},Ee),ne.setState({activeValue:Ue}),He(tt);return}var nt={};!me[ne.getFieldName("children")]||!me[ne.getFieldName("children")].length?(ne.handleChange(tt,{visible:!1},Ee),nt.value=Ue):Be&&(Ee.type==="click"||Ee.type==="keydown")&&(Ge==="hover"?ne.handleChange(tt,{visible:!1},Ee):ne.handleChange(tt,{visible:!0},Ee),nt.value=Ue),nt.activeValue=Ue,("value"in ne.props||Ee.type==="keydown"&&Ee.keyCode!==F.a.ENTER)&&delete nt.value,ne.setState(nt)},ne.handleItemDoubleClick=function(){var me=ne.props.changeOnSelect;me&&ne.setPopupVisible(!1)},ne.handleKeyDown=function(me){var Se=ne.props.children;if(Se&&Se.props.onKeyDown){Se.props.onKeyDown(me);return}var Ee=_(ne.state.activeValue),Le=Ee.length-1<0?0:Ee.length-1,Pe=ne.getCurrentLevelOptions(),Be=Pe.map(function(tt){return tt[ne.getFieldName("value")]}).indexOf(Ee[Le]);if(me.keyCode!==F.a.DOWN&&me.keyCode!==F.a.UP&&me.keyCode!==F.a.LEFT&&me.keyCode!==F.a.RIGHT&&me.keyCode!==F.a.ENTER&&me.keyCode!==F.a.SPACE&&me.keyCode!==F.a.BACKSPACE&&me.keyCode!==F.a.ESC&&me.keyCode!==F.a.TAB)return;if(!ne.state.popupVisible&&me.keyCode!==F.a.BACKSPACE&&me.keyCode!==F.a.LEFT&&me.keyCode!==F.a.RIGHT&&me.keyCode!==F.a.ESC&&me.keyCode!==F.a.TAB){ne.setPopupVisible(!0);return}if(me.keyCode===F.a.DOWN||me.keyCode===F.a.UP){me.preventDefault();var He=Be;He!==-1?me.keyCode===F.a.DOWN?(He+=1,He=He>=Pe.length?0:He):(He-=1,He=He<0?Pe.length-1:He):He=0,Ee[Le]=Pe[He][ne.getFieldName("value")]}else if(me.keyCode===F.a.LEFT||me.keyCode===F.a.BACKSPACE)me.preventDefault(),Ee.splice(Ee.length-1,1);else if(me.keyCode===F.a.RIGHT)me.preventDefault(),Pe[Be]&&Pe[Be][ne.getFieldName("children")]&&Ee.push(Pe[Be][ne.getFieldName("children")][0][ne.getFieldName("value")]);else if(me.keyCode===F.a.ESC||me.keyCode===F.a.TAB){ne.setPopupVisible(!1);return}(!Ee||Ee.length===0)&&ne.setPopupVisible(!1);var Ge=ne.getActiveOptions(Ee),Ue=Ge[Ge.length-1];ne.handleMenuSelect(Ue,Ge.length-1,me),ne.props.onKeyDown&&ne.props.onKeyDown(me)},ne.saveTrigger=function(me){ne.trigger=me};var se=[];return"value"in Z?se=Z.value||[]:"defaultValue"in Z&&(se=Z.defaultValue||[]),Q()(!("filedNames"in Z),"`filedNames` of Cascader is a typo usage and deprecated, please use `fieldNames` instead."),ne.state={popupVisible:Z.popupVisible,activeValue:se,value:se,prevProps:Z},ne.defaultFieldNames={label:"label",value:"value",children:"children"},ne}return j(oe,[{key:"getPopupDOMNode",value:function(){return this.trigger.getPopupDomNode()}},{key:"getFieldName",value:function(ne){var se=this.defaultFieldNames,me=this.props,Se=me.fieldNames,Ee=me.filedNames;return"filedNames"in this.props?Ee[ne]||se[ne]:Se[ne]||se[ne]}},{key:"getFieldNames",value:function(){var ne=this.props,se=ne.fieldNames,me=ne.filedNames;return"filedNames"in this.props?me:se}},{key:"getCurrentLevelOptions",value:function(){var ne=this,se=this.props.options,me=se===void 0?[]:se,Se=this.state.activeValue,Ee=Se===void 0?[]:Se,Le=G()(me,function(Pe,Be){return Pe[ne.getFieldName("value")]===Ee[Be]},{childrenKeyName:this.getFieldName("children")});return Le[Le.length-2]?Le[Le.length-2][this.getFieldName("children")]:_(me).filter(function(Pe){return!Pe.disabled})}},{key:"getActiveOptions",value:function(ne){var se=this;return G()(this.props.options||[],function(me,Se){return me[se.getFieldName("value")]===ne[Se]},{childrenKeyName:this.getFieldName("children")})}},{key:"render",value:function(){var ne=this.props,se=ne.prefixCls,me=ne.transitionName,Se=ne.popupClassName,Ee=ne.options,Le=Ee===void 0?[]:Ee,Pe=ne.disabled,Be=ne.builtinPlacements,He=ne.popupPlacement,Ge=ne.children,Ue=ne.dropdownRender,tt=S(ne,["prefixCls","transitionName","popupClassName","options","disabled","builtinPlacements","popupPlacement","children","dropdownRender"]),nt=ce.createElement("div",null),ot="";Le&&Le.length>0?nt=ce.createElement(O,Object.assign({},this.props,{fieldNames:this.getFieldNames(),defaultFieldNames:this.defaultFieldNames,activeValue:this.state.activeValue,onSelect:this.handleMenuSelect,onItemDoubleClick:this.handleItemDoubleClick,visible:this.state.popupVisible})):ot=" ".concat(se,"-menus-empty");var st=nt;return Ue&&(st=Ue(nt)),ce.createElement(Y.a,Object.assign({ref:this.saveTrigger},tt,{popupPlacement:He,builtinPlacements:Be,popupTransitionName:me,action:Pe?[]:["click"],popupVisible:Pe?!1:this.state.popupVisible,onPopupVisibleChange:this.handlePopupVisibleChange,prefixCls:"".concat(se,"-menus"),popupClassName:Se+ot,popup:st}),ce.cloneElement(Ge,{onKeyDown:this.handleKeyDown,tabIndex:Pe?void 0:0}))}}],[{key:"getDerivedStateFromProps",value:function(ne,se){var me=se.prevProps,Se=me===void 0?{}:me,Ee={prevProps:ne};return"value"in ne&&!B(Se.value,ne.value)&&(Ee.value=ne.value||[],"loadData"in ne||(Ee.activeValue=ne.value||[])),"popupVisible"in ne&&(Ee.popupVisible=ne.popupVisible),Ee}}]),oe}(ce.Component);return re.defaultProps={onChange:function(){},onPopupVisibleChange:function(){},disabled:!1,transitionName:"",prefixCls:"rc-cascader",popupClassName:"",popupPlacement:"bottomLeft",builtinPlacements:x,expandTrigger:"click",fieldNames:{label:"label",value:"value",children:"children"},expandIcon:">"},re}(),Te=_e,he=Ke.a=Te},"SA+Z":function(ut,Ke,$){var ce=$("wTVA"),Y=$("EbDI"),N=$("ZhPi"),Q=$("wkBT");function F(D){return ce(D)||Y(D)||N(D)||Q()}ut.exports=F,ut.exports.__esModule=!0,ut.exports.default=ut.exports},SJMd:function(ut,Ke){/**
|
|
* @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 $,ce,Y,N=!1,Q,F;window.PR_SHOULD_USE_CONTINUATION=!0;var D,G;(function(){var B=window,k=["break,continue,do,else,for,if,return,while"],R=[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"],b=[R,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],v=[b,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],m=[b,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],u=[b,"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"],r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",c=[b,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",a=[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"],o=[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"],h=[k,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],O=[v,u,m,c,s,a,o,h],w=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,x="str",A="kwd",S="com",y="typ",_="lit",p="pun",d="pln",g="tag",l="dec",E="src",U="atn",P="atv",j="nocode",H="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function I(Ee){for(var Le=0,Pe=!1,Be=!1,He=0,Ge=Ee.length;He<Ge;++He){var Ue=Ee[He];if(Ue.ignoreCase)Be=!0;else if(/[a-z]/i.test(Ue.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Pe=!0,Be=!1;break}}var tt={b:8,t:9,n:10,v:11,f:12,r:13};function nt(Ie){var Re=Ie.charCodeAt(0);if(Re!==92)return Re;var ze=Ie.charAt(1);return Re=tt[ze],Re||("0"<=ze&&ze<="7"?parseInt(Ie.substring(1),8):ze==="u"||ze==="x"?parseInt(Ie.substring(2),16):Ie.charCodeAt(1))}function ot(Ie){if(Ie<32)return(Ie<16?"\\x0":"\\x")+Ie.toString(16);var Re=String.fromCharCode(Ie);return Re==="\\"||Re==="-"||Re==="]"||Re==="^"?"\\"+Re:Re}function st(Ie){var Re=Ie.substring(1,Ie.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")),ze=[],Ve=Re[0]==="^",De=["["];Ve&&De.push("^");for(var Me=Ve?1:0,be=Re.length;Me<be;++Me){var ve=Re[Me];if(/\\[bdsw]/i.test(ve))De.push(ve);else{var ge=nt(ve),le;Me+2<be&&Re[Me+1]==="-"?(le=nt(Re[Me+2]),Me+=2):le=ge,ze.push([ge,le]),le<65||ge>122||(le<65||ge>90||ze.push([Math.max(65,ge)|32,Math.min(le,90)|32]),le<97||ge>122||ze.push([Math.max(97,ge)&~32,Math.min(le,122)&~32]))}}ze.sort(function(we,ke){return we[0]-ke[0]||ke[1]-we[1]});for(var ue=[],ye=[],Me=0;Me<ze.length;++Me){var xe=ze[Me];xe[0]<=ye[1]+1?ye[1]=Math.max(ye[1],xe[1]):ue.push(ye=xe)}for(var Me=0;Me<ue.length;++Me){var xe=ue[Me];De.push(ot(xe[0])),xe[1]>xe[0]&&(xe[1]+1>xe[0]&&De.push("-"),De.push(ot(xe[1])))}return De.push("]"),De.join("")}function mt(Ie){for(var Re=Ie.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")),ze=Re.length,Ve=[],De=0,Me=0;De<ze;++De){var be=Re[De];if(be==="(")++Me;else if(be.charAt(0)==="\\"){var ve=+be.substring(1);ve&&(ve<=Me?Ve[ve]=-1:Re[De]=ot(ve))}}for(var De=1;De<Ve.length;++De)Ve[De]===-1&&(Ve[De]=++Le);for(var De=0,Me=0;De<ze;++De){var be=Re[De];if(be==="(")++Me,Ve[Me]||(Re[De]="(?:");else if(be.charAt(0)==="\\"){var ve=+be.substring(1);ve&&ve<=Me&&(Re[De]="\\"+Ve[ve])}}for(var De=0;De<ze;++De)Re[De]==="^"&&Re[De+1]!=="^"&&(Re[De]="");if(Ie.ignoreCase&&Pe)for(var De=0;De<ze;++De){var be=Re[De],ge=be.charAt(0);be.length>=2&&ge==="["?Re[De]=st(be):ge!=="\\"&&(Re[De]=be.replace(/[a-zA-Z]/g,function(ye){var xe=ye.charCodeAt(0);return"["+String.fromCharCode(xe&~32,xe|32)+"]"}))}return Re.join("")}for(var ht=[],He=0,Ge=Ee.length;He<Ge;++He){var Ue=Ee[He];if(Ue.global||Ue.multiline)throw new Error(""+Ue);ht.push("(?:"+mt(Ue)+")")}return new RegExp(ht.join("|"),Be?"gi":"g")}function T(Ee,Le){var Pe=/(?:^|\s)nocode(?:\s|$)/,Be=[],He=0,Ge=[],Ue=0;function tt(nt){var ot=nt.nodeType;if(ot==1){if(Pe.test(nt.className))return;for(var st=nt.firstChild;st;st=st.nextSibling)tt(st);var mt=nt.nodeName.toLowerCase();(mt==="br"||mt==="li")&&(Be[Ue]=`
|
|
`,Ge[Ue<<1]=He++,Ge[Ue++<<1|1]=nt)}else if(ot==3||ot==4){var ht=nt.nodeValue;ht.length&&(Le?ht=ht.replace(/\r\n?/g,`
|
|
`):ht=ht.replace(/[ \t\r\n]+/g," "),Be[Ue]=ht,Ge[Ue<<1]=He,He+=ht.length,Ge[Ue++<<1|1]=nt)}}return tt(Ee),{sourceCode:Be.join("").replace(/\n$/,""),spans:Ge}}function K(Ee,Le,Pe,Be,He){if(!Pe)return;var Ge={sourceNode:Ee,pre:1,langExtension:null,numberLines:null,sourceCode:Pe,spans:null,basePos:Le,decorations:null};Be(Ge),He.push.apply(He,Ge.decorations)}var J=/\S/;function ie(Ee){for(var Le=void 0,Pe=Ee.firstChild;Pe;Pe=Pe.nextSibling){var Be=Pe.nodeType;Le=Be===1?Le?Ee:Pe:Be===3&&J.test(Pe.nodeValue)?Ee:Le}return Le===Ee?void 0:Le}function pe(Ee,Le){var Pe={},Be;(function(){for(var Ue=Ee.concat(Le),tt=[],nt={},ot=0,st=Ue.length;ot<st;++ot){var mt=Ue[ot],ht=mt[3];if(ht)for(var Ie=ht.length;--Ie>=0;)Pe[ht.charAt(Ie)]=mt;var Re=mt[1],ze=""+Re;nt.hasOwnProperty(ze)||(tt.push(Re),nt[ze]=null)}tt.push(/[\0-\uffff]/),Be=I(tt)})();var He=Le.length,Ge=function(Ue){for(var tt=Ue.sourceCode,nt=Ue.basePos,ot=Ue.sourceNode,st=[nt,d],mt=0,ht=tt.match(Be)||[],Ie={},Re=0,ze=ht.length;Re<ze;++Re){var Ve=ht[Re],De=Ie[Ve],Me=void 0,be;if(typeof De=="string")be=!1;else{var ve=Pe[Ve.charAt(0)];if(ve)Me=Ve.match(ve[1]),De=ve[0];else{for(var ge=0;ge<He;++ge)if(ve=Le[ge],Me=Ve.match(ve[1]),Me){De=ve[0];break}Me||(De=d)}be=De.length>=5&&De.substring(0,5)==="lang-",be&&!(Me&&typeof Me[1]=="string")&&(be=!1,De=E),be||(Ie[Ve]=De)}var le=mt;if(mt+=Ve.length,!be)st.push(nt+le,De);else{var ue=Me[1],ye=Ve.indexOf(ue),xe=ye+ue.length;Me[2]&&(xe=Ve.length-Me[2].length,ye=xe-ue.length);var we=De.substring(5);K(ot,nt+le,Ve.substring(0,ye),Ge,st),K(ot,nt+le+ye,ue,oe(we,ue),st),K(ot,nt+le+xe,Ve.substring(xe),Ge,st)}}Ue.decorations=st};return Ge}function _e(Ee){var Le=[],Pe=[];Ee.tripleQuotedStrings?Le.push([x,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Ee.multiLineStrings?Le.push([x,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Le.push([x,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Ee.verbatimStrings&&Pe.push([x,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Be=Ee.hashComments;Be&&(Ee.cStyleComments?(Be>1?Le.push([S,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Le.push([S,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Pe.push([x,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Le.push([S,/^#[^\r\n]*/,null,"#"])),Ee.cStyleComments&&(Pe.push([S,/^\/\/[^\r\n]*/,null]),Pe.push([S,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var He=Ee.regexLiterals;if(He){var Ge=He>1?"":`
|
|
\r`,Ue=Ge?".":"[\\S\\s]",tt="/(?=[^/*"+Ge+"])(?:[^/\\x5B\\x5C"+Ge+"]|\\x5C"+Ue+"|\\x5B(?:[^\\x5C\\x5D"+Ge+"]|\\x5C"+Ue+")*(?:\\x5D|$))+/";Pe.push(["lang-regex",RegExp("^"+H+"("+tt+")")])}var nt=Ee.types;nt&&Pe.push([y,nt]);var ot=(""+Ee.keywords).replace(/^ | $/g,"");ot.length&&Pe.push([A,new RegExp("^(?:"+ot.replace(/[\s,]+/g,"|")+")\\b"),null]),Le.push([d,/^\s+/,null,` \r
|
|
\xA0`]);var st="^.[^\\s\\w.$@'\"`/\\\\]*";return Ee.regexLiterals&&(st+="(?!s*/)"),Pe.push([_,/^@[a-z_$][a-z_$@0-9]*/i,null],[y,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[d,/^[a-z_$][a-z_$@0-9]*/i,null],[_,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[d,/^\\[\s\S]?/,null],[p,new RegExp(st),null]),pe(Le,Pe)}var Te=_e({keywords:O,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function he(Ee,Le,Pe){for(var Be=/(?:^|\s)nocode(?:\s|$)/,He=/\r\n?|\n/,Ge=Ee.ownerDocument,Ue=Ge.createElement("li");Ee.firstChild;)Ue.appendChild(Ee.firstChild);var tt=[Ue];function nt(Re){var ze=Re.nodeType;if(ze==1&&!Be.test(Re.className))if(Re.nodeName==="br")ot(Re),Re.parentNode&&Re.parentNode.removeChild(Re);else for(var Ve=Re.firstChild;Ve;Ve=Ve.nextSibling)nt(Ve);else if((ze==3||ze==4)&&Pe){var De=Re.nodeValue,Me=De.match(He);if(Me){var be=De.substring(0,Me.index);Re.nodeValue=be;var ve=De.substring(Me.index+Me[0].length);if(ve){var ge=Re.parentNode;ge.insertBefore(Ge.createTextNode(ve),Re.nextSibling)}ot(Re),be||Re.parentNode.removeChild(Re)}}}function ot(Re){for(;!Re.nextSibling;)if(Re=Re.parentNode,!Re)return;function ze(Me,be){var ve=be?Me.cloneNode(!1):Me,ge=Me.parentNode;if(ge){var le=ze(ge,1),ue=Me.nextSibling;le.appendChild(ve);for(var ye=ue;ye;ye=ue)ue=ye.nextSibling,le.appendChild(ye)}return ve}for(var Ve=ze(Re.nextSibling,0),De;(De=Ve.parentNode)&&De.nodeType===1;)Ve=De;tt.push(Ve)}for(var st=0;st<tt.length;++st)nt(tt[st]);Le===(Le|0)&&tt[0].setAttribute("value",Le);var mt=Ge.createElement("ol");mt.className="linenums";for(var ht=Math.max(0,Le-1|0)||0,st=0,Ie=tt.length;st<Ie;++st)Ue=tt[st],Ue.className="L"+(st+ht)%10,Ue.firstChild||Ue.appendChild(Ge.createTextNode("\xA0")),mt.appendChild(Ue);Ee.appendChild(mt)}function re(Ee){var Le=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Le=Le&&+Le[1]<=8;var Pe=/\n/g,Be=Ee.sourceCode,He=Be.length,Ge=0,Ue=Ee.spans,tt=Ue.length,nt=0,ot=Ee.decorations,st=ot.length,mt=0;ot[st]=He;var ht,Ie;for(Ie=ht=0;Ie<st;)ot[Ie]!==ot[Ie+2]?(ot[ht++]=ot[Ie++],ot[ht++]=ot[Ie++]):Ie+=2;for(st=ht,Ie=ht=0;Ie<st;){for(var Re=ot[Ie],ze=ot[Ie+1],Ve=Ie+2;Ve+2<=st&&ot[Ve+1]===ze;)Ve+=2;ot[ht++]=Re,ot[ht++]=ze,Ie=Ve}st=ot.length=ht;var De=Ee.sourceNode,Me="";De&&(Me=De.style.display,De.style.display="none");try{for(var be=null;nt<tt;){var ve=Ue[nt],ge=Ue[nt+2]||He,le=ot[mt+2]||He,Ve=Math.min(ge,le),ue=Ue[nt+1],ye;if(ue.nodeType!==1&&(ye=Be.substring(Ge,Ve))){Le&&(ye=ye.replace(Pe,"\r")),ue.nodeValue=ye;var xe=ue.ownerDocument,we=xe.createElement("span");we.className=ot[mt+1];var ke=ue.parentNode;ke.replaceChild(we,ue),we.appendChild(ue),Ge<ge&&(Ue[nt+1]=ue=xe.createTextNode(Be.substring(Ve,ge)),ke.insertBefore(ue,we.nextSibling))}Ge=Ve,Ge>=ge&&(nt+=2),Ge>=le&&(mt+=2)}}finally{De&&(De.style.display=Me)}}var fe={};function ae(Ee,Le){for(var Pe=Le.length;--Pe>=0;){var Be=Le[Pe];fe.hasOwnProperty(Be)?B.console&&console.warn("cannot override language handler %s",Be):fe[Be]=Ee}}function oe(Ee,Le){return Ee&&fe.hasOwnProperty(Ee)||(Ee=/^\s*</.test(Le)?"default-markup":"default-code"),fe[Ee]}ae(Te,["default-code"]),ae(pe([],[[d,/^[^<?]+/],[l,/^<!\w[^>]*(?:>|$)/],[S,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[p,/^(?:<[%?]|[%?]>)/],["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"]),ae(pe([[d,/^[\s]+/,null,` \r
|
|
`],[P,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[g,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[U,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[p,/^[=<>\/]+/],["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"]),ae(pe([],[[P,/^[\s\S]+/]]),["uq.val"]),ae(_e({keywords:v,hashComments:!0,cStyleComments:!0,types:w}),["c","cc","cpp","cxx","cyc","m"]),ae(_e({keywords:"null,true,false"}),["json"]),ae(_e({keywords:u,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:w}),["cs"]),ae(_e({keywords:m,cStyleComments:!0}),["java"]),ae(_e({keywords:h,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ae(_e({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ae(_e({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ae(_e({keywords:o,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ae(_e({keywords:c,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ae(_e({keywords:r,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ae(pe([],[[x,/^[\s\S]+/]]),["regex"]);function Z(Ee){var Le=Ee.langExtension;try{var Pe=T(Ee.sourceNode,Ee.pre),Be=Pe.sourceCode;Ee.sourceCode=Be,Ee.spans=Pe.spans,Ee.basePos=0,oe(Le,Be)(Ee),re(Ee)}catch(He){B.console&&console.log(He&&He.stack||He)}}function ne(Ee,Le,Pe){var Be=Pe||!1,He=Le||null,Ge=document.createElement("div");Ge.innerHTML="<pre>"+Ee+"</pre>",Ge=Ge.firstChild,Be&&he(Ge,Be,!0);var Ue={langExtension:He,numberLines:Be,sourceNode:Ge,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Z(Ue),Ge.innerHTML}function se(Ee,Le){var Pe=Le||document.body,Be=Pe.ownerDocument||document;function He(ve){return Pe.getElementsByTagName(ve)}for(var Ge=[He("pre"),He("code"),He("xmp")],Ue=[],tt=0;tt<Ge.length;++tt)for(var nt=0,ot=Ge[tt].length;nt<ot;++nt)Ue.push(Ge[tt][nt]);Ge=null;var st=Date;st.now||(st={now:function(){return+new Date}});var mt=0,ht=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ie=/\bprettyprint\b/,Re=/\bprettyprinted\b/,ze=/pre|xmp/i,Ve=/^code$/i,De=/^(?:pre|code|xmp)$/i,Me={};function be(){for(var ve=B.PR_SHOULD_USE_CONTINUATION?st.now()+250:Infinity;mt<Ue.length&&st.now()<ve;mt++){for(var ge=Ue[mt],le=Me,ue=ge;ue=ue.previousSibling;){var ye=ue.nodeType,xe=(ye===7||ye===8)&&ue.nodeValue;if(xe?!/^\??prettify\b/.test(xe):ye!==3||/\S/.test(ue.nodeValue))break;if(xe){le={},xe.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Mt,Ot,Lt){le[Ot]=Lt});break}}var we=ge.className;if((le!==Me||Ie.test(we))&&!Re.test(we)){for(var ke=!1,We=ge.parentNode;We;We=We.parentNode){var Je=We.tagName;if(De.test(Je)&&We.className&&Ie.test(We.className)){ke=!0;break}}if(!ke){ge.className+=" prettyprinted";var Qe=le.lang;if(!Qe){Qe=we.match(ht);var Ze;!Qe&&(Ze=ie(ge))&&Ve.test(Ze.tagName)&&(Qe=Ze.className.match(ht)),Qe&&(Qe=Qe[1])}var bt;if(ze.test(ge.tagName))bt=1;else{var yt=ge.currentStyle,lt=Be.defaultView,wt=yt?yt.whiteSpace:lt&<.getComputedStyle?lt.getComputedStyle(ge,null).getPropertyValue("white-space"):0;bt=wt&&wt.substring(0,3)==="pre"}var xt=le.linenums;(xt=xt==="true"||+xt)||(xt=we.match(/\blinenums\b(?::(\d+))?/),xt=xt?xt[1]&&xt[1].length?+xt[1]:!0:!1),xt&&he(ge,xt,bt);var Ct={langExtension:Qe,sourceNode:ge,numberLines:xt,pre:bt,sourceCode:null,basePos:null,spans:null,decorations:null};Z(Ct)}}}mt<Ue.length?B.setTimeout(be,250):typeof Ee=="function"&&Ee()}be()}var me=B.PR={createSimpleLexer:pe,registerLangHandler:ae,sourceDecorator:_e,PR_ATTRIB_NAME:U,PR_ATTRIB_VALUE:P,PR_COMMENT:S,PR_DECLARATION:l,PR_KEYWORD:A,PR_LITERAL:_,PR_NOCODE:j,PR_PLAIN:d,PR_PUNCTUATION:p,PR_SOURCE:E,PR_STRING:x,PR_TAG:g,PR_TYPE:y,prettyPrintOne:N?B.prettyPrintOne=ne:D=ne,prettyPrint:G=N?B.prettyPrint=se:G=se},Se=B.define;typeof Se=="function"&&Se.amd&&Se("google-code-prettify",[],function(){return me})})()},T1X5:function(ut,Ke){ut.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"},TXwP:function(ut,Ke,$){var ce,Y;(function(){var N;(function(){"use strict";var F=[,,function(k){function R(m){this.__parent=m,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}R.prototype.clone_empty=function(){var m=new R(this.__parent);return m.set_indent(this.__indent_count,this.__alignment_count),m},R.prototype.item=function(m){return m<0?this.__items[this.__items.length+m]:this.__items[m]},R.prototype.has_match=function(m){for(var u=this.__items.length-1;u>=0;u--)if(this.__items[u].match(m))return!0;return!1},R.prototype.set_indent=function(m,u){this.is_empty()&&(this.__indent_count=m||0,this.__alignment_count=u||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},R.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},R.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},R.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var m=this.__parent.current_line;return m.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),m.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),m.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,m.__items[0]===" "&&(m.__items.splice(0,1),m.__character_count-=1),!0}return!1},R.prototype.is_empty=function(){return this.__items.length===0},R.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},R.prototype.push=function(m){this.__items.push(m);var u=m.lastIndexOf(`
|
|
`);u!==-1?this.__character_count=m.length-u:this.__character_count+=m.length},R.prototype.pop=function(){var m=null;return this.is_empty()||(m=this.__items.pop(),this.__character_count-=m.length),m},R.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},R.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},R.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},R.prototype.toString=function(){var m="";return this.is_empty()?this.__parent.indent_empty_lines&&(m=this.__parent.get_indent_string(this.__indent_count)):(m=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),m+=this.__items.join("")),m};function b(m,u){this.__cache=[""],this.__indent_size=m.indent_size,this.__indent_string=m.indent_char,m.indent_with_tabs||(this.__indent_string=new Array(m.indent_size+1).join(m.indent_char)),u=u||"",m.indent_level>0&&(u=new Array(m.indent_level+1).join(this.__indent_string)),this.__base_string=u,this.__base_string_length=u.length}b.prototype.get_indent_size=function(m,u){var r=this.__base_string_length;return u=u||0,m<0&&(r=0),r+=m*this.__indent_size,r+=u,r},b.prototype.get_indent_string=function(m,u){var r=this.__base_string;return u=u||0,m<0&&(m=0,r=""),u+=m*this.__indent_size,this.__ensure_cache(u),r+=this.__cache[u],r},b.prototype.__ensure_cache=function(m){for(;m>=this.__cache.length;)this.__add_column()},b.prototype.__add_column=function(){var m=this.__cache.length,u=0,r="";this.__indent_size&&m>=this.__indent_size&&(u=Math.floor(m/this.__indent_size),m-=u*this.__indent_size,r=new Array(u+1).join(this.__indent_string)),m&&(r+=new Array(m+1).join(" ")),this.__cache.push(r)};function v(m,u){this.__indent_cache=new b(m,u),this.raw=!1,this._end_with_newline=m.end_with_newline,this.indent_size=m.indent_size,this.wrap_line_length=m.wrap_line_length,this.indent_empty_lines=m.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new R(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}v.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},v.prototype.get_line_number=function(){return this.__lines.length},v.prototype.get_indent_string=function(m,u){return this.__indent_cache.get_indent_string(m,u)},v.prototype.get_indent_size=function(m,u){return this.__indent_cache.get_indent_size(m,u)},v.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},v.prototype.add_new_line=function(m){return this.is_empty()||!m&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},v.prototype.get_code=function(m){this.trim(!0);var u=this.current_line.pop();u&&(u[u.length-1]===`
|
|
`&&(u=u.replace(/\n+$/g,"")),this.current_line.push(u)),this._end_with_newline&&this.__add_outputline();var r=this.__lines.join(`
|
|
`);return m!==`
|
|
`&&(r=r.replace(/[\n]/g,m)),r},v.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},v.prototype.set_indent=function(m,u){return m=m||0,u=u||0,this.next_line.set_indent(m,u),this.__lines.length>1?(this.current_line.set_indent(m,u),!0):(this.current_line.set_indent(),!1)},v.prototype.add_raw_token=function(m){for(var u=0;u<m.newlines;u++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(m.whitespace_before),this.current_line.push(m.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},v.prototype.add_token=function(m){this.__add_space_before_token(),this.current_line.push(m),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},v.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},v.prototype.remove_indent=function(m){for(var u=this.__lines.length;m<u;)this.__lines[m]._remove_indent(),m++;this.current_line._remove_wrap_indent()},v.prototype.trim=function(m){for(m=m===void 0?!1:m,this.current_line.trim();m&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},v.prototype.just_added_newline=function(){return this.current_line.is_empty()},v.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},v.prototype.ensure_empty_line_above=function(m,u){for(var r=this.__lines.length-2;r>=0;){var c=this.__lines[r];if(c.is_empty())break;if(c.item(0).indexOf(m)!==0&&c.item(-1)!==u){this.__lines.splice(r+1,0,new R(this)),this.previous_line=this.__lines[this.__lines.length-2];break}r--}},k.exports.Output=v},,,,function(k){function R(m,u){this.raw_options=b(m,u),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}R.prototype._get_array=function(m,u){var r=this.raw_options[m],c=u||[];return typeof r=="object"?r!==null&&typeof r.concat=="function"&&(c=r.concat()):typeof r=="string"&&(c=r.split(/[^a-zA-Z0-9_\/\-]+/)),c},R.prototype._get_boolean=function(m,u){var r=this.raw_options[m],c=r===void 0?!!u:!!r;return c},R.prototype._get_characters=function(m,u){var r=this.raw_options[m],c=u||"";return typeof r=="string"&&(c=r.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),c},R.prototype._get_number=function(m,u){var r=this.raw_options[m];u=parseInt(u,10),isNaN(u)&&(u=0);var c=parseInt(r,10);return isNaN(c)&&(c=u),c},R.prototype._get_selection=function(m,u,r){var c=this._get_selection_list(m,u,r);if(c.length!==1)throw new Error("Invalid Option Value: The option '"+m+`' can only be one of the following values:
|
|
`+u+`
|
|
You passed in: '`+this.raw_options[m]+"'");return c[0]},R.prototype._get_selection_list=function(m,u,r){if(!u||u.length===0)throw new Error("Selection list cannot be empty.");if(r=r||[u[0]],!this._is_valid_selection(r,u))throw new Error("Invalid Default Value!");var c=this._get_array(m,r);if(!this._is_valid_selection(c,u))throw new Error("Invalid Option Value: The option '"+m+`' can contain only the following values:
|
|
`+u+`
|
|
You passed in: '`+this.raw_options[m]+"'");return c},R.prototype._is_valid_selection=function(m,u){return m.length&&u.length&&!m.some(function(r){return u.indexOf(r)===-1})};function b(m,u){var r={};m=v(m);var c;for(c in m)c!==u&&(r[c]=m[c]);if(u&&m[u])for(c in m[u])r[c]=m[u][c];return r}function v(m){var u={},r;for(r in m){var c=r.replace(/-/g,"_");u[c]=m[r]}return u}k.exports.Options=R,k.exports.normalizeOpts=v,k.exports.mergeOpts=b},,function(k){var R=RegExp.prototype.hasOwnProperty("sticky");function b(v){this.__input=v||"",this.__input_length=this.__input.length,this.__position=0}b.prototype.restart=function(){this.__position=0},b.prototype.back=function(){this.__position>0&&(this.__position-=1)},b.prototype.hasNext=function(){return this.__position<this.__input_length},b.prototype.next=function(){var v=null;return this.hasNext()&&(v=this.__input.charAt(this.__position),this.__position+=1),v},b.prototype.peek=function(v){var m=null;return v=v||0,v+=this.__position,v>=0&&v<this.__input_length&&(m=this.__input.charAt(v)),m},b.prototype.__match=function(v,m){v.lastIndex=m;var u=v.exec(this.__input);return u&&!(R&&v.sticky)&&(u.index!==m&&(u=null)),u},b.prototype.test=function(v,m){return m=m||0,m+=this.__position,m>=0&&m<this.__input_length?!!this.__match(v,m):!1},b.prototype.testChar=function(v,m){var u=this.peek(m);return v.lastIndex=0,u!==null&&v.test(u)},b.prototype.match=function(v){var m=this.__match(v,this.__position);return m?this.__position+=m[0].length:m=null,m},b.prototype.read=function(v,m,u){var r="",c;return v&&(c=this.match(v),c&&(r+=c[0])),m&&(c||!v)&&(r+=this.readUntil(m,u)),r},b.prototype.readUntil=function(v,m){var u="",r=this.__position;v.lastIndex=this.__position;var c=v.exec(this.__input);return c?(r=c.index,m&&(r+=c[0].length)):r=this.__input_length,u=this.__input.substring(this.__position,r),this.__position=r,u},b.prototype.readUntilAfter=function(v){return this.readUntil(v,!0)},b.prototype.get_regexp=function(v,m){var u=null,r="g";return m&&R&&(r="y"),typeof v=="string"&&v!==""?u=new RegExp(v,r):v&&(u=new RegExp(v.source,r)),u},b.prototype.get_literal_regexp=function(v){return RegExp(v.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},b.prototype.peekUntilAfter=function(v){var m=this.__position,u=this.readUntilAfter(v);return this.__position=m,u},b.prototype.lookBack=function(v){var m=this.__position-1;return m>=v.length&&this.__input.substring(m-v.length,m).toLowerCase()===v},k.exports.InputScanner=b},,,,,function(k){function R(b,v){b=typeof b=="string"?b:b.source,v=typeof v=="string"?v:v.source,this.__directives_block_pattern=new RegExp(b+/ beautify( \w+[:]\w+)+ /.source+v,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(b+/\sbeautify\signore:end\s/.source+v,"g")}R.prototype.get_directives=function(b){if(!b.match(this.__directives_block_pattern))return null;var v={};this.__directive_pattern.lastIndex=0;for(var m=this.__directive_pattern.exec(b);m;)v[m[1]]=m[2],m=this.__directive_pattern.exec(b);return v},R.prototype.readIgnored=function(b){return b.readUntilAfter(this.__directives_end_ignore_pattern)},k.exports.Directives=R},,function(k,R,b){var v=b(16).Beautifier,m=b(17).Options;function u(r,c){var s=new v(r,c);return s.beautify()}k.exports=u,k.exports.defaultOptions=function(){return new m}},function(k,R,b){var v=b(17).Options,m=b(2).Output,u=b(8).InputScanner,r=b(13).Directives,c=new r(/\/\*/,/\*\//),s=/\r\n|[\r\n]/,a=/\r\n|[\r\n]/g,o=/\s/,h=/(?:\s|\n)+/g,O=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,w=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function x(A,S){this._source_text=A||"",this._options=new v(S),this._ch=null,this._input=null,this.NESTED_AT_RULE={"@page":!0,"@font-face":!0,"@keyframes":!0,"@media":!0,"@supports":!0,"@document":!0},this.CONDITIONAL_GROUP_RULE={"@media":!0,"@supports":!0,"@document":!0},this.NON_SEMICOLON_NEWLINE_PROPERTY=["grid-template-areas","grid-template"]}x.prototype.eatString=function(A){var S="";for(this._ch=this._input.next();this._ch;){if(S+=this._ch,this._ch==="\\")S+=this._input.next();else if(A.indexOf(this._ch)!==-1||this._ch===`
|
|
`)break;this._ch=this._input.next()}return S},x.prototype.eatWhitespace=function(A){for(var S=o.test(this._input.peek()),y=0;o.test(this._input.peek());)this._ch=this._input.next(),A&&this._ch===`
|
|
`&&((y===0||y<this._options.max_preserve_newlines)&&(y++,this._output.add_new_line(!0)));return S},x.prototype.foundNestedPseudoClass=function(){for(var A=0,S=1,y=this._input.peek(S);y;){if(y==="{")return!0;if(y==="(")A+=1;else if(y===")"){if(A===0)return!1;A-=1}else if(y===";"||y==="}")return!1;S++,y=this._input.peek(S)}return!1},x.prototype.print_string=function(A){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(A)},x.prototype.preserveSingleSpace=function(A){A&&(this._output.space_before_token=!0)},x.prototype.indent=function(){this._indentLevel++},x.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},x.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var A=this._source_text,S=this._options.eol;S==="auto"&&(S=`
|
|
`,A&&s.test(A||"")&&(S=A.match(s)[0])),A=A.replace(a,`
|
|
`);var y=A.match(/^[\t ]*/)[0];this._output=new m(this._options,y),this._input=new u(A),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var _=0,p=!1,d=!1,g=!1,l=!1,E=!1,U=!1,P=this._ch,j=!1,H,I,T;H=this._input.read(h),I=H!=="",T=P,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),P=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var K=this._input.read(O),J=c.get_directives(K);J&&J.ignore==="start"&&(K+=c.readIgnored(this._input)),this.print_string(K),this.eatWhitespace(!0),this._output.add_new_line()}else if(this._ch==="/"&&this._input.peek()==="/")this._output.space_before_token=!0,this._input.back(),this.print_string(this._input.read(w)),this.eatWhitespace(!0);else if(this._ch==="@"||this._ch==="$")if(this.preserveSingleSpace(I),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var ie=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);ie.match(/[ :]$/)&&(ie=this.eatString(": ").replace(/\s$/,""),this.print_string(ie),this._output.space_before_token=!0),ie=ie.replace(/\s$/,""),ie==="extend"?l=!0:ie==="import"&&(E=!0),ie in this.NESTED_AT_RULE?(this._nestedLevel+=1,ie in this.CONDITIONAL_GROUP_RULE&&(g=!0)):!p&&_===0&&ie.indexOf(":")!==-1&&(d=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(I),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")d&&(d=!1,this.outdent()),g?(g=!1,p=this._indentLevel>=this._nestedLevel):p=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&p&&(this._output.previous_line&&this._output.previous_line.item(-1)!=="{"&&this._output.ensure_empty_line_above("/",",")),this._output.space_before_token=!0,this._options.brace_style==="expand"?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):(T==="("?this._output.space_before_token=!1:T!==","&&this.indent(),this.print_string(this._ch)),this.eatWhitespace(!0),this._output.add_new_line();else if(this._ch==="}")this.outdent(),this._output.add_new_line(),T==="{"&&this._output.trim(!0),E=!1,l=!1,d&&(this.outdent(),d=!1),this.print_string(this._ch),p=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&(this._input.peek()!=="}"&&this._output.add_new_line(!0)),this._input.peek()===")"&&(this._output.trim(!0),this._options.brace_style==="expand"&&this._output.add_new_line(!0));else if(this._ch===":"){for(var pe=0;pe<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;pe++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[pe])){j=!0;break}(p||g)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!l&&_===0?(this.print_string(":"),d||(d=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var _e=T==='"'||T==="'";this.preserveSingleSpace(_e||I),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")j=!1,_===0?(d&&(this.outdent(),d=!1),l=!1,E=!1,this.print_string(this._ch),this.eatWhitespace(!0),this._input.peek()!=="/"&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if(this._ch==="(")if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),_++,this.indent(),this._ch=this._input.next(),this._ch===")"||this._ch==='"'||this._ch==="'"?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),_&&(_--,this.outdent()));else{var Te=!1;this._input.lookBack("with")&&(Te=!0),this.preserveSingleSpace(I||Te),this.print_string(this._ch),d&&T==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),U=!0):(this.eatWhitespace(),_++,this.indent())}else if(this._ch===")")_&&(_--,this.outdent()),U&&this._input.peek()===";"&&this._options.selector_separator_newline&&(U=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(this._ch===",")this.print_string(this._ch),this.eatWhitespace(!0),this._options.selector_separator_newline&&(!d||U)&&_===0&&!E&&!l?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!d&&_===0)this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&o.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(I),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),o.test(this._ch)&&(this._ch="");else if(this._ch==="!"&&!this._input.lookBack("\\"))this._output.space_before_token=!0,this.print_string(this._ch);else{var he=T==='"'||T==="'";this.preserveSingleSpace(he||I),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
`&&j&&this._output.add_new_line()}var re=this._output.get_code(S);return re},k.exports.Beautifier=x},function(k,R,b){var v=b(6).Options;function m(u){v.call(this,u,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var r=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||r;var c=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var s=0;s<c.length;s++)c[s]!=="expand"?this.brace_style="collapse":this.brace_style=c[s]}m.prototype=new v,k.exports.Options=m}],D={};function G(k){var R=D[k];if(R!==void 0)return R.exports;var b=D[k]={exports:{}};return F[k](b,b.exports,G),b.exports}var B=G(15);N=B})();var Q=N;!(ce=[],Y=function(){return{css_beautify:Q}}.apply(Ke,ce),Y!==void 0&&(ut.exports=Y))})()},"VrN/":function(ut,Ke,$){(function(ce,Y){ut.exports=Y()})(this,function(){"use strict";var ce=navigator.userAgent,Y=navigator.platform,N=/gecko\/\d/i.test(ce),Q=/MSIE \d/.test(ce),F=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ce),D=/Edge\/(\d+)/.exec(ce),G=Q||F||D,B=G&&(Q?document.documentMode||6:+(D||F)[1]),k=!D&&/WebKit\//.test(ce),R=k&&/Qt\/\d+\.\d+/.test(ce),b=!D&&/Chrome\//.test(ce),v=/Opera\//.test(ce),m=/Apple Computer/.test(navigator.vendor),u=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ce),r=/PhantomJS/.test(ce),c=!D&&/AppleWebKit/.test(ce)&&/Mobile\/\w+/.test(ce),s=/Android/.test(ce),a=c||s||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ce),o=c||/Mac/.test(Y),h=/\bCrOS\b/.test(ce),O=/win/i.test(Y),w=v&&ce.match(/Version\/(\d*\.\d*)/);w&&(w=Number(w[1])),w&&w>=15&&(v=!1,k=!0);var x=o&&(R||v&&(w==null||w<12.11)),A=N||G&&B>=9;function S(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var y=function(e,t){var i=e.className,n=S(t).exec(i);if(n){var f=i.slice(n.index+n[0].length);e.className=i.slice(0,n.index)+(f?n[1]+f:"")}};function _(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function p(e,t){return _(e).appendChild(t)}function d(e,t,i,n){var f=document.createElement(e);if(i&&(f.className=i),n&&(f.style.cssText=n),typeof t=="string")f.appendChild(document.createTextNode(t));else if(t)for(var M=0;M<t.length;++M)f.appendChild(t[M]);return f}function g(e,t,i,n){var f=d(e,t,i,n);return f.setAttribute("role","presentation"),f}var l;document.createRange?l=function(e,t,i,n){var f=document.createRange();return f.setEnd(n||e,i),f.setStart(e,t),f}:l=function(e,t,i){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(f){return n}return n.collapse(!0),n.moveEnd("character",i),n.moveStart("character",t),n};function E(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function U(){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 P(e,t){var i=e.className;S(t).test(i)||(e.className+=(i?" ":"")+t)}function j(e,t){for(var i=e.split(" "),n=0;n<i.length;n++)i[n]&&!S(i[n]).test(t)&&(t+=" "+i[n]);return t}var H=function(e){e.select()};c?H=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:G&&(H=function(e){try{e.select()}catch(t){}});function I(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function T(e,t,i){t||(t={});for(var n in e)e.hasOwnProperty(n)&&(i!==!1||!t.hasOwnProperty(n))&&(t[n]=e[n]);return t}function K(e,t,i,n,f){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var M=n||0,z=f||0;;){var q=e.indexOf(" ",M);if(q<0||q>=t)return z+(t-M);z+=q-M,z+=i-z%i,M=q+1}}var J=function(){this.id=null,this.f=null,this.time=0,this.handler=I(this.onTimeout,this)};J.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},J.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=i)};function ie(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var pe=50,_e={toString:function(){return"CodeMirror.Pass"}},Te={scroll:!1},he={origin:"*mouse"},re={origin:"+move"};function fe(e,t,i){for(var n=0,f=0;;){var M=e.indexOf(" ",n);M==-1&&(M=e.length);var z=M-n;if(M==e.length||f+z>=t)return n+Math.min(z,t-f);if(f+=M-n,f+=i-f%i,n=M+1,f>=t)return n}}var ae=[""];function oe(e){for(;ae.length<=e;)ae.push(Z(ae)+" ");return ae[e]}function Z(e){return e[e.length-1]}function ne(e,t){for(var i=[],n=0;n<e.length;n++)i[n]=t(e[n],n);return i}function se(e,t,i){for(var n=0,f=i(t);n<e.length&&i(e[n])<=f;)n++;e.splice(n,0,t)}function me(){}function Se(e,t){var i;return Object.create?i=Object.create(e):(me.prototype=e,i=new me),t&&T(t,i),i}var Ee=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Le(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&&Le(e)?!0:t.test(e):Le(e)}function Be(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 Ge(e){return e.charCodeAt(0)>=768&&He.test(e)}function Ue(e,t,i){for(;(i<0?t>0:t<e.length)&&Ge(e.charAt(t));)t+=i;return t}function tt(e,t,i){for(var n=t>i?-1:1;;){if(t==i)return t;var f=(t+i)/2,M=n<0?Math.ceil(f):Math.floor(f);if(M==t)return e(M)?t:i;e(M)?i=M:t=M+n}}function nt(e,t,i,n){if(!e)return n(t,i,"ltr",0);for(var f=!1,M=0;M<e.length;++M){var z=e[M];(z.from<i&&z.to>t||t==i&&z.to==t)&&(n(Math.max(z.from,t),Math.min(z.to,i),z.level==1?"rtl":"ltr",M),f=!0)}f||n(t,i,"ltr")}var ot=null;function st(e,t,i){var n;ot=null;for(var f=0;f<e.length;++f){var M=e[f];if(M.from<t&&M.to>t)return f;M.to==t&&(M.from!=M.to&&i=="before"?n=f:ot=f),M.from==t&&(M.from!=M.to&&i!="before"?n=f:ot=f)}return n!=null?n:ot}var mt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(de){return de<=247?e.charAt(de):1424<=de&&de<=1524?"R":1536<=de&&de<=1785?t.charAt(de-1536):1774<=de&&de<=2220?"r":8192<=de&&de<=8203?"w":de==8204?"b":"L"}var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,f=/[stwN]/,M=/[LRr]/,z=/[Lb1n]/,q=/[1n]/;function ee(de,Ce,Ae){this.level=de,this.from=Ce,this.to=Ae}return function(de,Ce){var Ae=Ce=="ltr"?"L":"R";if(de.length==0||Ce=="ltr"&&!n.test(de))return!1;for(var Fe=de.length,Ne=[],Xe=0;Xe<Fe;++Xe)Ne.push(i(de.charCodeAt(Xe)));for(var at=0,pt=Ae;at<Fe;++at){var _t=Ne[at];_t=="m"?Ne[at]=pt:pt=_t}for(var St=0,Et=Ae;St<Fe;++St){var Rt=Ne[St];Rt=="1"&&Et=="r"?Ne[St]="n":M.test(Rt)&&(Et=Rt,Rt=="r"&&(Ne[St]="R"))}for(var jt=1,Ut=Ne[0];jt<Fe-1;++jt){var qt=Ne[jt];qt=="+"&&Ut=="1"&&Ne[jt+1]=="1"?Ne[jt]="1":qt==","&&Ut==Ne[jt+1]&&(Ut=="1"||Ut=="n")&&(Ne[jt]=Ut),Ut=qt}for(var Cn=0;Cn<Fe;++Cn){var Xn=Ne[Cn];if(Xn==",")Ne[Cn]="N";else if(Xn=="%"){var An=void 0;for(An=Cn+1;An<Fe&&Ne[An]=="%";++An);for(var mi=Cn&&Ne[Cn-1]=="!"||An<Fe&&Ne[An]=="1"?"1":"N",li=Cn;li<An;++li)Ne[li]=mi;Cn=An-1}}for(var Bn=0,ui=Ae;Bn<Fe;++Bn){var Jn=Ne[Bn];ui=="L"&&Jn=="1"?Ne[Bn]="L":M.test(Jn)&&(ui=Jn)}for(var Hn=0;Hn<Fe;++Hn)if(f.test(Ne[Hn])){var jn=void 0;for(jn=Hn+1;jn<Fe&&f.test(Ne[jn]);++jn);for(var Ln=(Hn?Ne[Hn-1]:Ae)=="L",di=(jn<Fe?Ne[jn]:Ae)=="L",_r=Ln==di?Ln?"L":"R":Ae,Xi=Hn;Xi<jn;++Xi)Ne[Xi]=_r;Hn=jn-1}for(var qn=[],Li,Yn=0;Yn<Fe;)if(z.test(Ne[Yn])){var qa=Yn;for(++Yn;Yn<Fe&&z.test(Ne[Yn]);++Yn);qn.push(new ee(0,qa,Yn))}else{var Pi=Yn,ir=qn.length,rr=Ce=="rtl"?1:0;for(++Yn;Yn<Fe&&Ne[Yn]!="L";++Yn);for(var ai=Pi;ai<Yn;)if(q.test(Ne[ai])){Pi<ai&&(qn.splice(ir,0,new ee(1,Pi,ai)),ir+=rr);var Er=ai;for(++ai;ai<Yn&&q.test(Ne[ai]);++ai);qn.splice(ir,0,new ee(2,Er,ai)),ir+=rr,Pi=ai}else++ai;Pi<Yn&&qn.splice(ir,0,new ee(1,Pi,Yn))}return Ce=="ltr"&&(qn[0].level==1&&(Li=de.match(/^\s+/))&&(qn[0].from=Li[0].length,qn.unshift(new ee(0,0,Li[0].length))),Z(qn).level==1&&(Li=de.match(/\s+$/))&&(Z(qn).to-=Li[0].length,qn.push(new ee(0,Fe-Li[0].length,Fe)))),Ce=="rtl"?qn.reverse():qn}}();function ht(e,t){var i=e.order;return i==null&&(i=e.order=mt(e.text,t)),i}var Ie=[],Re=function(e,t,i){if(e.addEventListener)e.addEventListener(t,i,!1);else if(e.attachEvent)e.attachEvent("on"+t,i);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||Ie).concat(i)}};function ze(e,t){return e._handlers&&e._handlers[t]||Ie}function Ve(e,t,i){if(e.removeEventListener)e.removeEventListener(t,i,!1);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var n=e._handlers,f=n&&n[t];if(f){var M=ie(f,i);M>-1&&(n[t]=f.slice(0,M).concat(f.slice(M+1)))}}}function De(e,t){var i=ze(e,t);if(!i.length)return;for(var n=Array.prototype.slice.call(arguments,2),f=0;f<i.length;++f)i[f].apply(null,n)}function Me(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),De(e,i||t.type,e,t),ye(t)||t.codemirrorIgnore}function be(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var i=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)ie(i,t[n])==-1&&i.push(t[n])}function ve(e,t){return ze(e,t).length>0}function ge(e){e.prototype.on=function(t,i){Re(this,t,i)},e.prototype.off=function(t,i){Ve(this,t,i)}}function le(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ue(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ye(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function xe(e){le(e),ue(e)}function we(e){return e.target||e.srcElement}function ke(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),o&&e.ctrlKey&&t==1&&(t=3),t}var We=function(){if(G&&B<9)return!1;var e=d("div");return"draggable"in e||"dragDrop"in e}(),Je;function Qe(e){if(Je==null){var t=d("span","\u200B");p(e,d("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Je=t.offsetWidth<=1&&t.offsetHeight>2&&!(G&&B<8))}var i=Je?d("span","\u200B"):d("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var Ze;function bt(e){if(Ze!=null)return Ze;var t=p(e,document.createTextNode("A\u062EA")),i=l(t,0,1).getBoundingClientRect(),n=l(t,1,2).getBoundingClientRect();return _(e),!i||i.left==i.right?!1:Ze=n.right-i.right<3}var yt=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],n=e.length;t<=n;){var f=e.indexOf(`
|
|
`,t);f==-1&&(f=e.length);var M=e.slice(t,e.charAt(f-1)=="\r"?f-1:f),z=M.indexOf("\r");z!=-1?(i.push(M.slice(0,z)),t+=z+1):(i.push(M),t=f+1)}return i}:function(e){return e.split(/\r\n?|\n/)},lt=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(i){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},wt=function(){var e=d("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),xt=null;function Ct(e){if(xt!=null)return xt;var t=p(e,d("span","x")),i=t.getBoundingClientRect(),n=l(t,0,1).getBoundingClientRect();return xt=Math.abs(i.left-n.left)>1}var Mt={},Ot={};function Lt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Mt[e]=t}function gt(e,t){Ot[e]=t}function je(e){if(typeof e=="string"&&Ot.hasOwnProperty(e))e=Ot[e];else if(e&&typeof e.name=="string"&&Ot.hasOwnProperty(e.name)){var t=Ot[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 je("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return je("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function rt(e,t){t=je(t);var i=Mt[t.name];if(!i)return rt(e,"text/plain");var n=i(e,t);if(it.hasOwnProperty(t.name)){var f=it[t.name];for(var M in f){if(!f.hasOwnProperty(M))continue;n.hasOwnProperty(M)&&(n["_"+M]=n[M]),n[M]=f[M]}}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var z in t.modeProps)n[z]=t.modeProps[z];return n}var it={};function et(e,t){var i=it.hasOwnProperty(e)?it[e]:it[e]={};T(t,i)}function Tt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var n in t){var f=t[n];f instanceof Array&&(f=f.concat([])),i[n]=f}return i}function kt(e,t){for(var i;e.innerMode&&!(i=e.innerMode(t),!i||i.mode==e);)t=i.state,e=i.mode;return i||{mode:e,state:t}}function Dt(e,t,i){return e.startState?e.startState(t,i):!0}var vt=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};vt.prototype.eol=function(){return this.pos>=this.string.length},vt.prototype.sol=function(){return this.pos==this.lineStart},vt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},vt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},vt.prototype.eat=function(e){var t=this.string.charAt(this.pos),i;if(typeof e=="string"?i=t==e:i=t&&(e.test?e.test(t):e(t)),i)return++this.pos,t},vt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},vt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},vt.prototype.skipToEnd=function(){this.pos=this.string.length},vt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},vt.prototype.backUp=function(e){this.pos-=e},vt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=K(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?K(this.string,this.lineStart,this.tabSize):0)},vt.prototype.indentation=function(){return K(this.string,null,this.tabSize)-(this.lineStart?K(this.string,this.lineStart,this.tabSize):0)},vt.prototype.match=function(e,t,i){if(typeof e=="string"){var n=function(z){return i?z.toLowerCase():z},f=this.string.substr(this.pos,e.length);if(n(f)==n(e))return t!==!1&&(this.pos+=e.length),!0}else{var M=this.string.slice(this.pos).match(e);return M&&M.index>0?null:(M&&t!==!1&&(this.pos+=M[0].length),M)}},vt.prototype.current=function(){return this.string.slice(this.start,this.pos)},vt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},vt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},vt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function dt(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 i=e;!i.lines;)for(var n=0;;++n){var f=i.children[n],M=f.chunkSize();if(t<M){i=f;break}t-=M}return i.lines[t]}function Vt(e,t,i){var n=[],f=t.line;return e.iter(t.line,i.line+1,function(M){var z=M.text;f==i.line&&(z=z.slice(0,i.ch)),f==t.line&&(z=z.slice(t.ch)),n.push(z),++f}),n}function sn(e,t,i){var n=[];return e.iter(t,i,function(f){n.push(f.text)}),n}function gn(e,t){var i=t-e.height;if(i)for(var n=e;n;n=n.parent)n.height+=i}function Kt(e){if(e.parent==null)return null;for(var t=e.parent,i=ie(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var f=0;!(n.children[f]==t);++f)i+=n.children[f].chunkSize();return i+t.first}function vn(e,t){var i=e.first;e:do{for(var n=0;n<e.children.length;++n){var f=e.children[n],M=f.height;if(t<M){e=f;continue e}t-=M,i+=f.chunkSize()}return i}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 i+z}function Mn(e,t){return t>=e.first&&t<e.first+e.size}function Wn(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function $e(e,t,i){if(i===void 0&&(i=null),!(this instanceof $e))return new $e(e,t,i);this.line=e,this.ch=t,this.sticky=i}function ct(e,t){return e.line-t.line||e.ch-t.ch}function Jt(e,t){return e.sticky==t.sticky&&ct(e,t)==0}function hn(e){return $e(e.line,e.ch)}function _n(e,t){return ct(e,t)<0?t:e}function cn(e,t){return ct(e,t)<0?e:t}function V(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function C(e,t){if(t.line<e.first)return $e(e.first,0);var i=e.first+e.size-1;return t.line>i?$e(i,dt(e,i).text.length):L(t,dt(e,t.line).text.length)}function L(e,t){var i=e.ch;return i==null||i>t?$e(e.line,t):i<0?$e(e.line,0):e}function W(e,t){for(var i=[],n=0;n<t.length;n++)i[n]=C(e,t[n]);return i}var te=function(e,t){this.state=e,this.lookAhead=t},X=function(e,t,i,n){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};X.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},X.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}},X.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},X.fromSaved=function(e,t,i){return t instanceof te?new X(e,Tt(e.mode,t.state),i,t.lookAhead):new X(e,Tt(e.mode,t),i)},X.prototype.save=function(e){var t=e!==!1?Tt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new te(t,this.maxLookAhead):t};function Oe(e,t,i,n){var f=[e.state.modeGen],M={};In(e,t.text,e.doc.mode,i,function(de,Ce){return f.push(de,Ce)},M,n);for(var z=i.state,q=function(de){i.baseTokens=f;var Ce=e.state.overlays[de],Ae=1,Fe=0;i.state=!0,In(e,t.text,Ce.mode,i,function(Ne,Xe){for(var at=Ae;Fe<Ne;){var pt=f[Ae];pt>Ne&&f.splice(Ae,1,Ne,f[Ae+1],pt),Ae+=2,Fe=Math.min(Ne,pt)}if(!Xe)return;if(Ce.opaque)f.splice(at,Ae-at,Ne,"overlay "+Xe),Ae=at+2;else for(;at<Ae;at+=2){var _t=f[at+1];f[at+1]=(_t?_t+" ":"")+"overlay "+Xe}},M),i.state=z,i.baseTokens=null,i.baseTokenPos=1},ee=0;ee<e.state.overlays.length;++ee)q(ee);return{styles:f,classes:M.bgClass||M.textClass?M:null}}function Ye(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=ft(e,Kt(t)),f=t.text.length>e.options.maxHighlightLength&&Tt(e.doc.mode,n.state),M=Oe(e,t,n);f&&(n.state=f),t.stateAfter=n.save(!f),t.styles=M.styles,M.classes?t.styleClasses=M.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function ft(e,t,i){var n=e.doc,f=e.display;if(!n.mode.startState)return new X(n,!0,t);var M=Tn(e,t,i),z=M>n.first&&dt(n,M-1).stateAfter,q=z?X.fromSaved(n,z,M):new X(n,Dt(n.mode),M);return n.iter(M,t,function(ee){At(e,ee.text,q);var de=q.line;ee.stateAfter=de==t-1||de%5==0||de>=f.viewFrom&&de<f.viewTo?q.save():null,q.nextLine()}),i&&(n.modeFrontier=q.line),q}function At(e,t,i,n){var f=e.doc.mode,M=new vt(t,e.options.tabSize,i);for(M.start=M.pos=n||0,t==""&&qe(f,i.state);!M.eol();)Pt(f,M,i.state),M.start=M.pos}function qe(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var i=kt(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}function Pt(e,t,i,n){for(var f=0;f<10;f++){n&&(n[0]=kt(e,i).mode);var M=e.token(t,i);if(t.pos>t.start)return M}throw new Error("Mode "+e.name+" failed to advance stream.")}var Ft=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function fn(e,t,i,n){var f=e.doc,M=f.mode,z;t=C(f,t);var q=dt(f,t.line),ee=ft(e,t.line,i),de=new vt(q.text,e.options.tabSize,ee),Ce;for(n&&(Ce=[]);(n||de.pos<t.ch)&&!de.eol();)de.start=de.pos,z=Pt(M,de,ee.state),n&&Ce.push(new Ft(de,z,Tt(f.mode,ee.state)));return n?Ce:new Ft(de,z,ee.state)}function Nn(e,t){if(e)for(;;){var i=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;e=e.slice(0,i.index)+e.slice(i.index+i[0].length);var n=i[1]?"bgClass":"textClass";t[n]==null?t[n]=i[2]:new RegExp("(?:^|\\s)"+i[2]+"(?:$|\\s)").test(t[n])||(t[n]+=" "+i[2])}return e}function In(e,t,i,n,f,M,z){var q=i.flattenSpans;q==null&&(q=e.options.flattenSpans);var ee=0,de=null,Ce=new vt(t,e.options.tabSize,n),Ae,Fe=e.options.addModeClass&&[null];for(t==""&&Nn(qe(i,n.state),M);!Ce.eol();){if(Ce.pos>e.options.maxHighlightLength?(q=!1,z&&At(e,t,n,Ce.pos),Ce.pos=t.length,Ae=null):Ae=Nn(Pt(i,Ce,n.state,Fe),M),Fe){var Ne=Fe[0].name;Ne&&(Ae="m-"+(Ae?Ne+" "+Ae:Ne))}if(!q||de!=Ae){for(;ee<Ce.start;)ee=Math.min(Ce.start,ee+5e3),f(ee,de);de=Ae}Ce.start=Ce.pos}for(;ee<Ce.pos;){var Xe=Math.min(Ce.pos,ee+5e3);f(Xe,de),ee=Xe}}function Tn(e,t,i){for(var n,f,M=e.doc,z=i?-1:t-(e.doc.mode.innerMode?1e3:100),q=t;q>z;--q){if(q<=M.first)return M.first;var ee=dt(M,q-1),de=ee.stateAfter;if(de&&(!i||q+(de instanceof te?de.lookAhead:0)<=M.modeFrontier))return q;var Ce=K(ee.text,null,e.options.tabSize);(f==null||n>Ce)&&(f=q-1,n=Ce)}return f}function ei(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var i=e.first,n=t-1;n>i;n--){var f=dt(e,n).stateAfter;if(f&&(!(f instanceof te)||n+f.lookAhead<t)){i=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}var _i=!1,Ht=!1;function Bt(){_i=!0}function Gt(){Ht=!0}function Yt(e,t,i){this.marker=e,this.from=t,this.to=i}function Qt(e,t){if(e)for(var i=0;i<e.length;++i){var n=e[i];if(n.marker==t)return n}}function tn(e,t){for(var i,n=0;n<e.length;++n)e[n]!=t&&(i||(i=[])).push(e[n]);return i}function bn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Dn(e,t,i){var n;if(e)for(var f=0;f<e.length;++f){var M=e[f],z=M.marker,q=M.from==null||(z.inclusiveLeft?M.from<=t:M.from<t);if(q||M.from==t&&z.type=="bookmark"&&(!i||!M.marker.insertLeft)){var ee=M.to==null||(z.inclusiveRight?M.to>=t:M.to>t);(n||(n=[])).push(new Yt(z,M.from,ee?null:M.to))}}return n}function Un(e,t,i){var n;if(e)for(var f=0;f<e.length;++f){var M=e[f],z=M.marker,q=M.to==null||(z.inclusiveRight?M.to>=t:M.to>t);if(q||M.from==t&&z.type=="bookmark"&&(!i||M.marker.insertLeft)){var ee=M.from==null||(z.inclusiveLeft?M.from<=t:M.from<t);(n||(n=[])).push(new Yt(z,ee?null:M.from-t,M.to==null?null:M.to-t))}}return n}function Sn(e,t){if(t.full)return null;var i=Mn(e,t.from.line)&&dt(e,t.from.line).markedSpans,n=Mn(e,t.to.line)&&dt(e,t.to.line).markedSpans;if(!i&&!n)return null;var f=t.from.ch,M=t.to.ch,z=ct(t.from,t.to)==0,q=Dn(i,f,z),ee=Un(n,M,z),de=t.text.length==1,Ce=Z(t.text).length+(de?f:0);if(q)for(var Ae=0;Ae<q.length;++Ae){var Fe=q[Ae];if(Fe.to==null){var Ne=Qt(ee,Fe.marker);Ne?de&&(Fe.to=Ne.to==null?null:Ne.to+Ce):Fe.to=f}}if(ee)for(var Xe=0;Xe<ee.length;++Xe){var at=ee[Xe];if(at.to!=null&&(at.to+=Ce),at.from==null){var pt=Qt(q,at.marker);pt||(at.from=Ce,de&&(q||(q=[])).push(at))}else at.from+=Ce,de&&(q||(q=[])).push(at)}q&&(q=Fn(q)),ee&&ee!=q&&(ee=Fn(ee));var _t=[q];if(!de){var St=t.text.length-2,Et;if(St>0&&q)for(var Rt=0;Rt<q.length;++Rt)q[Rt].to==null&&(Et||(Et=[])).push(new Yt(q[Rt].marker,null,null));for(var jt=0;jt<St;++jt)_t.push(Et);_t.push(ee)}return _t}function Fn(e){for(var t=0;t<e.length;++t){var i=e[t];i.from!=null&&i.from==i.to&&i.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function ti(e,t,i){var n=null;if(e.iter(t.line,i.line+1,function(Ne){if(Ne.markedSpans)for(var Xe=0;Xe<Ne.markedSpans.length;++Xe){var at=Ne.markedSpans[Xe].marker;at.readOnly&&(!n||ie(n,at)==-1)&&(n||(n=[])).push(at)}}),!n)return null;for(var f=[{from:t,to:i}],M=0;M<n.length;++M)for(var z=n[M],q=z.find(0),ee=0;ee<f.length;++ee){var de=f[ee];if(ct(de.to,q.from)<0||ct(de.from,q.to)>0)continue;var Ce=[ee,1],Ae=ct(de.from,q.from),Fe=ct(de.to,q.to);(Ae<0||!z.inclusiveLeft&&!Ae)&&Ce.push({from:de.from,to:q.from}),(Fe>0||!z.inclusiveRight&&!Fe)&&Ce.push({from:q.to,to:de.to}),f.splice.apply(f,Ce),ee+=Ce.length-3}return f}function Ei(e){var t=e.markedSpans;if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.detachLine(e);e.markedSpans=null}function ni(e,t){if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}function ln(e){return e.inclusiveLeft?-1:0}function zt(e){return e.inclusiveRight?1:0}function wn(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var n=e.find(),f=t.find(),M=ct(n.from,f.from)||ln(e)-ln(t);if(M)return-M;var z=ct(n.to,f.to)||zt(e)-zt(t);return z||t.id-e.id}function Xt(e,t){var i=Ht&&e.markedSpans,n;if(i)for(var f=void 0,M=0;M<i.length;++M)f=i[M],f.marker.collapsed&&(t?f.from:f.to)==null&&(!n||wn(n,f.marker)<0)&&(n=f.marker);return n}function nn(e){return Xt(e,!0)}function rn(e){return Xt(e,!1)}function ii(e,t){var i=Ht&&e.markedSpans,n;if(i)for(var f=0;f<i.length;++f){var M=i[f];M.marker.collapsed&&(M.from==null||M.from<t)&&(M.to==null||M.to>t)&&(!n||wn(n,M.marker)<0)&&(n=M.marker)}return n}function kn(e,t,i,n,f){var M=dt(e,t),z=Ht&&M.markedSpans;if(z)for(var q=0;q<z.length;++q){var ee=z[q];if(!ee.marker.collapsed)continue;var de=ee.marker.find(0),Ce=ct(de.from,i)||ln(ee.marker)-ln(f),Ae=ct(de.to,n)||zt(ee.marker)-zt(f);if(Ce>=0&&Ae<=0||Ce<=0&&Ae>=0)continue;if(Ce<=0&&(ee.marker.inclusiveRight&&f.inclusiveLeft?ct(de.to,i)>=0:ct(de.to,i)>0)||Ce>=0&&(ee.marker.inclusiveRight&&f.inclusiveLeft?ct(de.from,n)<=0:ct(de.from,n)<0))return!0}}function en(e){for(var t;t=nn(e);)e=t.find(-1,!0).line;return e}function xi(e){for(var t;t=rn(e);)e=t.find(1,!0).line;return e}function Qn(e){for(var t,i;t=rn(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function Ii(e,t){var i=dt(e,t),n=en(i);return i==n?t:Kt(n)}function wi(e,t){if(t>e.lastLine())return t;var i=dt(e,t),n;if(!Ti(e,i))return t;for(;n=rn(i);)i=n.find(1,!0).line;return Kt(i)+1}function Ti(e,t){var i=Ht&&t.markedSpans;if(i)for(var n=void 0,f=0;f<i.length;++f){if(n=i[f],!n.marker.collapsed)continue;if(n.from==null)return!0;if(n.marker.widgetNode)continue;if(n.from==0&&n.marker.inclusiveLeft&&Mi(e,t,n))return!0}}function Mi(e,t,i){if(i.to==null){var n=i.marker.find(1,!0);return Mi(e,n.line,Qt(n.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var f=void 0,M=0;M<t.markedSpans.length;++M)if(f=t.markedSpans[M],f.marker.collapsed&&!f.marker.widgetNode&&f.from==i.to&&(f.to==null||f.to!=i.from)&&(f.marker.inclusiveLeft||i.marker.inclusiveRight)&&Mi(e,t,f))return!0}function gi(e){e=en(e);for(var t=0,i=e.parent,n=0;n<i.lines.length;++n){var f=i.lines[n];if(f==e)break;t+=f.height}for(var M=i.parent;M;i=M,M=i.parent)for(var z=0;z<M.children.length;++z){var q=M.children[z];if(q==i)break;t+=q.height}return t}function Ni(e){if(e.height==0)return 0;for(var t=e.text.length,i,n=e;i=nn(n);){var f=i.find(0,!0);n=f.from.line,t+=f.from.ch-f.to.ch}for(n=e;i=rn(n);){var M=i.find(0,!0);t-=n.text.length-M.from.ch,n=M.to.line,t+=n.text.length-M.to.ch}return t}function Ui(e){var t=e.display,i=e.doc;t.maxLine=dt(i,i.first),t.maxLineLength=Ni(t.maxLine),t.maxLineChanged=!0,i.iter(function(n){var f=Ni(n);f>t.maxLineLength&&(t.maxLineLength=f,t.maxLine=n)})}var ci=function(e,t,i){this.text=e,ni(this,t),this.height=i?i(this):1};ci.prototype.lineNo=function(){return Kt(this)},ge(ci);function Yi(e,t,i,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Ei(e),ni(e,i);var f=n?n(e):1;f!=e.height&&gn(e,f)}function It(e){e.parent=null,Ei(e)}var Wt={},Nt={};function $t(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?Nt:Wt;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function on(e,t){var i=g("span",null,null,k?"padding-right: .1px":null),n={pre:g("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var f=0;f<=(t.rest?t.rest.length:0);f++){var M=f?t.rest[f-1]:t.line,z=void 0;n.pos=0,n.addToken=an,bt(e.display.measure)&&(z=ht(M,e.doc.direction))&&(n.addToken=$n(n.addToken,z)),n.map=[];var q=t!=e.display.externalMeasured&&Kt(M);vi(M,n,Ye(e,M,q)),M.styleClasses&&(M.styleClasses.bgClass&&(n.bgClass=j(M.styleClasses.bgClass,n.bgClass||"")),M.styleClasses.textClass&&(n.textClass=j(M.styleClasses.textClass,n.textClass||""))),n.map.length==0&&n.map.push(0,0,n.content.appendChild(Qe(e.display.measure))),f==0?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(k){var ee=n.content.lastChild;(/\bcm-tab\b/.test(ee.className)||ee.querySelector&&ee.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return De(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=j(n.pre.className,n.textClass||"")),n}function En(e){var t=d("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function an(e,t,i,n,f,M,z){if(!t)return;var q=e.splitSpaces?Rn(t,e.trailingSpace):t,ee=e.cm.state.specialChars,de=!1,Ce;if(!ee.test(t))e.col+=t.length,Ce=document.createTextNode(q),e.map.push(e.pos,e.pos+t.length,Ce),G&&B<9&&(de=!0),e.pos+=t.length;else{Ce=document.createDocumentFragment();for(var Ae=0;;){ee.lastIndex=Ae;var Fe=ee.exec(t),Ne=Fe?Fe.index-Ae:t.length-Ae;if(Ne){var Xe=document.createTextNode(q.slice(Ae,Ae+Ne));G&&B<9?Ce.appendChild(d("span",[Xe])):Ce.appendChild(Xe),e.map.push(e.pos,e.pos+Ne,Xe),e.col+=Ne,e.pos+=Ne}if(!Fe)break;Ae+=Ne+1;var at=void 0;if(Fe[0]==" "){var pt=e.cm.options.tabSize,_t=pt-e.col%pt;at=Ce.appendChild(d("span",oe(_t),"cm-tab")),at.setAttribute("role","presentation"),at.setAttribute("cm-text"," "),e.col+=_t}else Fe[0]=="\r"||Fe[0]==`
|
|
`?(at=Ce.appendChild(d("span",Fe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),at.setAttribute("cm-text",Fe[0]),e.col+=1):(at=e.cm.options.specialCharPlaceholder(Fe[0]),at.setAttribute("cm-text",Fe[0]),G&&B<9?Ce.appendChild(d("span",[at])):Ce.appendChild(at),e.col+=1);e.map.push(e.pos,e.pos+1,at),e.pos++}}if(e.trailingSpace=q.charCodeAt(t.length-1)==32,i||n||f||de||M||z){var St=i||"";n&&(St+=n),f&&(St+=f);var Et=d("span",[Ce],St,M);if(z)for(var Rt in z)z.hasOwnProperty(Rt)&&Rt!="style"&&Rt!="class"&&Et.setAttribute(Rt,z[Rt]);return e.content.appendChild(Et)}e.content.appendChild(Ce)}function Rn(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,n="",f=0;f<e.length;f++){var M=e.charAt(f);M==" "&&i&&(f==e.length-1||e.charCodeAt(f+1)==32)&&(M="\xA0"),n+=M,i=M==" "}return n}function $n(e,t){return function(i,n,f,M,z,q,ee){f=f?f+" cm-force-border":"cm-force-border";for(var de=i.pos,Ce=de+n.length;;){for(var Ae=void 0,Fe=0;Fe<t.length&&!(Ae=t[Fe],Ae.to>de&&Ae.from<=de);Fe++);if(Ae.to>=Ce)return e(i,n,f,M,z,q,ee);e(i,n.slice(0,Ae.to-de),f,M,null,q,ee),M=null,n=n.slice(Ae.to-de),de=Ae.to}}}function Zt(e,t,i,n){var f=!n&&i.widgetNode;f&&e.map.push(e.pos,e.pos+t,f),!n&&e.cm.display.input.needsContentAttribute&&(f||(f=e.content.appendChild(document.createElement("span"))),f.setAttribute("cm-marker",i.id)),f&&(e.cm.display.input.setUneditable(f),e.content.appendChild(f)),e.pos+=t,e.trailingSpace=!1}function vi(e,t,i){var n=e.markedSpans,f=e.text,M=0;if(!n){for(var z=1;z<i.length;z+=2)t.addToken(t,f.slice(M,M=i[z]),$t(i[z+1],t.cm.options));return}for(var q=f.length,ee=0,de=1,Ce="",Ae,Fe,Ne=0,Xe,at,pt,_t,St;;){if(Ne==ee){Xe=at=pt=Fe="",St=null,_t=null,Ne=Infinity;for(var Et=[],Rt=void 0,jt=0;jt<n.length;++jt){var Ut=n[jt],qt=Ut.marker;if(qt.type=="bookmark"&&Ut.from==ee&&qt.widgetNode)Et.push(qt);else if(Ut.from<=ee&&(Ut.to==null||Ut.to>ee||qt.collapsed&&Ut.to==ee&&Ut.from==ee)){if(Ut.to!=null&&Ut.to!=ee&&Ne>Ut.to&&(Ne=Ut.to,at=""),qt.className&&(Xe+=" "+qt.className),qt.css&&(Fe=(Fe?Fe+";":"")+qt.css),qt.startStyle&&Ut.from==ee&&(pt+=" "+qt.startStyle),qt.endStyle&&Ut.to==Ne&&(Rt||(Rt=[])).push(qt.endStyle,Ut.to),qt.title&&((St||(St={})).title=qt.title),qt.attributes)for(var Cn in qt.attributes)(St||(St={}))[Cn]=qt.attributes[Cn];qt.collapsed&&(!_t||wn(_t.marker,qt)<0)&&(_t=Ut)}else Ut.from>ee&&Ne>Ut.from&&(Ne=Ut.from)}if(Rt)for(var Xn=0;Xn<Rt.length;Xn+=2)Rt[Xn+1]==Ne&&(at+=" "+Rt[Xn]);if(!_t||_t.from==ee)for(var An=0;An<Et.length;++An)Zt(t,0,Et[An]);if(_t&&(_t.from||0)==ee){if(Zt(t,(_t.to==null?q+1:_t.to)-ee,_t.marker,_t.from==null),_t.to==null)return;_t.to==ee&&(_t=!1)}}if(ee>=q)break;for(var mi=Math.min(q,Ne);;){if(Ce){var li=ee+Ce.length;if(!_t){var Bn=li>mi?Ce.slice(0,mi-ee):Ce;t.addToken(t,Bn,Ae?Ae+Xe:Xe,pt,ee+Bn.length==Ne?at:"",Fe,St)}if(li>=mi){Ce=Ce.slice(mi-ee),ee=mi;break}ee=li,pt=""}Ce=f.slice(M,M=i[de++]),Ae=$t(i[de++],t.cm.options)}}}function pn(e,t,i){this.line=t,this.rest=Qn(t),this.size=this.rest?Kt(Z(this.rest))-i+1:1,this.node=this.text=null,this.hidden=Ti(e,t)}function Kn(e,t,i){for(var n=[],f,M=t;M<i;M=f){var z=new pn(e.doc,dt(e.doc,M),M);f=M+z.size,n.push(z)}return n}var Gn=null;function hi(e){Gn?Gn.ops.push(e):e.ownsGroup=Gn={ops:[e],delayedCallbacks:[]}}function ma(e){var t=e.delayedCallbacks,i=0;do{for(;i<t.length;i++)t[i].call(null);for(var n=0;n<e.ops.length;n++){var f=e.ops[n];if(f.cursorActivityHandlers)for(;f.cursorActivityCalled<f.cursorActivityHandlers.length;)f.cursorActivityHandlers[f.cursorActivityCalled++].call(null,f.cm)}}while(i<t.length)}function mn(e,t){var i=e.ownsGroup;if(!i)return;try{ma(i)}finally{Gn=null,t(i)}}var un=null;function dn(e,t){var i=ze(e,t);if(!i.length)return;var n=Array.prototype.slice.call(arguments,2),f;Gn?f=Gn.delayedCallbacks:un?f=un:(f=un=[],setTimeout(fi,0));for(var M=function(q){f.push(function(){return i[q].apply(null,n)})},z=0;z<i.length;++z)M(z)}function fi(){var e=un;un=null;for(var t=0;t<e.length;++t)e[t]()}function Fi(e,t,i,n){for(var f=0;f<t.changes.length;f++){var M=t.changes[f];M=="text"?ga(e,t):M=="gutter"?to(e,t,i,n):M=="class"?va(e,t):M=="widget"&&Ms(e,t,n)}t.changes=null}function Bi(e){return e.node==e.text&&(e.node=d("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),G&&B<8&&(e.node.style.zIndex=2)),e.node}function xr(e,t){var i=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(i&&(i+=" CodeMirror-linebackground"),t.background)i?t.background.className=i:(t.background.parentNode.removeChild(t.background),t.background=null);else if(i){var n=Bi(t);t.background=n.insertBefore(d("div",null,i),n.firstChild),e.display.input.setUneditable(t.background)}}function Vr(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):on(e,t)}function ga(e,t){var i=t.text.className,n=Vr(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,va(e,t)):i&&(t.text.className=i)}function va(e,t){xr(e,t),t.line.wrapClass?Bi(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function to(e,t,i,n){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 f=Bi(t);t.gutterBackground=d("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),f.insertBefore(t.gutterBackground,t.text)}var M=t.line.gutterMarkers;if(e.options.lineNumbers||M){var z=Bi(t),q=t.gutter=d("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(q),z.insertBefore(q,t.text),t.line.gutterClass&&(q.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!M||!M["CodeMirror-linenumbers"])&&(t.lineNumber=q.appendChild(d("div",Wn(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),M)for(var ee=0;ee<e.display.gutterSpecs.length;++ee){var de=e.display.gutterSpecs[ee].className,Ce=M.hasOwnProperty(de)&&M[de];Ce&&q.appendChild(d("div",[Ce],"CodeMirror-gutter-elt","left: "+n.gutterLeft[de]+"px; width: "+n.gutterWidth[de]+"px"))}}}function Ms(e,t,i){t.alignable&&(t.alignable=null);for(var n=S("CodeMirror-linewidget"),f=t.node.firstChild,M=void 0;f;f=M)M=f.nextSibling,n.test(f.className)&&t.node.removeChild(f);no(e,t,i)}function Ns(e,t,i,n){var f=Vr(e,t);return t.text=t.node=f.pre,f.bgClass&&(t.bgClass=f.bgClass),f.textClass&&(t.textClass=f.textClass),va(e,t),to(e,t,i,n),no(e,t,n),t.node}function no(e,t,i){if(io(e,t.line,t,i,!0),t.rest)for(var n=0;n<t.rest.length;n++)io(e,t.rest[n],t,i,!1)}function io(e,t,i,n,f){if(!t.widgets)return;for(var M=Bi(i),z=0,q=t.widgets;z<q.length;++z){var ee=q[z],de=d("div",[ee.node],"CodeMirror-linewidget"+(ee.className?" "+ee.className:""));ee.handleMouseEvents||de.setAttribute("cm-ignore-events","true"),Us(ee,de,i,n),e.display.input.setUneditable(de),f&&ee.above?M.insertBefore(de,i.gutter||i.text):M.appendChild(de),dn(ee,"redraw")}}function Us(e,t,i,n){if(e.noHScroll){(i.alignable||(i.alignable=[])).push(t);var f=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(f-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=f+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function Tr(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!E(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),p(t.display.measure,d("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function Di(e,t){for(var i=we(t);i!=e.wrapper;i=i.parentNode)if(!i||i.nodeType==1&&i.getAttribute("cm-ignore-events")=="true"||i.parentNode==e.sizer&&i!=e.mover)return!0}function Xr(e){return e.lineSpace.offsetTop}function ya(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function ro(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=p(e.measure,d("pre","x","CodeMirror-line-like")),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return!isNaN(n.left)&&!isNaN(n.right)&&(e.cachedPaddingH=n),n}function Ai(e){return pe-e.display.nativeBarWidth}function $i(e){return e.display.scroller.clientWidth-Ai(e)-e.display.barWidth}function ba(e){return e.display.scroller.clientHeight-Ai(e)-e.display.barHeight}function Fs(e,t,i){var n=e.options.lineWrapping,f=n&&$i(e);if(!t.measure.heights||n&&t.measure.width!=f){var M=t.measure.heights=[];if(n){t.measure.width=f;for(var z=t.text.firstChild.getClientRects(),q=0;q<z.length-1;q++){var ee=z[q],de=z[q+1];Math.abs(ee.bottom-de.bottom)>2&&M.push((ee.bottom+de.top)/2-i.top)}}M.push(i.bottom-i.top)}}function ao(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var f=0;f<e.rest.length;f++)if(Kt(e.rest[f])>i)return{map:e.measure.maps[f],cache:e.measure.caches[f],before:!0}}function Bs(e,t){t=en(t);var i=Kt(t),n=e.display.externalMeasured=new pn(e.doc,t,i);n.lineN=i;var f=n.built=on(e,n);return n.text=f.pre,p(e.display.lineMeasure,f.pre),n}function oo(e,t,i,n){return Ri(e,ar(e,t),i,n)}function _a(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Zi(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function ar(e,t){var i=Kt(t),n=_a(e,i);n&&!n.text?n=null:n&&n.changes&&(Fi(e,n,i,Sa(e)),e.curOp.forceUpdate=!0),n||(n=Bs(e,t));var f=ao(n,t,i);return{line:t,view:n,rect:null,map:f.map,cache:f.cache,before:f.before,hasHeights:!1}}function Ri(e,t,i,n,f){t.before&&(i=-1);var M=i+(n||""),z;return t.cache.hasOwnProperty(M)?z=t.cache[M]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Fs(e,t.view,t.rect),t.hasHeights=!0),z=Hs(e,t,i,n),z.bogus||(t.cache[M]=z)),{left:z.left,right:z.right,top:f?z.rtop:z.top,bottom:f?z.rbottom:z.bottom}}var so={left:0,right:0,top:0,bottom:0};function lo(e,t,i){for(var n,f,M,z,q,ee,de=0;de<e.length;de+=3)if(q=e[de],ee=e[de+1],t<q?(f=0,M=1,z="left"):t<ee?(f=t-q,M=f+1):(de==e.length-3||t==ee&&e[de+3]>t)&&(M=ee-q,f=M-1,t>=ee&&(z="right")),f!=null){if(n=e[de+2],q==ee&&i==(n.insertLeft?"left":"right")&&(z=i),i=="left"&&f==0)for(;de&&e[de-2]==e[de-3]&&e[de-1].insertLeft;)n=e[(de-=3)+2],z="left";if(i=="right"&&f==ee-q)for(;de<e.length-3&&e[de+3]==e[de+4]&&!e[de+5].insertLeft;)n=e[(de+=3)+2],z="right";break}return{node:n,start:f,end:M,collapse:z,coverStart:q,coverEnd:ee}}function js(e,t){var i=so;if(t=="left")for(var n=0;n<e.length&&!((i=e[n]).left!=i.right);n++);else for(var f=e.length-1;f>=0&&!((i=e[f]).left!=i.right);f--);return i}function Hs(e,t,i,n){var f=lo(t.map,i,n),M=f.node,z=f.start,q=f.end,ee=f.collapse,de;if(M.nodeType==3){for(var Ce=0;Ce<4;Ce++){for(;z&&Ge(t.line.text.charAt(f.coverStart+z));)--z;for(;f.coverStart+q<f.coverEnd&&Ge(t.line.text.charAt(f.coverStart+q));)++q;if(G&&B<9&&z==0&&q==f.coverEnd-f.coverStart?de=M.parentNode.getBoundingClientRect():de=js(l(M,z,q).getClientRects(),n),de.left||de.right||z==0)break;q=z,z=z-1,ee="right"}G&&B<11&&(de=Ws(e.display.measure,de))}else{z>0&&(ee=n="right");var Ae;e.options.lineWrapping&&(Ae=M.getClientRects()).length>1?de=Ae[n=="right"?Ae.length-1:0]:de=M.getBoundingClientRect()}if(G&&B<9&&!z&&(!de||!de.left&&!de.right)){var Fe=M.parentNode.getClientRects()[0];Fe?de={left:Fe.left,right:Fe.left+sr(e.display),top:Fe.top,bottom:Fe.bottom}:de=so}for(var Ne=de.top-t.rect.top,Xe=de.bottom-t.rect.top,at=(Ne+Xe)/2,pt=t.view.measure.heights,_t=0;_t<pt.length-1&&!(at<pt[_t]);_t++);var St=_t?pt[_t-1]:0,Et=pt[_t],Rt={left:(ee=="right"?de.right:de.left)-t.rect.left,right:(ee=="left"?de.left:de.right)-t.rect.left,top:St,bottom:Et};return!de.left&&!de.right&&(Rt.bogus=!0),e.options.singleCursorHeightPerLine||(Rt.rtop=Ne,Rt.rbottom=Xe),Rt}function Ws(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Ct(e))return t;var i=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*i,right:t.right*i,top:t.top*n,bottom:t.bottom*n}}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,_(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)uo(e.display.view[t])}function wr(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 b&&s?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function fo(){return b&&s?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Ea(e){var t=0;if(e.widgets)for(var i=0;i<e.widgets.length;++i)e.widgets[i].above&&(t+=Tr(e.widgets[i]));return t}function Yr(e,t,i,n,f){if(!f){var M=Ea(t);i.top+=M,i.bottom+=M}if(n=="line")return i;n||(n="local");var z=gi(t);if(n=="local"?z+=Xr(e.display):z-=e.display.viewOffset,n=="page"||n=="window"){var q=e.display.lineSpace.getBoundingClientRect();z+=q.top+(n=="window"?0:fo());var ee=q.left+(n=="window"?0:ho());i.left+=ee,i.right+=ee}return i.top+=z,i.bottom+=z,i}function po(e,t,i){if(i=="div")return t;var n=t.left,f=t.top;if(i=="page")n-=ho(),f-=fo();else if(i=="local"||!i){var M=e.display.sizer.getBoundingClientRect();n+=M.left,f+=M.top}var z=e.display.lineSpace.getBoundingClientRect();return{left:n-z.left,top:f-z.top}}function xa(e,t,i,n,f){return n||(n=dt(e.doc,t.line)),Yr(e,n,oo(e,n,t.ch,f),i)}function Ci(e,t,i,n,f,M){n=n||dt(e.doc,t.line),f||(f=ar(e,n));function z(Xe,at){var pt=Ri(e,f,Xe,at?"right":"left",M);return at?pt.left=pt.right:pt.right=pt.left,Yr(e,n,pt,i)}var q=ht(n,e.doc.direction),ee=t.ch,de=t.sticky;if(ee>=n.text.length?(ee=n.text.length,de="before"):ee<=0&&(ee=0,de="after"),!q)return z(de=="before"?ee-1:ee,de=="before");function Ce(Xe,at,pt){var _t=q[at],St=_t.level==1;return z(pt?Xe-1:Xe,St!=pt)}var Ae=st(q,ee,de),Fe=ot,Ne=Ce(ee,Ae,de=="before");return Fe!=null&&(Ne.other=Ce(ee,Fe,de!="before")),Ne}function mo(e,t){var i=0;t=C(e.doc,t),e.options.lineWrapping||(i=sr(e.display)*t.ch);var n=dt(e.doc,t.line),f=gi(n)+Xr(e.display);return{left:i,right:i,top:f,bottom:f+n.height}}function Ta(e,t,i,n,f){var M=$e(e,t,i);return M.xRel=f,n&&(M.outside=n),M}function wa(e,t,i){var n=e.doc;if(i+=e.display.viewOffset,i<0)return Ta(n.first,0,null,-1,-1);var f=vn(n,i),M=n.first+n.size-1;if(f>M)return Ta(n.first+n.size-1,dt(n,M).text.length,null,1,1);t<0&&(t=0);for(var z=dt(n,f);;){var q=Ks(e,z,f,t,i),ee=ii(z,q.ch+(q.xRel>0||q.outside>0?1:0));if(!ee)return q;var de=ee.find(1);if(de.line==f)return de;z=dt(n,f=de.line)}}function go(e,t,i,n){n-=Ea(t);var f=t.text.length,M=tt(function(z){return Ri(e,i,z-1).bottom<=n},f,0);return f=tt(function(z){return Ri(e,i,z).top>n},M,f),{begin:M,end:f}}function vo(e,t,i,n){i||(i=ar(e,t));var f=Yr(e,t,Ri(e,i,n),"line").top;return go(e,t,i,f)}function Ca(e,t,i,n){return e.bottom<=i?!1:e.top>i?!0:(n?e.left:e.right)>t}function Ks(e,t,i,n,f){f-=gi(t);var M=ar(e,t),z=Ea(t),q=0,ee=t.text.length,de=!0,Ce=ht(t,e.doc.direction);if(Ce){var Ae=(e.options.lineWrapping?zs:Gs)(e,t,i,M,Ce,n,f);de=Ae.level!=1,q=de?Ae.from:Ae.to-1,ee=de?Ae.to:Ae.from-1}var Fe=null,Ne=null,Xe=tt(function(jt){var Ut=Ri(e,M,jt);return Ut.top+=z,Ut.bottom+=z,Ca(Ut,n,f,!1)?(Ut.top<=f&&Ut.left<=n&&(Fe=jt,Ne=Ut),!0):!1},q,ee),at,pt,_t=!1;if(Ne){var St=n-Ne.left<Ne.right-n,Et=St==de;Xe=Fe+(Et?0:1),pt=Et?"after":"before",at=St?Ne.left:Ne.right}else{!de&&(Xe==ee||Xe==q)&&Xe++,pt=Xe==0?"after":Xe==t.text.length?"before":Ri(e,M,Xe-(de?1:0)).bottom+z<=f==de?"after":"before";var Rt=Ci(e,$e(i,Xe,pt),"line",t,M);at=Rt.left,_t=f<Rt.top?-1:f>=Rt.bottom?1:0}return Xe=Ue(t.text,Xe,1),Ta(i,Xe,pt,_t,n-at)}function Gs(e,t,i,n,f,M,z){var q=tt(function(Ae){var Fe=f[Ae],Ne=Fe.level!=1;return Ca(Ci(e,$e(i,Ne?Fe.to:Fe.from,Ne?"before":"after"),"line",t,n),M,z,!0)},0,f.length-1),ee=f[q];if(q>0){var de=ee.level!=1,Ce=Ci(e,$e(i,de?ee.from:ee.to,de?"after":"before"),"line",t,n);Ca(Ce,M,z,!0)&&Ce.top>z&&(ee=f[q-1])}return ee}function zs(e,t,i,n,f,M,z){var q=go(e,t,n,z),ee=q.begin,de=q.end;/\s/.test(t.text.charAt(de-1))&&de--;for(var Ce=null,Ae=null,Fe=0;Fe<f.length;Fe++){var Ne=f[Fe];if(Ne.from>=de||Ne.to<=ee)continue;var Xe=Ne.level!=1,at=Ri(e,n,Xe?Math.min(de,Ne.to)-1:Math.max(ee,Ne.from)).right,pt=at<M?M-at+1e9:at-M;(!Ce||Ae>pt)&&(Ce=Ne,Ae=pt)}return Ce||(Ce=f[f.length-1]),Ce.from<ee&&(Ce={from:ee,to:Ce.to,level:Ce.level}),Ce.to>de&&(Ce={from:Ce.from,to:de,level:Ce.level}),Ce}var Ji;function or(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Ji==null){Ji=d("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Ji.appendChild(document.createTextNode("x")),Ji.appendChild(d("br"));Ji.appendChild(document.createTextNode("x"))}p(e.measure,Ji);var i=Ji.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),_(e.measure),i||1}function sr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=d("span","xxxxxxxxxx"),i=d("pre",[t],"CodeMirror-line-like");p(e.measure,i);var n=t.getBoundingClientRect(),f=(n.right-n.left)/10;return f>2&&(e.cachedCharWidth=f),f||10}function Sa(e){for(var t=e.display,i={},n={},f=t.gutters.clientLeft,M=t.gutters.firstChild,z=0;M;M=M.nextSibling,++z){var q=e.display.gutterSpecs[z].className;i[q]=M.offsetLeft+M.clientLeft+f,n[q]=M.clientWidth}return{fixedPos:Oa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function Oa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function yo(e){var t=or(e.display),i=e.options.lineWrapping,n=i&&Math.max(5,e.display.scroller.clientWidth/sr(e.display)-3);return function(f){if(Ti(e.doc,f))return 0;var M=0;if(f.widgets)for(var z=0;z<f.widgets.length;z++)f.widgets[z].height&&(M+=f.widgets[z].height);return i?M+(Math.ceil(f.text.length/n)||1)*t:M+t}}function Aa(e){var t=e.doc,i=yo(e);t.iter(function(n){var f=i(n);f!=n.height&&gn(n,f)})}function Qi(e,t,i,n){var f=e.display;if(!i&&we(t).getAttribute("cm-not-content")=="true")return null;var M,z,q=f.lineSpace.getBoundingClientRect();try{M=t.clientX-q.left,z=t.clientY-q.top}catch(Ae){return null}var ee=wa(e,M,z),de;if(n&&ee.xRel>0&&(de=dt(e.doc,ee.line).text).length==ee.ch){var Ce=K(de,de.length,e.options.tabSize)-de.length;ee=$e(ee.line,Math.max(0,Math.round((M-ro(e.display).left)/sr(e.display))-Ce))}return ee}function Zi(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var i=e.display.view,n=0;n<i.length;n++)if(t-=i[n].size,t<0)return n}function oi(e,t,i,n){t==null&&(t=e.doc.first),i==null&&(i=e.doc.first+e.doc.size),n||(n=0);var f=e.display;if(n&&i<f.viewTo&&(f.updateLineNumbers==null||f.updateLineNumbers>t)&&(f.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=f.viewTo)Ht&&Ii(e.doc,t)<f.viewTo&&Hi(e);else if(i<=f.viewFrom)Ht&&wi(e.doc,i+n)>f.viewFrom?Hi(e):(f.viewFrom+=n,f.viewTo+=n);else if(t<=f.viewFrom&&i>=f.viewTo)Hi(e);else if(t<=f.viewFrom){var M=$r(e,i,i+n,1);M?(f.view=f.view.slice(M.index),f.viewFrom=M.lineN,f.viewTo+=n):Hi(e)}else if(i>=f.viewTo){var z=$r(e,t,t,-1);z?(f.view=f.view.slice(0,z.index),f.viewTo=z.lineN):Hi(e)}else{var q=$r(e,t,t,-1),ee=$r(e,i,i+n,1);q&&ee?(f.view=f.view.slice(0,q.index).concat(Kn(e,q.lineN,ee.lineN)).concat(f.view.slice(ee.index)),f.viewTo+=n):Hi(e)}var de=f.externalMeasured;de&&(i<de.lineN?de.lineN+=n:t<de.lineN+de.size&&(f.externalMeasured=null))}function ji(e,t,i){e.curOp.viewChanged=!0;var n=e.display,f=e.display.externalMeasured;if(f&&t>=f.lineN&&t<f.lineN+f.size&&(n.externalMeasured=null),t<n.viewFrom||t>=n.viewTo)return;var M=n.view[Zi(e,t)];if(M.node==null)return;var z=M.changes||(M.changes=[]);ie(z,i)==-1&&z.push(i)}function Hi(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function $r(e,t,i,n){var f=Zi(e,t),M,z=e.display.view;if(!Ht||i==e.doc.first+e.doc.size)return{index:f,lineN:i};for(var q=e.display.viewFrom,ee=0;ee<f;ee++)q+=z[ee].size;if(q!=t){if(n>0){if(f==z.length-1)return null;M=q+z[f].size-t,f++}else M=q-t;t+=M,i+=M}for(;Ii(e.doc,i)!=i;){if(f==(n<0?0:z.length-1))return null;i+=n*z[f-(n<0?1:0)].size,f+=n}return{index:f,lineN:i}}function Vs(e,t,i){var n=e.display,f=n.view;f.length==0||t>=n.viewTo||i<=n.viewFrom?(n.view=Kn(e,t,i),n.viewFrom=t):(n.viewFrom>t?n.view=Kn(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(Zi(e,t))),n.viewFrom=t,n.viewTo<i?n.view=n.view.concat(Kn(e,n.viewTo,i)):n.viewTo>i&&(n.view=n.view.slice(0,Zi(e,i)))),n.viewTo=i}function bo(e){for(var t=e.display.view,i=0,n=0;n<t.length;n++){var f=t[n];!f.hidden&&(!f.node||f.changes)&&++i}return i}function Cr(e){e.display.input.showSelection(e.display.input.prepareSelection())}function _o(e,t){t===void 0&&(t=!0);for(var i=e.doc,n={},f=n.cursors=document.createDocumentFragment(),M=n.selection=document.createDocumentFragment(),z=0;z<i.sel.ranges.length;z++){if(!t&&z==i.sel.primIndex)continue;var q=i.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)&&Eo(e,q.head,f),ee||Xs(e,q,M)}return n}function Eo(e,t,i){var n=Ci(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),f=i.appendChild(d("div","\xA0","CodeMirror-cursor"));if(f.style.left=n.left+"px",f.style.top=n.top+"px",f.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var M=i.appendChild(d("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));M.style.display="",M.style.left=n.other.left+"px",M.style.top=n.other.top+"px",M.style.height=(n.other.bottom-n.other.top)*.85+"px"}}function Jr(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,i){var n=e.display,f=e.doc,M=document.createDocumentFragment(),z=ro(e.display),q=z.left,ee=Math.max(n.sizerWidth,$i(e)-n.sizer.offsetLeft)-z.right,de=f.direction=="ltr";function Ce(Et,Rt,jt,Ut){Rt<0&&(Rt=0),Rt=Math.round(Rt),Ut=Math.round(Ut),M.appendChild(d("div",null,"CodeMirror-selected","position: absolute; left: "+Et+`px;
|
|
top: `+Rt+"px; width: "+(jt==null?ee-Et:jt)+`px;
|
|
height: `+(Ut-Rt)+"px"))}function Ae(Et,Rt,jt){var Ut=dt(f,Et),qt=Ut.text.length,Cn,Xn;function An(Bn,ui){return xa(e,$e(Et,Bn),"div",Ut,ui)}function mi(Bn,ui,Jn){var Hn=vo(e,Ut,null,Bn),jn=ui=="ltr"==(Jn=="after")?"left":"right",Ln=Jn=="after"?Hn.begin:Hn.end-(/\s/.test(Ut.text.charAt(Hn.end-1))?2:1);return An(Ln,jn)[jn]}var li=ht(Ut,f.direction);return nt(li,Rt||0,jt==null?qt:jt,function(Bn,ui,Jn,Hn){var jn=Jn=="ltr",Ln=An(Bn,jn?"left":"right"),di=An(ui-1,jn?"right":"left"),_r=Rt==null&&Bn==0,Xi=jt==null&&ui==qt,qn=Hn==0,Li=!li||Hn==li.length-1;if(di.top-Ln.top<=3){var Yn=(de?_r:Xi)&&qn,qa=(de?Xi:_r)&&Li,Pi=Yn?q:(jn?Ln:di).left,ir=qa?ee:(jn?di:Ln).right;Ce(Pi,Ln.top,ir-Pi,Ln.bottom)}else{var rr,ai,Er,eo;jn?(rr=de&&_r&&qn?q:Ln.left,ai=de?ee:mi(Bn,Jn,"before"),Er=de?q:mi(ui,Jn,"after"),eo=de&&Xi&&Li?ee:di.right):(rr=de?mi(Bn,Jn,"before"):q,ai=!de&&_r&&qn?ee:Ln.right,Er=!de&&Xi&&Li?q:di.left,eo=de?mi(ui,Jn,"after"):ee),Ce(rr,Ln.top,ai-rr,Ln.bottom),Ln.bottom<di.top&&Ce(q,Ln.bottom,null,di.top),Ce(Er,di.top,eo-Er,di.bottom)}(!Cn||Jr(Ln,Cn)<0)&&(Cn=Ln),Jr(di,Cn)<0&&(Cn=di),(!Xn||Jr(Ln,Xn)<0)&&(Xn=Ln),Jr(di,Xn)<0&&(Xn=di)}),{start:Cn,end:Xn}}var Fe=t.from(),Ne=t.to();if(Fe.line==Ne.line)Ae(Fe.line,Fe.ch,Ne.ch);else{var Xe=dt(f,Fe.line),at=dt(f,Ne.line),pt=en(Xe)==en(at),_t=Ae(Fe.line,Fe.ch,pt?Xe.text.length+1:null).end,St=Ae(Ne.line,pt?0:null,Ne.ch).start;pt&&(_t.top<St.top-2?(Ce(_t.right,_t.top,null,_t.bottom),Ce(q,St.top,St.left,St.bottom)):Ce(_t.right,_t.top,St.left-_t.right,_t.bottom)),_t.bottom<St.top&&Ce(q,_t.bottom,null,St.top)}i.appendChild(M)}function Ra(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var i=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||lr(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function xo(e){e.state.focused||(e.display.input.focus(),La(e))}function To(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,lr(e))},100)}function La(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(De(e,"focus",e,t),e.state.focused=!0,P(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()),Ra(e)}function lr(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(De(e,"blur",e,t),e.state.focused=!1,y(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Qr(e){for(var t=e.display,i=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var f=t.view[n],M=e.options.lineWrapping,z=void 0,q=0;if(f.hidden)continue;if(G&&B<8){var ee=f.node.offsetTop+f.node.offsetHeight;z=ee-i,i=ee}else{var de=f.node.getBoundingClientRect();z=de.bottom-de.top,!M&&f.text.firstChild&&(q=f.text.firstChild.getBoundingClientRect().right-de.left-1)}var Ce=f.line.height-z;if((Ce>.005||Ce<-.005)&&(gn(f.line,z),wo(f.line),f.rest))for(var Ae=0;Ae<f.rest.length;Ae++)wo(f.rest[Ae]);if(q>e.display.sizerWidth){var Fe=Math.ceil(q/sr(e.display));Fe>e.display.maxLineLength&&(e.display.maxLineLength=Fe,e.display.maxLine=f.line,e.display.maxLineChanged=!0)}}}function wo(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var i=e.widgets[t],n=i.node.parentNode;n&&(i.height=n.offsetHeight)}}function Zr(e,t,i){var n=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;n=Math.floor(n-Xr(e));var f=i&&i.bottom!=null?i.bottom:n+e.wrapper.clientHeight,M=vn(t,n),z=vn(t,f);if(i&&i.ensure){var q=i.ensure.from.line,ee=i.ensure.to.line;q<M?(M=q,z=vn(t,gi(dt(t,q))+e.wrapper.clientHeight)):Math.min(ee,t.lastLine())>=z&&(M=vn(t,gi(dt(t,ee))-e.wrapper.clientHeight),z=ee)}return{from:M,to:Math.max(z,M+1)}}function Ys(e,t){if(Me(e,"scrollCursorIntoView"))return;var i=e.display,n=i.sizer.getBoundingClientRect(),f=null;if(t.top+n.top<0?f=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(f=!1),f!=null&&!r){var M=d("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-i.viewOffset-Xr(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Ai(e)+i.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(M),M.scrollIntoView(f),e.display.lineSpace.removeChild(M)}}function $s(e,t,i,n){n==null&&(n=0);var f;!e.options.lineWrapping&&t==i&&(t=t.ch?$e(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,i=t.sticky=="before"?$e(t.line,t.ch+1,"before"):t);for(var M=0;M<5;M++){var z=!1,q=Ci(e,t),ee=!i||i==t?q:Ci(e,i);f={left:Math.min(q.left,ee.left),top:Math.min(q.top,ee.top)-n,right:Math.max(q.left,ee.left),bottom:Math.max(q.bottom,ee.bottom)+n};var de=Ia(e,f),Ce=e.doc.scrollTop,Ae=e.doc.scrollLeft;if(de.scrollTop!=null&&(Or(e,de.scrollTop),Math.abs(e.doc.scrollTop-Ce)>1&&(z=!0)),de.scrollLeft!=null&&(qi(e,de.scrollLeft),Math.abs(e.doc.scrollLeft-Ae)>1&&(z=!0)),!z)break}return f}function Js(e,t){var i=Ia(e,t);i.scrollTop!=null&&Or(e,i.scrollTop),i.scrollLeft!=null&&qi(e,i.scrollLeft)}function Ia(e,t){var i=e.display,n=or(e.display);t.top<0&&(t.top=0);var f=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,M=ba(e),z={};t.bottom-t.top>M&&(t.bottom=t.top+M);var q=e.doc.height+ya(i),ee=t.top<n,de=t.bottom>q-n;if(t.top<f)z.scrollTop=ee?0:t.top;else if(t.bottom>f+M){var Ce=Math.min(t.top,(de?q:t.bottom)-M);Ce!=f&&(z.scrollTop=Ce)}var Ae=e.options.fixedGutter?0:i.gutters.offsetWidth,Fe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-Ae,Ne=$i(e)-i.gutters.offsetWidth,Xe=t.right-t.left>Ne;return Xe&&(t.right=t.left+Ne),t.left<10?z.scrollLeft=0:t.left<Fe?z.scrollLeft=Math.max(0,t.left+Ae-(Xe?0:10)):t.right>Ne+Fe-3&&(z.scrollLeft=t.right+(Xe?0:10)-Ne),z}function Da(e,t){if(t==null)return;qr(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function ur(e){qr(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Sr(e,t,i){(t!=null||i!=null)&&qr(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Qs(e,t){qr(e),e.curOp.scrollToPos=t}function qr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=mo(e,t.from),n=mo(e,t.to);Co(e,i,n,t.margin)}}function Co(e,t,i,n){var f=Ia(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-n,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+n});Sr(e,f.scrollLeft,f.scrollTop)}function Or(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;N||Pa(e,{top:t}),So(e,t,!0),N&&Pa(e),Lr(e,100)}function So(e,t,i){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!i)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function qi(e,t,i,n){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n)return;e.doc.scrollLeft=t,Io(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function Ar(e){var t=e.display,i=t.gutters.offsetWidth,n=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?i:0,docHeight:n,scrollHeight:n+Ai(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var er=function(e,t,i){this.cm=i;var n=this.vert=d("div",[d("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),f=this.horiz=d("div",[d("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=f.tabIndex=-1,e(n),e(f),Re(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Re(f,"scroll",function(){f.clientWidth&&t(f.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,G&&B<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};er.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var f=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+f)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var M=e.viewWidth-e.barLeft-(i?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+M)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(n==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?n:0,bottom:t?n:0}},er.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},er.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},er.prototype.zeroWidthHack=function(){var e=o&&!u?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new J,this.disableVert=new J},er.prototype.enableZeroWidthBar=function(e,t,i){e.style.pointerEvents="auto";function n(){var f=e.getBoundingClientRect(),M=i=="vert"?document.elementFromPoint(f.right-1,(f.top+f.bottom)/2):document.elementFromPoint((f.right+f.left)/2,f.bottom-1);M!=e?e.style.pointerEvents="none":t.set(1e3,n)}t.set(1e3,n)},er.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Rr=function(){};Rr.prototype.update=function(){return{bottom:0,right:0}},Rr.prototype.setScrollLeft=function(){},Rr.prototype.setScrollTop=function(){},Rr.prototype.clear=function(){};function dr(e,t){t||(t=Ar(e));var i=e.display.barWidth,n=e.display.barHeight;Oo(e,t);for(var f=0;f<4&&i!=e.display.barWidth||n!=e.display.barHeight;f++)i!=e.display.barWidth&&e.options.lineWrapping&&Qr(e),Oo(e,Ar(e)),i=e.display.barWidth,n=e.display.barHeight}function Oo(e,t){var i=e.display,n=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=n.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=n.bottom)+"px",i.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=n.bottom+"px",i.scrollbarFiller.style.width=n.right+"px"):i.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=n.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var Ao={native:er,null:Rr};function Ro(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&y(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ao[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Re(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?qi(e,t):Or(e,t)},e),e.display.scrollbars.addClass&&P(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function tr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zs},hi(e.curOp)}function nr(e){var t=e.curOp;t&&mn(t,function(i){for(var n=0;n<i.ops.length;n++)i.ops[n].cm.curOp=null;qs(i)})}function qs(e){for(var t=e.ops,i=0;i<t.length;i++)el(t[i]);for(var n=0;n<t.length;n++)tl(t[n]);for(var f=0;f<t.length;f++)nl(t[f]);for(var M=0;M<t.length;M++)il(t[M]);for(var z=0;z<t.length;z++)rl(t[z])}function el(e){var t=e.cm,i=t.display;ol(t),e.updateMaxLine&&Ui(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<i.viewFrom||e.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new ea(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&ka(e.cm,e.update)}function nl(e){var t=e.cm,i=t.display;e.updatedDisplay&&Qr(t),e.barMeasure=Ar(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=oo(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+Ai(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-$i(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function il(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&qi(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==U();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&dr(t,e.barMeasure),e.updatedDisplay&&Na(t,e.barMeasure),e.selectionChanged&&Ra(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&xo(e.cm)}function rl(e){var t=e.cm,i=t.display,n=t.doc;if(e.updatedDisplay&&Lo(t,e.update),i.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(i.wheelStartX=i.wheelStartY=null),e.scrollTop!=null&&So(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&qi(t,e.scrollLeft,!0,!0),e.scrollToPos){var f=$s(t,C(n,e.scrollToPos.from),C(n,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,f)}var M=e.maybeHiddenMarkers,z=e.maybeUnhiddenMarkers;if(M)for(var q=0;q<M.length;++q)M[q].lines.length||De(M[q],"hide");if(z)for(var ee=0;ee<z.length;++ee)z[ee].lines.length&&De(z[ee],"unhide");i.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&De(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function pi(e,t){if(e.curOp)return t();tr(e);try{return t()}finally{nr(e)}}function zn(e,t){return function(){if(e.curOp)return t.apply(e,arguments);tr(e);try{return t.apply(e,arguments)}finally{nr(e)}}}function ri(e){return function(){if(this.curOp)return e.apply(this,arguments);tr(this);try{return e.apply(this,arguments)}finally{nr(this)}}}function Vn(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);tr(t);try{return e.apply(this,arguments)}finally{nr(t)}}}function Lr(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,I(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var i=+new Date+e.options.workTime,n=ft(e,t.highlightFrontier),f=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(M){if(n.line>=e.display.viewFrom){var z=M.styles,q=M.text.length>e.options.maxHighlightLength?Tt(t.mode,n.state):null,ee=Oe(e,M,n,!0);q&&(n.state=q),M.styles=ee.styles;var de=M.styleClasses,Ce=ee.classes;Ce?M.styleClasses=Ce:de&&(M.styleClasses=null);for(var Ae=!z||z.length!=M.styles.length||de!=Ce&&(!de||!Ce||de.bgClass!=Ce.bgClass||de.textClass!=Ce.textClass),Fe=0;!Ae&&Fe<z.length;++Fe)Ae=z[Fe]!=M.styles[Fe];Ae&&f.push(n.line),M.stateAfter=n.save(),n.nextLine()}else M.text.length<=e.options.maxHighlightLength&&At(e,M.text,n),M.stateAfter=n.line%5==0?n.save():null,n.nextLine();if(+new Date>i)return Lr(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),f.length&&pi(e,function(){for(var M=0;M<f.length;M++)ji(e,f[M],"text")})}var ea=function(e,t,i){var n=e.display;this.viewport=t,this.visible=Zr(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=$i(e),this.force=i,this.dims=Sa(e),this.events=[]};ea.prototype.signal=function(e,t){ve(e,t)&&this.events.push(arguments)},ea.prototype.finish=function(){for(var e=0;e<this.events.length;e++)De.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=Ai(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Ai(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=U();if(!t||!E(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&E(e.display.lineDiv,n.anchorNode)&&(i.anchorNode=n.anchorNode,i.anchorOffset=n.anchorOffset,i.focusNode=n.focusNode,i.focusOffset=n.focusOffset)}return i}function ll(e){if(!e||!e.activeElt||e.activeElt==U())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&E(document.body,e.anchorNode)&&E(document.body,e.focusNode)){var t=window.getSelection(),i=document.createRange();i.setEnd(e.anchorNode,e.anchorOffset),i.collapse(!1),t.removeAllRanges(),t.addRange(i),t.extend(e.focusNode,e.focusOffset)}}function ka(e,t){var i=e.display,n=e.doc;if(t.editorIsHidden)return Hi(e),!1;if(!t.force&&t.visible.from>=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&bo(e)==0)return!1;Do(e)&&(Hi(e),t.dims=Sa(e));var f=n.first+n.size,M=Math.max(t.visible.from-e.options.viewportMargin,n.first),z=Math.min(f,t.visible.to+e.options.viewportMargin);i.viewFrom<M&&M-i.viewFrom<20&&(M=Math.max(n.first,i.viewFrom)),i.viewTo>z&&i.viewTo-z<20&&(z=Math.min(f,i.viewTo)),Ht&&(M=Ii(e.doc,M),z=wi(e.doc,z));var q=M!=i.viewFrom||z!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Vs(e,M,z),i.viewOffset=gi(dt(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var ee=bo(e);if(!q&&ee==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var de=sl(e);return ee>4&&(i.lineDiv.style.display="none"),ul(e,i.updateLineNumbers,t.dims),ee>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,ll(de),_(i.cursorDiv),_(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,q&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Lr(e,400)),i.updateLineNumbers=null,!0}function Lo(e,t){for(var i=t.viewport,n=!0;;n=!1){if(!n||!e.options.lineWrapping||t.oldDisplayWidth==$i(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+ya(e.display)-ba(e),i.top)}),t.visible=Zr(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else n&&(t.visible=Zr(e.display,e.doc,i));if(!ka(e,t))break;Qr(e);var f=Ar(e);Cr(e),dr(e,f),Na(e,f),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Pa(e,t){var i=new ea(e,t);if(ka(e,i)){Qr(e),Lo(e,i);var n=Ar(e);Cr(e),dr(e,n),Na(e,n),i.finish()}}function ul(e,t,i){var n=e.display,f=e.options.lineNumbers,M=n.lineDiv,z=M.firstChild;function q(Xe){var at=Xe.nextSibling;return k&&o&&e.display.currentWheelTarget==Xe?Xe.style.display="none":Xe.parentNode.removeChild(Xe),at}for(var ee=n.view,de=n.viewFrom,Ce=0;Ce<ee.length;Ce++){var Ae=ee[Ce];if(!Ae.hidden)if(!Ae.node||Ae.node.parentNode!=M){var Fe=Ns(e,Ae,de,i);M.insertBefore(Fe,z)}else{for(;z!=Ae.node;)z=q(z);var Ne=f&&t!=null&&t<=de&&Ae.lineNumber;Ae.changes&&(ie(Ae.changes,"gutter")>-1&&(Ne=!1),Fi(e,Ae,de,i)),Ne&&(_(Ae.lineNumber),Ae.lineNumber.appendChild(document.createTextNode(Wn(e.options,de)))),z=Ae.node.nextSibling}de+=Ae.size}for(;z;)z=q(z)}function Ma(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+Ai(e)+"px"}function Io(e){var t=e.display,i=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var n=Oa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,f=t.gutters.offsetWidth,M=n+"px",z=0;z<i.length;z++)if(!i[z].hidden){e.options.fixedGutter&&(i[z].gutter&&(i[z].gutter.style.left=M),i[z].gutterBackground&&(i[z].gutterBackground.style.left=M));var q=i[z].alignable;if(q)for(var ee=0;ee<q.length;ee++)q[ee].style.left=M}e.options.fixedGutter&&(t.gutters.style.left=n+f+"px")}function Do(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=Wn(e.options,t.first+t.size-1),n=e.display;if(i.length!=n.lineNumChars){var f=n.measure.appendChild(d("div",[d("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),M=f.firstChild.offsetWidth,z=f.offsetWidth-M;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(M,n.lineGutter.offsetWidth-z)+1,n.lineNumWidth=n.lineNumInnerWidth+z,n.lineNumChars=n.lineNumInnerWidth?i.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",Ma(e.display),!0}return!1}function Ua(e,t){for(var i=[],n=!1,f=0;f<e.length;f++){var M=e[f],z=null;if(typeof M!="string"&&(z=M.style,M=M.className),M=="CodeMirror-linenumbers")if(t)n=!0;else continue;i.push({className:M,style:z})}return t&&!n&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function ko(e){var t=e.gutters,i=e.gutterSpecs;_(t),e.lineGutter=null;for(var n=0;n<i.length;++n){var f=i[n],M=f.className,z=f.style,q=t.appendChild(d("div",null,"CodeMirror-gutter "+M));z&&(q.style.cssText=z),M=="CodeMirror-linenumbers"&&(e.lineGutter=q,q.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",Ma(e)}function Ir(e){ko(e.display),oi(e),Io(e)}function dl(e,t,i,n){var f=this;this.input=i,f.scrollbarFiller=d("div",null,"CodeMirror-scrollbar-filler"),f.scrollbarFiller.setAttribute("cm-not-content","true"),f.gutterFiller=d("div",null,"CodeMirror-gutter-filler"),f.gutterFiller.setAttribute("cm-not-content","true"),f.lineDiv=g("div",null,"CodeMirror-code"),f.selectionDiv=d("div",null,null,"position: relative; z-index: 1"),f.cursorDiv=d("div",null,"CodeMirror-cursors"),f.measure=d("div",null,"CodeMirror-measure"),f.lineMeasure=d("div",null,"CodeMirror-measure"),f.lineSpace=g("div",[f.measure,f.lineMeasure,f.selectionDiv,f.cursorDiv,f.lineDiv],null,"position: relative; outline: none");var M=g("div",[f.lineSpace],"CodeMirror-lines");f.mover=d("div",[M],null,"position: relative"),f.sizer=d("div",[f.mover],"CodeMirror-sizer"),f.sizerWidth=null,f.heightForcer=d("div",null,null,"position: absolute; height: "+pe+"px; width: 1px;"),f.gutters=d("div",null,"CodeMirror-gutters"),f.lineGutter=null,f.scroller=d("div",[f.sizer,f.heightForcer,f.gutters],"CodeMirror-scroll"),f.scroller.setAttribute("tabIndex","-1"),f.wrapper=d("div",[f.scrollbarFiller,f.gutterFiller,f.scroller],"CodeMirror"),G&&B<8&&(f.gutters.style.zIndex=-1,f.scroller.style.paddingRight=0),!k&&!(N&&a)&&(f.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(f.wrapper):e(f.wrapper)),f.viewFrom=f.viewTo=t.first,f.reportedViewFrom=f.reportedViewTo=t.first,f.view=[],f.renderedView=null,f.externalMeasured=null,f.viewOffset=0,f.lastWrapHeight=f.lastWrapWidth=0,f.updateLineNumbers=null,f.nativeBarWidth=f.barHeight=f.barWidth=0,f.scrollbarsClipped=!1,f.lineNumWidth=f.lineNumInnerWidth=f.lineNumChars=null,f.alignWidgets=!1,f.cachedCharWidth=f.cachedTextHeight=f.cachedPaddingH=null,f.maxLine=null,f.maxLineLength=0,f.maxLineChanged=!1,f.wheelDX=f.wheelDY=f.wheelStartX=f.wheelStartY=null,f.shift=!1,f.selForContextMenu=null,f.activeTouch=null,f.gutterSpecs=Ua(n.gutters,n.lineNumbers),ko(f),i.init(f)}var ta=0,yi=null;G?yi=-.53:N?yi=15:b?yi=-.7:m&&(yi=-1/3);function Po(e){var t=e.wheelDeltaX,i=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),i==null&&e.detail&&e.axis==e.VERTICAL_AXIS?i=e.detail:i==null&&(i=e.wheelDelta),{x:t,y:i}}function cl(e){var t=Po(e);return t.x*=yi,t.y*=yi,t}function Mo(e,t){var i=Po(t),n=i.x,f=i.y,M=e.display,z=M.scroller,q=z.scrollWidth>z.clientWidth,ee=z.scrollHeight>z.clientHeight;if(!(n&&q||f&&ee))return;if(f&&o&&k){e:for(var de=t.target,Ce=M.view;de!=z;de=de.parentNode)for(var Ae=0;Ae<Ce.length;Ae++)if(Ce[Ae].node==de){e.display.currentWheelTarget=de;break e}}if(n&&!N&&!v&&yi!=null){f&&ee&&Or(e,Math.max(0,z.scrollTop+f*yi)),qi(e,Math.max(0,z.scrollLeft+n*yi)),(!f||f&&ee)&&le(t),M.wheelStartX=null;return}if(f&&yi!=null){var Fe=f*yi,Ne=e.doc.scrollTop,Xe=Ne+M.wrapper.clientHeight;Fe<0?Ne=Math.max(0,Ne+Fe-50):Xe=Math.min(e.doc.height,Xe+Fe+50),Pa(e,{top:Ne,bottom:Xe})}ta<20&&(M.wheelStartX==null?(M.wheelStartX=z.scrollLeft,M.wheelStartY=z.scrollTop,M.wheelDX=n,M.wheelDY=f,setTimeout(function(){if(M.wheelStartX==null)return;var at=z.scrollLeft-M.wheelStartX,pt=z.scrollTop-M.wheelStartY,_t=pt&&M.wheelDY&&pt/M.wheelDY||at&&M.wheelDX&&at/M.wheelDX;if(M.wheelStartX=M.wheelStartY=null,!_t)return;yi=(yi*ta+_t)/(ta+1),++ta},200)):(M.wheelDX+=n,M.wheelDY+=f))}var bi=function(e,t){this.ranges=e,this.primIndex=t};bi.prototype.primary=function(){return this.ranges[this.primIndex]},bi.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 i=this.ranges[t],n=e.ranges[t];if(!Jt(i.anchor,n.anchor)||!Jt(i.head,n.head))return!1}return!0},bi.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new yn(hn(this.ranges[t].anchor),hn(this.ranges[t].head));return new bi(e,this.primIndex)},bi.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},bi.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var n=this.ranges[i];if(ct(t,n.from())>=0&&ct(e,n.to())<=0)return i}return-1};var yn=function(e,t){this.anchor=e,this.head=t};yn.prototype.from=function(){return cn(this.anchor,this.head)},yn.prototype.to=function(){return _n(this.anchor,this.head)},yn.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Si(e,t,i){var n=e&&e.options.selectionsMayTouch,f=t[i];t.sort(function(Fe,Ne){return ct(Fe.from(),Ne.from())}),i=ie(t,f);for(var M=1;M<t.length;M++){var z=t[M],q=t[M-1],ee=ct(q.to(),z.from());if(n&&!z.empty()?ee>0:ee>=0){var de=cn(q.from(),z.from()),Ce=_n(q.to(),z.to()),Ae=q.empty()?z.from()==z.head:q.from()==q.head;M<=i&&--i,t.splice(--M,2,new yn(Ae?Ce:de,Ae?de:Ce))}}return new bi(t,i)}function Wi(e,t){return new bi([new yn(e,t||e)],0)}function Ki(e){return e.text?$e(e.from.line+e.text.length-1,Z(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 Ki(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=Ki(t).ch-t.to.ch),$e(i,n)}function Fa(e,t){for(var i=[],n=0;n<e.sel.ranges.length;n++){var f=e.sel.ranges[n];i.push(new yn(No(f.anchor,t),No(f.head,t)))}return Si(e.cm,i,e.sel.primIndex)}function Uo(e,t,i){return e.line==t.line?$e(i.line,e.ch-t.ch+i.ch):$e(i.line+(e.line-t.line),e.ch)}function hl(e,t,i){for(var n=[],f=$e(e.first,0),M=f,z=0;z<t.length;z++){var q=t[z],ee=Uo(q.from,f,M),de=Uo(Ki(q),f,M);if(f=q.to,M=de,i=="around"){var Ce=e.sel.ranges[z],Ae=ct(Ce.head,Ce.anchor)<0;n[z]=new yn(Ae?de:ee,Ae?ee:de)}else n[z]=new yn(ee,ee)}return new bi(n,e.sel.primIndex)}function Ba(e){e.doc.mode=rt(e.options,e.doc.modeOption),Dr(e)}function Dr(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,Lr(e,100),e.state.modeGen++,e.curOp&&oi(e)}function Fo(e,t){return t.from.ch==0&&t.to.ch==0&&Z(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function ja(e,t,i,n){function f(St){return i?i[St]:null}function M(St,Et,Rt){Yi(St,Et,Rt,n),dn(St,"change",St,t)}function z(St,Et){for(var Rt=[],jt=St;jt<Et;++jt)Rt.push(new ci(de[jt],f(jt),n));return Rt}var q=t.from,ee=t.to,de=t.text,Ce=dt(e,q.line),Ae=dt(e,ee.line),Fe=Z(de),Ne=f(de.length-1),Xe=ee.line-q.line;if(t.full)e.insert(0,z(0,de.length)),e.remove(de.length,e.size-de.length);else if(Fo(e,t)){var at=z(0,de.length-1);M(Ae,Ae.text,Ne),Xe&&e.remove(q.line,Xe),at.length&&e.insert(q.line,at)}else if(Ce==Ae)if(de.length==1)M(Ce,Ce.text.slice(0,q.ch)+Fe+Ce.text.slice(ee.ch),Ne);else{var pt=z(1,de.length-1);pt.push(new ci(Fe+Ce.text.slice(ee.ch),Ne,n)),M(Ce,Ce.text.slice(0,q.ch)+de[0],f(0)),e.insert(q.line+1,pt)}else if(de.length==1)M(Ce,Ce.text.slice(0,q.ch)+de[0]+Ae.text.slice(ee.ch),f(0)),e.remove(q.line+1,Xe);else{M(Ce,Ce.text.slice(0,q.ch)+de[0],f(0)),M(Ae,Fe+Ae.text.slice(ee.ch),Ne);var _t=z(1,de.length-1);Xe>1&&e.remove(q.line+1,Xe-1),e.insert(q.line+1,_t)}dn(e,"change",e,t)}function Gi(e,t,i){function n(f,M,z){if(f.linked)for(var q=0;q<f.linked.length;++q){var ee=f.linked[q];if(ee.doc==M)continue;var de=z&&ee.sharedHist;if(i&&!de)continue;t(ee.doc,de),n(ee.doc,f,de)}}n(e,null,!0)}function Bo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Aa(e),Ba(e),jo(e),e.options.lineWrapping||Ui(e),e.options.mode=t.modeOption,oi(e)}function jo(e){(e.doc.direction=="rtl"?P:y)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){pi(e,function(){jo(e),oi(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 Ha(e,t){var i={from:hn(t.from),to:Ki(t),text:Vt(e,t.from,t.to)};return Ko(e,i,t.from.line,t.to.line+1),Gi(e,function(n){return Ko(n,i,t.from.line,t.to.line+1)},!0),i}function Ho(e){for(;e.length;){var t=Z(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Ho(e.done),Z(e.done);if(e.done.length&&!Z(e.done).ranges)return Z(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Z(e.done)}function Wo(e,t,i,n){var f=e.history;f.undone.length=0;var M=+new Date,z,q;if((f.lastOp==n||f.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&f.lastModTime>M-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(z=pl(f,f.lastOp==n)))q=Z(z.changes),ct(t.from,t.to)==0&&ct(t.from,q.to)==0?q.to=Ki(t):z.changes.push(Ha(e,t));else{var ee=Z(f.done);for((!ee||!ee.ranges)&&ia(e.sel,f.done),z={changes:[Ha(e,t)],generation:f.generation},f.done.push(z);f.done.length>f.undoDepth;)f.done.shift(),f.done[0].ranges||f.done.shift()}f.done.push(i),f.generation=++f.maxGeneration,f.lastModTime=f.lastSelTime=M,f.lastOp=f.lastSelOp=n,f.lastOrigin=f.lastSelOrigin=t.origin,q||De(e,"historyAdded")}function ml(e,t,i,n){var f=t.charAt(0);return f=="*"||f=="+"&&i.ranges.length==n.ranges.length&&i.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,i,n){var f=e.history,M=n&&n.origin;i==f.lastSelOp||M&&f.lastSelOrigin==M&&(f.lastModTime==f.lastSelTime&&f.lastOrigin==M||ml(e,M,Z(f.done),t))?f.done[f.done.length-1]=t:ia(t,f.done),f.lastSelTime=+new Date,f.lastSelOrigin=M,f.lastSelOp=i,n&&n.clearRedo!==!1&&Ho(f.undone)}function ia(e,t){var i=Z(t);i&&i.ranges&&i.equals(e)||t.push(e)}function Ko(e,t,i,n){var f=t["spans_"+e.id],M=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,n),function(z){z.markedSpans&&((f||(f=t["spans_"+e.id]={}))[M]=z.markedSpans),++M})}function vl(e){if(!e)return null;for(var t,i=0;i<e.length;++i)e[i].marker.explicitlyCleared?t||(t=e.slice(0,i)):t&&t.push(e[i]);return t?t.length?t:null:e}function yl(e,t){var i=t["spans_"+e.id];if(!i)return null;for(var n=[],f=0;f<t.text.length;++f)n.push(vl(i[f]));return n}function Go(e,t){var i=yl(e,t),n=Sn(e,t);if(!i)return n;if(!n)return i;for(var f=0;f<i.length;++f){var M=i[f],z=n[f];if(M&&z){e:for(var q=0;q<z.length;++q){for(var ee=z[q],de=0;de<M.length;++de)if(M[de].marker==ee.marker)continue e;M.push(ee)}}else z&&(i[f]=z)}return i}function cr(e,t,i){for(var n=[],f=0;f<e.length;++f){var M=e[f];if(M.ranges){n.push(i?bi.prototype.deepCopy.call(M):M);continue}var z=M.changes,q=[];n.push({changes:q});for(var ee=0;ee<z.length;++ee){var de=z[ee],Ce=void 0;if(q.push({from:de.from,to:de.to,text:de.text}),t)for(var Ae in de)(Ce=Ae.match(/^spans_(\d+)$/))&&(ie(t,Number(Ce[1]))>-1&&(Z(q)[Ae]=de[Ae],delete de[Ae]))}}return n}function Wa(e,t,i,n){if(n){var f=e.anchor;if(i){var M=ct(t,f)<0;M!=ct(i,f)<0?(f=t,t=i):M!=ct(t,i)<0&&(t=i)}return new yn(f,t)}else return new yn(i||t,t)}function ra(e,t,i,n,f){f==null&&(f=e.cm&&(e.cm.display.shift||e.extend)),Zn(e,new bi([Wa(e.sel.primary(),t,i,f)],0),n)}function zo(e,t,i){for(var n=[],f=e.cm&&(e.cm.display.shift||e.extend),M=0;M<e.sel.ranges.length;M++)n[M]=Wa(e.sel.ranges[M],t[M],null,f);var z=Si(e.cm,n,e.sel.primIndex);Zn(e,z,i)}function Ka(e,t,i,n){var f=e.sel.ranges.slice(0);f[t]=i,Zn(e,Si(e.cm,f,e.sel.primIndex),n)}function Vo(e,t,i,n){Zn(e,Wi(t,i),n)}function bl(e,t,i){var n={ranges:t.ranges,update:function(f){this.ranges=[];for(var M=0;M<f.length;M++)this.ranges[M]=new yn(C(e,f[M].anchor),C(e,f[M].head))},origin:i&&i.origin};return De(e,"beforeSelectionChange",e,n),e.cm&&De(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?Si(e.cm,n.ranges,n.ranges.length-1):t}function Xo(e,t,i){var n=e.history.done,f=Z(n);f&&f.ranges?(n[n.length-1]=t,aa(e,t,i)):Zn(e,t,i)}function Zn(e,t,i){aa(e,t,i),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function aa(e,t,i){(ve(e,"beforeSelectionChange")||e.cm&&ve(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,i));var n=i&&i.bias||(ct(t.primary().head,e.sel.primary().head)<0?-1:1);Yo(e,Jo(e,t,n,!0)),!(i&&i.scroll===!1)&&e.cm&&ur(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,be(e.cm)),dn(e,"cursorActivity",e)}function $o(e){Yo(e,Jo(e,e.sel,null,!1))}function Jo(e,t,i,n){for(var f,M=0;M<t.ranges.length;M++){var z=t.ranges[M],q=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[M],ee=oa(e,z.anchor,q&&q.anchor,i,n),de=oa(e,z.head,q&&q.head,i,n);(f||ee!=z.anchor||de!=z.head)&&(f||(f=t.ranges.slice(0,M)),f[M]=new yn(ee,de))}return f?Si(e.cm,f,t.primIndex):t}function hr(e,t,i,n,f){var M=dt(e,t.line);if(M.markedSpans)for(var z=0;z<M.markedSpans.length;++z){var q=M.markedSpans[z],ee=q.marker,de="selectLeft"in ee?!ee.selectLeft:ee.inclusiveLeft,Ce="selectRight"in ee?!ee.selectRight:ee.inclusiveRight;if((q.from==null||(de?q.from<=t.ch:q.from<t.ch))&&(q.to==null||(Ce?q.to>=t.ch:q.to>t.ch))){if(f&&(De(ee,"beforeCursorEnter"),ee.explicitlyCleared))if(M.markedSpans){--z;continue}else break;if(!ee.atomic)continue;if(i){var Ae=ee.find(n<0?1:-1),Fe=void 0;if((n<0?Ce:de)&&(Ae=Qo(e,Ae,-n,Ae&&Ae.line==t.line?M:null)),Ae&&Ae.line==t.line&&(Fe=ct(Ae,i))&&(n<0?Fe<0:Fe>0))return hr(e,Ae,t,n,f)}var Ne=ee.find(n<0?-1:1);return(n<0?de:Ce)&&(Ne=Qo(e,Ne,n,Ne.line==t.line?M:null)),Ne?hr(e,Ne,t,n,f):null}}return t}function oa(e,t,i,n,f){var M=n||1,z=hr(e,t,i,M,f)||!f&&hr(e,t,i,M,!0)||hr(e,t,i,-M,f)||!f&&hr(e,t,i,-M,!0);return z||(e.cantEdit=!0,$e(e.first,0))}function Qo(e,t,i,n){return i<0&&t.ch==0?t.line>e.first?C(e,$e(t.line-1)):null:i>0&&t.ch==(n||dt(e,t.line)).text.length?t.line<e.first+e.size-1?$e(t.line+1,0):null:new $e(t.line,t.ch+i)}function Zo(e){e.setSelection($e(e.firstLine(),0),$e(e.lastLine()),Te)}function qo(e,t,i){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return n.canceled=!0}};return i&&(n.update=function(f,M,z,q){f&&(n.from=C(e,f)),M&&(n.to=C(e,M)),z&&(n.text=z),q!==void 0&&(n.origin=q)}),De(e,"beforeChange",e,n),e.cm&&De(e.cm,"beforeChange",e.cm,n),n.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:n.from,to:n.to,text:n.text,origin:n.origin}}function fr(e,t,i){if(e.cm){if(!e.cm.curOp)return zn(e.cm,fr)(e,t,i);if(e.cm.state.suppressEdits)return}if((ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"))&&(t=qo(e,t,!0),!t))return;var n=_i&&!i&&ti(e,t.from,t.to);if(n)for(var f=n.length-1;f>=0;--f)es(e,{from:n[f].from,to:n[f].to,text:f?[""]: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 i=Fa(e,t);Wo(e,t,i,e.cm?e.cm.curOp.id:NaN),kr(e,t,i,Sn(e,t));var n=[];Gi(e,function(f,M){!M&&ie(n,f.history)==-1&&(rs(f.history,t),n.push(f.history)),kr(f,t,null,Sn(f,t))})}function sa(e,t,i){var n=e.cm&&e.cm.state.suppressEdits;if(n&&!i)return;for(var f=e.history,M,z=e.sel,q=t=="undo"?f.done:f.undone,ee=t=="undo"?f.undone:f.done,de=0;de<q.length&&!(M=q[de],i?M.ranges&&!M.equals(e.sel):!M.ranges);de++);if(de==q.length)return;for(f.lastOrigin=f.lastSelOrigin=null;;)if(M=q.pop(),M.ranges){if(ia(M,ee),i&&!M.equals(e.sel)){Zn(e,M,{clearRedo:!1});return}z=M}else if(n){q.push(M);return}else break;var Ce=[];ia(z,ee),ee.push({changes:Ce,generation:f.generation}),f.generation=M.generation||++f.maxGeneration;for(var Ae=ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"),Fe=function(at){var pt=M.changes[at];if(pt.origin=t,Ae&&!qo(e,pt,!1))return q.length=0,{};Ce.push(Ha(e,pt));var _t=at?Fa(e,pt):Z(q);kr(e,pt,_t,Go(e,pt)),!at&&e.cm&&e.cm.scrollIntoView({from:pt.from,to:Ki(pt)});var St=[];Gi(e,function(Et,Rt){!Rt&&ie(St,Et.history)==-1&&(rs(Et.history,pt),St.push(Et.history)),kr(Et,pt,null,Go(Et,pt))})},Ne=M.changes.length-1;Ne>=0;--Ne){var Xe=Fe(Ne);if(Xe)return Xe.v}}function ts(e,t){if(t==0)return;if(e.first+=t,e.sel=new bi(ne(e.sel.ranges,function(f){return new yn($e(f.anchor.line+t,f.anchor.ch),$e(f.head.line+t,f.head.ch))}),e.sel.primIndex),e.cm){oi(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,n=i.viewFrom;n<i.viewTo;n++)ji(e.cm,n,"gutter")}}function kr(e,t,i,n){if(e.cm&&!e.cm.curOp)return zn(e.cm,kr)(e,t,i,n);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 f=t.text.length-1-(e.first-t.from.line);ts(e,f),t={from:$e(e.first,0),to:$e(t.to.line+f,t.to.ch),text:[Z(t.text)],origin:t.origin}}var M=e.lastLine();t.to.line>M&&(t={from:t.from,to:$e(M,dt(e,M).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Vt(e,t.from,t.to),i||(i=Fa(e,t)),e.cm?_l(e.cm,t,n):ja(e,t,n),aa(e,i,Te),e.cantEdit&&oa(e,$e(e.firstLine(),0))&&(e.cantEdit=!1)}function _l(e,t,i){var n=e.doc,f=e.display,M=t.from,z=t.to,q=!1,ee=M.line;e.options.lineWrapping||(ee=Kt(en(dt(n,M.line))),n.iter(ee,z.line+1,function(Ne){if(Ne==f.maxLine)return q=!0,!0})),n.sel.contains(t.from,t.to)>-1&&be(e),ja(n,t,i,yo(e)),e.options.lineWrapping||(n.iter(ee,M.line+t.text.length,function(Ne){var Xe=Ni(Ne);Xe>f.maxLineLength&&(f.maxLine=Ne,f.maxLineLength=Xe,f.maxLineChanged=!0,q=!1)}),q&&(e.curOp.updateMaxLine=!0)),ei(n,M.line),Lr(e,400);var de=t.text.length-(z.line-M.line)-1;t.full?oi(e):M.line==z.line&&t.text.length==1&&!Fo(e.doc,t)?ji(e,M.line,"text"):oi(e,M.line,z.line+1,de);var Ce=ve(e,"changes"),Ae=ve(e,"change");if(Ae||Ce){var Fe={from:M,to:z,text:t.text,removed:t.removed,origin:t.origin};Ae&&dn(e,"change",e,Fe),Ce&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Fe)}e.display.selForContextMenu=null}function pr(e,t,i,n,f){var M;n||(n=i),ct(n,i)<0&&(M=[n,i],i=M[0],n=M[1]),typeof t=="string"&&(t=e.splitLines(t)),fr(e,{from:i,to:n,text:t,origin:f})}function ns(e,t,i,n){i<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function is(e,t,i,n){for(var f=0;f<e.length;++f){var M=e[f],z=!0;if(M.ranges){M.copied||(M=e[f]=M.deepCopy(),M.copied=!0);for(var q=0;q<M.ranges.length;q++)ns(M.ranges[q].anchor,t,i,n),ns(M.ranges[q].head,t,i,n);continue}for(var ee=0;ee<M.changes.length;++ee){var de=M.changes[ee];if(i<de.from.line)de.from=$e(de.from.line+n,de.from.ch),de.to=$e(de.to.line+n,de.to.ch);else if(t<=de.to.line){z=!1;break}}z||(e.splice(0,f+1),f=0)}}function rs(e,t){var i=t.from.line,n=t.to.line,f=t.text.length-(n-i)-1;is(e.done,i,n,f),is(e.undone,i,n,f)}function Pr(e,t,i,n){var f=t,M=t;return typeof t=="number"?M=dt(e,V(e,t)):f=Kt(t),f==null?null:(n(M,f)&&e.cm&&ji(e.cm,f,i),M)}function Mr(e){this.lines=e,this.parent=null;for(var t=0,i=0;i<e.length;++i)e[i].parent=this,t+=e[i].height;this.height=t}Mr.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var i=e,n=e+t;i<n;++i){var f=this.lines[i];this.height-=f.height,It(f),dn(f,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,i){this.height+=i,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,i){for(var n=e+t;e<n;++e)if(i(this.lines[e]))return!0}};function Nr(e){this.children=e;for(var t=0,i=0,n=0;n<e.length;++n){var f=e[n];t+=f.chunkSize(),i+=f.height,f.parent=this}this.size=t,this.height=i,this.parent=null}Nr.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var i=0;i<this.children.length;++i){var n=this.children[i],f=n.chunkSize();if(e<f){var M=Math.min(t,f-e),z=n.height;if(n.removeInner(e,M),this.height-=z-n.height,f==M&&(this.children.splice(i--,1),n.parent=null),(t-=M)==0)break;e=0}else e-=f}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Mr))){var q=[];this.collapse(q),this.children=[new Mr(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,i){this.size+=t.length,this.height+=i;for(var n=0;n<this.children.length;++n){var f=this.children[n],M=f.chunkSize();if(e<=M){if(f.insertInner(e,t,i),f.lines&&f.lines.length>50){for(var z=f.lines.length%25+25,q=z;q<f.lines.length;){var ee=new Mr(f.lines.slice(q,q+=25));f.height-=ee.height,this.children.splice(++n,0,ee),ee.parent=this}f.lines=f.lines.slice(0,z),this.maybeSpill()}break}e-=M}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new Nr(t);if(e.parent){e.size-=i.size,e.height-=i.height;var f=ie(e.parent.children,e);e.parent.children.splice(f+1,0,i)}else{var n=new Nr(e.children);n.parent=e,e.children=[n,i],e=n}i.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,i){for(var n=0;n<this.children.length;++n){var f=this.children[n],M=f.chunkSize();if(e<M){var z=Math.min(t,M-e);if(f.iterN(e,z,i))return!0;if((t-=z)==0)break;e=0}else e-=M}}};var Ur=function(e,t,i){if(i)for(var n in i)i.hasOwnProperty(n)&&(this[n]=i[n]);this.doc=e,this.node=t};Ur.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,n=Kt(i);if(n==null||!t)return;for(var f=0;f<t.length;++f)t[f]==this&&t.splice(f--,1);t.length||(i.widgets=null);var M=Tr(this);gn(i,Math.max(0,i.height-M)),e&&(pi(e,function(){as(e,i,-M),ji(e,n,"widget")}),dn(e,"lineWidgetCleared",e,this,n))},Ur.prototype.changed=function(){var e=this,t=this.height,i=this.doc.cm,n=this.line;this.height=null;var f=Tr(this)-t;if(!f)return;Ti(this.doc,n)||gn(n,n.height+f),i&&pi(i,function(){i.curOp.forceUpdate=!0,as(i,n,f),dn(i,"lineWidgetChanged",i,e,Kt(n))})},ge(Ur);function as(e,t,i){gi(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Da(e,i)}function El(e,t,i,n){var f=new Ur(e,i,n),M=e.cm;return M&&f.noHScroll&&(M.display.alignWidgets=!0),Pr(e,t,"widget",function(z){var q=z.widgets||(z.widgets=[]);if(f.insertAt==null?q.push(f):q.splice(Math.min(q.length-1,Math.max(0,f.insertAt)),0,f),f.line=z,M&&!Ti(e,z)){var ee=gi(z)<e.scrollTop;gn(z,z.height+Tr(f)),ee&&Da(M,f.height),M.curOp.forceUpdate=!0}return!0}),M&&dn(M,"lineWidgetAdded",M,f,typeof t=="number"?t:Kt(t)),f}var os=0,zi=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++os};zi.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&tr(e),ve(this,"clear")){var i=this.find();i&&dn(this,"clear",i.from,i.to)}for(var n=null,f=null,M=0;M<this.lines.length;++M){var z=this.lines[M],q=Qt(z.markedSpans,this);e&&!this.collapsed?ji(e,Kt(z),"text"):e&&(q.to!=null&&(f=Kt(z)),q.from!=null&&(n=Kt(z))),z.markedSpans=tn(z.markedSpans,q),q.from==null&&this.collapsed&&!Ti(this.doc,z)&&e&&gn(z,or(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var ee=0;ee<this.lines.length;++ee){var de=en(this.lines[ee]),Ce=Ni(de);Ce>e.display.maxLineLength&&(e.display.maxLine=de,e.display.maxLineLength=Ce,e.display.maxLineChanged=!0)}n!=null&&e&&this.collapsed&&oi(e,n,f+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&$o(e.doc)),e&&dn(e,"markerCleared",e,this,n,f),t&&nr(e),this.parent&&this.parent.clear()},zi.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,n,f=0;f<this.lines.length;++f){var M=this.lines[f],z=Qt(M.markedSpans,this);if(z.from!=null&&(i=$e(t?M:Kt(M),z.from),e==-1))return i;if(z.to!=null&&(n=$e(t?M:Kt(M),z.to),e==1))return n}return i&&{from:i,to:n}},zi.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,n=this.doc.cm;if(!t||!n)return;pi(n,function(){var f=t.line,M=Kt(t.line),z=_a(n,M);if(z&&(uo(z),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!Ti(i.doc,f)&&i.height!=null){var q=i.height;i.height=null;var ee=Tr(i)-q;ee&&gn(f,f.height+ee)}dn(n,"markerChanged",n,e)})},zi.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ie(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},zi.prototype.detachLine=function(e){if(this.lines.splice(ie(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ge(zi);function mr(e,t,i,n,f){if(n&&n.shared)return xl(e,t,i,n,f);if(e.cm&&!e.cm.curOp)return zn(e.cm,mr)(e,t,i,n,f);var M=new zi(e,f),z=ct(t,i);if(n&&T(n,M,!1),z>0||z==0&&M.clearWhenEmpty!==!1)return M;if(M.replacedWith&&(M.collapsed=!0,M.widgetNode=g("span",[M.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||M.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(M.widgetNode.insertLeft=!0)),M.collapsed){if(kn(e,t.line,t,i,M)||t.line!=i.line&&kn(e,i.line,t,i,M))throw new Error("Inserting collapsed marker partially overlapping an existing one");Gt()}M.addToHistory&&Wo(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var q=t.line,ee=e.cm,de;if(e.iter(q,i.line+1,function(Ae){ee&&M.collapsed&&!ee.options.lineWrapping&&en(Ae)==ee.display.maxLine&&(de=!0),M.collapsed&&q!=t.line&&gn(Ae,0),bn(Ae,new Yt(M,q==t.line?t.ch:null,q==i.line?i.ch:null)),++q}),M.collapsed&&e.iter(t.line,i.line+1,function(Ae){Ti(e,Ae)&&gn(Ae,0)}),M.clearOnEnter&&Re(M,"beforeCursorEnter",function(){return M.clear()}),M.readOnly&&(Bt(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),M.collapsed&&(M.id=++os,M.atomic=!0),ee){if(de&&(ee.curOp.updateMaxLine=!0),M.collapsed)oi(ee,t.line,i.line+1);else if(M.className||M.startStyle||M.endStyle||M.css||M.attributes||M.title)for(var Ce=t.line;Ce<=i.line;Ce++)ji(ee,Ce,"text");M.atomic&&$o(ee.doc),dn(ee,"markerAdded",ee,M)}return M}var Fr=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};Fr.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();dn(this,"clear")},Fr.prototype.find=function(e,t){return this.primary.find(e,t)},ge(Fr);function xl(e,t,i,n,f){n=T(n),n.shared=!1;var M=[mr(e,t,i,n,f)],z=M[0],q=n.widgetNode;return Gi(e,function(ee){q&&(n.widgetNode=q.cloneNode(!0)),M.push(mr(ee,C(ee,t),C(ee,i),n,f));for(var de=0;de<ee.linked.length;++de)if(ee.linked[de].isParent)return;z=Z(M)}),new Fr(M,z)}function ss(e){return e.findMarks($e(e.first,0),e.clipPos($e(e.lastLine())),function(t){return t.parent})}function Tl(e,t){for(var i=0;i<t.length;i++){var n=t[i],f=n.find(),M=e.clipPos(f.from),z=e.clipPos(f.to);if(ct(M,z)){var q=mr(e,M,z,n.primary,n.primary.type);n.markers.push(q),q.parent=n}}}function wl(e){for(var t=function(n){var f=e[n],M=[f.primary.doc];Gi(f.primary.doc,function(ee){return M.push(ee)});for(var z=0;z<f.markers.length;z++){var q=f.markers[z];ie(M,q.doc)==-1&&(q.parent=null,f.markers.splice(z--,1))}},i=0;i<e.length;i++)t(i)}var Cl=0,si=function(e,t,i,n,f){if(!(this instanceof si))return new si(e,t,i,n,f);i==null&&(i=0),Nr.call(this,[new Mr([new ci("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var M=$e(i,0);this.sel=Wi(M),this.history=new na(null),this.id=++Cl,this.modeOption=t,this.lineSep=n,this.direction=f=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),ja(this,{from:M,to:M,text:e}),Zn(this,Wi(M),Te)};si.prototype=Se(Nr.prototype,{constructor:si,iter:function(e,t,i){i?this.iterN(e-this.first,t-e,i):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var i=0,n=0;n<t.length;++n)i+=t[n].height;this.insertInner(e-this.first,t,i)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=sn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Vn(function(e){var t=$e(this.first,0),i=this.first+this.size-1;fr(this,{from:t,to:$e(i,dt(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Sr(this.cm,0,0),Zn(this,Wi(t),Te)}),replaceRange:function(e,t,i,n){t=C(this,t),i=i?C(this,i):t,pr(this,e,t,i,n)},getRange:function(e,t,i){var n=Vt(this,C(this,e),C(this,t));return i===!1?n:n.join(i||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Mn(this,e))return dt(this,e)},getLineNumber:function(e){return Kt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=dt(this,e)),en(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return C(this,e)},getCursor:function(e){var t=this.sel.primary(),i;return e==null||e=="head"?i=t.head:e=="anchor"?i=t.anchor:e=="end"||e=="to"||e===!1?i=t.to():i=t.from(),i},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Vn(function(e,t,i){Vo(this,C(this,typeof e=="number"?$e(e,t||0):e),null,i)}),setSelection:Vn(function(e,t,i){Vo(this,C(this,e),C(this,t||e),i)}),extendSelection:Vn(function(e,t,i){ra(this,C(this,e),t&&C(this,t),i)}),extendSelections:Vn(function(e,t){zo(this,W(this,e),t)}),extendSelectionsBy:Vn(function(e,t){var i=ne(this.sel.ranges,e);zo(this,W(this,i),t)}),setSelections:Vn(function(e,t,i){if(!e.length)return;for(var n=[],f=0;f<e.length;f++)n[f]=new yn(C(this,e[f].anchor),C(this,e[f].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Zn(this,Si(this.cm,n,t),i)}),addSelection:Vn(function(e,t,i){var n=this.sel.ranges.slice(0);n.push(new yn(C(this,e),C(this,t||e))),Zn(this,Si(this.cm,n,n.length-1),i)}),getSelection:function(e){for(var t=this.sel.ranges,i,n=0;n<t.length;n++){var f=Vt(this,t[n].from(),t[n].to());i=i?i.concat(f):f}return e===!1?i:i.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],i=this.sel.ranges,n=0;n<i.length;n++){var f=Vt(this,i[n].from(),i[n].to());e!==!1&&(f=f.join(e||this.lineSeparator())),t[n]=f}return t},replaceSelection:function(e,t,i){for(var n=[],f=0;f<this.sel.ranges.length;f++)n[f]=e;this.replaceSelections(n,t,i||"+input")},replaceSelections:Vn(function(e,t,i){for(var n=[],f=this.sel,M=0;M<f.ranges.length;M++){var z=f.ranges[M];n[M]={from:z.from(),to:z.to(),text:this.splitLines(e[M]),origin:i}}for(var q=t&&t!="end"&&hl(this,n,t),ee=n.length-1;ee>=0;ee--)fr(this,n[ee]);q?Xo(this,q):this.cm&&ur(this.cm)}),undo:Vn(function(){sa(this,"undo")}),redo:Vn(function(){sa(this,"redo")}),undoSelection:Vn(function(){sa(this,"undo",!0)}),redoSelection:Vn(function(){sa(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var f=0;f<e.undone.length;f++)e.undone[f].ranges||++i;return{undo:t,redo:i}},clearHistory:function(){var e=this;this.history=new na(this.history.maxGeneration),Gi(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:cr(this.history.done),undone:cr(this.history.undone)}},setHistory:function(e){var t=this.history=new na(this.history.maxGeneration);t.done=cr(e.done.slice(0),null,!0),t.undone=cr(e.undone.slice(0),null,!0)},setGutterMarker:Vn(function(e,t,i){return Pr(this,e,"gutter",function(n){var f=n.gutterMarkers||(n.gutterMarkers={});return f[t]=i,!i&&Be(f)&&(n.gutterMarkers=null),!0})}),clearGutter:Vn(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&Pr(t,i,"gutter",function(){return i.gutterMarkers[e]=null,Be(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Mn(this,e))return null;if(t=e,e=dt(this,e),!e)return null}else if(t=Kt(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:Vn(function(e,t,i){return Pr(this,e,t=="gutter"?"gutter":"class",function(n){var f=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!n[f])n[f]=i;else{if(S(i).test(n[f]))return!1;n[f]+=" "+i}return!0})}),removeLineClass:Vn(function(e,t,i){return Pr(this,e,t=="gutter"?"gutter":"class",function(n){var f=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",M=n[f];if(M)if(i==null)n[f]=null;else{var z=M.match(S(i));if(!z)return!1;var q=z.index+z[0].length;n[f]=M.slice(0,z.index)+(!z.index||q==M.length?"":" ")+M.slice(q)||null}else return!1;return!0})}),addLineWidget:Vn(function(e,t,i){return El(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return mr(this,C(this,e),C(this,t),i,i&&i.type||"range")},setBookmark:function(e,t){var i={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=C(this,e),mr(this,e,e,i,"bookmark")},findMarksAt:function(e){e=C(this,e);var t=[],i=dt(this,e.line).markedSpans;if(i)for(var n=0;n<i.length;++n){var f=i[n];(f.from==null||f.from<=e.ch)&&(f.to==null||f.to>=e.ch)&&t.push(f.marker.parent||f.marker)}return t},findMarks:function(e,t,i){e=C(this,e),t=C(this,t);var n=[],f=e.line;return this.iter(e.line,t.line+1,function(M){var z=M.markedSpans;if(z)for(var q=0;q<z.length;q++){var ee=z[q];!(ee.to!=null&&f==e.line&&e.ch>=ee.to||ee.from==null&&f!=e.line||ee.from!=null&&f==t.line&&ee.from>=t.ch)&&(!i||i(ee.marker))&&n.push(ee.marker.parent||ee.marker)}++f}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var n=0;n<i.length;++n)i[n].from!=null&&e.push(i[n].marker)}),e},posFromIndex:function(e){var t,i=this.first,n=this.lineSeparator().length;return this.iter(function(f){var M=f.text.length+n;if(M>e)return t=e,!0;e-=M,++i}),C(this,$e(i,t))},indexFromPos:function(e){e=C(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var i=this.lineSeparator().length;return this.iter(this.first,e.line,function(n){t+=n.text.length+i}),t},copy:function(e){var t=new si(sn(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,i=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<i&&(i=e.to);var n=new si(sn(this,t,i),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Tl(n,ss(this)),n},unlinkDoc:function(e){if(e instanceof On&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var i=this.linked[t];if(i.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(ss(this));break}if(e.history==this.history){var n=[e.id];Gi(e,function(f){return n.push(f.id)},!0),e.history=new na(null),e.history.done=cr(this.history.done,n),e.history.undone=cr(this.history.undone,n)}},iterLinkedDocs:function(e){Gi(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):yt(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Vn(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)})}),si.prototype.eachLine=si.prototype.iter;var ls=0;function Sl(e){var t=this;if(us(t),Me(t,e)||Di(t.display,e))return;le(e),G&&(ls=+new Date);var i=Qi(t,e,!0),n=e.dataTransfer.files;if(!i||t.isReadOnly())return;if(n&&n.length&&window.FileReader&&window.File)for(var f=n.length,M=Array(f),z=0,q=function(){++z==f&&zn(t,function(){i=C(t.doc,i);var Ne={from:i,to:i,text:t.doc.splitLines(M.filter(function(Xe){return Xe!=null}).join(t.doc.lineSeparator())),origin:"paste"};fr(t.doc,Ne),Xo(t.doc,Wi(C(t.doc,i),C(t.doc,Ki(Ne))))})()},ee=function(Ne,Xe){if(t.options.allowDropFileTypes&&ie(t.options.allowDropFileTypes,Ne.type)==-1){q();return}var at=new FileReader;at.onerror=function(){return q()},at.onload=function(){var pt=at.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(pt)){q();return}M[Xe]=pt,q()},at.readAsText(Ne)},de=0;de<n.length;de++)ee(n[de],de);else{if(t.state.draggingText&&t.doc.sel.contains(i)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var Ce=e.dataTransfer.getData("Text");if(Ce){var Ae;if(t.state.draggingText&&!t.state.draggingText.copy&&(Ae=t.listSelections()),aa(t.doc,Wi(i,i)),Ae)for(var Fe=0;Fe<Ae.length;++Fe)pr(t.doc,"",Ae[Fe].anchor,Ae[Fe].head,"drag");t.replaceSelection(Ce,"around","paste"),t.display.input.focus()}}catch(Ne){}}}function Ol(e,t){if(G&&(!e.state.draggingText||+new Date-ls<100)){xe(t);return}if(Me(e,t)||Di(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!m){var i=d("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",v&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),v&&i.parentNode.removeChild(i)}}function Al(e,t){var i=Qi(e,t);if(!i)return;var n=document.createDocumentFragment();Eo(e,i,n),e.display.dragCursor||(e.display.dragCursor=d("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),p(e.display.dragCursor,n)}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"),i=[],n=0;n<t.length;n++){var f=t[n].CodeMirror;f&&i.push(f)}i.length&&i[0].operation(function(){for(var M=0;M<i.length;M++)e(i[M])})}var cs=!1;function Rl(){if(cs)return;Ll(),cs=!0}function Ll(){var e;Re(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ds(Il)},100))}),Re(window,"blur",function(){return ds(lr)})}function Il(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Vi={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"},Br=0;Br<10;Br++)Vi[Br+48]=Vi[Br+96]=String(Br);for(var la=65;la<=90;la++)Vi[la]=String.fromCharCode(la);for(var jr=1;jr<=12;jr++)Vi[jr+111]=Vi[jr+63235]="F"+jr;var ki={};ki.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},ki.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},ki.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},ki.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},ki.default=o?ki.macDefault:ki.pcDefault;function Dl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,n,f,M,z=0;z<t.length-1;z++){var q=t[z];if(/^(cmd|meta|m)$/i.test(q))M=!0;else if(/^a(lt)?$/i.test(q))i=!0;else if(/^(c|ctrl|control)$/i.test(q))n=!0;else if(/^s(hift)?$/i.test(q))f=!0;else throw new Error("Unrecognized modifier name: "+q)}return i&&(e="Alt-"+e),n&&(e="Ctrl-"+e),M&&(e="Cmd-"+e),f&&(e="Shift-"+e),e}function kl(e){var t={};for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];if(/^(name|fallthrough|(de|at)tach)$/.test(i))continue;if(n=="..."){delete e[i];continue}for(var f=ne(i.split(" "),Dl),M=0;M<f.length;M++){var z=void 0,q=void 0;M==f.length-1?(q=f.join(" "),z=n):(q=f.slice(0,M+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[i]}for(var de in t)e[de]=t[de];return e}function gr(e,t,i,n){t=ua(t);var f=t.call?t.call(e,n):t[e];if(f===!1)return"nothing";if(f==="...")return"multi";if(f!=null&&i(f))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return gr(e,t.fallthrough,i,n);for(var M=0;M<t.fallthrough.length;M++){var z=gr(e,t.fallthrough[M],i,n);if(z)return z}}}function hs(e){var t=typeof e=="string"?e:Vi[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function fs(e,t,i){var n=e;return t.altKey&&n!="Alt"&&(e="Alt-"+e),(x?t.metaKey:t.ctrlKey)&&n!="Ctrl"&&(e="Ctrl-"+e),(x?t.ctrlKey:t.metaKey)&&n!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&n!="Shift"&&(e="Shift-"+e),e}function ps(e,t){if(v&&e.keyCode==34&&e.char)return!1;var i=Vi[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),fs(i,e,t))}function ua(e){return typeof e=="string"?ki[e]:e}function vr(e,t){for(var i=e.doc.sel.ranges,n=[],f=0;f<i.length;f++){for(var M=t(i[f]);n.length&&ct(M.from,Z(n).to)<=0;){var z=n.pop();if(ct(z.from,M.from)<0){M.from=z.from;break}}n.push(M)}pi(e,function(){for(var q=n.length-1;q>=0;q--)pr(e.doc,"",n[q].from,n[q].to,"+delete");ur(e)})}function Ga(e,t,i){var n=Ue(e.text,t+i,i);return n<0||n>e.text.length?null:n}function za(e,t,i){var n=Ga(e,t.ch,i);return n==null?null:new $e(t.line,n,i<0?"after":"before")}function Va(e,t,i,n,f){if(e){t.doc.direction=="rtl"&&(f=-f);var M=ht(i,t.doc.direction);if(M){var z=f<0?Z(M):M[0],q=f<0==(z.level==1),ee=q?"after":"before",de;if(z.level>0||t.doc.direction=="rtl"){var Ce=ar(t,i);de=f<0?i.text.length-1:0;var Ae=Ri(t,Ce,de).top;de=tt(function(Fe){return Ri(t,Ce,Fe).top==Ae},f<0==(z.level==1)?z.from:z.to-1,de),ee=="before"&&(de=Ga(i,de,1))}else de=f<0?z.to:z.from;return new $e(n,de,ee)}}return new $e(n,f<0?i.text.length:0,f<0?"before":"after")}function Pl(e,t,i,n){var f=ht(t,e.doc.direction);if(!f)return za(t,i,n);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var M=st(f,i.ch,i.sticky),z=f[M];if(e.doc.direction=="ltr"&&z.level%2==0&&(n>0?z.to>i.ch:z.from<i.ch))return za(t,i,n);var q=function(_t,St){return Ga(t,_t instanceof $e?_t.ch:_t,St)},ee,de=function(_t){return e.options.lineWrapping?(ee=ee||ar(e,t),vo(e,t,ee,_t)):{begin:0,end:t.text.length}},Ce=de(i.sticky=="before"?q(i,-1):i.ch);if(e.doc.direction=="rtl"||z.level==1){var Ae=z.level==1==n<0,Fe=q(i,Ae?1:-1);if(Fe!=null&&(Ae?Fe<=z.to&&Fe<=Ce.end:Fe>=z.from&&Fe>=Ce.begin)){var Ne=Ae?"before":"after";return new $e(i.line,Fe,Ne)}}var Xe=function(_t,St,Et){for(var Rt=function(Cn,Xn){return Xn?new $e(i.line,q(Cn,1),"before"):new $e(i.line,Cn,"after")};_t>=0&&_t<f.length;_t+=St){var jt=f[_t],Ut=St>0==(jt.level!=1),qt=Ut?Et.begin:q(Et.end,-1);if(jt.from<=qt&&qt<jt.to)return Rt(qt,Ut);if(qt=Ut?jt.from:q(jt.to,-1),Et.begin<=qt&&qt<Et.end)return Rt(qt,Ut)}},at=Xe(M+n,n,Ce);if(at)return at;var pt=n>0?Ce.end:q(Ce.begin,-1);return pt!=null&&!(n>0&&pt==t.text.length)&&(at=Xe(n>0?0:f.length-1,n,de(pt)),at)?at:null}var Hr={selectAll:Zo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Te)},killLine:function(e){return vr(e,function(t){if(t.empty()){var i=dt(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:$e(t.head.line+1,0)}:{from:t.head,to:$e(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return vr(e,function(t){return{from:$e(t.from().line,0),to:C(e.doc,$e(t.to().line+1,0))}})},delLineLeft:function(e){return vr(e,function(t){return{from:$e(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return vr(e,function(t){var i=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:i},"div");return{from:n,to:t.from()}})},delWrappedLineRight:function(e){return vr(e,function(t){var i=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div");return{from:t.from(),to:n}})},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($e(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection($e(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 Ml(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div")},re)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:i},"div")},re)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:i},"div");return n.ch<e.getLine(n.line).search(/\S/)?gs(e,t.head):n},re)},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=[],i=e.listSelections(),n=e.options.tabSize,f=0;f<i.length;f++){var M=i[f].from(),z=K(e.getLine(M.line),M.ch,n);t.push(oe(n-z%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return pi(e,function(){for(var t=e.listSelections(),i=[],n=0;n<t.length;n++){if(!t[n].empty())continue;var f=t[n].head,M=dt(e.doc,f.line).text;if(M){if(f.ch==M.length&&(f=new $e(f.line,f.ch-1)),f.ch>0)f=new $e(f.line,f.ch+1),e.replaceRange(M.charAt(f.ch-1)+M.charAt(f.ch-2),$e(f.line,f.ch-2),f,"+transpose");else if(f.line>e.doc.first){var z=dt(e.doc,f.line-1).text;z&&(f=new $e(f.line,1),e.replaceRange(M.charAt(0)+e.doc.lineSeparator()+z.charAt(z.length-1),$e(f.line-1,z.length-1),f,"+transpose"))}}i.push(new yn(f,f))}e.setSelections(i)})},newlineAndIndent:function(e){return pi(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var n=0;n<t.length;n++)e.indentLine(t[n].from().line,null,!0);ur(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ms(e,t){var i=dt(e.doc,t),n=en(i);return n!=i&&(t=Kt(n)),Va(!0,e,n,t,1)}function Ml(e,t){var i=dt(e.doc,t),n=xi(i);return n!=i&&(t=Kt(n)),Va(!0,e,i,t,-1)}function gs(e,t){var i=ms(e,t.line),n=dt(e.doc,i.line),f=ht(n,e.doc.direction);if(!f||f[0].level==0){var M=Math.max(i.ch,n.text.search(/\S/)),z=t.line==i.line&&t.ch<=M&&t.ch;return $e(i.line,z?0:M,i.sticky)}return i}function da(e,t,i){if(typeof t=="string"&&(t=Hr[t],!t))return!1;e.display.input.ensurePolled();var n=e.display.shift,f=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),i&&(e.display.shift=!1),f=t(e)!=_e}finally{e.display.shift=n,e.state.suppressEdits=!1}return f}function Nl(e,t,i){for(var n=0;n<e.state.keyMaps.length;n++){var f=gr(t,e.state.keyMaps[n],i,e);if(f)return f}return e.options.extraKeys&&gr(t,e.options.extraKeys,i,e)||gr(t,e.options.keyMap,i,e)}var Ul=new J;function Wr(e,t,i,n){var f=e.state.keySeq;if(f){if(hs(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ul.set(50,function(){e.state.keySeq==f&&(e.state.keySeq=null,e.display.input.reset())}),vs(e,f+" "+t,i,n))return!0}return vs(e,t,i,n)}function vs(e,t,i,n){var f=Nl(e,t,n);return f=="multi"&&(e.state.keySeq=t),f=="handled"&&dn(e,"keyHandled",e,t,i),(f=="handled"||f=="multi")&&(le(i),Ra(e)),!!f}function ys(e,t){var i=ps(t,!0);return i?t.shiftKey&&!e.state.keySeq?Wr(e,"Shift-"+i,t,function(n){return da(e,n,!0)})||Wr(e,i,t,function(n){if(typeof n=="string"?/^go[A-Z]/.test(n):n.motion)return da(e,n)}):Wr(e,i,t,function(n){return da(e,n)}):!1}function Fl(e,t,i){return Wr(e,"'"+i+"'",t,function(n){return da(e,n,!0)})}var Xa=null;function bs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=U(),Me(t,e))return;G&&B<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var n=ys(t,e);v&&(Xa=n?i:null,!n&&i==88&&!wt&&(o?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),N&&!o&&!n&&i==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),i==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;P(t,"CodeMirror-crosshair");function i(n){(n.keyCode==18||!n.altKey)&&(y(t,"CodeMirror-crosshair"),Ve(document,"keyup",i),Ve(document,"mouseover",i))}Re(document,"keyup",i),Re(document,"mouseover",i)}function _s(e){e.keyCode==16&&(this.doc.sel.shift=!1),Me(this,e)}function Es(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Di(t.display,e)||Me(t,e)||e.ctrlKey&&!e.altKey||o&&e.metaKey)return;var i=e.keyCode,n=e.charCode;if(v&&i==Xa){Xa=null,le(e);return}if(v&&(!e.which||e.which<10)&&ys(t,e))return;var f=String.fromCharCode(n==null?i:n);if(f=="\b")return;if(Fl(t,e,f))return;t.display.input.onKeyPress(e)}var jl=400,Ya=function(e,t,i){this.time=e,this.pos=t,this.button=i};Ya.prototype.compare=function(e,t,i){return this.time+jl>e&&ct(t,this.pos)==0&&i==this.button};var Kr,Gr;function Hl(e,t){var i=+new Date;return Gr&&Gr.compare(i,e,t)?(Kr=Gr=null,"triple"):Kr&&Kr.compare(i,e,t)?(Gr=new Ya(i,e,t),Kr=null,"double"):(Kr=new Ya(i,e,t),Gr=null,"single")}function xs(e){var t=this,i=t.display;if(Me(t,e)||i.activeTouch&&i.input.supportsTouch())return;if(i.input.ensurePolled(),i.shift=e.shiftKey,Di(i,e)){k||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if($a(t,e))return;var n=Qi(t,e),f=ke(e),M=n?Hl(n,f):"single";if(window.focus(),f==1&&t.state.selectingText&&t.state.selectingText(e),n&&Wl(t,f,n,M,e))return;f==1?n?Gl(t,n,M,e):we(e)==i.scroller&&le(e):f==2?(n&&ra(t.doc,n),setTimeout(function(){return i.input.focus()},20)):f==3&&(A?t.display.input.onContextMenu(e):To(t))}function Wl(e,t,i,n,f){var M="Click";return n=="double"?M="Double"+M:n=="triple"&&(M="Triple"+M),M=(t==1?"Left":t==2?"Middle":"Right")+M,Wr(e,fs(M,f),f,function(z){if(typeof z=="string"&&(z=Hr[z]),!z)return!1;var q=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),q=z(e,i)!=_e}finally{e.state.suppressEdits=!1}return q})}function Kl(e,t,i){var n=e.getOption("configureMouse"),f=n?n(e,t,i):{};if(f.unit==null){var M=h?i.shiftKey&&i.metaKey:i.altKey;f.unit=M?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(f.extend==null||e.doc.extend)&&(f.extend=e.doc.extend||i.shiftKey),f.addNew==null&&(f.addNew=o?i.metaKey:i.ctrlKey),f.moveOnDrag==null&&(f.moveOnDrag=!(o?i.altKey:i.ctrlKey)),f}function Gl(e,t,i,n){G?setTimeout(I(xo,e),0):e.curOp.focus=U();var f=Kl(e,i,n),M=e.doc.sel,z;e.options.dragDrop&&We&&!e.isReadOnly()&&i=="single"&&(z=M.contains(t))>-1&&(ct((z=M.ranges[z]).from(),t)<0||t.xRel>0)&&(ct(z.to(),t)>0||t.xRel<0)?zl(e,n,t,f):Vl(e,n,t,f)}function zl(e,t,i,n){var f=e.display,M=!1,z=zn(e,function(de){k&&(f.scroller.draggable=!1),e.state.draggingText=!1,Ve(f.wrapper.ownerDocument,"mouseup",z),Ve(f.wrapper.ownerDocument,"mousemove",q),Ve(f.scroller,"dragstart",ee),Ve(f.scroller,"drop",z),M||(le(de),n.addNew||ra(e.doc,i,null,null,n.extend),k&&!m||G&&B==9?setTimeout(function(){f.wrapper.ownerDocument.body.focus({preventScroll:!0}),f.input.focus()},20):f.input.focus())}),q=function(de){M=M||Math.abs(t.clientX-de.clientX)+Math.abs(t.clientY-de.clientY)>=10},ee=function(){return M=!0};k&&(f.scroller.draggable=!0),e.state.draggingText=z,z.copy=!n.moveOnDrag,f.scroller.dragDrop&&f.scroller.dragDrop(),Re(f.wrapper.ownerDocument,"mouseup",z),Re(f.wrapper.ownerDocument,"mousemove",q),Re(f.scroller,"dragstart",ee),Re(f.scroller,"drop",z),To(e),setTimeout(function(){return f.input.focus()},20)}function Ts(e,t,i){if(i=="char")return new yn(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new yn($e(t.line,0),C(e.doc,$e(t.line+1,0)));var n=i(e,t);return new yn(n.from,n.to)}function Vl(e,t,i,n){var f=e.display,M=e.doc;le(t);var z,q,ee=M.sel,de=ee.ranges;if(n.addNew&&!n.extend?(q=M.sel.contains(i),q>-1?z=de[q]:z=new yn(i,i)):(z=M.sel.primary(),q=M.sel.primIndex),n.unit=="rectangle")n.addNew||(z=new yn(i,i)),i=Qi(e,t,!0,!0),q=-1;else{var Ce=Ts(e,i,n.unit);n.extend?z=Wa(z,Ce.anchor,Ce.head,n.extend):z=Ce}n.addNew?q==-1?(q=de.length,Zn(M,Si(e,de.concat([z]),q),{scroll:!1,origin:"*mouse"})):de.length>1&&de[q].empty()&&n.unit=="char"&&!n.extend?(Zn(M,Si(e,de.slice(0,q).concat(de.slice(q+1)),0),{scroll:!1,origin:"*mouse"}),ee=M.sel):Ka(M,q,z,he):(q=0,Zn(M,new bi([z],0),he),ee=M.sel);var Ae=i;function Fe(Et){if(ct(Ae,Et)==0)return;if(Ae=Et,n.unit=="rectangle"){for(var Rt=[],jt=e.options.tabSize,Ut=K(dt(M,i.line).text,i.ch,jt),qt=K(dt(M,Et.line).text,Et.ch,jt),Cn=Math.min(Ut,qt),Xn=Math.max(Ut,qt),An=Math.min(i.line,Et.line),mi=Math.min(e.lastLine(),Math.max(i.line,Et.line));An<=mi;An++){var li=dt(M,An).text,Bn=fe(li,Cn,jt);Cn==Xn?Rt.push(new yn($e(An,Bn),$e(An,Bn))):li.length>Bn&&Rt.push(new yn($e(An,Bn),$e(An,fe(li,Xn,jt))))}Rt.length||Rt.push(new yn(i,i)),Zn(M,Si(e,ee.ranges.slice(0,q).concat(Rt),q),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Et)}else{var ui=z,Jn=Ts(e,Et,n.unit),Hn=ui.anchor,jn;ct(Jn.anchor,Hn)>0?(jn=Jn.head,Hn=cn(ui.from(),Jn.anchor)):(jn=Jn.anchor,Hn=_n(ui.to(),Jn.head));var Ln=ee.ranges.slice(0);Ln[q]=Xl(e,new yn(C(M,Hn),jn)),Zn(M,Si(e,Ln,q),he)}}var Ne=f.wrapper.getBoundingClientRect(),Xe=0;function at(Et){var Rt=++Xe,jt=Qi(e,Et,!0,n.unit=="rectangle");if(!jt)return;if(ct(jt,Ae)!=0){e.curOp.focus=U(),Fe(jt);var Ut=Zr(f,M);(jt.line>=Ut.to||jt.line<Ut.from)&&setTimeout(zn(e,function(){Xe==Rt&&at(Et)}),150)}else{var qt=Et.clientY<Ne.top?-20:Et.clientY>Ne.bottom?20:0;qt&&setTimeout(zn(e,function(){if(Xe!=Rt)return;f.scroller.scrollTop+=qt,at(Et)}),50)}}function pt(Et){e.state.selectingText=!1,Xe=Infinity,Et&&(le(Et),f.input.focus()),Ve(f.wrapper.ownerDocument,"mousemove",_t),Ve(f.wrapper.ownerDocument,"mouseup",St),M.history.lastSelOrigin=null}var _t=zn(e,function(Et){Et.buttons===0||!ke(Et)?pt(Et):at(Et)}),St=zn(e,pt);e.state.selectingText=St,Re(f.wrapper.ownerDocument,"mousemove",_t),Re(f.wrapper.ownerDocument,"mouseup",St)}function Xl(e,t){var i=t.anchor,n=t.head,f=dt(e.doc,i.line);if(ct(i,n)==0&&i.sticky==n.sticky)return t;var M=ht(f);if(!M)return t;var z=st(M,i.ch,i.sticky),q=M[z];if(q.from!=i.ch&&q.to!=i.ch)return t;var ee=z+(q.from==i.ch==(q.level!=1)?0:1);if(ee==0||ee==M.length)return t;var de;if(n.line!=i.line)de=(n.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var Ce=st(M,n.ch,n.sticky),Ae=Ce-z||(n.ch-i.ch)*(q.level==1?-1:1);Ce==ee-1||Ce==ee?de=Ae<0:de=Ae>0}var Fe=M[ee+(de?-1:0)],Ne=de==(Fe.level==1),Xe=Ne?Fe.from:Fe.to,at=Ne?"after":"before";return i.ch==Xe&&i.sticky==at?t:new yn(new $e(i.line,Xe,at),n)}function ws(e,t,i,n){var f,M;if(t.touches)f=t.touches[0].clientX,M=t.touches[0].clientY;else try{f=t.clientX,M=t.clientY}catch(Fe){return!1}if(f>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&le(t);var z=e.display,q=z.lineDiv.getBoundingClientRect();if(M>q.bottom||!ve(e,i))return ye(t);M-=q.top-z.viewOffset;for(var ee=0;ee<e.display.gutterSpecs.length;++ee){var de=z.gutters.childNodes[ee];if(de&&de.getBoundingClientRect().right>=f){var Ce=vn(e.doc,M),Ae=e.display.gutterSpecs[ee];return De(e,i,e,Ce,Ae.className,t),ye(t)}}}function $a(e,t){return ws(e,t,"gutterClick",!0)}function Cs(e,t){if(Di(e.display,t)||Yl(e,t))return;if(Me(e,t,"contextmenu"))return;A||e.display.input.onContextMenu(t)}function Yl(e,t){return ve(e,"gutterContextMenu")?ws(e,t,"gutterContextMenu",!1):!1}function Ss(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),wr(e)}var yr={toString:function(){return"CodeMirror.Init"}},Os={},ca={};function $l(e){var t=e.optionHandlers;function i(n,f,M,z){e.defaults[n]=f,M&&(t[n]=z?function(q,ee,de){de!=yr&&M(q,ee,de)}:M)}e.defineOption=i,e.Init=yr,i("value","",function(n,f){return n.setValue(f)},!0),i("mode",null,function(n,f){n.doc.modeOption=f,Ba(n)},!0),i("indentUnit",2,Ba,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(n){Dr(n),wr(n),oi(n)},!0),i("lineSeparator",null,function(n,f){if(n.doc.lineSep=f,!f)return;var M=[],z=n.doc.first;n.doc.iter(function(ee){for(var de=0;;){var Ce=ee.text.indexOf(f,de);if(Ce==-1)break;de=Ce+f.length,M.push($e(z,Ce))}z++});for(var q=M.length-1;q>=0;q--)pr(n.doc,f,M[q],$e(M[q].line,M[q].ch+f.length))}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(n,f,M){n.state.specialChars=new RegExp(f.source+(f.test(" ")?"":"| "),"g"),M!=yr&&n.refresh()}),i("specialCharPlaceholder",En,function(n){return n.refresh()},!0),i("electricChars",!0),i("inputStyle",a?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(n,f){return n.getInputField().spellcheck=f},!0),i("autocorrect",!1,function(n,f){return n.getInputField().autocorrect=f},!0),i("autocapitalize",!1,function(n,f){return n.getInputField().autocapitalize=f},!0),i("rtlMoveVisually",!O),i("wholeLineUpdateBefore",!0),i("theme","default",function(n){Ss(n),Ir(n)},!0),i("keyMap","default",function(n,f,M){var z=ua(f),q=M!=yr&&ua(M);q&&q.detach&&q.detach(n,z),z.attach&&z.attach(n,q||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Ql,!0),i("gutters",[],function(n,f){n.display.gutterSpecs=Ua(f,n.options.lineNumbers),Ir(n)},!0),i("fixedGutter",!0,function(n,f){n.display.gutters.style.left=f?Oa(n.display)+"px":"0",n.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(n){return dr(n)},!0),i("scrollbarStyle","native",function(n){Ro(n),dr(n),n.display.scrollbars.setScrollTop(n.doc.scrollTop),n.display.scrollbars.setScrollLeft(n.doc.scrollLeft)},!0),i("lineNumbers",!1,function(n,f){n.display.gutterSpecs=Ua(n.options.gutters,f),Ir(n)},!0),i("firstLineNumber",1,Ir,!0),i("lineNumberFormatter",function(n){return n},Ir,!0),i("showCursorWhenSelecting",!1,Cr,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(n,f){f=="nocursor"&&(lr(n),n.display.input.blur()),n.display.input.readOnlyChanged(f)}),i("screenReaderLabel",null,function(n,f){f=f===""?null:f,n.display.input.screenReaderLabelChanged(f)}),i("disableInput",!1,function(n,f){f||n.display.input.reset()},!0),i("dragDrop",!0,Jl),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,Cr,!0),i("singleCursorHeightPerLine",!0,Cr,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,Dr,!0),i("addModeClass",!1,Dr,!0),i("pollInterval",100),i("undoDepth",200,function(n,f){return n.doc.history.undoDepth=f}),i("historyEventDelay",1250),i("viewportMargin",10,function(n){return n.refresh()},!0),i("maxHighlightLength",1e4,Dr,!0),i("moveInputWithCursor",!0,function(n,f){f||n.display.input.resetPosition()}),i("tabindex",null,function(n,f){return n.display.input.getField().tabIndex=f||""}),i("autofocus",null),i("direction","ltr",function(n,f){return n.doc.setDirection(f)},!0),i("phrases",null)}function Jl(e,t,i){var n=i&&i!=yr;if(!t!=!n){var f=e.display.dragFunctions,M=t?Re:Ve;M(e.display.scroller,"dragstart",f.start),M(e.display.scroller,"dragenter",f.enter),M(e.display.scroller,"dragover",f.over),M(e.display.scroller,"dragleave",f.leave),M(e.display.scroller,"drop",f.drop)}}function Ql(e){e.options.lineWrapping?(P(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(y(e.display.wrapper,"CodeMirror-wrap"),Ui(e)),Aa(e),oi(e),wr(e),setTimeout(function(){return dr(e)},100)}function On(e,t){var i=this;if(!(this instanceof On))return new On(e,t);this.options=t=t?T(t):{},T(Os,t,!1);var n=t.value;typeof n=="string"?n=new si(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var f=new On.inputStyles[t.inputStyle](this),M=this.display=new dl(e,n,f,t);M.wrapper.CodeMirror=this,Ss(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ro(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 J,keySeq:null,specialChars:null},t.autofocus&&!a&&M.input.focus(),G&&B<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Zl(this),Rl(),tr(this),this.curOp.forceUpdate=!0,Bo(this,n),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&La(i)},20):lr(this);for(var z in ca)ca.hasOwnProperty(z)&&ca[z](this,t[z],yr);Do(this),t.finishInit&&t.finishInit(this);for(var q=0;q<Ja.length;++q)Ja[q](this);nr(this),k&&t.lineWrapping&&getComputedStyle(M.lineDiv).textRendering=="optimizelegibility"&&(M.lineDiv.style.textRendering="auto")}On.defaults=Os,On.optionHandlers=ca;function Zl(e){var t=e.display;Re(t.scroller,"mousedown",zn(e,xs)),G&&B<11?Re(t.scroller,"dblclick",zn(e,function(ee){if(Me(e,ee))return;var de=Qi(e,ee);if(!de||$a(e,ee)||Di(e.display,ee))return;le(ee);var Ce=e.findWordAt(de);ra(e.doc,Ce.anchor,Ce.head)})):Re(t.scroller,"dblclick",function(ee){return Me(e,ee)||le(ee)}),Re(t.scroller,"contextmenu",function(ee){return Cs(e,ee)}),Re(t.input.getField(),"contextmenu",function(ee){t.scroller.contains(ee.target)||Cs(e,ee)});var i,n={end:0};function f(){t.activeTouch&&(i=setTimeout(function(){return t.activeTouch=null},1e3),n=t.activeTouch,n.end=+new Date)}function M(ee){if(ee.touches.length!=1)return!1;var de=ee.touches[0];return de.radiusX<=1&&de.radiusY<=1}function z(ee,de){if(de.left==null)return!0;var Ce=de.left-ee.left,Ae=de.top-ee.top;return Ce*Ce+Ae*Ae>20*20}Re(t.scroller,"touchstart",function(ee){if(!Me(e,ee)&&!M(ee)&&!$a(e,ee)){t.input.ensurePolled(),clearTimeout(i);var de=+new Date;t.activeTouch={start:de,moved:!1,prev:de-n.end<=300?n:null},ee.touches.length==1&&(t.activeTouch.left=ee.touches[0].pageX,t.activeTouch.top=ee.touches[0].pageY)}}),Re(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Re(t.scroller,"touchend",function(ee){var de=t.activeTouch;if(de&&!Di(t,ee)&&de.left!=null&&!de.moved&&new Date-de.start<300){var Ce=e.coordsChar(t.activeTouch,"page"),Ae;!de.prev||z(de,de.prev)?Ae=new yn(Ce,Ce):!de.prev.prev||z(de,de.prev.prev)?Ae=e.findWordAt(Ce):Ae=new yn($e(Ce.line,0),C(e.doc,$e(Ce.line+1,0))),e.setSelection(Ae.anchor,Ae.head),e.focus(),le(ee)}f()}),Re(t.scroller,"touchcancel",f),Re(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Or(e,t.scroller.scrollTop),qi(e,t.scroller.scrollLeft,!0),De(e,"scroll",e))}),Re(t.scroller,"mousewheel",function(ee){return Mo(e,ee)}),Re(t.scroller,"DOMMouseScroll",function(ee){return Mo(e,ee)}),Re(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(ee){Me(e,ee)||xe(ee)},over:function(ee){Me(e,ee)||(Al(e,ee),xe(ee))},start:function(ee){return Ol(e,ee)},drop:zn(e,Sl),leave:function(ee){Me(e,ee)||us(e)}};var q=t.input.getField();Re(q,"keyup",function(ee){return _s.call(e,ee)}),Re(q,"keydown",zn(e,bs)),Re(q,"keypress",zn(e,Es)),Re(q,"focus",function(ee){return La(e,ee)}),Re(q,"blur",function(ee){return lr(e,ee)})}var Ja=[];On.defineInitHook=function(e){return Ja.push(e)};function zr(e,t,i,n){var f=e.doc,M;i==null&&(i="add"),i=="smart"&&(f.mode.indent?M=ft(e,t).state:i="prev");var z=e.options.tabSize,q=dt(f,t),ee=K(q.text,null,z);q.stateAfter&&(q.stateAfter=null);var de=q.text.match(/^\s*/)[0],Ce;if(!n&&!/\S/.test(q.text))Ce=0,i="not";else if(i=="smart"&&(Ce=f.mode.indent(M,q.text.slice(de.length),q.text),Ce==_e||Ce>150)){if(!n)return;i="prev"}i=="prev"?t>f.first?Ce=K(dt(f,t-1).text,null,z):Ce=0:i=="add"?Ce=ee+e.options.indentUnit:i=="subtract"?Ce=ee-e.options.indentUnit:typeof i=="number"&&(Ce=ee+i),Ce=Math.max(0,Ce);var Ae="",Fe=0;if(e.options.indentWithTabs)for(var Ne=Math.floor(Ce/z);Ne;--Ne)Fe+=z,Ae+=" ";if(Fe<Ce&&(Ae+=oe(Ce-Fe)),Ae!=de)return pr(f,Ae,$e(t,0),$e(t,de.length),"+input"),q.stateAfter=null,!0;for(var Xe=0;Xe<f.sel.ranges.length;Xe++){var at=f.sel.ranges[Xe];if(at.head.line==t&&at.head.ch<de.length){var pt=$e(t,de.length);Ka(f,Xe,new yn(pt,pt));break}}}var Oi=null;function ha(e){Oi=e}function Qa(e,t,i,n,f){var M=e.doc;e.display.shift=!1,n||(n=M.sel);var z=+new Date-200,q=f=="paste"||e.state.pasteIncoming>z,ee=yt(t),de=null;if(q&&n.ranges.length>1)if(Oi&&Oi.text.join(`
|
|
`)==t){if(n.ranges.length%Oi.text.length==0){de=[];for(var Ce=0;Ce<Oi.text.length;Ce++)de.push(M.splitLines(Oi.text[Ce]))}}else ee.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(de=ne(ee,function(_t){return[_t]}));for(var Ae=e.curOp.updateInput,Fe=n.ranges.length-1;Fe>=0;Fe--){var Ne=n.ranges[Fe],Xe=Ne.from(),at=Ne.to();Ne.empty()&&(i&&i>0?Xe=$e(Xe.line,Xe.ch-i):e.state.overwrite&&!q?at=$e(at.line,Math.min(dt(M,at.line).text.length,at.ch+Z(ee).length)):q&&Oi&&Oi.lineWise&&Oi.text.join(`
|
|
`)==ee.join(`
|
|
`)&&(Xe=at=$e(Xe.line,0)));var pt={from:Xe,to:at,text:de?de[Fe%de.length]:ee,origin:f||(q?"paste":e.state.cutIncoming>z?"cut":"+input")};fr(e.doc,pt),dn(e,"inputRead",e,pt)}t&&!q&&Rs(e,t),ur(e),e.curOp.updateInput<2&&(e.curOp.updateInput=Ae),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function As(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&pi(t,function(){return Qa(t,i,0,null,"paste")}),!0}function Rs(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var i=e.doc.sel,n=i.ranges.length-1;n>=0;n--){var f=i.ranges[n];if(f.head.ch>100||n&&i.ranges[n-1].head.line==f.head.line)continue;var M=e.getModeAt(f.head),z=!1;if(M.electricChars){for(var q=0;q<M.electricChars.length;q++)if(t.indexOf(M.electricChars.charAt(q))>-1){z=zr(e,f.head.line,"smart");break}}else M.electricInput&&(M.electricInput.test(dt(e.doc,f.head.line).text.slice(0,f.head.ch))&&(z=zr(e,f.head.line,"smart")));z&&dn(e,"electricInput",e,f.head.line)}}function Ls(e){for(var t=[],i=[],n=0;n<e.doc.sel.ranges.length;n++){var f=e.doc.sel.ranges[n].head.line,M={anchor:$e(f,0),head:$e(f+1,0)};i.push(M),t.push(e.getRange(M.anchor,M.head))}return{text:t,ranges:i}}function Is(e,t,i,n){e.setAttribute("autocorrect",i?"":"off"),e.setAttribute("autocapitalize",n?"":"off"),e.setAttribute("spellcheck",!!t)}function Ds(){var e=d("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=d("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return k?e.style.width="1000px":e.setAttribute("wrap","off"),c&&(e.style.border="1px solid black"),Is(e),t}function ql(e){var t=e.optionHandlers,i=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(n,f){var M=this.options,z=M[n];if(M[n]==f&&n!="mode")return;M[n]=f,t.hasOwnProperty(n)&&zn(this,t[n])(this,f,z),De(this,"optionChange",this,n)},getOption:function(n){return this.options[n]},getDoc:function(){return this.doc},addKeyMap:function(n,f){this.state.keyMaps[f?"push":"unshift"](ua(n))},removeKeyMap:function(n){for(var f=this.state.keyMaps,M=0;M<f.length;++M)if(f[M]==n||f[M].name==n)return f.splice(M,1),!0},addOverlay:ri(function(n,f){var M=n.token?n:e.getMode(this.options,n);if(M.startState)throw new Error("Overlays may not be stateful.");se(this.state.overlays,{mode:M,modeSpec:n,opaque:f&&f.opaque,priority:f&&f.priority||0},function(z){return z.priority}),this.state.modeGen++,oi(this)}),removeOverlay:ri(function(n){for(var f=this.state.overlays,M=0;M<f.length;++M){var z=f[M].modeSpec;if(z==n||typeof n=="string"&&z.name==n){f.splice(M,1),this.state.modeGen++,oi(this);return}}}),indentLine:ri(function(n,f,M){typeof f!="string"&&typeof f!="number"&&(f==null?f=this.options.smartIndent?"smart":"prev":f=f?"add":"subtract"),Mn(this.doc,n)&&zr(this,n,f,M)}),indentSelection:ri(function(n){for(var f=this.doc.sel.ranges,M=-1,z=0;z<f.length;z++){var q=f[z];if(q.empty())q.head.line>M&&(zr(this,q.head.line,n,!0),M=q.head.line,z==this.doc.sel.primIndex&&ur(this));else{var ee=q.from(),de=q.to(),Ce=Math.max(M,ee.line);M=Math.min(this.lastLine(),de.line-(de.ch?0:1))+1;for(var Ae=Ce;Ae<M;++Ae)zr(this,Ae,n);var Fe=this.doc.sel.ranges;ee.ch==0&&f.length==Fe.length&&Fe[z].from().ch>0&&Ka(this.doc,z,new yn(ee,Fe[z].to()),Te)}}}),getTokenAt:function(n,f){return fn(this,n,f)},getLineTokens:function(n,f){return fn(this,$e(n),f,!0)},getTokenTypeAt:function(n){n=C(this.doc,n);var f=Ye(this,dt(this.doc,n.line)),M=0,z=(f.length-1)/2,q=n.ch,ee;if(q==0)ee=f[2];else for(;;){var de=M+z>>1;if((de?f[de*2-1]:0)>=q)z=de;else if(f[de*2+1]<q)M=de+1;else{ee=f[de*2+2];break}}var Ce=ee?ee.indexOf("overlay "):-1;return Ce<0?ee:Ce==0?null:ee.slice(0,Ce-1)},getModeAt:function(n){var f=this.doc.mode;return f.innerMode?e.innerMode(f,this.getTokenAt(n).state).mode:f},getHelper:function(n,f){return this.getHelpers(n,f)[0]},getHelpers:function(n,f){var M=[];if(!i.hasOwnProperty(f))return M;var z=i[f],q=this.getModeAt(n);if(typeof q[f]=="string")z[q[f]]&&M.push(z[q[f]]);else if(q[f])for(var ee=0;ee<q[f].length;ee++){var de=z[q[f][ee]];de&&M.push(de)}else q.helperType&&z[q.helperType]?M.push(z[q.helperType]):z[q.name]&&M.push(z[q.name]);for(var Ce=0;Ce<z._global.length;Ce++){var Ae=z._global[Ce];Ae.pred(q,this)&&ie(M,Ae.val)==-1&&M.push(Ae.val)}return M},getStateAfter:function(n,f){var M=this.doc;return n=V(M,n==null?M.first+M.size-1:n),ft(this,n+1,f).state},cursorCoords:function(n,f){var M,z=this.doc.sel.primary();return n==null?M=z.head:typeof n=="object"?M=C(this.doc,n):M=n?z.from():z.to(),Ci(this,M,f||"page")},charCoords:function(n,f){return xa(this,C(this.doc,n),f||"page")},coordsChar:function(n,f){return n=po(this,n,f||"page"),wa(this,n.left,n.top)},lineAtHeight:function(n,f){return n=po(this,{top:n,left:0},f||"page").top,vn(this.doc,n+this.display.viewOffset)},heightAtLine:function(n,f,M){var z=!1,q;if(typeof n=="number"){var ee=this.doc.first+this.doc.size-1;n<this.doc.first?n=this.doc.first:n>ee&&(n=ee,z=!0),q=dt(this.doc,n)}else q=n;return Yr(this,q,{top:0,left:0},f||"page",M||z).top+(z?this.doc.height-gi(q):0)},defaultTextHeight:function(){return or(this.display)},defaultCharWidth:function(){return sr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(n,f,M,z,q){var ee=this.display;n=Ci(this,C(this.doc,n));var de=n.bottom,Ce=n.left;if(f.style.position="absolute",f.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(f),ee.sizer.appendChild(f),z=="over")de=n.top;else if(z=="above"||z=="near"){var Ae=Math.max(ee.wrapper.clientHeight,this.doc.height),Fe=Math.max(ee.sizer.clientWidth,ee.lineSpace.clientWidth);(z=="above"||n.bottom+f.offsetHeight>Ae)&&n.top>f.offsetHeight?de=n.top-f.offsetHeight:n.bottom+f.offsetHeight<=Ae&&(de=n.bottom),Ce+f.offsetWidth>Fe&&(Ce=Fe-f.offsetWidth)}f.style.top=de+"px",f.style.left=f.style.right="",q=="right"?(Ce=ee.sizer.clientWidth-f.offsetWidth,f.style.right="0px"):(q=="left"?Ce=0:q=="middle"&&(Ce=(ee.sizer.clientWidth-f.offsetWidth)/2),f.style.left=Ce+"px"),M&&Js(this,{left:Ce,top:de,right:Ce+f.offsetWidth,bottom:de+f.offsetHeight})},triggerOnKeyDown:ri(bs),triggerOnKeyPress:ri(Es),triggerOnKeyUp:_s,triggerOnMouseDown:ri(xs),execCommand:function(n){if(Hr.hasOwnProperty(n))return Hr[n].call(null,this)},triggerElectric:ri(function(n){Rs(this,n)}),findPosH:function(n,f,M,z){var q=1;f<0&&(q=-1,f=-f);for(var ee=C(this.doc,n),de=0;de<f&&!(ee=Za(this.doc,ee,q,M,z),ee.hitSide);++de);return ee},moveH:ri(function(n,f){var M=this;this.extendSelectionsBy(function(z){return M.display.shift||M.doc.extend||z.empty()?Za(M.doc,z.head,n,f,M.options.rtlMoveVisually):n<0?z.from():z.to()},re)}),deleteH:ri(function(n,f){var M=this.doc.sel,z=this.doc;M.somethingSelected()?z.replaceSelection("",null,"+delete"):vr(this,function(q){var ee=Za(z,q.head,n,f,!1);return n<0?{from:ee,to:q.head}:{from:q.head,to:ee}})}),findPosV:function(n,f,M,z){var q=1,ee=z;f<0&&(q=-1,f=-f);for(var de=C(this.doc,n),Ce=0;Ce<f;++Ce){var Ae=Ci(this,de,"div");if(ee==null?ee=Ae.left:Ae.left=ee,de=ks(this,Ae,q,M),de.hitSide)break}return de},moveV:ri(function(n,f){var M=this,z=this.doc,q=[],ee=!this.display.shift&&!z.extend&&z.sel.somethingSelected();if(z.extendSelectionsBy(function(Ce){if(ee)return n<0?Ce.from():Ce.to();var Ae=Ci(M,Ce.head,"div");Ce.goalColumn!=null&&(Ae.left=Ce.goalColumn),q.push(Ae.left);var Fe=ks(M,Ae,n,f);return f=="page"&&Ce==z.sel.primary()&&Da(M,xa(M,Fe,"div").top-Ae.top),Fe},re),q.length)for(var de=0;de<z.sel.ranges.length;de++)z.sel.ranges[de].goalColumn=q[de]}),findWordAt:function(n){var f=this.doc,M=dt(f,n.line).text,z=n.ch,q=n.ch;if(M){var ee=this.getHelper(n,"wordChars");(n.sticky=="before"||q==M.length)&&z?--z:++q;for(var de=M.charAt(z),Ce=Pe(de,ee)?function(Ae){return Pe(Ae,ee)}:/\s/.test(de)?function(Ae){return/\s/.test(Ae)}:function(Ae){return!/\s/.test(Ae)&&!Pe(Ae)};z>0&&Ce(M.charAt(z-1));)--z;for(;q<M.length&&Ce(M.charAt(q));)++q}return new yn($e(n.line,z),$e(n.line,q))},toggleOverwrite:function(n){if(n!=null&&n==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?P(this.display.cursorDiv,"CodeMirror-overwrite"):y(this.display.cursorDiv,"CodeMirror-overwrite"),De(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==U()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:ri(function(n,f){Sr(this,n,f)}),getScrollInfo:function(){var n=this.display.scroller;return{left:n.scrollLeft,top:n.scrollTop,height:n.scrollHeight-Ai(this)-this.display.barHeight,width:n.scrollWidth-Ai(this)-this.display.barWidth,clientHeight:ba(this),clientWidth:$i(this)}},scrollIntoView:ri(function(n,f){n==null?(n={from:this.doc.sel.primary().head,to:null},f==null&&(f=this.options.cursorScrollMargin)):typeof n=="number"?n={from:$e(n,0),to:null}:n.from==null&&(n={from:n,to:null}),n.to||(n.to=n.from),n.margin=f||0,n.from.line!=null?Qs(this,n):Co(this,n.from,n.to,n.margin)}),setSize:ri(function(n,f){var M=this,z=function(ee){return typeof ee=="number"||/^\d+$/.test(String(ee))?ee+"px":ee};n!=null&&(this.display.wrapper.style.width=z(n)),f!=null&&(this.display.wrapper.style.height=z(f)),this.options.lineWrapping&&co(this);var q=this.display.viewFrom;this.doc.iter(q,this.display.viewTo,function(ee){if(ee.widgets){for(var de=0;de<ee.widgets.length;de++)if(ee.widgets[de].noHScroll){ji(M,q,"widget");break}}++q}),this.curOp.forceUpdate=!0,De(this,"refresh",this)}),operation:function(n){return pi(this,n)},startOperation:function(){return tr(this)},endOperation:function(){return nr(this)},refresh:ri(function(){var n=this.display.cachedTextHeight;oi(this),this.curOp.forceUpdate=!0,wr(this),Sr(this,this.doc.scrollLeft,this.doc.scrollTop),Ma(this.display),(n==null||Math.abs(n-or(this.display))>.5||this.options.lineWrapping)&&Aa(this),De(this,"refresh",this)}),swapDoc:ri(function(n){var f=this.doc;return f.cm=null,this.state.selectingText&&this.state.selectingText(),Bo(this,n),wr(this),this.display.input.reset(),Sr(this,n.scrollLeft,n.scrollTop),this.curOp.forceScroll=!0,dn(this,"swapDoc",this,f),f}),phrase:function(n){var f=this.options.phrases;return f&&Object.prototype.hasOwnProperty.call(f,n)?f[n]:n},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}},ge(e),e.registerHelper=function(n,f,M){i.hasOwnProperty(n)||(i[n]=e[n]={_global:[]}),i[n][f]=M},e.registerGlobalHelper=function(n,f,M,z){e.registerHelper(n,f,z),i[n]._global.push({pred:M,val:z})}}function Za(e,t,i,n,f){var M=t,z=i,q=dt(e,t.line),ee=f&&e.direction=="rtl"?-i:i;function de(){var St=t.line+ee;return St<e.first||St>=e.first+e.size?!1:(t=new $e(St,t.ch,t.sticky),q=dt(e,St))}function Ce(St){var Et;if(n=="codepoint"){var Rt=q.text.charCodeAt(t.ch+(n>0?0:-1));isNaN(Rt)?Et=null:Et=new $e(t.line,Math.max(0,Math.min(q.text.length,t.ch+i*(Rt>=55296&&Rt<56320?2:1))),-i)}else f?Et=Pl(e.cm,q,t,i):Et=za(q,t,i);if(Et==null)if(!St&&de())t=Va(f,e.cm,q,t.line,ee);else return!1;else t=Et;return!0}if(n=="char"||n=="codepoint")Ce();else if(n=="column")Ce(!0);else if(n=="word"||n=="group")for(var Ae=null,Fe=n=="group",Ne=e.cm&&e.cm.getHelper(t,"wordChars"),Xe=!0;!(i<0&&!Ce(!Xe));Xe=!1){var at=q.text.charAt(t.ch)||`
|
|
`,pt=Pe(at,Ne)?"w":Fe&&at==`
|
|
`?"n":!Fe||/\s/.test(at)?null:"p";if(Fe&&!Xe&&!pt&&(pt="s"),Ae&&Ae!=pt){i<0&&(i=1,Ce(),t.sticky="after");break}if(pt&&(Ae=pt),i>0&&!Ce(!Xe))break}var _t=oa(e,t,M,z,!0);return Jt(M,_t)&&(_t.hitSide=!0),_t}function ks(e,t,i,n){var f=e.doc,M=t.left,z;if(n=="page"){var q=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),ee=Math.max(q-.5*or(e.display),3);z=(i>0?t.bottom:t.top)+i*ee}else n=="line"&&(z=i>0?t.bottom+3:t.top-3);for(var de;!(de=wa(e,M,z),!de.outside);){if(i<0?z<=0:z>=f.height){de.hitSide=!0;break}z+=i*5}return de}var xn=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new J,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};xn.prototype.init=function(e){var t=this,i=this,n=i.cm,f=i.div=e.lineDiv;Is(f,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize);function M(q){for(var ee=q.target;ee;ee=ee.parentNode){if(ee==f)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(ee.className))break}return!1}Re(f,"paste",function(q){if(!M(q)||Me(n,q)||As(q,n))return;B<=11&&setTimeout(zn(n,function(){return t.updateFromDOM()}),20)}),Re(f,"compositionstart",function(q){t.composing={data:q.data,done:!1}}),Re(f,"compositionupdate",function(q){t.composing||(t.composing={data:q.data,done:!1})}),Re(f,"compositionend",function(q){t.composing&&(q.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Re(f,"touchstart",function(){return i.forceCompositionEnd()}),Re(f,"input",function(){t.composing||t.readFromDOMSoon()});function z(q){if(!M(q)||Me(n,q))return;if(n.somethingSelected())ha({lineWise:!1,text:n.getSelections()}),q.type=="cut"&&n.replaceSelection("",null,"cut");else if(n.options.lineWiseCopyCut){var ee=Ls(n);ha({lineWise:!0,text:ee.text}),q.type=="cut"&&n.operation(function(){n.setSelections(ee.ranges,0,Te),n.replaceSelection("",null,"cut")})}else return;if(q.clipboardData){q.clipboardData.clearData();var de=Oi.text.join(`
|
|
`);if(q.clipboardData.setData("Text",de),q.clipboardData.getData("Text")==de){q.preventDefault();return}}var Ce=Ds(),Ae=Ce.firstChild;n.display.lineSpace.insertBefore(Ce,n.display.lineSpace.firstChild),Ae.value=Oi.text.join(`
|
|
`);var Fe=document.activeElement;H(Ae),setTimeout(function(){n.display.lineSpace.removeChild(Ce),Fe.focus(),Fe==f&&i.showPrimarySelection()},50)}Re(f,"copy",z),Re(f,"cut",z)},xn.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},xn.prototype.prepareSelection=function(){var e=_o(this.cm,!1);return e.focus=document.activeElement==this.div,e},xn.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},xn.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},xn.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),n=i.from(),f=i.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||f.line<t.display.viewFrom){e.removeAllRanges();return}var M=fa(t,e.anchorNode,e.anchorOffset),z=fa(t,e.focusNode,e.focusOffset);if(M&&!M.bad&&z&&!z.bad&&ct(cn(M,z),n)==0&&ct(_n(M,z),f)==0)return;var q=t.display.view,ee=n.line>=t.display.viewFrom&&Ps(t,n)||{node:q[0].measure.map[2],offset:0},de=f.line<t.display.viewTo&&Ps(t,f);if(!de){var Ce=q[q.length-1].measure,Ae=Ce.maps?Ce.maps[Ce.maps.length-1]:Ce.map;de={node:Ae[Ae.length-1],offset:Ae[Ae.length-2]-Ae[Ae.length-3]}}if(!ee||!de){e.removeAllRanges();return}var Fe=e.rangeCount&&e.getRangeAt(0),Ne;try{Ne=l(ee.node,ee.offset,de.offset,de.node)}catch(Xe){}Ne&&(!N&&t.state.focused?(e.collapse(ee.node,ee.offset),Ne.collapsed||(e.removeAllRanges(),e.addRange(Ne))):(e.removeAllRanges(),e.addRange(Ne)),Fe&&e.anchorNode==null?e.addRange(Fe):N&&this.startGracePeriod()),this.rememberSelection()},xn.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)},xn.prototype.showMultipleSelections=function(e){p(this.cm.display.cursorDiv,e.cursors),p(this.cm.display.selectionDiv,e.selection)},xn.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},xn.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return E(this.div,t)},xn.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},xn.prototype.blur=function(){this.div.blur()},xn.prototype.getField=function(){return this.div},xn.prototype.supportsTouch=function(){return!0},xn.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():pi(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)},xn.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},xn.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(s&&b&&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 i=fa(t,e.anchorNode,e.anchorOffset),n=fa(t,e.focusNode,e.focusOffset);i&&n&&pi(t,function(){Zn(t.doc,Wi(i,n),Te),(i.bad||n.bad)&&(t.curOp.selectionChanged=!0)})},xn.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,i=e.doc.sel.primary(),n=i.from(),f=i.to();if(n.ch==0&&n.line>e.firstLine()&&(n=$e(n.line-1,dt(e.doc,n.line-1).length)),f.ch==dt(e.doc,f.line).text.length&&f.line<e.lastLine()&&(f=$e(f.line+1,0)),n.line<t.viewFrom||f.line>t.viewTo-1)return!1;var M,z,q;n.line==t.viewFrom||(M=Zi(e,n.line))==0?(z=Kt(t.view[0].line),q=t.view[0].node):(z=Kt(t.view[M].line),q=t.view[M-1].node.nextSibling);var ee=Zi(e,f.line),de,Ce;if(ee==t.view.length-1?(de=t.viewTo-1,Ce=t.lineDiv.lastChild):(de=Kt(t.view[ee+1].line)-1,Ce=t.view[ee+1].node.previousSibling),!q)return!1;for(var Ae=e.doc.splitLines(tu(e,q,Ce,z,de)),Fe=Vt(e.doc,$e(z,0),$e(de,dt(e.doc,de).text.length));Ae.length>1&&Fe.length>1;)if(Z(Ae)==Z(Fe))Ae.pop(),Fe.pop(),de--;else if(Ae[0]==Fe[0])Ae.shift(),Fe.shift(),z++;else break;for(var Ne=0,Xe=0,at=Ae[0],pt=Fe[0],_t=Math.min(at.length,pt.length);Ne<_t&&at.charCodeAt(Ne)==pt.charCodeAt(Ne);)++Ne;for(var St=Z(Ae),Et=Z(Fe),Rt=Math.min(St.length-(Ae.length==1?Ne:0),Et.length-(Fe.length==1?Ne:0));Xe<Rt&&St.charCodeAt(St.length-Xe-1)==Et.charCodeAt(Et.length-Xe-1);)++Xe;if(Ae.length==1&&Fe.length==1&&z==n.line)for(;Ne&&Ne>n.ch&&St.charCodeAt(St.length-Xe-1)==Et.charCodeAt(Et.length-Xe-1);)Ne--,Xe++;Ae[Ae.length-1]=St.slice(0,St.length-Xe).replace(/^\u200b+/,""),Ae[0]=Ae[0].slice(Ne).replace(/\u200b+$/,"");var jt=$e(z,Ne),Ut=$e(de,Fe.length?Z(Fe).length-Xe:0);if(Ae.length>1||Ae[0]||ct(jt,Ut))return pr(e.doc,Ae,jt,Ut,"+input"),!0},xn.prototype.ensurePolled=function(){this.forceCompositionEnd()},xn.prototype.reset=function(){this.forceCompositionEnd()},xn.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},xn.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)},xn.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&pi(this.cm,function(){return oi(e.cm)})},xn.prototype.setUneditable=function(e){e.contentEditable="false"},xn.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||zn(this.cm,Qa)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},xn.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},xn.prototype.onContextMenu=function(){},xn.prototype.resetPosition=function(){},xn.prototype.needsContentAttribute=!0;function Ps(e,t){var i=_a(e,t.line);if(!i||i.hidden)return null;var n=dt(e.doc,t.line),f=ao(i,n,t.line),M=ht(n,e.doc.direction),z="left";if(M){var q=st(M,t.ch);z=q%2?"right":"left"}var ee=lo(f.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 br(e,t){return t&&(e.bad=!0),e}function tu(e,t,i,n,f){var M="",z=!1,q=e.doc.lineSeparator(),ee=!1;function de(Ne){return function(Xe){return Xe.id==Ne}}function Ce(){z&&(M+=q,ee&&(M+=q),z=ee=!1)}function Ae(Ne){Ne&&(Ce(),M+=Ne)}function Fe(Ne){if(Ne.nodeType==1){var Xe=Ne.getAttribute("cm-text");if(Xe){Ae(Xe);return}var at=Ne.getAttribute("cm-marker"),pt;if(at){var _t=e.findMarks($e(n,0),$e(f+1,0),de(+at));_t.length&&(pt=_t[0].find(0))&&Ae(Vt(e.doc,pt.from,pt.to).join(q));return}if(Ne.getAttribute("contenteditable")=="false")return;var St=/^(pre|div|p|li|table|br)$/i.test(Ne.nodeName);if(!/^br$/i.test(Ne.nodeName)&&Ne.textContent.length==0)return;St&&Ce();for(var Et=0;Et<Ne.childNodes.length;Et++)Fe(Ne.childNodes[Et]);/^(pre|p)$/i.test(Ne.nodeName)&&(ee=!0),St&&(z=!0)}else Ne.nodeType==3&&Ae(Ne.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Fe(t),t==i);)t=t.nextSibling,ee=!1;return M}function fa(e,t,i){var n;if(t==e.display.lineDiv){if(n=e.display.lineDiv.childNodes[i],!n)return br(e.clipPos($e(e.display.viewTo-1)),!0);t=null,i=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var f=0;f<e.display.view.length;f++){var M=e.display.view[f];if(M.node==n)return nu(M,t,i)}}function nu(e,t,i){var n=e.text.firstChild,f=!1;if(!t||!E(n,t))return br($e(Kt(e.line),0),!0);if(t==n&&(f=!0,t=n.childNodes[i],i=0,!t)){var M=e.rest?Z(e.rest):e.line;return br($e(Kt(M),M.text.length),f)}var z=t.nodeType==3?t:null,q=t;for(!z&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(z=t.firstChild,i&&(i=z.nodeValue.length));q.parentNode!=n;)q=q.parentNode;var ee=e.measure,de=ee.maps;function Ce(pt,_t,St){for(var Et=-1;Et<(de?de.length:0);Et++)for(var Rt=Et<0?ee.map:de[Et],jt=0;jt<Rt.length;jt+=3){var Ut=Rt[jt+2];if(Ut==pt||Ut==_t){var qt=Kt(Et<0?e.line:e.rest[Et]),Cn=Rt[jt]+St;return(St<0||Ut!=pt)&&(Cn=Rt[jt+(St?1:0)]),$e(qt,Cn)}}}var Ae=Ce(z,q,i);if(Ae)return br(Ae,f);for(var Fe=q.nextSibling,Ne=z?z.nodeValue.length-i:0;Fe;Fe=Fe.nextSibling){if(Ae=Ce(Fe,Fe.firstChild,0),Ae)return br($e(Ae.line,Ae.ch-Ne),f);Ne+=Fe.textContent.length}for(var Xe=q.previousSibling,at=i;Xe;Xe=Xe.previousSibling){if(Ae=Ce(Xe,Xe.firstChild,-1),Ae)return br($e(Ae.line,Ae.ch+at),f);at+=Xe.textContent.length}}var Pn=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new J,this.hasSelection=!1,this.composing=null};Pn.prototype.init=function(e){var t=this,i=this,n=this.cm;this.createField(e);var f=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),c&&(f.style.width="0px"),Re(f,"input",function(){G&&B>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),Re(f,"paste",function(z){if(Me(n,z)||As(z,n))return;n.state.pasteIncoming=+new Date,i.fastPoll()});function M(z){if(Me(n,z))return;if(n.somethingSelected())ha({lineWise:!1,text:n.getSelections()});else if(n.options.lineWiseCopyCut){var q=Ls(n);ha({lineWise:!0,text:q.text}),z.type=="cut"?n.setSelections(q.ranges,null,Te):(i.prevInput="",f.value=q.text.join(`
|
|
`),H(f))}else return;z.type=="cut"&&(n.state.cutIncoming=+new Date)}Re(f,"cut",M),Re(f,"copy",M),Re(e.scroller,"paste",function(z){if(Di(e,z)||Me(n,z))return;if(!f.dispatchEvent){n.state.pasteIncoming=+new Date,i.focus();return}var q=new Event("paste");q.clipboardData=z.clipboardData,f.dispatchEvent(q)}),Re(e.lineSpace,"selectstart",function(z){Di(e,z)||le(z)}),Re(f,"compositionstart",function(){var z=n.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:z,range:n.markText(z,n.getCursor("to"),{className:"CodeMirror-composing"})}}),Re(f,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},Pn.prototype.createField=function(e){this.wrapper=Ds(),this.textarea=this.wrapper.firstChild},Pn.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Pn.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,n=_o(e);if(e.options.moveInputWithCursor){var f=Ci(e,i.sel.primary().head,"div"),M=t.wrapper.getBoundingClientRect(),z=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,f.top+z.top-M.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,f.left+z.left-M.left))}return n},Pn.prototype.showSelection=function(e){var t=this.cm,i=t.display;p(i.cursorDiv,e.cursors),p(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Pn.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&H(this.textarea),G&&B>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",G&&B>=9&&(this.hasSelection=null))},Pn.prototype.getField=function(){return this.textarea},Pn.prototype.supportsTouch=function(){return!1},Pn.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||U()!=this.textarea))try{this.textarea.focus()}catch(e){}},Pn.prototype.blur=function(){this.textarea.blur()},Pn.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Pn.prototype.receivedFocus=function(){this.slowPoll()},Pn.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()})},Pn.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var n=t.poll();!n&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},Pn.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||lt(i)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var f=i.value;if(f==n&&!t.somethingSelected())return!1;if(G&&B>=9&&this.hasSelection===f||o&&/[\uf700-\uf7ff]/.test(f))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var M=f.charCodeAt(0);if(M==8203&&!n&&(n="\u200B"),M==8666)return this.reset(),this.cm.execCommand("undo")}for(var z=0,q=Math.min(n.length,f.length);z<q&&n.charCodeAt(z)==f.charCodeAt(z);)++z;return pi(t,function(){Qa(t,f.slice(z),n.length-z,null,e.composing?"*compose":null),f.length>1e3||f.indexOf(`
|
|
`)>-1?i.value=e.prevInput="":e.prevInput=f,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Pn.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Pn.prototype.onKeyPress=function(){G&&B>=9&&(this.hasSelection=null),this.fastPoll()},Pn.prototype.onContextMenu=function(e){var t=this,i=t.cm,n=i.display,f=t.textarea;t.contextMenuPending&&t.contextMenuPending();var M=Qi(i,e),z=n.scroller.scrollTop;if(!M||v)return;var q=i.options.resetSelectionOnContextMenu;q&&i.doc.sel.contains(M)==-1&&zn(i,Zn)(i.doc,Wi(M),Te);var ee=f.style.cssText,de=t.wrapper.style.cssText,Ce=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",f.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: `+(G?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var Ae;k&&(Ae=window.scrollY),n.input.focus(),k&&window.scrollTo(null,Ae),n.input.reset(),i.somethingSelected()||(f.value=t.prevInput=" "),t.contextMenuPending=Ne,n.selForContextMenu=i.doc.sel,clearTimeout(n.detectingSelectAll);function Fe(){if(f.selectionStart!=null){var at=i.somethingSelected(),pt="\u200B"+(at?f.value:"");f.value="\u21DA",f.value=pt,t.prevInput=at?"":"\u200B",f.selectionStart=1,f.selectionEnd=pt.length,n.selForContextMenu=i.doc.sel}}function Ne(){if(t.contextMenuPending!=Ne)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=de,f.style.cssText=ee,G&&B<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=z),f.selectionStart!=null){(!G||G&&B<9)&&Fe();var at=0,pt=function(){n.selForContextMenu==i.doc.sel&&f.selectionStart==0&&f.selectionEnd>0&&t.prevInput=="\u200B"?zn(i,Zo)(i):at++<10?n.detectingSelectAll=setTimeout(pt,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(pt,200)}}if(G&&B>=9&&Fe(),A){xe(e);var Xe=function(){Ve(window,"mouseup",Xe),setTimeout(Ne,20)};Re(window,"mouseup",Xe)}else setTimeout(Ne,50)},Pn.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Pn.prototype.setUneditable=function(){},Pn.prototype.needsContentAttribute=!1;function iu(e,t){if(t=t?T(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 i=U();t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function n(){e.value=q.getValue()}var f;if(e.form&&(Re(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var M=e.form;f=M.submit;try{var z=M.submit=function(){n(),M.submit=f,M.submit(),M.submit=z}}catch(ee){}}t.finishInit=function(ee){ee.save=n,ee.getTextArea=function(){return e},ee.toTextArea=function(){ee.toTextArea=isNaN,n(),e.parentNode.removeChild(ee.getWrapperElement()),e.style.display="",e.form&&(Ve(e.form,"submit",n),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=f))}},e.style.display="none";var q=On(function(ee){return e.parentNode.insertBefore(ee,e.nextSibling)},t);return q}function ru(e){e.off=Ve,e.on=Re,e.wheelEventPixels=cl,e.Doc=si,e.splitLines=yt,e.countColumn=K,e.findColumn=fe,e.isWordChar=Le,e.Pass=_e,e.signal=De,e.Line=ci,e.changeEnd=Ki,e.scrollbarModel=Ao,e.Pos=$e,e.cmpPos=ct,e.modes=Mt,e.mimeModes=Ot,e.resolveMode=je,e.getMode=rt,e.modeExtensions=it,e.extendMode=et,e.copyState=Tt,e.startState=Dt,e.innerMode=kt,e.commands=Hr,e.keyMap=ki,e.keyName=ps,e.isModifierKey=hs,e.lookupKey=gr,e.normalizeKeyMap=kl,e.StringStream=vt,e.SharedTextMarker=Fr,e.TextMarker=zi,e.LineWidget=Ur,e.e_preventDefault=le,e.e_stopPropagation=ue,e.e_stop=xe,e.addClass=P,e.contains=E,e.rmClass=y,e.keyNames=Vi}$l(On),ql(On);var au="iter insert remove copy getEditor constructor".split(" ");for(var pa in si.prototype)si.prototype.hasOwnProperty(pa)&&ie(au,pa)<0&&(On.prototype[pa]=function(e){return function(){return e.apply(this.doc,arguments)}}(si.prototype[pa]));return ge(si),On.inputStyles={textarea:Pn,contenteditable:xn},On.defineMode=function(e){!On.defaults.mode&&e!="null"&&(On.defaults.mode=e),Lt.apply(this,arguments)},On.defineMIME=gt,On.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),On.defineMIME("text/plain","null"),On.defineExtension=function(e,t){On.prototype[e]=t},On.defineDocExtension=function(e,t){si.prototype[e]=t},On.fromTextArea=iu,ru(On),On.version="5.58.2",On})},WaYH:function(ut,Ke,$){"use strict";var ce=$("rePB"),Y=$("Ff2n"),N=$("VTBJ"),Q=$("1OyB"),F=$("vuIU"),D=$("JX7q"),G=$("Ji7U"),B=$("LK+K"),k=$("q1tI"),R=$("TSYQ"),b=$.n(R),v=$("sboe"),m=$("OZM5"),u=function(A){var S=A.prefixCls,y=A.level,_=A.isStart,p=A.isEnd;if(!y)return null;for(var d="".concat(S,"-indent-unit"),g=[],l=0;l<y;l+=1){var E;g.push(k.createElement("span",{key:l,className:b()(d,(E={},Object(ce.a)(E,"".concat(d,"-start"),_[l+1]),Object(ce.a)(E,"".concat(d,"-end"),p[l+1]),Object(ce.a)(E,"".concat(d,"-end-first-level"),!l&&p[0]),E))}))}return k.createElement("span",{"aria-hidden":"true",className:"".concat(S,"-indent")},g)},r=u,c=$("815F"),s="open",a="close",o="---",h=function(x){Object(G.a)(S,x);var A=Object(B.a)(S);function S(){var y;return Object(Q.a)(this,S),y=A.apply(this,arguments),y.state={dragNodeHighlight:!1},y.onSelectorClick=function(_){var p=y.props.context.onNodeClick;p(_,Object(c.b)(y.props)),y.isSelectable()?y.onSelect(_):y.onCheck(_)},y.onSelectorDoubleClick=function(_){var p=y.props.context.onNodeDoubleClick;p(_,Object(c.b)(y.props))},y.onSelect=function(_){if(y.isDisabled())return;var p=y.props.context.onNodeSelect;_.preventDefault(),p(_,Object(c.b)(y.props))},y.onCheck=function(_){if(y.isDisabled())return;var p=y.props,d=p.disableCheckbox,g=p.checked,l=y.props.context.onNodeCheck;if(!y.isCheckable()||d)return;_.preventDefault();var E=!g;l(_,Object(c.b)(y.props),E)},y.onMouseEnter=function(_){var p=y.props.context.onNodeMouseEnter;p(_,Object(c.b)(y.props))},y.onMouseLeave=function(_){var p=y.props.context.onNodeMouseLeave;p(_,Object(c.b)(y.props))},y.onContextMenu=function(_){var p=y.props.context.onNodeContextMenu;p(_,Object(c.b)(y.props))},y.onDragStart=function(_){var p=y.props.context.onNodeDragStart;_.stopPropagation(),y.setState({dragNodeHighlight:!0}),p(_,Object(D.a)(y));try{_.dataTransfer.setData("text/plain","")}catch(d){}},y.onDragEnter=function(_){var p=y.props.context.onNodeDragEnter;_.preventDefault(),_.stopPropagation(),p(_,Object(D.a)(y))},y.onDragOver=function(_){var p=y.props.context.onNodeDragOver;_.preventDefault(),_.stopPropagation(),p(_,Object(D.a)(y))},y.onDragLeave=function(_){var p=y.props.context.onNodeDragLeave;_.stopPropagation(),p(_,Object(D.a)(y))},y.onDragEnd=function(_){var p=y.props.context.onNodeDragEnd;_.stopPropagation(),y.setState({dragNodeHighlight:!1}),p(_,Object(D.a)(y))},y.onDrop=function(_){var p=y.props.context.onNodeDrop;_.preventDefault(),_.stopPropagation(),y.setState({dragNodeHighlight:!1}),p(_,Object(D.a)(y))},y.onExpand=function(_){var p=y.props.context.onNodeExpand;p(_,Object(c.b)(y.props))},y.setSelectHandle=function(_){y.selectHandle=_},y.getNodeState=function(){var _=y.props.expanded;return y.isLeaf()?null:_?s:a},y.hasChildren=function(){var _=y.props.eventKey,p=y.props.context.keyEntities,d=p[_]||{},g=d.children;return!!(g||[]).length},y.isLeaf=function(){var _=y.props,p=_.isLeaf,d=_.loaded,g=y.props.context.loadData,l=y.hasChildren();return p===!1?!1:p||!g&&!l||g&&d&&!l},y.isDisabled=function(){var _=y.props.disabled,p=y.props.context.disabled;return!!(p||_)},y.isCheckable=function(){var _=y.props.checkable,p=y.props.context.checkable;return!p||_===!1?!1:p},y.syncLoadData=function(_){var p=_.expanded,d=_.loading,g=_.loaded,l=y.props.context,E=l.loadData,U=l.onNodeLoad;if(d)return;E&&p&&!y.isLeaf()&&(!y.hasChildren()&&!g&&U(Object(c.b)(y.props)))},y.renderSwitcher=function(){var _=y.props,p=_.expanded,d=_.switcherIcon,g=y.props.context,l=g.prefixCls,E=g.switcherIcon,U=d||E;if(y.isLeaf())return k.createElement("span",{className:b()("".concat(l,"-switcher"),"".concat(l,"-switcher-noop"))},typeof U=="function"?U(Object(N.a)(Object(N.a)({},y.props),{},{isLeaf:!0})):U);var P=b()("".concat(l,"-switcher"),"".concat(l,"-switcher_").concat(p?s:a));return k.createElement("span",{onClick:y.onExpand,className:P},typeof U=="function"?U(Object(N.a)(Object(N.a)({},y.props),{},{isLeaf:!1})):U)},y.renderCheckbox=function(){var _=y.props,p=_.checked,d=_.halfChecked,g=_.disableCheckbox,l=y.props.context.prefixCls,E=y.isDisabled(),U=y.isCheckable();if(!U)return null;var P=typeof U!="boolean"?U:null;return k.createElement("span",{className:b()("".concat(l,"-checkbox"),p&&"".concat(l,"-checkbox-checked"),!p&&d&&"".concat(l,"-checkbox-indeterminate"),(E||g)&&"".concat(l,"-checkbox-disabled")),onClick:y.onCheck},P)},y.renderIcon=function(){var _=y.props.loading,p=y.props.context.prefixCls;return k.createElement("span",{className:b()("".concat(p,"-iconEle"),"".concat(p,"-icon__").concat(y.getNodeState()||"docu"),_&&"".concat(p,"-icon_loading"))})},y.renderSelector=function(){var _=y.state.dragNodeHighlight,p=y.props,d=p.title,g=p.selected,l=p.icon,E=p.loading,U=p.data,P=y.props.context,j=P.prefixCls,H=P.showIcon,I=P.icon,T=P.draggable,K=P.loadData,J=P.titleRender,ie=y.isDisabled(),pe="".concat(j,"-node-content-wrapper"),_e;if(H){var Te=l||I;_e=Te?k.createElement("span",{className:b()("".concat(j,"-iconEle"),"".concat(j,"-icon__customize"))},typeof Te=="function"?Te(y.props):Te):y.renderIcon()}else K&&E&&(_e=y.renderIcon());var he;typeof d=="function"?he=d(U):J?he=J(U):he=d;var re=k.createElement("span",{className:"".concat(j,"-title")},he);return k.createElement("span",{ref:y.setSelectHandle,title:typeof d=="string"?d:"",className:b()("".concat(pe),"".concat(pe,"-").concat(y.getNodeState()||"normal"),!ie&&(g||_)&&"".concat(j,"-node-selected"),!ie&&T&&"draggable"),draggable:!ie&&T||void 0,"aria-grabbed":!ie&&T||void 0,onMouseEnter:y.onMouseEnter,onMouseLeave:y.onMouseLeave,onContextMenu:y.onContextMenu,onClick:y.onSelectorClick,onDoubleClick:y.onSelectorDoubleClick,onDragStart:T?y.onDragStart:void 0},_e,re)},y}return Object(F.a)(S,[{key:"componentDidMount",value:function(){this.syncLoadData(this.props)}},{key:"componentDidUpdate",value:function(){this.syncLoadData(this.props)}},{key:"isSelectable",value:function(){var _=this.props.selectable,p=this.props.context.selectable;return typeof _=="boolean"?_:p}},{key:"render",value:function(){var _,p=this.props,d=p.eventKey,g=p.className,l=p.style,E=p.dragOver,U=p.dragOverGapTop,P=p.dragOverGapBottom,j=p.isLeaf,H=p.isStart,I=p.isEnd,T=p.expanded,K=p.selected,J=p.checked,ie=p.halfChecked,pe=p.loading,_e=p.domRef,Te=p.active,he=p.onMouseMove,re=Object(Y.a)(p,["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","onMouseMove"]),fe=this.props.context,ae=fe.prefixCls,oe=fe.filterTreeNode,Z=fe.draggable,ne=fe.keyEntities,se=this.isDisabled(),me=Object(m.f)(re),Se=ne[d]||{},Ee=Se.level,Le=I[I.length-1];return k.createElement("div",Object.assign({ref:_e,className:b()(g,"".concat(ae,"-treenode"),(_={},Object(ce.a)(_,"".concat(ae,"-treenode-disabled"),se),Object(ce.a)(_,"".concat(ae,"-treenode-switcher-").concat(T?"open":"close"),!j),Object(ce.a)(_,"".concat(ae,"-treenode-checkbox-checked"),J),Object(ce.a)(_,"".concat(ae,"-treenode-checkbox-indeterminate"),ie),Object(ce.a)(_,"".concat(ae,"-treenode-selected"),K),Object(ce.a)(_,"".concat(ae,"-treenode-loading"),pe),Object(ce.a)(_,"".concat(ae,"-treenode-active"),Te),Object(ce.a)(_,"".concat(ae,"-treenode-leaf-last"),Le),Object(ce.a)(_,"drag-over",!se&&E),Object(ce.a)(_,"drag-over-gap-top",!se&&U),Object(ce.a)(_,"drag-over-gap-bottom",!se&&P),Object(ce.a)(_,"filter-node",oe&&oe(Object(c.b)(this.props))),_)),style:l,onDragEnter:Z?this.onDragEnter:void 0,onDragOver:Z?this.onDragOver:void 0,onDragLeave:Z?this.onDragLeave:void 0,onDrop:Z?this.onDrop:void 0,onDragEnd:Z?this.onDragEnd:void 0,onMouseMove:he},me),k.createElement(r,{prefixCls:ae,level:Ee,isStart:H,isEnd:I}),this.renderSwitcher(),this.renderCheckbox(),this.renderSelector())}}]),S}(k.Component),O=function(A){return k.createElement(v.a.Consumer,null,function(S){return k.createElement(h,Object.assign({},A,{context:S}))})};O.displayName="TreeNode",O.defaultProps={title:o},O.isTreeNode=1;var w=Ke.a=O},XIdC:function(ut,Ke,$){"use strict";var ce=$("rePB"),Y=$("ODXe"),N=$("Ff2n"),Q=$("q1tI"),F=$.n(Q),D=$("TSYQ"),G=$.n(D),B=$("6cGi"),k=$("4IlW"),R=Q.forwardRef(function(b,v){var m,u=b.prefixCls,r=u===void 0?"rc-switch":u,c=b.className,s=b.checked,a=b.defaultChecked,o=b.disabled,h=b.loadingIcon,O=b.checkedChildren,w=b.unCheckedChildren,x=b.onClick,A=b.onChange,S=b.onKeyDown,y=Object(N.a)(b,["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"]),_=Object(B.a)(!1,{value:s,defaultValue:a}),p=Object(Y.a)(_,2),d=p[0],g=p[1];function l(j,H){var I=d;return o||(I=j,g(I),A==null||A(I,H)),I}function E(j){j.which===k.a.LEFT?l(!1,j):j.which===k.a.RIGHT&&l(!0,j),S==null||S(j)}function U(j){var H=l(!d,j);x==null||x(H,j)}var P=G()(r,c,(m={},Object(ce.a)(m,"".concat(r,"-checked"),d),Object(ce.a)(m,"".concat(r,"-disabled"),o),m));return Q.createElement("button",Object.assign({},y,{type:"button",role:"switch","aria-checked":d,disabled:o,className:P,ref:v,onKeyDown:E,onClick:U}),h,Q.createElement("span",{className:"".concat(r,"-inner")},d?O:w))});R.displayName="Switch",Ke.a=R},Y1PL:function(ut,Ke,$){"use strict";$.r(Ke),$.d(Ke,"ResizableTextArea",function(){return ie});var ce=$("wx14"),Y=$("1OyB"),N=$("vuIU"),Q=$("Ji7U"),F=$("LK+K"),D=$("q1tI"),G=$("VTBJ"),B=$("rePB"),k=$("Zm9Q"),R=$("Kwbf"),b=$("c+Xe"),v=$("m+aA"),m=$("bdgK"),u=new Map;function r(Te){Te.forEach(function(he){var re,fe=he.target;(re=u.get(fe))===null||re===void 0||re.forEach(function(ae){return ae(fe)})})}var c=new m.default(r),s=null,a=null;function o(Te,he){u.has(Te)||(u.set(Te,new Set),c.observe(Te)),u.get(Te).add(he)}function h(Te,he){u.has(Te)&&(u.get(Te).delete(he),u.get(Te).size||(c.unobserve(Te),u.delete(Te)))}var O=function(Te){Object(Q.a)(re,Te);var he=Object(F.a)(re);function re(){return Object(Y.a)(this,re),he.apply(this,arguments)}return Object(N.a)(re,[{key:"render",value:function(){return this.props.children}}]),re}(D.Component),w=D.createContext(null);function x(Te){var he=Te.children,re=Te.onBatchResize,fe=D.useRef(0),ae=D.useRef([]),oe=D.useContext(w),Z=D.useCallback(function(ne,se,me){fe.current+=1;var Se=fe.current;ae.current.push({size:ne,element:se,data:me}),Promise.resolve().then(function(){Se===fe.current&&(re==null||re(ae.current),ae.current=[])}),oe==null||oe(ne,se,me)},[re,oe]);return D.createElement(w.Provider,{value:Z},he)}function A(Te){var he=Te.children,re=Te.disabled,fe=D.useRef(null),ae=D.useRef(null),oe=D.useContext(w),Z=D.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ne=D.isValidElement(he)&&Object(b.c)(he),se=ne?he.ref:null,me=D.useMemo(function(){return Object(b.a)(se,fe)},[se,fe]),Se=D.useRef(Te);Se.current=Te;var Ee=D.useCallback(function(Le){var Pe=Se.current,Be=Pe.onResize,He=Pe.data,Ge=Le.getBoundingClientRect(),Ue=Ge.width,tt=Ge.height,nt=Le.offsetWidth,ot=Le.offsetHeight,st=Math.floor(Ue),mt=Math.floor(tt);if(Z.current.width!==st||Z.current.height!==mt||Z.current.offsetWidth!==nt||Z.current.offsetHeight!==ot){var ht={width:st,height:mt,offsetWidth:nt,offsetHeight:ot};Z.current=ht;var Ie=nt===Math.round(Ue)?Ue:nt,Re=ot===Math.round(tt)?tt:ot,ze=Object(G.a)(Object(G.a)({},ht),{},{offsetWidth:Ie,offsetHeight:Re});oe==null||oe(ze,Le,He),Be&&Promise.resolve().then(function(){Be(ze,Le)})}},[]);return D.useEffect(function(){var Le=Object(v.a)(fe.current)||Object(v.a)(ae.current);return Le&&!re&&o(Le,Ee),function(){return h(Le,Ee)}},[fe.current,re]),D.createElement(O,{ref:ae},ne?D.cloneElement(he,{ref:me}):he)}var S="rc-observer-key";function y(Te){var he=Te.children,re=Object(k.a)(he);return re.map(function(fe,ae){var oe=(fe==null?void 0:fe.key)||"".concat(S,"-").concat(ae);return D.createElement(A,Object(ce.a)({},Te,{key:oe}),fe)})}y.Collection=x;var _=y,p=$("bT9E"),d=$("TSYQ"),g=$.n(d),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
|
|
`,E=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],U={},P;function j(Te){var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,re=Te.getAttribute("id")||Te.getAttribute("data-reactid")||Te.getAttribute("name");if(he&&U[re])return U[re];var fe=window.getComputedStyle(Te),ae=fe.getPropertyValue("box-sizing")||fe.getPropertyValue("-moz-box-sizing")||fe.getPropertyValue("-webkit-box-sizing"),oe=parseFloat(fe.getPropertyValue("padding-bottom"))+parseFloat(fe.getPropertyValue("padding-top")),Z=parseFloat(fe.getPropertyValue("border-bottom-width"))+parseFloat(fe.getPropertyValue("border-top-width")),ne=E.map(function(me){return"".concat(me,":").concat(fe.getPropertyValue(me))}).join(";"),se={sizingStyle:ne,paddingSize:oe,borderSize:Z,boxSizing:ae};return he&&re&&(U[re]=se),se}function H(Te){var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,fe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;P||(P=document.createElement("textarea"),P.setAttribute("tab-index","-1"),P.setAttribute("aria-hidden","true"),document.body.appendChild(P)),Te.getAttribute("wrap")?P.setAttribute("wrap",Te.getAttribute("wrap")):P.removeAttribute("wrap");var ae=j(Te,he),oe=ae.paddingSize,Z=ae.borderSize,ne=ae.boxSizing,se=ae.sizingStyle;P.setAttribute("style","".concat(se,";").concat(l)),P.value=Te.value||Te.placeholder||"";var me=Number.MIN_SAFE_INTEGER,Se=Number.MAX_SAFE_INTEGER,Ee=P.scrollHeight,Le;if(ne==="border-box"?Ee+=Z:ne==="content-box"&&(Ee-=oe),re!==null||fe!==null){P.value=" ";var Pe=P.scrollHeight-oe;re!==null&&(me=Pe*re,ne==="border-box"&&(me=me+oe+Z),Ee=Math.max(me,Ee)),fe!==null&&(Se=Pe*fe,ne==="border-box"&&(Se=Se+oe+Z),Le=Ee>Se?"":"hidden",Ee=Math.min(Se,Ee))}return{height:Ee,minHeight:me,maxHeight:Se,overflowY:Le,resize:"none"}}var I=$("Gytx"),T=$.n(I),K;(function(Te){Te[Te.NONE=0]="NONE",Te[Te.RESIZING=1]="RESIZING",Te[Te.RESIZED=2]="RESIZED"})(K||(K={}));var J=function(Te){Object(Q.a)(re,Te);var he=Object(F.a)(re);function re(fe){var ae;return Object(Y.a)(this,re),ae=he.call(this,fe),ae.nextFrameActionId=void 0,ae.resizeFrameId=void 0,ae.textArea=void 0,ae.saveTextArea=function(oe){ae.textArea=oe},ae.handleResize=function(oe){var Z=ae.state.resizeStatus,ne=ae.props,se=ne.autoSize,me=ne.onResize;if(Z!==K.NONE)return;typeof me=="function"&&me(oe),se&&ae.resizeOnNextFrame()},ae.resizeOnNextFrame=function(){cancelAnimationFrame(ae.nextFrameActionId),ae.nextFrameActionId=requestAnimationFrame(ae.resizeTextarea)},ae.resizeTextarea=function(){var oe=ae.props.autoSize;if(!oe||!ae.textArea)return;var Z=oe.minRows,ne=oe.maxRows,se=H(ae.textArea,!1,Z,ne);ae.setState({textareaStyles:se,resizeStatus:K.RESIZING},function(){cancelAnimationFrame(ae.resizeFrameId),ae.resizeFrameId=requestAnimationFrame(function(){ae.setState({resizeStatus:K.RESIZED},function(){ae.resizeFrameId=requestAnimationFrame(function(){ae.setState({resizeStatus:K.NONE}),ae.fixFirefoxAutoScroll()})})})})},ae.renderTextArea=function(){var oe=ae.props,Z=oe.prefixCls,ne=Z===void 0?"rc-textarea":Z,se=oe.autoSize,me=oe.onResize,Se=oe.className,Ee=oe.disabled,Le=ae.state,Pe=Le.textareaStyles,Be=Le.resizeStatus,He=Object(p.a)(ae.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ge=g()(ne,Se,Object(B.a)({},"".concat(ne,"-disabled"),Ee));"value"in He&&(He.value=He.value||"");var Ue=Object(G.a)(Object(G.a)(Object(G.a)({},ae.props.style),Pe),Be===K.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return D.createElement(_,{onResize:ae.handleResize,disabled:!(se||me)},D.createElement("textarea",Object(ce.a)({},He,{className:Ge,style:Ue,ref:ae.saveTextArea})))},ae.state={textareaStyles:{},resizeStatus:K.NONE},ae}return Object(N.a)(re,[{key:"componentDidUpdate",value:function(ae){(ae.value!==this.props.value||!T()(ae.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 ae=this.textArea.selectionStart,oe=this.textArea.selectionEnd;this.textArea.setSelectionRange(ae,oe)}}catch(Z){}}},{key:"render",value:function(){return this.renderTextArea()}}]),re}(D.Component),ie=J,pe=function(Te){Object(Q.a)(re,Te);var he=Object(F.a)(re);function re(fe){var ae;Object(Y.a)(this,re),ae=he.call(this,fe),ae.resizableTextArea=void 0,ae.focus=function(){ae.resizableTextArea.textArea.focus()},ae.saveTextArea=function(Z){ae.resizableTextArea=Z},ae.handleChange=function(Z){var ne=ae.props.onChange;ae.setValue(Z.target.value,function(){ae.resizableTextArea.resizeTextarea()}),ne&&ne(Z)},ae.handleKeyDown=function(Z){var ne=ae.props,se=ne.onPressEnter,me=ne.onKeyDown;Z.keyCode===13&&se&&se(Z),me&&me(Z)};var oe=typeof fe.value=="undefined"||fe.value===null?fe.defaultValue:fe.value;return ae.state={value:oe},ae}return Object(N.a)(re,[{key:"setValue",value:function(ae,oe){"value"in this.props||this.setState({value:ae},oe)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return D.createElement(ie,Object(ce.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ae){return"value"in ae?{value:ae.value}:null}}]),re}(D.Component),_e=Ke.default=pe},Z9P2:function(ut,Ke,$){"use strict";var ce=$("+BJd"),Y=$("mr32"),N=$("14J3"),Q=$("BMrR"),F=$("5NDa"),D=$("5rEg"),G=$("oBTY"),B=$("5Dmo"),k=$("3S7+"),R=$("miYZ"),b=$("tsqr"),v=$("tJVT"),m=$("q1tI"),u=$.n(m),r=function(s){var a,o,h=s.value,O=h===void 0?[[],[]]:h,w=s.onChange,x=Object(m.useState)(""),A=Object(v.a)(x,2),S=A[0],y=A[1],_=Object(m.useState)(""),p=Object(v.a)(_,2),d=p[0],g=p[1],l=function(U){if(!U)return!1;var P=new RegExp("[ `~!@#$^&*()={}':;,\\[\\].<>/?~\uFF01@#\uFFE5\u2026\u2026&*\uFF08\uFF09\u2014\u3010\u3011\u2018\uFF1B\uFF1A\u201D\u201C\u3002\uFF0C\u3001\uFF1F\u300C\u300D\u300E\u300F_\\+\\-\xB7%\u300A\u300B]|[\\\\/]");return P.test(U)?(b.b.warn("\u5173\u952E\u8BCD\u4E0D\u80FD\u542B\u6709\u7279\u6B8A\u5B57\u7B26\uFF01"),!1):U==="|"?(b.b.warn("\u5173\u952E\u8BCD\u4E0D\u80FD\u53EA\u8F93\u5165\u4E00\u4E2A\u201C|\u201D\u5B57\u7B26\uFF01"),!1):!0};return u.a.createElement("div",null,u.a.createElement("p",{className:"font14"},"\u5173\u952E\u8BCD",u.a.createElement("span",{className:"c-grey-999"},"\uFF08\u5173\u952E\u8BCD\u53EF\u7528\u4E8E\u81EA\u52A8\u5224\u5206\uFF09"),u.a.createElement(k.a,{overlayStyle:{maxWidth:350},title:u.a.createElement("div",null,u.a.createElement("div",null,"\u6BCF\u4E2A\u6838\u5FC3\u5173\u952E\u8BCD\u7684\u5206\u6570\u662F\u666E\u901A\u5173\u952E\u8BCD\u5206\u6570\u7684\u4E24\u500D"),u.a.createElement("div",null,"\u4F8B\u5982\uFF1A"),u.a.createElement("div",null,"\u672C\u989810\u5206\uFF0C\u666E\u901A\u5173\u952E\u8BCD1\u4E2A\uFF0C\u6838\u5FC3\u5173\u952E\u8BCD2\u4E2A\uFF0C\u5219\u6BCF\u4E2A"),u.a.createElement("div",null,"\u666E\u901A\u5173\u952E\u8BCD2\u5206\uFF0C\u6BCF\u4E2A\u6838\u5FC3\u5173\u952E\u8BCD4\u5206"))},u.a.createElement("span",{className:"iconfont icon-a-wenhaobeifen2 font14"}))),u.a.createElement(Q.a,{align:"middle",className:"font14"},"\u666E\u901A\u5173\u952E\u8BCD\uFF1A",u.a.createElement(D.a,{value:S,onChange:function(U){y(U.target.value)},maxLength:50,allowClear:!0,onPressEnter:function(U){var P,j=(P=U.target)===null||P===void 0?void 0:P.value;if(l(j)){var H,I;(H=O[0])===null||H===void 0||H.push(j==null||((I=j.split("|"))===null||I===void 0)?void 0:I.filter(function(T){return!!T})),w(Object(G.a)(O)),y("")}},style:{width:800},className:"ml5 mr10",placeholder:"\u652F\u6301\u4FDD\u5B58\u591A\u4E2A\u5173\u952E\u8BCD\uFF1B\u5E76\u5217\u5173\u952E\u8BCD\uFF08\u6216\u7684\u5173\u7CFB\uFF09\u7528\u201D|\u201D\u5206\u5272\u3002"}),u.a.createElement("span",{className:"c-grey-999"},"\u201C\u56DE\u8F66\u952E\u201D\u4FDD\u5B58\u5173\u952E\u8BCD")),u.a.createElement("div",{style:{paddingLeft:89},className:"mt10"},O==null||((a=O[0])===null||a===void 0)?void 0:a.map(function(E,U){return u.a.createElement(Y.a,{className:"mb10",key:U,closable:!0,onClose:function(j){var H;j.preventDefault(),O[0]=(H=O[0])===null||H===void 0?void 0:H.filter(function(I,T){return T!==U}),w(Object(G.a)(O))}},E==null?void 0:E.join(" \u6216 "))})),u.a.createElement(Q.a,{align:"middle",className:"font14"},"\u6838\u5FC3\u5173\u952E\u8BCD\uFF1A",u.a.createElement(D.a,{value:d,onChange:function(U){g(U.target.value)},maxLength:50,allowClear:!0,onPressEnter:function(U){var P,j=(P=U.target)===null||P===void 0?void 0:P.value;if(l(j)){var H,I;(H=O[1])===null||H===void 0||H.push(j==null||((I=j.split("|"))===null||I===void 0)?void 0:I.filter(function(T){return!!T})),w(Object(G.a)(O)),g("")}},style:{width:800},className:"ml5 mr10",placeholder:"\u652F\u6301\u4FDD\u5B58\u591A\u4E2A\u5173\u952E\u8BCD\uFF1B\u5E76\u5217\u5173\u952E\u8BCD\uFF08\u6216\u7684\u5173\u7CFB\uFF09\u7528\u201D|\u201D\u5206\u5272\u3002"}),u.a.createElement("span",{className:"c-grey-999"},"\u201C\u56DE\u8F66\u952E\u201D\u4FDD\u5B58\u5173\u952E\u8BCD")),u.a.createElement("div",{style:{paddingLeft:89},className:"mt10"},O==null||((o=O[1])===null||o===void 0)?void 0:o.map(function(E,U){return u.a.createElement(Y.a,{className:"mb10",key:U,closable:!0,onClose:function(j){var H;j.preventDefault(),O[1]=(H=O[1])===null||H===void 0?void 0:H.filter(function(I,T){return T!==U}),w(Object(G.a)(O))}},E==null?void 0:E.join(" \u6216 "))})))};Ke.a=r},ZW9T:function(ut,Ke,$){"use strict";$.d(Ke,"a",function(){return H});var ce=$("k1fw"),Y=$("miYZ"),N=$("tsqr"),Q=$("rAM+"),F=$("tJVT"),D=$("PpiC"),G=$("q1tI"),B=$.n(G),k=$("bdgK"),R=$("oBTY"),b=$("9og8"),v=$("WmNS"),m=$.n(v),u={keywords:["print","auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while"]},r={quickKey:[{label:"main",content:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`)},{label:"System.out.println",content:["System.out.println($0)"].join(`
|
|
`)},{label:"System.out.print",content:["System.out.print($0)"].join(`
|
|
`)}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},c={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","for","friend","gcnew","generic","goto","if","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`)},{label:"#include",content:'include "$0"'},{label:"printf",content:"printf($0)"},{label:"main",content:["int main () {"," $0","}"].join(`
|
|
`)},{label:"for",content:["for( ; ; ){"," $0","}"].join(`
|
|
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
|
|
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
|
|
`)},{label:"#include <iostream>",content:["#include <iostream>"].join(`
|
|
`)},{label:"#include <vector>",content:["#include <vector>"].join(`
|
|
`)},{label:"#include <sstream>",content:["#include <sstream>"].join(`
|
|
`)},{label:"#include <string>",content:["#include <string>"].join(`
|
|
`)},{label:"#include <cmath>",content:["#include <cmath>"].join(`
|
|
`)}]},s={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join(`
|
|
`)}]},a=$("5VLF"),o=$.n(a),h={languages:["c","abap","apex","azcli","bat","cameligo","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","graphql","handlebars","html","ini","java","javascript","json","kotlin","less","lua","markdown","mips","msdax","mysql","objective-c","pascal","pascaligo","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","restructuredtext","ruby","rust","sb","scheme","scss","shell","solidity","sophia","sql","st","swift","tcl","twig","vb","xml","yaml'"],tables:{users:["name","id","email","phone","password"],roles:["id","name","order","created_at","updated_at","deleted_at"]}},O=function(T,K){return K.map(function(J){return{label:J,kind:T.languages.CompletionItemKind.Keyword,insertText:J}})},w=function(T){return Object.keys(h.tables).map(function(K){return{label:K,kind:T.languages.CompletionItemKind.Variable,insertText:K}})},x=function(T,K){var J=h.tables[T];return J?J.map(function(ie){return{label:ie,kind:K.languages.CompletionItemKind.Field,insertText:ie}}):[]};function A(I,T,K,J,ie){var pe=T.getWordUntilPosition(K),_e={startLineNumber:K.lineNumber,endLineNumber:K.lineNumber,startColumn:pe.startColumn,endColumn:pe.endColumn},Te=J.map(function(he){return{label:he,kind:I.languages.CompletionItemKind.Keyword,insertText:he,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:_e}});return ie.map(function(he){Te.push(Object(ce.a)(Object(ce.a)({},he),{},{range:_e}))}),Te}var S=function(I){h.languages.map(function(ie){return I.languages.registerDocumentFormattingEditProvider(ie,{provideDocumentFormattingEdits:function(_e,Te,he){return Object(b.a)(m.a.mark(function re(){var fe;return m.a.wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:return fe=o()(_e.getValue(),{indent_size:"2",indent_char:" ",max_preserve_newlines:"2",preserve_newlines:!0,keep_array_indentation:!0,break_chained_methods:!1,indent_scripts:"normal",brace_style:"collapse",space_before_conditional:!0,unescape_strings:!1,jslint_happy:!1,end_with_newline:!0,wrap_line_length:"0",indent_inner_html:!1,comma_first:!1,e4x:!1,indent_empty_lines:!1}),oe.abrupt("return",[{range:_e.getFullModelRange(),text:fe}]);case 2:case"end":return oe.stop()}},re)}))()}}),ie});var T=c.quickKey.map(function(ie){return{label:ie.label,kind:I.languages.CompletionItemKind.Method,insertText:ie.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),K=s.quickKey.map(function(ie){return{label:ie.label,kind:I.languages.CompletionItemKind.Method,insertText:ie.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),J=r.quickKey.map(function(ie){return{label:ie.label,kind:I.languages.CompletionItemKind.Method,insertText:ie.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet}});I.languages.registerCompletionItemProvider("cpp",{triggerCharacters:["."," ","#"].concat(Object(R.a)(c.keywords),Object(R.a)(c.quickKey.map(function(ie){return ie.label}))),provideCompletionItems:function(pe,_e){var Te=pe.getValueInRange({startLineNumber:_e.lineNumber,startColumn:1,endLineNumber:_e.lineNumber,endColumn:_e.column}),he=Te.match(/cu/gim);console.log("match:",he,_e,Te,pe);var re=[],fe=_e.lineNumber,ae=_e.column,oe=pe.getValueInRange({startLineNumber:fe,startColumn:0,endLineNumber:fe,endColumn:ae}),Z=oe.trim().split(/\s+/),ne=Z[Z.length-1];if(ne.endsWith(".")){var se=ne.slice(0,ne.length-1);Object.keys(h.tables).includes(se)&&(re=Object(R.a)(x(se,I)))}else ne==="."?re=[]:re=[].concat(Object(R.a)(w(I)),Object(R.a)(O(I,c.keywords)),Object(R.a)(T));return{suggestions:re}}}),I.languages.registerCompletionItemProvider("c",{triggerCharacters:["."," ","#"].concat(Object(R.a)(u.keywords)),provideCompletionItems:function(pe,_e){var Te=pe.getValueInRange({startLineNumber:_e.lineNumber,startColumn:1,endLineNumber:_e.lineNumber,endColumn:_e.column}),he=Te.match(/cu/gim);console.log("match:",he,_e,Te,pe);var re=[],fe=_e.lineNumber,ae=_e.column,oe=pe.getValueInRange({startLineNumber:fe,startColumn:0,endLineNumber:fe,endColumn:ae}),Z=oe.trim().split(/\s+/),ne=Z[Z.length-1];if(ne.endsWith(".")){var se=ne.slice(0,ne.length-1);Object.keys(h.tables).includes(se)&&(re=Object(R.a)(x(se,I)))}else ne==="."?re=[]:re=[].concat(Object(R.a)(w(I)),Object(R.a)(O(I,u.keywords)));return{suggestions:re}}}),I.languages.registerCompletionItemProvider("java",{triggerCharacters:["."," "].concat(Object(R.a)(r.keywords)),provideCompletionItems:function(pe,_e){var Te=[],he=_e.lineNumber,re=_e.column,fe=pe.getValueInRange({startLineNumber:he,startColumn:0,endLineNumber:he,endColumn:re}),ae=fe.trim().split(/\s+/),oe=ae[ae.length-1];if(oe.endsWith(".")){var Z=oe.slice(0,oe.length-1);Object.keys(h.tables).includes(Z)&&(Te=Object(R.a)(x(Z,I)))}else oe==="."?Te=[]:Te=[].concat(Object(R.a)(w(I)),Object(R.a)(O(I,r.keywords)),Object(R.a)(J));return{suggestions:Te}}}),I.languages.registerCompletionItemProvider("python",{triggerCharacters:["."," "].concat(Object(R.a)(s.keywords)),provideCompletionItems:function(pe,_e){var Te=[],he=_e.lineNumber,re=_e.column,fe=pe.getValueInRange({startLineNumber:he,startColumn:0,endLineNumber:he,endColumn:re}),ae=fe.trim().split(/\s+/),oe=ae[ae.length-1];if(oe.endsWith(".")){var Z=oe.slice(0,oe.length-1);Object.keys(h.tables).includes(Z)&&(Te=Object(R.a)(x(Z,I)))}else oe==="."?Te=[]:Te=[].concat(Object(R.a)(w(I)),Object(R.a)(O(I,s.keywords)),Object(R.a)(K));return{suggestions:Te}}})},y="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",_=$("LvDl"),p=$("+ua5");function d(I){return/^\d+$/.test(I)?"".concat(I,"px"):I}function g(){}var l=!1,E={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function U(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],T=I;if(Array.isArray(I)){for(var K=0;K<I.length;K++){var J=E[I[K]];if(J)return J}return T[0]}return E[T]||T}var P=null,j=Ke.b=function(I){var T=I.width,K=T===void 0?"100%":T,J=I.height,ie=J===void 0?"100%":J,pe=I.value,_e=I.language,Te=_e===void 0?"javascript":_e,he=I.style,re=he===void 0?{}:he,fe=I.options,ae=fe===void 0?{}:fe,oe=I.overrideServices,Z=oe===void 0?{}:oe,ne=I.theme,se=ne===void 0?"vs-dark":ne,me=I.onEditBlur,Se=I.onSave,Ee=I.autoHeight,Le=Ee===void 0?!1:Ee,Pe=I.forbidCopy,Be=Pe===void 0?!1:Pe,He=I.onChange,Ge=He===void 0?g:He,Ue=I.editorDidMount,tt=Ue===void 0?g:Ue,nt=I.onFocus,ot=nt===void 0?g:nt,st=I.filename,mt=st===void 0?"educoder.txt":st,ht=I.errorLine,Ie=I.errorContent,Re=Ie===void 0?"":Ie,ze=Object(D.a)(I,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),Ve=Object(G.useRef)(),De=Object(G.useRef)({}),Me=Object(G.useRef)(),be=Object(G.useRef)(!1),ve=Object(G.useRef)(),ge=Object(G.useState)(!1),le=Object(F.a)(ge,2),ue=le[0],ye=le[1];function xe(){var je;return Ve.current&&(je=new k.default(function(rt){var it=Object(Q.a)(rt),et;try{for(it.s();!(et=it.n()).done;){var Tt=et.value;(Tt.target.offsetHeight>0||Tt.target.offsetWidth>0)&&De.current.instance.layout()}}catch(kt){it.e(kt)}finally{it.f()}}),je.observe(Ve.current)),je}function we(){N.b.warn(decodeURIComponent(y))}var ke=function(){var rt=De.current.instance;if(pe!=null&&rt&&ue){var it=rt.getModel();it&&pe!==it.getValue()&&(l=!0,it.setValue(pe),rt.layout(),l=!1)}};Object(G.useEffect)(function(){Me.current&&clearTimeout(Me.current),Me.current=setTimeout(function(){ke()},500)},[pe,ue,De.current]),Object(G.useEffect)(function(){if(ht&&De.current&&De.current.instance){var je=De.current.instance;je.changeViewZones(function(it){var et=document.createElement("div");et.style.padding="10px 20px",et.style.width="calc(100% - 20px)",et.className="my-error-line-wrp",et.innerHTML=Re,it.addZone({afterLineNumber:ht||11,heightInLines:3,domNode:et})});var rt={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};je.addOverlayWidget(rt),je.revealPositionInCenter({lineNumber:20,column:1})}},[ht,De.current,ue]);function We(){var je=De.current.instance;if(je){var rt=je.getSelection(),it=De.current.pastePos||{},et=new P.Range(it.startLineNumber||rt.endLineNumber,it.startColumn||rt.endColumn,it.endLineNumber||rt.endLineNumber,it.endColumn||rt.endColumn);setTimeout(function(){je.executeEdits("",[{range:et,text:""}])},300)}}function Je(je){(window.navigator.platform.match("Mac")?je.metaKey:je.ctrlKey)&&je.keyCode==83&&(je.preventDefault(),Se())}var Qe=function(){if(Le&&De.current.instance){var rt=De.current.instance.getContentHeight();Lt(rt<ie?ie:rt)}else Lt(ie)};function Ze(je){var rt=document.createEvent("MouseEvents");rt.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),je.dispatchEvent(rt)}function bt(je,rt){var it=window.URL||window.webkitURL||window,et=new Blob([rt]),Tt=document.createElementNS("http://www.w3.org/1999/xhtml","a");Tt.href=it.createObjectURL(et),Tt.download=je,Ze(Tt)}Object(G.useEffect)(function(){Qe()},[Qe]),Object(G.useEffect)(function(){Ve.current&&!ue&&$.e(27).then($.t.bind(null,"M/lh",7)).then(function(je){try{P=je,De.current.instance=P.editor.create(Ve.current,{value:pe,language:U(Te),theme:se,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},Z);var rt=De.current.instance;if(tt(rt,P),setTimeout(function(){Qe(),De.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){bt(mt||"educoder.txt",rt.getValue())}})},500),De.current.subscription=rt.onDidChangeModelContent(function(et){be.current?clearTimeout(ve.current):(Qe(),Ge(rt.getValue(),et)),ve.current=setTimeout(function(){be.current=!1},500)}),window.Monaco||S(P),Be&&(rt.addCommand(P.KeyMod.CtrlCmd|P.KeyMod.Shift|P.KeyCode.KEY_V,function(){return we(),null}),rt.addCommand(P.KeyMod.CtrlCmd|P.KeyCode.KEY_C,function(){return we(),null})),window.Monaco=P,me&&rt.onDidBlurEditorWidget(function(){me(rt.getValue())}),ot&&rt.onDidFocusEditorText(function(){ot(rt.getValue())}),Be){rt.addCommand(P.KeyMod.CtrlCmd|P.KeyCode.KEY_V,function(){return we(),null}),rt.onDidPaste(function(et){De.current.pastePos=et});try{window.addEventListener("paste",We)}catch(et){}}var it=xe();return ye(!0),function(){var et=De.current.instance;et.dispose();var Tt=et.getModel();Tt&&Tt.dispose(),De.current.subscription&&De.current.subscription.dispose(),Be&&window.removeEventListener("paste",We),it.unobserve(Ve.current)}}catch(et){}})},[]),Object(G.useEffect)(function(){var je=De.current.instance;if(je&&ue)return document.addEventListener("keydown",Je,!1),function(){document.removeEventListener("keydown",Je)}},[Se,ue]),Object(G.useEffect)(function(){var je=De.current.instance;if(je&&ue){var rt=U(Te);P.editor.setModelLanguage(je.getModel(),rt),console.log("language:",Te,je.getModel(),rt)}},[Te,ue]),Object(G.useEffect)(function(){var je=De.current.instance;je&&ue&&P.editor.setTheme(se)},[se,ue]),Object(G.useEffect)(function(){var je=De.current.instance;je&&ue&&(je.updateOptions(Object(ce.a)({},ae)),setTimeout(function(){je.getModel().updateOptions(Object(ce.a)({},ae))},200))},[JSON.stringify(ae),ue]),Object(G.useEffect)(function(){var je=De.current.instance;je&&ue&&je.layout()},[K,ie,ue]);var yt=Object(G.useState)(d(K)),lt=Object(F.a)(yt,2),wt=lt[0],xt=lt[1],Ct=Object(G.useState)(d(ie)),Mt=Object(F.a)(Ct,2),Ot=Mt[0],Lt=Mt[1],gt=Object(ce.a)(Object(ce.a)({},re),{},{width:wt,height:Ot});return B.a.createElement("div",{className:"my-monaco-editor",ref:Ve,style:gt})};function H(I){var T=I.width,K=T===void 0?"100%":T,J=I.height,ie=J===void 0?"100%":J,pe=I.original,_e=I.modified,Te=I.language,he=I.options,re=he===void 0?{}:he,fe=Object(G.useRef)(),ae=Object(G.useState)(null),oe=Object(F.a)(ae,2),Z=oe[0],ne=oe[1];function se(Le){var Pe;return fe.current&&(Pe=new k.default(function(Be){var He=Object(Q.a)(Be),Ge;try{for(He.s();!(Ge=He.n()).done;){var Ue=Ge.value;(Ue.target.offsetHeight>0||Ue.target.offsetWidth>0)&&Le.layout()}}catch(tt){He.e(tt)}finally{He.f()}}),Pe.observe(fe.current)),Pe}Object(G.useEffect)(function(){fe.current&&$.e(27).then($.t.bind(null,"M/lh",7)).then(function(Le){P=Le;var Pe=P.editor.createDiffEditor(fe.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},re),{},{wordWrap:!0}));ne(Pe);var Be=se(Pe);return function(){Pe.dispose();var He=Pe.getModel();He&&He.dispose(),Be.unobserve(fe.current)}})},[]),Object(G.useEffect)(function(){Z&&Z.setModel({original:P.editor.createModel(pe,Te),modified:P.editor.createModel(_e,Te)})},[pe,_e,Te,Z]);var me=d(K),Se=d(ie),Ee={width:me,height:Se};return B.a.createElement("div",{className:"my-diff-editor",ref:fe,style:Ee})}},ZpRC:function(ut,Ke,$){"use strict";function ce(b){return typeof b=="object"&&b!=null&&b.nodeType===1}function Y(b,v){return(!v||b!=="hidden")&&b!=="visible"&&b!=="clip"}function N(b,v){if(b.clientHeight<b.scrollHeight||b.clientWidth<b.scrollWidth){var m=getComputedStyle(b,null);return Y(m.overflowY,v)||Y(m.overflowX,v)||function(u){var r=function(c){if(!c.ownerDocument||!c.ownerDocument.defaultView)return null;try{return c.ownerDocument.defaultView.frameElement}catch(s){return null}}(u);return!!r&&(r.clientHeight<u.scrollHeight||r.clientWidth<u.scrollWidth)}(b)}return!1}function Q(b,v,m,u,r,c,s,a){return c<b&&s>v||c>b&&s<v?0:c<=b&&a<=m||s>=v&&a>=m?c-b-u:s>v&&a<m||c<b&&a>m?s-v+r:0}var F=function(b,v){var m=window,u=v.scrollMode,r=v.block,c=v.inline,s=v.boundary,a=v.skipOverflowHiddenElements,o=typeof s=="function"?s:function(Pe){return Pe!==s};if(!ce(b))throw new TypeError("Invalid target");for(var h=document.scrollingElement||document.documentElement,O=[],w=b;ce(w)&&o(w);){if((w=w.parentElement)===h){O.push(w);break}w!=null&&w===document.body&&N(w)&&!N(document.documentElement)||w!=null&&N(w,a)&&O.push(w)}for(var x=m.visualViewport?m.visualViewport.width:innerWidth,A=m.visualViewport?m.visualViewport.height:innerHeight,S=window.scrollX||pageXOffset,y=window.scrollY||pageYOffset,_=b.getBoundingClientRect(),p=_.height,d=_.width,g=_.top,l=_.right,E=_.bottom,U=_.left,P=r==="start"||r==="nearest"?g:r==="end"?E:g+p/2,j=c==="center"?U+d/2:c==="end"?l:U,H=[],I=0;I<O.length;I++){var T=O[I],K=T.getBoundingClientRect(),J=K.height,ie=K.width,pe=K.top,_e=K.right,Te=K.bottom,he=K.left;if(u==="if-needed"&&g>=0&&U>=0&&E<=A&&l<=x&&g>=pe&&E<=Te&&U>=he&&l<=_e)return H;var re=getComputedStyle(T),fe=parseInt(re.borderLeftWidth,10),ae=parseInt(re.borderTopWidth,10),oe=parseInt(re.borderRightWidth,10),Z=parseInt(re.borderBottomWidth,10),ne=0,se=0,me="offsetWidth"in T?T.offsetWidth-T.clientWidth-fe-oe:0,Se="offsetHeight"in T?T.offsetHeight-T.clientHeight-ae-Z:0;if(h===T)ne=r==="start"?P:r==="end"?P-A:r==="nearest"?Q(y,y+A,A,ae,Z,y+P,y+P+p,p):P-A/2,se=c==="start"?j:c==="center"?j-x/2:c==="end"?j-x:Q(S,S+x,x,fe,oe,S+j,S+j+d,d),ne=Math.max(0,ne+y),se=Math.max(0,se+S);else{ne=r==="start"?P-pe-ae:r==="end"?P-Te+Z+Se:r==="nearest"?Q(pe,Te,J,ae,Z+Se,P,P+p,p):P-(pe+J/2)+Se/2,se=c==="start"?j-he-fe:c==="center"?j-(he+ie/2)+me/2:c==="end"?j-_e+oe+me:Q(he,_e,ie,fe,oe+me,j,j+d,d);var Ee=T.scrollLeft,Le=T.scrollTop;P+=Le-(ne=Math.max(0,Math.min(Le+ne,T.scrollHeight-J+Se))),j+=Ee-(se=Math.max(0,Math.min(Ee+se,T.scrollWidth-ie+me)))}H.push({el:T,top:ne,left:se})}return H};function D(b){return b===Object(b)&&Object.keys(b).length!==0}function G(b,v){v===void 0&&(v="auto");var m="scrollBehavior"in document.body.style;b.forEach(function(u){var r=u.el,c=u.top,s=u.left;r.scroll&&m?r.scroll({top:c,left:s,behavior:v}):(r.scrollTop=c,r.scrollLeft=s)})}function B(b){return b===!1?{block:"end",inline:"nearest"}:D(b)?b:{block:"start",inline:"nearest"}}function k(b,v){var m=!b.ownerDocument.documentElement.contains(b);if(D(v)&&typeof v.behavior=="function")return v.behavior(m?[]:F(b,v));if(m)return;var u=B(v);return G(F(b,u),u.behavior)}var R=Ke.a=k},Zss7:function(ut,Ke,$){var ce;(function(Y){var N=/^\s+/,Q=/\s+$/,F=0,D=Y.round,G=Y.min,B=Y.max,k=Y.random;function R(Z,ne){if(Z=Z||"",ne=ne||{},Z instanceof R)return Z;if(!(this instanceof R))return new R(Z,ne);var se=b(Z);this._originalInput=Z,this._r=se.r,this._g=se.g,this._b=se.b,this._a=se.a,this._roundA=D(100*this._a)/100,this._format=ne.format||se.format,this._gradientType=ne.gradientType,this._r<1&&(this._r=D(this._r)),this._g<1&&(this._g=D(this._g)),this._b<1&&(this._b=D(this._b)),this._ok=se.ok,this._tc_id=F++}R.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 Z=this.toRgb();return(Z.r*299+Z.g*587+Z.b*114)/1e3},getLuminance:function(){var Z=this.toRgb(),ne,se,me,Se,Ee,Le;return ne=Z.r/255,se=Z.g/255,me=Z.b/255,ne<=.03928?Se=ne/12.92:Se=Y.pow((ne+.055)/1.055,2.4),se<=.03928?Ee=se/12.92:Ee=Y.pow((se+.055)/1.055,2.4),me<=.03928?Le=me/12.92:Le=Y.pow((me+.055)/1.055,2.4),.2126*Se+.7152*Ee+.0722*Le},setAlpha:function(Z){return this._a=H(Z),this._roundA=D(100*this._a)/100,this},toHsv:function(){var Z=r(this._r,this._g,this._b);return{h:Z.h*360,s:Z.s,v:Z.v,a:this._a}},toHsvString:function(){var Z=r(this._r,this._g,this._b),ne=D(Z.h*360),se=D(Z.s*100),me=D(Z.v*100);return this._a==1?"hsv("+ne+", "+se+"%, "+me+"%)":"hsva("+ne+", "+se+"%, "+me+"%, "+this._roundA+")"},toHsl:function(){var Z=m(this._r,this._g,this._b);return{h:Z.h*360,s:Z.s,l:Z.l,a:this._a}},toHslString:function(){var Z=m(this._r,this._g,this._b),ne=D(Z.h*360),se=D(Z.s*100),me=D(Z.l*100);return this._a==1?"hsl("+ne+", "+se+"%, "+me+"%)":"hsla("+ne+", "+se+"%, "+me+"%, "+this._roundA+")"},toHex:function(Z){return s(this._r,this._g,this._b,Z)},toHexString:function(Z){return"#"+this.toHex(Z)},toHex8:function(Z){return a(this._r,this._g,this._b,this._a,Z)},toHex8String:function(Z){return"#"+this.toHex8(Z)},toRgb:function(){return{r:D(this._r),g:D(this._g),b:D(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+D(this._r)+", "+D(this._g)+", "+D(this._b)+")":"rgba("+D(this._r)+", "+D(this._g)+", "+D(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:D(I(this._r,255)*100)+"%",g:D(I(this._g,255)*100)+"%",b:D(I(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+D(I(this._r,255)*100)+"%, "+D(I(this._g,255)*100)+"%, "+D(I(this._b,255)*100)+"%)":"rgba("+D(I(this._r,255)*100)+"%, "+D(I(this._g,255)*100)+"%, "+D(I(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:P[s(this._r,this._g,this._b,!0)]||!1},toFilter:function(Z){var ne="#"+o(this._r,this._g,this._b,this._a),se=ne,me=this._gradientType?"GradientType = 1, ":"";if(Z){var Se=R(Z);se="#"+o(Se._r,Se._g,Se._b,Se._a)}return"progid:DXImageTransform.Microsoft.gradient("+me+"startColorstr="+ne+",endColorstr="+se+")"},toString:function(Z){var ne=!!Z;Z=Z||this._format;var se=!1,me=this._a<1&&this._a>=0,Se=!ne&&me&&(Z==="hex"||Z==="hex6"||Z==="hex3"||Z==="hex4"||Z==="hex8"||Z==="name");return Se?Z==="name"&&this._a===0?this.toName():this.toRgbString():(Z==="rgb"&&(se=this.toRgbString()),Z==="prgb"&&(se=this.toPercentageRgbString()),(Z==="hex"||Z==="hex6")&&(se=this.toHexString()),Z==="hex3"&&(se=this.toHexString(!0)),Z==="hex4"&&(se=this.toHex8String(!0)),Z==="hex8"&&(se=this.toHex8String()),Z==="name"&&(se=this.toName()),Z==="hsl"&&(se=this.toHslString()),Z==="hsv"&&(se=this.toHsvString()),se||this.toHexString())},clone:function(){return R(this.toString())},_applyModification:function(Z,ne){var se=Z.apply(null,[this].concat([].slice.call(ne)));return this._r=se._r,this._g=se._g,this._b=se._b,this.setAlpha(se._a),this},lighten:function(){return this._applyModification(x,arguments)},brighten:function(){return this._applyModification(A,arguments)},darken:function(){return this._applyModification(S,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(O,arguments)},greyscale:function(){return this._applyModification(w,arguments)},spin:function(){return this._applyModification(y,arguments)},_applyCombination:function(Z,ne){return Z.apply(null,[this].concat([].slice.call(ne)))},analogous:function(){return this._applyCombination(l,arguments)},complement:function(){return this._applyCombination(_,arguments)},monochromatic:function(){return this._applyCombination(E,arguments)},splitcomplement:function(){return this._applyCombination(g,arguments)},triad:function(){return this._applyCombination(p,arguments)},tetrad:function(){return this._applyCombination(d,arguments)}},R.fromRatio=function(Z,ne){if(typeof Z=="object"){var se={};for(var me in Z)Z.hasOwnProperty(me)&&(me==="a"?se[me]=Z[me]:se[me]=_e(Z[me]));Z=se}return R(Z,ne)};function b(Z){var ne={r:0,g:0,b:0},se=1,me=null,Se=null,Ee=null,Le=!1,Pe=!1;return typeof Z=="string"&&(Z=ae(Z)),typeof Z=="object"&&(fe(Z.r)&&fe(Z.g)&&fe(Z.b)?(ne=v(Z.r,Z.g,Z.b),Le=!0,Pe=String(Z.r).substr(-1)==="%"?"prgb":"rgb"):fe(Z.h)&&fe(Z.s)&&fe(Z.v)?(me=_e(Z.s),Se=_e(Z.v),ne=c(Z.h,me,Se),Le=!0,Pe="hsv"):fe(Z.h)&&fe(Z.s)&&fe(Z.l)&&(me=_e(Z.s),Ee=_e(Z.l),ne=u(Z.h,me,Ee),Le=!0,Pe="hsl"),Z.hasOwnProperty("a")&&(se=Z.a)),se=H(se),{ok:Le,format:Z.format||Pe,r:G(255,B(ne.r,0)),g:G(255,B(ne.g,0)),b:G(255,B(ne.b,0)),a:se}}function v(Z,ne,se){return{r:I(Z,255)*255,g:I(ne,255)*255,b:I(se,255)*255}}function m(Z,ne,se){Z=I(Z,255),ne=I(ne,255),se=I(se,255);var me=B(Z,ne,se),Se=G(Z,ne,se),Ee,Le,Pe=(me+Se)/2;if(me==Se)Ee=Le=0;else{var Be=me-Se;Le=Pe>.5?Be/(2-me-Se):Be/(me+Se);switch(me){case Z:Ee=(ne-se)/Be+(ne<se?6:0);break;case ne:Ee=(se-Z)/Be+2;break;case se:Ee=(Z-ne)/Be+4;break}Ee/=6}return{h:Ee,s:Le,l:Pe}}function u(Z,ne,se){var me,Se,Ee;Z=I(Z,360),ne=I(ne,100),se=I(se,100);function Le(He,Ge,Ue){return Ue<0&&(Ue+=1),Ue>1&&(Ue-=1),Ue<1/6?He+(Ge-He)*6*Ue:Ue<1/2?Ge:Ue<2/3?He+(Ge-He)*(2/3-Ue)*6:He}if(ne===0)me=Se=Ee=se;else{var Pe=se<.5?se*(1+ne):se+ne-se*ne,Be=2*se-Pe;me=Le(Be,Pe,Z+1/3),Se=Le(Be,Pe,Z),Ee=Le(Be,Pe,Z-1/3)}return{r:me*255,g:Se*255,b:Ee*255}}function r(Z,ne,se){Z=I(Z,255),ne=I(ne,255),se=I(se,255);var me=B(Z,ne,se),Se=G(Z,ne,se),Ee,Le,Pe=me,Be=me-Se;if(Le=me===0?0:Be/me,me==Se)Ee=0;else{switch(me){case Z:Ee=(ne-se)/Be+(ne<se?6:0);break;case ne:Ee=(se-Z)/Be+2;break;case se:Ee=(Z-ne)/Be+4;break}Ee/=6}return{h:Ee,s:Le,v:Pe}}function c(Z,ne,se){Z=I(Z,360)*6,ne=I(ne,100),se=I(se,100);var me=Y.floor(Z),Se=Z-me,Ee=se*(1-ne),Le=se*(1-Se*ne),Pe=se*(1-(1-Se)*ne),Be=me%6,He=[se,Le,Ee,Ee,Pe,se][Be],Ge=[Pe,se,se,Le,Ee,Ee][Be],Ue=[Ee,Ee,Pe,se,se,Le][Be];return{r:He*255,g:Ge*255,b:Ue*255}}function s(Z,ne,se,me){var Se=[pe(D(Z).toString(16)),pe(D(ne).toString(16)),pe(D(se).toString(16))];return me&&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 a(Z,ne,se,me,Se){var Ee=[pe(D(Z).toString(16)),pe(D(ne).toString(16)),pe(D(se).toString(16)),pe(Te(me))];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 o(Z,ne,se,me){var Se=[pe(Te(me)),pe(D(Z).toString(16)),pe(D(ne).toString(16)),pe(D(se).toString(16))];return Se.join("")}R.equals=function(Z,ne){return!Z||!ne?!1:R(Z).toRgbString()==R(ne).toRgbString()},R.random=function(){return R.fromRatio({r:k(),g:k(),b:k()})};function h(Z,ne){ne=ne===0?0:ne||10;var se=R(Z).toHsl();return se.s-=ne/100,se.s=T(se.s),R(se)}function O(Z,ne){ne=ne===0?0:ne||10;var se=R(Z).toHsl();return se.s+=ne/100,se.s=T(se.s),R(se)}function w(Z){return R(Z).desaturate(100)}function x(Z,ne){ne=ne===0?0:ne||10;var se=R(Z).toHsl();return se.l+=ne/100,se.l=T(se.l),R(se)}function A(Z,ne){ne=ne===0?0:ne||10;var se=R(Z).toRgb();return se.r=B(0,G(255,se.r-D(255*-(ne/100)))),se.g=B(0,G(255,se.g-D(255*-(ne/100)))),se.b=B(0,G(255,se.b-D(255*-(ne/100)))),R(se)}function S(Z,ne){ne=ne===0?0:ne||10;var se=R(Z).toHsl();return se.l-=ne/100,se.l=T(se.l),R(se)}function y(Z,ne){var se=R(Z).toHsl(),me=(se.h+ne)%360;return se.h=me<0?360+me:me,R(se)}function _(Z){var ne=R(Z).toHsl();return ne.h=(ne.h+180)%360,R(ne)}function p(Z){var ne=R(Z).toHsl(),se=ne.h;return[R(Z),R({h:(se+120)%360,s:ne.s,l:ne.l}),R({h:(se+240)%360,s:ne.s,l:ne.l})]}function d(Z){var ne=R(Z).toHsl(),se=ne.h;return[R(Z),R({h:(se+90)%360,s:ne.s,l:ne.l}),R({h:(se+180)%360,s:ne.s,l:ne.l}),R({h:(se+270)%360,s:ne.s,l:ne.l})]}function g(Z){var ne=R(Z).toHsl(),se=ne.h;return[R(Z),R({h:(se+72)%360,s:ne.s,l:ne.l}),R({h:(se+216)%360,s:ne.s,l:ne.l})]}function l(Z,ne,se){ne=ne||6,se=se||30;var me=R(Z).toHsl(),Se=360/se,Ee=[R(Z)];for(me.h=(me.h-(Se*ne>>1)+720)%360;--ne;)me.h=(me.h+Se)%360,Ee.push(R(me));return Ee}function E(Z,ne){ne=ne||6;for(var se=R(Z).toHsv(),me=se.h,Se=se.s,Ee=se.v,Le=[],Pe=1/ne;ne--;)Le.push(R({h:me,s:Se,v:Ee})),Ee=(Ee+Pe)%1;return Le}R.mix=function(Z,ne,se){se=se===0?0:se||50;var me=R(Z).toRgb(),Se=R(ne).toRgb(),Ee=se/100,Le={r:(Se.r-me.r)*Ee+me.r,g:(Se.g-me.g)*Ee+me.g,b:(Se.b-me.b)*Ee+me.b,a:(Se.a-me.a)*Ee+me.a};return R(Le)},R.readability=function(Z,ne){var se=R(Z),me=R(ne);return(Y.max(se.getLuminance(),me.getLuminance())+.05)/(Y.min(se.getLuminance(),me.getLuminance())+.05)},R.isReadable=function(Z,ne,se){var me=R.readability(Z,ne),Se,Ee;Ee=!1,Se=oe(se);switch(Se.level+Se.size){case"AAsmall":case"AAAlarge":Ee=me>=4.5;break;case"AAlarge":Ee=me>=3;break;case"AAAsmall":Ee=me>=7;break}return Ee},R.mostReadable=function(Z,ne,se){var me=null,Se=0,Ee,Le,Pe,Be;se=se||{},Le=se.includeFallbackColors,Pe=se.level,Be=se.size;for(var He=0;He<ne.length;He++)Ee=R.readability(Z,ne[He]),Ee>Se&&(Se=Ee,me=R(ne[He]));return R.isReadable(Z,me,{level:Pe,size:Be})||!Le?me:(se.includeFallbackColors=!1,R.mostReadable(Z,["#fff","#000"],se))};var U=R.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"},P=R.hexNames=j(U);function j(Z){var ne={};for(var se in Z)Z.hasOwnProperty(se)&&(ne[Z[se]]=se);return ne}function H(Z){return Z=parseFloat(Z),(isNaN(Z)||Z<0||Z>1)&&(Z=1),Z}function I(Z,ne){J(Z)&&(Z="100%");var se=ie(Z);return Z=G(ne,B(0,parseFloat(Z))),se&&(Z=parseInt(Z*ne,10)/100),Y.abs(Z-ne)<1e-6?1:Z%ne/parseFloat(ne)}function T(Z){return G(1,B(0,Z))}function K(Z){return parseInt(Z,16)}function J(Z){return typeof Z=="string"&&Z.indexOf(".")!=-1&&parseFloat(Z)===1}function ie(Z){return typeof Z=="string"&&Z.indexOf("%")!=-1}function pe(Z){return Z.length==1?"0"+Z:""+Z}function _e(Z){return Z<=1&&(Z=Z*100+"%"),Z}function Te(Z){return Y.round(parseFloat(Z)*255).toString(16)}function he(Z){return K(Z)/255}var re=function(){var Z="[-\\+]?\\d+%?",ne="[-\\+]?\\d*\\.\\d+%?",se="(?:"+ne+")|(?:"+Z+")",me="[\\s|\\(]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")\\s*\\)?",Se="[\\s|\\(]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")\\s*\\)?";return{CSS_UNIT:new RegExp(se),rgb:new RegExp("rgb"+me),rgba:new RegExp("rgba"+Se),hsl:new RegExp("hsl"+me),hsla:new RegExp("hsla"+Se),hsv:new RegExp("hsv"+me),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 fe(Z){return!!re.CSS_UNIT.exec(Z)}function ae(Z){Z=Z.replace(N,"").replace(Q,"").toLowerCase();var ne=!1;if(U[Z])Z=U[Z],ne=!0;else if(Z=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var se;return(se=re.rgb.exec(Z))?{r:se[1],g:se[2],b:se[3]}:(se=re.rgba.exec(Z))?{r:se[1],g:se[2],b:se[3],a:se[4]}:(se=re.hsl.exec(Z))?{h:se[1],s:se[2],l:se[3]}:(se=re.hsla.exec(Z))?{h:se[1],s:se[2],l:se[3],a:se[4]}:(se=re.hsv.exec(Z))?{h:se[1],s:se[2],v:se[3]}:(se=re.hsva.exec(Z))?{h:se[1],s:se[2],v:se[3],a:se[4]}:(se=re.hex8.exec(Z))?{r:K(se[1]),g:K(se[2]),b:K(se[3]),a:he(se[4]),format:ne?"name":"hex8"}:(se=re.hex6.exec(Z))?{r:K(se[1]),g:K(se[2]),b:K(se[3]),format:ne?"name":"hex"}:(se=re.hex4.exec(Z))?{r:K(se[1]+""+se[1]),g:K(se[2]+""+se[2]),b:K(se[3]+""+se[3]),a:he(se[4]+""+se[4]),format:ne?"name":"hex8"}:(se=re.hex3.exec(Z))?{r:K(se[1]+""+se[1]),g:K(se[2]+""+se[2]),b:K(se[3]+""+se[3]),format:ne?"name":"hex"}:!1}function oe(Z){var ne,se;return Z=Z||{level:"AA",size:"small"},ne=(Z.level||"AA").toUpperCase(),se=(Z.size||"small").toLowerCase(),ne!=="AA"&&ne!=="AAA"&&(ne="AA"),se!=="small"&&se!=="large"&&(se="small"),{level:ne,size:se}}ut.exports?ut.exports=R:!(ce=function(){return R}.call(Ke,$,Ke,ut),ce!==void 0&&(ut.exports=ce))})(Math)},bT9E:function(ut,Ke,$){"use strict";$.d(Ke,"a",function(){return Y});var ce=$("VTBJ");function Y(N,Q){var F=Object(ce.a)({},N);return Array.isArray(Q)&&Q.forEach(function(D){delete F[D]}),F}},biw7:function(ut,Ke,$){"use strict";var ce=$("q1tI"),Y=$.n(ce),N=ce.createContext(null);Ke.a=N},c5Ni:function(ut,Ke,$){},dejd:function(ut,Ke,$){},dmUQ:function(ut,Ke,$){"use strict";var ce=$("Ff2n"),Y=$("rePB"),N=$("1OyB"),Q=$("vuIU"),F=$("Ji7U"),D=$("md7G"),G=$("foSv"),B=$("q1tI"),k=$.n(B),R=$("TSYQ"),b=$.n(R),v=$("4IlW");function m(p,d){var g=Object.keys(p);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(p);d&&(l=l.filter(function(E){return Object.getOwnPropertyDescriptor(p,E).enumerable})),g.push.apply(g,l)}return g}function u(p){for(var d=1;d<arguments.length;d++){var g=arguments[d]!=null?arguments[d]:{};d%2?m(Object(g),!0).forEach(function(l){Object(Y.a)(p,l,g[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(g)):m(Object(g)).forEach(function(l){Object.defineProperty(p,l,Object.getOwnPropertyDescriptor(g,l))})}return p}function r(p){var d=c();return function(){var l=Object(G.a)(p),E;if(d){var U=Object(G.a)(this).constructor;E=Reflect.construct(l,arguments,U)}else E=l.apply(this,arguments);return Object(D.a)(this,E)}}function c(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(p){return!1}}function s(){}function a(p){p.preventDefault()}var o=function(d){return d.replace(/[^\w.-]+/g,"")},h=200,O=600,w=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,x=function(d){return d!=null},A=function(d,g){return g===d||typeof g=="number"&&typeof d=="number"&&isNaN(g)&&isNaN(d)},S=function(p){Object(F.a)(g,p);var d=r(g);function g(l){var E;Object(N.a)(this,g),E=d.call(this,l),E.onKeyDown=function(j){var H=E.props,I=H.onKeyDown,T=H.onPressEnter;if(j.keyCode===v.a.UP){var K=E.getRatio(j);E.up(j,K,null),E.stop()}else if(j.keyCode===v.a.DOWN){var J=E.getRatio(j);E.down(j,J,null),E.stop()}else j.keyCode===v.a.ENTER&&T&&T(j);if(E.recordCursorPosition(),E.lastKeyCode=j.keyCode,I){for(var ie=arguments.length,pe=new Array(ie>1?ie-1:0),_e=1;_e<ie;_e++)pe[_e-1]=arguments[_e];I.apply(void 0,[j].concat(pe))}},E.onKeyUp=function(j){var H=E.props.onKeyUp;if(E.stop(),E.recordCursorPosition(),H){for(var I=arguments.length,T=new Array(I>1?I-1:0),K=1;K<I;K++)T[K-1]=arguments[K];H.apply(void 0,[j].concat(T))}},E.onChange=function(j){var H=E.props.onChange;E.state.focused&&(E.inputting=!0),E.rawInput=E.props.parser(E.getValueFromEvent(j)),E.setState({inputValue:E.rawInput}),H(E.toNumber(E.rawInput))},E.onMouseUp=function(){var j=E.props.onMouseUp;E.recordCursorPosition(),j&&j.apply(void 0,arguments)},E.onFocus=function(){var j;E.setState({focused:!0}),(j=E.props).onFocus.apply(j,arguments)},E.onBlur=function(){var j=E.props.onBlur;E.inputting=!1,E.setState({focused:!1});var H=E.getCurrentValidValue(E.state.inputValue),I=E.setValue(H,s);if(j){var T=E.input.value,K=E.getInputDisplayValue({focus:!1,value:I});E.input.value=K&&Number(K),j.apply(void 0,arguments),E.input.value=T}},E.getRatio=function(j){var H=1;return j.metaKey||j.ctrlKey?H=.1:j.shiftKey&&(H=10),H},E.getFullNum=function(j){return isNaN(j)?j:/e/i.test(String(j))?Number(j).toFixed(18).replace(/\.?0+$/,""):j},E.getPrecision=function(j){if(x(E.props.precision))return E.props.precision;var H=String(j);if(H.indexOf("e-")>=0)return parseInt(H.slice(H.indexOf("e-")+2),10);var I=0;return H.indexOf(".")>=0&&(I=H.length-H.indexOf(".")-1),I},E.getInputDisplayValue=function(j){var H=j||E.state,I=H.focused,T=H.inputValue,K=H.value,J;I?J=T:J=E.toPrecisionAsStep(K),J==null&&(J="");var ie=E.formatWrapper(J);return x(E.props.decimalSeparator)&&(ie=ie.toString().replace(".",E.props.decimalSeparator)),ie},E.recordCursorPosition=function(){try{E.cursorStart=E.input.selectionStart,E.cursorEnd=E.input.selectionEnd,E.currentValue=E.input.value,E.cursorBefore=E.input.value.substring(0,E.cursorStart),E.cursorAfter=E.input.value.substring(E.cursorEnd)}catch(j){}},E.restoreByAfter=function(j){if(j===void 0)return!1;var H=E.input.value,I=H.lastIndexOf(j);if(I===-1)return!1;var T=E.cursorBefore.length;return E.lastKeyCode===v.a.DELETE&&E.cursorBefore.charAt(T-1)===j[0]?(E.fixCaret(T,T),!0):I+j.length===H.length?(E.fixCaret(I,I),!0):!1},E.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(H,I){var T=j.substring(I);return E.restoreByAfter(T)})},E.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},E.stop=function(){E.autoStepTimer&&clearTimeout(E.autoStepTimer)},E.down=function(j,H,I){E.pressingUpOrDown=!0,E.step("down",j,H,I)},E.up=function(j,H,I){E.pressingUpOrDown=!0,E.step("up",j,H,I)},E.saveInput=function(j){E.input=j};var U=l.value;U===void 0&&(U=l.defaultValue),E.state={focused:l.autoFocus};var P=E.getValidValue(E.toNumber(U));return E.state=u(u({},E.state),{},{inputValue:E.toPrecisionAsStep(P),value:P}),E}return Object(Q.a)(g,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(E){var U=this.props,P=U.value,j=U.onChange,H=U.max,I=U.min,T=this.state.focused;if(E){if(!A(E.value,P)||!A(E.max,H)||!A(E.min,I)){var K=T?P:this.getValidValue(P),J;this.pressingUpOrDown?J=K:this.inputting?J=this.rawInput:J=this.toPrecisionAsStep(K),this.setState({value:K,inputValue:J})}var ie="value"in this.props?P:this.state.value;"max"in this.props&&E.max!==H&&typeof ie=="number"&&ie>H&&j&&j(H),"min"in this.props&&E.min!==I&&typeof ie=="number"&&ie<I&&j&&j(I)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var pe=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===v.a.BACKSPACE?pe=this.cursorStart-1:this.lastKeyCode===v.a.DELETE&&(pe=this.cursorStart):pe=this.input.value.length,this.fixCaret(pe,pe)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case v.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case v.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(_e){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(E){var U=E;return U===""?U="":this.isNotCompleteNumber(parseFloat(U))?U=this.state.value:U=this.getValidValue(U),this.toNumber(U)}},{key:"getValueFromEvent",value:function(E){var U=E.target.value.trim().replace(/。/g,".");return x(this.props.decimalSeparator)&&(U=U.replace(this.props.decimalSeparator,".")),U}},{key:"getValidValue",value:function(E){var U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,j=parseFloat(E);return isNaN(j)?E:(j<U&&(j=U),j>P&&(j=P),j)}},{key:"setValue",value:function(E,U){var P=this.props.precision,j=this.isNotCompleteNumber(parseFloat(E))?null:parseFloat(E),H=this.state.value,I=H===void 0?null:H,T=this.state.inputValue,K=T===void 0?null:T,J=typeof j=="number"?j.toFixed(P):"".concat(j),ie=j!==I||J!=="".concat(K);return"value"in this.props?(K=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:K},U)):this.setState({value:j,inputValue:this.toPrecisionAsStep(E)},U),ie&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(E){var U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,P=this.props,j=P.precision,H=P.step;if(x(j))return j;var I=this.getPrecision(U),T=this.getPrecision(H),K=this.getPrecision(E);return E?Math.max(K,I+T):I+T}},{key:"getPrecisionFactor",value:function(E){var U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,P=this.getMaxPrecision(E,U);return Math.pow(10,P)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(E){return this.props.formatter?this.props.formatter(E):E}},{key:"toPrecisionAsStep",value:function(E){if(this.isNotCompleteNumber(E)||E==="")return E;var U=Math.abs(this.getMaxPrecision(E));return isNaN(U)?E.toString():Number(E).toFixed(U)}},{key:"toNumber",value:function(E){var U=this.props.precision,P=this.state.focused,j=E&&E.length>16&&P;return this.isNotCompleteNumber(E)||j?E:x(U)?Math.round(E*Math.pow(10,U))/Math.pow(10,U):Number(E)}},{key:"upStep",value:function(E,U){var P=this.props.step,j=this.getPrecisionFactor(E,U),H=Math.abs(this.getMaxPrecision(E,U)),I=((j*E+j*P*U)/j).toFixed(H);return this.toNumber(I)}},{key:"downStep",value:function(E,U){var P=this.props.step,j=this.getPrecisionFactor(E,U),H=Math.abs(this.getMaxPrecision(E,U)),I=((j*E-j*P*U)/j).toFixed(H);return this.toNumber(I)}},{key:"step",value:function(E,U){var P=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,H=arguments.length>3?arguments[3]:void 0;this.stop(),U&&(U.persist(),U.preventDefault());var I=this.props;if(I.disabled)return;var T=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(T))return;var K=this["".concat(E,"Step")](T,j),J=K>I.max||K<I.min;if(K>I.max?K=I.max:K<I.min&&(K=I.min),this.setValue(K,null),this.setState({focused:!0},function(){P.pressingUpOrDown=!1}),J)return;this.autoStepTimer=setTimeout(function(){P[E](U,j,!0)},H?h:O)}},{key:"fixCaret",value:function(E,U){if(E===void 0||U===void 0||!this.input||!this.input.value)return;try{var P=this.input.selectionStart,j=this.input.selectionEnd;(E!==P||U!==j)&&this.input.setSelectionRange(E,U)}catch(H){}}},{key:"render",value:function(){var E,U=this.props,P=U.prefixCls,j=U.disabled,H=U.readOnly,I=U.useTouch,T=U.autoComplete,K=U.upHandler,J=U.downHandler,ie=U.className,pe=U.max,_e=U.min,Te=U.style,he=U.title,re=U.onMouseEnter,fe=U.onMouseLeave,ae=U.onMouseOver,oe=U.onMouseOut,Z=U.required,ne=U.onClick,se=U.tabIndex,me=U.type,Se=U.placeholder,Ee=U.id,Le=U.inputMode,Pe=U.pattern,Be=U.step,He=U.maxLength,Ge=U.autoFocus,Ue=U.name,tt=U.onPaste,nt=U.onInput,ot=Object(ce.a)(U,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),st=this.state,mt=st.value,ht=st.focused,Ie=b()(P,(E={},Object(Y.a)(E,ie,!!ie),Object(Y.a)(E,"".concat(P,"-disabled"),j),Object(Y.a)(E,"".concat(P,"-focused"),ht),E)),Re={};Object.keys(ot).forEach(function(xe){(xe.substr(0,5)==="data-"||xe.substr(0,5)==="aria-"||xe==="role")&&(Re[xe]=ot[xe])});var ze=!H&&!j,Ve=this.getInputDisplayValue(null),De=(mt||mt===0)&&(isNaN(mt)||Number(mt)>=pe),Me=(mt||mt===0)&&(isNaN(mt)||Number(mt)<=_e),be=De||j||H,ve=Me||j||H,ge=b()("".concat(P,"-handler"),"".concat(P,"-handler-up"),Object(Y.a)({},"".concat(P,"-handler-up-disabled"),be)),le=b()("".concat(P,"-handler"),"".concat(P,"-handler-down"),Object(Y.a)({},"".concat(P,"-handler-down-disabled"),ve)),ue=I?{onTouchStart:be?s:this.up,onTouchEnd:this.stop}:{onMouseDown:be?s:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ye=I?{onTouchStart:ve?s:this.down,onTouchEnd:this.stop}:{onMouseDown:ve?s:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return k.a.createElement("div",{className:Ie,style:Te,title:he,onMouseEnter:re,onMouseLeave:fe,onMouseOver:ae,onMouseOut:oe,onFocus:function(){return null},onBlur:function(){return null}},k.a.createElement("div",{className:"".concat(P,"-handler-wrap")},k.a.createElement("span",Object.assign({unselectable:"on"},ue,{role:"button","aria-label":"Increase Value","aria-disabled":be,className:ge}),K||k.a.createElement("span",{unselectable:"on",className:"".concat(P,"-handler-up-inner"),onClick:a})),k.a.createElement("span",Object.assign({unselectable:"on"},ye,{role:"button","aria-label":"Decrease Value","aria-disabled":ve,className:le}),J||k.a.createElement("span",{unselectable:"on",className:"".concat(P,"-handler-down-inner"),onClick:a}))),k.a.createElement("div",{className:"".concat(P,"-input-wrap")},k.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":_e,"aria-valuemax":pe,"aria-valuenow":mt,required:Z,type:me,placeholder:Se,onPaste:tt,onClick:ne,onMouseUp:this.onMouseUp,className:"".concat(P,"-input"),tabIndex:se,autoComplete:T,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:ze?this.onKeyDown:s,onKeyUp:ze?this.onKeyUp:s,autoFocus:Ge,maxLength:He,readOnly:H,disabled:j,max:pe,min:_e,step:Be,name:Ue,title:he,id:Ee,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ve),pattern:Pe,inputMode:Le,onInput:nt},Re))))}}]),g}(k.a.Component);S.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:w,min:-w,step:1,style:{},onChange:s,onKeyDown:s,onPressEnter:s,onFocus:s,onBlur:s,parser:o,required:!1,autoComplete:"off"};var y=S,_=Ke.a=y},fAei:function(ut,Ke,$){"use strict";$.d(Ke,"a",function(){return h.a});var ce=$("rePB"),Y=$("VTBJ"),N=$("KQm4"),Q=$("1OyB"),F=$("vuIU"),D=$("Ji7U"),G=$("LK+K"),B=$("q1tI"),k=$("4IlW"),R=$("Kwbf"),b=$("TSYQ"),v=$.n(b),m=$("sboe"),u=$("OZM5"),r=$("815F"),c=$("ODXe"),s=$("Ff2n"),a=$("+nKL"),o=$("8XRh"),h=$("WaYH"),O=function(_e,Te){var he=_e.className,re=_e.style,fe=_e.motion,ae=_e.motionNodes,oe=_e.motionType,Z=_e.onMotionStart,ne=_e.onMotionEnd,se=_e.active,me=_e.treeNodeRequiredProps,Se=Object(s.a)(_e,["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"]),Ee=B.useState(!0),Le=Object(c.a)(Ee,2),Pe=Le[0],Be=Le[1],He=B.useContext(m.a),Ge=He.prefixCls,Ue=B.useRef(!1),tt=function(){Ue.current||ne(),Ue.current=!0};return Object(B.useEffect)(function(){ae&&oe==="hide"&&Pe&&Be(!1)},[ae]),Object(B.useEffect)(function(){return ae&&Z(),function(){ae&&tt()}},[]),ae?B.createElement(o.default,Object.assign({ref:Te,visible:Pe},fe,{motionAppear:oe==="show",onAppearEnd:tt,onLeaveEnd:tt}),function(nt,ot){var st=nt.className,mt=nt.style;return B.createElement("div",{ref:ot,className:v()("".concat(Ge,"-treenode-motion"),st),style:mt},ae.map(function(ht){var Ie=ht.data,Re=Ie.key,ze=Object(s.a)(Ie,["key"]),Ve=ht.isStart,De=ht.isEnd;delete ze.children;var Me=Object(r.f)(Re,me);return B.createElement(h.a,Object.assign({},ze,Me,{active:se,data:ht.data,key:Re,isStart:Ve,isEnd:De}))}))}):B.createElement(h.a,Object.assign({domRef:Te,className:he,style:re},Se,{active:se}))};O.displayName="MotionTreeNode";var w=B.forwardRef(O),x=w;function A(){var pe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],_e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],Te=pe.length,he=_e.length;if(Math.abs(Te-he)!==1)return{add:!1,key:null};function re(fe,ae){var oe=new Map;fe.forEach(function(ne){oe.set(ne,!0)});var Z=ae.filter(function(ne){return!oe.has(ne)});return Z.length===1?Z[0]:null}return Te<he?{add:!0,key:re(pe,_e)}:{add:!1,key:re(_e,pe)}}function S(pe,_e,Te){var he=pe.findIndex(function(oe){var Z=oe.data;return Z.key===Te}),re=pe[he+1],fe=_e.findIndex(function(oe){var Z=oe.data;return Z.key===Te});if(re){var ae=_e.findIndex(function(oe){var Z=oe.data;return Z.key===re.data.key});return _e.slice(fe+1,ae)}return _e.slice(fe+1)}var y={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},_=function(){},p="RC_TREE_MOTION_".concat(Math.random()),d={key:p},g={key:p,level:0,index:0,pos:"0",node:d},l={parent:null,children:[],pos:g.pos,data:d,isStart:[],isEnd:[]};function E(pe,_e,Te,he){return _e===!1||!Te?pe:pe.slice(0,Math.ceil(Te/he)+1)}function U(pe){var _e=pe.data.key,Te=pe.pos;return Object(r.e)(_e,Te)}function P(pe){for(var _e=String(pe.data.key),Te=pe;Te.parent;)Te=Te.parent,_e="".concat(Te.data.key," > ").concat(_e);return _e}var j=function(_e,Te){var he=_e.prefixCls,re=_e.data,fe=_e.selectable,ae=_e.checkable,oe=_e.expandedKeys,Z=_e.selectedKeys,ne=_e.checkedKeys,se=_e.loadedKeys,me=_e.loadingKeys,Se=_e.halfCheckedKeys,Ee=_e.keyEntities,Le=_e.disabled,Pe=_e.dragging,Be=_e.dragOverNodeKey,He=_e.dropPosition,Ge=_e.motion,Ue=_e.height,tt=_e.itemHeight,nt=_e.virtual,ot=_e.focusable,st=_e.activeItem,mt=_e.focused,ht=_e.tabIndex,Ie=_e.onKeyDown,Re=_e.onFocus,ze=_e.onBlur,Ve=_e.onActiveChange,De=_e.onListChangeStart,Me=_e.onListChangeEnd,be=Object(s.a)(_e,["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"]),ve=B.useRef(null);B.useImperativeHandle(Te,function(){return{scrollTo:function(et){ve.current.scrollTo(et)}}});var ge=B.useState(oe),le=Object(c.a)(ge,2),ue=le[0],ye=le[1],xe=B.useState(re),we=Object(c.a)(xe,2),ke=we[0],We=we[1],Je=B.useState(re),Qe=Object(c.a)(Je,2),Ze=Qe[0],bt=Qe[1],yt=B.useState([]),lt=Object(c.a)(yt,2),wt=lt[0],xt=lt[1],Ct=B.useState(null),Mt=Object(c.a)(Ct,2),Ot=Mt[0],Lt=Mt[1];function gt(){We(re),bt(re),xt([]),Lt(null),Me()}B.useEffect(function(){ye(oe);var it=A(ue,oe);if(it.key!==null)if(it.add){var et=ke.findIndex(function(Vt){var sn=Vt.data.key;return sn===it.key}),Tt=E(S(ke,re,it.key),nt,Ue,tt),kt=ke.slice();kt.splice(et+1,0,l),bt(kt),xt(Tt),Lt("show")}else{var Dt=re.findIndex(function(Vt){var sn=Vt.data.key;return sn===it.key}),vt=E(S(re,ke,it.key),nt,Ue,tt),dt=re.slice();dt.splice(Dt+1,0,l),bt(dt),xt(vt),Lt("hide")}else ke!==re&&(We(re),bt(re))},[oe,re]),B.useEffect(function(){Pe||gt()},[Pe]);var je=Ge?Ze:re,rt={expandedKeys:oe,selectedKeys:Z,loadedKeys:se,loadingKeys:me,checkedKeys:ne,halfCheckedKeys:Se,dragOverNodeKey:Be,dropPosition:He,keyEntities:Ee};return B.createElement(B.Fragment,null,mt&&st&&B.createElement("span",{style:y,"aria-live":"assertive"},P(st)),B.createElement("div",{role:"tree"},B.createElement("input",{style:y,disabled:ot===!1||Le,tabIndex:ot!==!1?ht:null,onKeyDown:Ie,onFocus:Re,onBlur:ze,value:"",onChange:_})),B.createElement(a.a,Object.assign({},be,{data:je,itemKey:U,height:Ue,fullHeight:!1,virtual:nt,itemHeight:tt,prefixCls:"".concat(he,"-list"),ref:ve}),function(it){var et=it.pos,Tt=it.data,kt=Tt.key,Dt=Object(s.a)(Tt,["key"]),vt=it.isStart,dt=it.isEnd,Vt=Object(r.e)(kt,et);delete Dt.children;var sn=Object(r.f)(Vt,rt);return B.createElement(x,Object.assign({},Dt,sn,{active:st&&kt===st.data.key,pos:et,data:it.data,isStart:vt,isEnd:dt,motion:Ge,motionNodes:kt===p?wt:null,motionType:Ot,onMotionStart:De,onMotionEnd:gt,treeNodeRequiredProps:rt,onMouseMove:function(){Ve(null)}}))}))},H=B.forwardRef(j);H.displayName="NodeList";var I=H,T=$("NvD2"),K=function(pe){Object(D.a)(Te,pe);var _e=Object(G.a)(Te);function Te(){var he;return Object(Q.a)(this,Te),he=_e.apply(this,arguments),he.destroyed=!1,he.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},he.listRef=B.createRef(),he.onNodeDragStart=function(re,fe){var ae=he.state,oe=ae.expandedKeys,Z=ae.keyEntities,ne=he.props.onDragStart,se=fe.props.eventKey;he.dragNode=fe;var me=Object(u.b)(oe,se);he.setState({dragging:!0,dragNodesKeys:Object(u.g)(se,Z)}),he.setExpandedKeys(me),ne&&ne({event:re,node:Object(r.b)(fe.props)})},he.onNodeDragEnter=function(re,fe){var ae=he.state,oe=ae.expandedKeys,Z=ae.keyEntities,ne=ae.dragNodesKeys,se=he.props.onDragEnter,me=fe.props,Se=me.pos,Ee=me.eventKey;if(!he.dragNode||ne.indexOf(Ee)!==-1)return;var Le=Object(u.c)(re,fe);if(he.dragNode.props.eventKey===Ee&&Le===0){he.setState({dragOverNodeKey:"",dropPosition:null});return}setTimeout(function(){he.setState({dragOverNodeKey:Ee,dropPosition:Le}),he.delayedDragEnterLogic||(he.delayedDragEnterLogic={}),Object.keys(he.delayedDragEnterLogic).forEach(function(Pe){clearTimeout(he.delayedDragEnterLogic[Pe])}),he.delayedDragEnterLogic[Se]=window.setTimeout(function(){if(!he.state.dragging)return;var Pe=Object(N.a)(oe),Be=Z[Ee];Be&&(Be.children||[]).length&&(Pe=Object(u.a)(oe,Ee)),"expandedKeys"in he.props||he.setExpandedKeys(Pe),se&&se({event:re,node:Object(r.b)(fe.props),expandedKeys:Pe})},400)},0)},he.onNodeDragOver=function(re,fe){var ae=he.state.dragNodesKeys,oe=he.props.onDragOver,Z=fe.props.eventKey;if(ae.indexOf(Z)!==-1)return;if(he.dragNode&&Z===he.state.dragOverNodeKey){var ne=Object(u.c)(re,fe);if(ne===he.state.dropPosition)return;he.setState({dropPosition:ne})}oe&&oe({event:re,node:Object(r.b)(fe.props)})},he.onNodeDragLeave=function(re,fe){var ae=he.props.onDragLeave;he.setState({dragOverNodeKey:""}),ae&&ae({event:re,node:Object(r.b)(fe.props)})},he.onNodeDragEnd=function(re,fe){var ae=he.props.onDragEnd;he.setState({dragOverNodeKey:""}),he.cleanDragState(),ae&&ae({event:re,node:Object(r.b)(fe.props)}),he.dragNode=null},he.onNodeDrop=function(re,fe){var ae=he.state,oe=ae.dragNodesKeys,Z=oe===void 0?[]:oe,ne=ae.dropPosition,se=he.props.onDrop,me=fe.props,Se=me.eventKey,Ee=me.pos;if(he.setState({dragOverNodeKey:""}),he.cleanDragState(),Z.indexOf(Se)!==-1){Object(R.a)(!1,"Can not drop to dragNode(include it's children node)");return}var Le=Object(u.k)(Ee),Pe={event:re,node:Object(r.b)(fe.props),dragNode:he.dragNode?Object(r.b)(he.dragNode.props):null,dragNodesKeys:Z.slice(),dropPosition:ne+Number(Le[Le.length-1]),dropToGap:!1};ne!==0&&(Pe.dropToGap=!0),se&&se(Pe),he.dragNode=null},he.cleanDragState=function(){var re=he.state.dragging;re&&he.setState({dragging:!1})},he.onNodeClick=function(re,fe){var ae=he.props.onClick;ae&&ae(re,fe)},he.onNodeDoubleClick=function(re,fe){var ae=he.props.onDoubleClick;ae&&ae(re,fe)},he.onNodeSelect=function(re,fe){var ae=he.state.selectedKeys,oe=he.state.keyEntities,Z=he.props,ne=Z.onSelect,se=Z.multiple,me=fe.selected,Se=fe.key,Ee=!me;Ee?se?ae=Object(u.a)(ae,Se):ae=[Se]:ae=Object(u.b)(ae,Se);var Le=ae.map(function(Pe){var Be=oe[Pe];return Be?Be.node:null}).filter(function(Pe){return Pe});he.setUncontrolledState({selectedKeys:ae}),ne&&ne(ae,{event:"select",selected:Ee,node:fe,selectedNodes:Le,nativeEvent:re.nativeEvent})},he.onNodeCheck=function(re,fe,ae){var oe=he.state,Z=oe.keyEntities,ne=oe.checkedKeys,se=oe.halfCheckedKeys,me=he.props,Se=me.checkStrictly,Ee=me.onCheck,Le=fe.key,Pe,Be={event:"check",node:fe,checked:ae,nativeEvent:re.nativeEvent};if(Se){var He=ae?Object(u.a)(ne,Le):Object(u.b)(ne,Le),Ge=Object(u.b)(se,Le);Pe={checked:He,halfChecked:Ge},Be.checkedNodes=He.map(function(mt){return Z[mt]}).filter(function(mt){return mt}).map(function(mt){return mt.node}),he.setUncontrolledState({checkedKeys:He})}else{var Ue=Object(T.a)([].concat(Object(N.a)(ne),[Le]),!0,Z),tt=Ue.checkedKeys,nt=Ue.halfCheckedKeys;if(!ae){var ot=new Set(tt);ot.delete(Le);var st=Object(T.a)(Array.from(ot),{checked:!1,halfCheckedKeys:nt},Z);tt=st.checkedKeys,nt=st.halfCheckedKeys}Pe=tt,Be.checkedNodes=[],Be.checkedNodesPositions=[],Be.halfCheckedKeys=nt,tt.forEach(function(mt){var ht=Z[mt];if(!ht)return;var Ie=ht.node,Re=ht.pos;Be.checkedNodes.push(Ie),Be.checkedNodesPositions.push({node:Ie,pos:Re})}),he.setUncontrolledState({checkedKeys:tt},!1,{halfCheckedKeys:nt})}Ee&&Ee(Pe,Be)},he.onNodeLoad=function(re){return new Promise(function(fe){he.setState(function(ae){var oe=ae.loadedKeys,Z=oe===void 0?[]:oe,ne=ae.loadingKeys,se=ne===void 0?[]:ne,me=he.props,Se=me.loadData,Ee=me.onLoad,Le=re.key;if(!Se||Z.indexOf(Le)!==-1||se.indexOf(Le)!==-1)return{};var Pe=Se(re);return Pe.then(function(){var Be=he.state,He=Be.loadedKeys,Ge=Be.loadingKeys,Ue=Object(u.a)(He,Le),tt=Object(u.b)(Ge,Le);Ee&&Ee(Ue,{event:"load",node:re}),he.setUncontrolledState({loadedKeys:Ue}),he.setState({loadingKeys:tt}),fe()}),{loadingKeys:Object(u.a)(se,Le)}})})},he.onNodeMouseEnter=function(re,fe){var ae=he.props.onMouseEnter;ae&&ae({event:re,node:fe})},he.onNodeMouseLeave=function(re,fe){var ae=he.props.onMouseLeave;ae&&ae({event:re,node:fe})},he.onNodeContextMenu=function(re,fe){var ae=he.props.onRightClick;ae&&(re.preventDefault(),ae({event:re,node:fe}))},he.onFocus=function(){var re=he.props.onFocus;he.setState({focused:!0}),re&&re.apply(void 0,arguments)},he.onBlur=function(){var re=he.props.onBlur;he.setState({focused:!1}),he.onActiveChange(null),re&&re.apply(void 0,arguments)},he.getTreeNodeRequiredProps=function(){var re=he.state,fe=re.expandedKeys,ae=re.selectedKeys,oe=re.loadedKeys,Z=re.loadingKeys,ne=re.checkedKeys,se=re.halfCheckedKeys,me=re.dragOverNodeKey,Se=re.dropPosition,Ee=re.keyEntities;return{expandedKeys:fe||[],selectedKeys:ae||[],loadedKeys:oe||[],loadingKeys:Z||[],checkedKeys:ne||[],halfCheckedKeys:se||[],dragOverNodeKey:me,dropPosition:Se,keyEntities:Ee}},he.setExpandedKeys=function(re){var fe=he.state.treeData,ae=Object(r.d)(fe,re);he.setUncontrolledState({expandedKeys:re,flattenNodes:ae},!0)},he.onNodeExpand=function(re,fe){var ae=he.state.expandedKeys,oe=he.state.listChanging,Z=he.props,ne=Z.onExpand,se=Z.loadData,me=fe.key,Se=fe.expanded;if(oe)return;var Ee=ae.indexOf(me),Le=!Se;if(Object(R.a)(Se&&Ee!==-1||!Se&&Ee===-1,"Expand state not sync with index check"),Le?ae=Object(u.a)(ae,me):ae=Object(u.b)(ae,me),he.setExpandedKeys(ae),ne&&ne(ae,{node:fe,expanded:Le,nativeEvent:re.nativeEvent}),Le&&se){var Pe=he.onNodeLoad(fe);Pe&&Pe.then(function(){var Be=Object(r.d)(he.state.treeData,ae);he.setUncontrolledState({flattenNodes:Be})})}},he.onListChangeStart=function(){he.setUncontrolledState({listChanging:!0})},he.onListChangeEnd=function(){setTimeout(function(){he.setUncontrolledState({listChanging:!1})})},he.onActiveChange=function(re){var fe=he.state.activeKey,ae=he.props.onActiveChange;if(fe===re)return;he.setState({activeKey:re}),re!==null&&he.scrollTo({key:re}),ae&&ae(re)},he.getActiveItem=function(){var re=he.state,fe=re.activeKey,ae=re.flattenNodes;return fe===null?null:ae.find(function(oe){var Z=oe.data.key;return Z===fe})||null},he.offsetActiveKey=function(re){var fe=he.state,ae=fe.flattenNodes,oe=fe.activeKey,Z=ae.findIndex(function(me){var Se=me.data.key;return Se===oe});Z===-1&&re<0&&(Z=ae.length),Z=(Z+re+ae.length)%ae.length;var ne=ae[Z];if(ne){var se=ne.data.key;he.onActiveChange(se)}else he.onActiveChange(null)},he.onKeyDown=function(re){var fe=he.state,ae=fe.activeKey,oe=fe.expandedKeys,Z=fe.checkedKeys,ne=he.props,se=ne.onKeyDown,me=ne.checkable,Se=ne.selectable;switch(re.which){case k.a.UP:{he.offsetActiveKey(-1),re.preventDefault();break}case k.a.DOWN:{he.offsetActiveKey(1),re.preventDefault();break}}var Ee=he.getActiveItem();if(Ee&&Ee.data){var Le=he.getTreeNodeRequiredProps(),Pe=Ee.data.isLeaf===!1||!!(Ee.data.children||[]).length,Be=Object(r.b)(Object(Y.a)(Object(Y.a)({},Object(r.f)(ae,Le)),{},{data:Ee.data,active:!0}));switch(re.which){case k.a.LEFT:{Pe&&oe.includes(ae)?he.onNodeExpand({},Be):Ee.parent&&he.onActiveChange(Ee.parent.data.key),re.preventDefault();break}case k.a.RIGHT:{Pe&&!oe.includes(ae)?he.onNodeExpand({},Be):Ee.children&&Ee.children.length&&he.onActiveChange(Ee.children[0].data.key),re.preventDefault();break}case k.a.ENTER:case k.a.SPACE:{me&&!Be.disabled&&Be.checkable!==!1&&!Be.disableCheckbox?he.onNodeCheck({},Be,!Z.includes(ae)):!me&&Se&&!Be.disabled&&Be.selectable!==!1&&he.onNodeSelect({},Be);break}}}se&&se(re)},he.setUncontrolledState=function(re){var fe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ae=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(he.destroyed)return;var oe=!1,Z=!0,ne={};Object.keys(re).forEach(function(se){if(se in he.props){Z=!1;return}oe=!0,ne[se]=re[se]}),oe&&(!fe||Z)&&he.setState(Object(Y.a)(Object(Y.a)({},ne),ae))},he.scrollTo=function(re){he.listRef.current.scrollTo(re)},he}return Object(F.a)(Te,[{key:"componentWillUnmount",value:function(){this.destroyed=!0}},{key:"render",value:function(){var re,fe=this.state,ae=fe.focused,oe=fe.flattenNodes,Z=fe.keyEntities,ne=fe.dragging,se=fe.activeKey,me=this.props,Se=me.prefixCls,Ee=me.className,Le=me.style,Pe=me.showLine,Be=me.focusable,He=me.tabIndex,Ge=He===void 0?0:He,Ue=me.selectable,tt=me.showIcon,nt=me.icon,ot=me.switcherIcon,st=me.draggable,mt=me.checkable,ht=me.checkStrictly,Ie=me.disabled,Re=me.motion,ze=me.loadData,Ve=me.filterTreeNode,De=me.height,Me=me.itemHeight,be=me.virtual,ve=me.titleRender,ge=me.onContextMenu,le=Object(u.f)(this.props);return B.createElement(m.a.Provider,{value:{prefixCls:Se,selectable:Ue,showIcon:tt,icon:nt,switcherIcon:ot,draggable:st,checkable:mt,checkStrictly:ht,disabled:Ie,keyEntities:Z,loadData:ze,filterTreeNode:Ve,titleRender:ve,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:v()(Se,Ee,(re={},Object(ce.a)(re,"".concat(Se,"-show-line"),Pe),Object(ce.a)(re,"".concat(Se,"-focused"),ae),Object(ce.a)(re,"".concat(Se,"-active-focused"),se!==null),re))},B.createElement(I,Object.assign({ref:this.listRef,prefixCls:Se,style:Le,data:oe,disabled:Ie,selectable:Ue,checkable:!!mt,motion:Re,dragging:ne,height:De,itemHeight:Me,virtual:be,focusable:Be,focused:ae,tabIndex:Ge,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:ge},this.getTreeNodeRequiredProps(),le))))}}],[{key:"getDerivedStateFromProps",value:function(re,fe){var ae=fe.prevProps,oe={prevProps:re};function Z(nt){return!ae&&nt in re||ae&&ae[nt]!==re[nt]}var ne;if(Z("treeData")?ne=re.treeData:Z("children")&&(Object(R.a)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),ne=Object(r.c)(re.children)),ne){oe.treeData=ne;var se=Object(r.a)(ne);oe.keyEntities=Object(Y.a)(Object(ce.a)({},p,g),se.keyEntities)}var me=oe.keyEntities||fe.keyEntities;if(Z("expandedKeys")||ae&&Z("autoExpandParent"))oe.expandedKeys=re.autoExpandParent||!ae&&re.defaultExpandParent?Object(u.e)(re.expandedKeys,me):re.expandedKeys;else if(!ae&&re.defaultExpandAll){var Se=Object(Y.a)({},me);delete Se[p],oe.expandedKeys=Object.keys(Se).map(function(nt){return Se[nt].key})}else!ae&&re.defaultExpandedKeys&&(oe.expandedKeys=re.autoExpandParent||re.defaultExpandParent?Object(u.e)(re.defaultExpandedKeys,me):re.defaultExpandedKeys);if(oe.expandedKeys||delete oe.expandedKeys,ne||oe.expandedKeys){var Ee=Object(r.d)(ne||fe.treeData,oe.expandedKeys||fe.expandedKeys);oe.flattenNodes=Ee}if(re.selectable&&(Z("selectedKeys")?oe.selectedKeys=Object(u.d)(re.selectedKeys,re):!ae&&re.defaultSelectedKeys&&(oe.selectedKeys=Object(u.d)(re.defaultSelectedKeys,re))),re.checkable){var Le;if(Z("checkedKeys")?Le=Object(u.j)(re.checkedKeys)||{}:!ae&&re.defaultCheckedKeys?Le=Object(u.j)(re.defaultCheckedKeys)||{}:ne&&(Le=Object(u.j)(re.checkedKeys)||{checkedKeys:fe.checkedKeys,halfCheckedKeys:fe.halfCheckedKeys}),Le){var Pe=Le,Be=Pe.checkedKeys,He=Be===void 0?[]:Be,Ge=Pe.halfCheckedKeys,Ue=Ge===void 0?[]:Ge;if(!re.checkStrictly){var tt=Object(T.a)(He,!0,me);He=tt.checkedKeys,Ue=tt.halfCheckedKeys}oe.checkedKeys=He,oe.halfCheckedKeys=Ue}}return Z("loadedKeys")&&(oe.loadedKeys=re.loadedKeys),oe}}]),Te}(B.Component);K.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:[]},K.TreeNode=h.a;var J=K,ie=Ke.b=J},fyJ8:function(ut,Ke,$){"use strict";var ce=$("rePB"),Y=$("VTBJ"),N=$("Ff2n"),Q=$("U8pU"),F=$("q1tI"),D=$.n(F),G=$("TSYQ"),B=$.n(G),k=$("c+Xe"),R=$("sR1s");function b(c){return c&&Object(Q.a)(c)==="object"&&!Array.isArray(c)&&!F.isValidElement(c)}function v(c){return typeof c=="string"?!0:Object(k.c)(c)}function m(c,s){var a,o=c.prefixCls,h=c.className,O=c.record,w=c.index,x=c.dataIndex,A=c.render,S=c.children,y=c.component,_=y===void 0?"td":y,p=c.colSpan,d=c.rowSpan,g=c.fixLeft,l=c.fixRight,E=c.firstFixLeft,U=c.lastFixLeft,P=c.firstFixRight,j=c.lastFixRight,H=c.appendNode,I=c.additionalProps,T=I===void 0?{}:I,K=c.ellipsis,J=c.align,ie=c.rowType,pe=c.isSticky,_e="".concat(o,"-cell"),Te,he;if(S)he=S;else{var re=Object(R.b)(O,x);if(he=re,A){var fe=A(re,O,w);b(fe)?(he=fe.children,Te=fe.props):he=fe}}Object(Q.a)(he)==="object"&&!Array.isArray(he)&&!F.isValidElement(he)&&(he=null),K&&(U||P)&&(he=F.createElement("span",{className:"".concat(_e,"-content")},he));var ae=Te||{},oe=ae.colSpan,Z=ae.rowSpan,ne=ae.style,se=ae.className,me=Object(N.a)(ae,["colSpan","rowSpan","style","className"]),Se=oe!==void 0?oe:p,Ee=Z!==void 0?Z:d;if(Se===0||Ee===0)return null;var Le={},Pe=typeof g=="number",Be=typeof l=="number";Pe&&(Le.position="sticky",Le.left=g),Be&&(Le.position="sticky",Le.right=l);var He={};J&&(He.textAlign=J);var Ge,Ue=K===!0?{showTitle:!0}:K;Ue&&(Ue.showTitle||ie==="header")&&(typeof he=="string"||typeof he=="number"?Ge=he.toString():F.isValidElement(he)&&typeof he.props.children=="string"&&(Ge=he.props.children));var tt=Object(Y.a)(Object(Y.a)(Object(Y.a)({title:Ge},me),T),{},{colSpan:Se&&Se!==1?Se:null,rowSpan:Ee&&Ee!==1?Ee:null,className:B()(_e,h,(a={},Object(ce.a)(a,"".concat(_e,"-fix-left"),Pe),Object(ce.a)(a,"".concat(_e,"-fix-left-first"),E),Object(ce.a)(a,"".concat(_e,"-fix-left-last"),U),Object(ce.a)(a,"".concat(_e,"-fix-right"),Be),Object(ce.a)(a,"".concat(_e,"-fix-right-first"),P),Object(ce.a)(a,"".concat(_e,"-fix-right-last"),j),Object(ce.a)(a,"".concat(_e,"-ellipsis"),K),Object(ce.a)(a,"".concat(_e,"-with-append"),H),Object(ce.a)(a,"".concat(_e,"-fix-sticky"),(Pe||Be)&&pe),a),T.className,se),style:Object(Y.a)(Object(Y.a)(Object(Y.a)(Object(Y.a)({},T.style),He),Le),ne),ref:v(_)?s:null});return F.createElement(_,Object.assign({},tt),H,he)}var u=F.forwardRef(m);u.displayName="Cell";var r=F.memo(u,function(c,s){return s.shouldCellUpdate?!s.shouldCellUpdate(s.record,c.record):!1});Ke.a=r},h78n:function(ut,Ke,$){"use strict";$.d(Ke,"a",function(){return E});var ce=$("q1tI"),Y=$.n(ce),N=$("TSYQ"),Q=$.n(N),F={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},D=function(j){var H=j.map(function(){return Object(ce.useRef)()}),I=Object(ce.useRef)();return Object(ce.useEffect)(function(){var T=Date.now(),K=!1;Object.keys(H).forEach(function(J){var ie=H[J].current;if(!ie)return;K=!0;var pe=ie.style;pe.transitionDuration=".3s, .3s, .3s, .06s",I.current&&T-I.current<100&&(pe.transitionDuration="0s, 0s")}),K&&(I.current=Date.now())}),[H]};function G(){return G=Object.assign||function(P){for(var j=1;j<arguments.length;j++){var H=arguments[j];for(var I in H)Object.prototype.hasOwnProperty.call(H,I)&&(P[I]=H[I])}return P},G.apply(this,arguments)}function B(P,j){return m(P)||v(P,j)||R(P,j)||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 R(P,j){if(!P)return;if(typeof P=="string")return b(P,j);var H=Object.prototype.toString.call(P).slice(8,-1);if(H==="Object"&&P.constructor&&(H=P.constructor.name),H==="Map"||H==="Set")return Array.from(P);if(H==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(H))return b(P,j)}function b(P,j){(j==null||j>P.length)&&(j=P.length);for(var H=0,I=new Array(j);H<j;H++)I[H]=P[H];return I}function v(P,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(P)))return;var H=[],I=!0,T=!1,K=void 0;try{for(var J=P[Symbol.iterator](),ie;!(I=(ie=J.next()).done)&&!(H.push(ie.value),j&&H.length===j);I=!0);}catch(pe){T=!0,K=pe}finally{try{!I&&J.return!=null&&J.return()}finally{if(T)throw K}}return H}function m(P){if(Array.isArray(P))return P}function u(P,j){if(P==null)return{};var H=r(P,j),I,T;if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(P);for(T=0;T<K.length;T++){if(I=K[T],j.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(P,I))continue;H[I]=P[I]}}return H}function r(P,j){if(P==null)return{};var H={},I=Object.keys(P),T,K;for(K=0;K<I.length;K++){if(T=I[K],j.indexOf(T)>=0)continue;H[T]=P[T]}return H}var c=function(j){var H=j.className,I=j.percent,T=j.prefixCls,K=j.strokeColor,J=j.strokeLinecap,ie=j.strokeWidth,pe=j.style,_e=j.trailColor,Te=j.trailWidth,he=j.transition,re=u(j,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete re.gapPosition;var fe=Array.isArray(I)?I:[I],ae=Array.isArray(K)?K:[K],oe=D(fe),Z=B(oe,1),ne=Z[0],se=ie/2,me=100-ie/2,Se="M ".concat(J==="round"?se:0,",").concat(se,`
|
|
L `).concat(J==="round"?me:100,",").concat(se),Ee="0 0 100 ".concat(ie),Le=0;return Y.a.createElement("svg",G({className:Q()("".concat(T,"-line"),H),viewBox:Ee,preserveAspectRatio:"none",style:pe},re),Y.a.createElement("path",{className:"".concat(T,"-line-trail"),d:Se,strokeLinecap:J,stroke:_e,strokeWidth:Te||ie,fillOpacity:"0"}),fe.map(function(Pe,Be){var He={strokeDasharray:"".concat(Pe,"px, 100px"),strokeDashoffset:"-".concat(Le,"px"),transition:he||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Ge=ae[Be]||ae[ae.length-1];return Le+=Pe,Y.a.createElement("path",{key:Be,className:"".concat(T,"-line-path"),d:Se,strokeLinecap:J,stroke:Ge,strokeWidth:ie,fillOpacity:"0",ref:ne[Be],style:He})}))};c.defaultProps=F;var s=c;function a(){return a=Object.assign||function(P){for(var j=1;j<arguments.length;j++){var H=arguments[j];for(var I in H)Object.prototype.hasOwnProperty.call(H,I)&&(P[I]=H[I])}return P},a.apply(this,arguments)}function o(P,j){return A(P)||x(P,j)||O(P,j)||h()}function h(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function O(P,j){if(!P)return;if(typeof P=="string")return w(P,j);var H=Object.prototype.toString.call(P).slice(8,-1);if(H==="Object"&&P.constructor&&(H=P.constructor.name),H==="Map"||H==="Set")return Array.from(P);if(H==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(H))return w(P,j)}function w(P,j){(j==null||j>P.length)&&(j=P.length);for(var H=0,I=new Array(j);H<j;H++)I[H]=P[H];return I}function x(P,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(P)))return;var H=[],I=!0,T=!1,K=void 0;try{for(var J=P[Symbol.iterator](),ie;!(I=(ie=J.next()).done)&&!(H.push(ie.value),j&&H.length===j);I=!0);}catch(pe){T=!0,K=pe}finally{try{!I&&J.return!=null&&J.return()}finally{if(T)throw K}}return H}function A(P){if(Array.isArray(P))return P}function S(P,j){if(P==null)return{};var H=y(P,j),I,T;if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(P);for(T=0;T<K.length;T++){if(I=K[T],j.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(P,I))continue;H[I]=P[I]}}return H}function y(P,j){if(P==null)return{};var H={},I=Object.keys(P),T,K;for(K=0;K<I.length;K++){if(T=I[K],j.indexOf(T)>=0)continue;H[T]=P[T]}return H}var _=0;function p(P){return+P.replace("%","")}function d(P){return Array.isArray(P)?P:[P]}function g(P,j,H,I){var T=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,K=arguments.length>5?arguments[5]:void 0,J=50-I/2,ie=0,pe=-J,_e=0,Te=-2*J;switch(K){case"left":ie=-J,pe=0,_e=2*J,Te=0;break;case"right":ie=J,pe=0,_e=-2*J,Te=0;break;case"bottom":pe=J,Te=2*J;break;default:}var he="M 50,50 m ".concat(ie,",").concat(pe,`
|
|
a `).concat(J,",").concat(J," 0 1 1 ").concat(_e,",").concat(-Te,`
|
|
a `).concat(J,",").concat(J," 0 1 1 ").concat(-_e,",").concat(Te),re=Math.PI*2*J,fe={stroke:H,strokeDasharray:"".concat(j/100*(re-T),"px ").concat(re,"px"),strokeDashoffset:"-".concat(T/2+P/100*(re-T),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:he,pathStyle:fe}}var l=function(j){var H=j.prefixCls,I=j.strokeWidth,T=j.trailWidth,K=j.gapDegree,J=j.gapPosition,ie=j.trailColor,pe=j.strokeLinecap,_e=j.style,Te=j.className,he=j.strokeColor,re=j.percent,fe=S(j,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ae=Object(ce.useMemo)(function(){return _+=1,_},[]),oe=g(0,100,ie,I,K,J),Z=oe.pathString,ne=oe.pathStyle,se=d(re),me=d(he),Se=me.find(function(He){return Object.prototype.toString.call(He)==="[object Object]"}),Ee=D(se),Le=o(Ee,1),Pe=Le[0],Be=function(){var Ge=0;return se.map(function(Ue,tt){var nt=me[tt]||me[me.length-1],ot=Object.prototype.toString.call(nt)==="[object Object]"?"url(#".concat(H,"-gradient-").concat(ae,")"):"",st=g(Ge,Ue,nt,I,K,J);return Ge+=Ue,Y.a.createElement("path",{key:tt,className:"".concat(H,"-circle-path"),d:st.pathString,stroke:ot,strokeLinecap:pe,strokeWidth:I,opacity:Ue===0?0:1,fillOpacity:"0",style:st.pathStyle,ref:Pe[tt]})})};return Y.a.createElement("svg",a({className:Q()("".concat(H,"-circle"),Te),viewBox:"0 0 100 100",style:_e},fe),Se&&Y.a.createElement("defs",null,Y.a.createElement("linearGradient",{id:"".concat(H,"-gradient-").concat(ae),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Se).sort(function(He,Ge){return p(He)-p(Ge)}).map(function(He,Ge){return Y.a.createElement("stop",{key:Ge,offset:He,stopColor:Se[He]})}))),Y.a.createElement("path",{className:"".concat(H,"-circle-trail"),d:Z,stroke:ie,strokeLinecap:pe,strokeWidth:T||I,fillOpacity:"0",style:ne}),Be().reverse())};l.defaultProps=F;var E=l,U={Line:s,Circle:E}},hW8S:function(ut,Ke,$){"use strict";$.d(Ke,"a",function(){return Q}),$.d(Ke,"c",function(){return F}),$.d(Ke,"b",function(){return D});var ce=$("VTBJ"),Y=$("Ff2n"),N=$("Kwbf"),Q="RC_TABLE_INTERNAL_COL_DEFINE";function F(G){var B=G.expandable,k=Object(Y.a)(G,["expandable"]);return"expandable"in G?Object(ce.a)(Object(ce.a)({},k),B):k}function D(G){return Object.keys(G).reduce(function(B,k){return(k.substr(0,5)==="data-"||k.substr(0,5)==="aria-")&&(B[k]=G[k]),B},{})}},i58Z:function(ut,Ke,$){ut.exports={wrap:"wrap___Yg2Z9",addKnowledge:"addKnowledge___2FlI0",disabled:"disabled___1_wxN"}},kSUc:function(ut,Ke,$){},kqOp:function(ut,Ke,$){"use strict";$.d(Ke,"a",function(){return R});var ce=$("0Owb"),Y=$("fWQN"),N=$("mtLc"),Q=$("yKVA"),F=$("879j"),D=$("q1tI"),G=$.n(D),B=$("Ot1p"),k="\u2581",R=function(b){Object(Q.a)(m,b);var v=Object(F.a)(m);function m(){var u;Object(Y.a)(this,m);for(var r=arguments.length,c=new Array(r),s=0;s<r;s++)c[s]=arguments[s];return u=v.call.apply(v,[this].concat(c)),u.getChCountBeforeCursor=function(a,o){for(var h=o.line,O=0,w=0;w<h;w++)O+=a.getLine(w).split(k).length-1;var x=a.getLine(h).substring(0,o.ch);return O+=x.split(k).length-1,O},u.onCMBeforeChange=function(a,o){var h=a.getRange(o.from,o.to),O=0;if(o.text.forEach(function(S){O+=S.split(k).length-1}),h&&h.indexOf(k)!=-1){var w=h.split(k).length-1,x=u.getChCountBeforeCursor(a,o.from);console.log("\u5220\u9664".concat(w,"\u4E2A\uFF0C \u4E4B\u524D\u6709").concat(x,"\u4E2A\uFF0C\u65B0\u589E").concat(O,"\u4E2A")),u.props.deleteEmptyDisabled?o.cancel():u.props.onPlaceholderChange&&u.props.onPlaceholderChange(x,w,O)}else if(O){var A=u.getChCountBeforeCursor(a,o.from);console.log("\u65B0\u589E".concat(O,"\u4E2A\uFF0C\u4E4B\u524D\u6709").concat(A,"\u4E2A")),u.props.onPlaceholderChange&&u.props.onPlaceholderChange(A,0,O)}},u}return Object(N.a)(m,[{key:"render",value:function(){return G.a.createElement(B.a,Object(ce.a)({},this.props,{onCMBeforeChange:this.onCMBeforeChange}))}}]),m}(D.Component)},lZu9:function(ut,Ke,$){(function(ce){ce($("VrN/"),$("1eCo"),$("8EBN"))})(function(ce){"use strict";ce.defineMode("markdown",function(Y,N){var Q=ce.getMode(Y,"text/html"),F=Q.name=="null";function D(I){if(ce.findModeByName){var T=ce.findModeByName(I);T&&(I=T.mime||T.mimes[0])}var K=ce.getMode(Y,I);return K.name=="null"?null:K}N.highlightFormatting===void 0&&(N.highlightFormatting=!1),N.maxBlockquoteDepth===void 0&&(N.maxBlockquoteDepth=0),N.taskLists===void 0&&(N.taskLists=!1),N.strikethrough===void 0&&(N.strikethrough=!1),N.emoji===void 0&&(N.emoji=!1),N.fencedCodeBlockHighlighting===void 0&&(N.fencedCodeBlockHighlighting=!0),N.fencedCodeBlockDefaultMode===void 0&&(N.fencedCodeBlockDefaultMode="text/plain"),N.xml===void 0&&(N.xml=!0),N.tokenTypeOverrides===void 0&&(N.tokenTypeOverrides={});var G={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 G)G.hasOwnProperty(B)&&N.tokenTypeOverrides[B]&&(G[B]=N.tokenTypeOverrides[B]);var k=/^([*\-_])(?:\s*\1){2,}\s*$/,R=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,b=/^\[(x| )\](?=\s)/i,v=N.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,m=/^ {0,3}(?:\={1,}|-{2,})\s*$/,u=/^[^#!\[\]*_\\<>` "'(~:]+/,r=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,c=/^\s*\[[^\]]+?\]:.*$/,s=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,a=" ";function o(I,T,K){return T.f=T.inline=K,K(I,T)}function h(I,T,K){return T.f=T.block=K,K(I,T)}function O(I){return!I||!/\S/.test(I.string)}function w(I){if(I.linkTitle=!1,I.linkHref=!1,I.linkText=!1,I.em=!1,I.strong=!1,I.strikethrough=!1,I.quote=0,I.indentedCode=!1,I.f==A){var T=F;if(!T){var K=ce.innerMode(Q,I.htmlState);T=K.mode.name=="xml"&&K.state.tagStart===null&&!K.state.context&&K.state.tokenize.isInText}T&&(I.f=p,I.block=x,I.htmlState=null)}return I.trailingSpace=0,I.trailingSpaceNewLine=!1,I.prevLine=I.thisLine,I.thisLine={stream:null},null}function x(I,T){var K=I.column()===T.indentation,J=O(T.prevLine.stream),ie=T.indentedCode,pe=T.prevLine.hr,_e=T.list!==!1,Te=(T.listStack[T.listStack.length-1]||0)+3;T.indentedCode=!1;var he=T.indentation;if(T.indentationDiff===null&&(T.indentationDiff=T.indentation,_e)){for(T.list=null;he<T.listStack[T.listStack.length-1];)T.listStack.pop(),T.listStack.length?T.indentation=T.listStack[T.listStack.length-1]:T.list=!1;T.list!==!1&&(T.indentationDiff=he-T.listStack[T.listStack.length-1])}var re=!J&&!pe&&!T.prevLine.header&&(!_e||!ie)&&!T.prevLine.fencedCodeEnd,fe=(T.list===!1||pe||J)&&T.indentation<=Te&&I.match(k),ae=null;if(T.indentationDiff>=4&&(ie||T.prevLine.fencedCodeEnd||T.prevLine.header||J))return I.skipToEnd(),T.indentedCode=!0,G.code;if(I.eatSpace())return null;if(K&&T.indentation<=Te&&(ae=I.match(v))&&ae[1].length<=6)return T.quote=0,T.header=ae[1].length,T.thisLine.header=!0,N.highlightFormatting&&(T.formatting="header"),T.f=T.inline,y(T);if(T.indentation<=Te&&I.eat(">"))return T.quote=K?1:T.quote+1,N.highlightFormatting&&(T.formatting="quote"),I.eatSpace(),y(T);if(!fe&&!T.setext&&K&&T.indentation<=Te&&(ae=I.match(R))){var oe=ae[1]?"ol":"ul";return T.indentation=he+I.current().length,T.list=!0,T.quote=0,T.listStack.push(T.indentation),T.em=!1,T.strong=!1,T.code=!1,T.strikethrough=!1,N.taskLists&&I.match(b,!1)&&(T.taskList=!0),T.f=T.inline,N.highlightFormatting&&(T.formatting=["list","list-"+oe]),y(T)}else{if(K&&T.indentation<=Te&&(ae=I.match(r,!0)))return T.quote=0,T.fencedEndRE=new RegExp(ae[1]+"+ *$"),T.localMode=N.fencedCodeBlockHighlighting&&D(ae[2]||N.fencedCodeBlockDefaultMode),T.localMode&&(T.localState=ce.startState(T.localMode)),T.f=T.block=S,N.highlightFormatting&&(T.formatting="code-block"),T.code=-1,y(T);if(T.setext||(!re||!_e)&&!T.quote&&T.list===!1&&!T.code&&!fe&&!c.test(I.string)&&(ae=I.lookAhead(1))&&(ae=ae.match(m)))return T.setext?(T.header=T.setext,T.setext=0,I.skipToEnd(),N.highlightFormatting&&(T.formatting="header")):(T.header=ae[0].charAt(0)=="="?1:2,T.setext=T.header),T.thisLine.header=!0,T.f=T.inline,y(T);if(fe)return I.skipToEnd(),T.hr=!0,T.thisLine.hr=!0,G.hr;if(I.peek()==="[")return o(I,T,U)}return o(I,T,T.inline)}function A(I,T){var K=Q.token(I,T.htmlState);if(!F){var J=ce.innerMode(Q,T.htmlState);(J.mode.name=="xml"&&J.state.tagStart===null&&!J.state.context&&J.state.tokenize.isInText||T.md_inside&&I.current().indexOf(">")>-1)&&(T.f=p,T.block=x,T.htmlState=null)}return K}function S(I,T){var K=T.listStack[T.listStack.length-1]||0,J=T.indentation<K,ie=K+3;if(T.fencedEndRE&&T.indentation<=ie&&(J||I.match(T.fencedEndRE))){N.highlightFormatting&&(T.formatting="code-block");var pe;return J||(pe=y(T)),T.localMode=T.localState=null,T.block=x,T.f=p,T.fencedEndRE=null,T.code=0,T.thisLine.fencedCodeEnd=!0,J?h(I,T,T.block):pe}else return T.localMode?T.localMode.token(I,T.localState):(I.skipToEnd(),G.code)}function y(I){var T=[];if(I.formatting){T.push(G.formatting),typeof I.formatting=="string"&&(I.formatting=[I.formatting]);for(var K=0;K<I.formatting.length;K++)T.push(G.formatting+"-"+I.formatting[K]),I.formatting[K]==="header"&&T.push(G.formatting+"-"+I.formatting[K]+"-"+I.header),I.formatting[K]==="quote"&&(!N.maxBlockquoteDepth||N.maxBlockquoteDepth>=I.quote?T.push(G.formatting+"-"+I.formatting[K]+"-"+I.quote):T.push("error"))}if(I.taskOpen)return T.push("meta"),T.length?T.join(" "):null;if(I.taskClosed)return T.push("property"),T.length?T.join(" "):null;if(I.linkHref?T.push(G.linkHref,"url"):(I.strong&&T.push(G.strong),I.em&&T.push(G.em),I.strikethrough&&T.push(G.strikethrough),I.emoji&&T.push(G.emoji),I.linkText&&T.push(G.linkText),I.code&&T.push(G.code),I.image&&T.push(G.image),I.imageAltText&&T.push(G.imageAltText,"link"),I.imageMarker&&T.push(G.imageMarker)),I.header&&T.push(G.header,G.header+"-"+I.header),I.quote&&(T.push(G.quote),!N.maxBlockquoteDepth||N.maxBlockquoteDepth>=I.quote?T.push(G.quote+"-"+I.quote):T.push(G.quote+"-"+N.maxBlockquoteDepth)),I.list!==!1){var J=(I.listStack.length-1)%3;J?J===1?T.push(G.list2):T.push(G.list3):T.push(G.list1)}return I.trailingSpaceNewLine?T.push("trailing-space-new-line"):I.trailingSpace&&T.push("trailing-space-"+(I.trailingSpace%2?"a":"b")),T.length?T.join(" "):null}function _(I,T){return I.match(u,!0)?y(T):void 0}function p(I,T){var K=T.text(I,T);if(typeof K!="undefined")return K;if(T.list)return T.list=null,y(T);if(T.taskList){var J=I.match(b,!0)[1]===" ";return J?T.taskOpen=!0:T.taskClosed=!0,N.highlightFormatting&&(T.formatting="task"),T.taskList=!1,y(T)}if(T.taskOpen=!1,T.taskClosed=!1,T.header&&I.match(/^#+$/,!0))return N.highlightFormatting&&(T.formatting="header"),y(T);var ie=I.next();if(T.linkTitle){T.linkTitle=!1;var pe=ie;ie==="("&&(pe=")"),pe=(pe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var _e="^\\s*(?:[^"+pe+"\\\\]+|\\\\\\\\|\\\\.)"+pe;if(I.match(new RegExp(_e),!0))return G.linkHref}if(ie==="`"){var Te=T.formatting;N.highlightFormatting&&(T.formatting="code"),I.eatWhile("`");var he=I.current().length;if(T.code==0&&(!T.quote||he==1))return T.code=he,y(T);if(he==T.code){var re=y(T);return T.code=0,re}else return T.formatting=Te,y(T)}else if(T.code)return y(T);if(ie==="\\"&&(I.next(),N.highlightFormatting)){var fe=y(T),ae=G.formatting+"-escape";return fe?fe+" "+ae:ae}if(ie==="!"&&I.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return T.imageMarker=!0,T.image=!0,N.highlightFormatting&&(T.formatting="image"),y(T);if(ie==="["&&T.imageMarker&&I.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return T.imageMarker=!1,T.imageAltText=!0,N.highlightFormatting&&(T.formatting="image"),y(T);if(ie==="]"&&T.imageAltText){N.highlightFormatting&&(T.formatting="image");var fe=y(T);return T.imageAltText=!1,T.image=!1,T.inline=T.f=g,fe}if(ie==="["&&!T.image)return T.linkText&&I.match(/^.*?\]/)||(T.linkText=!0,N.highlightFormatting&&(T.formatting="link")),y(T);if(ie==="]"&&T.linkText){N.highlightFormatting&&(T.formatting="link");var fe=y(T);return T.linkText=!1,T.inline=T.f=I.match(/\(.*?\)| ?\[.*?\]/,!1)?g:p,fe}if(ie==="<"&&I.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){T.f=T.inline=d,N.highlightFormatting&&(T.formatting="link");var fe=y(T);return fe?fe+=" ":fe="",fe+G.linkInline}if(ie==="<"&&I.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){T.f=T.inline=d,N.highlightFormatting&&(T.formatting="link");var fe=y(T);return fe?fe+=" ":fe="",fe+G.linkEmail}if(N.xml&&ie==="<"&&I.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var oe=I.string.indexOf(">",I.pos);if(oe!=-1){var Z=I.string.substring(I.start,oe);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Z)&&(T.md_inside=!0)}return I.backUp(1),T.htmlState=ce.startState(Q),h(I,T,A)}if(N.xml&&ie==="<"&&I.match(/^\/\w*?>/))return T.md_inside=!1,"tag";if(ie==="*"||ie==="_"){for(var ne=1,se=I.pos==1?" ":I.string.charAt(I.pos-2);ne<3&&I.eat(ie);)ne++;var me=I.peek()||" ",Se=!/\s/.test(me)&&(!s.test(me)||/\s/.test(se)||s.test(se)),Ee=!/\s/.test(se)&&(!s.test(se)||/\s/.test(me)||s.test(me)),Le=null,Pe=null;if(ne%2&&(!T.em&&Se&&(ie==="*"||!Ee||s.test(se))?Le=!0:T.em==ie&&Ee&&(ie==="*"||!Se||s.test(me))&&(Le=!1)),ne>1&&(!T.strong&&Se&&(ie==="*"||!Ee||s.test(se))?Pe=!0:T.strong==ie&&Ee&&(ie==="*"||!Se||s.test(me))&&(Pe=!1)),Pe!=null||Le!=null){N.highlightFormatting&&(T.formatting=Le==null?"strong":Pe==null?"em":"strong em"),Le===!0&&(T.em=ie),Pe===!0&&(T.strong=ie);var re=y(T);return Le===!1&&(T.em=!1),Pe===!1&&(T.strong=!1),re}}else if(ie===" "&&(I.eat("*")||I.eat("_"))){if(I.peek()===" ")return y(T);I.backUp(1)}if(N.strikethrough){if(ie==="~"&&I.eatWhile(ie)){if(T.strikethrough){N.highlightFormatting&&(T.formatting="strikethrough");var re=y(T);return T.strikethrough=!1,re}else if(I.match(/^[^\s]/,!1))return T.strikethrough=!0,N.highlightFormatting&&(T.formatting="strikethrough"),y(T)}else if(ie===" "&&I.match(/^~~/,!0)){if(I.peek()===" ")return y(T);I.backUp(2)}}if(N.emoji&&ie===":"&&I.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){T.emoji=!0,N.highlightFormatting&&(T.formatting="emoji");var Be=y(T);return T.emoji=!1,Be}return ie===" "&&(I.match(/^ +$/,!1)?T.trailingSpace++:T.trailingSpace&&(T.trailingSpaceNewLine=!0)),y(T)}function d(I,T){var K=I.next();if(K===">"){T.f=T.inline=p,N.highlightFormatting&&(T.formatting="link");var J=y(T);return J?J+=" ":J="",J+G.linkInline}return I.match(/^[^>]+/,!0),G.linkInline}function g(I,T){if(I.eatSpace())return null;var K=I.next();return K==="("||K==="["?(T.f=T.inline=E(K==="("?")":"]"),N.highlightFormatting&&(T.formatting="link-string"),T.linkHref=!0,y(T)):"error"}var l={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function E(I){return function(T,K){var J=T.next();if(J===I){K.f=K.inline=p,N.highlightFormatting&&(K.formatting="link-string");var ie=y(K);return K.linkHref=!1,ie}return T.match(l[I]),K.linkHref=!0,y(K)}}function U(I,T){return I.match(/^([^\]\\]|\\.)*\]:/,!1)?(T.f=P,I.next(),N.highlightFormatting&&(T.formatting="link"),T.linkText=!0,y(T)):o(I,T,p)}function P(I,T){if(I.match(/^\]:/,!0)){T.f=T.inline=j,N.highlightFormatting&&(T.formatting="link");var K=y(T);return T.linkText=!1,K}return I.match(/^([^\]\\]|\\.)+/,!0),G.linkText}function j(I,T){return I.eatSpace()?null:(I.match(/^[^\s]+/,!0),I.peek()===void 0?T.linkTitle=!0:I.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),T.f=T.inline=p,G.linkHref+" url")}var H={startState:function(){return{f:x,prevLine:{stream:null},thisLine:{stream:null},block:x,htmlState:null,indentation:0,inline:p,text:_,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(I){return{f:I.f,prevLine:I.prevLine,thisLine:I.thisLine,block:I.block,htmlState:I.htmlState&&ce.copyState(Q,I.htmlState),indentation:I.indentation,localMode:I.localMode,localState:I.localMode?ce.copyState(I.localMode,I.localState):null,inline:I.inline,text:I.text,formatting:!1,linkText:I.linkText,linkTitle:I.linkTitle,linkHref:I.linkHref,code:I.code,em:I.em,strong:I.strong,strikethrough:I.strikethrough,emoji:I.emoji,header:I.header,setext:I.setext,hr:I.hr,taskList:I.taskList,list:I.list,listStack:I.listStack.slice(0),quote:I.quote,indentedCode:I.indentedCode,trailingSpace:I.trailingSpace,trailingSpaceNewLine:I.trailingSpaceNewLine,md_inside:I.md_inside,fencedEndRE:I.fencedEndRE}},token:function(I,T){if(T.formatting=!1,I!=T.thisLine.stream){if(T.header=0,T.hr=!1,I.match(/^\s*$/,!0))return w(T),null;if(T.prevLine=T.thisLine,T.thisLine={stream:I},T.taskList=!1,T.trailingSpace=0,T.trailingSpaceNewLine=!1,!T.localState&&(T.f=T.block,T.f!=A)){var K=I.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(T.indentation=K,T.indentationDiff=null,K>0)return null}}return T.f(I,T)},innerMode:function(I){return I.block==A?{state:I.htmlState,mode:Q}:I.localState?{state:I.localState,mode:I.localMode}:{state:I,mode:H}},indent:function(I,T,K){return I.block==A&&Q.indent?Q.indent(I.htmlState,T,K):I.localState&&I.localMode.indent?I.localMode.indent(I.localState,T,K):ce.Pass},blankLine:w,getType:y,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return H},"xml"),ce.defineMIME("text/markdown","markdown"),ce.defineMIME("text/x-markdown","markdown")})},n6Qo:function(ut,Ke,$){"use strict";$.d(Ke,"a",function(){return B});var ce=$("q1tI"),Y=$("biw7"),N=$("fyJ8");function Q(k){var R=k.className,b=k.index,v=k.children,m=k.colSpan,u=k.rowSpan,r=ce.useContext(Y.a),c=r.prefixCls,s=r.fixedInfoList,a=s[b];return ce.createElement(N.a,Object.assign({className:R,index:b,component:"td",prefixCls:c,record:null,dataIndex:null,render:function(){return{children:v,props:{colSpan:m,rowSpan:u}}}},a))}function F(k){return ce.createElement("tr",Object.assign({},k))}function D(k){var R=k.children,b=ce.useContext(Y.a),v=b.prefixCls;return ce.createElement("tfoot",{className:"".concat(v,"-summary")},R)}var G=Ke.b=D,B={Cell:Q,Row:F}},osHv:function(ut,Ke,$){(function(ce){ce($("VrN/"))})(function(ce){"use strict";var Y=ce.Pos;function N(s,a){return s.line-a.line||s.ch-a.ch}var Q="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",F=Q+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",D=new RegExp("<(/?)(["+Q+"]["+F+"]*)","g");function G(s,a,o,h){this.line=a,this.ch=o,this.cm=s,this.text=s.getLine(a),this.min=h?Math.max(h.from,s.firstLine()):s.firstLine(),this.max=h?Math.min(h.to-1,s.lastLine()):s.lastLine()}function B(s,a){var o=s.cm.getTokenTypeAt(Y(s.line,a));return o&&/\btag\b/.test(o)}function k(s){return s.line>=s.max?void 0:(s.ch=0,s.text=s.cm.getLine(++s.line),!0)}function R(s){return s.line<=s.min?void 0:(s.text=s.cm.getLine(--s.line),s.ch=s.text.length,!0)}function b(s){for(;;){var a=s.text.indexOf(">",s.ch);if(a==-1){if(k(s))continue;return}if(!B(s,a+1)){s.ch=a+1;continue}var o=s.text.lastIndexOf("/",a),h=o>-1&&!/\S/.test(s.text.slice(o+1,a));return s.ch=a+1,h?"selfClose":"regular"}}function v(s){for(;;){var a=s.ch?s.text.lastIndexOf("<",s.ch-1):-1;if(a==-1){if(R(s))continue;return}if(!B(s,a+1)){s.ch=a;continue}D.lastIndex=a,s.ch=a;var o=D.exec(s.text);if(o&&o.index==a)return o}}function m(s){for(;;){D.lastIndex=s.ch;var a=D.exec(s.text);if(!a){if(k(s))continue;return}if(!B(s,a.index+1)){s.ch=a.index+1;continue}return s.ch=a.index+a[0].length,a}}function u(s){for(;;){var a=s.ch?s.text.lastIndexOf(">",s.ch-1):-1;if(a==-1){if(R(s))continue;return}if(!B(s,a+1)){s.ch=a;continue}var o=s.text.lastIndexOf("/",a),h=o>-1&&!/\S/.test(s.text.slice(o+1,a));return s.ch=a+1,h?"selfClose":"regular"}}function r(s,a){for(var o=[];;){var h=m(s),O,w=s.line,x=s.ch-(h?h[0].length:0);if(!h||!(O=b(s)))return;if(O=="selfClose")continue;if(h[1]){for(var A=o.length-1;A>=0;--A)if(o[A]==h[2]){o.length=A;break}if(A<0&&(!a||a==h[2]))return{tag:h[2],from:Y(w,x),to:Y(s.line,s.ch)}}else o.push(h[2])}}function c(s,a){for(var o=[];;){var h=u(s);if(!h)return;if(h=="selfClose"){v(s);continue}var O=s.line,w=s.ch,x=v(s);if(!x)return;if(x[1])o.push(x[2]);else{for(var A=o.length-1;A>=0;--A)if(o[A]==x[2]){o.length=A;break}if(A<0&&(!a||a==x[2]))return{tag:x[2],from:Y(s.line,s.ch),to:Y(O,w)}}}}ce.registerHelper("fold","xml",function(s,a){for(var o=new G(s,a.line,0);;){var h=m(o);if(!h||o.line!=a.line)return;var O=b(o);if(!O)return;if(!h[1]&&O!="selfClose"){var w=Y(o.line,o.ch),x=r(o,h[2]);return x&&N(x.from,w)>0?{from:w,to:x.from}:null}}}),ce.findMatchingTag=function(s,a,o){var h=new G(s,a.line,a.ch,o);if(h.text.indexOf(">")==-1&&h.text.indexOf("<")==-1)return;var O=b(h),w=O&&Y(h.line,h.ch),x=O&&v(h);if(!O||!x||N(h,a)>0)return;var A={from:Y(h.line,h.ch),to:w,tag:x[2]};return O=="selfClose"?{open:A,close:null,at:"open"}:x[1]?{open:c(h,x[2]),close:A,at:"close"}:(h=new G(s,w.line,w.ch,o),{open:A,close:r(h,x[2]),at:"open"})},ce.findEnclosingTag=function(s,a,o,h){for(var O=new G(s,a.line,a.ch,o);;){var w=c(O,h);if(!w)break;var x=new G(s,a.line,a.ch,o),A=r(x,w.tag);if(A)return{open:w,close:A}}},ce.scanForClosingTag=function(s,a,o,h){var O=new G(s,a.line,a.ch,h?{from:0,to:h}:null);return r(O,o)}})},p5ED:function(ut,Ke,$){"use strict";var ce=$("+L6B"),Y=$("2/Rp"),N=$("5Dmo"),Q=$("3S7+"),F=$("k1fw"),D=$("tJVT"),G=$("q1tI"),B=$.n(G),k=$("vHTk"),R=$.n(k),b=$("yEEn"),v=$("ZW9T"),m=$("1vsH");Ke.a=function(u){var r=u.name,c=u.data,s=u.theme,a=u.type,o=u.filename,h=u.monacoEditor,O=u.className,w=u.style,x=u.close,A=u.onClose,S=u.hasMask,y=Object(G.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),_=Object(D.a)(y,2),p=_[0],d=_[1],g=Object(G.useState)(""),l=Object(D.a)(g,2),E=l[0],U=l[1],P,j=1024*1024,H=10*j,I=Object(G.useRef)();a==="office"&&(P=Object(m.T)(c).filesize,P>H&&(a="other")),o&&(h.filename=o),Object(G.useEffect)(function(){var J,ie,pe=(J=document.cookie)===null||J===void 0||((ie=J.replace(/\s/g,""))===null||ie===void 0)?void 0:ie.split(";");pe==null||pe.map(function(_e){var Te=_e.split("=");Te[0]==="_educoder_session"&&U(Te[1])})},[]);var T=function(){if(c.startsWith("http")||c.startsWith("/")){K();return}Object(m.z)(o||"educoder",c,o)},K=function(){Object(m.x)(o||r,c)};return console.log("data:",c,"fileanme:",o," name:",r),B.a.createElement("div",{style:Object(F.a)({},w||{}),className:"".concat(S&&R.a.bgBlack," ").concat(a?R.a.wrp:"hide")},x&&B.a.createElement("div",{className:R.a.close,ref:I},B.a.createElement(Q.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return I.current}},B.a.createElement("span",{onClick:K},B.a.createElement("i",{className:"icon-quxiaozhiding"}))),B.a.createElement(Q.a,{title:"\u5173\u95ED",getPopupContainer:function(){return I.current}},B.a.createElement("span",{className:"",onClick:A},B.a.createElement("i",{className:"icon-guanbi1"})))),B.a.createElement("div",{className:"".concat(R.a[O]," ").concat(O," ").concat(R.a.monaco," ").concat(a==="txt"?"show":"hide")},a==="txt"&&B.a.createElement(v.b,h)),a==="audio"&&B.a.createElement("audio",{src:"".concat(c!=null&&c.startsWith("/")||(c==null?void 0:c.indexOf("https://"))>-1?c:"data:audio/mp3;base64,").concat(c),autoPlay:!0}),a==="video"&&B.a.createElement(B.a.Fragment,null,c!=null&&c.startsWith("/")?B.a.createElement("video",{controls:!0,src:"".concat(c),autoPlay:!0}):B.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(c),autoPlay:!0})),a==="html"&&B.a.createElement("iframe",{src:c+"&disposition=inline"}),a==="pdf"&&B.a.createElement("embed",{className:R.a.embed,src:c}),a==="image"&&B.a.createElement(B.a.Fragment,null,B.a.createElement("img",{src:"".concat(c!=null&&c.startsWith("/")||(c==null?void 0:c.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(c)})),a==="other"&&B.a.createElement("div",null,B.a.createElement(Y.a,{type:"primary",size:"large",onClick:T},B.a.createElement(b.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(a==="download"||a==="office")&&B.a.createElement(Y.a,{type:"primary",size:"large",onClick:T},B.a.createElement(b.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(ut,Ke,$){},psGv:function(ut,Ke,$){var ce,Y;(function(){var N;(function(){"use strict";var G=[,,function(b){function v(r){this.__parent=r,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}v.prototype.clone_empty=function(){var r=new v(this.__parent);return r.set_indent(this.__indent_count,this.__alignment_count),r},v.prototype.item=function(r){return r<0?this.__items[this.__items.length+r]:this.__items[r]},v.prototype.has_match=function(r){for(var c=this.__items.length-1;c>=0;c--)if(this.__items[c].match(r))return!0;return!1},v.prototype.set_indent=function(r,c){this.is_empty()&&(this.__indent_count=r||0,this.__alignment_count=c||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},v.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},v.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},v.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var r=this.__parent.current_line;return r.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),r.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),r.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,r.__items[0]===" "&&(r.__items.splice(0,1),r.__character_count-=1),!0}return!1},v.prototype.is_empty=function(){return this.__items.length===0},v.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},v.prototype.push=function(r){this.__items.push(r);var c=r.lastIndexOf(`
|
|
`);c!==-1?this.__character_count=r.length-c:this.__character_count+=r.length},v.prototype.pop=function(){var r=null;return this.is_empty()||(r=this.__items.pop(),this.__character_count-=r.length),r},v.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},v.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},v.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},v.prototype.toString=function(){var r="";return this.is_empty()?this.__parent.indent_empty_lines&&(r=this.__parent.get_indent_string(this.__indent_count)):(r=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),r+=this.__items.join("")),r};function m(r,c){this.__cache=[""],this.__indent_size=r.indent_size,this.__indent_string=r.indent_char,r.indent_with_tabs||(this.__indent_string=new Array(r.indent_size+1).join(r.indent_char)),c=c||"",r.indent_level>0&&(c=new Array(r.indent_level+1).join(this.__indent_string)),this.__base_string=c,this.__base_string_length=c.length}m.prototype.get_indent_size=function(r,c){var s=this.__base_string_length;return c=c||0,r<0&&(s=0),s+=r*this.__indent_size,s+=c,s},m.prototype.get_indent_string=function(r,c){var s=this.__base_string;return c=c||0,r<0&&(r=0,s=""),c+=r*this.__indent_size,this.__ensure_cache(c),s+=this.__cache[c],s},m.prototype.__ensure_cache=function(r){for(;r>=this.__cache.length;)this.__add_column()},m.prototype.__add_column=function(){var r=this.__cache.length,c=0,s="";this.__indent_size&&r>=this.__indent_size&&(c=Math.floor(r/this.__indent_size),r-=c*this.__indent_size,s=new Array(c+1).join(this.__indent_string)),r&&(s+=new Array(r+1).join(" ")),this.__cache.push(s)};function u(r,c){this.__indent_cache=new m(r,c),this.raw=!1,this._end_with_newline=r.end_with_newline,this.indent_size=r.indent_size,this.wrap_line_length=r.wrap_line_length,this.indent_empty_lines=r.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new v(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}u.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},u.prototype.get_line_number=function(){return this.__lines.length},u.prototype.get_indent_string=function(r,c){return this.__indent_cache.get_indent_string(r,c)},u.prototype.get_indent_size=function(r,c){return this.__indent_cache.get_indent_size(r,c)},u.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},u.prototype.add_new_line=function(r){return this.is_empty()||!r&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},u.prototype.get_code=function(r){this.trim(!0);var c=this.current_line.pop();c&&(c[c.length-1]===`
|
|
`&&(c=c.replace(/\n+$/g,"")),this.current_line.push(c)),this._end_with_newline&&this.__add_outputline();var s=this.__lines.join(`
|
|
`);return r!==`
|
|
`&&(s=s.replace(/[\n]/g,r)),s},u.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},u.prototype.set_indent=function(r,c){return r=r||0,c=c||0,this.next_line.set_indent(r,c),this.__lines.length>1?(this.current_line.set_indent(r,c),!0):(this.current_line.set_indent(),!1)},u.prototype.add_raw_token=function(r){for(var c=0;c<r.newlines;c++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(r.whitespace_before),this.current_line.push(r.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},u.prototype.add_token=function(r){this.__add_space_before_token(),this.current_line.push(r),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},u.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},u.prototype.remove_indent=function(r){for(var c=this.__lines.length;r<c;)this.__lines[r]._remove_indent(),r++;this.current_line._remove_wrap_indent()},u.prototype.trim=function(r){for(r=r===void 0?!1:r,this.current_line.trim();r&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},u.prototype.just_added_newline=function(){return this.current_line.is_empty()},u.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},u.prototype.ensure_empty_line_above=function(r,c){for(var s=this.__lines.length-2;s>=0;){var a=this.__lines[s];if(a.is_empty())break;if(a.item(0).indexOf(r)!==0&&a.item(-1)!==c){this.__lines.splice(s+1,0,new v(this)),this.previous_line=this.__lines[this.__lines.length-2];break}s--}},b.exports.Output=u},function(b){function v(m,u,r,c){this.type=m,this.text=u,this.comments_before=null,this.newlines=r||0,this.whitespace_before=c||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}b.exports.Token=v},,,function(b){function v(r,c){this.raw_options=m(r,c),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}v.prototype._get_array=function(r,c){var s=this.raw_options[r],a=c||[];return typeof s=="object"?s!==null&&typeof s.concat=="function"&&(a=s.concat()):typeof s=="string"&&(a=s.split(/[^a-zA-Z0-9_\/\-]+/)),a},v.prototype._get_boolean=function(r,c){var s=this.raw_options[r],a=s===void 0?!!c:!!s;return a},v.prototype._get_characters=function(r,c){var s=this.raw_options[r],a=c||"";return typeof s=="string"&&(a=s.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),a},v.prototype._get_number=function(r,c){var s=this.raw_options[r];c=parseInt(c,10),isNaN(c)&&(c=0);var a=parseInt(s,10);return isNaN(a)&&(a=c),a},v.prototype._get_selection=function(r,c,s){var a=this._get_selection_list(r,c,s);if(a.length!==1)throw new Error("Invalid Option Value: The option '"+r+`' can only be one of the following values:
|
|
`+c+`
|
|
You passed in: '`+this.raw_options[r]+"'");return a[0]},v.prototype._get_selection_list=function(r,c,s){if(!c||c.length===0)throw new Error("Selection list cannot be empty.");if(s=s||[c[0]],!this._is_valid_selection(s,c))throw new Error("Invalid Default Value!");var a=this._get_array(r,s);if(!this._is_valid_selection(a,c))throw new Error("Invalid Option Value: The option '"+r+`' can contain only the following values:
|
|
`+c+`
|
|
You passed in: '`+this.raw_options[r]+"'");return a},v.prototype._is_valid_selection=function(r,c){return r.length&&c.length&&!r.some(function(s){return c.indexOf(s)===-1})};function m(r,c){var s={};r=u(r);var a;for(a in r)a!==c&&(s[a]=r[a]);if(c&&r[c])for(a in r[c])s[a]=r[c][a];return s}function u(r){var c={},s;for(s in r){var a=s.replace(/-/g,"_");c[a]=r[s]}return c}b.exports.Options=v,b.exports.normalizeOpts=u,b.exports.mergeOpts=m},,function(b){var v=RegExp.prototype.hasOwnProperty("sticky");function m(u){this.__input=u||"",this.__input_length=this.__input.length,this.__position=0}m.prototype.restart=function(){this.__position=0},m.prototype.back=function(){this.__position>0&&(this.__position-=1)},m.prototype.hasNext=function(){return this.__position<this.__input_length},m.prototype.next=function(){var u=null;return this.hasNext()&&(u=this.__input.charAt(this.__position),this.__position+=1),u},m.prototype.peek=function(u){var r=null;return u=u||0,u+=this.__position,u>=0&&u<this.__input_length&&(r=this.__input.charAt(u)),r},m.prototype.__match=function(u,r){u.lastIndex=r;var c=u.exec(this.__input);return c&&!(v&&u.sticky)&&(c.index!==r&&(c=null)),c},m.prototype.test=function(u,r){return r=r||0,r+=this.__position,r>=0&&r<this.__input_length?!!this.__match(u,r):!1},m.prototype.testChar=function(u,r){var c=this.peek(r);return u.lastIndex=0,c!==null&&u.test(c)},m.prototype.match=function(u){var r=this.__match(u,this.__position);return r?this.__position+=r[0].length:r=null,r},m.prototype.read=function(u,r,c){var s="",a;return u&&(a=this.match(u),a&&(s+=a[0])),r&&(a||!u)&&(s+=this.readUntil(r,c)),s},m.prototype.readUntil=function(u,r){var c="",s=this.__position;u.lastIndex=this.__position;var a=u.exec(this.__input);return a?(s=a.index,r&&(s+=a[0].length)):s=this.__input_length,c=this.__input.substring(this.__position,s),this.__position=s,c},m.prototype.readUntilAfter=function(u){return this.readUntil(u,!0)},m.prototype.get_regexp=function(u,r){var c=null,s="g";return r&&v&&(s="y"),typeof u=="string"&&u!==""?c=new RegExp(u,s):u&&(c=new RegExp(u.source,s)),c},m.prototype.get_literal_regexp=function(u){return RegExp(u.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},m.prototype.peekUntilAfter=function(u){var r=this.__position,c=this.readUntilAfter(u);return this.__position=r,c},m.prototype.lookBack=function(u){var r=this.__position-1;return r>=u.length&&this.__input.substring(r-u.length,r).toLowerCase()===u},b.exports.InputScanner=m},function(b,v,m){var u=m(8).InputScanner,r=m(3).Token,c=m(10).TokenStream,s=m(11).WhitespacePattern,a={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},o=function(h,O){this._input=new u(h),this._options=O||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new s(this._input)};o.prototype.tokenize=function(){this._input.restart(),this.__tokens=new c,this._reset();for(var h,O=new r(a.START,""),w=null,x=[],A=new c;O.type!==a.EOF;){for(h=this._get_next_token(O,w);this._is_comment(h);)A.add(h),h=this._get_next_token(O,w);A.isEmpty()||(h.comments_before=A,A=new c),h.parent=w,this._is_opening(h)?(x.push(w),w=h):w&&this._is_closing(h,w)&&(h.opened=w,w.closed=h,w=x.pop(),h.parent=w),h.previous=O,O.next=h,this.__tokens.add(h),O=h}return this.__tokens},o.prototype._is_first_token=function(){return this.__tokens.isEmpty()},o.prototype._reset=function(){},o.prototype._get_next_token=function(h,O){this._readWhitespace();var w=this._input.read(/.+/g);return w?this._create_token(a.RAW,w):this._create_token(a.EOF,"")},o.prototype._is_comment=function(h){return!1},o.prototype._is_opening=function(h){return!1},o.prototype._is_closing=function(h,O){return!1},o.prototype._create_token=function(h,O){var w=new r(h,O,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return w},o.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},b.exports.Tokenizer=o,b.exports.TOKEN=a},function(b){function v(m){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=m}v.prototype.restart=function(){this.__position=0},v.prototype.isEmpty=function(){return this.__tokens_length===0},v.prototype.hasNext=function(){return this.__position<this.__tokens_length},v.prototype.next=function(){var m=null;return this.hasNext()&&(m=this.__tokens[this.__position],this.__position+=1),m},v.prototype.peek=function(m){var u=null;return m=m||0,m+=this.__position,m>=0&&m<this.__tokens_length&&(u=this.__tokens[m]),u},v.prototype.add=function(m){this.__parent_token&&(m.parent=this.__parent_token),this.__tokens.push(m),this.__tokens_length+=1},b.exports.TokenStream=v},function(b,v,m){var u=m(12).Pattern;function r(c,s){u.call(this,c,s),s?this._line_regexp=this._input.get_regexp(s._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}r.prototype=new u,r.prototype.__set_whitespace_patterns=function(c,s){c+="\\t ",s+="\\n\\r",this._match_pattern=this._input.get_regexp("["+c+s+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+s+"]")},r.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var c=this._input.read(this._match_pattern);if(c===" ")this.whitespace_before_token=" ";else if(c){var s=this.__split(this._newline_regexp,c);this.newline_count=s.length-1,this.whitespace_before_token=s[this.newline_count]}return c},r.prototype.matching=function(c,s){var a=this._create();return a.__set_whitespace_patterns(c,s),a._update(),a},r.prototype._create=function(){return new r(this._input,this)},r.prototype.__split=function(c,s){c.lastIndex=0;for(var a=0,o=[],h=c.exec(s);h;)o.push(s.substring(a,h.index)),a=h.index+h[0].length,h=c.exec(s);return a<s.length?o.push(s.substring(a,s.length)):o.push(""),o},b.exports.WhitespacePattern=r},function(b){function v(m,u){this._input=m,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,u&&(this._starting_pattern=this._input.get_regexp(u._starting_pattern,!0),this._match_pattern=this._input.get_regexp(u._match_pattern,!0),this._until_pattern=this._input.get_regexp(u._until_pattern),this._until_after=u._until_after)}v.prototype.read=function(){var m=this._input.read(this._starting_pattern);return(!this._starting_pattern||m)&&(m+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),m},v.prototype.read_match=function(){return this._input.match(this._match_pattern)},v.prototype.until_after=function(m){var u=this._create();return u._until_after=!0,u._until_pattern=this._input.get_regexp(m),u._update(),u},v.prototype.until=function(m){var u=this._create();return u._until_after=!1,u._until_pattern=this._input.get_regexp(m),u._update(),u},v.prototype.starting_with=function(m){var u=this._create();return u._starting_pattern=this._input.get_regexp(m,!0),u._update(),u},v.prototype.matching=function(m){var u=this._create();return u._match_pattern=this._input.get_regexp(m,!0),u._update(),u},v.prototype._create=function(){return new v(this._input,this)},v.prototype._update=function(){},b.exports.Pattern=v},function(b){function v(m,u){m=typeof m=="string"?m:m.source,u=typeof u=="string"?u:u.source,this.__directives_block_pattern=new RegExp(m+/ beautify( \w+[:]\w+)+ /.source+u,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(m+/\sbeautify\signore:end\s/.source+u,"g")}v.prototype.get_directives=function(m){if(!m.match(this.__directives_block_pattern))return null;var u={};this.__directive_pattern.lastIndex=0;for(var r=this.__directive_pattern.exec(m);r;)u[r[1]]=r[2],r=this.__directive_pattern.exec(m);return u},v.prototype.readIgnored=function(m){return m.readUntilAfter(this.__directives_end_ignore_pattern)},b.exports.Directives=v},function(b,v,m){var u=m(12).Pattern,r={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function c(s,a){u.call(this,s,a),this.__template_pattern=null,this._disabled=Object.assign({},r),this._excluded=Object.assign({},r),a&&(this.__template_pattern=this._input.get_regexp(a.__template_pattern),this._excluded=Object.assign(this._excluded,a._excluded),this._disabled=Object.assign(this._disabled,a._disabled));var o=new u(s);this.__patterns={handlebars_comment:o.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:o.starting_with(/{{{/).until_after(/}}}/),handlebars:o.starting_with(/{{/).until_after(/}}/),php:o.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:o.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:o.starting_with(/{%/).until_after(/%}/),django_value:o.starting_with(/{{/).until_after(/}}/),django_comment:o.starting_with(/{#/).until_after(/#}/),smarty:o.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:o.starting_with(/{\*/).until_after(/\*}/),smarty_literal:o.starting_with(/{literal}/).until_after(/{\/literal}/)}}c.prototype=new u,c.prototype._create=function(){return new c(this._input,this)},c.prototype._update=function(){this.__set_templated_pattern()},c.prototype.disable=function(s){var a=this._create();return a._disabled[s]=!0,a._update(),a},c.prototype.read_options=function(s){var a=this._create();for(var o in r)a._disabled[o]=s.templating.indexOf(o)===-1;return a._update(),a},c.prototype.exclude=function(s){var a=this._create();return a._excluded[s]=!0,a._update(),a},c.prototype.read=function(){var s="";this._match_pattern?s=this._input.read(this._starting_pattern):s=this._input.read(this._starting_pattern,this.__template_pattern);for(var a=this._read_template();a;)this._match_pattern?a+=this._input.read(this._match_pattern):a+=this._input.readUntil(this.__template_pattern),s+=a,a=this._read_template();return this._until_after&&(s+=this._input.readUntilAfter(this._until_pattern)),s},c.prototype.__set_templated_pattern=function(){var s=[];this._disabled.php||s.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||s.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||s.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(s.push(this.__patterns.django._starting_pattern.source),s.push(this.__patterns.django_value._starting_pattern.source),s.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||s.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&s.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+s.join("|")+")")},c.prototype._read_template=function(){var s="",a=this._input.peek();if(a==="<"){var o=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&o==="?"&&(s=s||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&o==="%"&&(s=s||this.__patterns.erb.read())}else a==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(s=s||this.__patterns.handlebars_comment.read(),s=s||this.__patterns.handlebars_unescaped.read(),s=s||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(s=s||this.__patterns.django_value.read()),this._excluded.django||(s=s||this.__patterns.django_comment.read(),s=s||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(s=s||this.__patterns.smarty_comment.read(),s=s||this.__patterns.smarty_literal.read(),s=s||this.__patterns.smarty.read()));return s},b.exports.TemplatablePattern=c},,,,function(b,v,m){var u=m(19).Beautifier,r=m(20).Options;function c(s,a,o,h){var O=new u(s,a,o,h);return O.beautify()}b.exports=c,b.exports.defaultOptions=function(){return new r}},function(b,v,m){var u=m(20).Options,r=m(2).Output,c=m(21).Tokenizer,s=m(21).TOKEN,a=/\r\n|[\r\n]/,o=/\r\n|[\r\n]/g,h=function(g,l){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=g.max_preserve_newlines,this.preserve_newlines=g.preserve_newlines,this._output=new r(g,l)};h.prototype.current_line_has_match=function(g){return this._output.current_line.has_match(g)},h.prototype.set_space_before_token=function(g,l){this._output.space_before_token=g,this._output.non_breaking_space=l},h.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},h.prototype.add_raw_token=function(g){this._output.add_raw_token(g)},h.prototype.print_preserved_newlines=function(g){var l=0;g.type!==s.TEXT&&g.previous.type!==s.TEXT&&(l=g.newlines?1:0),this.preserve_newlines&&(l=g.newlines<this.max_preserve_newlines+1?g.newlines:this.max_preserve_newlines+1);for(var E=0;E<l;E++)this.print_newline(E>0);return l!==0},h.prototype.traverse_whitespace=function(g){return g.whitespace_before||g.newlines?(this.print_preserved_newlines(g)||(this._output.space_before_token=!0),!0):!1},h.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},h.prototype.print_newline=function(g){this._output.add_new_line(g)},h.prototype.print_token=function(g){g.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(g.text))},h.prototype.indent=function(){this.indent_level++},h.prototype.get_full_indent=function(g){return g=this.indent_level+(g||0),g<1?"":this._output.get_indent_string(g)};var O=function(g){for(var l=null,E=g.next;E.type!==s.EOF&&g.closed!==E;){if(E.type===s.ATTRIBUTE&&E.text==="type"){E.next&&E.next.type===s.EQUALS&&E.next.next&&E.next.next.type===s.VALUE&&(l=E.next.next.text);break}E=E.next}return l},w=function(g,l){var E=null,U=null;return l.closed?(g==="script"?E="text/javascript":g==="style"&&(E="text/css"),E=O(l)||E,E.search("text/css")>-1?U="css":E.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?U="javascript":E.search(/(text|application|dojo)\/(x-)?(html)/)>-1?U="html":E.search(/test\/null/)>-1&&(U="null"),U):null};function x(g,l){return l.indexOf(g)!==-1}function A(g,l,E){this.parent=g||null,this.tag=l?l.tag_name:"",this.indent_level=E||0,this.parser_token=l||null}function S(g){this._printer=g,this._current_frame=null}S.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},S.prototype.record_tag=function(g){var l=new A(this._current_frame,g,this._printer.indent_level);this._current_frame=l},S.prototype._try_pop_frame=function(g){var l=null;return g&&(l=g.parser_token,this._printer.indent_level=g.indent_level,this._current_frame=g.parent),l},S.prototype._get_frame=function(g,l){for(var E=this._current_frame;E&&!(g.indexOf(E.tag)!==-1);){if(l&&l.indexOf(E.tag)!==-1){E=null;break}E=E.parent}return E},S.prototype.try_pop=function(g,l){var E=this._get_frame([g],l);return this._try_pop_frame(E)},S.prototype.indent_to_tag=function(g){var l=this._get_frame(g);l&&(this._printer.indent_level=l.indent_level)};function y(g,l,E,U){this._source_text=g||"",l=l||{},this._js_beautify=E,this._css_beautify=U,this._tag_stack=null;var P=new u(l,"html");this._options=P,this._is_wrap_attributes_force=this._options.wrap_attributes.substr(0,"force".length)==="force",this._is_wrap_attributes_force_expand_multiline=this._options.wrap_attributes==="force-expand-multiline",this._is_wrap_attributes_force_aligned=this._options.wrap_attributes==="force-aligned",this._is_wrap_attributes_aligned_multiple=this._options.wrap_attributes==="aligned-multiple",this._is_wrap_attributes_preserve=this._options.wrap_attributes.substr(0,"preserve".length)==="preserve",this._is_wrap_attributes_preserve_aligned=this._options.wrap_attributes==="preserve-aligned"}y.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var g=this._source_text,l=this._options.eol;this._options.eol==="auto"&&(l=`
|
|
`,g&&a.test(g)&&(l=g.match(a)[0])),g=g.replace(o,`
|
|
`);var E=g.match(/^[\t ]*/)[0],U={text:"",type:""},P=new _,j=new h(this._options,E),H=new c(g,this._options).tokenize();this._tag_stack=new S(j);for(var I=null,T=H.next();T.type!==s.EOF;)T.type===s.TAG_OPEN||T.type===s.COMMENT?(I=this._handle_tag_open(j,T,P,U),P=I):T.type===s.ATTRIBUTE||T.type===s.EQUALS||T.type===s.VALUE||T.type===s.TEXT&&!P.tag_complete?I=this._handle_inside_tag(j,T,P,H):T.type===s.TAG_CLOSE?I=this._handle_tag_close(j,T,P):T.type===s.TEXT?I=this._handle_text(j,T,P):j.add_raw_token(T),U=I,T=H.next();var K=j._output.get_code(l);return K},y.prototype._handle_tag_close=function(g,l,E){var U={text:l.text,type:l.type};return g.alignment_size=0,E.tag_complete=!0,g.set_space_before_token(l.newlines||l.whitespace_before!=="",!0),E.is_unformatted?g.add_raw_token(l):(E.tag_start_char==="<"&&(g.set_space_before_token(l.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&E.has_wrapped_attrs&&g.print_newline(!1)),g.print_token(l)),E.indent_content&&!(E.is_unformatted||E.is_content_unformatted)&&(g.indent(),E.indent_content=!1),!E.is_inline_element&&!(E.is_unformatted||E.is_content_unformatted)&&g.set_wrap_point(),U},y.prototype._handle_inside_tag=function(g,l,E,U){var P=E.has_wrapped_attrs,j={text:l.text,type:l.type};if(g.set_space_before_token(l.newlines||l.whitespace_before!=="",!0),E.is_unformatted)g.add_raw_token(l);else if(E.tag_start_char==="{"&&l.type===s.TEXT)g.print_preserved_newlines(l)?(l.newlines=0,g.add_raw_token(l)):g.print_token(l);else{if(l.type===s.ATTRIBUTE?(g.set_space_before_token(!0),E.attr_count+=1):(l.type===s.EQUALS||l.type===s.VALUE&&l.previous.type===s.EQUALS)&&g.set_space_before_token(!1),l.type===s.ATTRIBUTE&&E.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(g.traverse_whitespace(l),P=P||l.newlines!==0),this._is_wrap_attributes_force)){var H=E.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&E.attr_count===1){var I=!0,T=0,K;do{if(K=U.peek(T),K.type===s.ATTRIBUTE){I=!1;break}T+=1}while(T<4&&K.type!==s.EOF&&K.type!==s.TAG_CLOSE);H=!I}H&&(g.print_newline(!1),P=!0)}g.print_token(l),P=P||g.previous_token_wrapped(),E.has_wrapped_attrs=P}return j},y.prototype._handle_text=function(g,l,E){var U={text:l.text,type:"TK_CONTENT"};return E.custom_beautifier_name?this._print_custom_beatifier_text(g,l,E):E.is_unformatted||E.is_content_unformatted?g.add_raw_token(l):(g.traverse_whitespace(l),g.print_token(l)),U},y.prototype._print_custom_beatifier_text=function(g,l,E){var U=this;if(l.text!==""){var P=l.text,j,H=1,I="",T="";E.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?j=this._js_beautify:E.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?j=this._css_beautify:E.custom_beautifier_name==="html"&&(j=function(Te,he){var re=new y(Te,he,U._js_beautify,U._css_beautify);return re.beautify()}),this._options.indent_scripts==="keep"?H=0:this._options.indent_scripts==="separate"&&(H=-g.indent_level);var K=g.get_full_indent(H);if(P=P.replace(/\n[ \t]*$/,""),E.custom_beautifier_name!=="html"&&P[0]==="<"&&P.match(/^(<!--|<!\[CDATA\[)/)){var J=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(P);if(!J){g.add_raw_token(l);return}I=K+J[1]+`
|
|
`,P=J[4],J[5]&&(T=K+J[5]),P=P.replace(/\n[ \t]*$/,""),(J[2]||J[3].indexOf(`
|
|
`)!==-1)&&(J=J[3].match(/[ \t]+$/),J&&(l.whitespace_before=J[0]))}if(P)if(j){var ie=function(){this.eol=`
|
|
`};ie.prototype=this._options.raw_options;var pe=new ie;P=j(K+P,pe)}else{var _e=l.whitespace_before;_e&&(P=P.replace(new RegExp(`
|
|
(`+_e+")?","g"),`
|
|
`)),P=K+P.replace(/\n/g,`
|
|
`+K)}I&&(P?P=I+P+`
|
|
`+T:P=I+T),g.print_newline(!1),P&&(l.text=P,l.whitespace_before="",l.newlines=0,g.add_raw_token(l),g.print_newline(!0))}},y.prototype._handle_tag_open=function(g,l,E,U){var P=this._get_tag_open_token(l);return(E.is_unformatted||E.is_content_unformatted)&&!E.is_empty_element&&l.type===s.TAG_OPEN&&l.text.indexOf("</")===0?(g.add_raw_token(l),P.start_tag_token=this._tag_stack.try_pop(P.tag_name)):(g.traverse_whitespace(l),this._set_tag_position(g,l,P,E,U),P.is_inline_element||g.set_wrap_point(),g.print_token(l)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(P.alignment_size=l.text.length+1),!P.tag_complete&&!P.is_unformatted&&(g.alignment_size=P.alignment_size),P};var _=function(g,l){if(this.parent=g||null,this.text="",this.type="TK_TAG_OPEN",this.tag_name="",this.is_inline_element=!1,this.is_unformatted=!1,this.is_content_unformatted=!1,this.is_empty_element=!1,this.is_start_tag=!1,this.is_end_tag=!1,this.indent_content=!1,this.multiline_content=!1,this.custom_beautifier_name=null,this.start_tag_token=null,this.attr_count=0,this.has_wrapped_attrs=!1,this.alignment_size=0,this.tag_complete=!1,this.tag_start_char="",this.tag_check="",!l)this.tag_complete=!0;else{var E;this.tag_start_char=l.text[0],this.text=l.text,this.tag_start_char==="<"?(E=l.text.match(/^<([^\s>]*)/),this.tag_check=E?E[1]:""):(E=l.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=E?E[1]:"",(l.text.startsWith("{{#>")||l.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&l.next!==null?this.tag_check=l.next.text.split(" ")[0]:this.tag_check=l.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),l.type===s.COMMENT&&(this.tag_complete=!0),this.is_start_tag=this.tag_check.charAt(0)!=="/",this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||l.closed&&l.closed.text==="/>";var U=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(U=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(U)))}};y.prototype._get_tag_open_token=function(g){var l=new _(this._tag_stack.get_parser_token(),g);return l.alignment_size=this._options.wrap_attributes_indent_size,l.is_end_tag=l.is_end_tag||x(l.tag_check,this._options.void_elements),l.is_empty_element=l.tag_complete||l.is_start_tag&&l.is_end_tag,l.is_unformatted=!l.tag_complete&&x(l.tag_check,this._options.unformatted),l.is_content_unformatted=!l.is_empty_element&&x(l.tag_check,this._options.content_unformatted),l.is_inline_element=x(l.tag_name,this._options.inline)||l.tag_name.includes("-")||l.tag_start_char==="{",l},y.prototype._set_tag_position=function(g,l,E,U,P){if(E.is_empty_element||(E.is_end_tag?E.start_tag_token=this._tag_stack.try_pop(E.tag_name):(this._do_optional_end_element(E)&&(E.is_inline_element||g.print_newline(!1)),this._tag_stack.record_tag(E),(E.tag_name==="script"||E.tag_name==="style")&&!(E.is_unformatted||E.is_content_unformatted)&&(E.custom_beautifier_name=w(E.tag_check,l)))),x(E.tag_check,this._options.extra_liners)&&(g.print_newline(!1),g._output.just_added_blankline()||g.print_newline(!0)),E.is_empty_element){if(E.tag_start_char==="{"&&E.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),E.indent_content=!0;var j=g.current_line_has_match(/{{#if/);j||g.print_newline(!1)}E.tag_name==="!--"&&P.type===s.TAG_CLOSE&&U.is_end_tag&&E.text.indexOf(`
|
|
`)===-1||(E.is_inline_element||E.is_unformatted||g.print_newline(!1),this._calcluate_parent_multiline(g,E))}else if(E.is_end_tag){var H=!1;H=E.start_tag_token&&E.start_tag_token.multiline_content,H=H||!E.is_inline_element&&!(U.is_inline_element||U.is_unformatted)&&!(P.type===s.TAG_CLOSE&&E.start_tag_token===U)&&P.type!=="TK_CONTENT",(E.is_content_unformatted||E.is_unformatted)&&(H=!1),H&&g.print_newline(!1)}else E.indent_content=!E.custom_beautifier_name,E.tag_start_char==="<"&&(E.tag_name==="html"?E.indent_content=this._options.indent_inner_html:E.tag_name==="head"?E.indent_content=this._options.indent_head_inner_html:E.tag_name==="body"&&(E.indent_content=this._options.indent_body_inner_html)),!(E.is_inline_element||E.is_unformatted)&&(P.type!=="TK_CONTENT"||E.is_content_unformatted)&&g.print_newline(!1),this._calcluate_parent_multiline(g,E)},y.prototype._calcluate_parent_multiline=function(g,l){l.parent&&g._output.just_added_newline()&&!((l.is_inline_element||l.is_unformatted)&&l.parent.is_inline_element)&&(l.parent.multiline_content=!0)};var p=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","nav","ol","p","pre","section","table","ul"],d=["a","audio","del","ins","map","noscript","video"];y.prototype._do_optional_end_element=function(g){var l=null;if(g.is_empty_element||!g.is_start_tag||!g.parent)return;if(g.tag_name==="body")l=l||this._tag_stack.try_pop("head");else if(g.tag_name==="li")l=l||this._tag_stack.try_pop("li",["ol","ul"]);else if(g.tag_name==="dd"||g.tag_name==="dt")l=l||this._tag_stack.try_pop("dt",["dl"]),l=l||this._tag_stack.try_pop("dd",["dl"]);else if(g.parent.tag_name==="p"&&p.indexOf(g.tag_name)!==-1){var E=g.parent.parent;(!E||d.indexOf(E.tag_name)===-1)&&(l=l||this._tag_stack.try_pop("p"))}else g.tag_name==="rp"||g.tag_name==="rt"?(l=l||this._tag_stack.try_pop("rt",["ruby","rtc"]),l=l||this._tag_stack.try_pop("rp",["ruby","rtc"])):g.tag_name==="optgroup"?l=l||this._tag_stack.try_pop("optgroup",["select"]):g.tag_name==="option"?l=l||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):g.tag_name==="colgroup"?l=l||this._tag_stack.try_pop("caption",["table"]):g.tag_name==="thead"?(l=l||this._tag_stack.try_pop("caption",["table"]),l=l||this._tag_stack.try_pop("colgroup",["table"])):g.tag_name==="tbody"||g.tag_name==="tfoot"?(l=l||this._tag_stack.try_pop("caption",["table"]),l=l||this._tag_stack.try_pop("colgroup",["table"]),l=l||this._tag_stack.try_pop("thead",["table"]),l=l||this._tag_stack.try_pop("tbody",["table"])):g.tag_name==="tr"?(l=l||this._tag_stack.try_pop("caption",["table"]),l=l||this._tag_stack.try_pop("colgroup",["table"]),l=l||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(g.tag_name==="th"||g.tag_name==="td")&&(l=l||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),l=l||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return g.parent=this._tag_stack.get_parser_token(),l},b.exports.Beautifier=y},function(b,v,m){var u=m(6).Options;function r(c){u.call(this,c,"html"),this.templating.length===1&&this.templating[0]==="auto"&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}r.prototype=new u,b.exports.Options=r},function(b,v,m){var u=m(9).Tokenizer,r=m(9).TOKEN,c=m(13).Directives,s=m(14).TemplatablePattern,a=m(12).Pattern,o={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:r.START,RAW:r.RAW,EOF:r.EOF},h=new c(/<\!--/,/-->/),O=function(w,x){u.call(this,w,x),this._current_tag_name="";var A=new s(this._input).read_options(this._options),S=new a(this._input);if(this.__patterns={word:A.until(/[\n\r\t <]/),single_quote:A.until_after(/'/),double_quote:A.until_after(/"/),attribute:A.until(/[\n\r\t =>]|\/>/),element_name:A.until(/[\n\r\t >\/]/),handlebars_comment:S.starting_with(/{{!--/).until_after(/--}}/),handlebars:S.starting_with(/{{/).until_after(/}}/),handlebars_open:S.until(/[\n\r\t }]/),handlebars_raw_close:S.until(/}}/),comment:S.starting_with(/<!--/).until_after(/-->/),cdata:S.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:S.starting_with(/<!\[/).until_after(/]>/),processing:S.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter){var y=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=S.matching(y).until_after(y)}};O.prototype=new u,O.prototype._is_comment=function(w){return!1},O.prototype._is_opening=function(w){return w.type===o.TAG_OPEN},O.prototype._is_closing=function(w,x){return w.type===o.TAG_CLOSE&&x&&((w.text===">"||w.text==="/>")&&x.text[0]==="<"||w.text==="}}"&&x.text[0]==="{"&&x.text[1]==="{")},O.prototype._reset=function(){this._current_tag_name=""},O.prototype._get_next_token=function(w,x){var A=null;this._readWhitespace();var S=this._input.peek();return S===null?this._create_token(o.EOF,""):(A=A||this._read_open_handlebars(S,x),A=A||this._read_attribute(S,w,x),A=A||this._read_close(S,x),A=A||this._read_raw_content(S,w,x),A=A||this._read_content_word(S),A=A||this._read_comment_or_cdata(S),A=A||this._read_processing(S),A=A||this._read_open(S,x),A=A||this._create_token(o.UNKNOWN,this._input.next()),A)},O.prototype._read_comment_or_cdata=function(w){var x=null,A=null,S=null;if(w==="<"){var y=this._input.peek(1);y==="!"&&(A=this.__patterns.comment.read(),A?(S=h.get_directives(A),S&&S.ignore==="start"&&(A+=h.readIgnored(this._input))):A=this.__patterns.cdata.read()),A&&(x=this._create_token(o.COMMENT,A),x.directives=S)}return x},O.prototype._read_processing=function(w){var x=null,A=null,S=null;if(w==="<"){var y=this._input.peek(1);(y==="!"||y==="?")&&(A=this.__patterns.conditional_comment.read(),A=A||this.__patterns.processing.read()),A&&(x=this._create_token(o.COMMENT,A),x.directives=S)}return x},O.prototype._read_open=function(w,x){var A=null,S=null;return x||w==="<"&&(A=this._input.next(),this._input.peek()==="/"&&(A+=this._input.next()),A+=this.__patterns.element_name.read(),S=this._create_token(o.TAG_OPEN,A)),S},O.prototype._read_open_handlebars=function(w,x){var A=null,S=null;return x||this._options.indent_handlebars&&w==="{"&&this._input.peek(1)==="{"&&(this._input.peek(2)==="!"?(A=this.__patterns.handlebars_comment.read(),A=A||this.__patterns.handlebars.read(),S=this._create_token(o.COMMENT,A)):(A=this.__patterns.handlebars_open.read(),S=this._create_token(o.TAG_OPEN,A))),S},O.prototype._read_close=function(w,x){var A=null,S=null;return x&&(x.text[0]==="<"&&(w===">"||w==="/"&&this._input.peek(1)===">")?(A=this._input.next(),w==="/"&&(A+=this._input.next()),S=this._create_token(o.TAG_CLOSE,A)):x.text[0]==="{"&&w==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),S=this._create_token(o.TAG_CLOSE,"}}"))),S},O.prototype._read_attribute=function(w,x,A){var S=null,y="";if(A&&A.text[0]==="<")if(w==="=")S=this._create_token(o.EQUALS,this._input.next());else if(w==='"'||w==="'"){var _=this._input.next();w==='"'?_+=this.__patterns.double_quote.read():_+=this.__patterns.single_quote.read(),S=this._create_token(o.VALUE,_)}else y=this.__patterns.attribute.read(),y&&(x.type===o.EQUALS?S=this._create_token(o.VALUE,y):S=this._create_token(o.ATTRIBUTE,y));return S},O.prototype._is_content_unformatted=function(w){return this._options.void_elements.indexOf(w)===-1&&(this._options.content_unformatted.indexOf(w)!==-1||this._options.unformatted.indexOf(w)!==-1)},O.prototype._read_raw_content=function(w,x,A){var S="";if(A&&A.text[0]==="{")S=this.__patterns.handlebars_raw_close.read();else if(x.type===o.TAG_CLOSE&&x.opened.text[0]==="<"&&x.text[0]!=="/"){var y=x.opened.text.substr(1).toLowerCase();if(y==="script"||y==="style"){var _=this._read_comment_or_cdata(w);if(_)return _.type=o.TEXT,_;S=this._input.readUntil(new RegExp("</"+y+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(y)&&(S=this._input.readUntil(new RegExp("</"+y+"[\\n\\r\\t ]*?>","ig")))}return S?this._create_token(o.TEXT,S):null},O.prototype._read_content_word=function(w){var x="";if(this._options.unformatted_content_delimiter&&(w===this._options.unformatted_content_delimiter[0]&&(x=this.__patterns.unformatted_content_delimiter.read())),x||(x=this.__patterns.word.read()),x)return this._create_token(o.TEXT,x)},b.exports.Tokenizer=O,b.exports.TOKEN=o}],B={};function k(b){var v=B[b];if(v!==void 0)return v.exports;var m=B[b]={exports:{}};return G[b](m,m.exports,k),m.exports}var R=k(18);N=R})();var Q=N;if(!0)!(ce=[$,$("6UM0"),$("TXwP")],Y=function(G){var B=$("6UM0"),k=$("TXwP");return{html_beautify:function(R,b){return Q(R,b,B.js_beautify,k.css_beautify)}}}.apply(Ke,ce),Y!==void 0&&(ut.exports=Y));else var F,D})()},"rAM+":function(ut,Ke,$){"use strict";$.d(Ke,"a",function(){return Y});var ce=$("Qw5x");function Y(N,Q){var F;if(typeof Symbol=="undefined"||N[Symbol.iterator]==null){if(Array.isArray(N)||(F=Object(ce.a)(N))||Q&&N&&typeof N.length=="number"){F&&(N=F);var D=0,G=function(){};return{s:G,n:function(){return D>=N.length?{done:!0}:{done:!1,value:N[D++]}},e:function(v){throw v},f:G}}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,R;return{s:function(){F=N[Symbol.iterator]()},n:function(){var v=F.next();return B=v.done,v},e:function(v){k=!0,R=v},f:function(){try{!B&&F.return!=null&&F.return()}finally{if(k)throw R}}}}},rUJ1:function(ut,Ke){const $=/[&<>"']/,ce=/[&<>"']/g,Y=/[<>"']|&(?!#?\w+;)/,N=/[<>"']|&(?!#?\w+;)/g,Q={"&":"&","<":"<",">":">",'"':""","'":"'"},F=S=>Q[S];function D(S,y){if(y){if($.test(S))return S.replace(ce,F)}else if(Y.test(S))return S.replace(N,F);return S}const G=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function B(S){return S.replace(G,(y,_)=>(_=_.toLowerCase(),_==="colon"?":":_.charAt(0)==="#"?_.charAt(1)==="x"?String.fromCharCode(parseInt(_.substring(2),16)):String.fromCharCode(+_.substring(1)):""))}const k=/(^|[^\[])\^/g;function R(S,y){S=S.source||S,y=y||"";const _={replace:(p,d)=>(d=d.source||d,d=d.replace(k,"$1"),S=S.replace(p,d),_),getRegex:()=>new RegExp(S,y)};return _}const b=/[^\w:]/g,v=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function m(S,y,_){if(S){let p;try{p=decodeURIComponent(B(_)).replace(b,"").toLowerCase()}catch(d){return null}if(p.indexOf("javascript:")===0||p.indexOf("vbscript:")===0||p.indexOf("data:")===0)return null}y&&!v.test(_)&&(_=a(y,_));try{_=encodeURI(_).replace(/%25/g,"%")}catch(p){return null}return _}const u={},r=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,s=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(S,y){u[" "+S]||(r.test(S)?u[" "+S]=S+"/":u[" "+S]=w(S,"/",!0)),S=u[" "+S];const _=S.indexOf(":")===-1;return y.substring(0,2)==="//"?_?y:S.replace(c,"$1")+y:y.charAt(0)==="/"?_?y:S.replace(s,"$1")+y:S+y}const o={exec:function(){}};function h(S){let y=1,_,p;for(;y<arguments.length;y++){_=arguments[y];for(p in _)Object.prototype.hasOwnProperty.call(_,p)&&(S[p]=_[p])}return S}function O(S,y){const _=S.replace(/\|/g,(g,l,E)=>{let U=!1,P=l;for(;--P>=0&&E[P]==="\\";)U=!U;return U?"|":" |"}),p=_.split(/ \|/);let d=0;if(p.length>y)p.splice(y);else for(;p.length<y;)p.push("");for(;d<p.length;d++)p[d]=p[d].trim().replace(/\\\|/g,"|");return p}function w(S,y,_){const p=S.length;if(p===0)return"";let d=0;for(;d<p;){const g=S.charAt(p-d-1);if(g===y&&!_)d++;else if(g!==y&&_)d++;else break}return S.substr(0,p-d)}function x(S,y){if(S.indexOf(y[1])===-1)return-1;const _=S.length;let p=0,d=0;for(;d<_;d++)if(S[d]==="\\")d++;else if(S[d]===y[0])p++;else if(S[d]===y[1]&&(p--,p<0))return d;return-1}function A(S){S&&S.sanitize&&!S.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")}ut.exports={escape:D,unescape:B,edit:R,cleanUrl:m,resolveUrl:a,noopTest:o,merge:h,splitCells:O,rtrim:w,findClosingBracket:x,checkSanitizeDeprecation:A}},sR1s:function(ut,Ke,$){"use strict";$.d(Ke,"b",function(){return Q}),$.d(Ke,"a",function(){return F}),$.d(Ke,"c",function(){return D}),$.d(Ke,"d",function(){return G});var ce=$("U8pU"),Y="RC_TABLE_KEY";function N(B){return B==null?[]:Array.isArray(B)?B:[B]}function Q(B,k){if(!k&&typeof k!="number")return B;for(var R=N(k),b=B,v=0;v<R.length;v+=1){if(!b)return null;var m=R[v];b=b[m]}return b}function F(B){var k=[],R={};return B.forEach(function(b){for(var v=b||{},m=v.key,u=v.dataIndex,r=m||N(u).join("-")||Y;R[r];)r="".concat(r,"_next");R[r]=!0,k.push(r)}),k}function D(){var B={};function k(m,u){u&&Object.keys(u).forEach(function(r){var c=u[r];c&&Object(ce.a)(c)==="object"?(m[r]=m[r]||{},k(m[r],c)):m[r]=c})}for(var R=arguments.length,b=new Array(R),v=0;v<R;v++)b[v]=arguments[v];return b.forEach(function(m){k(B,m)}),B}function G(B){return B!=null}},sboe:function(ut,Ke,$){"use strict";$.d(Ke,"a",function(){return N});var ce=$("q1tI"),Y=$.n(ce),N=ce.createContext(null)},spXi:function(ut,Ke,$){ut.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(ut,Ke,$){"use strict";var ce=$("VTBJ"),Y=$("1OyB"),N=$("vuIU"),Q=$("Ji7U"),F=$("LK+K"),D=$("q1tI"),G=$.n(D),B=$("m+aA"),k=$("Zm9Q"),R=$("Kwbf"),b=$("c+Xe"),v=$("bdgK"),m="rc-observer-key",u=function(r){Object(Q.a)(s,r);var c=Object(F.a)(s);function s(){var a;return Object(Y.a)(this,s),a=c.apply(this,arguments),a.resizeObserver=null,a.childNode=null,a.currentElement=null,a.state={width:0,height:0,offsetHeight:0,offsetWidth:0},a.onResize=function(o){var h=a.props.onResize,O=o[0].target,w=O.getBoundingClientRect(),x=w.width,A=w.height,S=O.offsetWidth,y=O.offsetHeight,_=Math.floor(x),p=Math.floor(A);if(a.state.width!==_||a.state.height!==p||a.state.offsetWidth!==S||a.state.offsetHeight!==y){var d={width:_,height:p,offsetWidth:S,offsetHeight:y};a.setState(d),h&&Promise.resolve().then(function(){h(Object(ce.a)(Object(ce.a)({},d),{},{offsetWidth:S,offsetHeight:y}))})}},a.setChildNode=function(o){a.childNode=o},a}return Object(N.a)(s,[{key:"componentDidMount",value:function(){this.onComponentUpdated()}},{key:"componentDidUpdate",value:function(){this.onComponentUpdated()}},{key:"componentWillUnmount",value:function(){this.destroyObserver()}},{key:"onComponentUpdated",value:function(){var o=this.props.disabled;if(o){this.destroyObserver();return}var h=Object(B.a)(this.childNode||this),O=h!==this.currentElement;O&&(this.destroyObserver(),this.currentElement=h),!this.resizeObserver&&h&&(this.resizeObserver=new v.default(this.onResize),this.resizeObserver.observe(h))}},{key:"destroyObserver",value:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"render",value:function(){var o=this.props.children,h=Object(k.a)(o);if(h.length>1)Object(R.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(h.length===0)return Object(R.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var O=h[0];if(D.isValidElement(O)&&Object(b.c)(O)){var w=O.ref;h[0]=D.cloneElement(O,{ref:Object(b.a)(w,this.setChildNode)})}return h.length===1?h[0]:h.map(function(x,A){return!D.isValidElement(x)||"key"in x&&x.key!==null?x:D.cloneElement(x,{key:"".concat(m,"-").concat(A)})})}}]),s}(D.Component);u.displayName="ResizeObserver",Ke.a=u},u2Z1:function(ut,Ke,$){"use strict";$.d(Ke,"a",function(){return w});var ce=$("miYZ"),Y=$("tsqr"),N=$("9og8"),Q=$("5NDa"),F=$("5rEg"),D=$("2qtc"),G=$("kLXV"),B=$("oBTY"),k=$("tJVT"),R=$("OaEy"),b=$("2fM7"),v=$("WmNS"),m=$.n(v),u=$("q1tI"),r=$.n(u),c=$("ErOA"),s=$("i58Z"),a=$.n(s),o=$("T1X5"),h=$.n(o),O=b.a.Option,w=function(A){var S=A.subId,y=A.value,_=A.selectvalues,p=A.disabled,d=A.knowledgeOptions,g=d===void 0?[]:d,l=A.onChange,E=l===void 0?function(){}:l,U=A.onAddKnowledgeFinish,P=U===void 0?function(){}:U,j=Object(u.useRef)(),H=Object(u.useState)([]),I=Object(k.a)(H,2),T=I[0],K=I[1];y=y||[];var J=function(_e,Te){_e?(K([Te.key]),E([Te.key])):(K([]),E([]))};Object(u.useEffect)(function(){(_==null?void 0:_.length)>0&&(K(Object(B.a)(_)),E(Object(B.a)(_)))},[g]),Object(u.useEffect)(function(){var pe;((pe=y)===null||pe===void 0?void 0:pe.length)>0&&E(Object(B.a)(y))},[g]);var ie=function(_e){_e.preventDefault(),j.current="",G.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:r.a.createElement("div",{className:"font14"},r.a.createElement("div",{style:{display:"flex",marginTop:"48px",marginBottom:"36px"}},r.a.createElement("img",{src:h.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",r.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",r.a.createElement("br",null),"\u8BF7\u8BA4\u771F\u586B\u5199\u4E0E\u6559\u5B66\u5185\u5BB9\u76F8\u5173\u7684\u771F\u5B9E\u77E5\u8BC6\u70B9 ",r.a.createElement("br",null)),r.a.createElement(F.a,{className:"mt5",maxLength:20,style:{marginBottom:"42px"},placeholder:"\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC720\u5B57\u7684\u77E5\u8BC6\u70B9\u540D\u79F0",defaultValue:j.current,onChange:function(he){j.current=he.target.value}})),onOk:function(){return new Promise(function(){var he=Object(N.a)(m.a.mark(function re(fe,ae){var oe,Z;return m.a.wrap(function(se){for(;;)switch(se.prev=se.next){case 0:if(j.current){se.next=3;break}return Y.b.warn("\u8BF7\u8F93\u5165\u77E5\u8BC6\u70B9\u540D\u79F0"),se.abrupt("return",ae());case 3:if(!(j.current.length>20)){se.next=6;break}return Y.b.warn("\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC720\u5B57\u7684\u77E5\u8BC6\u70B9\u540D\u79F0"),se.abrupt("return",ae());case 6:return se.next=8,Object(c.a)("/api/tag_disciplines.json",{method:"post",body:{name:j.current,sub_discipline_id:S}});case 8:return oe=se.sent,(oe==null?void 0:oe.status)===0&&(P({id:oe.tag_discipline_id,name:j.current,type:"personal"}),Z=[],Z.push(oe.tag_discipline_id),E([].concat(Z)),K([oe.tag_discipline_id]),E([].concat(Z))),se.abrupt("return",fe());case 11:case"end":return se.stop()}},re)}));return function(re,fe){return he.apply(this,arguments)}}())}})};return r.a.createElement("div",{className:a.a.wrap},r.a.createElement(b.a,{disabled:!S||p,className:"mr5",style:{width:"242px"},onChange:J,showSearch:!0,allowClear:!0,value:g==null?void 0:g.filter(function(pe){return(T==null?void 0:T.includes(pe==null?void 0:pe.id))||(T==null?void 0:T.includes((pe==null?void 0:pe.id)+""))}).map(function(pe){return pe.name})},g==null?void 0:g.map(function(pe){return r.a.createElement(O,{key:pe.id,value:pe.name},r.a.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},r.a.createElement("span",{style:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}},pe.name),r.a.createElement("span",null,pe.type==="personal"?"\uFF08\u81EA\u7528\uFF09":"")))})),r.a.createElement("button",{disabled:!S,className:"".concat(a.a.addKnowledge," ").concat(S?"":a.a.disabled),onClick:ie},"\u65B0\u5EFA\u77E5\u8BC6\u70B9"))}},uK0f:function(ut,Ke,$){(function(ce,Y){ut.exports=Y()})(this,function(){"use strict";function ce(Y,N,Q){Q=Q||{},Q.childrenKeyName=Q.childrenKeyName||"children";var F=Y||[],D=[],G=0;do{var B=F.filter(function(k){return N(k,G)})[0];if(!B)break;D.push(B),F=B[Q.childrenKeyName]||[],G+=1}while(F.length>0);return D}return ce})},ulZh:function(ut,Ke,$){typeof window!="undefined"&&function(Y,N){ut.exports=N()}(this,function(){return function(ce){var Y={};function N(Q){if(Y[Q])return Y[Q].exports;var F=Y[Q]={i:Q,l:!1,exports:{}};return ce[Q].call(F.exports,F,F.exports,N),F.l=!0,F.exports}return N.m=ce,N.c=Y,N.d=function(Q,F,D){N.o(Q,F)||Object.defineProperty(Q,F,{enumerable:!0,get:D})},N.r=function(Q){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Q,"__esModule",{value:!0})},N.t=function(Q,F){if(F&1&&(Q=N(Q)),F&8)return Q;if(F&4&&typeof Q=="object"&&Q&&Q.__esModule)return Q;var D=Object.create(null);if(N.r(D),Object.defineProperty(D,"default",{enumerable:!0,value:Q}),F&2&&typeof Q!="string")for(var G in Q)N.d(D,G,function(B){return Q[B]}.bind(null,G));return D},N.n=function(Q){var F=Q&&Q.__esModule?function(){return Q.default}:function(){return Q};return N.d(F,"a",F),F},N.o=function(Q,F){return Object.prototype.hasOwnProperty.call(Q,F)},N.p="/dist/",N(N.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ce,Y,N){"use strict";var Q=Object.prototype.hasOwnProperty,F="~";function D(){}Object.create&&(D.prototype=Object.create(null),new D().__proto__||(F=!1));function G(b,v,m){this.fn=b,this.context=v,this.once=m||!1}function B(b,v,m,u,r){if(typeof m!="function")throw new TypeError("The listener must be a function");var c=new G(m,u||b,r),s=F?F+v:v;return b._events[s]?b._events[s].fn?b._events[s]=[b._events[s],c]:b._events[s].push(c):(b._events[s]=c,b._eventsCount++),b}function k(b,v){--b._eventsCount===0?b._events=new D:delete b._events[v]}function R(){this._events=new D,this._eventsCount=0}R.prototype.eventNames=function(){var v=[],m,u;if(this._eventsCount===0)return v;for(u in m=this._events)Q.call(m,u)&&v.push(F?u.slice(1):u);return Object.getOwnPropertySymbols?v.concat(Object.getOwnPropertySymbols(m)):v},R.prototype.listeners=function(v){var m=F?F+v:v,u=this._events[m];if(!u)return[];if(u.fn)return[u.fn];for(var r=0,c=u.length,s=new Array(c);r<c;r++)s[r]=u[r].fn;return s},R.prototype.listenerCount=function(v){var m=F?F+v:v,u=this._events[m];return u?u.fn?1:u.length:0},R.prototype.emit=function(v,m,u,r,c,s){var a=F?F+v:v;if(!this._events[a])return!1;var o=this._events[a],h=arguments.length,O,w;if(o.fn){o.once&&this.removeListener(v,o.fn,void 0,!0);switch(h){case 1:return o.fn.call(o.context),!0;case 2:return o.fn.call(o.context,m),!0;case 3:return o.fn.call(o.context,m,u),!0;case 4:return o.fn.call(o.context,m,u,r),!0;case 5:return o.fn.call(o.context,m,u,r,c),!0;case 6:return o.fn.call(o.context,m,u,r,c,s),!0}for(w=1,O=new Array(h-1);w<h;w++)O[w-1]=arguments[w];o.fn.apply(o.context,O)}else{var x=o.length,A;for(w=0;w<x;w++){o[w].once&&this.removeListener(v,o[w].fn,void 0,!0);switch(h){case 1:o[w].fn.call(o[w].context);break;case 2:o[w].fn.call(o[w].context,m);break;case 3:o[w].fn.call(o[w].context,m,u);break;case 4:o[w].fn.call(o[w].context,m,u,r);break;default:if(!O)for(A=1,O=new Array(h-1);A<h;A++)O[A-1]=arguments[A];o[w].fn.apply(o[w].context,O)}}}return!0},R.prototype.on=function(v,m,u){return B(this,v,m,u,!1)},R.prototype.once=function(v,m,u){return B(this,v,m,u,!0)},R.prototype.removeListener=function(v,m,u,r){var c=F?F+v:v;if(!this._events[c])return this;if(!m)return k(this,c),this;var s=this._events[c];if(s.fn)s.fn===m&&(!r||s.once)&&(!u||s.context===u)&&k(this,c);else{for(var a=0,o=[],h=s.length;a<h;a++)(s[a].fn!==m||r&&!s[a].once||u&&s[a].context!==u)&&o.push(s[a]);o.length?this._events[c]=o.length===1?o[0]:o:k(this,c)}return this},R.prototype.removeAllListeners=function(v){var m;return v?(m=F?F+v:v,this._events[m]&&k(this,m)):(this._events=new D,this._eventsCount=0),this},R.prototype.off=R.prototype.removeListener,R.prototype.addListener=R.prototype.on,R.prefixed=F,R.EventEmitter=R,ce.exports=R},"./node_modules/url-toolkit/src/url-toolkit.js":function(ce,Y,N){(function(Q){var F=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,D=/^([^\/?#]*)([^]*)$/,G=/(?:\/|^)\.(?=\/)/g,B=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,k={buildAbsoluteURL:function(R,b,v){if(v=v||{},R=R.trim(),b=b.trim(),!b){if(!v.alwaysNormalize)return R;var m=k.parseURL(R);if(!m)throw new Error("Error trying to parse base URL.");return m.path=k.normalizePath(m.path),k.buildURLFromParts(m)}var u=k.parseURL(b);if(!u)throw new Error("Error trying to parse relative URL.");if(u.scheme)return v.alwaysNormalize?(u.path=k.normalizePath(u.path),k.buildURLFromParts(u)):b;var r=k.parseURL(R);if(!r)throw new Error("Error trying to parse base URL.");if(!r.netLoc&&r.path&&r.path[0]!=="/"){var c=D.exec(r.path);r.netLoc=c[1],r.path=c[2]}r.netLoc&&!r.path&&(r.path="/");var s={scheme:r.scheme,netLoc:u.netLoc,path:null,params:u.params,query:u.query,fragment:u.fragment};if(!u.netLoc&&(s.netLoc=r.netLoc,u.path[0]!=="/"))if(!u.path)s.path=r.path,u.params||(s.params=r.params,u.query||(s.query=r.query));else{var a=r.path,o=a.substring(0,a.lastIndexOf("/")+1)+u.path;s.path=k.normalizePath(o)}return s.path===null&&(s.path=v.alwaysNormalize?k.normalizePath(u.path):u.path),k.buildURLFromParts(s)},parseURL:function(R){var b=F.exec(R);return b?{scheme:b[1]||"",netLoc:b[2]||"",path:b[3]||"",params:b[4]||"",query:b[5]||"",fragment:b[6]||""}:null},normalizePath:function(R){for(R=R.split("").reverse().join("").replace(G,"");R.length!==(R=R.replace(B,"")).length;);return R.split("").reverse().join("")},buildURLFromParts:function(R){return R.scheme+R.netLoc+R.path+R.params+R.query+R.fragment}};ce.exports=k})(this)},"./node_modules/webworkify-webpack/index.js":function(ce,Y,N){function Q(v){var m={};function u(c){if(m[c])return m[c].exports;var s=m[c]={i:c,l:!1,exports:{}};return v[c].call(s.exports,s,s.exports,u),s.l=!0,s.exports}u.m=v,u.c=m,u.i=function(c){return c},u.d=function(c,s,a){u.o(c,s)||Object.defineProperty(c,s,{configurable:!1,enumerable:!0,get:a})},u.r=function(c){Object.defineProperty(c,"__esModule",{value:!0})},u.n=function(c){var s=c&&c.__esModule?function(){return c.default}:function(){return c};return u.d(s,"a",s),s},u.o=function(c,s){return Object.prototype.hasOwnProperty.call(c,s)},u.p="/",u.oe=function(c){throw console.error(c),c};var r=u(u.s=ENTRY_MODULE);return r.default||r}var F="[\\.|\\-|\\+|\\w|/|@]+",D="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+F+").*?\\)";function G(v){return(v+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function B(v){return!isNaN(1*v)}function k(v,m,u){var r={};r[u]=[];var c=m.toString(),s=c.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!s)return r;for(var a=s[1],o=new RegExp("(\\\\n|\\W)"+G(a)+D,"g"),h;h=o.exec(c);){if(h[3]==="dll-reference")continue;r[u].push(h[3])}for(o=new RegExp("\\("+G(a)+'\\("(dll-reference\\s('+F+'))"\\)\\)'+D,"g");h=o.exec(c);)v[h[2]]||(r[u].push(h[1]),v[h[2]]=N(h[1]).m),r[h[2]]=r[h[2]]||[],r[h[2]].push(h[4]);for(var O=Object.keys(r),w=0;w<O.length;w++)for(var x=0;x<r[O[w]].length;x++)B(r[O[w]][x])&&(r[O[w]][x]=1*r[O[w]][x]);return r}function R(v){var m=Object.keys(v);return m.reduce(function(u,r){return u||v[r].length>0},!1)}function b(v,m){for(var u={main:[m]},r={main:[]},c={main:{}};R(u);)for(var s=Object.keys(u),a=0;a<s.length;a++){var o=s[a],h=u[o],O=h.pop();if(c[o]=c[o]||{},c[o][O]||!v[o][O])continue;c[o][O]=!0,r[o]=r[o]||[],r[o].push(O);for(var w=k(v,v[o][O],o),x=Object.keys(w),A=0;A<x.length;A++)u[x[A]]=u[x[A]]||[],u[x[A]]=u[x[A]].concat(w[x[A]])}return r}ce.exports=function(v,m){m=m||{};var u={main:N.m},r=m.all?{main:Object.keys(u.main)}:b(u,v),c="";Object.keys(r).filter(function(O){return O!=="main"}).forEach(function(O){for(var w=0;r[O][w];)w++;r[O].push(w),u[O][w]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",c=c+"var "+O+" = ("+Q.toString().replace("ENTRY_MODULE",JSON.stringify(w))+")({"+r[O].map(function(x){return""+JSON.stringify(x)+": "+u[O][x].toString()}).join(",")+`});
|
|
`}),c=c+"new (("+Q.toString().replace("ENTRY_MODULE",JSON.stringify(v))+")({"+r.main.map(function(O){return""+JSON.stringify(O)+": "+u.main[O].toString()}).join(",")+"}))(self);";var s=new window.Blob([c],{type:"text/javascript"});if(m.bare)return s;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,o=a.createObjectURL(s),h=new window.Worker(o);return h.objectURL=o,h}},"./src/config.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"hlsDefaultConfig",function(){return A}),N.d(Y,"mergeConfig",function(){return y}),N.d(Y,"enableStreamingMode",function(){return _});var Q=N("./src/controller/abr-controller.ts"),F=N("./src/controller/audio-stream-controller.ts"),D=N("./src/controller/audio-track-controller.ts"),G=N("./src/controller/subtitle-stream-controller.ts"),B=N("./src/controller/subtitle-track-controller.ts"),k=N("./src/controller/buffer-controller.ts"),R=N("./src/controller/timeline-controller.ts"),b=N("./src/controller/cap-level-controller.ts"),v=N("./src/controller/fps-controller.ts"),m=N("./src/controller/eme-controller.ts"),u=N("./src/controller/cmcd-controller.ts"),r=N("./src/utils/xhr-loader.ts"),c=N("./src/utils/fetch-loader.ts"),s=N("./src/utils/cues.ts"),a=N("./src/utils/mediakeys-helper.ts"),o=N("./src/utils/logger.ts");function h(){return h=Object.assign||function(p){for(var d=1;d<arguments.length;d++){var g=arguments[d];for(var l in g)Object.prototype.hasOwnProperty.call(g,l)&&(p[l]=g[l])}return p},h.apply(this,arguments)}function O(p,d){var g=Object.keys(p);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(p);d&&(l=l.filter(function(E){return Object.getOwnPropertyDescriptor(p,E).enumerable})),g.push.apply(g,l)}return g}function w(p){for(var d=1;d<arguments.length;d++){var g=arguments[d]!=null?arguments[d]:{};d%2?O(Object(g),!0).forEach(function(l){x(p,l,g[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(g)):O(Object(g)).forEach(function(l){Object.defineProperty(p,l,Object.getOwnPropertyDescriptor(g,l))})}return p}function x(p,d,g){return d in p?Object.defineProperty(p,d,{value:g,enumerable:!0,configurable:!0,writable:!0}):p[d]=g,p}var A=w(w({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:r.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Q.default,bufferController:k.default,capLevelController:b.default,fpsController:v.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:a.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},S()),{},{subtitleStreamController:G.SubtitleStreamController,subtitleTrackController:B.default,timelineController:R.TimelineController,audioStreamController:F.default,audioTrackController:D.default,emeController:m.default,cmcdController:u.default});function S(){return{cueHandler:s.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 y(p,d){if((d.liveSyncDurationCount||d.liveMaxLatencyDurationCount)&&(d.liveSyncDuration||d.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(d.liveMaxLatencyDurationCount!==void 0&&(d.liveSyncDurationCount===void 0||d.liveMaxLatencyDurationCount<=d.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(d.liveMaxLatencyDuration!==void 0&&(d.liveSyncDuration===void 0||d.liveMaxLatencyDuration<=d.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return h({},p,d)}function _(p){var d=p.loader;if(d!==c.default&&d!==r.default)o.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),p.progressive=!1;else{var g=Object(c.fetchSupported)();g&&(p.loader=c.default,p.progressive=!0,p.enableSoftwareAES=!0,o.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ce,Y,N){"use strict";N.r(Y);var Q=N("./src/polyfills/number.ts"),F=N("./src/utils/ewma-bandwidth-estimator.ts"),D=N("./src/events.ts"),G=N("./src/utils/buffer-helper.ts"),B=N("./src/errors.ts"),k=N("./src/types/loader.ts"),R=N("./src/utils/logger.ts");function b(u,r){for(var c=0;c<r.length;c++){var s=r[c];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(u,s.key,s)}}function v(u,r,c){return r&&b(u.prototype,r),c&&b(u,c),u}var m=function(){function u(c){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=c;var s=c.config;this.bwEstimator=new F.default(s.abrEwmaSlowVoD,s.abrEwmaFastVoD,s.abrEwmaDefaultEstimate),this.registerListeners()}var r=u.prototype;return r.registerListeners=function(){var s=this.hls;s.on(D.Events.FRAG_LOADING,this.onFragLoading,this),s.on(D.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(D.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.on(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.on(D.Events.ERROR,this.onError,this)},r.unregisterListeners=function(){var s=this.hls;s.off(D.Events.FRAG_LOADING,this.onFragLoading,this),s.off(D.Events.FRAG_LOADED,this.onFragLoaded,this),s.off(D.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.off(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.off(D.Events.ERROR,this.onError,this)},r.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},r.onFragLoading=function(s,a){var o=a.frag;if(o.type===k.PlaylistLevelType.MAIN&&!this.timer){var h;this.fragCurrent=o,this.partCurrent=(h=a.part)!=null?h:null,this.timer=self.setInterval(this.onCheck,100)}},r.onLevelLoaded=function(s,a){var o=this.hls.config;a.details.live?this.bwEstimator.update(o.abrEwmaSlowLive,o.abrEwmaFastLive):this.bwEstimator.update(o.abrEwmaSlowVoD,o.abrEwmaFastVoD)},r._abandonRulesCheck=function(){var s=this.fragCurrent,a=this.partCurrent,o=this.hls,h=o.autoLevelEnabled,O=o.config,w=o.media;if(!s||!w)return;var x=a?a.stats:s.stats,A=a?a.duration:s.duration;if(x.aborted){R.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!h||w.paused||!w.playbackRate||!w.readyState)return;var S=performance.now()-x.loading.start,y=Math.abs(w.playbackRate);if(S<=500*A/y)return;var _=o.levels,p=o.minAutoLevel,d=_[s.level],g=x.total||Math.max(x.loaded,Math.round(A*d.maxBitrate/8)),l=Math.max(1,x.bwEstimate?x.bwEstimate/8:x.loaded*1e3/S),E=(g-x.loaded)/l,U=w.currentTime,P=(G.BufferHelper.bufferInfo(w,U,O.maxBufferHole).end-U)/y;if(P>=2*A/y||E<=P)return;var j=Number.POSITIVE_INFINITY,H;for(H=s.level-1;H>p;H--){var I=_[H].maxBitrate;if(j=A*I/(8*.8*l),j<P)break}if(j>=E)return;var T=this.bwEstimator.getEstimate();R.logger.warn("Fragment "+s.sn+(a?" part "+a.index:"")+" of level "+s.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+H+`
|
|
Current BW estimate: `+(Object(Q.isFiniteNumber)(T)?(T/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+E.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+j.toFixed(3)+` s
|
|
Time to underbuffer: `+P.toFixed(3)+" s"),o.nextLoadLevel=H,this.bwEstimator.sample(S,x.loaded),this.clearTimer(),s.loader&&(this.fragCurrent=this.partCurrent=null,s.loader.abort()),o.trigger(D.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:s,part:a,stats:x})},r.onFragLoaded=function(s,a){var o=a.frag,h=a.part;if(o.type===k.PlaylistLevelType.MAIN&&Object(Q.isFiniteNumber)(o.sn)){var O=h?h.stats:o.stats,w=h?h.duration:o.duration;if(this.clearTimer(),this.lastLoadedFragLevel=o.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var x=this.hls.levels[o.level],A=(x.loaded?x.loaded.bytes:0)+O.loaded,S=(x.loaded?x.loaded.duration:0)+w;x.loaded={bytes:A,duration:S},x.realBitrate=Math.round(8*A/S)}if(o.bitrateTest){var y={stats:O,frag:o,part:h,id:o.type};this.onFragBuffered(D.Events.FRAG_BUFFERED,y),o.bitrateTest=!1}}},r.onFragBuffered=function(s,a){var o=a.frag,h=a.part,O=h?h.stats:o.stats;if(O.aborted)return;if(o.type!==k.PlaylistLevelType.MAIN||o.sn==="initSegment")return;var w=O.parsing.end-O.loading.start;this.bwEstimator.sample(w,O.loaded),O.bwEstimate=this.bwEstimator.getEstimate(),o.bitrateTest?this.bitrateTestDelay=w/1e3:this.bitrateTestDelay=0},r.onError=function(s,a){switch(a.details){case B.ErrorDetails.FRAG_LOAD_ERROR:case B.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},r.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},r.getNextABRAutoLevel=function(){var s=this.fragCurrent,a=this.partCurrent,o=this.hls,h=o.maxAutoLevel,O=o.config,w=o.minAutoLevel,x=o.media,A=a?a.duration:s?s.duration:0,S=x?x.currentTime:0,y=x&&x.playbackRate!==0?Math.abs(x.playbackRate):1,_=this.bwEstimator?this.bwEstimator.getEstimate():O.abrEwmaDefaultEstimate,p=(G.BufferHelper.bufferInfo(x,S,O.maxBufferHole).end-S)/y,d=this.findBestLevel(_,w,h,p,O.abrBandWidthFactor,O.abrBandWidthUpFactor);if(d>=0)return d;R.logger.trace((p?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var g=A?Math.min(A,O.maxStarvationDelay):O.maxStarvationDelay,l=O.abrBandWidthFactor,E=O.abrBandWidthUpFactor;if(!p){var U=this.bitrateTestDelay;if(U){var P=A?Math.min(A,O.maxLoadingDelay):O.maxLoadingDelay;g=P-U,R.logger.trace("bitrate test took "+Math.round(1e3*U)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*g)+" ms"),l=E=1}}return d=this.findBestLevel(_,w,h,p+g,l,E),Math.max(d,0)},r.findBestLevel=function(s,a,o,h,O,w){for(var x,A=this.fragCurrent,S=this.partCurrent,y=this.lastLoadedFragLevel,_=this.hls.levels,p=_[y],d=!!(p!=null&&(x=p.details)!==null&&x!==void 0&&x.live),g=p==null?void 0:p.codecSet,l=S?S.duration:A?A.duration:0,E=o;E>=a;E--){var U=_[E];if(!U||g&&U.codecSet!==g)continue;var P=U.details,j=(S?P==null?void 0:P.partTarget:P==null?void 0:P.averagetargetduration)||l,H=void 0;E<=y?H=O*s:H=w*s;var I=_[E].maxBitrate,T=I*j/H;if(R.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+E+"/"+Math.round(H)+"/"+I+"/"+j+"/"+h+"/"+T),H>I&&(!T||d&&!this.bitrateTestDelay||T<h))return E}return-1},v(u,[{key:"nextAutoLevel",get:function(){var s=this._nextAutoLevel,a=this.bwEstimator;if(s!==-1&&(!a||!a.canEstimate()))return s;var o=this.getNextABRAutoLevel();return s!==-1&&(o=Math.min(s,o)),o},set:function(s){this._nextAutoLevel=s}}]),u}();Y.default=m},"./src/controller/audio-stream-controller.ts":function(ce,Y,N){"use strict";N.r(Y);var Q=N("./src/polyfills/number.ts"),F=N("./src/controller/base-stream-controller.ts"),D=N("./src/events.ts"),G=N("./src/utils/buffer-helper.ts"),B=N("./src/controller/fragment-tracker.ts"),k=N("./src/types/level.ts"),R=N("./src/types/loader.ts"),b=N("./src/loader/fragment.ts"),v=N("./src/demux/chunk-cache.ts"),m=N("./src/demux/transmuxer-interface.ts"),u=N("./src/types/transmuxer.ts"),r=N("./src/controller/fragment-finders.ts"),c=N("./src/utils/discontinuities.ts"),s=N("./src/errors.ts"),a=N("./src/utils/logger.ts");function o(){return o=Object.assign||function(A){for(var S=1;S<arguments.length;S++){var y=arguments[S];for(var _ in y)Object.prototype.hasOwnProperty.call(y,_)&&(A[_]=y[_])}return A},o.apply(this,arguments)}function h(A,S){A.prototype=Object.create(S.prototype),A.prototype.constructor=A,O(A,S)}function O(A,S){return O=Object.setPrototypeOf||function(_,p){return _.__proto__=p,_},O(A,S)}var w=100,x=function(A){h(S,A);function S(_,p){var d;return d=A.call(this,_,p,"[audio-stream-controller]")||this,d.videoBuffer=null,d.videoTrackCC=-1,d.waitingVideoCC=-1,d.audioSwitch=!1,d.trackId=-1,d.waitingData=null,d.mainDetails=null,d.bufferFlushed=!1,d._registerListeners(),d}var y=S.prototype;return y.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},y._registerListeners=function(){var p=this.hls;p.on(D.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.on(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.on(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.on(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(D.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),p.on(D.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),p.on(D.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),p.on(D.Events.ERROR,this.onError,this),p.on(D.Events.BUFFER_RESET,this.onBufferReset,this),p.on(D.Events.BUFFER_CREATED,this.onBufferCreated,this),p.on(D.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),p.on(D.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),p.on(D.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y._unregisterListeners=function(){var p=this.hls;p.off(D.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.off(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.off(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.off(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(D.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),p.off(D.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),p.off(D.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),p.off(D.Events.ERROR,this.onError,this),p.off(D.Events.BUFFER_RESET,this.onBufferReset,this),p.off(D.Events.BUFFER_CREATED,this.onBufferCreated,this),p.off(D.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),p.off(D.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),p.off(D.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y.onInitPtsFound=function(p,d){var g=d.frag,l=d.id,E=d.initPTS;if(l==="main"){var U=g.cc;this.initPTS[g.cc]=E,this.log("InitPTS for cc: "+U+" found from main: "+E),this.videoTrackCC=U,this.state===F.State.WAITING_INIT_PTS&&this.tick()}},y.startLoad=function(p){if(!this.levels){this.startPosition=p,this.state=F.State.STOPPED;return}var d=this.lastCurrentTime;this.stopLoad(),this.setInterval(w),this.fragLoadError=0,d>0&&p===-1?(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),this.state=F.State.IDLE):(this.loadedmetadata=!1,this.state=F.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=p,this.tick()},y.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_TRACK:{var p,d=this.levels,g=this.trackId,l=d==null||((p=d[g])===null||p===void 0)?void 0:p.details;if(l){if(this.waitForCdnTuneIn(l))break;this.state=F.State.WAITING_INIT_PTS}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var E,U=performance.now(),P=this.retryDate;(!P||U>=P||(E=this.media)!==null&&E!==void 0&&E.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=F.State.IDLE);break}case F.State.WAITING_INIT_PTS:{var j=this.waitingData;if(j){var H=j.frag,I=j.part,T=j.cache,K=j.complete;if(this.initPTS[H.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.FRAG_LOADING;var J=T.flush(),ie={frag:H,part:I,payload:J,networkDetails:null};this._handleFragmentLoadProgress(ie),K&&A.prototype._handleFragmentLoadComplete.call(this,ie)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+H.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var pe=this.getLoadPosition(),_e=G.BufferHelper.bufferInfo(this.mediaBuffer,pe,this.config.maxBufferHole),Te=Object(r.fragmentWithinToleranceTest)(_e.end,this.config.maxFragLookUpTolerance,H);Te<0&&(a.logger.log("Waiting fragment cc ("+H.cc+") @ "+H.start+" cancelled because another fragment at "+_e.end+" is needed"),this.clearWaitingFragment())}}else this.state=F.State.IDLE}}this.onTickEnd()},y.clearWaitingFragment=function(){var p=this.waitingData;p&&(this.fragmentTracker.removeFragment(p.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.IDLE)},y.onTickEnd=function(){var p=this.media;if(!p||!p.readyState)return;var d=this.mediaBuffer?this.mediaBuffer:p,g=d.buffered;!this.loadedmetadata&&g.length&&(this.loadedmetadata=!0),this.lastCurrentTime=p.currentTime},y.doTickIdle=function(){var p,d,g=this.hls,l=this.levels,E=this.media,U=this.trackId,P=g.config;if(!l||!l[U])return;if(!E&&(this.startFragRequested||!P.startFragPrefetch))return;var j=l[U],H=j.details;if(!H||H.live&&this.levelLastLoaded!==U||this.waitForCdnTuneIn(H)){this.state=F.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,b.ElementaryStreamTypes.AUDIO,R.PlaylistLevelType.AUDIO));var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,R.PlaylistLevelType.AUDIO);if(I===null)return;var T=I.len,K=this.getMaxBufferLength(),J=this.audioSwitch;if(T>=K&&!J)return;if(!J&&this._streamEnded(I,H)){g.trigger(D.Events.BUFFER_EOS,{type:"audio"}),this.state=F.State.ENDED;return}var ie=H.fragments,pe=ie[0].start,_e=I.end;if(J){var Te=this.getLoadPosition();_e=Te,H.PTSKnown&&Te<pe&&((I.end>pe||I.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),E.currentTime=pe+.05))}var he=this.getNextFragment(_e,H);if(!he){this.bufferFlushed=!0;return}((p=he.decryptdata)===null||p===void 0?void 0:p.keyFormat)==="identity"&&!((d=he.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(he,H):this.loadFragment(he,H,_e)},y.getMaxBufferLength=function(){var p=A.prototype.getMaxBufferLength.call(this),d=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,R.PlaylistLevelType.MAIN);return d===null?p:Math.max(p,d.len)},y.onMediaDetaching=function(){this.videoBuffer=null,A.prototype.onMediaDetaching.call(this)},y.onAudioTracksUpdated=function(p,d){var g=d.audioTracks;this.resetTransmuxer(),this.levels=g.map(function(l){return new k.Level(l)})},y.onAudioTrackSwitching=function(p,d){var g=!!d.url;this.trackId=d.id;var l=this.fragCurrent;l!=null&&l.loader&&l.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),g?this.setInterval(w):this.resetTransmuxer(),g?(this.audioSwitch=!0,this.state=F.State.IDLE):this.state=F.State.STOPPED,this.tick()},y.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},y.onLevelLoaded=function(p,d){this.mainDetails=d.details},y.onAudioTrackLoaded=function(p,d){var g,l=this.levels,E=d.details,U=d.id;if(!l){this.warn("Audio tracks were reset while loading level "+U);return}this.log("Track "+U+" loaded ["+E.startSN+","+E.endSN+"],duration:"+E.totalduration);var P=l[U],j=0;if(E.live||(g=P.details)!==null&&g!==void 0&&g.live){var H=this.mainDetails;if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed||!H)return;!P.details&&E.hasProgramDateTime&&H.hasProgramDateTime?(Object(c.alignMediaPlaylistByPDT)(E,H),j=E.fragments[0].start):j=this.alignPlaylists(E,P.details)}P.details=E,this.levelLastLoaded=U,!this.startFragRequested&&(this.mainDetails||!E.live)&&this.setStartPosition(P.details,j),this.state===F.State.WAITING_TRACK&&!this.waitForCdnTuneIn(E)&&(this.state=F.State.IDLE),this.tick()},y._handleFragmentLoadProgress=function(p){var d,g=p.frag,l=p.part,E=p.payload,U=this.config,P=this.trackId,j=this.levels;if(!j){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 H=j[P];console.assert(H,"Audio track is defined on fragment load progress");var I=H.details;console.assert(I,"Audio track details are defined on fragment load progress");var T=U.defaultAudioCodec||H.audioCodec||"mp4a.40.2",K=this.transmuxer;K||(K=this.transmuxer=new m.default(this.hls,R.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var J=this.initPTS[g.cc],ie=(d=g.initSegment)===null||d===void 0?void 0:d.data;if(J!==void 0){var pe=!1,_e=l?l.index:-1,Te=_e!==-1,he=new u.ChunkMetadata(g.level,g.sn,g.stats.chunkCount,E.byteLength,_e,Te);K.push(E,ie,T,"",g,l,I.totalduration,pe,he,J)}else{a.logger.log("Unknown video PTS for cc "+g.cc+", waiting for video PTS before demuxing audio frag "+g.sn+" of ["+I.startSN+" ,"+I.endSN+"],track "+P);var re=this.waitingData=this.waitingData||{frag:g,part:l,cache:new v.default,complete:!1},fe=re.cache;fe.push(new Uint8Array(E)),this.waitingVideoCC=this.videoTrackCC,this.state=F.State.WAITING_INIT_PTS}},y._handleFragmentLoadComplete=function(p){if(this.waitingData){this.waitingData.complete=!0;return}A.prototype._handleFragmentLoadComplete.call(this,p)},y.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},y.onBufferCreated=function(p,d){var g=d.tracks.audio;g&&(this.mediaBuffer=g.buffer),d.tracks.video&&(this.videoBuffer=d.tracks.video.buffer)},y.onFragBuffered=function(p,d){var g=d.frag,l=d.part;if(g.type!==R.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(D.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(g,l)},y.onError=function(p,d){switch(d.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:case s.ErrorDetails.KEY_LOAD_ERROR:case s.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.AUDIO,d);break;case s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==F.State.ERROR&&this.state!==F.State.STOPPED&&(this.state=d.fatal?F.State.ERROR:F.State.IDLE,this.warn(d.details+" while loading frag, switching to "+this.state+" state"));break;case s.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="audio"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var g=!0,l=this.getFwdBufferInfo(this.mediaBuffer,R.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,A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},y.onBufferFlushed=function(p,d){var g=d.type;g===b.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},y._handleTransmuxComplete=function(p){var d,g="audio",l=this.hls,E=p.remuxResult,U=p.chunkMeta,P=this.getCurrentContext(U);if(!P){this.warn("The loading context changed while buffering fragment "+U.sn+" of level "+U.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(U.level);return}var j=P.frag,H=P.part,I=E.audio,T=E.text,K=E.id3,J=E.initSegment;if(this.fragContextChanged(j))return;if(this.state=F.State.PARSING,this.audioSwitch&&I&&this.completeAudioSwitch(),J!=null&&J.tracks&&(this._bufferInitSegment(J.tracks,j,U),l.trigger(D.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:g,tracks:J.tracks})),I){var ie=I.startPTS,pe=I.endPTS,_e=I.startDTS,Te=I.endDTS;H&&(H.elementaryStreams[b.ElementaryStreamTypes.AUDIO]={startPTS:ie,endPTS:pe,startDTS:_e,endDTS:Te}),j.setElementaryStreamInfo(b.ElementaryStreamTypes.AUDIO,ie,pe,_e,Te),this.bufferFragmentData(I,j,H,U)}if(K!=null&&(d=K.samples)!==null&&d!==void 0&&d.length){var he=o({frag:j,id:g},K);l.trigger(D.Events.FRAG_PARSING_METADATA,he)}if(T){var re=o({frag:j,id:g},T);l.trigger(D.Events.FRAG_PARSING_USERDATA,re)}},y._bufferInitSegment=function(p,d,g){if(this.state!==F.State.PARSING)return;p.video&&delete p.video;var l=p.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(D.Events.BUFFER_CODECS,p);var E=l.initSegment;if(E!=null&&E.byteLength){var U={type:"audio",frag:d,part:null,chunkMeta:g,parent:d.type,data:E};this.hls.trigger(D.Events.BUFFER_APPENDING,U)}this.tick()},y.loadFragment=function(p,d,g){var l=this.fragmentTracker.getState(p);this.fragCurrent=p,(this.audioSwitch||l===B.FragmentState.NOT_LOADED||l===B.FragmentState.PARTIAL)&&(p.sn==="initSegment"?this._loadInitSegment(p):d.live&&!Object(Q.isFiniteNumber)(this.initPTS[p.cc])?(this.log("Waiting for video PTS in continuity counter "+p.cc+" of live stream before loading audio fragment "+p.sn+" of level "+this.trackId),this.state=F.State.WAITING_INIT_PTS):(this.startFragRequested=!0,A.prototype.loadFragment.call(this,p,d,g)))},y.completeAudioSwitch=function(){var p=this.hls,d=this.media,g=this.trackId;d&&(this.log("Switching audio track : flushing all audio"),A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,p.trigger(D.Events.AUDIO_TRACK_SWITCHED,{id:g})},S}(F.default);Y.default=x},"./src/controller/audio-track-controller.ts":function(ce,Y,N){"use strict";N.r(Y);var Q=N("./src/events.ts"),F=N("./src/errors.ts"),D=N("./src/controller/base-playlist-controller.ts"),G=N("./src/types/loader.ts");function B(m,u){for(var r=0;r<u.length;r++){var c=u[r];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(m,c.key,c)}}function k(m,u,r){return u&&B(m.prototype,u),r&&B(m,r),m}function R(m,u){m.prototype=Object.create(u.prototype),m.prototype.constructor=m,b(m,u)}function b(m,u){return b=Object.setPrototypeOf||function(c,s){return c.__proto__=s,c},b(m,u)}var v=function(m){R(u,m);function u(c){var s;return s=m.call(this,c,"[audio-track-controller]")||this,s.tracks=[],s.groupId=null,s.tracksInGroup=[],s.trackId=-1,s.trackName="",s.selectDefaultTrack=!0,s.registerListeners(),s}var r=u.prototype;return r.registerListeners=function(){var s=this.hls;s.on(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.on(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),s.on(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.on(Q.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.on(Q.Events.ERROR,this.onError,this)},r.unregisterListeners=function(){var s=this.hls;s.off(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.off(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),s.off(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.off(Q.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.off(Q.Events.ERROR,this.onError,this)},r.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,m.prototype.destroy.call(this)},r.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},r.onManifestParsed=function(s,a){this.tracks=a.audioTracks||[]},r.onAudioTrackLoaded=function(s,a){var o=a.id,h=a.details,O=this.tracksInGroup[o];if(!O){this.warn("Invalid audio track id "+o);return}var w=O.details;O.details=a.details,this.log("audioTrack "+o+" loaded ["+h.startSN+"-"+h.endSN+"]"),o===this.trackId&&(this.retryCount=0,this.playlistLoaded(o,a,w))},r.onLevelLoading=function(s,a){this.switchLevel(a.level)},r.onLevelSwitching=function(s,a){this.switchLevel(a.level)},r.switchLevel=function(s){var a=this.hls.levels[s];if(!(a!=null&&a.audioGroupIds))return;var o=a.audioGroupIds[a.urlId];if(this.groupId!==o){this.groupId=o;var h=this.tracks.filter(function(w){return!o||w.groupId===o});this.selectDefaultTrack&&!h.some(function(w){return w.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=h;var O={audioTracks:h};this.log("Updating audio tracks, "+h.length+' track(s) found in "'+o+'" group-id'),this.hls.trigger(Q.Events.AUDIO_TRACKS_UPDATED,O),this.selectInitialTrack()}},r.onError=function(s,a){if(m.prototype.onError.call(this,s,a),a.fatal||!a.context)return;a.context.type===G.PlaylistContextType.AUDIO_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},r.setAudioTrack=function(s){var a=this.tracksInGroup;if(s<0||s>=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var o=a[this.trackId];this.log("Now switching to audio-track index "+s);var h=a[s],O=h.id,w=h.groupId,x=w===void 0?"":w,A=h.name,S=h.type,y=h.url;if(this.trackId=s,this.trackName=A,this.selectDefaultTrack=!1,this.hls.trigger(Q.Events.AUDIO_TRACK_SWITCHING,{id:O,groupId:x,name:A,type:S,url:y}),h.details&&!h.details.live)return;var _=this.switchParams(h.url,o==null?void 0:o.details);this.loadPlaylist(_)},r.selectInitialTrack=function(){var s=this.tracksInGroup;console.assert(s.length,"Initial audio track should be selected when tracks are known");var a=this.trackName,o=this.findTrackId(a)||this.findTrackId();o!==-1?this.setAudioTrack(o):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Q.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},r.findTrackId=function(s){for(var a=this.tracksInGroup,o=0;o<a.length;o++){var h=a[o];if((!this.selectDefaultTrack||h.default)&&(!s||s===h.name))return h.id}return-1},r.loadPlaylist=function(s){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var o=a.id,h=a.groupId,O=a.url;if(s)try{O=s.addDirectives(O)}catch(w){this.warn("Could not construct new URL with HLS Delivery Directives: "+w)}this.log("loading audio-track playlist for id: "+o),this.clearTimer(),this.hls.trigger(Q.Events.AUDIO_TRACK_LOADING,{url:O,id:o,groupId:h,deliveryDirectives:s||null})}},k(u,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(s){this.selectDefaultTrack=!1,this.setAudioTrack(s)}}]),u}(D.default);Y.default=v},"./src/controller/base-playlist-controller.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return k});var Q=N("./src/polyfills/number.ts"),F=N("./src/types/level.ts"),D=N("./src/controller/level-helper.ts"),G=N("./src/utils/logger.ts"),B=N("./src/errors.ts"),k=function(){function R(v,m){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=G.logger.log.bind(G.logger,m+":"),this.warn=G.logger.warn.bind(G.logger,m+":"),this.hls=v}var b=R.prototype;return b.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},b.onError=function(m,u){u.fatal&&u.type===B.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},b.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},b.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},b.stopLoad=function(){this.canLoad=!1,this.clearTimer()},b.switchParams=function(m,u){var r=u==null?void 0:u.renditionReports;if(r)for(var c=0;c<r.length;c++){var s=r[c],a=""+s.URI;if(a===m.substr(-a.length)){var o=parseInt(s["LAST-MSN"]),h=parseInt(s["LAST-PART"]);if(u&&this.hls.config.lowLatencyMode){var O=Math.min(u.age-u.partTarget,u.targetduration);h!==void 0&&O>u.partTarget&&(h+=1)}if(Object(Q.isFiniteNumber)(o))return new F.HlsUrlParameters(o,Object(Q.isFiniteNumber)(h)?h:void 0,F.HlsSkip.No)}}},b.loadPlaylist=function(m){},b.shouldLoadTrack=function(m){return this.canLoad&&m&&!!m.url&&(!m.details||m.details.live)},b.playlistLoaded=function(m,u,r){var c=this,s=u.details,a=u.stats,o=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(s.advancedDateTime=Date.now()-o,s.live||r!=null&&r.live){if(s.reloaded(r),r&&this.log("live playlist "+m+" "+(s.advanced?"REFRESHED "+s.lastPartSn+"-"+s.lastPartIndex:"MISSED")),r&&s.fragments.length>0&&Object(D.mergeDetails)(r,s),!this.canLoad||!s.live)return;var h,O=void 0,w=void 0;if(s.canBlockReload&&s.endSN&&s.advanced){var x=this.hls.config.lowLatencyMode,A=s.lastPartSn,S=s.endSN,y=s.lastPartIndex,_=y!==-1,p=A===S,d=x?0:y;_?(O=p?S+1:A,w=p?d:y+1):O=S+1;var g=s.age,l=g+s.ageHeader,E=Math.min(l-s.partTarget,s.targetduration*1.5);if(E>0){if(r&&E>r.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+r.tuneInGoal+" to: "+E+" with playlist age: "+s.age),E=0;else{var U=Math.floor(E/s.targetduration);if(O+=U,w!==void 0){var P=Math.round(E%s.targetduration/s.partTarget);w+=P}this.log("CDN Tune-in age: "+s.ageHeader+"s last advanced "+g.toFixed(2)+"s goal: "+E+" skip sn "+U+" to part "+w)}s.tuneInGoal=E}if(h=this.getDeliveryDirectives(s,u.deliveryDirectives,O,w),x||!p){this.loadPlaylist(h);return}}else h=this.getDeliveryDirectives(s,u.deliveryDirectives,O,w);var j=Object(D.computeReloadInterval)(s,a);O!==void 0&&s.canBlockReload&&(j-=s.partTarget||1),this.log("reload live playlist "+m+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return c.loadPlaylist(h)},j)}else this.clearTimer()},b.getDeliveryDirectives=function(m,u,r,c){var s=Object(F.getSkipValue)(m,r);return u!=null&&u.skip&&m.deltaUpdateFailed&&(r=u.msn,c=u.part,s=F.HlsSkip.No),new F.HlsUrlParameters(r,c,s)},b.retryLoadingOrFail=function(m){var u=this,r=this.hls.config,c=this.retryCount<r.levelLoadingMaxRetry;if(c){var s;if(this.retryCount++,m.details.indexOf("LoadTimeOut")>-1&&(s=m.context)!==null&&s!==void 0&&s.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+m.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*r.levelLoadingRetryDelay,r.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return u.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+m.details+'"')}}else this.warn('cannot recover from error "'+m.details+'"'),this.clearTimer(),m.fatal=!0;return c},R}()},"./src/controller/base-stream-controller.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"State",function(){return S}),N.d(Y,"default",function(){return y});var Q=N("./src/polyfills/number.ts"),F=N("./src/task-loop.ts"),D=N("./src/controller/fragment-tracker.ts"),G=N("./src/utils/buffer-helper.ts"),B=N("./src/utils/logger.ts"),k=N("./src/events.ts"),R=N("./src/errors.ts"),b=N("./src/types/transmuxer.ts"),v=N("./src/utils/mp4-tools.ts"),m=N("./src/utils/discontinuities.ts"),u=N("./src/controller/fragment-finders.ts"),r=N("./src/controller/level-helper.ts"),c=N("./src/loader/fragment-loader.ts"),s=N("./src/crypt/decrypter.ts"),a=N("./src/utils/time-ranges.ts"),o=N("./src/types/loader.ts");function h(_,p){for(var d=0;d<p.length;d++){var g=p[d];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(_,g.key,g)}}function O(_,p,d){return p&&h(_.prototype,p),d&&h(_,d),_}function w(_){if(_===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _}function x(_,p){_.prototype=Object.create(p.prototype),_.prototype.constructor=_,A(_,p)}function A(_,p){return A=Object.setPrototypeOf||function(g,l){return g.__proto__=l,g},A(_,p)}var S={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"},y=function(_){x(p,_);function p(g,l,E){var U;return U=_.call(this)||this,U.hls=void 0,U.fragPrevious=null,U.fragCurrent=null,U.fragmentTracker=void 0,U.transmuxer=null,U._state=S.STOPPED,U.media=void 0,U.mediaBuffer=void 0,U.config=void 0,U.bitrateTest=!1,U.lastCurrentTime=0,U.nextLoadPosition=0,U.startPosition=0,U.loadedmetadata=!1,U.fragLoadError=0,U.retryDate=0,U.levels=null,U.fragmentLoader=void 0,U.levelLastLoaded=null,U.startFragRequested=!1,U.decrypter=void 0,U.initPTS=[],U.onvseeking=null,U.onvended=null,U.logPrefix="",U.log=void 0,U.warn=void 0,U.logPrefix=E,U.log=B.logger.log.bind(B.logger,E+":"),U.warn=B.logger.warn.bind(B.logger,E+":"),U.hls=g,U.fragmentLoader=new c.default(g.config),U.fragmentTracker=l,U.config=g.config,U.decrypter=new s.default(g,g.config),g.on(k.Events.KEY_LOADED,U.onKeyLoaded,w(U)),U}var d=p.prototype;return d.doTick=function(){this.onTickEnd()},d.onTickEnd=function(){},d.startLoad=function(l){},d.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=S.STOPPED},d._streamEnded=function(l,E){var U=this.fragCurrent,P=this.fragmentTracker;if(!E.live&&U&&U.sn===E.endSN&&!l.nextStart){var j=P.getState(U);return j===D.FragmentState.PARTIAL||j===D.FragmentState.OK}return!1},d.onMediaAttached=function(l,E){var U=this.media=this.mediaBuffer=E.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),U.addEventListener("seeking",this.onvseeking),U.addEventListener("ended",this.onvended);var P=this.config;this.levels&&P.autoStartLoad&&this.state===S.STOPPED&&this.startLoad(P.startPosition)},d.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()},d.onMediaSeeking=function(){var l=this.config,E=this.fragCurrent,U=this.media,P=this.mediaBuffer,j=this.state,H=U?U.currentTime:0,I=G.BufferHelper.bufferInfo(P||U,H,l.maxBufferHole);if(this.log("media seeking to "+(Object(Q.isFiniteNumber)(H)?H.toFixed(3):H)+", state: "+j),j===S.ENDED)this.resetLoadingState();else if(E&&!I.len){var T=l.maxFragLookUpTolerance,K=E.start-T,J=E.start+E.duration+T,ie=H>J;(H<K||ie)&&(ie&&E.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),E.loader.abort()),this.resetLoadingState())}U&&(this.lastCurrentTime=H),!this.loadedmetadata&&!I.len&&(this.nextLoadPosition=this.startPosition=H),this.tickImmediate()},d.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},d.onKeyLoaded=function(l,E){if(this.state!==S.KEY_LOADING||E.frag!==this.fragCurrent||!this.levels)return;this.state=S.IDLE;var U=this.levels[E.frag.level].details;U&&this.loadFragment(E.frag,U,E.frag.start)},d.onHandlerDestroying=function(){this.stopLoad(),_.prototype.onHandlerDestroying.call(this)},d.onHandlerDestroyed=function(){this.state=S.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,_.prototype.onHandlerDestroyed.call(this)},d.loadKey=function(l,E){this.log("Loading key for "+l.sn+" of ["+E.startSN+"-"+E.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+l.level),this.state=S.KEY_LOADING,this.fragCurrent=l,this.hls.trigger(k.Events.KEY_LOADING,{frag:l})},d.loadFragment=function(l,E,U){this._loadFragForPlayback(l,E,U)},d._loadFragForPlayback=function(l,E,U){var P=this,j=function(I){if(P.fragContextChanged(l)){P.warn("Fragment "+l.sn+(I.part?" p: "+I.part.index:"")+" of level "+l.level+" was dropped during download."),P.fragmentTracker.removeFragment(l);return}l.stats.chunkCount++,P._handleFragmentLoadProgress(I)};this._doFragLoad(l,E,U,j).then(function(H){if(!H)return;P.fragLoadError=0;var I=P.state;if(P.fragContextChanged(l)){(I===S.FRAG_LOADING||I===S.BACKTRACKING||!P.fragCurrent&&I===S.PARSING)&&(P.fragmentTracker.removeFragment(l),P.state=S.IDLE);return}if("payload"in H&&(P.log("Loaded fragment "+l.sn+" of level "+l.level),P.hls.trigger(k.Events.FRAG_LOADED,H),P.state===S.BACKTRACKING)){P.fragmentTracker.backtrack(l,H),P.resetFragmentLoading(l);return}P._handleFragmentLoadComplete(H)}).catch(function(H){P.warn(H),P.resetFragmentLoading(l)})},d.flushMainBuffer=function(l,E,U){if(U===void 0&&(U=null),!(l-E))return;var P={startOffset:l,endOffset:E,type:U};this.fragLoadError=0,this.hls.trigger(k.Events.BUFFER_FLUSHING,P)},d._loadInitSegment=function(l){var E=this;this._doFragLoad(l).then(function(U){if(!U||E.fragContextChanged(l)||!E.levels)throw new Error("init load aborted");return U}).then(function(U){var P=E.hls,j=U.payload,H=l.decryptdata;if(j&&j.byteLength>0&&H&&H.key&&H.iv&&H.method==="AES-128"){var I=self.performance.now();return E.decrypter.webCryptoDecrypt(new Uint8Array(j),H.key.buffer,H.iv.buffer).then(function(T){var K=self.performance.now();return P.trigger(k.Events.FRAG_DECRYPTED,{frag:l,payload:T,stats:{tstart:I,tdecrypt:K}}),U.payload=T,U})}return U}).then(function(U){var P=E.fragCurrent,j=E.hls,H=E.levels;if(!H)throw new Error("init load aborted, missing levels");var I=H[l.level].details;console.assert(I,"Level details are defined when init segment is loaded");var T=l.stats;E.state=S.IDLE,E.fragLoadError=0,l.data=new Uint8Array(U.payload),T.parsing.start=T.buffering.start=self.performance.now(),T.parsing.end=T.buffering.end=self.performance.now(),U.frag===P&&j.trigger(k.Events.FRAG_BUFFERED,{stats:T,frag:P,part:null,id:l.type}),E.tick()}).catch(function(U){E.warn(U),E.resetFragmentLoading(l)})},d.fragContextChanged=function(l){var E=this.fragCurrent;return!l||!E||l.level!==E.level||l.sn!==E.sn||l.urlId!==E.urlId},d.fragBufferedComplete=function(l,E){var U=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+l.type+" sn: "+l.sn+(E?" part: "+E.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+l.level+" "+a.default.toString(G.BufferHelper.getBuffered(U))),this.state=S.IDLE,this.tick()},d._handleFragmentLoadComplete=function(l){var E=this.transmuxer;if(!E)return;var U=l.frag,P=l.part,j=l.partsLoaded,H=!j||j.length===0||j.some(function(T){return!T}),I=new b.ChunkMetadata(U.level,U.sn,U.stats.chunkCount+1,0,P?P.index:-1,!H);E.flush(I)},d._handleFragmentLoadProgress=function(l){},d._doFragLoad=function(l,E,U,P){var j=this;if(U===void 0&&(U=null),!this.levels)throw new Error("frag load aborted, missing levels");if(U=Math.max(l.start,U||0),this.config.lowLatencyMode&&E){var H=E.partList;if(H&&P){U>l.end&&E.fragmentHint&&(l=E.fragmentHint);var I=this.getNextPart(H,l,U);if(I>-1){var T=H[I];return this.log("Loading part sn: "+l.sn+" p: "+T.index+" cc: "+l.cc+" of playlist ["+E.startSN+"-"+E.endSN+"] parts [0-"+I+"-"+(H.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+l.level+", target: "+parseFloat(U.toFixed(3))),this.nextLoadPosition=T.start+T.duration,this.state=S.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:l,part:H[I],targetBufferTime:U}),this.doFragPartsLoad(l,H,I,P).catch(function(K){return j.handleFragLoadError(K)})}else if(!l.url||this.loadedEndOfParts(H,U))return Promise.resolve(null)}}return this.log("Loading fragment "+l.sn+" cc: "+l.cc+" "+(E?"of ["+E.startSN+"-"+E.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+l.level+", target: "+parseFloat(U.toFixed(3))),Object(Q.isFiniteNumber)(l.sn)&&!this.bitrateTest&&(this.nextLoadPosition=l.start+l.duration),this.state=S.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:l,targetBufferTime:U}),this.fragmentLoader.load(l,P).catch(function(K){return j.handleFragLoadError(K)})},d.doFragPartsLoad=function(l,E,U,P){var j=this;return new Promise(function(H,I){var T=[],K=function J(ie){var pe=E[ie];j.fragmentLoader.loadPart(l,pe,P).then(function(_e){T[pe.index]=_e;var Te=_e.part;j.hls.trigger(k.Events.FRAG_LOADED,_e);var he=E[ie+1];if(he&&he.fragment===l)J(ie+1);else return H({frag:l,part:Te,partsLoaded:T})}).catch(I)};K(U)})},d.handleFragLoadError=function(l){var E=l.data;return E&&E.details===R.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(E.frag,E.part):this.hls.trigger(k.Events.ERROR,E),null},d._handleTransmuxerFlush=function(l){var E=this.getCurrentContext(l);if(!E||this.state!==S.PARSING){this.fragCurrent||(this.state=S.IDLE);return}var U=E.frag,P=E.part,j=E.level,H=self.performance.now();U.stats.parsing.end=H,P&&(P.stats.parsing.end=H),this.updateLevelTiming(U,P,j,l.partial)},d.getCurrentContext=function(l){var E=this.levels,U=l.level,P=l.sn,j=l.part;if(!E||!E[U])return this.warn("Levels object was unset while buffering fragment "+P+" of level "+U+". The current chunk will not be buffered."),null;var H=E[U],I=j>-1?Object(r.getPartWith)(H,P,j):null,T=I?I.fragment:Object(r.getFragmentWithSN)(H,P,this.fragCurrent);return T?{frag:T,part:I,level:H}:null},d.bufferFragmentData=function(l,E,U,P){if(!l||this.state!==S.PARSING)return;var j=l.data1,H=l.data2,I=j;if(j&&H&&(I=Object(v.appendUint8Array)(j,H)),!I||!I.length)return;var T={type:l.type,frag:E,part:U,chunkMeta:P,parent:E.type,data:I};this.hls.trigger(k.Events.BUFFER_APPENDING,T),l.dropped&&l.independent&&!U&&this.flushBufferGap(E)},d.flushBufferGap=function(l){var E=this.media;if(!E)return;if(!G.BufferHelper.isBuffered(E,E.currentTime)){this.flushMainBuffer(0,l.start);return}var U=E.currentTime,P=G.BufferHelper.bufferInfo(E,U,0),j=l.duration,H=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),I=Math.max(Math.min(l.start-H,P.end-H),U+H);l.start-I>H&&this.flushMainBuffer(I,l.start)},d.getFwdBufferInfo=function(l,E){var U=this.config,P=this.getLoadPosition();if(!Object(Q.isFiniteNumber)(P))return null;var j=G.BufferHelper.bufferInfo(l,P,U.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var H=this.fragmentTracker.getBufferedFrag(P,E);if(H&&j.nextStart<H.end)return G.BufferHelper.bufferInfo(l,P,Math.max(j.nextStart,U.maxBufferHole))}return j},d.getMaxBufferLength=function(l){var E=this.config,U;return l?U=Math.max(8*E.maxBufferSize/l,E.maxBufferLength):U=E.maxBufferLength,Math.min(U,E.maxMaxBufferLength)},d.reduceMaxBufferLength=function(l){var E=this.config,U=l||E.maxBufferLength;return E.maxMaxBufferLength>=U?(E.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+E.maxMaxBufferLength+"s"),!0):!1},d.getNextFragment=function(l,E){var U,P,j=E.fragments,H=j.length;if(!H)return null;var I=this.config,T=j[0].start,K;if(E.live){var J=I.initialLiveManifestSize;if(H<J)return this.warn("Not enough fragments to start playback (have: "+H+", need: "+J+")"),null;!E.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(K=this.getInitialLiveFragment(E,j),this.startPosition=K?this.hls.liveSyncPosition||K.start:l)}else l<=T&&(K=j[0]);if(!K){var ie=I.lowLatencyMode?E.partEnd:E.fragmentEnd;K=this.getFragmentAtPosition(l,ie,E)}return(U=K)!==null&&U!==void 0&&U.initSegment&&!((P=K)!==null&&P!==void 0&&P.initSegment.data)&&!this.bitrateTest&&(K=K.initSegment),K},d.getNextPart=function(l,E,U){for(var P=-1,j=!1,H=!0,I=0,T=l.length;I<T;I++){var K=l[I];if(H=H&&!K.independent,P>-1&&U<K.start)break;var J=K.loaded;!J&&(j||K.independent||H)&&K.fragment===E&&(P=I),j=J}return P},d.loadedEndOfParts=function(l,E){var U=l[l.length-1];return U&&E>U.start&&U.loaded},d.getInitialLiveFragment=function(l,E){var U=this.fragPrevious,P=null;if(U){if(l.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+U.programDateTime),P=Object(u.findFragmentByPDT)(E,U.endProgramDateTime,this.config.maxFragLookUpTolerance)),!P){var j=U.sn+1;if(j>=l.startSN&&j<=l.endSN){var H=E[j-l.startSN];U.cc===H.cc&&(P=H,this.log("Live playlist, switching playlist, load frag with next SN: "+P.sn))}P||(P=Object(u.findFragWithCC)(E,U.cc),P&&this.log("Live playlist, switching playlist, load frag with same CC: "+P.sn))}}else{var I=this.hls.liveSyncPosition;I!==null&&(P=this.getFragmentAtPosition(I,this.bitrateTest?l.fragmentEnd:l.edge,l))}return P},d.getFragmentAtPosition=function(l,E,U){var P=this.config,j=this.fragPrevious,H=U.fragments,I=U.endSN,T=U.fragmentHint,K=P.maxFragLookUpTolerance,J=!!(P.lowLatencyMode&&U.partList&&T);J&&T&&!this.bitrateTest&&(H=H.concat(T),I=T.sn);var ie;if(l<E){var pe=l>E-K?0:K;ie=Object(u.findFragmentByPTS)(j,H,l,pe)}else ie=H[H.length-1];if(ie){var _e=ie.sn-U.startSN,Te=j&&ie.level===j.level,he=H[_e+1],re=this.fragmentTracker.getState(ie);if(re===D.FragmentState.BACKTRACKED){ie=null;for(var fe=_e;H[fe]&&this.fragmentTracker.getState(H[fe])===D.FragmentState.BACKTRACKED;)j?ie=H[fe--]:ie=H[--fe];ie||(ie=he)}else j&&ie.sn===j.sn&&!J&&(Te&&(ie.sn<I&&this.fragmentTracker.getState(he)!==D.FragmentState.OK?(this.log("SN "+ie.sn+" just loaded, load next one: "+he.sn),ie=he):ie=null))}return ie},d.synchronizeToLiveEdge=function(l){var E=this.config,U=this.media;if(!U)return;var P=this.hls.liveSyncPosition,j=U.currentTime,H=l.fragments[0].start,I=l.edge,T=j>=H-E.maxFragLookUpTolerance&&j<=I;if(P!==null&&U.duration>P&&(j<P||!T)){var K=E.liveMaxLatencyDuration!==void 0?E.liveMaxLatencyDuration:E.liveMaxLatencyDurationCount*l.targetduration;(!T&&U.readyState<4||j<I-K)&&(this.loadedmetadata||(this.nextLoadPosition=P),U.readyState&&(this.warn("Playback: "+j.toFixed(3)+" is located too far from the end of live sliding playlist: "+I+", reset currentTime to : "+P.toFixed(3)),U.currentTime=P))}},d.alignPlaylists=function(l,E){var U=this.levels,P=this.levelLastLoaded,j=this.fragPrevious,H=P!==null?U[P]:null,I=l.fragments.length;if(!I)return this.warn("No fragments in live playlist"),0;var T=l.fragments[0].start,K=!E,J=l.alignedSliding&&Object(Q.isFiniteNumber)(T);if(K||!J&&!T){Object(m.alignStream)(j,H,l);var ie=l.fragments[0].start;return this.log("Live playlist sliding: "+ie.toFixed(2)+" start-sn: "+(E?E.startSN:"na")+"->"+l.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+I),ie}return T},d.waitForCdnTuneIn=function(l){var E=3;return l.live&&l.canBlockReload&&l.tuneInGoal>Math.max(l.partHoldBack,l.partTarget*E)},d.setStartPosition=function(l,E){var U=this.startPosition;if(U<E&&(U=-1),U===-1||this.lastCurrentTime===-1){var P=l.startTimeOffset;Object(Q.isFiniteNumber)(P)?(U=E+P,P<0&&(U+=l.totalduration),U=Math.min(Math.max(E,U),E+l.totalduration),this.log("Start time offset "+P+" found in playlist, adjust startPosition to "+U),this.startPosition=U):l.live?U=this.hls.liveSyncPosition||E:this.startPosition=U=0,this.lastCurrentTime=U}this.nextLoadPosition=U},d.getLoadPosition=function(){var l=this.media,E=0;return this.loadedmetadata&&l?E=l.currentTime:this.nextLoadPosition&&(E=this.nextLoadPosition),E},d.handleFragLoadAborted=function(l,E){this.transmuxer&&l.sn!=="initSegment"&&l.stats.aborted&&(this.warn("Fragment "+l.sn+(E?" part"+E.index:"")+" of level "+l.level+" was aborted"),this.resetFragmentLoading(l))},d.resetFragmentLoading=function(l){(!this.fragCurrent||!this.fragContextChanged(l))&&(this.state=S.IDLE)},d.onFragmentOrKeyLoadError=function(l,E){if(E.fatal)return;var U=E.frag;if(!U||U.type!==l)return;var P=this.fragCurrent;console.assert(P&&U.sn===P.sn&&U.level===P.level&&U.urlId===P.urlId,"Frag load error must match current frag to retry");var j=this.config;if(this.fragLoadError+1<=j.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(U.level))return;var H=Math.min(Math.pow(2,this.fragLoadError)*j.fragLoadingRetryDelay,j.fragLoadingMaxRetryTimeout);this.warn("Fragment "+U.sn+" of "+l+" "+U.level+" failed to load, retrying in "+H+"ms"),this.retryDate=self.performance.now()+H,this.fragLoadError++,this.state=S.FRAG_LOADING_WAITING_RETRY}else E.levelRetry?(l===o.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=S.IDLE):(B.logger.error(E.details+" reaches max retry, redispatch as fatal ..."),E.fatal=!0,this.hls.stopLoad(),this.state=S.ERROR)},d.afterBufferFlushed=function(l,E,U){if(!l)return;var P=G.BufferHelper.getBuffered(l);this.fragmentTracker.detectEvictedFragments(E,P,U),this.state===S.ENDED&&this.resetLoadingState()},d.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=S.IDLE},d.resetLiveStartWhenNotLoaded=function(l){if(!this.loadedmetadata){this.startFragRequested=!1;var E=this.levels?this.levels[l].details:null;if(E!=null&&E.live)return this.startPosition=-1,this.setStartPosition(E,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},d.updateLevelTiming=function(l,E,U,P){var j=this,H=U.details;console.assert(!!H,"level.details must be defined");var I=Object.keys(l.elementaryStreams).reduce(function(T,K){var J=l.elementaryStreams[K];if(J){var ie=J.endPTS-J.startPTS;if(ie<=0)return j.warn("Could not parse fragment "+l.sn+" "+K+" duration reliably ("+ie+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),T||!1;var pe=P?0:Object(r.updateFragPTSDTS)(H,l,J.startPTS,J.endPTS,J.startDTS,J.endDTS);return j.hls.trigger(k.Events.LEVEL_PTS_UPDATED,{details:H,level:U,drift:pe,type:K,frag:l,start:J.startPTS,end:J.endPTS}),!0}return T},!1);I?(this.state=S.PARSED,this.hls.trigger(k.Events.FRAG_PARSED,{frag:l,part:E})):this.resetLoadingState()},d.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},O(p,[{key:"state",get:function(){return this._state},set:function(l){var E=this._state;E!==l&&(this._state=l,this.log(E+"->"+l))}}]),p}(F.default)},"./src/controller/buffer-controller.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return u});var Q=N("./src/polyfills/number.ts"),F=N("./src/events.ts"),D=N("./src/utils/logger.ts"),G=N("./src/errors.ts"),B=N("./src/utils/buffer-helper.ts"),k=N("./src/utils/mediasource-helper.ts"),R=N("./src/loader/fragment.ts"),b=N("./src/controller/buffer-operation-queue.ts"),v=Object(k.getMediaSource)(),m=/([ha]vc.)(?:\.[^.,]+)+/,u=function(){function r(s){var a=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var o=a.hls,h=a.media,O=a.mediaSource;D.logger.log("[buffer-controller]: Media source opened"),h&&(a.updateMediaElementDuration(),o.trigger(F.Events.MEDIA_ATTACHED,{media:h})),O&&O.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){D.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){D.logger.log("[buffer-controller]: Media source ended")},this.hls=s,this._initSourceBuffer(),this.registerListeners()}var c=r.prototype;return c.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},c.destroy=function(){this.unregisterListeners(),this.details=null},c.registerListeners=function(){var a=this.hls;a.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(F.Events.BUFFER_RESET,this.onBufferReset,this),a.on(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(F.Events.BUFFER_EOS,this.onBufferEos,this),a.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(F.Events.FRAG_PARSED,this.onFragParsed,this),a.on(F.Events.FRAG_CHANGED,this.onFragChanged,this)},c.unregisterListeners=function(){var a=this.hls;a.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(F.Events.BUFFER_RESET,this.onBufferReset,this),a.off(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(F.Events.BUFFER_EOS,this.onBufferEos,this),a.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(F.Events.FRAG_PARSED,this.onFragParsed,this),a.off(F.Events.FRAG_CHANGED,this.onFragChanged,this)},c._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new b.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},c.onManifestParsed=function(a,o){var h=2;(o.audio&&!o.video||!o.altAudio)&&(h=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=h,this.details=null,D.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},c.onMediaAttaching=function(a,o){var h=this.media=o.media;if(h&&v){var O=this.mediaSource=new v;O.addEventListener("sourceopen",this._onMediaSourceOpen),O.addEventListener("sourceended",this._onMediaSourceEnded),O.addEventListener("sourceclose",this._onMediaSourceClose),h.src=self.URL.createObjectURL(O),this._objectUrl=h.src}},c.onMediaDetaching=function(){var a=this.media,o=this.mediaSource,h=this._objectUrl;if(o){if(D.logger.log("[buffer-controller]: media source detaching"),o.readyState==="open")try{o.endOfStream()}catch(O){D.logger.warn("[buffer-controller]: onMediaDetaching: "+O.message+" while calling endOfStream")}this.onBufferReset(),o.removeEventListener("sourceopen",this._onMediaSourceOpen),o.removeEventListener("sourceended",this._onMediaSourceEnded),o.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(h&&self.URL.revokeObjectURL(h),a.src===h?(a.removeAttribute("src"),a.load()):D.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(F.Events.MEDIA_DETACHED,void 0)},c.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(o){var h=a.sourceBuffer[o];try{h&&(a.removeBufferListeners(o),a.mediaSource&&a.mediaSource.removeSourceBuffer(h),a.sourceBuffer[o]=void 0)}catch(O){D.logger.warn("[buffer-controller]: Failed to reset the "+o+" buffer",O)}}),this._initSourceBuffer()},c.onBufferCodecs=function(a,o){var h=this,O=this.getSourceBufferTypes().length;if(Object.keys(o).forEach(function(w){if(O){var x=h.tracks[w];if(x&&typeof x.buffer.changeType=="function"){var A=o[w],S=A.codec,y=A.levelCodec,_=A.container,p=(x.levelCodec||x.codec).replace(m,"$1"),d=(y||S).replace(m,"$1");if(p!==d){var g=_+";codecs="+(y||S);h.appendChangeType(w,g)}}}else h.pendingTracks[w]=o[w]}),O)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},c.appendChangeType=function(a,o){var h=this,O=this.operationQueue,w={execute:function(){var A=h.sourceBuffer[a];A&&(D.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+o),A.changeType(o)),O.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(A){D.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",A)}};O.append(w,a)},c.onBufferAppending=function(a,o){var h=this,O=this.hls,w=this.operationQueue,x=this.tracks,A=o.data,S=o.type,y=o.frag,_=o.part,p=o.chunkMeta,d=p.buffering[S],g=self.performance.now();d.start=g;var l=y.stats.buffering,E=_?_.stats.buffering:null;l.start===0&&(l.start=g),E&&E.start===0&&(E.start=g);var U=x.audio,P=S==="audio"&&p.id===1&&(U==null?void 0:U.container)==="audio/mpeg",j={execute:function(){if(d.executeStart=self.performance.now(),P){var I=h.sourceBuffer[S];if(I){var T=y.start-I.timestampOffset;Math.abs(T)>=.1&&(D.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+y.start+" (delta: "+T+") sn: "+y.sn+")"),I.timestampOffset=y.start)}}h.appendExecutor(A,S)},onStart:function(){},onComplete:function(){var I=self.performance.now();d.executeEnd=d.end=I,l.first===0&&(l.first=I),E&&E.first===0&&(E.first=I);var T=h.sourceBuffer,K={};for(var J in T)K[J]=B.BufferHelper.getBuffered(T[J]);h.appendError=0,h.hls.trigger(F.Events.BUFFER_APPENDED,{type:S,frag:y,part:_,chunkMeta:p,parent:y.type,timeRanges:K})},onError:function(I){D.logger.error("[buffer-controller]: Error encountered while trying to append to the "+S+" SourceBuffer",I);var T={type:G.ErrorTypes.MEDIA_ERROR,parent:y.type,details:G.ErrorDetails.BUFFER_APPEND_ERROR,err:I,fatal:!1};I.code===DOMException.QUOTA_EXCEEDED_ERR?T.details=G.ErrorDetails.BUFFER_FULL_ERROR:(h.appendError++,T.details=G.ErrorDetails.BUFFER_APPEND_ERROR,h.appendError>O.config.appendErrorMaxRetry&&(D.logger.error("[buffer-controller]: Failed "+O.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),T.fatal=!0)),O.trigger(F.Events.ERROR,T)}};w.append(j,S)},c.onBufferFlushing=function(a,o){var h=this,O=this.operationQueue,w=function(A){return{execute:h.removeExecutor.bind(h,A,o.startOffset,o.endOffset),onStart:function(){},onComplete:function(){h.hls.trigger(F.Events.BUFFER_FLUSHED,{type:A})},onError:function(y){D.logger.warn("[buffer-controller]: Failed to remove from "+A+" SourceBuffer",y)}}};o.type?O.append(w(o.type),o.type):this.getSourceBufferTypes().forEach(function(x){O.append(w(x),x)})},c.onFragParsed=function(a,o){var h=this,O=o.frag,w=o.part,x=[],A=w?w.elementaryStreams:O.elementaryStreams;A[R.ElementaryStreamTypes.AUDIOVIDEO]?x.push("audiovideo"):(A[R.ElementaryStreamTypes.AUDIO]&&x.push("audio"),A[R.ElementaryStreamTypes.VIDEO]&&x.push("video"));var S=function(){var _=self.performance.now();O.stats.buffering.end=_,w&&(w.stats.buffering.end=_);var p=w?w.stats:O.stats;h.hls.trigger(F.Events.FRAG_BUFFERED,{frag:O,part:w,stats:p,id:O.type})};x.length===0&&D.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+O.type+" level: "+O.level+" sn: "+O.sn),this.blockBuffers(S,x)},c.onFragChanged=function(a,o){this.flushBackBuffer()},c.onBufferEos=function(a,o){var h=this,O=this.getSourceBufferTypes().reduce(function(w,x){var A=h.sourceBuffer[x];return(!o.type||o.type===x)&&(A&&!A.ended&&(A.ended=!0,D.logger.log("[buffer-controller]: "+x+" sourceBuffer now EOS"))),w&&!!(!A||A.ended)},!0);O&&this.blockBuffers(function(){var w=h.mediaSource;if(!w||w.readyState!=="open")return;w.endOfStream()})},c.onLevelUpdated=function(a,o){var h=o.details;if(!h.fragments.length)return;this.details=h,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},c.flushBackBuffer=function(){var a=this.hls,o=this.details,h=this.media,O=this.sourceBuffer;if(!h||o===null)return;var w=this.getSourceBufferTypes();if(!w.length)return;var x=o.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(Q.isFiniteNumber)(x)||x<0)return;var A=h.currentTime,S=o.levelTargetDuration,y=Math.max(x,S),_=Math.floor(A/S)*S-y;w.forEach(function(p){var d=O[p];if(d){var g=B.BufferHelper.getBuffered(d);g.length>0&&_>g.start(0)&&(a.trigger(F.Events.BACK_BUFFER_REACHED,{bufferEnd:_}),o.live&&a.trigger(F.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:_}),a.trigger(F.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:_,type:p}))}})},c.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,o=this.hls,h=this.media,O=this.mediaSource,w=a.fragments[0].start+a.totalduration,x=h.duration,A=Object(Q.isFiniteNumber)(O.duration)?O.duration:0;a.live&&o.config.liveDurationInfinity?(D.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),O.duration=Infinity,this.updateSeekableRange(a)):(w>A&&w>x||!Object(Q.isFiniteNumber)(x))&&(D.logger.log("[buffer-controller]: Updating Media Source duration to "+w.toFixed(3)),O.duration=w)},c.updateSeekableRange=function(a){var o=this.mediaSource,h=a.fragments,O=h.length;if(O&&a.live&&o!==null&&o!==void 0&&o.setLiveSeekableRange){var w=Math.max(0,h[0].start),x=Math.max(w,w+a.totalduration);o.setLiveSeekableRange(w,x)}},c.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,o=this.operationQueue,h=this.pendingTracks,O=Object.keys(h).length;if(O&&!a||O===2){this.createSourceBuffers(h),this.pendingTracks={};var w=this.getSourceBufferTypes();if(w.length===0){this.hls.trigger(F.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}w.forEach(function(x){o.executeNext(x)})}},c.createSourceBuffers=function(a){var o=this.sourceBuffer,h=this.mediaSource;if(!h)throw Error("createSourceBuffers called when mediaSource was null");var O=0;for(var w in a)if(!o[w]){var x=a[w];if(!x)throw Error("source buffer exists for track "+w+", however track does not");var A=x.levelCodec||x.codec,S=x.container+";codecs="+A;D.logger.log("[buffer-controller]: creating sourceBuffer("+S+")");try{var y=o[w]=h.addSourceBuffer(S),_=w;this.addBufferListener(_,"updatestart",this._onSBUpdateStart),this.addBufferListener(_,"updateend",this._onSBUpdateEnd),this.addBufferListener(_,"error",this._onSBUpdateError),this.tracks[w]={buffer:y,codec:A,container:x.container,levelCodec:x.levelCodec,id:x.id},O++}catch(p){D.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+p.message),this.hls.trigger(F.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:p,mimeType:S})}}O&&this.hls.trigger(F.Events.BUFFER_CREATED,{tracks:this.tracks})},c._onSBUpdateStart=function(a){var o=this.operationQueue,h=o.current(a);h.onStart()},c._onSBUpdateEnd=function(a){var o=this.operationQueue,h=o.current(a);h.onComplete(),o.shiftAndExecuteNext(a)},c._onSBUpdateError=function(a,o){D.logger.error("[buffer-controller]: "+a+" SourceBuffer error",o),this.hls.trigger(F.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var h=this.operationQueue.current(a);h&&h.onError(o)},c.removeExecutor=function(a,o,h){var O=this.media,w=this.mediaSource,x=this.operationQueue,A=this.sourceBuffer,S=A[a];if(!O||!w||!S){D.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),x.shiftAndExecuteNext(a);return}var y=Object(Q.isFiniteNumber)(O.duration)?O.duration:Infinity,_=Object(Q.isFiniteNumber)(w.duration)?w.duration:Infinity,p=Math.max(0,o),d=Math.min(h,y,_);d>p?(D.logger.log("[buffer-controller]: Removing ["+p+","+d+"] from the "+a+" SourceBuffer"),console.assert(!S.updating,a+" sourceBuffer must not be updating"),S.remove(p,d)):x.shiftAndExecuteNext(a)},c.appendExecutor=function(a,o){var h=this.operationQueue,O=this.sourceBuffer,w=O[o];if(!w){D.logger.warn("[buffer-controller]: Attempting to append to the "+o+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(o);return}w.ended=!1,console.assert(!w.updating,o+" sourceBuffer must not be updating"),w.appendBuffer(a)},c.blockBuffers=function(a,o){var h=this;if(o===void 0&&(o=this.getSourceBufferTypes()),!o.length){D.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var O=this.operationQueue,w=o.map(function(x){return O.appendBlocker(x)});Promise.all(w).then(function(){a(),o.forEach(function(x){var A=h.sourceBuffer[x];(!A||!A.updating)&&O.shiftAndExecuteNext(x)})})},c.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},c.addBufferListener=function(a,o,h){var O=this.sourceBuffer[a];if(!O)return;var w=h.bind(this,a);this.listeners[a].push({event:o,listener:w}),O.addEventListener(o,w)},c.removeBufferListeners=function(a){var o=this.sourceBuffer[a];if(!o)return;this.listeners[a].forEach(function(h){o.removeEventListener(h.event,h.listener)})},r}()},"./src/controller/buffer-operation-queue.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return F});var Q=N("./src/utils/logger.ts"),F=function(){function D(B){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=B}var G=D.prototype;return G.append=function(k,R){var b=this.queues[R];b.push(k),b.length===1&&this.buffers[R]&&this.executeNext(R)},G.insertAbort=function(k,R){var b=this.queues[R];b.unshift(k),this.executeNext(R)},G.appendBlocker=function(k){var R,b=new Promise(function(m){R=m}),v={execute:R,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(v,k),b},G.executeNext=function(k){var R=this.buffers,b=this.queues,v=R[k],m=b[k];if(m.length){var u=m[0];try{u.execute()}catch(r){Q.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),u.onError(r),(!v||!v.updating)&&(m.shift(),this.executeNext(k))}}},G.shiftAndExecuteNext=function(k){this.queues[k].shift(),this.executeNext(k)},G.current=function(k){return this.queues[k][0]},D}()},"./src/controller/cap-level-controller.ts":function(ce,Y,N){"use strict";N.r(Y);var Q=N("./src/events.ts");function F(B,k){for(var R=0;R<k.length;R++){var b=k[R];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(B,b.key,b)}}function D(B,k,R){return k&&F(B.prototype,k),R&&F(B,R),B}var G=function(){function B(R){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=R,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(b){this.streamController=b},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 b=this.hls;b.on(Q.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),b.on(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),b.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.on(Q.Events.BUFFER_CODECS,this.onBufferCodecs,this),b.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.unregisterListener=function(){var b=this.hls;b.off(Q.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),b.off(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),b.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.off(Q.Events.BUFFER_CODECS,this.onBufferCodecs,this),b.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},k.onFpsDropLevelCapping=function(b,v){B.isLevelAllowed(v.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(v.droppedLevel)},k.onMediaAttaching=function(b,v){this.media=v.media instanceof HTMLVideoElement?v.media:null},k.onManifestParsed=function(b,v){var m=this.hls;this.restrictedLevels=[],this.firstLevel=v.firstLevel,m.config.capLevelToPlayerSize&&v.video&&this.startCapping()},k.onBufferCodecs=function(b,v){var m=this.hls;m.config.capLevelToPlayerSize&&v.video&&this.startCapping()},k.onMediaDetaching=function(){this.stopCapping()},k.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var b=this.hls.levels;if(b.length){var v=this.hls;v.autoLevelCapping=this.getMaxLevel(b.length-1),v.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=v.autoLevelCapping}}},k.getMaxLevel=function(b){var v=this,m=this.hls.levels;if(!m.length)return-1;var u=m.filter(function(r,c){return B.isLevelAllowed(c,v.restrictedLevels)&&c<=b});return this.clientRect=null,B.getMaxLevelByMediaSize(u,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 b=this.media,v={width:0,height:0};if(b){var m=b.getBoundingClientRect();v.width=m.width,v.height=m.height,!v.width&&!v.height&&(v.width=m.right-m.left||b.width||0,v.height=m.bottom-m.top||b.height||0)}return this.clientRect=v,v},B.isLevelAllowed=function(b,v){return v===void 0&&(v=[]),v.indexOf(b)===-1},B.getMaxLevelByMediaSize=function(b,v,m){if(!b||!b.length)return-1;for(var u=function(o,h){return h?o.width!==h.width||o.height!==h.height:!0},r=b.length-1,c=0;c<b.length;c+=1){var s=b[c];if((s.width>=v||s.height>=m)&&u(s,b[c+1])){r=c;break}}return r},D(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 b=1;try{b=self.devicePixelRatio}catch(v){}return b}}]),B}();Y.default=G},"./src/controller/cmcd-controller.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return u});var Q=N("./src/events.ts"),F=N("./src/types/cmcd.ts"),D=N("./src/utils/buffer-helper.ts"),G=N("./src/utils/logger.ts");function B(r,c){for(var s=0;s<c.length;s++){var a=c[s];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}function k(r,c,s){return c&&B(r.prototype,c),s&&B(r,s),r}function R(r,c){var s=typeof Symbol!="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(s)return(s=s.call(r)).next.bind(s);if(Array.isArray(r)||(s=b(r))||c&&r&&typeof r.length=="number"){s&&(r=s);var a=0;return function(){return a>=r.length?{done:!0}:{done:!1,value:r[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function b(r,c){if(!r)return;if(typeof r=="string")return v(r,c);var s=Object.prototype.toString.call(r).slice(8,-1);if(s==="Object"&&r.constructor&&(s=r.constructor.name),s==="Map"||s==="Set")return Array.from(r);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return v(r,c)}function v(r,c){(c==null||c>r.length)&&(c=r.length);for(var s=0,a=new Array(c);s<c;s++)a[s]=r[s];return a}function m(){return m=Object.assign||function(r){for(var c=1;c<arguments.length;c++){var s=arguments[c];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(r[a]=s[a])}return r},m.apply(this,arguments)}var u=function(){function r(s){var a=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){a.initialized&&(a.starved=!0),a.buffering=!0},this.onPlaying=function(){a.initialized||(a.initialized=!0),a.buffering=!1},this.applyPlaylistData=function(O){try{a.apply(O,{ot:F.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(w){G.logger.warn("Could not generate manifest CMCD data.",w)}},this.applyFragmentData=function(O){try{var w=O.frag,x=a.hls.levels[w.level],A=a.getObjectType(w),S={d:w.duration*1e3,ot:A};(A===F.CMCDObjectType.VIDEO||A===F.CMCDObjectType.AUDIO||A==F.CMCDObjectType.MUXED)&&(S.br=x.bitrate/1e3,S.tb=a.getTopBandwidth(A),S.bl=a.getBufferLength(A)),a.apply(O,S)}catch(y){G.logger.warn("Could not generate segment CMCD data.",y)}},this.hls=s;var o=this.config=s.config,h=o.cmcd;h!=null&&(o.pLoader=this.createPlaylistLoader(),o.fLoader=this.createFragmentLoader(),this.sid=h.sessionId||r.uuid(),this.cid=h.contentId,this.useHeaders=h.useHeaders===!0,this.registerListeners())}var c=r.prototype;return c.registerListeners=function(){var a=this.hls;a.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.on(Q.Events.BUFFER_CREATED,this.onBufferCreated,this)},c.unregisterListeners=function(){var a=this.hls;a.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.off(Q.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},c.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},c.onMediaAttached=function(a,o){this.media=o.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},c.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},c.onBufferCreated=function(a,o){var h,O;this.audioBuffer=(h=o.tracks.audio)===null||h===void 0?void 0:h.buffer,this.videoBuffer=(O=o.tracks.video)===null||O===void 0?void 0:O.buffer},c.createData=function(){var a;return{v:F.CMCDVersion,sf:F.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(a=this.media)===null||a===void 0?void 0:a.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},c.apply=function(a,o){o===void 0&&(o={}),m(o,this.createData());var h=o.ot===F.CMCDObjectType.INIT||o.ot===F.CMCDObjectType.VIDEO||o.ot===F.CMCDObjectType.MUXED;if(this.starved&&h&&(o.bs=!0,o.su=!0,this.starved=!1),o.su==null&&(o.su=this.buffering),this.useHeaders){var O=r.toHeaders(o);if(!Object.keys(O).length)return;a.headers||(a.headers={}),m(a.headers,O)}else{var w=r.toQuery(o);if(!w)return;a.url=r.appendQueryToUri(a.url,w)}},c.getObjectType=function(a){var o=a.type;return o==="subtitle"?F.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?F.CMCDObjectType.INIT:o==="audio"?F.CMCDObjectType.AUDIO:o==="main"?this.hls.audioTracks.length?F.CMCDObjectType.VIDEO:F.CMCDObjectType.MUXED:void 0},c.getTopBandwidth=function(a){for(var o=0,h=a===F.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,O=R(h),w;!(w=O()).done;){var x=w.value;x.bitrate>o&&(o=x.bitrate)}return o>0?o:NaN},c.getBufferLength=function(a){var o=this.hls.media,h=a===F.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!h||!o)return NaN;var O=D.BufferHelper.bufferInfo(h,o.currentTime,this.config.maxBufferHole);return O.len*1e3},c.createPlaylistLoader=function(){var a=this.config.pLoader,o=this.applyPlaylistData,h=a||this.config.loader;return function(){function O(x){this.loader=void 0,this.loader=new h(x)}var w=O.prototype;return w.destroy=function(){this.loader.destroy()},w.abort=function(){this.loader.abort()},w.load=function(A,S,y){o(A),this.loader.load(A,S,y)},k(O,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),O}()},c.createFragmentLoader=function(){var a=this.config.fLoader,o=this.applyFragmentData,h=a||this.config.loader;return function(){function O(x){this.loader=void 0,this.loader=new h(x)}var w=O.prototype;return w.destroy=function(){this.loader.destroy()},w.abort=function(){this.loader.abort()},w.load=function(A,S,y){o(A),this.loader.load(A,S,y)},k(O,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),O}()},r.uuid=function(){var a=URL.createObjectURL(new Blob),o=a.toString();return URL.revokeObjectURL(a),o.substr(o.lastIndexOf("/")+1)},r.serialize=function(a){for(var o=[],h=function(P){return!Number.isNaN(P)&&P!=null&&P!==""&&P!==!1},O=function(P){return Math.round(P)},w=function(P){return O(P/100)*100},x=function(P){return encodeURIComponent(P)},A={br:O,d:O,bl:w,dl:w,mtp:w,nor:x,rtp:w,tb:O},S=Object.keys(a||{}).sort(),y=R(S),_;!(_=y()).done;){var p=_.value,d=a[p];if(!h(d))continue;if(p==="v"&&d===1)continue;if(p=="pr"&&d===1)continue;var g=A[p];g&&(d=g(d));var l=typeof d,E=void 0;p==="ot"||p==="sf"||p==="st"?E=p+"="+d:l==="boolean"?E=p:l==="number"?E=p+"="+d:E=p+"="+JSON.stringify(d),o.push(E)}return o.join(",")},r.toHeaders=function(a){for(var o=Object.keys(a),h={},O=["Object","Request","Session","Status"],w=[{},{},{},{}],x={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},A=0,S=o;A<S.length;A++){var y=S[A],_=x[y]!=null?x[y]:1;w[_][y]=a[y]}for(var p=0;p<w.length;p++){var d=r.serialize(w[p]);d&&(h["CMCD-"+O[p]]=d)}return h},r.toQuery=function(a){return"CMCD="+encodeURIComponent(r.serialize(a))},r.appendQueryToUri=function(a,o){if(!o)return a;var h=a.includes("?")?"&":"?";return""+a+h+o},r}()},"./src/controller/eme-controller.ts":function(ce,Y,N){"use strict";N.r(Y);var Q=N("./src/events.ts"),F=N("./src/errors.ts"),D=N("./src/utils/logger.ts"),G=N("./src/utils/mediakeys-helper.ts");function B(u,r){for(var c=0;c<r.length;c++){var s=r[c];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(u,s.key,s)}}function k(u,r,c){return r&&B(u.prototype,r),c&&B(u,c),u}var R=3,b=function(r,c,s){var a={audioCapabilities:[],videoCapabilities:[]};return r.forEach(function(o){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+o+'"',robustness:s.audioRobustness||""})}),c.forEach(function(o){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+o+'"',robustness:s.videoRobustness||""})}),[a]},v=function(r,c,s,a){switch(r){case G.KeySystems.WIDEVINE:return b(c,s,a);default:throw new Error("Unknown key-system: "+r)}},m=function(){function u(c){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=c,this._config=c.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var r=u.prototype;return r.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},r._registerListeners=function(){this.hls.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this)},r._unregisterListeners=function(){this.hls.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this)},r.getLicenseServerUrl=function(s){switch(s){case G.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+s+'"')},r._attemptKeySystemAccess=function(s,a,o){var h=this,O=v(s,a,o,this._drmSystemOptions);D.logger.log("Requesting encrypted media key-system access");var w=this.requestMediaKeySystemAccess(s,O);this.mediaKeysPromise=w.then(function(x){return h._onMediaKeySystemAccessObtained(s,x)}),w.catch(function(x){D.logger.error('Failed to obtain key-system "'+s+'" access:',x)})},r._onMediaKeySystemAccessObtained=function(s,a){var o=this;D.logger.log('Access for key-system "'+s+'" obtained');var h={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:s};this._mediaKeysList.push(h);var O=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(w){return h.mediaKeys=w,D.logger.log('Media-keys created for key-system "'+s+'"'),o._onMediaKeysCreated(),w});return O.catch(function(w){D.logger.error("Failed to create media-keys:",w)}),O},r._onMediaKeysCreated=function(){var s=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),s._onNewMediaKeySession(a.mediaKeysSession))})},r._onNewMediaKeySession=function(s){var a=this;D.logger.log("New key-system session "+s.sessionId),s.addEventListener("message",function(o){a._onKeySessionMessage(s,o.message)},!1)},r._onKeySessionMessage=function(s,a){D.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(o){D.logger.log("Received license data (length: "+(o&&o.byteLength)+"), updating key-session"),s.update(o)})},r.onMediaEncrypted=function(s){var a=this;if(D.logger.log('Media is encrypted using "'+s.initDataType+'" init data type'),!this.mediaKeysPromise){D.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Q.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var o=function(O){if(!a._media)return;a._attemptSetMediaKeys(O),a._generateRequestWithPreferredKeySession(s.initDataType,s.initData)};this.mediaKeysPromise.then(o).catch(o)},r._attemptSetMediaKeys=function(s){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var a=this._mediaKeysList[0];if(!a||!a.mediaKeys){D.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Q.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}D.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(a.mediaKeys),this._hasSetMediaKeys=!0}},r._generateRequestWithPreferredKeySession=function(s,a){var o=this,h=this._mediaKeysList[0];if(!h){D.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Q.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(h.mediaKeysSessionInitialized){D.logger.warn("Key-Session already initialized but requested again");return}var O=h.mediaKeysSession;if(!O){D.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Q.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){D.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Q.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}D.logger.log('Generating key-session request for "'+s+'" init data type'),h.mediaKeysSessionInitialized=!0,O.generateRequest(s,a).then(function(){D.logger.debug("Key-session generation succeeded")}).catch(function(w){D.logger.error("Error generating key-session request:",w),o.hls.trigger(Q.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},r._createLicenseXhr=function(s,a,o){var h=new XMLHttpRequest;h.responseType="arraybuffer",h.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,h,s,a,o);var O=this._licenseXhrSetup;if(O)try{O.call(this.hls,h,s),O=void 0}catch(w){D.logger.error(w)}try{h.readyState||h.open("POST",s,!0),O&&O.call(this.hls,h,s)}catch(w){throw new Error("issue setting up KeySystem license XHR "+w)}return h},r._onLicenseRequestReadyStageChange=function(s,a,o,h){switch(s.readyState){case 4:if(s.status===200){this._requestLicenseFailureCount=0,D.logger.log("License request succeeded");var O=s.response,w=this._licenseResponseCallback;if(w)try{O=w.call(this.hls,s,a)}catch(A){D.logger.error(A)}h(O)}else{if(D.logger.error("License Request XHR failed ("+a+"). Status: "+s.status+" ("+s.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>R){this.hls.trigger(Q.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var x=R-this._requestLicenseFailureCount+1;D.logger.warn("Retrying license request, "+x+" attempts left"),this._requestLicense(o,h)}break}},r._generateLicenseRequestChallenge=function(s,a){switch(s.mediaKeySystemDomain){case G.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+s.mediaKeySystemDomain)},r._requestLicense=function(s,a){D.logger.log("Requesting content license for key-system");var o=this._mediaKeysList[0];if(!o){D.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Q.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var h=this.getLicenseServerUrl(o.mediaKeySystemDomain),O=this._createLicenseXhr(h,s,a);D.logger.log("Sending license request to URL: "+h);var w=this._generateLicenseRequestChallenge(o,s);O.send(w)}catch(x){D.logger.error("Failure requesting DRM license: "+x),this.hls.trigger(Q.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},r.onMediaAttached=function(s,a){if(!this._emeEnabled)return;var o=a.media;this._media=o,o.addEventListener("encrypted",this._onMediaEncrypted)},r.onMediaDetached=function(){var s=this._media,a=this._mediaKeysList;if(!s)return;s.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(o){if(o.mediaKeysSession)return o.mediaKeysSession.close().catch(function(){})})).then(function(){return s.setMediaKeys(null)}).catch(function(){})},r.onManifestParsed=function(s,a){if(!this._emeEnabled)return;var o=a.levels.map(function(O){return O.audioCodec}).filter(function(O){return!!O}),h=a.levels.map(function(O){return O.videoCodec}).filter(function(O){return!!O});this._attemptKeySystemAccess(G.KeySystems.WIDEVINE,o,h)},k(u,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),u}();Y.default=m},"./src/controller/fps-controller.ts":function(ce,Y,N){"use strict";N.r(Y);var Q=N("./src/events.ts"),F=N("./src/utils/logger.ts"),D=function(){function G(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=G.prototype;return B.setStreamController=function(R){this.streamController=R},B.registerListeners=function(){this.hls.on(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},B.unregisterListeners=function(){this.hls.off(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching)},B.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},B.onMediaAttaching=function(R,b){var v=this.hls.config;if(v.capLevelOnFPSDrop){var m=b.media instanceof self.HTMLVideoElement?b.media:null;this.media=m,m&&typeof m.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),v.fpsDroppedMonitoringPeriod)}},B.checkFPS=function(R,b,v){var m=performance.now();if(b){if(this.lastTime){var u=m-this.lastTime,r=v-this.lastDroppedFrames,c=b-this.lastDecodedFrames,s=1e3*r/u,a=this.hls;if(a.trigger(Q.Events.FPS_DROP,{currentDropped:r,currentDecoded:c,totalDroppedFrames:v}),s>0&&r>a.config.fpsDroppedMonitoringThreshold*c){var o=a.currentLevel;F.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+o),o>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=o)&&(o=o-1,a.trigger(Q.Events.FPS_DROP_LEVEL_CAPPING,{level:o,droppedLevel:a.currentLevel}),a.autoLevelCapping=o,this.streamController.nextLevelSwitch())}}this.lastTime=m,this.lastDroppedFrames=v,this.lastDecodedFrames=b}},B.checkFPSInterval=function(){var R=this.media;if(R)if(this.isVideoPlaybackQualityAvailable){var b=R.getVideoPlaybackQuality();this.checkFPS(R,b.totalVideoFrames,b.droppedVideoFrames)}else this.checkFPS(R,R.webkitDecodedFrameCount,R.webkitDroppedFrameCount)},G}();Y.default=D},"./src/controller/fragment-finders.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"findFragmentByPDT",function(){return D}),N.d(Y,"findFragmentByPTS",function(){return G}),N.d(Y,"fragmentWithinToleranceTest",function(){return B}),N.d(Y,"pdtWithinToleranceTest",function(){return k}),N.d(Y,"findFragWithCC",function(){return R});var Q=N("./src/polyfills/number.ts"),F=N("./src/utils/binary-search.ts");function D(b,v,m){if(v===null||!Array.isArray(b)||!b.length||!Object(Q.isFiniteNumber)(v))return null;var u=b[0].programDateTime;if(v<(u||0))return null;var r=b[b.length-1].endProgramDateTime;if(v>=(r||0))return null;m=m||0;for(var c=0;c<b.length;++c){var s=b[c];if(k(v,m,s))return s}return null}function G(b,v,m,u){m===void 0&&(m=0),u===void 0&&(u=0);var r=null;if(b?r=v[b.sn-v[0].sn+1]||null:m===0&&v[0].start===0&&(r=v[0]),r&&B(m,u,r)===0)return r;var c=F.default.search(v,B.bind(null,m,u));return c||r}function B(b,v,m){b===void 0&&(b=0),v===void 0&&(v=0);var u=Math.min(v,m.duration+(m.deltaPTS?m.deltaPTS:0));return m.start+m.duration-u<=b?1:m.start-u>b&&m.start?-1:0}function k(b,v,m){var u=Math.min(v,m.duration+(m.deltaPTS?m.deltaPTS:0))*1e3,r=m.endProgramDateTime||0;return r-u>b}function R(b,v){return F.default.search(b,function(m){return m.cc<v?1:m.cc>v?-1:0})}},"./src/controller/fragment-tracker.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"FragmentState",function(){return D}),N.d(Y,"FragmentTracker",function(){return G});var Q=N("./src/events.ts"),F=N("./src/types/loader.ts"),D;(function(R){R.NOT_LOADED="NOT_LOADED",R.BACKTRACKED="BACKTRACKED",R.APPENDING="APPENDING",R.PARTIAL="PARTIAL",R.OK="OK"})(D||(D={}));var G=function(){function R(v){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=v,this._registerListeners()}var b=R.prototype;return b._registerListeners=function(){var m=this.hls;m.on(Q.Events.BUFFER_APPENDED,this.onBufferAppended,this),m.on(Q.Events.FRAG_BUFFERED,this.onFragBuffered,this),m.on(Q.Events.FRAG_LOADED,this.onFragLoaded,this)},b._unregisterListeners=function(){var m=this.hls;m.off(Q.Events.BUFFER_APPENDED,this.onBufferAppended,this),m.off(Q.Events.FRAG_BUFFERED,this.onFragBuffered,this),m.off(Q.Events.FRAG_LOADED,this.onFragLoaded,this)},b.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},b.getAppendedFrag=function(m,u){if(u===F.PlaylistLevelType.MAIN){var r=this.activeFragment,c=this.activeParts;if(!r)return null;if(c)for(var s=c.length;s--;){var a=c[s],o=a?a.end:r.appendedPTS;if(a.start<=m&&o!==void 0&&m<=o)return s>9&&(this.activeParts=c.slice(s-9)),a}else if(r.start<=m&&r.appendedPTS!==void 0&&m<=r.appendedPTS)return r}return this.getBufferedFrag(m,u)},b.getBufferedFrag=function(m,u){for(var r=this.fragments,c=Object.keys(r),s=c.length;s--;){var a=r[c[s]];if((a==null?void 0:a.body.type)===u&&a.buffered){var o=a.body;if(o.start<=m&&m<=o.end)return o}}return null},b.detectEvictedFragments=function(m,u,r){var c=this;Object.keys(this.fragments).forEach(function(s){var a=c.fragments[s];if(!a)return;if(!a.buffered){a.body.type===r&&c.removeFragment(a.body);return}var o=a.range[m];if(!o)return;o.time.some(function(h){var O=!c.isTimeBuffered(h.startPTS,h.endPTS,u);return O&&c.removeFragment(a.body),O})})},b.detectPartialFragments=function(m){var u=this,r=this.timeRanges,c=m.frag,s=m.part;if(!r||c.sn==="initSegment")return;var a=k(c),o=this.fragments[a];if(!o)return;Object.keys(r).forEach(function(h){var O=c.elementaryStreams[h];if(!O)return;var w=r[h],x=s!==null||O.partial===!0;o.range[h]=u.getBufferedTimes(c,s,x,w)}),o.backtrack=o.loaded=null,Object.keys(o.range).length?o.buffered=!0:this.removeFragment(o.body)},b.fragBuffered=function(m){var u=k(m),r=this.fragments[u];r&&(r.backtrack=r.loaded=null,r.buffered=!0)},b.getBufferedTimes=function(m,u,r,c){for(var s={time:[],partial:r},a=u?u.start:m.start,o=u?u.end:m.end,h=m.minEndPTS||o,O=m.maxStartPTS||a,w=0;w<c.length;w++){var x=c.start(w)-this.bufferPadding,A=c.end(w)+this.bufferPadding;if(O>=x&&h<=A){s.time.push({startPTS:Math.max(a,c.start(w)),endPTS:Math.min(o,c.end(w))});break}else if(a<A&&o>x)s.partial=!0,s.time.push({startPTS:Math.max(a,c.start(w)),endPTS:Math.min(o,c.end(w))});else if(o<=x)break}return s},b.getPartialFragment=function(m){var u=null,r,c,s,a=0,o=this.bufferPadding,h=this.fragments;return Object.keys(h).forEach(function(O){var w=h[O];if(!w)return;B(w)&&(c=w.body.start-o,s=w.body.end+o,m>=c&&m<=s&&(r=Math.min(m-c,s-m),a<=r&&(u=w.body,a=r)))}),u},b.getState=function(m){var u=k(m),r=this.fragments[u];return r?r.buffered?B(r)?D.PARTIAL:D.OK:r.backtrack?D.BACKTRACKED:D.APPENDING:D.NOT_LOADED},b.backtrack=function(m,u){var r=k(m),c=this.fragments[r];if(!c||c.backtrack)return null;var s=c.backtrack=u||c.loaded;return c.loaded=null,s},b.getBacktrackData=function(m){var u=k(m),r=this.fragments[u];if(r){var c,s=r.backtrack;if(s!=null&&(c=s.payload)!==null&&c!==void 0&&c.byteLength)return s;this.removeFragment(m)}return null},b.isTimeBuffered=function(m,u,r){for(var c,s,a=0;a<r.length;a++){if(c=r.start(a)-this.bufferPadding,s=r.end(a)+this.bufferPadding,m>=c&&u<=s)return!0;if(u<=c)return!1}return!1},b.onFragLoaded=function(m,u){var r=u.frag,c=u.part;if(r.sn==="initSegment"||r.bitrateTest||c)return;var s=k(r);this.fragments[s]={body:r,loaded:u,backtrack:null,buffered:!1,range:Object.create(null)}},b.onBufferAppended=function(m,u){var r=this,c=u.frag,s=u.part,a=u.timeRanges;if(c.type===F.PlaylistLevelType.MAIN)if(this.activeFragment=c,s){var o=this.activeParts;o||(this.activeParts=o=[]),o.push(s)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(h){var O=a[h];if(r.detectEvictedFragments(h,O),!s)for(var w=0;w<O.length;w++)c.appendedPTS=Math.max(O.end(w),c.appendedPTS||0)})},b.onFragBuffered=function(m,u){this.detectPartialFragments(u)},b.hasFragment=function(m){var u=k(m);return!!this.fragments[u]},b.removeFragmentsInRange=function(m,u,r){var c=this;Object.keys(this.fragments).forEach(function(s){var a=c.fragments[s];if(!a)return;if(a.buffered){var o=a.body;o.type===r&&o.start<u&&o.end>m&&c.removeFragment(o)}})},b.removeFragment=function(m){var u=k(m);m.stats.loaded=0,m.clearElementaryStreamInfo(),delete this.fragments[u]},b.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},R}();function B(R){var b,v;return R.buffered&&(((b=R.range.video)===null||b===void 0?void 0:b.partial)||((v=R.range.audio)===null||v===void 0?void 0:v.partial))}function k(R){return R.type+"_"+R.level+"_"+R.urlId+"_"+R.sn}},"./src/controller/gap-controller.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"STALL_MINIMUM_DURATION_MS",function(){return B}),N.d(Y,"MAX_START_GAP_JUMP",function(){return k}),N.d(Y,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return R}),N.d(Y,"SKIP_BUFFER_RANGE_START",function(){return b}),N.d(Y,"default",function(){return v});var Q=N("./src/utils/buffer-helper.ts"),F=N("./src/errors.ts"),D=N("./src/events.ts"),G=N("./src/utils/logger.ts"),B=250,k=2,R=.1,b=.05,v=function(){function m(r,c,s,a){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=r,this.media=c,this.fragmentTracker=s,this.hls=a}var u=m.prototype;return u.destroy=function(){this.hls=this.fragmentTracker=this.media=null},u.poll=function(c){var s=this.config,a=this.media,o=this.stalled,h=a.currentTime,O=a.seeking,w=this.seeking&&!O,x=!this.seeking&&O;if(this.seeking=O,h!==c){if(this.moved=!0,o!==null){if(this.stallReported){var A=self.performance.now()-o;G.logger.warn("playback not stuck anymore @"+h+", after "+Math.round(A)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((x||w)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!Q.BufferHelper.getBuffered(a).length)return;var S=Q.BufferHelper.bufferInfo(a,h,0),y=S.len>0,_=S.nextStart||0;if(!y&&!_)return;if(O){var p=S.len>k,d=!_||_-h>k&&!this.fragmentTracker.getPartialFragment(h);if(p||d)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var g,l=Math.max(_,S.start||0)-h,E=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,U=E==null||((g=E.details)===null||g===void 0)?void 0:g.live,P=U?E.details.targetduration*2:k;if(l>0&&l<=P){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(o===null){this.stalled=j;return}var H=j-o;!O&&H>=B&&this._reportStall(S.len);var I=Q.BufferHelper.bufferInfo(a,h,s.maxBufferHole);this._tryFixBufferStall(I,H)},u._tryFixBufferStall=function(c,s){var a=this.config,o=this.fragmentTracker,h=this.media,O=h.currentTime,w=o.getPartialFragment(O);if(w){var x=this._trySkipBufferHole(w);if(x)return}c.len>a.maxBufferHole&&s>a.highBufferWatchdogPeriod*1e3&&(G.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},u._reportStall=function(c){var s=this.hls,a=this.media,o=this.stallReported;o||(this.stallReported=!0,G.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+c+")"),s.trigger(D.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:c}))},u._trySkipBufferHole=function(c){for(var s=this.config,a=this.hls,o=this.media,h=o.currentTime,O=0,w=Q.BufferHelper.getBuffered(o),x=0;x<w.length;x++){var A=w.start(x);if(h+s.maxBufferHole>=O&&h<A){var S=Math.max(A+b,o.currentTime+R);return G.logger.warn("skipping hole, adjusting currentTime from "+h+" to "+S),this.moved=!0,this.stalled=null,o.currentTime=S,c&&a.trigger(D.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+h+" to "+S,frag:c}),S}O=w.end(x)}return 0},u._tryNudgeBuffer=function(){var c=this.config,s=this.hls,a=this.media,o=a.currentTime,h=(this.nudgeRetry||0)+1;if(this.nudgeRetry=h,h<c.nudgeMaxRetry){var O=o+h*c.nudgeOffset;G.logger.warn("Nudging 'currentTime' from "+o+" to "+O),a.currentTime=O,s.trigger(D.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else G.logger.error("Playhead still not moving while enough data buffered @"+o+" after "+c.nudgeMaxRetry+" nudges"),s.trigger(D.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},m}()},"./src/controller/id3-track-controller.ts":function(ce,Y,N){"use strict";N.r(Y);var Q=N("./src/events.ts"),F=N("./src/utils/texttrack-utils.ts"),D=N("./src/demux/id3.ts"),G=.25,B=function(){function k(b){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=b,this._registerListeners()}var R=k.prototype;return R.destroy=function(){this._unregisterListeners()},R._registerListeners=function(){var v=this.hls;v.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),v.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),v.on(Q.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),v.on(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R._unregisterListeners=function(){var v=this.hls;v.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),v.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),v.off(Q.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),v.off(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R.onMediaAttached=function(v,m){this.media=m.media},R.onMediaDetaching=function(){if(!this.id3Track)return;Object(F.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},R.getID3Track=function(v){if(!this.media)return;for(var m=0;m<v.length;m++){var u=v[m];if(u.kind==="metadata"&&u.label==="id3")return Object(F.sendAddTrackEvent)(u,this.media),u}return this.media.addTextTrack("metadata","id3")},R.onFragParsingMetadata=function(v,m){if(!this.media)return;var u=m.frag,r=m.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var c=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,s=0;s<r.length;s++){var a=D.getID3Frames(r[s].data);if(a){var o=r[s].pts,h=s<r.length-1?r[s+1].pts:u.end,O=h-o;O<=0&&(h=o+G);for(var w=0;w<a.length;w++){var x=a[w];if(!D.isTimeStampFrame(x)){var A=new c(o,h,"");A.value=x,this.id3Track.addCue(A)}}}}},R.onBufferFlushing=function(v,m){var u=m.startOffset,r=m.endOffset,c=m.type;if(!c||c==="audio"){var s=this.id3Track;s&&Object(F.removeCuesInRange)(s,u,r)}},k}();Y.default=B},"./src/controller/latency-controller.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return k});var Q=N("./src/errors.ts"),F=N("./src/events.ts"),D=N("./src/utils/logger.ts");function G(R,b){for(var v=0;v<b.length;v++){var m=b[v];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(R,m.key,m)}}function B(R,b,v){return b&&G(R.prototype,b),v&&G(R,v),R}var k=function(){function R(v){var m=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return m.timeupdate()},this.hls=v,this.config=v.config,this.registerListeners()}var b=R.prototype;return b.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},b.registerListeners=function(){this.hls.on(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(F.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){this.hls.off(F.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(F.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(F.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(F.Events.ERROR,this.onError)},b.onMediaAttached=function(m,u){this.media=u.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},b.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},b.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},b.onLevelUpdated=function(m,u){var r=u.details;this.levelDetails=r,r.advanced&&this.timeupdate(),!r.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},b.onError=function(m,u){if(u.details!==Q.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,D.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},b.timeupdate=function(){var m=this.media,u=this.levelDetails;if(!m||!u)return;this.currentTime=m.currentTime;var r=this.computeLatency();if(r===null)return;this._latency=r;var c=this.config,s=c.lowLatencyMode,a=c.maxLiveSyncPlaybackRate;if(!s||a===1)return;var o=this.targetLatency;if(o===null)return;var h=r-o,O=Math.min(this.maxLatency,o+u.targetduration),w=h<O;if(u.live&&w&&h>.05&&this.forwardBufferLength>1){var x=Math.min(2,Math.max(1,a)),A=Math.round(2/(1+Math.exp(-.75*h-this.edgeStalled))*20)/20;m.playbackRate=Math.min(x,Math.max(1,A))}else m.playbackRate!==1&&m.playbackRate!==0&&(m.playbackRate=1)},b.estimateLiveEdge=function(){var m=this.levelDetails;return m===null?null:m.edge+m.age},b.computeLatency=function(){var m=this.estimateLiveEdge();return m===null?null:m-this.currentTime},B(R,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var m=this.config,u=this.levelDetails;return m.liveMaxLatencyDuration!==void 0?m.liveMaxLatencyDuration:u?m.liveMaxLatencyDurationCount*u.targetduration:0}},{key:"targetLatency",get:function(){var m=this.levelDetails;if(m===null)return null;var u=m.holdBack,r=m.partHoldBack,c=m.targetduration,s=this.config,a=s.liveSyncDuration,o=s.liveSyncDurationCount,h=s.lowLatencyMode,O=this.hls.userConfig,w=h&&r||u;(O.liveSyncDuration||O.liveSyncDurationCount||w===0)&&(w=a!==void 0?a:o*c);var x=c,A=1;return w+Math.min(this.stallCount*A,x)}},{key:"liveSyncPosition",get:function(){var m=this.estimateLiveEdge(),u=this.targetLatency,r=this.levelDetails;if(m===null||u===null||r===null)return null;var c=r.edge,s=m-u-this.edgeStalled,a=c-r.totalduration,o=c-(this.config.lowLatencyMode&&r.partTarget||r.targetduration);return Math.min(Math.max(a,s),o)}},{key:"drift",get:function(){var m=this.levelDetails;return m===null?1:m.drift}},{key:"edgeStalled",get:function(){var m=this.levelDetails;if(m===null)return 0;var u=(this.config.lowLatencyMode&&m.partTarget||m.targetduration)*3;return Math.max(m.age-u,0)}},{key:"forwardBufferLength",get:function(){var m=this.media,u=this.levelDetails;if(!m||!u)return 0;var r=m.buffered.length;return r?m.buffered.end(r-1):u.edge-this.currentTime}}]),R}()},"./src/controller/level-controller.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return s});var Q=N("./src/types/level.ts"),F=N("./src/events.ts"),D=N("./src/errors.ts"),G=N("./src/utils/codecs.ts"),B=N("./src/controller/level-helper.ts"),k=N("./src/controller/base-playlist-controller.ts"),R=N("./src/types/loader.ts");function b(){return b=Object.assign||function(a){for(var o=1;o<arguments.length;o++){var h=arguments[o];for(var O in h)Object.prototype.hasOwnProperty.call(h,O)&&(a[O]=h[O])}return a},b.apply(this,arguments)}function v(a,o){for(var h=0;h<o.length;h++){var O=o[h];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(a,O.key,O)}}function m(a,o,h){return o&&v(a.prototype,o),h&&v(a,h),a}function u(a,o){a.prototype=Object.create(o.prototype),a.prototype.constructor=a,r(a,o)}function r(a,o){return r=Object.setPrototypeOf||function(O,w){return O.__proto__=w,O},r(a,o)}var c=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),s=function(a){u(o,a);function o(O){var w;return w=a.call(this,O,"[level-controller]")||this,w._levels=[],w._firstLevel=-1,w._startLevel=void 0,w.currentLevelIndex=-1,w.manualLevelIndex=-1,w.onParsedComplete=void 0,w._registerListeners(),w}var h=o.prototype;return h._registerListeners=function(){var w=this.hls;w.on(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),w.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.on(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),w.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),w.on(F.Events.ERROR,this.onError,this)},h._unregisterListeners=function(){var w=this.hls;w.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),w.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.off(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),w.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),w.off(F.Events.ERROR,this.onError,this)},h.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,a.prototype.destroy.call(this)},h.startLoad=function(){var w=this._levels;w.forEach(function(x){x.loadError=0}),a.prototype.startLoad.call(this)},h.onManifestLoaded=function(w,x){var A=[],S=[],y=[],_,p={},d,g=!1,l=!1,E=!1;if(x.levels.forEach(function(H){var I=H.attrs;g=g||!!(H.width&&H.height),l=l||!!H.videoCodec,E=E||!!H.audioCodec,c&&H.audioCodec&&H.audioCodec.indexOf("mp4a.40.34")!==-1&&(H.audioCodec=void 0);var T=H.bitrate+"-"+H.attrs.RESOLUTION+"-"+H.attrs.CODECS;d=p[T],d?d.url.push(H.url):(d=new Q.Level(H),p[T]=d,A.push(d)),I&&(I.AUDIO&&Object(B.addGroupId)(d,"audio",I.AUDIO),I.SUBTITLES&&Object(B.addGroupId)(d,"text",I.SUBTITLES))}),(g||l)&&E&&(A=A.filter(function(H){var I=H.videoCodec,T=H.width,K=H.height;return!!I||!!(T&&K)})),A=A.filter(function(H){var I=H.audioCodec,T=H.videoCodec;return(!I||Object(G.isCodecSupportedInMp4)(I,"audio"))&&(!T||Object(G.isCodecSupportedInMp4)(T,"video"))}),x.audioTracks&&(S=x.audioTracks.filter(function(H){return!H.audioCodec||Object(G.isCodecSupportedInMp4)(H.audioCodec,"audio")}),Object(B.assignTrackIdsByGroup)(S)),x.subtitles&&(y=x.subtitles,Object(B.assignTrackIdsByGroup)(y)),A.length>0){_=A[0].bitrate,A.sort(function(H,I){return H.bitrate-I.bitrate}),this._levels=A;for(var U=0;U<A.length;U++)if(A[U].bitrate===_){this._firstLevel=U,this.log("manifest loaded, "+A.length+" level(s) found, first bitrate: "+_);break}var P=E&&!l,j={levels:A,audioTracks:S,subtitleTracks:y,firstLevel:this._firstLevel,stats:x.stats,audio:E,video:l,altAudio:!P&&S.some(function(H){return!!H.url})};this.hls.trigger(F.Events.MANIFEST_PARSED,j),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(F.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:x.url,reason:"no level with compatible codecs found in manifest"})},h.onError=function(w,x){if(a.prototype.onError.call(this,w,x),x.fatal)return;var A=x.context,S=this._levels[this.currentLevelIndex];if(A&&(A.type===R.PlaylistContextType.AUDIO_TRACK&&S.audioGroupIds&&A.groupId===S.audioGroupIds[S.urlId]||A.type===R.PlaylistContextType.SUBTITLE_TRACK&&S.textGroupIds&&A.groupId===S.textGroupIds[S.urlId])){this.redundantFailover(this.currentLevelIndex);return}var y=!1,_=!0,p;switch(x.details){case D.ErrorDetails.FRAG_LOAD_ERROR:case D.ErrorDetails.FRAG_LOAD_TIMEOUT:case D.ErrorDetails.KEY_LOAD_ERROR:case D.ErrorDetails.KEY_LOAD_TIMEOUT:if(x.frag){var d=this._levels[x.frag.level];d?(d.fragmentError++,d.fragmentError>this.hls.config.fragLoadingMaxRetry&&(p=x.frag.level)):p=x.frag.level}break;case D.ErrorDetails.LEVEL_LOAD_ERROR:case D.ErrorDetails.LEVEL_LOAD_TIMEOUT:A&&(A.deliveryDirectives&&(_=!1),p=A.level),y=!0;break;case D.ErrorDetails.REMUX_ALLOC_ERROR:p=x.level,y=!0;break}p!==void 0&&this.recoverLevel(x,p,y,_)},h.recoverLevel=function(w,x,A,S){var y=w.details,_=this._levels[x];if(_.loadError++,A){var p=this.retryLoadingOrFail(w);if(p)w.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(S){var d=_.url.length;if(d>1&&_.loadError<d)w.levelRetry=!0,this.redundantFailover(x);else if(this.manualLevelIndex===-1){var g=x===0?this._levels.length-1:x-1;this.currentLevelIndex!==g&&this._levels[g].loadError===0&&(this.warn(y+": switch to "+g),w.levelRetry=!0,this.hls.nextAutoLevel=g)}}},h.redundantFailover=function(w){var x=this._levels[w],A=x.url.length;if(A>1){var S=(x.urlId+1)%A;this.warn("Switching to redundant URL-id "+S),this._levels.forEach(function(y){y.urlId=S}),this.level=w}},h.onFragLoaded=function(w,x){var A=x.frag;if(A!==void 0&&A.type===R.PlaylistLevelType.MAIN){var S=this._levels[A.level];S!==void 0&&(S.fragmentError=0,S.loadError=0)}},h.onLevelLoaded=function(w,x){var A,S=x.level,y=x.details,_=this._levels[S];if(!_){var p;this.warn("Invalid level index "+S),(p=x.deliveryDirectives)!==null&&p!==void 0&&p.skip&&(y.deltaUpdateFailed=!0);return}S===this.currentLevelIndex?(_.fragmentError===0&&(_.loadError=0,this.retryCount=0),this.playlistLoaded(S,x,_.details)):(A=x.deliveryDirectives)!==null&&A!==void 0&&A.skip&&(y.deltaUpdateFailed=!0)},h.onAudioTrackSwitched=function(w,x){var A=this.hls.levels[this.currentLevelIndex];if(!A)return;if(A.audioGroupIds){for(var S=-1,y=this.hls.audioTracks[x.id].groupId,_=0;_<A.audioGroupIds.length;_++)if(A.audioGroupIds[_]===y){S=_;break}S!==A.urlId&&(A.urlId=S,this.startLoad())}},h.loadPlaylist=function(w){var x=this.currentLevelIndex,A=this._levels[x];if(this.canLoad&&A&&A.url.length>0){var S=A.urlId,y=A.url[S];if(w)try{y=w.addDirectives(y)}catch(_){this.warn("Could not construct new URL with HLS Delivery Directives: "+_)}this.log("Attempt loading level index "+x+(w?" at sn "+w.msn+" part "+w.part:"")+" with URL-id "+S+" "+y),this.clearTimer(),this.hls.trigger(F.Events.LEVEL_LOADING,{url:y,level:x,id:S,deliveryDirectives:w||null})}},h.removeLevel=function(w,x){var A=function(_,p){return p!==x},S=this._levels.filter(function(y,_){return _!==w?!0:y.url.length>1&&x!==void 0?(y.url=y.url.filter(A),y.audioGroupIds&&(y.audioGroupIds=y.audioGroupIds.filter(A)),y.textGroupIds&&(y.textGroupIds=y.textGroupIds.filter(A)),y.urlId=0,!0):!1}).map(function(y,_){var p=y.details;return p!=null&&p.fragments&&p.fragments.forEach(function(d){d.level=_}),y});this._levels=S,this.hls.trigger(F.Events.LEVELS_UPDATED,{levels:S})},m(o,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(w){var x,A=this._levels;if(A.length===0)return;if(this.currentLevelIndex===w&&(x=A[w])!==null&&x!==void 0&&x.details)return;if(w<0||w>=A.length){var S=w<0;if(this.hls.trigger(F.Events.ERROR,{type:D.ErrorTypes.OTHER_ERROR,details:D.ErrorDetails.LEVEL_SWITCH_ERROR,level:w,fatal:S,reason:"invalid level idx"}),S)return;w=Math.min(w,A.length-1)}this.clearTimer();var y=this.currentLevelIndex,_=A[y],p=A[w];this.log("switching to level "+w+" from "+y),this.currentLevelIndex=w;var d=b({},p,{level:w,maxBitrate:p.maxBitrate,uri:p.uri,urlId:p.urlId});delete d._urlId,this.hls.trigger(F.Events.LEVEL_SWITCHING,d);var g=p.details;if(!g||g.live){var l=this.switchParams(p.uri,_==null?void 0:_.details);this.loadPlaylist(l)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(w){this.manualLevelIndex=w,this._startLevel===void 0&&(this._startLevel=w),w!==-1&&(this.level=w)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(w){this._firstLevel=w}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var w=this.hls.config.startLevel;return w!==void 0?w:this._firstLevel}else return this._startLevel},set:function(w){this._startLevel=w}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(w){this.level=w,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=w)}}]),o}(k.default)},"./src/controller/level-helper.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"addGroupId",function(){return D}),N.d(Y,"assignTrackIdsByGroup",function(){return G}),N.d(Y,"updatePTS",function(){return B}),N.d(Y,"updateFragPTSDTS",function(){return R}),N.d(Y,"mergeDetails",function(){return b}),N.d(Y,"mapPartIntersection",function(){return v}),N.d(Y,"mapFragmentIntersection",function(){return m}),N.d(Y,"adjustSliding",function(){return u}),N.d(Y,"addSliding",function(){return r}),N.d(Y,"computeReloadInterval",function(){return c}),N.d(Y,"getFragmentWithSN",function(){return s}),N.d(Y,"getPartWith",function(){return a});var Q=N("./src/polyfills/number.ts"),F=N("./src/utils/logger.ts");function D(o,h,O){switch(h){case"audio":o.audioGroupIds||(o.audioGroupIds=[]),o.audioGroupIds.push(O);break;case"text":o.textGroupIds||(o.textGroupIds=[]),o.textGroupIds.push(O);break}}function G(o){var h={};o.forEach(function(O){var w=O.groupId||"";O.id=h[w]=h[w]||0,h[w]++})}function B(o,h,O){var w=o[h],x=o[O];k(w,x)}function k(o,h){var O=h.startPTS;if(Object(Q.isFiniteNumber)(O)){var w=0,x;h.sn>o.sn?(w=O-o.start,x=o):(w=o.start-O,x=h),x.duration!==w&&(x.duration=w)}else if(h.sn>o.sn){var A=o.cc===h.cc;A&&o.minEndPTS?h.start=o.start+(o.minEndPTS-o.start):h.start=o.start+o.duration}else h.start=Math.max(o.start-h.duration,0)}function R(o,h,O,w,x,A){var S=w-O;S<=0&&(F.logger.warn("Fragment should have a positive duration",h),w=O+h.duration,A=x+h.duration);var y=O,_=w,p=h.startPTS,d=h.endPTS;if(Object(Q.isFiniteNumber)(p)){var g=Math.abs(p-O);Object(Q.isFiniteNumber)(h.deltaPTS)?h.deltaPTS=Math.max(g,h.deltaPTS):h.deltaPTS=g,y=Math.max(O,p),O=Math.min(O,p),x=Math.min(x,h.startDTS),_=Math.min(w,d),w=Math.max(w,d),A=Math.max(A,h.endDTS)}h.duration=w-O;var l=O-h.start;h.appendedPTS=w,h.start=h.startPTS=O,h.maxStartPTS=y,h.startDTS=x,h.endPTS=w,h.minEndPTS=_,h.endDTS=A;var E=h.sn;if(!o||E<o.startSN||E>o.endSN)return 0;var U,P=E-o.startSN,j=o.fragments;for(j[P]=h,U=P;U>0;U--)k(j[U],j[U-1]);for(U=P;U<j.length-1;U++)k(j[U],j[U+1]);return o.fragmentHint&&k(j[j.length-1],o.fragmentHint),o.PTSKnown=o.alignedSliding=!0,l}function b(o,h){for(var O=null,w=o.fragments,x=w.length-1;x>=0;x--){var A=w[x].initSegment;if(A){O=A;break}}o.fragmentHint&&delete o.fragmentHint.endPTS;var S=0,y;if(m(o,h,function(U,P){U.relurl&&(S=U.cc-P.cc),Object(Q.isFiniteNumber)(U.startPTS)&&Object(Q.isFiniteNumber)(U.endPTS)&&(P.start=P.startPTS=U.startPTS,P.startDTS=U.startDTS,P.appendedPTS=U.appendedPTS,P.maxStartPTS=U.maxStartPTS,P.endPTS=U.endPTS,P.endDTS=U.endDTS,P.minEndPTS=U.minEndPTS,P.duration=U.endPTS-U.startPTS,P.duration&&(y=P),h.PTSKnown=h.alignedSliding=!0),P.elementaryStreams=U.elementaryStreams,P.loader=U.loader,P.stats=U.stats,P.urlId=U.urlId,U.initSegment&&(P.initSegment=U.initSegment,O=U.initSegment)}),O){var _=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments;_.forEach(function(U){var P;(!U.initSegment||U.initSegment.relurl===((P=O)===null||P===void 0?void 0:P.relurl))&&(U.initSegment=O)})}if(h.skippedSegments&&(h.deltaUpdateFailed=h.fragments.some(function(U){return!U}),h.deltaUpdateFailed)){F.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var p=h.skippedSegments;p--;)h.fragments.shift();h.startSN=h.fragments[0].sn,h.startCC=h.fragments[0].cc}var d=h.fragments;if(S){F.logger.warn("discontinuity sliding from playlist, take drift into account");for(var g=0;g<d.length;g++)d[g].cc+=S}h.skippedSegments&&(h.startCC=h.fragments[0].cc),v(o.partList,h.partList,function(U,P){P.elementaryStreams=U.elementaryStreams,P.stats=U.stats}),y?R(h,y,y.startPTS,y.endPTS,y.startDTS,y.endDTS):u(o,h),d.length&&(h.totalduration=h.edge-d[0].start),h.driftStartTime=o.driftStartTime,h.driftStart=o.driftStart;var l=h.advancedDateTime;if(h.advanced&&l){var E=h.edge;h.driftStart||(h.driftStartTime=l,h.driftStart=E),h.driftEndTime=l,h.driftEnd=E}else h.driftEndTime=o.driftEndTime,h.driftEnd=o.driftEnd,h.advancedDateTime=o.advancedDateTime}function v(o,h,O){if(o&&h)for(var w=0,x=0,A=o.length;x<=A;x++){var S=o[x],y=h[x+w];S&&y&&S.index===y.index&&S.fragment.sn===y.fragment.sn?O(S,y):w--}}function m(o,h,O){for(var w=h.skippedSegments,x=Math.max(o.startSN,h.startSN)-h.startSN,A=(o.fragmentHint?1:0)+(w?h.endSN:Math.min(o.endSN,h.endSN))-h.startSN,S=h.startSN-o.startSN,y=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments,_=o.fragmentHint?o.fragments.concat(o.fragmentHint):o.fragments,p=x;p<=A;p++){var d=_[S+p],g=y[p];w&&!g&&p<w&&(g=h.fragments[p]=d),d&&g&&O(d,g)}}function u(o,h){var O=h.startSN+h.skippedSegments-o.startSN,w=o.fragments;if(O<0||O>=w.length)return;r(h,w[O].start)}function r(o,h){if(h){for(var O=o.fragments,w=o.skippedSegments;w<O.length;w++)O[w].start+=h;o.fragmentHint&&(o.fragmentHint.start+=h)}}function c(o,h){var O=1e3*o.levelTargetDuration,w=O/2,x=o.age,A=x>0&&x<O*3,S=h.loading.end-h.loading.start,y,_=o.availabilityDelay;if(o.updated===!1)if(A){var p=333*o.misses;y=Math.max(Math.min(w,S*2),p),o.availabilityDelay=(o.availabilityDelay||0)+y}else y=w;else A?(_=Math.min(_||O/2,x),o.availabilityDelay=_,y=_+O-x):y=O-S;return Math.round(y)}function s(o,h,O){if(!o||!o.details)return null;var w=o.details,x=w.fragments[h-w.startSN];return x||(x=w.fragmentHint,x&&x.sn===h?x:h<w.startSN&&O&&O.sn===h?O:null)}function a(o,h,O){if(!o||!o.details)return null;var w=o.details.partList;if(w)for(var x=w.length;x--;){var A=w[x];if(A.index===O&&A.fragment.sn===h)return A}return null}},"./src/controller/stream-controller.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return w});var Q=N("./src/polyfills/number.ts"),F=N("./src/controller/base-stream-controller.ts"),D=N("./src/is-supported.ts"),G=N("./src/events.ts"),B=N("./src/utils/buffer-helper.ts"),k=N("./src/controller/fragment-tracker.ts"),R=N("./src/types/loader.ts"),b=N("./src/loader/fragment.ts"),v=N("./src/demux/transmuxer-interface.ts"),m=N("./src/types/transmuxer.ts"),u=N("./src/controller/gap-controller.ts"),r=N("./src/errors.ts"),c=N("./src/utils/logger.ts");function s(x,A){for(var S=0;S<A.length;S++){var y=A[S];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(x,y.key,y)}}function a(x,A,S){return A&&s(x.prototype,A),S&&s(x,S),x}function o(x,A){x.prototype=Object.create(A.prototype),x.prototype.constructor=x,h(x,A)}function h(x,A){return h=Object.setPrototypeOf||function(y,_){return y.__proto__=_,y},h(x,A)}var O=100,w=function(x){o(A,x);function A(y,_){var p;return p=x.call(this,y,_,"[stream-controller]")||this,p.audioCodecSwap=!1,p.gapController=null,p.level=-1,p._forceStartLoad=!1,p.altAudio=!1,p.audioOnly=!1,p.fragPlaying=null,p.onvplaying=null,p.onvseeked=null,p.fragLastKbps=0,p.stalled=!1,p.couldBacktrack=!1,p.audioCodecSwitch=!1,p.videoBuffer=null,p._registerListeners(),p}var S=A.prototype;return S._registerListeners=function(){var _=this.hls;_.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),_.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),_.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),_.on(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),_.on(G.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),_.on(G.Events.ERROR,this.onError,this),_.on(G.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),_.on(G.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),_.on(G.Events.BUFFER_CREATED,this.onBufferCreated,this),_.on(G.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),_.on(G.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),_.on(G.Events.FRAG_BUFFERED,this.onFragBuffered,this)},S._unregisterListeners=function(){var _=this.hls;_.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),_.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),_.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),_.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),_.off(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),_.off(G.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),_.off(G.Events.ERROR,this.onError,this),_.off(G.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),_.off(G.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),_.off(G.Events.BUFFER_CREATED,this.onBufferCreated,this),_.off(G.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),_.off(G.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),_.off(G.Events.FRAG_BUFFERED,this.onFragBuffered,this)},S.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},S.startLoad=function(_){if(this.levels){var p=this.lastCurrentTime,d=this.hls;if(this.stopLoad(),this.setInterval(O),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var g=d.startLevel;g===-1&&(d.config.testBandwidth?(g=0,this.bitrateTest=!0):g=d.nextAutoLevel),this.level=d.nextLoadLevel=g,this.loadedmetadata=!1}p>0&&_===-1&&(this.log("Override startPosition with lastCurrentTime @"+p.toFixed(3)),_=p),this.state=F.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=_,this.tick()}else this._forceStartLoad=!0,this.state=F.State.STOPPED},S.stopLoad=function(){this._forceStartLoad=!1,x.prototype.stopLoad.call(this)},S.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_LEVEL:{var _,p=this.levels,d=this.level,g=p==null||((_=p[d])===null||_===void 0)?void 0:_.details;if(g&&(!g.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(g))break;this.state=F.State.IDLE;break}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var l,E=self.performance.now(),U=this.retryDate;(!U||E>=U||(l=this.media)!==null&&l!==void 0&&l.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=F.State.IDLE)}break;default:break}this.onTickEnd()},S.onTickEnd=function(){x.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},S.doTickIdle=function(){var _,p,d=this.hls,g=this.levelLastLoaded,l=this.levels,E=this.media,U=d.config,P=d.nextLoadLevel;if(g===null||!E&&(this.startFragRequested||!U.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!l||!l[P])return;var j=l[P];this.level=d.nextLoadLevel=P;var H=j.details;if(!H||this.state===F.State.WAITING_LEVEL||H.live&&this.levelLastLoaded!==P){this.state=F.State.WAITING_LEVEL;return}var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:E,R.PlaylistLevelType.MAIN);if(I===null)return;var T=I.len,K=this.getMaxBufferLength(j.maxBitrate);if(T>=K)return;if(this._streamEnded(I,H)){var J={};this.altAudio&&(J.type="video"),this.hls.trigger(G.Events.BUFFER_EOS,J),this.state=F.State.ENDED;return}var ie=I.end,pe=this.getNextFragment(ie,H);if(this.couldBacktrack&&!this.fragPrevious&&pe&&pe.sn!=="initSegment"){var _e=pe.sn-H.startSN;_e>1&&(pe=H.fragments[_e-1],this.fragmentTracker.removeFragment(pe))}if(pe&&this.fragmentTracker.getState(pe)===k.FragmentState.OK&&this.nextLoadPosition>ie){var Te=this.audioOnly&&!this.altAudio?b.ElementaryStreamTypes.AUDIO:b.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(E,Te,R.PlaylistLevelType.MAIN),pe=this.getNextFragment(this.nextLoadPosition,H)}if(!pe)return;pe.initSegment&&!pe.initSegment.data&&!this.bitrateTest&&(pe=pe.initSegment),((_=pe.decryptdata)===null||_===void 0?void 0:_.keyFormat)==="identity"&&!((p=pe.decryptdata)!==null&&p!==void 0&&p.key)?this.loadKey(pe,H):this.loadFragment(pe,H,ie)},S.loadFragment=function(_,p,d){var g,l=this.fragmentTracker.getState(_);if(this.fragCurrent=_,l===k.FragmentState.BACKTRACKED){var E=this.fragmentTracker.getBacktrackData(_);if(E){this._handleFragmentLoadProgress(E),this._handleFragmentLoadComplete(E);return}else l=k.FragmentState.NOT_LOADED}l===k.FragmentState.NOT_LOADED||l===k.FragmentState.PARTIAL?_.sn==="initSegment"?this._loadInitSegment(_):this.bitrateTest?(_.bitrateTest=!0,this.log("Fragment "+_.sn+" of level "+_.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(_)):(this.startFragRequested=!0,x.prototype.loadFragment.call(this,_,p,d)):l===k.FragmentState.APPENDING?this.reduceMaxBufferLength(_.duration)&&this.fragmentTracker.removeFragment(_):((g=this.media)===null||g===void 0?void 0:g.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},S.getAppendedFrag=function(_){var p=this.fragmentTracker.getAppendedFrag(_,R.PlaylistLevelType.MAIN);return p&&"fragment"in p?p.fragment:p},S.getBufferedFrag=function(_){return this.fragmentTracker.getBufferedFrag(_,R.PlaylistLevelType.MAIN)},S.followingBufferedFrag=function(_){return _?this.getBufferedFrag(_.end+.5):null},S.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},S.nextLevelSwitch=function(){var _=this.levels,p=this.media;if(p!=null&&p.readyState){var d,g=this.getAppendedFrag(p.currentTime);if(g&&g.start>1&&this.flushMainBuffer(0,g.start-1),!p.paused&&_){var l=this.hls.nextLoadLevel,E=_[l],U=this.fragLastKbps;U&&this.fragCurrent?d=this.fragCurrent.duration*E.maxBitrate/(1e3*U)+1:d=0}else d=0;var P=this.getBufferedFrag(p.currentTime+d);if(P){var j=this.followingBufferedFrag(P);if(j){this.abortCurrentFrag();var H=j.maxStartPTS?j.maxStartPTS:j.start,I=j.duration,T=Math.max(P.end,H+Math.min(Math.max(I-this.config.maxFragLookUpTolerance,I*.5),I*.75));this.flushMainBuffer(T,Number.POSITIVE_INFINITY)}}}},S.abortCurrentFrag=function(){var _=this.fragCurrent;this.fragCurrent=null,_!=null&&_.loader&&_.loader.abort(),this.state===F.State.KEY_LOADING&&(this.state=F.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},S.flushMainBuffer=function(_,p){x.prototype.flushMainBuffer.call(this,_,p,this.altAudio?"video":null)},S.onMediaAttached=function(_,p){x.prototype.onMediaAttached.call(this,_,p);var d=p.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),d.addEventListener("playing",this.onvplaying),d.addEventListener("seeked",this.onvseeked),this.gapController=new u.default(this.config,d,this.fragmentTracker,this.hls)},S.onMediaDetaching=function(){var _=this.media;_&&(_.removeEventListener("playing",this.onvplaying),_.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),x.prototype.onMediaDetaching.call(this)},S.onMediaPlaying=function(){this.tick()},S.onMediaSeeked=function(){var _=this.media,p=_?_.currentTime:null;Object(Q.isFiniteNumber)(p)&&this.log("Media seeked to "+p.toFixed(3)),this.tick()},S.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(G.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},S.onManifestParsed=function(_,p){var d=!1,g=!1,l;p.levels.forEach(function(E){l=E.audioCodec,l&&(l.indexOf("mp4a.40.2")!==-1&&(d=!0),l.indexOf("mp4a.40.5")!==-1&&(g=!0))}),this.audioCodecSwitch=d&&g&&!Object(D.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=p.levels,this.startFragRequested=!1},S.onLevelLoading=function(_,p){var d=this.levels;if(!d||this.state!==F.State.IDLE)return;var g=d[p.level];(!g.details||g.details.live&&this.levelLastLoaded!==p.level||this.waitForCdnTuneIn(g.details))&&(this.state=F.State.WAITING_LEVEL)},S.onLevelLoaded=function(_,p){var d,g=this.levels,l=p.level,E=p.details,U=E.totalduration;if(!g){this.warn("Levels were reset while loading level "+l);return}this.log("Level "+l+" loaded ["+E.startSN+","+E.endSN+"], cc ["+E.startCC+", "+E.endCC+"] duration:"+U);var P=this.fragCurrent;P&&(this.state===F.State.FRAG_LOADING||this.state===F.State.FRAG_LOADING_WAITING_RETRY)&&(P.level!==p.level&&P.loader&&(this.state=F.State.IDLE,P.loader.abort()));var j=g[l],H=0;if(E.live||(d=j.details)!==null&&d!==void 0&&d.live){if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed)return;H=this.alignPlaylists(E,j.details)}if(j.details=E,this.levelLastLoaded=l,this.hls.trigger(G.Events.LEVEL_UPDATED,{details:E,level:l}),this.state===F.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(E))return;this.state=F.State.IDLE}this.startFragRequested?E.live&&this.synchronizeToLiveEdge(E):this.setStartPosition(E,H),this.tick()},S._handleFragmentLoadProgress=function(_){var p,d=_.frag,g=_.part,l=_.payload,E=this.levels;if(!E){this.warn("Levels were reset while fragment load was in progress. Fragment "+d.sn+" of level "+d.level+" will not be buffered");return}var U=E[d.level],P=U.details;if(!P){this.warn("Dropping fragment "+d.sn+" of level "+d.level+" after level details were reset");return}var j=U.videoCodec,H=P.PTSKnown||!P.live,I=(p=d.initSegment)===null||p===void 0?void 0:p.data,T=this._getAudioCodec(U),K=this.transmuxer=this.transmuxer||new v.default(this.hls,R.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),J=g?g.index:-1,ie=J!==-1,pe=new m.ChunkMetadata(d.level,d.sn,d.stats.chunkCount,l.byteLength,J,ie),_e=this.initPTS[d.cc];K.push(l,I,T,j,d,g,P.totalduration,H,pe,_e)},S.onAudioTrackSwitching=function(_,p){var d=this.altAudio,g=!!p.url,l=p.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 E=this.fragCurrent;E!=null&&E.loader&&(this.log("Switching to main audio track, cancel main fragment load"),E.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var U=this.hls;d&&U.trigger(G.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),U.trigger(G.Events.AUDIO_TRACK_SWITCHED,{id:l})}},S.onAudioTrackSwitched=function(_,p){var d=p.id,g=!!this.hls.audioTracks[d].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()},S.onBufferCreated=function(_,p){var d=p.tracks,g,l,E=!1;for(var U in d){var P=d[U];if(P.id==="main"){if(l=U,g=P,U==="video"){var j=d[U];j&&(this.videoBuffer=j.buffer)}}else E=!0}E&&g?(this.log("Alternate track found, use "+l+".buffered to schedule main fragment loading"),this.mediaBuffer=g.buffer):this.mediaBuffer=this.media},S.onFragBuffered=function(_,p){var d=p.frag,g=p.part;if(d&&d.type!==R.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(d)){this.warn("Fragment "+d.sn+(g?" p: "+g.index:"")+" of level "+d.level+" finished buffering, but was aborted. state: "+this.state),this.state===F.State.PARSED&&(this.state=F.State.IDLE);return}var l=g?g.stats:d.stats;this.fragLastKbps=Math.round(8*l.total/(l.buffering.end-l.loading.first)),d.sn!=="initSegment"&&(this.fragPrevious=d),this.fragBufferedComplete(d,g)},S.onError=function(_,p){switch(p.details){case r.ErrorDetails.FRAG_LOAD_ERROR:case r.ErrorDetails.FRAG_LOAD_TIMEOUT:case r.ErrorDetails.KEY_LOAD_ERROR:case r.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.MAIN,p);break;case r.ErrorDetails.LEVEL_LOAD_ERROR:case r.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==F.State.ERROR&&(p.fatal?(this.warn(""+p.details),this.state=F.State.ERROR):!p.levelRetry&&this.state===F.State.WAITING_LEVEL&&(this.state=F.State.IDLE));break;case r.ErrorDetails.BUFFER_FULL_ERROR:if(p.parent==="main"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var d=!0,g=this.getFwdBufferInfo(this.media,R.PlaylistLevelType.MAIN);g&&g.len>.5&&(d=!this.reduceMaxBufferLength(g.len)),d&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},S.checkBuffer=function(){var _=this.media,p=this.gapController;if(!_||!p||!_.readyState)return;var d=B.BufferHelper.getBuffered(_);!this.loadedmetadata&&d.length?(this.loadedmetadata=!0,this.seekToStartPos()):p.poll(this.lastCurrentTime),this.lastCurrentTime=_.currentTime},S.onFragLoadEmergencyAborted=function(){this.state=F.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},S.onBufferFlushed=function(_,p){var d=p.type;if(d!==b.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var g=(d===b.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(g,d,R.PlaylistLevelType.MAIN)}},S.onLevelsUpdated=function(_,p){this.levels=p.levels},S.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},S.seekToStartPos=function(){var _=this.media,p=_.currentTime,d=this.startPosition;if(d>=0&&p<d){if(_.seeking){c.logger.log("could not seek to "+d+", already seeking at "+p);return}var g=B.BufferHelper.getBuffered(_),l=g.length?g.start(0):0,E=l-d;E>0&&(E<this.config.maxBufferHole||E<this.config.maxFragLookUpTolerance)&&(c.logger.log("adjusting start position by "+E+" to match buffer start"),d+=E,this.startPosition=d),this.log("seek to target start position "+d+" from current time "+p),_.currentTime=d}},S._getAudioCodec=function(_){var p=this.config.defaultAudioCodec||_.audioCodec;return this.audioCodecSwap&&p&&(this.log("Swapping audio codec"),p.indexOf("mp4a.40.5")!==-1?p="mp4a.40.2":p="mp4a.40.5"),p},S._loadBitrateTestFrag=function(_){var p=this;this._doFragLoad(_).then(function(d){var g=p.hls;if(!d||g.nextLoadLevel||p.fragContextChanged(_))return;p.fragLoadError=0,p.state=F.State.IDLE,p.startFragRequested=!1,p.bitrateTest=!1;var l=_.stats;l.parsing.start=l.parsing.end=l.buffering.start=l.buffering.end=self.performance.now(),g.trigger(G.Events.FRAG_LOADED,d)})},S._handleTransmuxComplete=function(_){var p,d="main",g=this.hls,l=_.remuxResult,E=_.chunkMeta,U=this.getCurrentContext(E);if(!U){this.warn("The loading context changed while buffering fragment "+E.sn+" of level "+E.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(E.level);return}var P=U.frag,j=U.part,H=U.level,I=l.video,T=l.text,K=l.id3,J=l.initSegment,ie=this.altAudio?void 0:l.audio;if(this.fragContextChanged(P))return;if(this.state=F.State.PARSING,J){J.tracks&&(this._bufferInitSegment(H,J.tracks,P,E),g.trigger(G.Events.FRAG_PARSING_INIT_SEGMENT,{frag:P,id:d,tracks:J.tracks}));var pe=J.initPTS,_e=J.timescale;Object(Q.isFiniteNumber)(pe)&&(this.initPTS[P.cc]=pe,g.trigger(G.Events.INIT_PTS_FOUND,{frag:P,id:d,initPTS:pe,timescale:_e}))}if(I&&l.independent!==!1){if(H.details){var Te=I.startPTS,he=I.endPTS,re=I.startDTS,fe=I.endDTS;if(j)j.elementaryStreams[I.type]={startPTS:Te,endPTS:he,startDTS:re,endDTS:fe};else if(I.firstKeyFrame&&I.independent&&(this.couldBacktrack=!0),I.dropped&&I.independent){var ae=this.getLoadPosition()+this.config.maxBufferHole;if(ae<Te){this.backtrack(P);return}P.setElementaryStreamInfo(I.type,P.start,he,P.start,fe,!0)}P.setElementaryStreamInfo(I.type,Te,he,re,fe),this.bufferFragmentData(I,P,j,E)}}else if(l.independent===!1){this.backtrack(P);return}if(ie){var oe=ie.startPTS,Z=ie.endPTS,ne=ie.startDTS,se=ie.endDTS;j&&(j.elementaryStreams[b.ElementaryStreamTypes.AUDIO]={startPTS:oe,endPTS:Z,startDTS:ne,endDTS:se}),P.setElementaryStreamInfo(b.ElementaryStreamTypes.AUDIO,oe,Z,ne,se),this.bufferFragmentData(ie,P,j,E)}if(K!=null&&(p=K.samples)!==null&&p!==void 0&&p.length){var me={frag:P,id:d,samples:K.samples};g.trigger(G.Events.FRAG_PARSING_METADATA,me)}if(T){var Se={frag:P,id:d,samples:T.samples};g.trigger(G.Events.FRAG_PARSING_USERDATA,Se)}},S._bufferInitSegment=function(_,p,d,g){var l=this;if(this.state!==F.State.PARSING)return;this.audioOnly=!!p.audio&&!p.video,this.altAudio&&!this.audioOnly&&delete p.audio;var E=p.audio,U=p.video,P=p.audiovideo;if(E){var j=_.audioCodec,H=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(j&&(j.indexOf("mp4a.40.5")!==-1?j="mp4a.40.2":j="mp4a.40.5"),E.metadata.channelCount!==1&&H.indexOf("firefox")===-1&&(j="mp4a.40.5")),H.indexOf("android")!==-1&&E.container!=="audio/mpeg"&&(j="mp4a.40.2",this.log("Android: force audio codec to "+j)),_.audioCodec&&_.audioCodec!==j&&this.log('Swapping manifest audio codec "'+_.audioCodec+'" for "'+j+'"'),E.levelCodec=j,E.id="main",this.log("Init audio buffer, container:"+E.container+", codecs[selected/level/parsed]=["+(j||"")+"/"+(_.audioCodec||"")+"/"+E.codec+"]")}U&&(U.levelCodec=_.videoCodec,U.id="main",this.log("Init video buffer, container:"+U.container+", codecs[level/parsed]=["+(_.videoCodec||"")+"/"+U.codec+"]")),P&&this.log("Init audiovideo buffer, container:"+P.container+", codecs[level/parsed]=["+(_.attrs.CODECS||"")+"/"+P.codec+"]"),this.hls.trigger(G.Events.BUFFER_CODECS,p),Object.keys(p).forEach(function(I){var T=p[I],K=T.initSegment;K!=null&&K.byteLength&&l.hls.trigger(G.Events.BUFFER_APPENDING,{type:I,data:K,frag:d,part:null,chunkMeta:g,parent:d.type})}),this.tick()},S.backtrack=function(_){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(_);var p=this.fragmentTracker.backtrack(_);this.fragPrevious=null,this.nextLoadPosition=_.start,p?this.resetFragmentLoading(_):this.state=F.State.BACKTRACKING},S.checkFragmentChanged=function(){var _=this.media,p=null;if(_&&_.readyState>1&&_.seeking===!1){var d=_.currentTime;if(B.BufferHelper.isBuffered(_,d)?p=this.getAppendedFrag(d):B.BufferHelper.isBuffered(_,d+.1)&&(p=this.getAppendedFrag(d+.1)),p){var g=this.fragPlaying,l=p.level;(!g||p.sn!==g.sn||g.level!==l||p.urlId!==g.urlId)&&(this.hls.trigger(G.Events.FRAG_CHANGED,{frag:p}),(!g||g.level!==l)&&this.hls.trigger(G.Events.LEVEL_SWITCHED,{level:l}),this.fragPlaying=p)}}},a(A,[{key:"nextLevel",get:function(){var _=this.nextBufferedFrag;return _?_.level:-1}},{key:"currentLevel",get:function(){var _=this.media;if(_){var p=this.getAppendedFrag(_.currentTime);if(p)return p.level}return-1}},{key:"nextBufferedFrag",get:function(){var _=this.media;if(_){var p=this.getAppendedFrag(_.currentTime);return this.followingBufferedFrag(p)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),A}(F.default)},"./src/controller/subtitle-stream-controller.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"SubtitleStreamController",function(){return o});var Q=N("./src/events.ts"),F=N("./src/utils/logger.ts"),D=N("./src/utils/buffer-helper.ts"),G=N("./src/controller/fragment-finders.ts"),B=N("./src/utils/discontinuities.ts"),k=N("./src/controller/level-helper.ts"),R=N("./src/controller/fragment-tracker.ts"),b=N("./src/controller/base-stream-controller.ts"),v=N("./src/types/loader.ts"),m=N("./src/types/level.ts");function u(h,O){for(var w=0;w<O.length;w++){var x=O[w];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(h,x.key,x)}}function r(h,O,w){return O&&u(h.prototype,O),w&&u(h,w),h}function c(h,O){h.prototype=Object.create(O.prototype),h.prototype.constructor=h,s(h,O)}function s(h,O){return s=Object.setPrototypeOf||function(x,A){return x.__proto__=A,x},s(h,O)}var a=500,o=function(h){c(O,h);function O(x,A){var S;return S=h.call(this,x,A,"[subtitle-stream-controller]")||this,S.levels=[],S.currentTrackId=-1,S.tracksBuffered=[],S.mainDetails=null,S._registerListeners(),S}var w=O.prototype;return w.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},w._registerListeners=function(){var A=this.hls;A.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.on(Q.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.on(Q.Events.ERROR,this.onError,this),A.on(Q.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.on(Q.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.on(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.on(Q.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.on(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w._unregisterListeners=function(){var A=this.hls;A.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.off(Q.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.off(Q.Events.ERROR,this.onError,this),A.off(Q.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.off(Q.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.off(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.off(Q.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.off(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},w.startLoad=function(){this.stopLoad(),this.state=b.State.IDLE,this.setInterval(a),this.tick()},w.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},w.onLevelLoaded=function(A,S){this.mainDetails=S.details},w.onSubtitleFragProcessed=function(A,S){var y=S.frag,_=S.success;if(this.fragPrevious=y,this.state=b.State.IDLE,!_)return;var p=this.tracksBuffered[this.currentTrackId];if(!p)return;for(var d,g=y.start,l=0;l<p.length;l++)if(g>=p[l].start&&g<=p[l].end){d=p[l];break}var E=y.start+y.duration;d?d.end=E:(d={start:g,end:E},p.push(d)),this.fragmentTracker.fragBuffered(y)},w.onBufferFlushing=function(A,S){var y=S.startOffset,_=S.endOffset;if(y===0&&_!==Number.POSITIVE_INFINITY){var p=this.currentTrackId,d=this.levels;if(!d.length||!d[p]||!d[p].details)return;var g=d[p].details,l=g.targetduration,E=_-l;if(E<=0)return;S.endOffsetSubtitles=Math.max(0,E),this.tracksBuffered.forEach(function(U){for(var P=0;P<U.length;){if(U[P].end<=E){U.shift();continue}else if(U[P].start<E)U[P].start=E;else break;P++}}),this.fragmentTracker.removeFragmentsInRange(y,E,v.PlaylistLevelType.SUBTITLE)}},w.onError=function(A,S){var y,_=S.frag;if(!_||_.type!==v.PlaylistLevelType.SUBTITLE)return;(y=this.fragCurrent)!==null&&y!==void 0&&y.loader&&this.fragCurrent.loader.abort(),this.state=b.State.IDLE},w.onSubtitleTracksUpdated=function(A,S){var y=this,_=S.subtitleTracks;this.tracksBuffered=[],this.levels=_.map(function(p){return new m.Level(p)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(p){y.tracksBuffered[p.id]=[]}),this.mediaBuffer=null},w.onSubtitleTrackSwitch=function(A,S){if(this.currentTrackId=S.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var y=this.levels[this.currentTrackId];y!=null&&y.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,y&&this.setInterval(a)},w.onSubtitleTrackLoaded=function(A,S){var y,_=S.details,p=S.id,d=this.currentTrackId,g=this.levels;if(!g.length)return;var l=g[d];if(p>=g.length||p!==d||!l)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,_.live||(y=l.details)!==null&&y!==void 0&&y.live){var E=this.mainDetails;if(_.deltaUpdateFailed||!E)return;var U=E.fragments[0];if(!l.details)_.hasProgramDateTime&&E.hasProgramDateTime?Object(B.alignMediaPlaylistByPDT)(_,E):U&&Object(k.addSliding)(_,U.start);else{var P=this.alignPlaylists(_,l.details);P===0&&U&&Object(k.addSliding)(_,U.start)}}if(l.details=_,this.levelLastLoaded=p,this.tick(),_.live&&!this.fragCurrent&&this.media&&this.state===b.State.IDLE){var j=Object(G.findFragmentByPTS)(null,_.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),l.details=void 0)}},w._handleFragmentLoadComplete=function(A){var S=A.frag,y=A.payload,_=S.decryptdata,p=this.hls;if(this.fragContextChanged(S))return;if(y&&y.byteLength>0&&_&&_.key&&_.iv&&_.method==="AES-128"){var d=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(y),_.key.buffer,_.iv.buffer).then(function(g){var l=performance.now();p.trigger(Q.Events.FRAG_DECRYPTED,{frag:S,payload:g,stats:{tstart:d,tdecrypt:l}})})}},w.doTick=function(){if(!this.media){this.state=b.State.IDLE;return}if(this.state===b.State.IDLE){var A,S=this.currentTrackId,y=this.levels;if(!y.length||!y[S]||!y[S].details)return;var _=y[S].details,p=_.targetduration,d=this.config,g=this.media,l=D.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,g.currentTime-p,d.maxBufferHole),E=l.end,U=l.len,P=this.getMaxBufferLength()+p;if(U>P)return;console.assert(_,"Subtitle track details are defined on idle subtitle stream controller tick");var j=_.fragments,H=j.length,I=_.edge,T,K=this.fragPrevious;if(E<I){var J=d.maxFragLookUpTolerance;K&&_.hasProgramDateTime&&(T=Object(G.findFragmentByPDT)(j,K.endProgramDateTime,J)),T||(T=Object(G.findFragmentByPTS)(K,j,E,J),!T&&K&&K.start<j[0].start&&(T=j[0]))}else T=j[H-1];(A=T)!==null&&A!==void 0&&A.encrypted?(F.logger.log("Loading key for "+T.sn),this.state=b.State.KEY_LOADING,this.hls.trigger(Q.Events.KEY_LOADING,{frag:T})):T&&this.fragmentTracker.getState(T)===R.FragmentState.NOT_LOADED&&this.loadFragment(T,_,E)}},w.loadFragment=function(A,S,y){this.fragCurrent=A,h.prototype.loadFragment.call(this,A,S,y)},r(O,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),O}(b.default)},"./src/controller/subtitle-track-controller.ts":function(ce,Y,N){"use strict";N.r(Y);var Q=N("./src/events.ts"),F=N("./src/utils/texttrack-utils.ts"),D=N("./src/controller/base-playlist-controller.ts"),G=N("./src/types/loader.ts");function B(u,r){for(var c=0;c<r.length;c++){var s=r[c];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(u,s.key,s)}}function k(u,r,c){return r&&B(u.prototype,r),c&&B(u,c),u}function R(u,r){u.prototype=Object.create(r.prototype),u.prototype.constructor=u,b(u,r)}function b(u,r){return b=Object.setPrototypeOf||function(s,a){return s.__proto__=a,s},b(u,r)}var v=function(u){R(r,u);function r(s){var a;return a=u.call(this,s,"[subtitle-track-controller]")||this,a.media=null,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.selectDefaultTrack=!0,a.queuedDefaultTrack=-1,a.trackChangeListener=function(){return a.onTextTracksChanged()},a.asyncPollTrackChange=function(){return a.pollTrackChange(0)},a.useTextTrackPolling=!1,a.subtitlePollingInterval=-1,a.subtitleDisplay=!0,a.registerListeners(),a}var c=r.prototype;return c.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,u.prototype.destroy.call(this)},c.registerListeners=function(){var a=this.hls;a.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(Q.Events.ERROR,this.onError,this)},c.unregisterListeners=function(){var a=this.hls;a.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(Q.Events.ERROR,this.onError,this)},c.onMediaAttached=function(a,o){if(this.media=o.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},c.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},c.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var a=m(this.media.textTracks);a.forEach(function(o){Object(F.clearCurrentCues)(o)}),this.subtitleTrack=-1,this.media=null},c.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},c.onManifestParsed=function(a,o){this.tracks=o.subtitleTracks},c.onSubtitleTrackLoaded=function(a,o){var h=o.id,O=o.details,w=this.trackId,x=this.tracksInGroup[w];if(!x){this.warn("Invalid subtitle track id "+h);return}var A=x.details;x.details=o.details,this.log("subtitle track "+h+" loaded ["+O.startSN+"-"+O.endSN+"]"),h===this.trackId&&(this.retryCount=0,this.playlistLoaded(h,o,A))},c.onLevelLoading=function(a,o){this.switchLevel(o.level)},c.onLevelSwitching=function(a,o){this.switchLevel(o.level)},c.switchLevel=function(a){var o=this.hls.levels[a];if(!(o!=null&&o.textGroupIds))return;var h=o.textGroupIds[o.urlId];if(this.groupId!==h){var O=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,w=this.tracks.filter(function(S){return!h||S.groupId===h});this.tracksInGroup=w;var x=this.findTrackId(O==null?void 0:O.name)||this.findTrackId();this.groupId=h;var A={subtitleTracks:w};this.log("Updating subtitle tracks, "+w.length+' track(s) found in "'+h+'" group-id'),this.hls.trigger(Q.Events.SUBTITLE_TRACKS_UPDATED,A),x!==-1&&this.setSubtitleTrack(x,O)}},c.findTrackId=function(a){for(var o=this.tracksInGroup,h=0;h<o.length;h++){var O=o[h];if((!this.selectDefaultTrack||O.default)&&(!a||a===O.name))return O.id}return-1},c.onError=function(a,o){if(u.prototype.onError.call(this,a,o),o.fatal||!o.context)return;o.context.type===G.PlaylistContextType.SUBTITLE_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},c.loadPlaylist=function(a){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var h=o.id,O=o.groupId,w=o.url;if(a)try{w=a.addDirectives(w)}catch(x){this.warn("Could not construct new URL with HLS Delivery Directives: "+x)}this.log("Loading subtitle playlist for id "+h),this.hls.trigger(Q.Events.SUBTITLE_TRACK_LOADING,{url:w,id:h,groupId:O,deliveryDirectives:a||null})}},c.toggleTrackModes=function(a){var o=this,h=this.media,O=this.subtitleDisplay,w=this.trackId;if(!h)return;var x=m(h.textTracks),A=x.filter(function(_){return _.groupId===o.groupId});if(a===-1)[].slice.call(x).forEach(function(_){_.mode="disabled"});else{var S=A[w];S&&(S.mode="disabled")}var y=A[a];y&&(y.mode=O?"showing":"hidden")},c.setSubtitleTrack=function(a,o){var h,O=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(h=O[a])!==null&&h!==void 0&&h.details)||a<-1||a>=O.length)return;this.clearTimer();var w=O[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,w){var x=w.id,A=w.groupId,S=A===void 0?"":A,y=w.name,_=w.type,p=w.url;this.hls.trigger(Q.Events.SUBTITLE_TRACK_SWITCH,{id:x,groupId:S,name:y,type:_,url:p});var d=this.switchParams(w.url,o==null?void 0:o.details);this.loadPlaylist(d)}else this.hls.trigger(Q.Events.SUBTITLE_TRACK_SWITCH,{id:a})},c.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,o=m(this.media.textTracks),h=0;h<o.length;h++)if(o[h].mode==="hidden")a=h;else if(o[h].mode==="showing"){a=h;break}this.subtitleTrack!==a&&(this.subtitleTrack=a)},k(r,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1;var o=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(a,o)}}]),r}(D.default);function m(u){for(var r=[],c=0;c<u.length;c++){var s=u[c];s.kind==="subtitles"&&s.label&&r.push(u[c])}return r}Y.default=v},"./src/controller/timeline-controller.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"TimelineController",function(){return m});var Q=N("./src/polyfills/number.ts"),F=N("./src/events.ts"),D=N("./src/utils/cea-608-parser.ts"),G=N("./src/utils/output-filter.ts"),B=N("./src/utils/webvtt-parser.ts"),k=N("./src/utils/texttrack-utils.ts"),R=N("./src/utils/imsc1-ttml-parser.ts"),b=N("./src/types/loader.ts"),v=N("./src/utils/logger.ts"),m=function(){function s(o){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=c(),this.captionsProperties=void 0,this.hls=o,this.config=o.config,this.Cues=o.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 h=new G.default(this,"textTrack1"),O=new G.default(this,"textTrack2"),w=new G.default(this,"textTrack3"),x=new G.default(this,"textTrack4");this.cea608Parser1=new D.default(1,h,O),this.cea608Parser2=new D.default(3,w,x)}o.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),o.on(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),o.on(F.Events.FRAG_LOADING,this.onFragLoading,this),o.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),o.on(F.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),o.on(F.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),o.on(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),o.on(F.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),o.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var a=s.prototype;return a.destroy=function(){var h=this.hls;h.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),h.off(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),h.off(F.Events.FRAG_LOADING,this.onFragLoading,this),h.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(F.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),h.off(F.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),h.off(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.off(F.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),h.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(h,O,w,x,A){for(var S=!1,y=A.length;y--;){var _=A[y],p=r(_[0],_[1],O,w);if(p>=0&&(_[0]=Math.min(_[0],O),_[1]=Math.max(_[1],w),S=!0,p/(w-O)>.5))return}if(S||A.push([O,w]),this.config.renderTextTracksNatively){var d=this.captionsTracks[h];this.Cues.newCue(d,O,w,x)}else{var g=this.Cues.newCue(null,O,w,x);this.hls.trigger(F.Events.CUES_PARSED,{type:"captions",cues:g,track:h})}},a.onInitPtsFound=function(h,O){var w=this,x=O.frag,A=O.id,S=O.initPTS,y=O.timescale,_=this.unparsedVttFrags;A==="main"&&(this.initPTS[x.cc]=S,this.timescale[x.cc]=y),_.length&&(this.unparsedVttFrags=[],_.forEach(function(p){w.onFragLoaded(F.Events.FRAG_LOADED,p)}))},a.getExistingTrack=function(h){var O=this.media;if(O)for(var w=0;w<O.textTracks.length;w++){var x=O.textTracks[w];if(x[h])return x}return null},a.createCaptionsTrack=function(h){this.config.renderTextTracksNatively?this.createNativeTrack(h):this.createNonNativeTrack(h)},a.createNativeTrack=function(h){if(this.captionsTracks[h])return;var O=this.captionsProperties,w=this.captionsTracks,x=this.media,A=O[h],S=A.label,y=A.languageCode,_=this.getExistingTrack(h);if(_)w[h]=_,Object(k.clearCurrentCues)(w[h]),Object(k.sendAddTrackEvent)(w[h],x);else{var p=this.createTextTrack("captions",S,y);p&&(p[h]=!0,w[h]=p)}},a.createNonNativeTrack=function(h){if(this.nonNativeCaptionsTracks[h])return;var O=this.captionsProperties[h];if(!O)return;var w=O.label,x={_id:h,label:w,kind:"captions",default:O.media?!!O.media.default:!1,closedCaptions:O.media};this.nonNativeCaptionsTracks[h]=x,this.hls.trigger(F.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[x]})},a.createTextTrack=function(h,O,w){var x=this.media;return x?x.addTextTrack(h,O,w):void 0},a.onMediaAttaching=function(h,O){this.media=O.media,this._cleanTracks()},a.onMediaDetaching=function(){var h=this.captionsTracks;Object.keys(h).forEach(function(O){Object(k.clearCurrentCues)(h[O]),delete h[O]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=c(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},a._cleanTracks=function(){var h=this.media;if(!h)return;var O=h.textTracks;if(O)for(var w=0;w<O.length;w++)Object(k.clearCurrentCues)(O[w])},a.onSubtitleTracksUpdated=function(h,O){var w=this;this.textTracks=[];var x=O.subtitleTracks||[],A=x.some(function(p){return p.textCodec===R.IMSC1_CODEC});if(this.config.enableWebVTT||A&&this.config.enableIMSC1){var S=this.tracks&&x&&this.tracks.length===x.length;if(this.tracks=x||[],this.config.renderTextTracksNatively){var y=this.media?this.media.textTracks:[];this.tracks.forEach(function(p,d){var g;if(d<y.length){for(var l=null,E=0;E<y.length;E++)if(u(y[E],p)){l=y[E];break}l&&(g=l)}g?Object(k.clearCurrentCues)(g):(g=w.createTextTrack("subtitles",p.name,p.lang),g&&(g.mode="disabled")),g&&(g.groupId=p.groupId,w.textTracks.push(g))})}else if(!S&&this.tracks&&this.tracks.length){var _=this.tracks.map(function(p){return{label:p.name,kind:p.type.toLowerCase(),default:p.default,subtitleTrack:p}});this.hls.trigger(F.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:_})}}},a.onManifestLoaded=function(h,O){var w=this;this.config.enableCEA708Captions&&O.captions&&O.captions.forEach(function(x){var A=/(?:CC|SERVICE)([1-4])/.exec(x.instreamId);if(!A)return;var S="textTrack"+A[1],y=w.captionsProperties[S];if(!y)return;y.label=x.name,x.lang&&(y.languageCode=x.lang),y.media=x})},a.onFragLoading=function(h,O){var w=this.cea608Parser1,x=this.cea608Parser2,A=this.lastSn,S=this.lastPartIndex;if(!this.enabled||!(w&&x))return;if(O.frag.type===b.PlaylistLevelType.MAIN){var y,_,p=O.frag.sn,d=(y=O==null||((_=O.part)===null||_===void 0)?void 0:_.index)!=null?y:-1;p===A+1||p===A&&d===S+1||(w.reset(),x.reset()),this.lastSn=p,this.lastPartIndex=d}},a.onFragLoaded=function(h,O){var w=O.frag,x=O.payload,A=this.initPTS,S=this.unparsedVttFrags;if(w.type===b.PlaylistLevelType.SUBTITLE)if(x.byteLength){if(!Object(Q.isFiniteNumber)(A[w.cc])){S.push(O),A.length&&this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:w,error:new Error("Missing initial subtitle PTS")});return}var y=w.decryptdata;if(y==null||y.key==null||y.method!=="AES-128"){var _=this.tracks[w.level],p=this.vttCCs;p[w.cc]||(p[w.cc]={start:w.start,prevCC:this.prevCC,new:!0},this.prevCC=w.cc),_&&_.textCodec===R.IMSC1_CODEC?this._parseIMSC1(w,x):this._parseVTTs(w,x,p)}}else this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:w,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(h,O){var w=this,x=this.hls;Object(R.parseIMSC1)(O,this.initPTS[h.cc],this.timescale[h.cc],function(A){w._appendCues(A,h.level),x.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(A){v.logger.log("Failed to parse IMSC1: "+A),x.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:A})})},a._parseVTTs=function(h,O,w){var x=this,A=this.hls;Object(B.parseWebVTT)(O,this.initPTS[h.cc],this.timescale[h.cc],w,h.cc,h.start,function(S){x._appendCues(S,h.level),A.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(S){x._fallbackToIMSC1(h,O),v.logger.log("Failed to parse VTT cue: "+S),A.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:S})})},a._fallbackToIMSC1=function(h,O){var w=this,x=this.tracks[h.level];x.textCodec||Object(R.parseIMSC1)(O,this.initPTS[h.cc],this.timescale[h.cc],function(){x.textCodec=R.IMSC1_CODEC,w._parseIMSC1(h,O)},function(){x.textCodec="wvtt"})},a._appendCues=function(h,O){var w=this.hls;if(this.config.renderTextTracksNatively){var x=this.textTracks[O];if(x.mode==="disabled")return;h.forEach(function(y){return Object(k.addCueToTrack)(x,y)})}else{var A=this.tracks[O],S=A.default?"default":"subtitles"+O;w.trigger(F.Events.CUES_PARSED,{type:"subtitles",cues:h,track:S})}},a.onFragDecrypted=function(h,O){var w=O.frag;if(w.type===b.PlaylistLevelType.SUBTITLE){if(!Object(Q.isFiniteNumber)(this.initPTS[w.cc])){this.unparsedVttFrags.push(O);return}this.onFragLoaded(F.Events.FRAG_LOADED,O)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(h,O){var w=this.cea608Parser1,x=this.cea608Parser2;if(!this.enabled||!(w&&x))return;for(var A=0;A<O.samples.length;A++){var S=O.samples[A].bytes;if(S){var y=this.extractCea608Data(S);w.addData(O.samples[A].pts,y[0]),x.addData(O.samples[A].pts,y[1])}}},a.onBufferFlushing=function(h,O){var w=O.startOffset,x=O.endOffset,A=O.endOffsetSubtitles,S=O.type,y=this.media;if(!y||y.currentTime<x)return;if(!S||S==="video"){var _=this.captionsTracks;Object.keys(_).forEach(function(d){return Object(k.removeCuesInRange)(_[d],w,x)})}if(this.config.renderTextTracksNatively&&(w===0&&A!==void 0)){var p=this.textTracks;Object.keys(p).forEach(function(d){return Object(k.removeCuesInRange)(p[d],w,A)})}},a.extractCea608Data=function(h){for(var O=h[0]&31,w=2,x=[[],[]],A=0;A<O;A++){var S=h[w++],y=127&h[w++],_=127&h[w++],p=(4&S)!==0,d=3&S;if(y===0&&_===0)continue;p&&((d===0||d===1)&&(x[d].push(y),x[d].push(_)))}return x},s}();function u(s,a){return s&&s.label===a.name&&!(s.textTrack1||s.textTrack2)}function r(s,a,o,h){return Math.min(a,h)-Math.max(s,o)}function c(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return Q});var Q=function(){function F(G,B){this.subtle=void 0,this.aesIV=void 0,this.subtle=G,this.aesIV=B}var D=F.prototype;return D.decrypt=function(B,k){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},k,B)},F}()},"./src/crypt/aes-decryptor.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"removePadding",function(){return F}),N.d(Y,"default",function(){return D});var Q=N("./src/utils/typed-array.ts");function F(G){var B=G.byteLength,k=B&&new DataView(G.buffer).getUint8(B-1);return k?Object(Q.sliceUint8)(G,0,B-k):G}var D=function(){function G(){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=G.prototype;return B.uint8ArrayToUint32Array_=function(R){for(var b=new DataView(R),v=new Uint32Array(4),m=0;m<4;m++)v[m]=b.getUint32(m*4);return v},B.initTable=function(){var R=this.sBox,b=this.invSBox,v=this.subMix,m=v[0],u=v[1],r=v[2],c=v[3],s=this.invSubMix,a=s[0],o=s[1],h=s[2],O=s[3],w=new Uint32Array(256),x=0,A=0,S=0;for(S=0;S<256;S++)S<128?w[S]=S<<1:w[S]=S<<1^283;for(S=0;S<256;S++){var y=A^A<<1^A<<2^A<<3^A<<4;y=y>>>8^y&255^99,R[x]=y,b[y]=x;var _=w[x],p=w[_],d=w[p],g=w[y]*257^y*16843008;m[x]=g<<24|g>>>8,u[x]=g<<16|g>>>16,r[x]=g<<8|g>>>24,c[x]=g,g=d*16843009^p*65537^_*257^x*16843008,a[y]=g<<24|g>>>8,o[y]=g<<16|g>>>16,h[y]=g<<8|g>>>24,O[y]=g,x?(x=_^w[w[w[d^_]]],A^=w[w[A]]):x=A=1}},B.expandKey=function(R){for(var b=this.uint8ArrayToUint32Array_(R),v=!0,m=0;m<b.length&&v;)v=b[m]===this.key[m],m++;if(v)return;this.key=b;var u=this.keySize=b.length;if(u!==4&&u!==6&&u!==8)throw new Error("Invalid aes key size="+u);var r=this.ksRows=(u+6+1)*4,c,s,a=this.keySchedule=new Uint32Array(r),o=this.invKeySchedule=new Uint32Array(r),h=this.sBox,O=this.rcon,w=this.invSubMix,x=w[0],A=w[1],S=w[2],y=w[3],_,p;for(c=0;c<r;c++){if(c<u){_=a[c]=b[c];continue}p=_,c%u===0?(p=p<<8|p>>>24,p=h[p>>>24]<<24|h[p>>>16&255]<<16|h[p>>>8&255]<<8|h[p&255],p^=O[c/u|0]<<24):u>6&&c%u===4&&(p=h[p>>>24]<<24|h[p>>>16&255]<<16|h[p>>>8&255]<<8|h[p&255]),a[c]=_=(a[c-u]^p)>>>0}for(s=0;s<r;s++)c=r-s,s&3?p=a[c]:p=a[c-4],s<4||c<=4?o[s]=p:o[s]=x[h[p>>>24]]^A[h[p>>>16&255]]^S[h[p>>>8&255]]^y[h[p&255]],o[s]=o[s]>>>0},B.networkToHostOrderSwap=function(R){return R<<24|(R&65280)<<8|(R&16711680)>>8|R>>>24},B.decrypt=function(R,b,v){for(var m=this.keySize+6,u=this.invKeySchedule,r=this.invSBox,c=this.invSubMix,s=c[0],a=c[1],o=c[2],h=c[3],O=this.uint8ArrayToUint32Array_(v),w=O[0],x=O[1],A=O[2],S=O[3],y=new Int32Array(R),_=new Int32Array(y.length),p,d,g,l,E,U,P,j,H,I,T,K,J,ie,pe=this.networkToHostOrderSwap;b<y.length;){for(H=pe(y[b]),I=pe(y[b+1]),T=pe(y[b+2]),K=pe(y[b+3]),E=H^u[0],U=K^u[1],P=T^u[2],j=I^u[3],J=4,ie=1;ie<m;ie++)p=s[E>>>24]^a[U>>16&255]^o[P>>8&255]^h[j&255]^u[J],d=s[U>>>24]^a[P>>16&255]^o[j>>8&255]^h[E&255]^u[J+1],g=s[P>>>24]^a[j>>16&255]^o[E>>8&255]^h[U&255]^u[J+2],l=s[j>>>24]^a[E>>16&255]^o[U>>8&255]^h[P&255]^u[J+3],E=p,U=d,P=g,j=l,J=J+4;p=r[E>>>24]<<24^r[U>>16&255]<<16^r[P>>8&255]<<8^r[j&255]^u[J],d=r[U>>>24]<<24^r[P>>16&255]<<16^r[j>>8&255]<<8^r[E&255]^u[J+1],g=r[P>>>24]<<24^r[j>>16&255]<<16^r[E>>8&255]<<8^r[U&255]^u[J+2],l=r[j>>>24]<<24^r[E>>16&255]<<16^r[U>>8&255]<<8^r[P&255]^u[J+3],_[b]=pe(p^w),_[b+1]=pe(l^x),_[b+2]=pe(g^A),_[b+3]=pe(d^S),w=H,x=I,A=T,S=K,b=b+4}return _.buffer},G}()},"./src/crypt/decrypter.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return b});var Q=N("./src/crypt/aes-crypto.ts"),F=N("./src/crypt/fast-aes-key.ts"),D=N("./src/crypt/aes-decryptor.ts"),G=N("./src/utils/logger.ts"),B=N("./src/utils/mp4-tools.ts"),k=N("./src/utils/typed-array.ts"),R=16,b=function(){function v(u,r,c){var s=c===void 0?{}:c,a=s.removePKCS7Padding,o=a===void 0?!0:a;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=u,this.config=r,this.removePKCS7Padding=o,o)try{var h=self.crypto;h&&(this.subtle=h.subtle||h.webkitSubtle)}catch(O){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var m=v.prototype;return m.destroy=function(){this.observer=null},m.isSync=function(){return this.config.enableSoftwareAES},m.flush=function(){var r=this.currentResult;if(!r){this.reset();return}var c=new Uint8Array(r);return this.reset(),this.removePKCS7Padding?Object(D.removePadding)(c):c},m.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},m.decrypt=function(r,c,s,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(r),c,s);var o=this.flush();o&&a(o.buffer)}else this.webCryptoDecrypt(new Uint8Array(r),c,s).then(a)},m.softwareDecrypt=function(r,c,s){var a=this.currentIV,o=this.currentResult,h=this.remainderData;this.logOnce("JS AES decrypt"),h&&(r=Object(B.appendUint8Array)(h,r),this.remainderData=null);var O=this.getValidChunk(r);if(!O.length)return null;a&&(s=a);var w=this.softwareDecrypter;w||(w=this.softwareDecrypter=new D.default),w.expandKey(c);var x=o;return this.currentResult=w.decrypt(O.buffer,0,s),this.currentIV=Object(k.sliceUint8)(O,-16).buffer,x||null},m.webCryptoDecrypt=function(r,c,s){var a=this,o=this.subtle;return(this.key!==c||!this.fastAesKey)&&(this.key=c,this.fastAesKey=new F.default(o,c)),this.fastAesKey.expandKey().then(function(h){if(!o)return Promise.reject(new Error("web crypto not initialized"));var O=new Q.default(o,s);return O.decrypt(r.buffer,h)}).catch(function(h){return a.onWebCryptoError(h,r,c,s)})},m.onWebCryptoError=function(r,c,s,a){return G.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",r),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(c,s,a)},m.getValidChunk=function(r){var c=r,s=r.length-r.length%R;return s!==r.length&&(c=Object(k.sliceUint8)(r,0,s),this.remainderData=Object(k.sliceUint8)(r,s)),c},m.logOnce=function(r){if(!this.logEnabled)return;G.logger.log("[decrypter.ts]: "+r),this.logEnabled=!1},v}()},"./src/crypt/fast-aes-key.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return Q});var Q=function(){function F(G,B){this.subtle=void 0,this.key=void 0,this.subtle=G,this.key=B}var D=F.prototype;return D.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},F}()},"./src/demux/aacdemuxer.ts":function(ce,Y,N){"use strict";N.r(Y);var Q=N("./src/demux/base-audio-demuxer.ts"),F=N("./src/demux/adts.ts"),D=N("./src/utils/logger.ts"),G=N("./src/demux/id3.ts");function B(b,v){b.prototype=Object.create(v.prototype),b.prototype.constructor=b,k(b,v)}function k(b,v){return k=Object.setPrototypeOf||function(u,r){return u.__proto__=r,u},k(b,v)}var R=function(b){B(v,b);function v(u,r){var c;return c=b.call(this)||this,c.observer=void 0,c.config=void 0,c.observer=u,c.config=r,c}var m=v.prototype;return m.resetInitSegment=function(r,c,s){b.prototype.resetInitSegment.call(this,r,c,s),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:r,duration:s,inputTimeScale:9e4,dropped:0}},v.probe=function(r){if(!r)return!1;for(var c=G.getID3Data(r,0)||[],s=c.length,a=r.length;s<a;s++)if(F.probe(r,s))return D.logger.log("ADTS sync word found !"),!0;return!1},m.canParse=function(r,c){return F.canParse(r,c)},m.appendFrame=function(r,c,s){F.initTrackConfig(r,this.observer,c,s,r.manifestCodec);var a=F.appendFrame(r,c,s,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},v}(Q.default);R.minProbeByteLength=9,Y.default=R},"./src/demux/adts.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"getAudioConfig",function(){return G}),N.d(Y,"isHeaderPattern",function(){return B}),N.d(Y,"getHeaderLength",function(){return k}),N.d(Y,"getFullFrameLength",function(){return R}),N.d(Y,"canGetFrameLength",function(){return b}),N.d(Y,"isHeader",function(){return v}),N.d(Y,"canParse",function(){return m}),N.d(Y,"probe",function(){return u}),N.d(Y,"initTrackConfig",function(){return r}),N.d(Y,"getFrameDuration",function(){return c}),N.d(Y,"parseFrameHeader",function(){return s}),N.d(Y,"appendFrame",function(){return a});var Q=N("./src/utils/logger.ts"),F=N("./src/errors.ts"),D=N("./src/events.ts");function G(o,h,O,w){var x,A,S,y,_=navigator.userAgent.toLowerCase(),p=w,d=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];x=((h[O+2]&192)>>>6)+1;var g=(h[O+2]&60)>>>2;if(g>d.length-1){o.trigger(D.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+g});return}return S=(h[O+2]&1)<<2,S|=(h[O+3]&192)>>>6,Q.logger.log("manifest codec:"+w+", ADTS type:"+x+", samplingIndex:"+g),/firefox/i.test(_)?g>=6?(x=5,y=new Array(4),A=g-3):(x=2,y=new Array(2),A=g):_.indexOf("android")!==-1?(x=2,y=new Array(2),A=g):(x=5,y=new Array(4),w&&(w.indexOf("mp4a.40.29")!==-1||w.indexOf("mp4a.40.5")!==-1)||!w&&g>=6?A=g-3:((w&&w.indexOf("mp4a.40.2")!==-1&&(g>=6&&S===1||/vivaldi/i.test(_))||!w&&S===1)&&(x=2,y=new Array(2)),A=g)),y[0]=x<<3,y[0]|=(g&14)>>1,y[1]|=(g&1)<<7,y[1]|=S<<3,x===5&&(y[1]|=(A&14)>>1,y[2]=(A&1)<<7,y[2]|=2<<2,y[3]=0),{config:y,samplerate:d[g],channelCount:S,codec:"mp4a.40."+x,manifestCodec:p}}function B(o,h){return o[h]===255&&(o[h+1]&246)===240}function k(o,h){return o[h+1]&1?7:9}function R(o,h){return(o[h+3]&3)<<11|o[h+4]<<3|(o[h+5]&224)>>>5}function b(o,h){return h+5<o.length}function v(o,h){return h+1<o.length&&B(o,h)}function m(o,h){return b(o,h)&&B(o,h)&&R(o,h)<=o.length-h}function u(o,h){if(v(o,h)){var O=k(o,h);if(h+O>=o.length)return!1;var w=R(o,h);if(w<=O)return!1;var x=h+w;return x===o.length||v(o,x)}return!1}function r(o,h,O,w,x){if(!o.samplerate){var A=G(h,O,w,x);if(!A)return;o.config=A.config,o.samplerate=A.samplerate,o.channelCount=A.channelCount,o.codec=A.codec,o.manifestCodec=A.manifestCodec,Q.logger.log("parsed codec:"+o.codec+", rate:"+A.samplerate+", channels:"+A.channelCount)}}function c(o){return 1024*9e4/o}function s(o,h,O,w,x){var A=k(o,h),S=R(o,h);if(S-=A,S>0){var y=O+w*x;return{headerLength:A,frameLength:S,stamp:y}}}function a(o,h,O,w,x){var A=c(o.samplerate),S=s(h,O,w,x,A);if(S){var y=S.frameLength,_=S.headerLength,p=S.stamp,d=_+y,g=Math.max(0,O+d-h.length),l;g?(l=new Uint8Array(d-_),l.set(h.subarray(O+_,h.length),0)):l=h.subarray(O+_,O+d);var E={unit:l,pts:p};return g||o.samples.push(E),{sample:E,length:d,missing:g}}}},"./src/demux/base-audio-demuxer.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"initPTSFn",function(){return R});var Q=N("./src/polyfills/number.ts"),F=N("./src/demux/id3.ts"),D=N("./src/demux/dummy-demuxed-track.ts"),G=N("./src/utils/mp4-tools.ts"),B=N("./src/utils/typed-array.ts"),k=function(){function b(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var v=b.prototype;return v.resetInitSegment=function(u,r,c){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},v.resetTimeStamp=function(){},v.resetContiguity=function(){},v.canParse=function(u,r){return!1},v.appendFrame=function(u,r,c){},v.demux=function(u,r){this.cachedData&&(u=Object(G.appendUint8Array)(this.cachedData,u),this.cachedData=null);var c=F.getID3Data(u,0),s=c?c.length:0,a,o,h=this._audioTrack,O=this._id3Track,w=c?F.getTimeStamp(c):void 0,x=u.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=R(w,r)),c&&c.length>0&&O.samples.push({pts:this.initPTS,dts:this.initPTS,data:c}),o=this.initPTS;s<x;){if(this.canParse(u,s)){var A=this.appendFrame(h,u,s);A?(this.frameIndex++,o=A.sample.pts,s+=A.length,a=s):s=x}else F.canParse(u,s)?(c=F.getID3Data(u,s),O.samples.push({pts:o,dts:o,data:c}),s+=c.length,a=s):s++;if(s===x&&a!==x){var S=Object(B.sliceUint8)(u,a);this.cachedData?this.cachedData=Object(G.appendUint8Array)(this.cachedData,S):this.cachedData=S}}return{audioTrack:h,avcTrack:Object(D.dummyTrack)(),id3Track:O,textTrack:Object(D.dummyTrack)()}},v.demuxSampleAes=function(u,r,c){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},v.flush=function(u){var r=this.cachedData;return r&&(this.cachedData=null,this.demux(r,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(D.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(D.dummyTrack)()}},v.destroy=function(){},b}(),R=function(v,m){return Object(Q.isFiniteNumber)(v)?v*90:m*9e4};Y.default=k},"./src/demux/chunk-cache.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return Q});var Q=function(){function D(){this.chunks=[],this.dataLength=0}var G=D.prototype;return G.push=function(k){this.chunks.push(k),this.dataLength+=k.length},G.flush=function(){var k=this.chunks,R=this.dataLength,b;if(k.length)k.length===1?b=k[0]:b=F(k,R);else return new Uint8Array(0);return this.reset(),b},G.reset=function(){this.chunks.length=0,this.dataLength=0},D}();function F(D,G){for(var B=new Uint8Array(G),k=0,R=0;R<D.length;R++){var b=D[R];B.set(b,k),k+=b.length}return B}},"./src/demux/dummy-demuxed-track.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"dummyTrack",function(){return Q});function Q(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ce,Y,N){"use strict";N.r(Y);var Q=N("./src/utils/logger.ts"),F=function(){function D(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 G=D.prototype;return G.loadWord=function(){var k=this.data,R=this.bytesAvailable,b=k.byteLength-R,v=new Uint8Array(4),m=Math.min(4,R);if(m===0)throw new Error("no bytes available");v.set(k.subarray(b,b+m)),this.word=new DataView(v.buffer).getUint32(0),this.bitsAvailable=m*8,this.bytesAvailable-=m},G.skipBits=function(k){var R;this.bitsAvailable>k?(this.word<<=k,this.bitsAvailable-=k):(k-=this.bitsAvailable,R=k>>3,k-=R>>3,this.bytesAvailable-=R,this.loadWord(),this.word<<=k,this.bitsAvailable-=k)},G.readBits=function(k){var R=Math.min(this.bitsAvailable,k),b=this.word>>>32-R;return k>32&&Q.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=R,this.bitsAvailable>0?this.word<<=R:this.bytesAvailable>0&&this.loadWord(),R=k-R,R>0&&this.bitsAvailable?b<<R|this.readBits(R):b},G.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()},G.skipUEG=function(){this.skipBits(1+this.skipLZ())},G.skipEG=function(){this.skipBits(1+this.skipLZ())},G.readUEG=function(){var k=this.skipLZ();return this.readBits(k+1)-1},G.readEG=function(){var k=this.readUEG();return 1&k?1+k>>>1:-1*(k>>>1)},G.readBoolean=function(){return this.readBits(1)===1},G.readUByte=function(){return this.readBits(8)},G.readUShort=function(){return this.readBits(16)},G.readUInt=function(){return this.readBits(32)},G.skipScalingList=function(k){for(var R=8,b=8,v,m=0;m<k;m++)b!==0&&(v=this.readEG(),b=(R+v+256)%256),R=b===0?R:b},G.readSPS=function(){var k=0,R=0,b=0,v=0,m,u,r,c=this.readUByte.bind(this),s=this.readBits.bind(this),a=this.readUEG.bind(this),o=this.readBoolean.bind(this),h=this.skipBits.bind(this),O=this.skipEG.bind(this),w=this.skipUEG.bind(this),x=this.skipScalingList.bind(this);c();var A=c();if(s(5),h(3),c(),w(),A===100||A===110||A===122||A===244||A===44||A===83||A===86||A===118||A===128){var S=a();if(S===3&&h(1),w(),w(),h(1),o())for(u=S!==3?8:12,r=0;r<u;r++)o()&&(r<6?x(16):x(64))}w();var y=a();if(y===0)a();else if(y===1)for(h(1),O(),O(),m=a(),r=0;r<m;r++)O();w(),h(1);var _=a(),p=a(),d=s(1);d===0&&h(1),h(1),o()&&(k=a(),R=a(),b=a(),v=a());var g=[1,1];if(o()&&o()){var l=c();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=[c()<<8|c(),c()<<8|c()];break}}}return{width:Math.ceil((_+1)*16-k*2-R*2),height:(2-d)*(p+1)*16-(d?2:4)*(b+v),pixelRatio:g}},G.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},D}();Y.default=F},"./src/demux/id3.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"isHeader",function(){return Q}),N.d(Y,"isFooter",function(){return F}),N.d(Y,"getID3Data",function(){return D}),N.d(Y,"canParse",function(){return B}),N.d(Y,"getTimeStamp",function(){return k}),N.d(Y,"isTimeStampFrame",function(){return R}),N.d(Y,"getID3Frames",function(){return v}),N.d(Y,"decodeFrame",function(){return m}),N.d(Y,"utf8ArrayToStr",function(){return a}),N.d(Y,"testables",function(){return o});var Q=function(x,A){return A+10<=x.length&&(x[A]===73&&x[A+1]===68&&x[A+2]===51&&(x[A+3]<255&&x[A+4]<255&&(x[A+6]<128&&x[A+7]<128&&x[A+8]<128&&x[A+9]<128)))},F=function(x,A){return A+10<=x.length&&(x[A]===51&&x[A+1]===68&&x[A+2]===73&&(x[A+3]<255&&x[A+4]<255&&(x[A+6]<128&&x[A+7]<128&&x[A+8]<128&&x[A+9]<128)))},D=function(x,A){for(var S=A,y=0;Q(x,A);){y+=10;var _=G(x,A+6);y+=_,F(x,A+10)&&(y+=10),A+=y}return y>0?x.subarray(S,S+y):void 0},G=function(x,A){var S=0;return S=(x[A]&127)<<21,S|=(x[A+1]&127)<<14,S|=(x[A+2]&127)<<7,S|=x[A+3]&127,S},B=function(x,A){return Q(x,A)&&G(x,A+6)+10<=x.length-A},k=function(x){for(var A=v(x),S=0;S<A.length;S++){var y=A[S];if(R(y))return s(y)}return},R=function(x){return x&&x.key==="PRIV"&&x.info==="com.apple.streaming.transportStreamTimestamp"},b=function(x){var A=String.fromCharCode(x[0],x[1],x[2],x[3]),S=G(x,4),y=10;return{type:A,size:S,data:x.subarray(y,y+S)}},v=function(x){for(var A=0,S=[];Q(x,A);){var y=G(x,A+6);A+=10;for(var _=A+y;A+8<_;){var p=b(x.subarray(A)),d=m(p);d&&S.push(d),A+=p.size+10}F(x,A)&&(A+=10)}return S},m=function(x){return x.type==="PRIV"?u(x):x.type[0]==="W"?c(x):r(x)},u=function(x){if(x.size<2)return;var A=a(x.data,!0),S=new Uint8Array(x.data.subarray(A.length+1));return{key:x.type,info:A,data:S.buffer}},r=function(x){if(x.size<2)return;if(x.type==="TXXX"){var A=1,S=a(x.data.subarray(A),!0);A+=S.length+1;var y=a(x.data.subarray(A));return{key:x.type,info:S,data:y}}var _=a(x.data.subarray(1));return{key:x.type,data:_}},c=function(x){if(x.type==="WXXX"){if(x.size<2)return;var A=1,S=a(x.data.subarray(A),!0);A+=S.length+1;var y=a(x.data.subarray(A));return{key:x.type,info:S,data:y}}var _=a(x.data);return{key:x.type,data:_}},s=function(x){if(x.data.byteLength===8){var A=new Uint8Array(x.data),S=A[3]&1,y=(A[4]<<23)+(A[5]<<15)+(A[6]<<7)+A[7];return y/=45,S&&(y+=4772185884e-2),Math.round(y)}return},a=function(x,A){A===void 0&&(A=!1);var S=O();if(S){var y=S.decode(x);if(A){var _=y.indexOf("\0");return _!==-1?y.substring(0,_):y}return y.replace(/\0/g,"")}for(var p=x.length,d,g,l,E="",U=0;U<p;){if(d=x[U++],d===0&&A)return E;if(d===0||d===3)continue;switch(d>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:E+=String.fromCharCode(d);break;case 12:case 13:g=x[U++],E+=String.fromCharCode((d&31)<<6|g&63);break;case 14:g=x[U++],l=x[U++],E+=String.fromCharCode((d&15)<<12|(g&63)<<6|(l&63)<<0);break;default:}}return E},o={decodeTextFrame:r},h;function O(){return!h&&typeof self.TextDecoder!="undefined"&&(h=new self.TextDecoder("utf-8")),h}},"./src/demux/mp3demuxer.ts":function(ce,Y,N){"use strict";N.r(Y);var Q=N("./src/demux/base-audio-demuxer.ts"),F=N("./src/demux/id3.ts"),D=N("./src/utils/logger.ts"),G=N("./src/demux/mpegaudio.ts");function B(b,v){b.prototype=Object.create(v.prototype),b.prototype.constructor=b,k(b,v)}function k(b,v){return k=Object.setPrototypeOf||function(u,r){return u.__proto__=r,u},k(b,v)}var R=function(b){B(v,b);function v(){return b.apply(this,arguments)||this}var m=v.prototype;return m.resetInitSegment=function(r,c,s){b.prototype.resetInitSegment.call(this,r,c,s),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:r,duration:s,inputTimeScale:9e4,dropped:0}},v.probe=function(r){if(!r)return!1;for(var c=F.getID3Data(r,0)||[],s=c.length,a=r.length;s<a;s++)if(G.probe(r,s))return D.logger.log("MPEG Audio sync word found !"),!0;return!1},m.canParse=function(r,c){return G.canParse(r,c)},m.appendFrame=function(r,c,s){return this.initPTS===null?void 0:G.appendFrame(r,c,s,this.initPTS,this.frameIndex)},v}(Q.default);R.minProbeByteLength=4,Y.default=R},"./src/demux/mp4demuxer.ts":function(ce,Y,N){"use strict";N.r(Y);var Q=N("./src/utils/mp4-tools.ts"),F=N("./src/demux/dummy-demuxed-track.ts"),D=function(){function G(k,R){this.remainderData=null,this.config=void 0,this.config=R}var B=G.prototype;return B.resetTimeStamp=function(){},B.resetInitSegment=function(){},B.resetContiguity=function(){},G.probe=function(R){return Object(Q.findBox)({data:R,start:0,end:Math.min(R.length,16384)},["moof"]).length>0},B.demux=function(R){var b=R,v=Object(F.dummyTrack)();if(this.config.progressive){this.remainderData&&(b=Object(Q.appendUint8Array)(this.remainderData,R));var m=Object(Q.segmentValidRange)(b);this.remainderData=m.remainder,v.samples=m.valid||new Uint8Array}else v.samples=b;return{audioTrack:Object(F.dummyTrack)(),avcTrack:v,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},B.flush=function(){var R=Object(F.dummyTrack)();return R.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(F.dummyTrack)(),avcTrack:R,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},B.demuxSampleAes=function(R,b,v){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},B.destroy=function(){},G}();D.minProbeByteLength=1024,Y.default=D},"./src/demux/mpegaudio.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"appendFrame",function(){return k}),N.d(Y,"parseHeader",function(){return R}),N.d(Y,"isHeaderPattern",function(){return b}),N.d(Y,"isHeader",function(){return v}),N.d(Y,"canParse",function(){return m}),N.d(Y,"probe",function(){return u});var Q=null,F=[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],D=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],G=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],B=[0,1,1,4];function k(r,c,s,a,o){if(s+24>c.length)return;var h=R(c,s);if(h&&s+h.frameLength<=c.length){var O=h.samplesPerFrame*9e4/h.sampleRate,w=a+o*O,x={unit:c.subarray(s,s+h.frameLength),pts:w,dts:w};return r.config=[],r.channelCount=h.channelCount,r.samplerate=h.sampleRate,r.samples.push(x),{sample:x,length:h.frameLength,missing:0}}}function R(r,c){var s=r[c+1]>>3&3,a=r[c+1]>>1&3,o=r[c+2]>>4&15,h=r[c+2]>>2&3;if(s!==1&&o!==0&&o!==15&&h!==3){var O=r[c+2]>>1&1,w=r[c+3]>>6,x=s===3?3-a:a===3?3:4,A=F[x*14+o-1]*1e3,S=s===3?0:s===2?1:2,y=D[S*3+h],_=w===3?1:2,p=G[s][a],d=B[a],g=p*8*d,l=Math.floor(p*A/y+O)*d;if(Q===null){var E=navigator.userAgent||"",U=E.match(/Chrome\/(\d+)/i);Q=U?parseInt(U[1]):0}var P=!!Q&&Q<=87;return P&&a===2&&A>=224e3&&w===0&&(r[c+3]=r[c+3]|128),{sampleRate:y,channelCount:_,frameLength:l,samplesPerFrame:g}}}function b(r,c){return r[c]===255&&(r[c+1]&224)===224&&(r[c+1]&6)!==0}function v(r,c){return c+1<r.length&&b(r,c)}function m(r,c){var s=4;return b(r,c)&&s<=r.length-c}function u(r,c){if(c+1<r.length&&b(r,c)){var s=4,a=R(r,c),o=s;a!=null&&a.frameLength&&(o=a.frameLength);var h=c+o;return h===r.length||v(r,h)}return!1}},"./src/demux/sample-aes.ts":function(ce,Y,N){"use strict";N.r(Y);var Q=N("./src/crypt/decrypter.ts"),F=N("./src/demux/tsdemuxer.ts"),D=function(){function G(k,R,b){this.keyData=void 0,this.decrypter=void 0,this.keyData=b,this.decrypter=new Q.default(k,R,{removePKCS7Padding:!1})}var B=G.prototype;return B.decryptBuffer=function(R,b){this.decrypter.decrypt(R,this.keyData.key.buffer,this.keyData.iv.buffer,b)},B.decryptAacSample=function(R,b,v,m){var u=R[b].unit,r=u.subarray(16,u.length-u.length%16),c=r.buffer.slice(r.byteOffset,r.byteOffset+r.length),s=this;this.decryptBuffer(c,function(a){var o=new Uint8Array(a);u.set(o,16),m||s.decryptAacSamples(R,b+1,v)})},B.decryptAacSamples=function(R,b,v){for(;;b++){if(b>=R.length){v();return}if(R[b].unit.length<32)continue;var m=this.decrypter.isSync();if(this.decryptAacSample(R,b,v,m),!m)return}},B.getAvcEncryptedData=function(R){for(var b=Math.floor((R.length-48)/160)*16+16,v=new Int8Array(b),m=0,u=32;u<=R.length-16;u+=160,m+=16)v.set(R.subarray(u,u+16),m);return v},B.getAvcDecryptedUnit=function(R,b){for(var v=new Uint8Array(b),m=0,u=32;u<=R.length-16;u+=160,m+=16)R.set(v.subarray(m,m+16),u);return R},B.decryptAvcSample=function(R,b,v,m,u,r){var c=Object(F.discardEPB)(u.data),s=this.getAvcEncryptedData(c),a=this;this.decryptBuffer(s.buffer,function(o){u.data=a.getAvcDecryptedUnit(c,o),r||a.decryptAvcSamples(R,b,v+1,m)})},B.decryptAvcSamples=function(R,b,v,m){if(R instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;b++,v=0){if(b>=R.length){m();return}for(var u=R[b].units;!(v>=u.length);v++){var r=u[v];if(r.data.length<=48||r.type!==1&&r.type!==5)continue;var c=this.decrypter.isSync();if(this.decryptAvcSample(R,b,v,m,r,c),!c)return}}},G}();Y.default=D},"./src/demux/transmuxer-interface.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return u});var Q=N("./node_modules/webworkify-webpack/index.js"),F=N.n(Q),D=N("./src/events.ts"),G=N("./src/demux/transmuxer.ts"),B=N("./src/utils/logger.ts"),k=N("./src/errors.ts"),R=N("./src/utils/mediasource-helper.ts"),b=N("./node_modules/eventemitter3/index.js"),v=N.n(b),m=Object(R.getMediaSource)()||{isTypeSupported:function(){return!1}},u=function(){function r(s,a,o,h){var O=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=s,this.id=a,this.onTransmuxComplete=o,this.onFlush=h;var w=s.config,x=function(p,d){d=d||{},d.frag=O.frag,d.id=O.id,s.trigger(p,d)};this.observer=new b.EventEmitter,this.observer.on(D.Events.FRAG_DECRYPTED,x),this.observer.on(D.Events.ERROR,x);var A={mp4:m.isTypeSupported("video/mp4"),mpeg:m.isTypeSupported("audio/mpeg"),mp3:m.isTypeSupported('audio/mp4; codecs="mp3"')},S=navigator.vendor;if(w.enableWorker&&typeof Worker!="undefined"){B.logger.log("demuxing in webworker");var y;try{y=this.worker=Q("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),y.addEventListener("message",this.onwmsg),y.onerror=function(_){s.trigger(D.Events.ERROR,{type:k.ErrorTypes.OTHER_ERROR,details:k.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(_.message+" ("+_.filename+":"+_.lineno+")")})},y.postMessage({cmd:"init",typeSupported:A,vendor:S,id:a,config:JSON.stringify(w)})}catch(_){B.logger.warn("Error in worker:",_),B.logger.error("Error while initializing DemuxerWorker, fallback to inline"),y&&self.URL.revokeObjectURL(y.objectURL),this.transmuxer=new G.default(this.observer,A,w,S,a),this.worker=null}}else this.transmuxer=new G.default(this.observer,A,w,S,a)}var c=r.prototype;return c.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.terminate(),this.worker=null;else{var o=this.transmuxer;o&&(o.destroy(),this.transmuxer=null)}var h=this.observer;h&&h.removeAllListeners(),this.observer=null},c.push=function(a,o,h,O,w,x,A,S,y,_){var p=this;y.transmuxing.start=self.performance.now();var d=this.transmuxer,g=this.worker,l=x?x.start:w.start,E=w.decryptdata,U=this.frag,P=!(U&&w.cc===U.cc),j=!(U&&y.level===U.level),H=U?y.sn-U.sn:-1,I=this.part?y.part-this.part.index:1,T=!j&&(H===1||H===0&&I===1),K=self.performance.now();(j||H||w.stats.parsing.start===0)&&(w.stats.parsing.start=K),x&&(I||!T)&&(x.stats.parsing.start=K);var J=new G.TransmuxState(P,T,S,j,l);if(!T||P){B.logger.log("[transmuxer-interface, "+w.type+"]: Starting new transmux session for sn: "+y.sn+" p: "+y.part+" level: "+y.level+" id: "+y.id+`
|
|
discontinuity: `+P+`
|
|
trackSwitch: `+j+`
|
|
contiguous: `+T+`
|
|
accurateTimeOffset: `+S+`
|
|
timeOffset: `+l);var ie=new G.TransmuxConfig(h,O,o,A,_);this.configureTransmuxer(ie)}if(this.frag=w,this.part=x,g)g.postMessage({cmd:"demux",data:a,decryptdata:E,chunkMeta:y,state:J},a instanceof ArrayBuffer?[a]:[]);else if(d){var pe=d.push(a,E,y,J);Object(G.isPromise)(pe)?pe.then(function(_e){p.handleTransmuxComplete(_e)}):this.handleTransmuxComplete(pe)}},c.flush=function(a){var o=this;a.transmuxing.start=self.performance.now();var h=this.transmuxer,O=this.worker;if(O)O.postMessage({cmd:"flush",chunkMeta:a});else if(h){var w=h.flush(a);Object(G.isPromise)(w)?w.then(function(x){o.handleFlushResult(x,a)}):this.handleFlushResult(w,a)}},c.handleFlushResult=function(a,o){var h=this;a.forEach(function(O){h.handleTransmuxComplete(O)}),this.onFlush(o)},c.onWorkerMessage=function(a){var o=a.data,h=this.hls;switch(o.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(o.data);break}case"flush":{this.onFlush(o.data);break}default:{o.data=o.data||{},o.data.frag=this.frag,o.data.id=this.id,h.trigger(o.event,o.data);break}}},c.configureTransmuxer=function(a){var o=this.worker,h=this.transmuxer;o?o.postMessage({cmd:"configure",config:a}):h&&h.configure(a)},c.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},r}()},"./src/demux/transmuxer-worker.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return k});var Q=N("./src/demux/transmuxer.ts"),F=N("./src/events.ts"),D=N("./src/utils/logger.ts"),G=N("./node_modules/eventemitter3/index.js"),B=N.n(G);function k(u){var r=new G.EventEmitter,c=function(a,o){u.postMessage({event:a,data:o})};r.on(F.Events.FRAG_DECRYPTED,c),r.on(F.Events.ERROR,c),u.addEventListener("message",function(s){var a=s.data;switch(a.cmd){case"init":{var o=JSON.parse(a.config);u.transmuxer=new Q.default(r,a.typeSupported,o,a.vendor,a.id),Object(D.enableLogs)(o.debug),c("init",null);break}case"configure":{u.transmuxer.configure(a.config);break}case"demux":{var h=u.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(Q.isPromise)(h)?h.then(function(x){R(u,x)}):R(u,h);break}case"flush":{var O=a.chunkMeta,w=u.transmuxer.flush(O);Object(Q.isPromise)(w)?w.then(function(x){v(u,x,O)}):v(u,w,O);break}default:break}})}function R(u,r){if(m(r.remuxResult))return;var c=[],s=r.remuxResult,a=s.audio,o=s.video;a&&b(c,a),o&&b(c,o),u.postMessage({event:"transmuxComplete",data:r},c)}function b(u,r){r.data1&&u.push(r.data1.buffer),r.data2&&u.push(r.data2.buffer)}function v(u,r,c){r.forEach(function(s){R(u,s)}),u.postMessage({event:"flush",data:c})}function m(u){return!u.audio&&!u.video&&!u.text&&!u.id3&&!u.initSegment}},"./src/demux/transmuxer.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return o}),N.d(Y,"isPromise",function(){return w}),N.d(Y,"TransmuxConfig",function(){return x}),N.d(Y,"TransmuxState",function(){return A});var Q=N("./src/events.ts"),F=N("./src/errors.ts"),D=N("./src/crypt/decrypter.ts"),G=N("./src/demux/aacdemuxer.ts"),B=N("./src/demux/mp4demuxer.ts"),k=N("./src/demux/tsdemuxer.ts"),R=N("./src/demux/mp3demuxer.ts"),b=N("./src/remux/mp4-remuxer.ts"),v=N("./src/remux/passthrough-remuxer.ts"),m=N("./src/demux/chunk-cache.ts"),u=N("./src/utils/mp4-tools.ts"),r=N("./src/utils/logger.ts"),c;try{c=self.performance.now.bind(self.performance)}catch(S){r.logger.debug("Unable to use Performance API on this environment"),c=self.Date.now}var s=[{demux:k.default,remux:b.default},{demux:B.default,remux:v.default},{demux:G.default,remux:b.default},{demux:R.default,remux:b.default}],a=1024;s.forEach(function(S){var y=S.demux;a=Math.max(a,y.minProbeByteLength)});var o=function(){function S(_,p,d,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 m.default,this.observer=_,this.typeSupported=p,this.config=d,this.vendor=g,this.id=l}var y=S.prototype;return y.configure=function(p){this.transmuxConfig=p,this.decrypter&&this.decrypter.reset()},y.push=function(p,d,g,l){var E=this,U=g.transmuxing;U.executeStart=c();var P=new Uint8Array(p),j=this.cache,H=this.config,I=this.currentTransmuxState,T=this.transmuxConfig;l&&(this.currentTransmuxState=l);var K=h(P,d);if(K&&K.method==="AES-128"){var J=this.getDecrypter();if(H.enableSoftwareAES){var ie=J.softwareDecrypt(P,K.key.buffer,K.iv.buffer);if(!ie)return U.executeEnd=c(),O(g);P=new Uint8Array(ie)}else return this.decryptionPromise=J.webCryptoDecrypt(P,K.key.buffer,K.iv.buffer).then(function(Le){var Pe=E.push(Le,null,g);return E.decryptionPromise=null,Pe}),this.decryptionPromise}var pe=l||I,_e=pe.contiguous,Te=pe.discontinuity,he=pe.trackSwitch,re=pe.accurateTimeOffset,fe=pe.timeOffset,ae=T.audioCodec,oe=T.videoCodec,Z=T.defaultInitPts,ne=T.duration,se=T.initSegmentData;if((Te||he)&&this.resetInitSegment(se,ae,oe,ne),Te&&this.resetInitialTimestamp(Z),_e||this.resetContiguity(),this.needsProbing(P,Te,he)){if(j.dataLength){var me=j.flush();P=Object(u.appendUint8Array)(me,P)}this.configureTransmuxer(P,T)}var Se=this.transmux(P,K,fe,re,g),Ee=this.currentTransmuxState;return Ee.contiguous=!0,Ee.discontinuity=!1,Ee.trackSwitch=!1,U.executeEnd=c(),Se},y.flush=function(p){var d=this,g=p.transmuxing;g.executeStart=c();var l=this.decrypter,E=this.cache,U=this.currentTransmuxState,P=this.decryptionPromise;if(P)return P.then(function(){return d.flush(p)});var j=[],H=U.timeOffset;if(l){var I=l.flush();I&&j.push(this.push(I,null,p))}var T=E.dataLength;E.reset();var K=this.demuxer,J=this.remuxer;if(!K||!J)return T>=a&&this.observer.emit(Q.Events.ERROR,Q.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),g.executeEnd=c(),[O(p)];var ie=K.flush(H);return w(ie)?ie.then(function(pe){return d.flushRemux(j,pe,p),j}):(this.flushRemux(j,ie,p),j)},y.flushRemux=function(p,d,g){var l=d.audioTrack,E=d.avcTrack,U=d.id3Track,P=d.textTrack,j=this.currentTransmuxState,H=j.accurateTimeOffset,I=j.timeOffset;r.logger.log("[transmuxer.ts]: Flushed fragment "+g.sn+(g.part>-1?" p: "+g.part:"")+" of level "+g.level);var T=this.remuxer.remux(l,E,U,P,I,H,!0,this.id);p.push({remuxResult:T,chunkMeta:g}),g.transmuxing.executeEnd=c()},y.resetInitialTimestamp=function(p){var d=this.demuxer,g=this.remuxer;if(!d||!g)return;d.resetTimeStamp(p),g.resetTimeStamp(p)},y.resetContiguity=function(){var p=this.demuxer,d=this.remuxer;if(!p||!d)return;p.resetContiguity(),d.resetNextTimestamp()},y.resetInitSegment=function(p,d,g,l){var E=this.demuxer,U=this.remuxer;if(!E||!U)return;E.resetInitSegment(d,g,l),U.resetInitSegment(p,d,g)},y.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},y.transmux=function(p,d,g,l,E){var U;return d&&d.method==="SAMPLE-AES"?U=this.transmuxSampleAes(p,d,g,l,E):U=this.transmuxUnencrypted(p,g,l,E),U},y.transmuxUnencrypted=function(p,d,g,l){var E=this.demuxer.demux(p,d,!1,!this.config.progressive),U=E.audioTrack,P=E.avcTrack,j=E.id3Track,H=E.textTrack,I=this.remuxer.remux(U,P,j,H,d,g,!1,this.id);return{remuxResult:I,chunkMeta:l}},y.transmuxSampleAes=function(p,d,g,l,E){var U=this;return this.demuxer.demuxSampleAes(p,d,g).then(function(P){var j=U.remuxer.remux(P.audioTrack,P.avcTrack,P.id3Track,P.textTrack,g,l,!1,U.id);return{remuxResult:j,chunkMeta:E}})},y.configureTransmuxer=function(p,d){for(var g=this.config,l=this.observer,E=this.typeSupported,U=this.vendor,P=d.audioCodec,j=d.defaultInitPts,H=d.duration,I=d.initSegmentData,T=d.videoCodec,K,J=0,ie=s.length;J<ie;J++)if(s[J].demux.probe(p)){K=s[J];break}K||(r.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),K={demux:B.default,remux:v.default});var pe=this.demuxer,_e=this.remuxer,Te=K.remux,he=K.demux;(!_e||!(_e instanceof Te))&&(this.remuxer=new Te(l,g,E,U)),(!pe||!(pe instanceof he))&&(this.demuxer=new he(l,g,E),this.probe=he.probe),this.resetInitSegment(I,P,T,H),this.resetInitialTimestamp(j)},y.needsProbing=function(p,d,g){return!this.demuxer||!this.remuxer||d||g},y.getDecrypter=function(){var p=this.decrypter;return p||(p=this.decrypter=new D.default(this.observer,this.config)),p},S}();function h(S,y){var _=null;return S.byteLength>0&&y!=null&&y.key!=null&&y.iv!==null&&y.method!=null&&(_=y),_}var O=function(y){return{remuxResult:{},chunkMeta:y}};function w(S){return"then"in S&&S.then instanceof Function}var x=function(y,_,p,d,g){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=y,this.videoCodec=_,this.initSegmentData=p,this.duration=d,this.defaultInitPts=g},A=function(y,_,p,d,g){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=y,this.contiguous=_,this.accurateTimeOffset=p,this.trackSwitch=d,this.timeOffset=g}},"./src/demux/tsdemuxer.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"discardEPB",function(){return O});var Q=N("./src/demux/adts.ts"),F=N("./src/demux/mpegaudio.ts"),D=N("./src/demux/exp-golomb.ts"),G=N("./src/demux/id3.ts"),B=N("./src/demux/sample-aes.ts"),k=N("./src/events.ts"),R=N("./src/utils/mp4-tools.ts"),b=N("./src/utils/logger.ts"),v=N("./src/errors.ts"),m={video:1,audio:2,id3:3,text:4},u=function(){function w(A,S,y){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=A,this.config=S,this.typeSupported=y}w.probe=function(S){var y=w.syncOffset(S);return y<0?!1:(y&&b.logger.warn("MPEG2-TS detected but first sync word found @ offset "+y+", junk ahead ?"),!0)},w.syncOffset=function(S){for(var y=Math.min(1e3,S.length-3*188),_=0;_<y;){if(S[_]===71&&S[_+188]===71&&S[_+2*188]===71)return _;_++}return-1},w.createTrack=function(S,y){return{container:S==="video"||S==="audio"?"video/mp2t":void 0,type:S,id:m[S],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:S==="audio"?y:void 0}};var x=w.prototype;return x.resetInitSegment=function(S,y,_){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=w.createTrack("video",_),this._audioTrack=w.createTrack("audio",_),this._id3Track=w.createTrack("id3",_),this._txtTrack=w.createTrack("text",_),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=S,this.videoCodec=y,this._duration=_},x.resetTimeStamp=function(){},x.resetContiguity=function(){var S=this._audioTrack,y=this._avcTrack,_=this._id3Track;S&&(S.pesData=null),y&&(y.pesData=null),_&&(_.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},x.demux=function(S,y,_,p){_===void 0&&(_=!1),p===void 0&&(p=!1),_||(this.sampleAes=null);var d,g=this._avcTrack,l=this._audioTrack,E=this._id3Track,U=g.pid,P=g.pesData,j=l.pid,H=E.pid,I=l.pesData,T=E.pesData,K=!1,J=this.pmtParsed,ie=this._pmtId,pe=S.length;if(this.remainderData&&(S=Object(R.appendUint8Array)(this.remainderData,S),pe=S.length,this.remainderData=null),pe<188&&!p)return this.remainderData=S,{audioTrack:l,avcTrack:g,id3Track:E,textTrack:this._txtTrack};var _e=Math.max(0,w.syncOffset(S));pe-=(pe+_e)%188,pe<S.byteLength&&!p&&(this.remainderData=new Uint8Array(S.buffer,pe,S.buffer.byteLength-pe));for(var Te=_e;Te<pe;Te+=188)if(S[Te]===71){var he=!!(S[Te+1]&64),re=((S[Te+1]&31)<<8)+S[Te+2],fe=(S[Te+3]&48)>>4,ae=void 0;if(fe>1){if(ae=Te+5+S[Te+4],ae===Te+188)continue}else ae=Te+4;switch(re){case U:he&&(P&&(d=a(P))&&this.parseAVCPES(d,!1),P={data:[],size:0}),P&&(P.data.push(S.subarray(ae,Te+188)),P.size+=Te+188-ae);break;case j:he&&(I&&(d=a(I))&&(l.isAAC?this.parseAACPES(d):this.parseMPEGPES(d)),I={data:[],size:0}),I&&(I.data.push(S.subarray(ae,Te+188)),I.size+=Te+188-ae);break;case H:he&&(T&&(d=a(T))&&this.parseID3PES(d),T={data:[],size:0}),T&&(T.data.push(S.subarray(ae,Te+188)),T.size+=Te+188-ae);break;case 0:he&&(ae+=S[ae]+1),ie=this._pmtId=c(S,ae);break;case ie:{he&&(ae+=S[ae]+1);var oe=s(S,ae,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,_);U=oe.avc,U>0&&(g.pid=U),j=oe.audio,j>0&&(l.pid=j,l.isAAC=oe.isAAC),H=oe.id3,H>0&&(E.pid=H),K&&!J&&(b.logger.log("reparse from beginning"),K=!1,Te=_e-188),J=this.pmtParsed=!0;break}case 17:case 8191:break;default:K=!0;break}}else this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:v.ErrorTypes.MEDIA_ERROR,details:v.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});g.pesData=P,l.pesData=I,E.pesData=T;var Z={audioTrack:l,avcTrack:g,id3Track:E,textTrack:this._txtTrack};return p&&this.extractRemainingSamples(Z),Z},x.flush=function(){var S=this.remainderData;this.remainderData=null;var y;return S?y=this.demux(S,-1,!1,!0):y={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(y),this.sampleAes?this.decrypt(y,this.sampleAes):y},x.extractRemainingSamples=function(S){var y=S.audioTrack,_=S.avcTrack,p=S.id3Track,d=_.pesData,g=y.pesData,l=p.pesData,E;d&&(E=a(d))?(this.parseAVCPES(E,!0),_.pesData=null):_.pesData=d,g&&(E=a(g))?(y.isAAC?this.parseAACPES(E):this.parseMPEGPES(E),y.pesData=null):(g!=null&&g.size&&b.logger.log("last AAC PES packet truncated,might overlap between fragments"),y.pesData=g),l&&(E=a(l))?(this.parseID3PES(E),p.pesData=null):p.pesData=l},x.demuxSampleAes=function(S,y,_){var p=this.demux(S,_,!0,!this.config.progressive),d=this.sampleAes=new B.default(this.observer,this.config,y);return this.decrypt(p,d)},x.decrypt=function(S,y){return new Promise(function(_){var p=S.audioTrack,d=S.avcTrack;p.samples&&p.isAAC?y.decryptAacSamples(p.samples,0,function(){d.samples?y.decryptAvcSamples(d.samples,0,0,function(){_(S)}):_(S)}):d.samples&&y.decryptAvcSamples(d.samples,0,0,function(){_(S)})})},x.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},x.parseAVCPES=function(S,y){var _=this,p=this._avcTrack,d=this.parseAVCNALu(S.data),g=!1,l=this.avcSample,E,U=!1;S.data=null,l&&d.length&&!p.audFound&&(o(l,p),l=this.avcSample=r(!1,S.pts,S.dts,"")),d.forEach(function(P){switch(P.type){case 1:{E=!0,l||(l=_.avcSample=r(!0,S.pts,S.dts,"")),g&&(l.debug+="NDR "),l.frame=!0;var j=P.data;if(U&&j.length>4){var H=new D.default(j).readSliceType();(H===2||H===4||H===7||H===9)&&(l.key=!0)}break}case 5:E=!0,l||(l=_.avcSample=r(!0,S.pts,S.dts,"")),g&&(l.debug+="IDR "),l.key=!0,l.frame=!0;break;case 6:{E=!0,g&&l&&(l.debug+="SEI ");var I=new D.default(O(P.data));I.readUByte();for(var T=0,K=0,J=!1,ie=0;!J&&I.bytesAvailable>1;){T=0;do ie=I.readUByte(),T+=ie;while(ie===255);K=0;do ie=I.readUByte(),K+=ie;while(ie===255);if(T===4&&I.bytesAvailable!==0){J=!0;var pe=I.readUByte();if(pe===181){var _e=I.readUShort();if(_e===49){var Te=I.readUInt();if(Te===1195456820){var he=I.readUByte();if(he===3){for(var re=I.readUByte(),fe=I.readUByte(),ae=31&re,oe=[re,fe],Z=0;Z<ae;Z++)oe.push(I.readUByte()),oe.push(I.readUByte()),oe.push(I.readUByte());h(_._txtTrack.samples,{type:3,pts:S.pts,bytes:oe})}}}}}else if(T===5&&I.bytesAvailable!==0){if(J=!0,K>16){for(var ne=[],se=0;se<16;se++)ne.push(I.readUByte().toString(16)),(se===3||se===5||se===7||se===9)&&ne.push("-");for(var me=K-16,Se=new Uint8Array(me),Ee=0;Ee<me;Ee++)Se[Ee]=I.readUByte();h(_._txtTrack.samples,{pts:S.pts,payloadType:T,uuid:ne.join(""),userData:Object(G.utf8ArrayToStr)(Se),userDataBytes:Se})}}else if(K<I.bytesAvailable)for(var Le=0;Le<K;Le++)I.readUByte()}break}case 7:if(E=!0,U=!0,g&&l&&(l.debug+="SPS "),!p.sps){var Pe=new D.default(P.data),Be=Pe.readSPS();p.width=Be.width,p.height=Be.height,p.pixelRatio=Be.pixelRatio,p.sps=[P.data],p.duration=_._duration;for(var He=P.data.subarray(1,4),Ge="avc1.",Ue=0;Ue<3;Ue++){var tt=He[Ue].toString(16);tt.length<2&&(tt="0"+tt),Ge+=tt}p.codec=Ge}break;case 8:E=!0,g&&l&&(l.debug+="PPS "),p.pps||(p.pps=[P.data]);break;case 9:E=!1,p.audFound=!0,l&&o(l,p),l=_.avcSample=r(!1,S.pts,S.dts,g?"AUD ":"");break;case 12:E=!1;break;default:E=!1,l&&(l.debug+="unknown NAL "+P.type+" ");break}if(l&&E){var nt=l.units;nt.push(P)}}),y&&l&&(o(l,p),this.avcSample=null)},x.getLastNalUnit=function(){var S,y=this.avcSample,_;if(!y||y.units.length===0){var p=this._avcTrack.samples;y=p[p.length-1]}if((S=y)!==null&&S!==void 0&&S.units){var d=y.units;_=d[d.length-1]}return _},x.parseAVCNALu=function(S){var y=S.byteLength,_=this._avcTrack,p=_.naluState||0,d=p,g=[],l=0,E,U,P,j=-1,H=0;for(p===-1&&(j=0,H=S[0]&31,p=0,l=1);l<y;){if(E=S[l++],!p){p=E?0:1;continue}if(p===1){p=E?0:2;continue}if(!E)p=3;else if(E===1){if(j>=0){var I={data:S.subarray(j,l-p-1),type:H};g.push(I)}else{var T=this.getLastNalUnit();if(T&&(d&&l<=4-d&&(T.state&&(T.data=T.data.subarray(0,T.data.byteLength-d))),U=l-p-1,U>0)){var K=new Uint8Array(T.data.byteLength+U);K.set(T.data,0),K.set(S.subarray(0,U),T.data.byteLength),T.data=K,T.state=0}}l<y?(P=S[l]&31,j=l,H=P,p=0):p=-1}else p=0}if(j>=0&&p>=0){var J={data:S.subarray(j,y),type:H,state:p};g.push(J)}if(g.length===0){var ie=this.getLastNalUnit();if(ie){var pe=new Uint8Array(ie.data.byteLength+S.byteLength);pe.set(ie.data,0),pe.set(S,ie.data.byteLength),ie.data=pe}}return _.naluState=p,g},x.parseAACPES=function(S){var y=0,_=this._audioTrack,p=this.aacOverFlow,d=S.data;if(p){this.aacOverFlow=null;var g=p.sample.unit.byteLength,l=Math.min(p.missing,g),E=g-l;p.sample.unit.set(d.subarray(0,l),E),_.samples.push(p.sample),y=p.missing}var U,P;for(U=y,P=d.length;U<P-1&&!Q.isHeader(d,U);U++);if(U!==y){var j,H;if(U<P-1?(j="AAC PES did not start with ADTS header,offset:"+U,H=!1):(j="no ADTS header found in AAC PES",H=!0),b.logger.warn("parsing error:"+j),this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:v.ErrorTypes.MEDIA_ERROR,details:v.ErrorDetails.FRAG_PARSING_ERROR,fatal:H,reason:j}),H)return}Q.initTrackConfig(_,this.observer,d,U,this.audioCodec);var I;if(S.pts!==void 0)I=S.pts;else if(p){var T=Q.getFrameDuration(_.samplerate);I=p.sample.pts+T}else{b.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var K=0;U<P;)if(Q.isHeader(d,U)){if(U+5<P){var J=Q.appendFrame(_,d,U,I,K);if(J)if(J.missing)this.aacOverFlow=J;else{U+=J.length,K++;continue}}break}else U++},x.parseMPEGPES=function(S){var y=S.data,_=y.length,p=0,d=0,g=S.pts;if(g===void 0){b.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;d<_;)if(F.isHeader(y,d)){var l=F.appendFrame(this._audioTrack,y,d,g,p);if(l)d+=l.length,p++;else break}else d++},x.parseID3PES=function(S){if(S.pts===void 0){b.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(S)},w}();u.minProbeByteLength=188;function r(w,x,A,S){return{key:w,frame:!1,pts:x,dts:A,units:[],debug:S,length:0}}function c(w,x){return(w[x+10]&31)<<8|w[x+11]}function s(w,x,A,S){var y={audio:-1,avc:-1,id3:-1,isAAC:!0},_=(w[x+1]&15)<<8|w[x+2],p=x+3+_-4,d=(w[x+10]&15)<<8|w[x+11];for(x+=12+d;x<p;){var g=(w[x+1]&31)<<8|w[x+2];switch(w[x]){case 207:if(!S){b.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:y.audio===-1&&(y.audio=g);break;case 21:y.id3===-1&&(y.id3=g);break;case 219:if(!S){b.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:y.avc===-1&&(y.avc=g);break;case 3:case 4:A?y.audio===-1&&(y.audio=g,y.isAAC=!1):b.logger.log("MPEG audio found, not supported in this browser");break;case 36:b.logger.warn("Unsupported HEVC stream type found");break;default:break}x+=((w[x+3]&15)<<8|w[x+4])+5}return y}function a(w){var x=0,A,S,y,_,p,d=w.data;if(!w||w.size===0)return null;for(;d[0].length<19&&d.length>1;){var g=new Uint8Array(d[0].length+d[1].length);g.set(d[0]),g.set(d[1],d[0].length),d[0]=g,d.splice(1,1)}A=d[0];var l=(A[0]<<16)+(A[1]<<8)+A[2];if(l===1){if(S=(A[4]<<8)+A[5],S&&S>w.size-6)return null;var E=A[7];E&192&&(_=(A[9]&14)*536870912+(A[10]&255)*4194304+(A[11]&254)*16384+(A[12]&255)*128+(A[13]&254)/2,E&64?(p=(A[14]&14)*536870912+(A[15]&255)*4194304+(A[16]&254)*16384+(A[17]&255)*128+(A[18]&254)/2,_-p>60*9e4&&(b.logger.warn(Math.round((_-p)/9e4)+"s delta between PTS and DTS, align them"),_=p)):p=_),y=A[8];var U=y+9;if(w.size<=U)return null;w.size-=U;for(var P=new Uint8Array(w.size),j=0,H=d.length;j<H;j++){A=d[j];var I=A.byteLength;if(U)if(U>I){U-=I;continue}else A=A.subarray(U),I-=U,U=0;P.set(A,x),x+=I}return S&&(S-=y+3),{data:P,pts:_,dts:p,len:S}}return null}function o(w,x){if(w.units.length&&w.frame){if(w.pts===void 0){var A=x.samples,S=A.length;if(S){var y=A[S-1];w.pts=y.pts,w.dts=y.dts}else{x.dropped++;return}}x.samples.push(w)}w.debug.length&&b.logger.log(w.pts+"/"+w.dts+":"+w.debug)}function h(w,x){var A=w.length;if(A>0){if(x.pts>=w[A-1].pts)w.push(x);else for(var S=A-1;S>=0;S--)if(x.pts<w[S].pts){w.splice(S,0,x);break}}else w.push(x)}function O(w){for(var x=w.byteLength,A=[],S=1;S<x-2;)w[S]===0&&w[S+1]===0&&w[S+2]===3?(A.push(S+2),S+=2):S++;if(A.length===0)return w;var y=x-A.length,_=new Uint8Array(y),p=0;for(S=0;S<y;p++,S++)p===A[0]&&(p++,A.shift()),_[S]=w[p];return _}Y.default=u},"./src/errors.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"ErrorTypes",function(){return Q}),N.d(Y,"ErrorDetails",function(){return F});var Q;(function(D){D.NETWORK_ERROR="networkError",D.MEDIA_ERROR="mediaError",D.KEY_SYSTEM_ERROR="keySystemError",D.MUX_ERROR="muxError",D.OTHER_ERROR="otherError"})(Q||(Q={}));var F;(function(D){D.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",D.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",D.KEY_SYSTEM_NO_SESSION="keySystemNoSession",D.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",D.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",D.MANIFEST_LOAD_ERROR="manifestLoadError",D.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",D.MANIFEST_PARSING_ERROR="manifestParsingError",D.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",D.LEVEL_EMPTY_ERROR="levelEmptyError",D.LEVEL_LOAD_ERROR="levelLoadError",D.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",D.LEVEL_SWITCH_ERROR="levelSwitchError",D.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",D.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",D.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",D.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",D.FRAG_LOAD_ERROR="fragLoadError",D.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",D.FRAG_DECRYPT_ERROR="fragDecryptError",D.FRAG_PARSING_ERROR="fragParsingError",D.REMUX_ALLOC_ERROR="remuxAllocError",D.KEY_LOAD_ERROR="keyLoadError",D.KEY_LOAD_TIMEOUT="keyLoadTimeOut",D.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",D.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",D.BUFFER_APPEND_ERROR="bufferAppendError",D.BUFFER_APPENDING_ERROR="bufferAppendingError",D.BUFFER_STALLED_ERROR="bufferStalledError",D.BUFFER_FULL_ERROR="bufferFullError",D.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",D.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",D.INTERNAL_EXCEPTION="internalException",D.INTERNAL_ABORTED="aborted",D.UNKNOWN="unknown"})(F||(F={}))},"./src/events.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"Events",function(){return Q});var Q;(function(F){F.MEDIA_ATTACHING="hlsMediaAttaching",F.MEDIA_ATTACHED="hlsMediaAttached",F.MEDIA_DETACHING="hlsMediaDetaching",F.MEDIA_DETACHED="hlsMediaDetached",F.BUFFER_RESET="hlsBufferReset",F.BUFFER_CODECS="hlsBufferCodecs",F.BUFFER_CREATED="hlsBufferCreated",F.BUFFER_APPENDING="hlsBufferAppending",F.BUFFER_APPENDED="hlsBufferAppended",F.BUFFER_EOS="hlsBufferEos",F.BUFFER_FLUSHING="hlsBufferFlushing",F.BUFFER_FLUSHED="hlsBufferFlushed",F.MANIFEST_LOADING="hlsManifestLoading",F.MANIFEST_LOADED="hlsManifestLoaded",F.MANIFEST_PARSED="hlsManifestParsed",F.LEVEL_SWITCHING="hlsLevelSwitching",F.LEVEL_SWITCHED="hlsLevelSwitched",F.LEVEL_LOADING="hlsLevelLoading",F.LEVEL_LOADED="hlsLevelLoaded",F.LEVEL_UPDATED="hlsLevelUpdated",F.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",F.LEVELS_UPDATED="hlsLevelsUpdated",F.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",F.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",F.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",F.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",F.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",F.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",F.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",F.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",F.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",F.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",F.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",F.CUES_PARSED="hlsCuesParsed",F.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",F.INIT_PTS_FOUND="hlsInitPtsFound",F.FRAG_LOADING="hlsFragLoading",F.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",F.FRAG_LOADED="hlsFragLoaded",F.FRAG_DECRYPTED="hlsFragDecrypted",F.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",F.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",F.FRAG_PARSING_METADATA="hlsFragParsingMetadata",F.FRAG_PARSED="hlsFragParsed",F.FRAG_BUFFERED="hlsFragBuffered",F.FRAG_CHANGED="hlsFragChanged",F.FPS_DROP="hlsFpsDrop",F.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",F.ERROR="hlsError",F.DESTROYING="hlsDestroying",F.KEY_LOADING="hlsKeyLoading",F.KEY_LOADED="hlsKeyLoaded",F.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",F.BACK_BUFFER_REACHED="hlsBackBufferReached"})(Q||(Q={}))},"./src/hls.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return w});var Q=N("./node_modules/url-toolkit/src/url-toolkit.js"),F=N.n(Q),D=N("./src/loader/playlist-loader.ts"),G=N("./src/loader/key-loader.ts"),B=N("./src/controller/id3-track-controller.ts"),k=N("./src/controller/latency-controller.ts"),R=N("./src/controller/level-controller.ts"),b=N("./src/controller/fragment-tracker.ts"),v=N("./src/controller/stream-controller.ts"),m=N("./src/is-supported.ts"),u=N("./src/utils/logger.ts"),r=N("./src/config.ts"),c=N("./node_modules/eventemitter3/index.js"),s=N.n(c),a=N("./src/events.ts"),o=N("./src/errors.ts");function h(x,A){for(var S=0;S<A.length;S++){var y=A[S];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(x,y.key,y)}}function O(x,A,S){return A&&h(x.prototype,A),S&&h(x,S),x}var w=function(){x.isSupported=function(){return Object(m.isSupported)()};function x(S){S===void 0&&(S={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new c.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var y=this.config=Object(r.mergeConfig)(x.DefaultConfig,S);this.userConfig=S,Object(u.enableLogs)(y.debug),this._autoLevelCapping=-1,y.progressive&&Object(r.enableStreamingMode)(y);var _=y.abrController,p=y.bufferController,d=y.capLevelController,g=y.fpsController,l=this.abrController=new _(this),E=this.bufferController=new p(this),U=this.capLevelController=new d(this),P=new g(this),j=new D.default(this),H=new G.default(this),I=new B.default(this),T=this.levelController=new R.default(this),K=new b.FragmentTracker(this),J=this.streamController=new v.default(this,K);U.setStreamController(J),P.setStreamController(J);var ie=[T,J];this.networkControllers=ie;var pe=[j,H,l,E,U,P,I,K];this.audioTrackController=this.createController(y.audioTrackController,null,ie),this.createController(y.audioStreamController,K,ie),this.subtitleTrackController=this.createController(y.subtitleTrackController,null,ie),this.createController(y.subtitleStreamController,K,ie),this.createController(y.timelineController,null,pe),this.emeController=this.createController(y.emeController,null,pe),this.cmcdController=this.createController(y.cmcdController,null,pe),this.latencyController=this.createController(k.default,null,pe),this.coreComponents=pe}var A=x.prototype;return A.createController=function(y,_,p){if(y){var d=_?new y(this,_):new y(this);return p&&p.push(d),d}return null},A.on=function(y,_,p){p===void 0&&(p=this),this._emitter.on(y,_,p)},A.once=function(y,_,p){p===void 0&&(p=this),this._emitter.once(y,_,p)},A.removeAllListeners=function(y){this._emitter.removeAllListeners(y)},A.off=function(y,_,p,d){p===void 0&&(p=this),this._emitter.off(y,_,p,d)},A.listeners=function(y){return this._emitter.listeners(y)},A.emit=function(y,_,p){return this._emitter.emit(y,_,p)},A.trigger=function(y,_){if(this.config.debug)return this.emit(y,y,_);try{return this.emit(y,y,_)}catch(p){u.logger.error("An internal error happened while handling event "+y+'. Error message: "'+p.message+'". Here is a stacktrace:',p),this.trigger(a.Events.ERROR,{type:o.ErrorTypes.OTHER_ERROR,details:o.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:y,error:p})}return!1},A.listenerCount=function(y){return this._emitter.listenerCount(y)},A.destroy=function(){u.logger.log("destroy"),this.trigger(a.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(y){return y.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(y){return y.destroy()}),this.coreComponents.length=0},A.attachMedia=function(y){u.logger.log("attachMedia"),this._media=y,this.trigger(a.Events.MEDIA_ATTACHING,{media:y})},A.detachMedia=function(){u.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},A.loadSource=function(y){this.stopLoad();var _=this.media,p=this.url,d=this.url=Q.buildAbsoluteURL(self.location.href,y,{alwaysNormalize:!0});u.logger.log("loadSource:"+d),_&&p&&p!==d&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(_)),this.trigger(a.Events.MANIFEST_LOADING,{url:y})},A.startLoad=function(y){y===void 0&&(y=-1),u.logger.log("startLoad("+y+")"),this.networkControllers.forEach(function(_){_.startLoad(y)})},A.stopLoad=function(){u.logger.log("stopLoad"),this.networkControllers.forEach(function(y){y.stopLoad()})},A.swapAudioCodec=function(){u.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},A.recoverMediaError=function(){u.logger.log("recoverMediaError");var y=this._media;this.detachMedia(),y&&this.attachMedia(y)},A.removeLevel=function(y,_){_===void 0&&(_=0),this.levelController.removeLevel(y,_)},O(x,[{key:"levels",get:function(){var y=this.levelController.levels;return y||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(y){u.logger.log("set currentLevel:"+y),this.loadLevel=y,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(y){u.logger.log("set nextLevel:"+y),this.levelController.manualLevel=y,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(y){u.logger.log("set loadLevel:"+y),this.levelController.manualLevel=y}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(y){this.levelController.nextLoadLevel=y}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(y){u.logger.log("set firstLevel:"+y),this.levelController.firstLevel=y}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(y){u.logger.log("set startLevel:"+y),y!==-1&&(y=Math.max(y,this.minAutoLevel)),this.levelController.startLevel=y}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(y){var _=!!y;_!==this.config.capLevelToPlayerSize&&(_?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=_)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(y){this._autoLevelCapping!==y&&(u.logger.log("set autoLevelCapping:"+y),this._autoLevelCapping=y)}},{key:"bandwidthEstimate",get:function(){var y=this.abrController.bwEstimator;return y?y.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var y=this.levels,_=this.config.minAutoBitrate;if(!y)return 0;for(var p=y.length,d=0;d<p;d++)if(y[d].maxBitrate>_)return d;return 0}},{key:"maxAutoLevel",get:function(){var y=this.levels,_=this.autoLevelCapping,p;return _===-1&&y&&y.length?p=y.length-1:p=_,p}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(y){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,y)}},{key:"audioTracks",get:function(){var y=this.audioTrackController;return y?y.audioTracks:[]}},{key:"audioTrack",get:function(){var y=this.audioTrackController;return y?y.audioTrack:-1},set:function(y){var _=this.audioTrackController;_&&(_.audioTrack=y)}},{key:"subtitleTracks",get:function(){var y=this.subtitleTrackController;return y?y.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var y=this.subtitleTrackController;return y?y.subtitleTrack:-1},set:function(y){var _=this.subtitleTrackController;_&&(_.subtitleTrack=y)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var y=this.subtitleTrackController;return y?y.subtitleDisplay:!1},set:function(y){var _=this.subtitleTrackController;_&&(_.subtitleDisplay=y)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(y){this.config.lowLatencyMode=y}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return a.Events}},{key:"ErrorTypes",get:function(){return o.ErrorTypes}},{key:"ErrorDetails",get:function(){return o.ErrorDetails}},{key:"DefaultConfig",get:function(){return x.defaultConfig?x.defaultConfig:r.hlsDefaultConfig},set:function(y){x.defaultConfig=y}}]),x}();w.defaultConfig=void 0},"./src/is-supported.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"isSupported",function(){return D}),N.d(Y,"changeTypeSupported",function(){return G});var Q=N("./src/utils/mediasource-helper.ts");function F(){return self.SourceBuffer||self.WebKitSourceBuffer}function D(){var B=Object(Q.getMediaSource)();if(!B)return!1;var k=F(),R=B&&typeof B.isTypeSupported=="function"&&B.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),b=!k||k.prototype&&typeof k.prototype.appendBuffer=="function"&&typeof k.prototype.remove=="function";return!!R&&!!b}function G(){var B,k=F();return typeof(k==null||((B=k.prototype)===null||B===void 0)?void 0:B.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return u}),N.d(Y,"LoadError",function(){return c});var Q=N("./src/polyfills/number.ts"),F=N("./src/errors.ts");function D(s,a){s.prototype=Object.create(a.prototype),s.prototype.constructor=s,b(s,a)}function G(s){var a=typeof Map=="function"?new Map:void 0;return G=function(h){if(h===null||!R(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(h))return a.get(h);a.set(h,O)}function O(){return B(h,arguments,v(this).constructor)}return O.prototype=Object.create(h.prototype,{constructor:{value:O,enumerable:!1,writable:!0,configurable:!0}}),b(O,h)},G(s)}function B(s,a,o){return k()?B=Reflect.construct:B=function(O,w,x){var A=[null];A.push.apply(A,w);var S=Function.bind.apply(O,A),y=new S;return x&&b(y,x.prototype),y},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(s){return!1}}function R(s){return Function.toString.call(s).indexOf("[native code]")!==-1}function b(s,a){return b=Object.setPrototypeOf||function(h,O){return h.__proto__=O,h},b(s,a)}function v(s){return v=Object.setPrototypeOf?Object.getPrototypeOf:function(o){return o.__proto__||Object.getPrototypeOf(o)},v(s)}var m=Math.pow(2,17),u=function(){function s(o){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=o}var a=s.prototype;return a.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},a.abort=function(){this.loader&&this.loader.abort()},a.load=function(h,O){var w=this,x=h.url;if(!x)return Promise.reject(new c({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,networkDetails:null},"Fragment does not have a "+(x?"part list":"url")));this.abort();var A=this.config,S=A.fLoader,y=A.loader;return new Promise(function(_,p){w.loader&&w.loader.destroy();var d=w.loader=h.loader=S?new S(A):new y(A),g=r(h),l={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:m};h.stats=d.stats,d.load(g,l,{onSuccess:function(U,P,j,H){w.resetLoader(h,d),_({frag:h,part:null,payload:U.data,networkDetails:H})},onError:function(U,P,j){w.resetLoader(h,d),p(new c({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,response:U,networkDetails:j}))},onAbort:function(U,P,j){w.resetLoader(h,d),p(new c({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,networkDetails:j}))},onTimeout:function(U,P,j){w.resetLoader(h,d),p(new c({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,networkDetails:j}))},onProgress:function(U,P,j,H){O&&O({frag:h,part:null,payload:j,networkDetails:H})}})})},a.loadPart=function(h,O,w){var x=this;this.abort();var A=this.config,S=A.fLoader,y=A.loader;return new Promise(function(_,p){x.loader&&x.loader.destroy();var d=x.loader=h.loader=S?new S(A):new y(A),g=r(h,O),l={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:m};O.stats=d.stats,d.load(g,l,{onSuccess:function(U,P,j,H){x.resetLoader(h,d),x.updateStatsFromPart(h,O);var I={frag:h,part:O,payload:U.data,networkDetails:H};w(I),_(I)},onError:function(U,P,j){x.resetLoader(h,d),p(new c({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,part:O,response:U,networkDetails:j}))},onAbort:function(U,P,j){h.stats.aborted=O.stats.aborted,x.resetLoader(h,d),p(new c({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,part:O,networkDetails:j}))},onTimeout:function(U,P,j){x.resetLoader(h,d),p(new c({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,part:O,networkDetails:j}))}})})},a.updateStatsFromPart=function(h,O){var w=h.stats,x=O.stats,A=x.total;if(w.loaded+=x.loaded,A){var S=Math.round(h.duration/O.duration),y=Math.min(Math.round(w.loaded/A),S),_=S-y,p=_*Math.round(w.loaded/y);w.total=w.loaded+p}else w.total=Math.max(w.loaded,w.total);var d=w.loading,g=x.loading;d.start?d.first+=g.first-g.start:(d.start=g.start,d.first=g.first),d.end=g.end},a.resetLoader=function(h,O){h.loader=null,this.loader===O&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),O.destroy()},s}();function r(s,a){a===void 0&&(a=null);var o=a||s,h={frag:s,part:a,responseType:"arraybuffer",url:o.url,headers:{},rangeStart:0,rangeEnd:0},O=o.byteRangeStartOffset,w=o.byteRangeEndOffset;return Object(Q.isFiniteNumber)(O)&&Object(Q.isFiniteNumber)(w)&&(h.rangeStart=O,h.rangeEnd=w),h}var c=function(s){D(a,s);function a(o){for(var h,O=arguments.length,w=new Array(O>1?O-1:0),x=1;x<O;x++)w[x-1]=arguments[x];return h=s.call.apply(s,[this].concat(w))||this,h.data=void 0,h.data=o,h}return a}(G(Error))},"./src/loader/fragment.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"ElementaryStreamTypes",function(){return u}),N.d(Y,"BaseSegment",function(){return r}),N.d(Y,"Fragment",function(){return c}),N.d(Y,"Part",function(){return s});var Q=N("./src/polyfills/number.ts"),F=N("./node_modules/url-toolkit/src/url-toolkit.js"),D=N.n(F),G=N("./src/utils/logger.ts"),B=N("./src/loader/level-key.ts"),k=N("./src/loader/load-stats.ts");function R(a,o){a.prototype=Object.create(o.prototype),a.prototype.constructor=a,b(a,o)}function b(a,o){return b=Object.setPrototypeOf||function(O,w){return O.__proto__=w,O},b(a,o)}function v(a,o){for(var h=0;h<o.length;h++){var O=o[h];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(a,O.key,O)}}function m(a,o,h){return o&&v(a.prototype,o),h&&v(a,h),a}var u;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(u||(u={}));var r=function(){function a(h){var O;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(O={},O[u.AUDIO]=null,O[u.VIDEO]=null,O[u.AUDIOVIDEO]=null,O),this.baseurl=h}var o=a.prototype;return o.setByteRange=function(O,w){var x=O.split("@",2),A=[];x.length===1?A[0]=w?w.byteRangeEndOffset:0:A[0]=parseInt(x[1]),A[1]=parseInt(x[0])+A[0],this._byteRange=A},m(a,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(F.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(O){this._url=O}}]),a}(),c=function(a){R(o,a);function o(O,w){var x;return x=a.call(this,w)||this,x._decryptdata=null,x.rawProgramDateTime=null,x.programDateTime=null,x.tagList=[],x.duration=0,x.sn=0,x.levelkey=void 0,x.type=void 0,x.loader=null,x.level=-1,x.cc=0,x.startPTS=void 0,x.endPTS=void 0,x.appendedPTS=void 0,x.startDTS=void 0,x.endDTS=void 0,x.start=0,x.deltaPTS=void 0,x.maxStartPTS=void 0,x.minEndPTS=void 0,x.stats=new k.LoadStats,x.urlId=0,x.data=void 0,x.bitrateTest=!1,x.title=null,x.initSegment=null,x.type=O,x}var h=o.prototype;return h.createInitializationVector=function(w){for(var x=new Uint8Array(16),A=12;A<16;A++)x[A]=w>>8*(15-A)&255;return x},h.setDecryptDataFromLevelKey=function(w,x){var A=w;return(w==null?void 0:w.method)==="AES-128"&&w.uri&&!w.iv&&(A=B.LevelKey.fromURI(w.uri),A.method=w.method,A.iv=this.createInitializationVector(x),A.keyFormat="identity"),A},h.setElementaryStreamInfo=function(w,x,A,S,y,_){_===void 0&&(_=!1);var p=this.elementaryStreams,d=p[w];if(!d){p[w]={startPTS:x,endPTS:A,startDTS:S,endDTS:y,partial:_};return}d.startPTS=Math.min(d.startPTS,x),d.endPTS=Math.max(d.endPTS,A),d.startDTS=Math.min(d.startDTS,S),d.endDTS=Math.max(d.endDTS,y)},h.clearElementaryStreamInfo=function(){var w=this.elementaryStreams;w[u.AUDIO]=null,w[u.VIDEO]=null,w[u.AUDIOVIDEO]=null},m(o,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var w=this.sn;typeof w!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&G.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),w=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,w)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(Q.isFiniteNumber)(this.programDateTime))return null;var w=Object(Q.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+w*1e3}},{key:"encrypted",get:function(){var w;return!!((w=this.decryptdata)!==null&&w!==void 0&&w.keyFormat&&this.decryptdata.uri)}}]),o}(r),s=function(a){R(o,a);function o(h,O,w,x,A){var S;S=a.call(this,w)||this,S.fragOffset=0,S.duration=0,S.gap=!1,S.independent=!1,S.relurl=void 0,S.fragment=void 0,S.index=void 0,S.stats=new k.LoadStats,S.duration=h.decimalFloatingPoint("DURATION"),S.gap=h.bool("GAP"),S.independent=h.bool("INDEPENDENT"),S.relurl=h.enumeratedString("URI"),S.fragment=O,S.index=x;var y=h.enumeratedString("BYTERANGE");return y&&S.setByteRange(y,A),A&&(S.fragOffset=A.fragOffset+A.duration),S}return m(o,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var O=this.elementaryStreams;return!!(O.audio||O.video||O.audiovideo)}}]),o}(r)},"./src/loader/key-loader.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return G});var Q=N("./src/events.ts"),F=N("./src/errors.ts"),D=N("./src/utils/logger.ts"),G=function(){function B(R){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=R,this._registerListeners()}var k=B.prototype;return k._registerListeners=function(){this.hls.on(Q.Events.KEY_LOADING,this.onKeyLoading,this)},k._unregisterListeners=function(){this.hls.off(Q.Events.KEY_LOADING,this.onKeyLoading)},k.destroy=function(){this._unregisterListeners();for(var b in this.loaders){var v=this.loaders[b];v&&v.destroy()}this.loaders={}},k.onKeyLoading=function(b,v){var m=v.frag,u=m.type,r=this.loaders[u];if(!m.decryptdata){D.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var c=m.decryptdata.uri;if(c!==this.decrypturl||this.decryptkey===null){var s=this.hls.config;if(r&&(D.logger.warn("abort previous key loader for type:"+u),r.abort()),!c){D.logger.warn("key uri is falsy");return}var a=s.loader,o=m.loader=this.loaders[u]=new a(s);this.decrypturl=c,this.decryptkey=null;var h={url:c,frag:m,responseType:"arraybuffer"},O={timeout:s.fragLoadingTimeOut,maxRetry:0,retryDelay:s.fragLoadingRetryDelay,maxRetryDelay:s.fragLoadingMaxRetryTimeout,highWaterMark:0},w={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};o.load(h,O,w)}else this.decryptkey&&(m.decryptdata.key=this.decryptkey,this.hls.trigger(Q.Events.KEY_LOADED,{frag:m}))},k.loadsuccess=function(b,v,m){var u=m.frag;if(!u.decryptdata){D.logger.error("after key load, decryptdata unset");return}this.decryptkey=u.decryptdata.key=new Uint8Array(b.data),u.loader=null,delete this.loaders[u.type],this.hls.trigger(Q.Events.KEY_LOADED,{frag:u})},k.loaderror=function(b,v){var m=v.frag,u=m.loader;u&&u.abort(),delete this.loaders[m.type],this.hls.trigger(Q.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:m,response:b})},k.loadtimeout=function(b,v){var m=v.frag,u=m.loader;u&&u.abort(),delete this.loaders[m.type],this.hls.trigger(Q.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:m})},B}()},"./src/loader/level-details.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"LevelDetails",function(){return B});var Q=N("./src/polyfills/number.ts");function F(k,R){for(var b=0;b<R.length;b++){var v=R[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(k,v.key,v)}}function D(k,R,b){return R&&F(k.prototype,R),b&&F(k,b),k}var G=10,B=function(){function k(b){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=b}var R=k.prototype;return R.reloaded=function(v){if(!v){this.advanced=!0,this.updated=!0;return}var m=this.lastPartSn-v.lastPartSn,u=this.lastPartIndex-v.lastPartIndex;this.updated=this.endSN!==v.endSN||!!u||!!m,this.advanced=this.endSN>v.endSN||m>0||m===0&&u>0,this.updated||this.advanced?this.misses=Math.floor(v.misses*.6):this.misses=v.misses+1,this.availabilityDelay=v.availabilityDelay},D(k,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Q.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||G}},{key:"drift",get:function(){var v=this.driftEndTime-this.driftStartTime;if(v>0){var m=this.driftEnd-this.driftStart;return m*1e3/v}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var v;return(v=this.partList)!==null&&v!==void 0&&v.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var v;return(v=this.fragments)!==null&&v!==void 0&&v.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 v;return(v=this.partList)!==null&&v!==void 0&&v.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var v;return(v=this.partList)!==null&&v!==void 0&&v.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),k}()},"./src/loader/level-key.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"LevelKey",function(){return B});var Q=N("./node_modules/url-toolkit/src/url-toolkit.js"),F=N.n(Q);function D(k,R){for(var b=0;b<R.length;b++){var v=R[b];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(k,v.key,v)}}function G(k,R,b){return R&&D(k.prototype,R),b&&D(k,b),k}var B=function(){k.fromURL=function(b,v){return new k(b,v)},k.fromURI=function(b){return new k(b)};function k(R,b){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,b?this._uri=Object(Q.buildAbsoluteURL)(R,b,{alwaysNormalize:!0}):this._uri=R}return G(k,[{key:"uri",get:function(){return this._uri}}]),k}()},"./src/loader/load-stats.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"LoadStats",function(){return Q});var Q=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,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return o});var Q=N("./src/polyfills/number.ts"),F=N("./node_modules/url-toolkit/src/url-toolkit.js"),D=N.n(F),G=N("./src/loader/fragment.ts"),B=N("./src/loader/level-details.ts"),k=N("./src/loader/level-key.ts"),R=N("./src/utils/attr-list.ts"),b=N("./src/utils/logger.ts"),v=N("./src/utils/codecs.ts"),m=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,u=/#EXT-X-MEDIA:(.*)/g,r=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),c=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),s=/\.(mp4|m4s|m4v|m4a)$/i;function a(A){var S,y;return s.test((S=(y=F.parseURL(A))===null||y===void 0?void 0:y.path)!=null?S:"")}var o=function(){function A(){}return A.findGroup=function(y,_){for(var p=0;p<y.length;p++){var d=y[p];if(d.id===_)return d}},A.convertAVC1ToAVCOTI=function(y){var _=y.split(".");if(_.length>2){var p=_.shift()+".";return p+=parseInt(_.shift()).toString(16),p+=("000"+parseInt(_.shift()).toString(16)).substr(-4),p}return y},A.resolve=function(y,_){return F.buildAbsoluteURL(_,y,{alwaysNormalize:!0})},A.parseMasterPlaylist=function(y,_){var p=[],d={},g=!1;m.lastIndex=0;for(var l;(l=m.exec(y))!=null;)if(l[1]){var E=new R.AttrList(l[1]),U={attrs:E,bitrate:E.decimalInteger("AVERAGE-BANDWIDTH")||E.decimalInteger("BANDWIDTH"),name:E.NAME,url:A.resolve(l[2],_)},P=E.decimalResolution("RESOLUTION");P&&(U.width=P.width,U.height=P.height),h((E.CODECS||"").split(/[ ,]+/).filter(function(H){return H}),U),U.videoCodec&&U.videoCodec.indexOf("avc1")!==-1&&(U.videoCodec=A.convertAVC1ToAVCOTI(U.videoCodec)),p.push(U)}else if(l[3]){var j=new R.AttrList(l[3]);j["DATA-ID"]&&(g=!0,d[j["DATA-ID"]]=j)}return{levels:p,sessionData:g?d:null}},A.parseMasterPlaylistMedia=function(y,_,p,d){d===void 0&&(d=[]);var g,l=[],E=0;for(u.lastIndex=0;(g=u.exec(y))!==null;){var U=new R.AttrList(g[1]);if(U.TYPE===p){var P={attrs:U,bitrate:0,id:E++,groupId:U["GROUP-ID"],instreamId:U["INSTREAM-ID"],name:U.NAME||U.LANGUAGE||"",type:p,default:U.bool("DEFAULT"),autoselect:U.bool("AUTOSELECT"),forced:U.bool("FORCED"),lang:U.LANGUAGE,url:U.URI?A.resolve(U.URI,_):""};if(d.length){var j=A.findGroup(d,P.groupId)||d[0];O(P,j,"audioCodec"),O(P,j,"textCodec")}l.push(P)}}return l},A.parseLevelPlaylist=function(y,_,p,d,g){var l=new B.LevelDetails(_),E=l.fragments,U=null,P=0,j=0,H=0,I=0,T=null,K=new G.Fragment(d,_),J,ie,pe,_e=-1,Te=!1;for(r.lastIndex=0,l.m3u8=y;(J=r.exec(y))!==null;){Te&&(Te=!1,K=new G.Fragment(d,_),K.start=H,K.sn=P,K.cc=I,K.level=p,U&&(K.initSegment=U,K.rawProgramDateTime=U.rawProgramDateTime));var he=J[1];if(he){K.duration=parseFloat(he);var re=(" "+J[2]).slice(1);K.title=re||null,K.tagList.push(re?["INF",he,re]:["INF",he])}else if(J[3])Object(Q.isFiniteNumber)(K.duration)&&(K.start=H,pe&&(K.levelkey=pe),K.sn=P,K.level=p,K.cc=I,K.urlId=g,E.push(K),K.relurl=(" "+J[3]).slice(1),x(K,T),T=K,H+=K.duration,P++,j=0,Te=!0);else if(J[4]){var fe=(" "+J[4]).slice(1);T?K.setByteRange(fe,T):K.setByteRange(fe)}else if(J[5])K.rawProgramDateTime=(" "+J[5]).slice(1),K.tagList.push(["PROGRAM-DATE-TIME",K.rawProgramDateTime]),_e===-1&&(_e=E.length);else{if(J=J[0].match(c),!J){b.logger.warn("No matches on slow regex match for level playlist!");continue}for(ie=1;ie<J.length&&!(typeof J[ie]!="undefined");ie++);var ae=(" "+J[ie]).slice(1),oe=(" "+J[ie+1]).slice(1),Z=J[ie+2]?(" "+J[ie+2]).slice(1):"";switch(ae){case"PLAYLIST-TYPE":l.type=oe.toUpperCase();break;case"MEDIA-SEQUENCE":P=l.startSN=parseInt(oe);break;case"SKIP":{var ne=new R.AttrList(oe),se=ne.decimalInteger("SKIPPED-SEGMENTS");if(Object(Q.isFiniteNumber)(se)){l.skippedSegments=se;for(var me=se;me--;)E.unshift(null);P+=se}var Se=ne.enumeratedString("RECENTLY-REMOVED-DATERANGES");Se&&(l.recentlyRemovedDateranges=Se.split(" "));break}case"TARGETDURATION":l.targetduration=parseFloat(oe);break;case"VERSION":l.version=parseInt(oe);break;case"EXTM3U":break;case"ENDLIST":l.live=!1;break;case"#":(oe||Z)&&K.tagList.push(Z?[oe,Z]:[oe]);break;case"DIS":I++;case"GAP":K.tagList.push([ae]);break;case"BITRATE":K.tagList.push([ae,oe]);break;case"DISCONTINUITY-SEQ":I=parseInt(oe);break;case"KEY":{var Ee,Le=new R.AttrList(oe),Pe=Le.enumeratedString("METHOD"),Be=Le.URI,He=Le.hexadecimalInteger("IV"),Ge=Le.enumeratedString("KEYFORMATVERSIONS"),Ue=Le.enumeratedString("KEYID"),tt=(Ee=Le.enumeratedString("KEYFORMAT"))!=null?Ee:"identity",nt=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(nt.indexOf(tt)>-1){b.logger.warn("Keyformat "+tt+" is not supported from the manifest");continue}else if(tt!=="identity")continue;Pe&&(pe=k.LevelKey.fromURL(_,Be),Be&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Pe)>=0&&(pe.method=Pe,pe.keyFormat=tt,Ue&&(pe.keyID=Ue),Ge&&(pe.keyFormatVersions=Ge),pe.iv=He));break}case"START":{var ot=new R.AttrList(oe),st=ot.decimalFloatingPoint("TIME-OFFSET");Object(Q.isFiniteNumber)(st)&&(l.startTimeOffset=st);break}case"MAP":{var mt=new R.AttrList(oe);K.relurl=mt.URI,mt.BYTERANGE&&K.setByteRange(mt.BYTERANGE),K.level=p,K.sn="initSegment",pe&&(K.levelkey=pe),K.initSegment=null,U=K,Te=!0;break}case"SERVER-CONTROL":{var ht=new R.AttrList(oe);l.canBlockReload=ht.bool("CAN-BLOCK-RELOAD"),l.canSkipUntil=ht.optionalFloat("CAN-SKIP-UNTIL",0),l.canSkipDateRanges=l.canSkipUntil>0&&ht.bool("CAN-SKIP-DATERANGES"),l.partHoldBack=ht.optionalFloat("PART-HOLD-BACK",0),l.holdBack=ht.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ie=new R.AttrList(oe);l.partTarget=Ie.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Re=l.partList;Re||(Re=l.partList=[]);var ze=j>0?Re[Re.length-1]:void 0,Ve=j++,De=new G.Part(new R.AttrList(oe),K,_,Ve,ze);Re.push(De),K.duration+=De.duration;break}case"PRELOAD-HINT":{var Me=new R.AttrList(oe);l.preloadHint=Me;break}case"RENDITION-REPORT":{var be=new R.AttrList(oe);l.renditionReports=l.renditionReports||[],l.renditionReports.push(be);break}default:b.logger.warn("line parsed but not handled: "+J);break}}}T&&!T.relurl?(E.pop(),H-=T.duration,l.partList&&(l.fragmentHint=T)):l.partList&&(x(K,T),K.cc=I,l.fragmentHint=K);var ve=E.length,ge=E[0],le=E[ve-1];if(H+=l.skippedSegments*l.targetduration,H>0&&ve&&le){l.averagetargetduration=H/ve;var ue=le.sn;l.endSN=ue!=="initSegment"?ue:0,ge&&(l.startCC=ge.cc,ge.initSegment||l.fragments.every(function(ye){return ye.relurl&&a(ye.relurl)})&&(b.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),K=new G.Fragment(d,_),K.relurl=le.relurl,K.level=p,K.sn="initSegment",ge.initSegment=K,l.needSidxRanges=!0))}else l.endSN=0,l.startCC=0;return l.fragmentHint&&(H+=l.fragmentHint.duration),l.totalduration=H,l.endCC=I,_e>0&&w(E,_e),l},A}();function h(A,S){["video","audio","text"].forEach(function(y){var _=A.filter(function(d){return Object(v.isCodecType)(d,y)});if(_.length){var p=_.filter(function(d){return d.lastIndexOf("avc1",0)===0||d.lastIndexOf("mp4a",0)===0});S[y+"Codec"]=p.length>0?p[0]:_[0],A=A.filter(function(d){return _.indexOf(d)===-1})}}),S.unknownCodecs=A}function O(A,S,y){var _=S[y];_&&(A[y]=_)}function w(A,S){for(var y=A[S],_=S;_--;){var p=A[_];if(!p)return;p.programDateTime=y.programDateTime-p.duration*1e3,y=p}}function x(A,S){A.rawProgramDateTime?A.programDateTime=Date.parse(A.rawProgramDateTime):S!=null&&S.programDateTime&&(A.programDateTime=S.endProgramDateTime),Object(Q.isFiniteNumber)(A.programDateTime)||(A.programDateTime=null,A.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ce,Y,N){"use strict";N.r(Y);var Q=N("./src/polyfills/number.ts"),F=N("./src/events.ts"),D=N("./src/errors.ts"),G=N("./src/utils/logger.ts"),B=N("./src/utils/mp4-tools.ts"),k=N("./src/loader/m3u8-parser.ts"),R=N("./src/types/loader.ts"),b=N("./src/utils/attr-list.ts");function v(r){var c=r.type;switch(c){case R.PlaylistContextType.AUDIO_TRACK:return R.PlaylistLevelType.AUDIO;case R.PlaylistContextType.SUBTITLE_TRACK:return R.PlaylistLevelType.SUBTITLE;default:return R.PlaylistLevelType.MAIN}}function m(r,c){var s=r.url;return(s===void 0||s.indexOf("data:")===0)&&(s=c.url),s}var u=function(){function r(s){this.hls=void 0,this.loaders=Object.create(null),this.hls=s,this.registerListeners()}var c=r.prototype;return c.registerListeners=function(){var a=this.hls;a.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(F.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},c.unregisterListeners=function(){var a=this.hls;a.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(F.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},c.createInternalLoader=function(a){var o=this.hls.config,h=o.pLoader,O=o.loader,w=h||O,x=new w(o);return a.loader=x,this.loaders[a.type]=x,x},c.getInternalLoader=function(a){return this.loaders[a.type]},c.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},c.destroyInternalLoaders=function(){for(var a in this.loaders){var o=this.loaders[a];o&&o.destroy(),this.resetInternalLoader(a)}},c.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},c.onManifestLoading=function(a,o){var h=o.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:R.PlaylistContextType.MANIFEST,url:h,deliveryDirectives:null})},c.onLevelLoading=function(a,o){var h=o.id,O=o.level,w=o.url,x=o.deliveryDirectives;this.load({id:h,groupId:null,level:O,responseType:"text",type:R.PlaylistContextType.LEVEL,url:w,deliveryDirectives:x})},c.onAudioTrackLoading=function(a,o){var h=o.id,O=o.groupId,w=o.url,x=o.deliveryDirectives;this.load({id:h,groupId:O,level:null,responseType:"text",type:R.PlaylistContextType.AUDIO_TRACK,url:w,deliveryDirectives:x})},c.onSubtitleTrackLoading=function(a,o){var h=o.id,O=o.groupId,w=o.url,x=o.deliveryDirectives;this.load({id:h,groupId:O,level:null,responseType:"text",type:R.PlaylistContextType.SUBTITLE_TRACK,url:w,deliveryDirectives:x})},c.load=function(a){var o,h=this.hls.config,O=this.getInternalLoader(a);if(O){var w=O.context;if(w&&w.url===a.url){G.logger.trace("[playlist-loader]: playlist request ongoing");return}G.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),O.abort()}var x,A,S,y;switch(a.type){case R.PlaylistContextType.MANIFEST:x=h.manifestLoadingMaxRetry,A=h.manifestLoadingTimeOut,S=h.manifestLoadingRetryDelay,y=h.manifestLoadingMaxRetryTimeout;break;case R.PlaylistContextType.LEVEL:case R.PlaylistContextType.AUDIO_TRACK:case R.PlaylistContextType.SUBTITLE_TRACK:x=0,A=h.levelLoadingTimeOut;break;default:x=h.levelLoadingMaxRetry,A=h.levelLoadingTimeOut,S=h.levelLoadingRetryDelay,y=h.levelLoadingMaxRetryTimeout;break}if(O=this.createInternalLoader(a),(o=a.deliveryDirectives)!==null&&o!==void 0&&o.part){var _;if(a.type===R.PlaylistContextType.LEVEL&&a.level!==null?_=this.hls.levels[a.level].details:a.type===R.PlaylistContextType.AUDIO_TRACK&&a.id!==null?_=this.hls.audioTracks[a.id].details:a.type===R.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(_=this.hls.subtitleTracks[a.id].details),_){var p=_.partTarget,d=_.targetduration;p&&d&&(A=Math.min(Math.max(p*3,d*.8)*1e3,A))}}var g={timeout:A,maxRetry:x,retryDelay:S,maxRetryDelay:y,highWaterMark:0},l={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};O.load(a,g,l)},c.loadsuccess=function(a,o,h,O){if(O===void 0&&(O=null),h.isSidxRequest){this.handleSidxRequest(a,h),this.handlePlaylistLoaded(a,o,h,O);return}this.resetInternalLoader(h.type);var w=a.data;if(w.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,h,"no EXTM3U delimiter",O);return}o.parsing.start=performance.now(),w.indexOf("#EXTINF:")>0||w.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,o,h,O):this.handleMasterPlaylist(a,o,h,O)},c.loaderror=function(a,o,h){h===void 0&&(h=null),this.handleNetworkError(o,h,!1,a)},c.loadtimeout=function(a,o,h){h===void 0&&(h=null),this.handleNetworkError(o,h,!0)},c.handleMasterPlaylist=function(a,o,h,O){var w=this.hls,x=a.data,A=m(a,h),S=k.default.parseMasterPlaylist(x,A),y=S.levels,_=S.sessionData;if(!y.length){this.handleManifestParsingError(a,h,"no level found in manifest",O);return}var p=y.map(function(P){return{id:P.attrs.AUDIO,audioCodec:P.audioCodec}}),d=y.map(function(P){return{id:P.attrs.SUBTITLES,textCodec:P.textCodec}}),g=k.default.parseMasterPlaylistMedia(x,A,"AUDIO",p),l=k.default.parseMasterPlaylistMedia(x,A,"SUBTITLES",d),E=k.default.parseMasterPlaylistMedia(x,A,"CLOSED-CAPTIONS");if(g.length){var U=g.some(function(P){return!P.url});!U&&y[0].audioCodec&&!y[0].attrs.AUDIO&&(G.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 b.AttrList({}),bitrate:0,url:""}))}w.trigger(F.Events.MANIFEST_LOADED,{levels:y,audioTracks:g,subtitles:l,captions:E,url:A,stats:o,networkDetails:O,sessionData:_})},c.handleTrackOrLevelPlaylist=function(a,o,h,O){var w=this.hls,x=h.id,A=h.level,S=h.type,y=m(a,h),_=Object(Q.isFiniteNumber)(x)?x:0,p=Object(Q.isFiniteNumber)(A)?A:_,d=v(h),g=k.default.parseLevelPlaylist(a.data,y,p,d,_);if(!g.fragments.length){w.trigger(F.Events.ERROR,{type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:y,reason:"no fragments found in level",level:typeof h.level=="number"?h.level:void 0});return}if(S===R.PlaylistContextType.MANIFEST){var l={attrs:new b.AttrList({}),bitrate:0,details:g,name:"",url:y};w.trigger(F.Events.MANIFEST_LOADED,{levels:[l],audioTracks:[],url:y,stats:o,networkDetails:O,sessionData:null})}if(o.parsing.end=performance.now(),g.needSidxRanges){var E,U=(E=g.fragments[0].initSegment)===null||E===void 0?void 0:E.url;this.load({url:U,isSidxRequest:!0,type:S,level:A,levelDetails:g,id:x,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}h.levelDetails=g,this.handlePlaylistLoaded(a,o,h,O)},c.handleSidxRequest=function(a,o){var h=Object(B.parseSegmentIndex)(new Uint8Array(a.data));if(!h)return;var O=h.references,w=o.levelDetails;O.forEach(function(x,A){var S=x.info,y=w.fragments[A];y.byteRange.length===0&&y.setByteRange(String(1+S.end-S.start)+"@"+String(S.start)),y.initSegment&&y.initSegment.setByteRange(String(h.moovEndOffset)+"@0")})},c.handleManifestParsingError=function(a,o,h,O){this.hls.trigger(F.Events.ERROR,{type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:o.type===R.PlaylistContextType.MANIFEST,url:a.url,reason:h,response:a,context:o,networkDetails:O})},c.handleNetworkError=function(a,o,h,O){h===void 0&&(h=!1),G.logger.warn("[playlist-loader]: A network "+(h?"timeout":"error")+" occurred while loading "+a.type+" level: "+a.level+" id: "+a.id+' group-id: "'+a.groupId+'"');var w=D.ErrorDetails.UNKNOWN,x=!1,A=this.getInternalLoader(a);switch(a.type){case R.PlaylistContextType.MANIFEST:w=h?D.ErrorDetails.MANIFEST_LOAD_TIMEOUT:D.ErrorDetails.MANIFEST_LOAD_ERROR,x=!0;break;case R.PlaylistContextType.LEVEL:w=h?D.ErrorDetails.LEVEL_LOAD_TIMEOUT:D.ErrorDetails.LEVEL_LOAD_ERROR,x=!1;break;case R.PlaylistContextType.AUDIO_TRACK:w=h?D.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:D.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,x=!1;break;case R.PlaylistContextType.SUBTITLE_TRACK:w=h?D.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:D.ErrorDetails.SUBTITLE_LOAD_ERROR,x=!1;break}A&&this.resetInternalLoader(a.type);var S={type:D.ErrorTypes.NETWORK_ERROR,details:w,fatal:x,url:a.url,loader:A,context:a,networkDetails:o};O&&(S.response=O),this.hls.trigger(F.Events.ERROR,S)},c.handlePlaylistLoaded=function(a,o,h,O){var w=h.type,x=h.level,A=h.id,S=h.groupId,y=h.loader,_=h.levelDetails,p=h.deliveryDirectives;if(!(_!=null&&_.targetduration)){this.handleManifestParsingError(a,h,"invalid target duration",O);return}if(!y)return;_.live&&(y.getCacheAge&&(_.ageHeader=y.getCacheAge()||0),(!y.getCacheAge||isNaN(_.ageHeader))&&(_.ageHeader=0));switch(w){case R.PlaylistContextType.MANIFEST:case R.PlaylistContextType.LEVEL:this.hls.trigger(F.Events.LEVEL_LOADED,{details:_,level:x||0,id:A||0,stats:o,networkDetails:O,deliveryDirectives:p});break;case R.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(F.Events.AUDIO_TRACK_LOADED,{details:_,id:A||0,groupId:S||"",stats:o,networkDetails:O,deliveryDirectives:p});break;case R.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(F.Events.SUBTITLE_TRACK_LOADED,{details:_,id:A||0,groupId:S||"",stats:o,networkDetails:O,deliveryDirectives:p});break}},r}();Y.default=u},"./src/polyfills/number.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"isFiniteNumber",function(){return Q}),N.d(Y,"MAX_SAFE_INTEGER",function(){return F});var Q=Number.isFinite||function(D){return typeof D=="number"&&isFinite(D)},F=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ce,Y,N){"use strict";N.r(Y);var Q=function(){function F(){}return F.getSilentFrame=function(G,B){switch(G){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},F}();Y.default=Q},"./src/remux/mp4-generator.ts":function(ce,Y,N){"use strict";N.r(Y);var Q=Math.pow(2,32)-1,F=function(){function D(){}return D.init=function(){D.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 D.types)D.types.hasOwnProperty(B)&&(D.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]),R=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);D.HDLR_TYPES={video:k,audio:R};var b=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),v=new Uint8Array([0,0,0,0,0,0,0,0]);D.STTS=D.STSC=D.STCO=v,D.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),D.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),D.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),D.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var m=new Uint8Array([105,115,111,109]),u=new Uint8Array([97,118,99,49]),r=new Uint8Array([0,0,0,1]);D.FTYP=D.box(D.types.ftyp,m,r,m,u),D.DINF=D.box(D.types.dinf,D.box(D.types.dref,b))},D.box=function(B){for(var k=8,R=arguments.length,b=new Array(R>1?R-1:0),v=1;v<R;v++)b[v-1]=arguments[v];for(var m=b.length,u=m;m--;)k+=b[m].byteLength;var r=new Uint8Array(k);for(r[0]=k>>24&255,r[1]=k>>16&255,r[2]=k>>8&255,r[3]=k&255,r.set(B,4),m=0,k=8;m<u;m++)r.set(b[m],k),k+=b[m].byteLength;return r},D.hdlr=function(B){return D.box(D.types.hdlr,D.HDLR_TYPES[B])},D.mdat=function(B){return D.box(D.types.mdat,B)},D.mdhd=function(B,k){k*=B;var R=Math.floor(k/(Q+1)),b=Math.floor(k%(Q+1));return D.box(D.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,R>>24,R>>16&255,R>>8&255,R&255,b>>24,b>>16&255,b>>8&255,b&255,85,196,0,0]))},D.mdia=function(B){return D.box(D.types.mdia,D.mdhd(B.timescale,B.duration),D.hdlr(B.type),D.minf(B))},D.mfhd=function(B){return D.box(D.types.mfhd,new Uint8Array([0,0,0,0,B>>24,B>>16&255,B>>8&255,B&255]))},D.minf=function(B){return B.type==="audio"?D.box(D.types.minf,D.box(D.types.smhd,D.SMHD),D.DINF,D.stbl(B)):D.box(D.types.minf,D.box(D.types.vmhd,D.VMHD),D.DINF,D.stbl(B))},D.moof=function(B,k,R){return D.box(D.types.moof,D.mfhd(B),D.traf(R,k))},D.moov=function(B){for(var k=B.length,R=[];k--;)R[k]=D.trak(B[k]);return D.box.apply(null,[D.types.moov,D.mvhd(B[0].timescale,B[0].duration)].concat(R).concat(D.mvex(B)))},D.mvex=function(B){for(var k=B.length,R=[];k--;)R[k]=D.trex(B[k]);return D.box.apply(null,[D.types.mvex].concat(R))},D.mvhd=function(B,k){k*=B;var R=Math.floor(k/(Q+1)),b=Math.floor(k%(Q+1)),v=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,R>>24,R>>16&255,R>>8&255,R&255,b>>24,b>>16&255,b>>8&255,b&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 D.box(D.types.mvhd,v)},D.sdtp=function(B){var k=B.samples||[],R=new Uint8Array(4+k.length),b,v;for(b=0;b<k.length;b++)v=k[b].flags,R[b+4]=v.dependsOn<<4|v.isDependedOn<<2|v.hasRedundancy;return D.box(D.types.sdtp,R)},D.stbl=function(B){return D.box(D.types.stbl,D.stsd(B),D.box(D.types.stts,D.STTS),D.box(D.types.stsc,D.STSC),D.box(D.types.stsz,D.STSZ),D.box(D.types.stco,D.STCO))},D.avc1=function(B){var k=[],R=[],b,v,m;for(b=0;b<B.sps.length;b++)v=B.sps[b],m=v.byteLength,k.push(m>>>8&255),k.push(m&255),k=k.concat(Array.prototype.slice.call(v));for(b=0;b<B.pps.length;b++)v=B.pps[b],m=v.byteLength,R.push(m>>>8&255),R.push(m&255),R=R.concat(Array.prototype.slice.call(v));var u=D.box(D.types.avcC,new Uint8Array([1,k[3],k[4],k[5],252|3,224|B.sps.length].concat(k).concat([B.pps.length]).concat(R))),r=B.width,c=B.height,s=B.pixelRatio[0],a=B.pixelRatio[1];return D.box(D.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,r>>8&255,r&255,c>>8&255,c&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),u,D.box(D.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),D.box(D.types.pasp,new Uint8Array([s>>24,s>>16&255,s>>8&255,s&255,a>>24,a>>16&255,a>>8&255,a&255])))},D.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]))},D.mp4a=function(B){var k=B.samplerate;return D.box(D.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]),D.box(D.types.esds,D.esds(B)))},D.mp3=function(B){var k=B.samplerate;return D.box(D.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]))},D.stsd=function(B){return B.type==="audio"?!B.isAAC&&B.codec==="mp3"?D.box(D.types.stsd,D.STSD,D.mp3(B)):D.box(D.types.stsd,D.STSD,D.mp4a(B)):D.box(D.types.stsd,D.STSD,D.avc1(B))},D.tkhd=function(B){var k=B.id,R=B.duration*B.timescale,b=B.width,v=B.height,m=Math.floor(R/(Q+1)),u=Math.floor(R%(Q+1));return D.box(D.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,m>>24,m>>16&255,m>>8&255,m&255,u>>24,u>>16&255,u>>8&255,u&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,b>>8&255,b&255,0,0,v>>8&255,v&255,0,0]))},D.traf=function(B,k){var R=D.sdtp(B),b=B.id,v=Math.floor(k/(Q+1)),m=Math.floor(k%(Q+1));return D.box(D.types.traf,D.box(D.types.tfhd,new Uint8Array([0,0,0,0,b>>24,b>>16&255,b>>8&255,b&255])),D.box(D.types.tfdt,new Uint8Array([1,0,0,0,v>>24,v>>16&255,v>>8&255,v&255,m>>24,m>>16&255,m>>8&255,m&255])),D.trun(B,R.length+16+20+8+16+8+8),R)},D.trak=function(B){return B.duration=B.duration||4294967295,D.box(D.types.trak,D.tkhd(B),D.mdia(B))},D.trex=function(B){var k=B.id;return D.box(D.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]))},D.trun=function(B,k){var R=B.samples||[],b=R.length,v=12+16*b,m=new Uint8Array(v),u,r,c,s,a,o;for(k+=8+v,m.set([0,0,15,1,b>>>24&255,b>>>16&255,b>>>8&255,b&255,k>>>24&255,k>>>16&255,k>>>8&255,k&255],0),u=0;u<b;u++)r=R[u],c=r.duration,s=r.size,a=r.flags,o=r.cts,m.set([c>>>24&255,c>>>16&255,c>>>8&255,c&255,s>>>24&255,s>>>16&255,s>>>8&255,s&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,o>>>24&255,o>>>16&255,o>>>8&255,o&255],12+16*u);return D.box(D.types.trun,m)},D.initSegment=function(B){D.types||D.init();var k=D.moov(B),R=new Uint8Array(D.FTYP.byteLength+k.byteLength);return R.set(D.FTYP),R.set(k,D.FTYP.byteLength),R},D}();F.types=void 0,F.HDLR_TYPES=void 0,F.STTS=void 0,F.STSC=void 0,F.STCO=void 0,F.STSZ=void 0,F.VMHD=void 0,F.SMHD=void 0,F.STSD=void 0,F.FTYP=void 0,F.DINF=void 0,Y.default=F},"./src/remux/mp4-remuxer.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return o}),N.d(Y,"normalizePts",function(){return h});var Q=N("./src/polyfills/number.ts"),F=N("./src/remux/aac-helper.ts"),D=N("./src/remux/mp4-generator.ts"),G=N("./src/events.ts"),B=N("./src/errors.ts"),k=N("./src/utils/logger.ts"),R=N("./src/types/loader.ts"),b=N("./src/utils/timescale-conversion.ts");function v(){return v=Object.assign||function(A){for(var S=1;S<arguments.length;S++){var y=arguments[S];for(var _ in y)Object.prototype.hasOwnProperty.call(y,_)&&(A[_]=y[_])}return A},v.apply(this,arguments)}var m=10*1e3,u=1024,r=1152,c=null,s=null,a=!1,o=function(){function A(y,_,p,d){if(d===void 0&&(d=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=y,this.config=_,this.typeSupported=p,this.ISGenerated=!1,c===null){var g=navigator.userAgent||"",l=g.match(/Chrome\/(\d+)/i);c=l?parseInt(l[1]):0}if(s===null){var E=navigator.userAgent.match(/Safari\/(\d+)/i);s=E?parseInt(E[1]):0}a=!!c&&c<75||!!s&&s<600}var S=A.prototype;return S.destroy=function(){},S.resetTimeStamp=function(_){k.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=_},S.resetNextTimestamp=function(){k.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},S.resetInitSegment=function(){k.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},S.getVideoStartPts=function(_){var p=!1,d=_.reduce(function(g,l){var E=l.pts-g;return E<-4294967296?(p=!0,h(g,l.pts)):E>0?g:l.pts},_[0].pts);return p&&k.logger.debug("PTS rollover detected"),d},S.remux=function(_,p,d,g,l,E,U,P){var j,H,I,T,K,J,ie=l,pe=l,_e=_.pid>-1,Te=p.pid>-1,he=p.samples.length,re=_.samples.length>0,fe=he>1,ae=(!_e||re)&&(!Te||fe)||this.ISGenerated||U;if(ae){this.ISGenerated||(I=this.generateIS(_,p,l));var oe=this.isVideoContiguous,Z=-1;if(fe&&(Z=O(p.samples),!oe&&this.config.forceKeyFrameOnDiscontinuity))if(J=!0,Z>0){k.logger.warn("[mp4-remuxer]: Dropped "+Z+" out of "+he+" video samples due to a missing keyframe");var ne=this.getVideoStartPts(p.samples);p.samples=p.samples.slice(Z),p.dropped+=Z,pe+=(p.samples[0].pts-ne)/(p.timescale||9e4)}else Z===-1&&(k.logger.warn("[mp4-remuxer]: No keyframe found out of "+he+" video samples"),J=!1);if(this.ISGenerated){if(re&&fe){var se=this.getVideoStartPts(p.samples),me=h(_.samples[0].pts,se)-se,Se=me/p.inputTimeScale;ie+=Math.max(0,Se),pe+=Math.max(0,-Se)}if(re){if(_.samplerate||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),I=this.generateIS(_,p,l)),H=this.remuxAudio(_,ie,this.isAudioContiguous,E,Te||fe||P===R.PlaylistLevelType.AUDIO?pe:void 0),fe){var Ee=H?H.endPTS-H.startPTS:0;p.inputTimeScale||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),I=this.generateIS(_,p,l)),j=this.remuxVideo(p,pe,oe,Ee)}}else fe&&(j=this.remuxVideo(p,pe,oe,0));j&&(j.firstKeyFrame=Z,j.independent=Z!==-1)}}return this.ISGenerated&&(d.samples.length&&(K=this.remuxID3(d,l)),g.samples.length&&(T=this.remuxText(g,l))),{audio:H,video:j,initSegment:I,independent:J,text:T,id3:K}},S.generateIS=function(_,p,d){var g=_.samples,l=p.samples,E=this.typeSupported,U={},P=!Object(Q.isFiniteNumber)(this._initPTS),j="audio/mp4",H,I,T;if(P&&(H=I=Infinity),_.config&&g.length&&(_.timescale=_.samplerate,_.isAAC||(E.mpeg?(j="audio/mpeg",_.codec=""):E.mp3&&(_.codec="mp3")),U.audio={id:"audio",container:j,codec:_.codec,initSegment:!_.isAAC&&E.mpeg?new Uint8Array(0):D.default.initSegment([_]),metadata:{channelCount:_.channelCount}},P&&(T=_.inputTimeScale,H=I=g[0].pts-Math.round(T*d))),p.sps&&p.pps&&l.length&&(p.timescale=p.inputTimeScale,U.video={id:"main",container:"video/mp4",codec:p.codec,initSegment:D.default.initSegment([p]),metadata:{width:p.width,height:p.height}},P)){T=p.inputTimeScale;var K=this.getVideoStartPts(l),J=Math.round(T*d);I=Math.min(I,h(l[0].dts,K)-J),H=Math.min(H,K-J)}if(Object.keys(U).length)return this.ISGenerated=!0,P&&(this._initPTS=H,this._initDTS=I),{tracks:U,initPTS:H,timescale:T}},S.remuxVideo=function(_,p,d,g){var l=_.inputTimeScale,E=_.samples,U=[],P=E.length,j=this._initPTS,H=this.nextAvcDts,I=8,T,K,J,ie=Number.POSITIVE_INFINITY,pe=Number.NEGATIVE_INFINITY,_e=0,Te=!1;if(!d||H===null){var he=p*l,re=E[0].pts-h(E[0].dts,E[0].pts);H=he-re}for(var fe=0;fe<P;fe++){var ae=E[fe];if(ae.pts=h(ae.pts-j,H),ae.dts=h(ae.dts-j,H),ae.dts>ae.pts){var oe=9e4*.2;_e=Math.max(Math.min(_e,ae.pts-ae.dts),-1*oe)}ae.dts<E[fe>0?fe-1:fe].dts&&(Te=!0)}Te&&E.sort(function(bt,yt){var lt=bt.dts-yt.dts,wt=bt.pts-yt.pts;return lt||wt}),K=E[0].dts,J=E[E.length-1].dts;var Z=Math.round((J-K)/(P-1));if(_e<0){if(_e<Z*-2){k.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(b.toMsFromMpegTsClock)(-Z,!0)+" ms");for(var ne=_e,se=0;se<P;se++)E[se].dts=ne=Math.max(ne,E[se].pts-Z),E[se].pts=Math.max(ne,E[se].pts)}else{k.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(b.toMsFromMpegTsClock)(_e,!0)+" ms to overcome this issue");for(var me=0;me<P;me++)E[me].dts=E[me].dts+_e}K=E[0].dts}if(d){var Se=K-H,Ee=Se>Z,Le=Se<-1;if(Ee||Le){Ee?k.logger.warn("AVC: "+Object(b.toMsFromMpegTsClock)(Se,!0)+" ms ("+Se+"dts) hole between fragments detected, filling it"):k.logger.warn("AVC: "+Object(b.toMsFromMpegTsClock)(-Se,!0)+" ms ("+Se+"dts) overlapping between fragments detected"),K=H;var Pe=E[0].pts-Se;E[0].dts=K,E[0].pts=Pe,k.logger.log("Video: First PTS/DTS adjusted: "+Object(b.toMsFromMpegTsClock)(Pe,!0)+"/"+Object(b.toMsFromMpegTsClock)(K,!0)+", delta: "+Object(b.toMsFromMpegTsClock)(Se,!0)+" ms")}}a&&(K=Math.max(0,K));for(var Be=0,He=0,Ge=0;Ge<P;Ge++){for(var Ue=E[Ge],tt=Ue.units,nt=tt.length,ot=0,st=0;st<nt;st++)ot+=tt[st].data.length;He+=ot,Be+=nt,Ue.length=ot,Ue.dts=Math.max(Ue.dts,K),Ue.pts=Math.max(Ue.pts,Ue.dts,0),ie=Math.min(Ue.pts,ie),pe=Math.max(Ue.pts,pe)}J=E[P-1].dts;var mt=He+4*Be+8,ht;try{ht=new Uint8Array(mt)}catch(bt){this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:B.ErrorTypes.MUX_ERROR,details:B.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:mt,reason:"fail allocating video mdat "+mt});return}var Ie=new DataView(ht.buffer);Ie.setUint32(0,mt),ht.set(D.default.types.mdat,4);for(var Re=0;Re<P;Re++){for(var ze=E[Re],Ve=ze.units,De=0,Me=0,be=Ve.length;Me<be;Me++){var ve=Ve[Me],ge=ve.data,le=ve.data.byteLength;Ie.setUint32(I,le),I+=4,ht.set(ge,I),I+=le,De+=4+le}if(Re<P-1)T=E[Re+1].dts-ze.dts;else{var ue=this.config,ye=ze.dts-E[Re>0?Re-1:Re].dts;if(ue.stretchShortVideoTrack&&this.nextAudioPts!==null){var xe=Math.floor(ue.maxBufferHole*l),we=(g?ie+g*l:this.nextAudioPts)-ze.pts;we>xe?(T=we-ye,T<0&&(T=ye),k.logger.log("[mp4-remuxer]: It is approximately "+we/90+" ms to the next segment; using duration "+T/90+" ms for the last video frame.")):T=ye}else T=ye}var ke=Math.round(ze.pts-ze.dts);U.push(new w(ze.key,T,De,ke))}if(U.length&&c&&c<70){var We=U[0].flags;We.dependsOn=2,We.isNonSync=0}console.assert(T!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=H=J+T,this.isVideoContiguous=!0;var Je=D.default.moof(_.sequenceNumber++,K,v({},_,{samples:U})),Qe="video",Ze={data1:Je,data2:ht,startPTS:ie/l,endPTS:(pe+T)/l,startDTS:K/l,endDTS:H/l,type:Qe,hasAudio:!1,hasVideo:!0,nb:U.length,dropped:_.dropped};return _.samples=[],_.dropped=0,console.assert(ht.length,"MDAT length must not be zero"),Ze},S.remuxAudio=function(_,p,d,g,l){var E=_.inputTimeScale,U=_.samplerate?_.samplerate:E,P=E/U,j=_.isAAC?u:r,H=j*P,I=this._initPTS,T=!_.isAAC&&this.typeSupported.mpeg,K=[],J=_.samples,ie=T?0:8,pe=this.nextAudioPts||-1,_e=p*E;if(this.isAudioContiguous=d=d||J.length&&pe>0&&(g&&Math.abs(_e-pe)<9e3||Math.abs(h(J[0].pts-I,_e)-pe)<20*H),J.forEach(function(ge){ge.pts=h(ge.pts-I,_e)}),!d||pe<0){if(J=J.filter(function(ge){return ge.pts>=0}),!J.length)return;l===0?pe=0:g?pe=Math.max(0,_e):pe=J[0].pts}if(_.isAAC)for(var Te=l!==void 0,he=this.config.maxAudioFramesDrift,re=0,fe=pe;re<J.length;re++){var ae=J[re],oe=ae.pts,Z=oe-fe,ne=Math.abs(1e3*Z/E);if(Z<=-he*H&&Te)re===0&&(k.logger.warn("Audio frame @ "+(oe/E).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*Z/E)+" ms."),this.nextAudioPts=pe=fe=oe);else if(Z>=he*H&&ne<m&&Te){var se=Math.round(Z/H);fe=oe-se*H,fe<0&&(se--,fe+=H),re===0&&(this.nextAudioPts=pe=fe),k.logger.warn("[mp4-remuxer]: Injecting "+se+" audio frame @ "+(fe/E).toFixed(3)+"s due to "+Math.round(1e3*Z/E)+" ms gap.");for(var me=0;me<se;me++){var Se=Math.max(fe,0),Ee=F.default.getSilentFrame(_.manifestCodec||_.codec,_.channelCount);Ee||(k.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Ee=ae.unit.subarray()),J.splice(re,0,{unit:Ee,pts:Se}),fe+=H,re++}}ae.pts=fe,fe+=H}for(var Le=null,Pe=null,Be,He=0,Ge=J.length;Ge--;)He+=J[Ge].unit.byteLength;for(var Ue=0,tt=J.length;Ue<tt;Ue++){var nt=J[Ue],ot=nt.unit,st=nt.pts;if(Pe!==null){var mt=K[Ue-1];mt.duration=Math.round((st-Pe)/P)}else if(d&&_.isAAC&&(st=pe),Le=st,He>0){He+=ie;try{Be=new Uint8Array(He)}catch(ge){this.observer.emit(G.Events.ERROR,G.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(!T){var ht=new DataView(Be.buffer);ht.setUint32(0,He),Be.set(D.default.types.mdat,4)}}else return;Be.set(ot,ie);var Ie=ot.byteLength;ie+=Ie,K.push(new w(!0,j,Ie,0)),Pe=st}var Re=K.length;if(!Re)return;var ze=K[K.length-1];this.nextAudioPts=pe=Pe+P*ze.duration;var Ve=T?new Uint8Array(0):D.default.moof(_.sequenceNumber++,Le/P,v({},_,{samples:K}));_.samples=[];var De=Le/E,Me=pe/E,be="audio",ve={data1:Ve,data2:Be,startPTS:De,endPTS:Me,startDTS:De,endDTS:Me,type:be,hasAudio:!0,hasVideo:!1,nb:Re};return this.isAudioContiguous=!0,console.assert(Be.length,"MDAT length must not be zero"),ve},S.remuxEmptyAudio=function(_,p,d,g){var l=_.inputTimeScale,E=_.samplerate?_.samplerate:l,U=l/E,P=this.nextAudioPts,j=(P!==null?P:g.startDTS*l)+this._initDTS,H=g.endDTS*l+this._initDTS,I=U*u,T=Math.ceil((H-j)/I),K=F.default.getSilentFrame(_.manifestCodec||_.codec,_.channelCount);if(k.logger.warn("[mp4-remuxer]: remux empty Audio"),!K){k.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var J=[],ie=0;ie<T;ie++){var pe=j+ie*I;J.push({unit:K,pts:pe,dts:pe})}return _.samples=J,this.remuxAudio(_,p,d,!1)},S.remuxID3=function(_,p){var d=_.samples.length;if(!d)return;for(var g=_.inputTimeScale,l=this._initPTS,E=this._initDTS,U=0;U<d;U++){var P=_.samples[U];P.pts=h(P.pts-l,p*g)/g,P.dts=h(P.dts-E,p*g)/g}var j=_.samples;return _.samples=[],{samples:j}},S.remuxText=function(_,p){var d=_.samples.length;if(!d)return;for(var g=_.inputTimeScale,l=this._initPTS,E=0;E<d;E++){var U=_.samples[E];U.pts=h(U.pts-l,p*g)/g}_.samples.sort(function(j,H){return j.pts-H.pts});var P=_.samples;return _.samples=[],{samples:P}},A}();function h(A,S){var y;if(S===null)return A;for(S<A?y=-8589934592:y=8589934592;Math.abs(A-S)>4294967296;)A+=y;return A}function O(A){for(var S=0;S<A.length;S++)if(A[S].key)return S;return-1}var w=function(S,y,_,p){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=y,this.size=_,this.cts=p,this.flags=new x(S)},x=function(S){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=S?2:1,this.isNonSync=S?0:1}},"./src/remux/passthrough-remuxer.ts":function(ce,Y,N){"use strict";N.r(Y);var Q=N("./src/polyfills/number.ts"),F=N("./src/utils/mp4-tools.ts"),D=N("./src/loader/fragment.ts"),G=N("./src/utils/logger.ts"),B=function(){function b(){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 v=b.prototype;return v.destroy=function(){},v.resetTimeStamp=function(u){this.initPTS=u,this.lastEndDTS=null},v.resetNextTimestamp=function(){this.lastEndDTS=null},v.resetInitSegment=function(u,r,c){this.audioCodec=r,this.videoCodec=c,this.generateInitSegment(u),this.emitInitSegment=!0},v.generateInitSegment=function(u){var r=this.audioCodec,c=this.videoCodec;if(!u||!u.byteLength){this.initTracks=void 0,this.initData=void 0;return}var s=this.initData=Object(F.parseInitSegment)(u);r||(r=R(s.audio,D.ElementaryStreamTypes.AUDIO)),c||(c=R(s.video,D.ElementaryStreamTypes.VIDEO));var a={};s.audio&&s.video?a.audiovideo={container:"video/mp4",codec:r+","+c,initSegment:u,id:"main"}:s.audio?a.audio={container:"audio/mp4",codec:r,initSegment:u,id:"audio"}:s.video?a.video={container:"video/mp4",codec:c,initSegment:u,id:"main"}:G.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},v.remux=function(u,r,c,s,a){var o=this.initPTS,h=this.lastEndDTS,O={audio:void 0,video:void 0,text:s,id3:c,initSegment:void 0};Object(Q.isFiniteNumber)(h)||(h=this.lastEndDTS=a||0);var w=r.samples;if(!w||!w.length)return O;var x={initPTS:void 0,timescale:1},A=this.initData;if((!A||!A.length)&&(this.generateInitSegment(w),A=this.initData),!A||!A.length)return G.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),O;this.emitInitSegment&&(x.tracks=this.initTracks,this.emitInitSegment=!1),Object(Q.isFiniteNumber)(o)||(this.initPTS=x.initPTS=o=k(A,w,h));var S=Object(F.getDuration)(w,A),y=h,_=S+y;Object(F.offsetStartDTS)(A,w,o),S>0?this.lastEndDTS=_:(G.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var p=!!A.audio,d=!!A.video,g="";p&&(g+="audio"),d&&(g+="video");var l={data1:w,startPTS:y,startDTS:y,endPTS:_,endDTS:_,type:g,hasAudio:p,hasVideo:d,nb:1,dropped:0};return O.audio=l.type==="audio"?l:void 0,O.video=l.type!=="audio"?l:void 0,O.text=s,O.id3=c,O.initSegment=x,O},b}(),k=function(v,m,u){return Object(F.getStartDTS)(v,m)-u};function R(b,v){var m=b==null?void 0:b.codec;return m&&m.length>4?m:m==="hvc1"?"hvc1.1.c.L120.90":m==="av01"?"av01.0.04M.08":m==="avc1"||v===D.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Y.default=B},"./src/task-loop.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return Q});var Q=function(){function F(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var D=F.prototype;return D.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},D.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},D.onHandlerDestroyed=function(){},D.hasInterval=function(){return!!this._tickInterval},D.hasNextTick=function(){return!!this._tickTimer},D.setInterval=function(B){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,B),!0)},D.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},D.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},D.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},D.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},D.doTick=function(){},F}()},"./src/types/cmcd.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"CMCDVersion",function(){return Q}),N.d(Y,"CMCDObjectType",function(){return F}),N.d(Y,"CMCDStreamingFormat",function(){return D}),N.d(Y,"CMCDStreamType",function(){return G});var Q=1,F;(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"})(F||(F={}));var D;(function(B){B.DASH="d",B.HLS="h",B.SMOOTH="s",B.OTHER="o"})(D||(D={}));var G;(function(B){B.VOD="v",B.LIVE="l"})(G||(G={}))},"./src/types/level.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"HlsSkip",function(){return D}),N.d(Y,"getSkipValue",function(){return G}),N.d(Y,"HlsUrlParameters",function(){return B}),N.d(Y,"Level",function(){return k});function Q(R,b){for(var v=0;v<b.length;v++){var m=b[v];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(R,m.key,m)}}function F(R,b,v){return b&&Q(R.prototype,b),v&&Q(R,v),R}var D;(function(R){R.No="",R.Yes="YES",R.v2="v2"})(D||(D={}));function G(R,b){var v=R.canSkipUntil,m=R.canSkipDateRanges,u=R.endSN,r=b!==void 0?b-u:0;return v&&r<v?m?D.v2:D.Yes:D.No}var B=function(){function R(v,m,u){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=v,this.part=m,this.skip=u}var b=R.prototype;return b.addDirectives=function(m){var u=new self.URL(m);return this.msn!==void 0&&u.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&u.searchParams.set("_HLS_part",this.part.toString()),this.skip&&u.searchParams.set("_HLS_skip",this.skip),u.toString()},R}(),k=function(){function R(b){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=[b.url],this.attrs=b.attrs,this.bitrate=b.bitrate,b.details&&(this.details=b.details),this.id=b.id||0,this.name=b.name,this.width=b.width||0,this.height=b.height||0,this.audioCodec=b.audioCodec,this.videoCodec=b.videoCodec,this.unknownCodecs=b.unknownCodecs,this.codecSet=[b.videoCodec,b.audioCodec].filter(function(v){return v}).join(",").replace(/\.[^.,]+/g,"")}return F(R,[{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(v){var m=v%this.url.length;this._urlId!==m&&(this.details=void 0,this._urlId=m)}}]),R}()},"./src/types/loader.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"PlaylistContextType",function(){return Q}),N.d(Y,"PlaylistLevelType",function(){return F});var Q;(function(D){D.MANIFEST="manifest",D.LEVEL="level",D.AUDIO_TRACK="audioTrack",D.SUBTITLE_TRACK="subtitleTrack"})(Q||(Q={}));var F;(function(D){D.MAIN="main",D.AUDIO="audio",D.SUBTITLE="subtitle"})(F||(F={}))},"./src/types/transmuxer.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"ChunkMetadata",function(){return Q});var Q=function(G,B,k,R,b,v){R===void 0&&(R=0),b===void 0&&(b=-1),v===void 0&&(v=!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=F(),this.buffering={audio:F(),video:F(),audiovideo:F()},this.level=G,this.sn=B,this.id=k,this.size=R,this.part=b,this.partial=v};function F(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"AttrList",function(){return D});var Q=/^(\d+)x(\d+)$/,F=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,D=function(){function G(k){typeof k=="string"&&(k=G.parseAttrList(k));for(var R in k)k.hasOwnProperty(R)&&(this[R]=k[R])}var B=G.prototype;return B.decimalInteger=function(R){var b=parseInt(this[R],10);return b>Number.MAX_SAFE_INTEGER?Infinity:b},B.hexadecimalInteger=function(R){if(this[R]){var b=(this[R]||"0x").slice(2);b=(b.length&1?"0":"")+b;for(var v=new Uint8Array(b.length/2),m=0;m<b.length/2;m++)v[m]=parseInt(b.slice(m*2,m*2+2),16);return v}else return null},B.hexadecimalIntegerAsNumber=function(R){var b=parseInt(this[R],16);return b>Number.MAX_SAFE_INTEGER?Infinity:b},B.decimalFloatingPoint=function(R){return parseFloat(this[R])},B.optionalFloat=function(R,b){var v=this[R];return v?parseFloat(v):b},B.enumeratedString=function(R){return this[R]},B.bool=function(R){return this[R]==="YES"},B.decimalResolution=function(R){var b=Q.exec(this[R]);return b===null?void 0:{width:parseInt(b[1],10),height:parseInt(b[2],10)}},G.parseAttrList=function(R){var b,v={},m='"';for(F.lastIndex=0;(b=F.exec(R))!==null;){var u=b[2];u.indexOf(m)===0&&u.lastIndexOf(m)===u.length-1&&(u=u.slice(1,-1)),v[b[1]]=u}return v},G}()},"./src/utils/binary-search.ts":function(ce,Y,N){"use strict";N.r(Y);var Q={search:function(D,G){for(var B=0,k=D.length-1,R=null,b=null;B<=k;){R=(B+k)/2|0,b=D[R];var v=G(b);if(v>0)B=R+1;else if(v<0)k=R-1;else return b}return null}};Y.default=Q},"./src/utils/buffer-helper.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"BufferHelper",function(){return D});var Q=N("./src/utils/logger.ts"),F={length:0,start:function(){return 0},end:function(){return 0}},D=function(){function G(){}return G.isBuffered=function(k,R){try{if(k){for(var b=G.getBuffered(k),v=0;v<b.length;v++)if(R>=b.start(v)&&R<=b.end(v))return!0}}catch(m){}return!1},G.bufferInfo=function(k,R,b){try{if(k){var v=G.getBuffered(k),m=[],u;for(u=0;u<v.length;u++)m.push({start:v.start(u),end:v.end(u)});return this.bufferedInfo(m,R,b)}}catch(r){}return{len:0,start:R,end:R,nextStart:void 0}},G.bufferedInfo=function(k,R,b){R=Math.max(0,R),k.sort(function(x,A){var S=x.start-A.start;return S||A.end-x.end});var v=[];if(b)for(var m=0;m<k.length;m++){var u=v.length;if(u){var r=v[u-1].end;k[m].start-r<b?k[m].end>r&&(v[u-1].end=k[m].end):v.push(k[m])}else v.push(k[m])}else v=k;for(var c=0,s,a=R,o=R,h=0;h<v.length;h++){var O=v[h].start,w=v[h].end;if(R+b>=O&&R<w)a=O,o=w,c=o-R;else if(R+b<O){s=O;break}}return{len:c,start:a||0,end:o||0,nextStart:s}},G.getBuffered=function(k){try{return k.buffered}catch(R){return Q.logger.log("failed to get media.buffered",R),F}},G}()},"./src/utils/cea-608-parser.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"Row",function(){return o}),N.d(Y,"CaptionScreen",function(){return h});var Q=N("./src/utils/logger.ts"),F={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},D=function(_){var p=_;return F.hasOwnProperty(_)&&(p=F[_]),String.fromCharCode(p)},G=15,B=100,k={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},R={17:2,18:4,21:6,22:8,23:10,19:13,20:15},b={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},v={25:2,26:4,29:6,30:8,31:10,27:13,28:15},m=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],u;(function(y){y[y.ERROR=0]="ERROR",y[y.TEXT=1]="TEXT",y[y.WARNING=2]="WARNING",y[y.INFO=2]="INFO",y[y.DEBUG=3]="DEBUG",y[y.DATA=3]="DATA"})(u||(u={}));var r=function(){function y(){this.time=null,this.verboseLevel=u.ERROR}var _=y.prototype;return _.log=function(d,g){this.verboseLevel>=d&&Q.logger.log(this.time+" ["+d+"] "+g)},y}(),c=function(_){for(var p=[],d=0;d<_.length;d++)p.push(_[d].toString(16));return p},s=function(){function y(p,d,g,l,E){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=p||"white",this.underline=d||!1,this.italics=g||!1,this.background=l||"black",this.flash=E||!1}var _=y.prototype;return _.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},_.setStyles=function(d){for(var g=["foreground","underline","italics","background","flash"],l=0;l<g.length;l++){var E=g[l];d.hasOwnProperty(E)&&(this[E]=d[E])}},_.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},_.equals=function(d){return this.foreground===d.foreground&&this.underline===d.underline&&this.italics===d.italics&&this.background===d.background&&this.flash===d.flash},_.copy=function(d){this.foreground=d.foreground,this.underline=d.underline,this.italics=d.italics,this.background=d.background,this.flash=d.flash},_.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},y}(),a=function(){function y(p,d,g,l,E,U){this.uchar=void 0,this.penState=void 0,this.uchar=p||" ",this.penState=new s(d,g,l,E,U)}var _=y.prototype;return _.reset=function(){this.uchar=" ",this.penState.reset()},_.setChar=function(d,g){this.uchar=d,this.penState.copy(g)},_.setPenState=function(d){this.penState.copy(d)},_.equals=function(d){return this.uchar===d.uchar&&this.penState.equals(d.penState)},_.copy=function(d){this.uchar=d.uchar,this.penState.copy(d.penState)},_.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},y}(),o=function(){function y(p){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var d=0;d<B;d++)this.chars.push(new a);this.logger=p,this.pos=0,this.currPenState=new s}var _=y.prototype;return _.equals=function(d){for(var g=!0,l=0;l<B;l++)if(!this.chars[l].equals(d.chars[l])){g=!1;break}return g},_.copy=function(d){for(var g=0;g<B;g++)this.chars[g].copy(d.chars[g])},_.isEmpty=function(){for(var d=!0,g=0;g<B;g++)if(!this.chars[g].isEmpty()){d=!1;break}return d},_.setCursor=function(d){this.pos!==d&&(this.pos=d),this.pos<0?(this.logger.log(u.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>B&&(this.logger.log(u.DEBUG,"Too large cursor position "+this.pos),this.pos=B)},_.moveCursor=function(d){var g=this.pos+d;if(d>1)for(var l=this.pos+1;l<g+1;l++)this.chars[l].setPenState(this.currPenState);this.setCursor(g)},_.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},_.insertChar=function(d){d>=144&&this.backSpace();var g=D(d);if(this.pos>=B){this.logger.log(u.ERROR,"Cannot insert "+d.toString(16)+" ("+g+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(g,this.currPenState),this.moveCursor(1)},_.clearFromPos=function(d){var g;for(g=d;g<B;g++)this.chars[g].reset()},_.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},_.clearToEndOfRow=function(){this.clearFromPos(this.pos)},_.getTextString=function(){for(var d=[],g=!0,l=0;l<B;l++){var E=this.chars[l].uchar;E!==" "&&(g=!1),d.push(E)}return g?"":d.join("")},_.setPenStyles=function(d){this.currPenState.setStyles(d);var g=this.chars[this.pos];g.setPenState(this.currPenState)},y}(),h=function(){function y(p){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var d=0;d<G;d++)this.rows.push(new o(p));this.logger=p,this.currRow=G-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var _=y.prototype;return _.reset=function(){for(var d=0;d<G;d++)this.rows[d].clear();this.currRow=G-1},_.equals=function(d){for(var g=!0,l=0;l<G;l++)if(!this.rows[l].equals(d.rows[l])){g=!1;break}return g},_.copy=function(d){for(var g=0;g<G;g++)this.rows[g].copy(d.rows[g])},_.isEmpty=function(){for(var d=!0,g=0;g<G;g++)if(!this.rows[g].isEmpty()){d=!1;break}return d},_.backSpace=function(){var d=this.rows[this.currRow];d.backSpace()},_.clearToEndOfRow=function(){var d=this.rows[this.currRow];d.clearToEndOfRow()},_.insertChar=function(d){var g=this.rows[this.currRow];g.insertChar(d)},_.setPen=function(d){var g=this.rows[this.currRow];g.setPenStyles(d)},_.moveCursor=function(d){var g=this.rows[this.currRow];g.moveCursor(d)},_.setCursor=function(d){this.logger.log(u.INFO,"setCursor: "+d);var g=this.rows[this.currRow];g.setCursor(d)},_.setPAC=function(d){this.logger.log(u.INFO,"pacData = "+JSON.stringify(d));var g=d.row-1;if(this.nrRollUpRows&&g<this.nrRollUpRows-1&&(g=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==g){for(var l=0;l<G;l++)this.rows[l].clear();var E=this.currRow+1-this.nrRollUpRows,U=this.lastOutputScreen;if(U){var P=U.rows[E].cueStartTime,j=this.logger.time;if(P&&j!==null&&P<j)for(var H=0;H<this.nrRollUpRows;H++)this.rows[g-this.nrRollUpRows+H+1].copy(U.rows[E+H])}}this.currRow=g;var I=this.rows[this.currRow];if(d.indent!==null){var T=d.indent,K=Math.max(T-1,0);I.setCursor(d.indent),d.color=I.chars[K].penState.foreground}var J={foreground:d.color,underline:d.underline,italics:d.italics,background:"black",flash:!1};this.setPen(J)},_.setBkgData=function(d){this.logger.log(u.INFO,"bkgData = "+JSON.stringify(d)),this.backSpace(),this.setPen(d),this.insertChar(32)},_.setRollUpRows=function(d){this.nrRollUpRows=d},_.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(u.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(u.TEXT,this.getDisplayText());var d=this.currRow+1-this.nrRollUpRows,g=this.rows.splice(d,1)[0];g.clear(),this.rows.splice(this.currRow,0,g),this.logger.log(u.INFO,"Rolling up")},_.getDisplayText=function(d){d=d||!1;for(var g=[],l="",E=-1,U=0;U<G;U++){var P=this.rows[U].getTextString();P&&(E=U+1,d?g.push("Row "+E+": '"+P+"'"):g.push(P.trim()))}return g.length>0&&(d?l="["+g.join(" | ")+"]":l=g.join(`
|
|
`)),l},_.getTextAndFormat=function(){return this.rows},y}(),O=function(){function y(p,d,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=p,this.outputFilter=d,this.mode=null,this.verbose=0,this.displayedMemory=new h(g),this.nonDisplayedMemory=new h(g),this.lastOutputScreen=new h(g),this.currRollUpRow=this.displayedMemory.rows[G-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=g}var _=y.prototype;return _.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[G-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},_.getHandler=function(){return this.outputFilter},_.setHandler=function(d){this.outputFilter=d},_.setPAC=function(d){this.writeScreen.setPAC(d)},_.setBkgData=function(d){this.writeScreen.setBkgData(d)},_.setMode=function(d){if(d===this.mode)return;this.mode=d,this.logger.log(u.INFO,"MODE="+d),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=d},_.insertChars=function(d){for(var g=0;g<d.length;g++)this.writeScreen.insertChar(d[g]);var l=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(u.INFO,l+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(u.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},_.ccRCL=function(){this.logger.log(u.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},_.ccBS=function(){if(this.logger.log(u.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},_.ccAOF=function(){},_.ccAON=function(){},_.ccDER=function(){this.logger.log(u.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},_.ccRU=function(d){this.logger.log(u.INFO,"RU("+d+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(d)},_.ccFON=function(){this.logger.log(u.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},_.ccRDC=function(){this.logger.log(u.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},_.ccTR=function(){this.logger.log(u.INFO,"TR"),this.setMode("MODE_TEXT")},_.ccRTD=function(){this.logger.log(u.INFO,"RTD"),this.setMode("MODE_TEXT")},_.ccEDM=function(){this.logger.log(u.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},_.ccCR=function(){this.logger.log(u.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},_.ccENM=function(){this.logger.log(u.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},_.ccEOC=function(){if(this.logger.log(u.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var d=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=d,this.writeScreen=this.nonDisplayedMemory,this.logger.log(u.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},_.ccTO=function(d){this.logger.log(u.INFO,"TO("+d+") - Tab Offset"),this.writeScreen.moveCursor(d)},_.ccMIDROW=function(d){var g={flash:!1};if(g.underline=d%2===1,g.italics=d>=46,g.italics)g.foreground="white";else{var l=Math.floor(d/2)-16,E=["white","green","blue","cyan","red","yellow","magenta"];g.foreground=E[l]}this.logger.log(u.INFO,"MIDROW: "+JSON.stringify(g)),this.writeScreen.setPen(g)},_.outputDataUpdate=function(d){d===void 0&&(d=!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),d&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:g),this.lastOutputScreen.copy(this.displayedMemory))},_.cueSplitAtTime=function(d){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,d,this.displayedMemory),this.cueStartTime=d))},y}(),w=function(){function y(p,d,g){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var l=new r;this.channels=[null,new O(p,d,l),new O(p+1,g,l)],this.cmdHistory=S(),this.logger=l}var _=y.prototype;return _.getHandler=function(d){return this.channels[d].getHandler()},_.setHandler=function(d,g){this.channels[d].setHandler(g)},_.addData=function(d,g){var l,E,U,P=!1;this.logger.time=d;for(var j=0;j<g.length;j+=2){if(E=g[j]&127,U=g[j+1]&127,E===0&&U===0)continue;if(this.logger.log(u.DATA,"["+c([g[j],g[j+1]])+"] -> ("+c([E,U])+")"),l=this.parseCmd(E,U),l||(l=this.parseMidrow(E,U)),l||(l=this.parsePAC(E,U)),l||(l=this.parseBackgroundAttributes(E,U)),!l&&(P=this.parseChars(E,U),P)){var H=this.currentChannel;if(H&&H>0){var I=this.channels[H];I.insertChars(P)}else this.logger.log(u.WARNING,"No channel found yet. TEXT-MODE?")}!l&&!P&&this.logger.log(u.WARNING,"Couldn't parse cleaned data "+c([E,U])+" orig: "+c([g[j],g[j+1]]))}},_.parseCmd=function(d,g){var l=this.cmdHistory,E=(d===20||d===28||d===21||d===29)&&g>=32&&g<=47,U=(d===23||d===31)&&g>=33&&g<=35;if(!(E||U))return!1;if(A(d,g,l))return x(null,null,l),this.logger.log(u.DEBUG,"Repeated command ("+c([d,g])+") is dropped"),!0;var P=d===20||d===21||d===23?1:2,j=this.channels[P];return d===20||d===21||d===28||d===29?g===32?j.ccRCL():g===33?j.ccBS():g===34?j.ccAOF():g===35?j.ccAON():g===36?j.ccDER():g===37?j.ccRU(2):g===38?j.ccRU(3):g===39?j.ccRU(4):g===40?j.ccFON():g===41?j.ccRDC():g===42?j.ccTR():g===43?j.ccRTD():g===44?j.ccEDM():g===45?j.ccCR():g===46?j.ccENM():g===47&&j.ccEOC():j.ccTO(g-32),x(d,g,l),this.currentChannel=P,!0},_.parseMidrow=function(d,g){var l=0;if((d===17||d===25)&&g>=32&&g<=47){if(d===17?l=1:l=2,l!==this.currentChannel)return this.logger.log(u.ERROR,"Mismatch channel in midrow parsing"),!1;var E=this.channels[l];return E?(E.ccMIDROW(g),this.logger.log(u.DEBUG,"MIDROW ("+c([d,g])+")"),!0):!1}return!1},_.parsePAC=function(d,g){var l,E=this.cmdHistory,U=(d>=17&&d<=23||d>=25&&d<=31)&&g>=64&&g<=127,P=(d===16||d===24)&&g>=64&&g<=95;if(!(U||P))return!1;if(A(d,g,E))return x(null,null,E),!0;var j=d<=23?1:2;g>=64&&g<=95?l=j===1?k[d]:b[d]:l=j===1?R[d]:v[d];var H=this.channels[j];return H?(H.setPAC(this.interpretPAC(l,g)),x(d,g,E),this.currentChannel=j,!0):!1},_.interpretPAC=function(d,g){var l,E={color:null,italics:!1,indent:null,underline:!1,row:d};return g>95?l=g-96:l=g-64,E.underline=(l&1)===1,l<=13?E.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(l/2)]:l<=15?(E.italics=!0,E.color="white"):E.indent=Math.floor((l-16)/2)*4,E},_.parseChars=function(d,g){var l,E=null,U=null;if(d>=25?(l=2,U=d-8):(l=1,U=d),U>=17&&U<=19){var P;U===17?P=g+80:U===18?P=g+112:P=g+144,this.logger.log(u.INFO,"Special char '"+D(P)+"' in channel "+l),E=[P]}else d>=32&&d<=127&&(E=g===0?[d]:[d,g]);if(E){var j=c(E);this.logger.log(u.DEBUG,"Char codes = "+j.join(",")),x(d,g,this.cmdHistory)}return E},_.parseBackgroundAttributes=function(d,g){var l=(d===16||d===24)&&g>=32&&g<=47,E=(d===23||d===31)&&g>=45&&g<=47;if(!(l||E))return!1;var U,P={};d===16||d===24?(U=Math.floor((g-32)/2),P.background=m[U],g%2===1&&(P.background=P.background+"_semi")):g===45?P.background="transparent":(P.foreground="black",g===47&&(P.underline=!0));var j=d<=23?1:2,H=this.channels[j];return H.setBkgData(P),x(d,g,this.cmdHistory),!0},_.reset=function(){for(var d=0;d<Object.keys(this.channels).length;d++){var g=this.channels[d];g&&g.reset()}this.cmdHistory=S()},_.cueSplitAtTime=function(d){for(var g=0;g<this.channels.length;g++){var l=this.channels[g];l&&l.cueSplitAtTime(d)}},y}();function x(y,_,p){p.a=y,p.b=_}function A(y,_,p){return p.a===y&&p.b===_}function S(){return{a:null,b:null}}Y.default=w},"./src/utils/codecs.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"isCodecType",function(){return F}),N.d(Y,"isCodecSupportedInMp4",function(){return D});var Q={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 F(G,B){var k=Q[B];return!!k&&k[G.slice(0,4)]===!0}function D(G,B){return MediaSource.isTypeSupported((B||"video")+'/mp4;codecs="'+G+'"')}},"./src/utils/cues.ts":function(ce,Y,N){"use strict";N.r(Y);var Q=N("./src/utils/vttparser.ts"),F=N("./src/utils/webvtt-parser.ts"),D=N("./src/utils/texttrack-utils.ts"),G=/\s/,B={newCue:function(R,b,v,m){for(var u=[],r,c,s,a,o,h=self.VTTCue||self.TextTrackCue,O=0;O<m.rows.length;O++)if(r=m.rows[O],s=!0,a=0,o="",!r.isEmpty()){for(var w=0;w<r.chars.length;w++)G.test(r.chars[w].uchar)&&s?a++:(o+=r.chars[w].uchar,s=!1);r.cueStartTime=b,b===v&&(v+=1e-4),a>=16?a--:a++;var x=Object(Q.fixLineBreaks)(o.trim()),A=Object(F.generateCueId)(b,v,x);(!R||!R.cues||!R.cues.getCueById(A))&&(c=new h(b,v,x),c.id=A,c.line=O+1,c.align="left",c.position=10+Math.min(80,Math.floor(a*8/32)*10),u.push(c))}return R&&u.length&&(u.sort(function(S,y){return S.line==="auto"||y.line==="auto"?0:S.line>8&&y.line>8?y.line-S.line:S.line-y.line}),u.forEach(function(S){return Object(D.addCueToTrack)(R,S)})),u}};Y.default=B},"./src/utils/discontinuities.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"findFirstFragWithCC",function(){return G}),N.d(Y,"shouldAlignOnDiscontinuities",function(){return B}),N.d(Y,"findDiscontinuousReferenceFrag",function(){return k}),N.d(Y,"adjustSlidingStart",function(){return b}),N.d(Y,"alignStream",function(){return v}),N.d(Y,"alignPDT",function(){return u}),N.d(Y,"alignFragmentByPDTDelta",function(){return r}),N.d(Y,"alignMediaPlaylistByPDT",function(){return c});var Q=N("./src/polyfills/number.ts"),F=N("./src/utils/logger.ts"),D=N("./src/controller/level-helper.ts");function G(s,a){for(var o=null,h=0,O=s.length;h<O;h++){var w=s[h];if(w&&w.cc===a){o=w;break}}return o}function B(s,a,o){return!!(a.details&&(o.endCC>o.startCC||s&&s.cc<o.startCC))}function k(s,a){var o=s.fragments,h=a.fragments;if(!h.length||!o.length){F.logger.log("No fragments to align");return}var O=G(o,h[0].cc);if(!O||O&&!O.startPTS){F.logger.log("No frag in previous level to align on");return}return O}function R(s,a){if(s){var o=s.start+a;s.start=s.startPTS=o,s.endPTS=o+s.duration}}function b(s,a){for(var o=a.fragments,h=0,O=o.length;h<O;h++)R(o[h],s);a.fragmentHint&&R(a.fragmentHint,s),a.alignedSliding=!0}function v(s,a,o){if(!a)return;m(s,o,a),!o.alignedSliding&&a.details&&u(o,a.details),!o.alignedSliding&&a.details&&!o.skippedSegments&&Object(D.adjustSliding)(a.details,o)}function m(s,a,o){if(B(s,o,a)){var h=k(o.details,a);h&&Object(Q.isFiniteNumber)(h.start)&&(F.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),b(h.start,a))}}function u(s,a){if(!a.fragments.length||!s.hasProgramDateTime||!a.hasProgramDateTime)return;var o=a.fragments[0].programDateTime,h=s.fragments[0].programDateTime,O=(h-o)/1e3+a.fragments[0].start;O&&Object(Q.isFiniteNumber)(O)&&(F.logger.log("Adjusting PTS using programDateTime delta "+(h-o)+"ms, sliding:"+O.toFixed(3)+" "+s.url+" "),b(O,s))}function r(s,a){var o=s.programDateTime;if(!o)return;var h=(o-a)/1e3;s.start=s.startPTS=h,s.endPTS=h+s.duration}function c(s,a){if(!a.fragments.length||!s.hasProgramDateTime||!a.hasProgramDateTime)return;var o=a.fragments[0].programDateTime,h=a.fragments[0].start,O=o-h*1e3;s.fragments.forEach(function(w){r(w,O)}),s.fragmentHint&&r(s.fragmentHint,O),s.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ce,Y,N){"use strict";N.r(Y);var Q=N("./src/utils/ewma.ts"),F=function(){function D(B,k,R){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=R,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Q.default(B),this.fast_=new Q.default(k)}var G=D.prototype;return G.update=function(k,R){var b=this.slow_,v=this.fast_;this.slow_.halfLife!==k&&(this.slow_=new Q.default(k,b.getEstimate(),b.getTotalWeight())),this.fast_.halfLife!==R&&(this.fast_=new Q.default(R,v.getEstimate(),v.getTotalWeight()))},G.sample=function(k,R){k=Math.max(k,this.minDelayMs_);var b=8*R,v=k/1e3,m=b/v;this.fast_.sample(v,m),this.slow_.sample(v,m)},G.canEstimate=function(){var k=this.fast_;return k&&k.getTotalWeight()>=this.minWeight_},G.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},G.destroy=function(){},D}();Y.default=F},"./src/utils/ewma.ts":function(ce,Y,N){"use strict";N.r(Y);var Q=function(){function F(G,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=G,this.alpha_=G?Math.exp(Math.log(.5)/G):0,this.estimate_=B,this.totalWeight_=k}var D=F.prototype;return D.sample=function(B,k){var R=Math.pow(this.alpha_,B);this.estimate_=k*(1-R)+R*this.estimate_,this.totalWeight_+=B},D.getTotalWeight=function(){return this.totalWeight_},D.getEstimate=function(){if(this.alpha_){var B=1-Math.pow(this.alpha_,this.totalWeight_);if(B)return this.estimate_/B}return this.estimate_},F}();Y.default=Q},"./src/utils/fetch-loader.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"fetchSupported",function(){return r});var Q=N("./src/polyfills/number.ts"),F=N("./src/loader/load-stats.ts"),D=N("./src/demux/chunk-cache.ts");function G(h,O){h.prototype=Object.create(O.prototype),h.prototype.constructor=h,v(h,O)}function B(h){var O=typeof Map=="function"?new Map:void 0;return B=function(x){if(x===null||!b(x))return x;if(typeof x!="function")throw new TypeError("Super expression must either be null or a function");if(typeof O!="undefined"){if(O.has(x))return O.get(x);O.set(x,A)}function A(){return k(x,arguments,m(this).constructor)}return A.prototype=Object.create(x.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),v(A,x)},B(h)}function k(h,O,w){return R()?k=Reflect.construct:k=function(A,S,y){var _=[null];_.push.apply(_,S);var p=Function.bind.apply(A,_),d=new p;return y&&v(d,y.prototype),d},k.apply(null,arguments)}function R(){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(h){return!1}}function b(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function v(h,O){return v=Object.setPrototypeOf||function(x,A){return x.__proto__=A,x},v(h,O)}function m(h){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(w){return w.__proto__||Object.getPrototypeOf(w)},m(h)}function u(){return u=Object.assign||function(h){for(var O=1;O<arguments.length;O++){var w=arguments[O];for(var x in w)Object.prototype.hasOwnProperty.call(w,x)&&(h[x]=w[x])}return h},u.apply(this,arguments)}function r(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(h){}return!1}var c=function(){function h(w){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=w.fetchSetup||a,this.controller=new self.AbortController,this.stats=new F.LoadStats}var O=h.prototype;return O.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},O.abortInternal=function(){var x=this.response;(!x||!x.ok)&&(this.stats.aborted=!0,this.controller.abort())},O.abort=function(){var x;this.abortInternal(),(x=this.callbacks)!==null&&x!==void 0&&x.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},O.load=function(x,A,S){var y=this,_=this.stats;if(_.loading.start)throw new Error("Loader can only be used once.");_.loading.start=self.performance.now();var p=s(x,this.controller.signal),d=S.onProgress,g=x.responseType==="arraybuffer",l=g?"byteLength":"length";this.context=x,this.config=A,this.callbacks=S,this.request=this.fetchSetup(x,p),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){y.abortInternal(),S.onTimeout(_,x,y.response)},A.timeout),self.fetch(this.request).then(function(E){if(y.response=y.loader=E,!E.ok){var U=E.status,P=E.statusText;throw new o(P||"fetch, bad network response",U,E)}return _.loading.first=Math.max(self.performance.now(),_.loading.start),_.total=parseInt(E.headers.get("Content-Length")||"0"),d&&Object(Q.isFiniteNumber)(A.highWaterMark)?y.loadProgressively(E,_,x,A.highWaterMark,d):g?E.arrayBuffer():E.text()}).then(function(E){var U=y.response;self.clearTimeout(y.requestTimeout),_.loading.end=Math.max(self.performance.now(),_.loading.first),_.loaded=_.total=E[l];var P={url:U.url,data:E};d&&!Object(Q.isFiniteNumber)(A.highWaterMark)&&d(_,x,E,U),S.onSuccess(P,_,x,U)}).catch(function(E){if(self.clearTimeout(y.requestTimeout),_.aborted)return;var U=E.code||0;S.onError({code:U,text:E.message},x,E.details)})},O.getCacheAge=function(){var x=null;if(this.response){var A=this.response.headers.get("age");x=A?parseFloat(A):null}return x},O.loadProgressively=function(x,A,S,y,_){y===void 0&&(y=0);var p=new D.default,d=x.body.getReader(),g=function l(){return d.read().then(function(E){if(E.done)return p.dataLength&&_(A,S,p.flush(),x),Promise.resolve(new ArrayBuffer(0));var U=E.value,P=U.length;return A.loaded+=P,P<y||p.dataLength?(p.push(U),p.dataLength>=y&&_(A,S,p.flush(),x)):_(A,S,U,x),l()}).catch(function(){return Promise.reject()})};return g()},h}();function s(h,O){var w={method:"GET",mode:"cors",credentials:"same-origin",signal:O,headers:new self.Headers(u({},h.headers))};return h.rangeEnd&&w.headers.set("Range","bytes="+h.rangeStart+"-"+String(h.rangeEnd-1)),w}function a(h,O){return new self.Request(h.url,O)}var o=function(h){G(O,h);function O(w,x,A){var S;return S=h.call(this,w)||this,S.code=void 0,S.details=void 0,S.code=x,S.details=A,S}return O}(B(Error));Y.default=c},"./src/utils/imsc1-ttml-parser.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"IMSC1_CODEC",function(){return b}),N.d(Y,"parseIMSC1",function(){return r});var Q=N("./src/utils/mp4-tools.ts"),F=N("./src/utils/vttparser.ts"),D=N("./src/utils/vttcue.ts"),G=N("./src/demux/id3.ts"),B=N("./src/utils/timescale-conversion.ts"),k=N("./src/utils/webvtt-parser.ts");function R(){return R=Object.assign||function(y){for(var _=1;_<arguments.length;_++){var p=arguments[_];for(var d in p)Object.prototype.hasOwnProperty.call(p,d)&&(y[d]=p[d])}return y},R.apply(this,arguments)}var b="stpp.ttml.im1t",v=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,m=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,u={left:"start",center:"center",right:"end",start:"start",end:"end"};function r(y,_,p,d,g){var l=Object(Q.findBox)(new Uint8Array(y),["mdat"]);if(l.length===0){g(new Error("Could not parse IMSC1 mdat"));return}var E=l[0],U=Object(G.utf8ArrayToStr)(new Uint8Array(y,E.start,E.end-E.start)),P=Object(B.toTimescaleFromScale)(_,1,p);try{d(c(U,P))}catch(j){g(j)}}function c(y,_){var p=new DOMParser,d=p.parseFromString(y,"text/xml"),g=d.getElementsByTagName("tt")[0];if(!g)throw new Error("Invalid ttml");var l={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},E=Object.keys(l).reduce(function(I,T){return I[T]=g.getAttribute("ttp:"+T)||l[T],I},{}),U=g.getAttribute("xml:space")!=="preserve",P=a(s(g,"styling","style")),j=a(s(g,"layout","region")),H=s(g,"body","[begin]");return[].map.call(H,function(I){var T=o(I,U);if(!T||!I.hasAttribute("begin"))return null;var K=x(I.getAttribute("begin"),E),J=x(I.getAttribute("dur"),E),ie=x(I.getAttribute("end"),E);if(K===null)throw w(I);if(ie===null){if(J===null)throw w(I);ie=K+J}var pe=new D.default(K-_,ie-_,T);pe.id=Object(k.generateCueId)(pe.startTime,pe.endTime,pe.text);var _e=j[I.getAttribute("region")],Te=P[I.getAttribute("style")];pe.position=10,pe.size=80;var he=h(_e,Te),re=he.textAlign;if(re){var fe=u[re];fe&&(pe.lineAlign=fe),pe.align=re}return R(pe,he),pe}).filter(function(I){return I!==null})}function s(y,_,p){var d=y.getElementsByTagName(_)[0];return d?[].slice.call(d.querySelectorAll(p)):[]}function a(y){return y.reduce(function(_,p){var d=p.getAttribute("xml:id");return d&&(_[d]=p),_},{})}function o(y,_){return[].slice.call(y.childNodes).reduce(function(p,d,g){var l;return d.nodeName==="br"&&g?p+`
|
|
`:(l=d.childNodes)!==null&&l!==void 0&&l.length?o(d,_):_?p+d.textContent.trim().replace(/\s+/g," "):p+d.textContent},"")}function h(y,_){var p="http://www.w3.org/ns/ttml#styling",d=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return d.reduce(function(g,l){var E=O(_,p,l)||O(y,p,l);return E&&(g[l]=E),g},{})}function O(y,_,p){return y.hasAttributeNS(_,p)?y.getAttributeNS(_,p):null}function w(y){return new Error("Could not parse ttml timestamp "+y)}function x(y,_){if(!y)return null;var p=Object(F.parseTimeStamp)(y);return p===null&&(v.test(y)?p=A(y,_):m.test(y)&&(p=S(y,_))),p}function A(y,_){var p=v.exec(y),d=(p[4]|0)+(p[5]|0)/_.subFrameRate;return(p[1]|0)*3600+(p[2]|0)*60+(p[3]|0)+d/_.frameRate}function S(y,_){var p=m.exec(y),d=Number(p[1]),g=p[2];switch(g){case"h":return d*3600;case"m":return d*60;case"ms":return d*1e3;case"f":return d/_.frameRate;case"t":return d/_.tickRate}return d}},"./src/utils/logger.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"enableLogs",function(){return k}),N.d(Y,"logger",function(){return R});var Q=function(){},F={trace:Q,debug:Q,log:Q,warn:Q,info:Q,error:Q},D=F;function G(b){var v=self.console[b];return v?v.bind(self.console,"["+b+"] >"):Q}function B(b){for(var v=arguments.length,m=new Array(v>1?v-1:0),u=1;u<v;u++)m[u-1]=arguments[u];m.forEach(function(r){D[r]=b[r]?b[r].bind(b):G(r)})}function k(b){if(self.console&&b===!0||typeof b=="object"){B(b,"debug","log","info","warn","error");try{D.log()}catch(v){D=F}}else D=F}var R=D},"./src/utils/mediakeys-helper.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"KeySystems",function(){return Q}),N.d(Y,"requestMediaKeySystemAccess",function(){return F});var Q;(function(D){D.WIDEVINE="com.widevine.alpha",D.PLAYREADY="com.microsoft.playready"})(Q||(Q={}));var F=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"getMediaSource",function(){return Q});function Q(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"bin2str",function(){return B}),N.d(Y,"readUint16",function(){return k}),N.d(Y,"readUint32",function(){return R}),N.d(Y,"writeUint32",function(){return b}),N.d(Y,"findBox",function(){return v}),N.d(Y,"parseSegmentIndex",function(){return m}),N.d(Y,"parseInitSegment",function(){return u}),N.d(Y,"getStartDTS",function(){return r}),N.d(Y,"getDuration",function(){return c}),N.d(Y,"computeRawDurationFromSamples",function(){return s}),N.d(Y,"offsetStartDTS",function(){return a}),N.d(Y,"segmentValidRange",function(){return o}),N.d(Y,"appendUint8Array",function(){return h});var Q=N("./src/utils/typed-array.ts"),F=N("./src/loader/fragment.ts"),D=Math.pow(2,32)-1,G=[].push;function B(O){return String.fromCharCode.apply(null,O)}function k(O,w){"data"in O&&(w+=O.start,O=O.data);var x=O[w]<<8|O[w+1];return x<0?65536+x:x}function R(O,w){"data"in O&&(w+=O.start,O=O.data);var x=O[w]<<24|O[w+1]<<16|O[w+2]<<8|O[w+3];return x<0?4294967296+x:x}function b(O,w,x){"data"in O&&(w+=O.start,O=O.data),O[w]=x>>24,O[w+1]=x>>16&255,O[w+2]=x>>8&255,O[w+3]=x&255}function v(O,w){var x=[];if(!w.length)return x;var A,S,y;"data"in O?(A=O.data,S=O.start,y=O.end):(A=O,S=0,y=A.byteLength);for(var _=S;_<y;){var p=R(A,_),d=B(A.subarray(_+4,_+8)),g=p>1?_+p:y;if(d===w[0])if(w.length===1)x.push({data:A,start:_+8,end:g});else{var l=v({data:A,start:_+8,end:g},w.slice(1));l.length&&G.apply(x,l)}_=g}return x}function m(O){var w=v(O,["moov"]),x=w[0],A=x?x.end:null,S=v(O,["sidx"]);if(!S||!S[0])return null;var y=[],_=S[0],p=_.data[0],d=p===0?8:16,g=R(_,d);d+=4;var l=0,E=0;p===0?d+=8:d+=16,d+=2;var U=_.end+E,P=k(_,d);d+=2;for(var j=0;j<P;j++){var H=d,I=R(_,H);H+=4;var T=I&2147483647,K=(I&2147483648)>>>31;if(K===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var J=R(_,H);H+=4,y.push({referenceSize:T,subsegmentDuration:J,info:{duration:J/g,start:U,end:U+T-1}}),U+=T,H+=4,d=H}return{earliestPresentationTime:l,timescale:g,version:p,referencesCount:P,references:y,moovEndOffset:A}}function u(O){for(var w=[],x=v(O,["moov","trak"]),A=0;A<x.length;A++){var S=x[A],y=v(S,["tkhd"])[0];if(y){var _=y.data[y.start],p=_===0?12:20,d=R(y,p),g=v(S,["mdia","mdhd"])[0];if(g){_=g.data[g.start],p=_===0?12:20;var l=R(g,p),E=v(S,["mdia","hdlr"])[0];if(E){var U=B(E.data.subarray(E.start+8,E.start+12)),P={soun:F.ElementaryStreamTypes.AUDIO,vide:F.ElementaryStreamTypes.VIDEO}[U];if(P){var j=v(S,["mdia","minf","stbl","stsd"])[0],H=void 0;j&&(H=B(j.data.subarray(j.start+12,j.start+16))),w[d]={timescale:l,type:P},w[P]={timescale:l,id:d,codec:H}}}}}}var I=v(O,["moov","mvex","trex"]);return I.forEach(function(T){var K=R(T,4),J=w[K];J&&(J.default={duration:R(T,12),flags:R(T,20)})}),w}function r(O,w){return v(w,["moof","traf"]).reduce(function(x,A){var S=v(A,["tfdt"])[0],y=S.data[S.start],_=v(A,["tfhd"]).reduce(function(p,d){var g=R(d,4),l=O[g];if(l){var E=R(S,4);y===1&&(E*=Math.pow(2,32),E+=R(S,8));var U=l.timescale||9e4,P=E/U;if(isFinite(P)&&(p===null||P<p))return P}return p},null);return _!==null&&isFinite(_)&&(x===null||_<x)?_:x},null)||0}function c(O,w){for(var x=0,A=0,S=0,y=v(O,["moof","traf"]),_=0;_<y.length;_++){var p=y[_],d=v(p,["tfhd"])[0],g=R(d,4),l=w[g];if(!l)continue;var E=l.default,U=R(d,0)|(E==null?void 0:E.flags),P=E==null?void 0:E.duration;U&8&&(U&2?P=R(d,12):P=R(d,8));for(var j=l.timescale||9e4,H=v(p,["trun"]),I=0;I<H.length;I++){if(P){var T=R(H[I],4);x=P*T}else x=s(H[I]);l.type===F.ElementaryStreamTypes.VIDEO?A+=x/j:l.type===F.ElementaryStreamTypes.AUDIO&&(S+=x/j)}}if(A===0&&S===0){var K=m(O);if(K!=null&&K.references)return K.references.reduce(function(J,ie){return J+ie.info.duration||0},0)}return A||S}function s(O){var w=R(O,0),x=8;w&1&&(x+=4),w&4&&(x+=4);for(var A=0,S=R(O,4),y=0;y<S;y++){if(w&256){var _=R(O,x);A+=_,x+=4}w&512&&(x+=4),w&1024&&(x+=4),w&2048&&(x+=4)}return A}function a(O,w,x){v(w,["moof","traf"]).forEach(function(A){v(A,["tfhd"]).forEach(function(S){var y=R(S,4),_=O[y];if(!_)return;var p=_.timescale||9e4;v(A,["tfdt"]).forEach(function(d){var g=d.data[d.start],l=R(d,4);if(g===0)b(d,4,l-x*p);else{l*=Math.pow(2,32),l+=R(d,8),l-=x*p,l=Math.max(l,0);var E=Math.floor(l/(D+1)),U=Math.floor(l%(D+1));b(d,4,E),b(d,8,U)}})})})}function o(O){var w={valid:null,remainder:null},x=v(O,["moof"]);if(x){if(x.length<2)return w.remainder=O,w}else return w;var A=x[x.length-1];return w.valid=Object(Q.sliceUint8)(O,0,A.start-8),w.remainder=Object(Q.sliceUint8)(O,A.start-8),w}function h(O,w){var x=new Uint8Array(O.length+w.length);return x.set(O),x.set(w,O.length),x}},"./src/utils/output-filter.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"default",function(){return Q});var Q=function(){function F(G,B){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=G,this.trackName=B}var D=F.prototype;return D.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},D.newCue=function(B,k,R){(this.startTime===null||this.startTime>B)&&(this.startTime=B),this.endTime=k,this.screen=R,this.timelineController.createCaptionsTrack(this.trackName)},D.reset=function(){this.cueRanges=[]},F}()},"./src/utils/texttrack-utils.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"sendAddTrackEvent",function(){return F}),N.d(Y,"addCueToTrack",function(){return D}),N.d(Y,"clearCurrentCues",function(){return G}),N.d(Y,"removeCuesInRange",function(){return B}),N.d(Y,"getCuesInRange",function(){return R});var Q=N("./src/utils/logger.ts");function F(b,v){var m;try{m=new Event("addtrack")}catch(u){m=document.createEvent("Event"),m.initEvent("addtrack",!1,!1)}m.track=b,v.dispatchEvent(m)}function D(b,v){var m=b.mode;if(m==="disabled"&&(b.mode="hidden"),b.cues&&!b.cues.getCueById(v.id))try{if(b.addCue(v),!b.cues.getCueById(v.id))throw new Error("addCue is failed for: "+v)}catch(r){Q.logger.debug("[texttrack-utils]: "+r);var u=new self.TextTrackCue(v.startTime,v.endTime,v.text);u.id=v.id,b.addCue(u)}m==="disabled"&&(b.mode=m)}function G(b){var v=b.mode;if(v==="disabled"&&(b.mode="hidden"),b.cues)for(var m=b.cues.length;m--;)b.removeCue(b.cues[m]);v==="disabled"&&(b.mode=v)}function B(b,v,m){var u=b.mode;if(u==="disabled"&&(b.mode="hidden"),b.cues&&b.cues.length>0)for(var r=R(b.cues,v,m),c=0;c<r.length;c++)b.removeCue(r[c]);u==="disabled"&&(b.mode=u)}function k(b,v){if(v<b[0].startTime)return 0;var m=b.length-1;if(v>b[m].endTime)return-1;for(var u=0,r=m;u<=r;){var c=Math.floor((r+u)/2);if(v<b[c].startTime)r=c-1;else if(v>b[c].startTime&&u<m)u=c+1;else return c}return b[u].startTime-v<v-b[r].startTime?u:r}function R(b,v,m){var u=[],r=k(b,v);if(r>-1)for(var c=r,s=b.length;c<s;c++){var a=b[c];if(a.startTime>=v&&a.endTime<=m)u.push(a);else if(a.startTime>m)return u}return u}},"./src/utils/time-ranges.ts":function(ce,Y,N){"use strict";N.r(Y);var Q={toString:function(D){for(var G="",B=D.length,k=0;k<B;k++)G+="["+D.start(k).toFixed(3)+","+D.end(k).toFixed(3)+"]";return G}};Y.default=Q},"./src/utils/timescale-conversion.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"toTimescaleFromBase",function(){return F}),N.d(Y,"toTimescaleFromScale",function(){return D}),N.d(Y,"toMsFromMpegTsClock",function(){return G}),N.d(Y,"toMpegTsClockFromTimescale",function(){return B});var Q=9e4;function F(k,R,b,v){b===void 0&&(b=1),v===void 0&&(v=!1);var m=k*R*b;return v?Math.round(m):m}function D(k,R,b,v){return b===void 0&&(b=1),v===void 0&&(v=!1),F(k,R,1/b,v)}function G(k,R){return R===void 0&&(R=!1),F(k,1e3,1/Q,R)}function B(k,R){return R===void 0&&(R=1),F(k,Q,1/R)}},"./src/utils/typed-array.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"sliceUint8",function(){return Q});function Q(F,D,G){return Uint8Array.prototype.slice?F.slice(D,G):new Uint8Array(Array.prototype.slice.call(F,D,G))}},"./src/utils/vttcue.ts":function(ce,Y,N){"use strict";N.r(Y),Y.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Q=["","lr","rl"],F=["start","middle","end","left","right"];function D(b,v){if(typeof v!="string")return!1;if(!Array.isArray(b))return!1;var m=v.toLowerCase();return~b.indexOf(m)?m:!1}function G(b){return D(Q,b)}function B(b){return D(F,b)}function k(b){for(var v=arguments.length,m=new Array(v>1?v-1:0),u=1;u<v;u++)m[u-1]=arguments[u];for(var r=1;r<arguments.length;r++){var c=arguments[r];for(var s in c)b[s]=c[s]}return b}function R(b,v,m){var u=this,r={enumerable:!0};u.hasBeenReset=!1;var c="",s=!1,a=b,o=v,h=m,O=null,w="",x=!0,A="auto",S="start",y=50,_="middle",p=50,d="middle";Object.defineProperty(u,"id",k({},r,{get:function(){return c},set:function(l){c=""+l}})),Object.defineProperty(u,"pauseOnExit",k({},r,{get:function(){return s},set:function(l){s=!!l}})),Object.defineProperty(u,"startTime",k({},r,{get:function(){return a},set:function(l){if(typeof l!="number")throw new TypeError("Start time must be set to a number.");a=l,this.hasBeenReset=!0}})),Object.defineProperty(u,"endTime",k({},r,{get:function(){return o},set:function(l){if(typeof l!="number")throw new TypeError("End time must be set to a number.");o=l,this.hasBeenReset=!0}})),Object.defineProperty(u,"text",k({},r,{get:function(){return h},set:function(l){h=""+l,this.hasBeenReset=!0}})),Object.defineProperty(u,"region",k({},r,{get:function(){return O},set:function(l){O=l,this.hasBeenReset=!0}})),Object.defineProperty(u,"vertical",k({},r,{get:function(){return w},set:function(l){var E=G(l);if(E===!1)throw new SyntaxError("An invalid or illegal string was specified.");w=E,this.hasBeenReset=!0}})),Object.defineProperty(u,"snapToLines",k({},r,{get:function(){return x},set:function(l){x=!!l,this.hasBeenReset=!0}})),Object.defineProperty(u,"line",k({},r,{get:function(){return A},set:function(l){if(typeof l!="number"&&l!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");A=l,this.hasBeenReset=!0}})),Object.defineProperty(u,"lineAlign",k({},r,{get:function(){return S},set:function(l){var E=B(l);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");S=E,this.hasBeenReset=!0}})),Object.defineProperty(u,"position",k({},r,{get:function(){return y},set:function(l){if(l<0||l>100)throw new Error("Position must be between 0 and 100.");y=l,this.hasBeenReset=!0}})),Object.defineProperty(u,"positionAlign",k({},r,{get:function(){return _},set:function(l){var E=B(l);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");_=E,this.hasBeenReset=!0}})),Object.defineProperty(u,"size",k({},r,{get:function(){return p},set:function(l){if(l<0||l>100)throw new Error("Size must be between 0 and 100.");p=l,this.hasBeenReset=!0}})),Object.defineProperty(u,"align",k({},r,{get:function(){return d},set:function(l){var E=B(l);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");d=E,this.hasBeenReset=!0}})),u.displayState=void 0}return R.prototype.getCueAsHTML=function(){var b=self.WebVTT;return b.convertCueToDOMTree(self,this.text)},R}()},"./src/utils/vttparser.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"parseTimeStamp",function(){return D}),N.d(Y,"fixLineBreaks",function(){return v}),N.d(Y,"VTTParser",function(){return m});var Q=N("./src/utils/vttcue.ts"),F=function(){function u(){}var r=u.prototype;return r.decode=function(s,a){if(!s)return"";if(typeof s!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(s))},u}();function D(u){function r(s,a,o,h){return(s|0)*3600+(a|0)*60+(o|0)+parseFloat(h||0)}var c=u.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return c?parseFloat(c[2])>59?r(c[2],c[3],0,c[4]):r(c[1],c[2],c[3],c[4]):null}var G=function(){function u(){this.values=Object.create(null)}var r=u.prototype;return r.set=function(s,a){!this.get(s)&&a!==""&&(this.values[s]=a)},r.get=function(s,a,o){return o?this.has(s)?this.values[s]:a[o]:this.has(s)?this.values[s]:a},r.has=function(s){return s in this.values},r.alt=function(s,a,o){for(var h=0;h<o.length;++h)if(a===o[h]){this.set(s,a);break}},r.integer=function(s,a){/^-?\d+$/.test(a)&&this.set(s,parseInt(a,10))},r.percent=function(s,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var o=parseFloat(a);if(o>=0&&o<=100)return this.set(s,o),!0}return!1},u}();function B(u,r,c,s){var a=s?u.split(s):[u];for(var o in a){if(typeof a[o]!="string")continue;var h=a[o].split(c);if(h.length!==2)continue;var O=h[0],w=h[1];r(O,w)}}var k=new Q.default(0,0,""),R=k.align==="middle"?"middle":"center";function b(u,r,c){var s=u;function a(){var O=D(u);if(O===null)throw new Error("Malformed timestamp: "+s);return u=u.replace(/^[^\sa-zA-Z-]+/,""),O}function o(O,w){var x=new G;B(O,function(y,_){var p;switch(y){case"region":for(var d=c.length-1;d>=0;d--)if(c[d].id===_){x.set(y,c[d].region);break}break;case"vertical":x.alt(y,_,["rl","lr"]);break;case"line":p=_.split(","),x.integer(y,p[0]),x.percent(y,p[0])&&x.set("snapToLines",!1),x.alt(y,p[0],["auto"]),p.length===2&&x.alt("lineAlign",p[1],["start",R,"end"]);break;case"position":p=_.split(","),x.percent(y,p[0]),p.length===2&&x.alt("positionAlign",p[1],["start",R,"end","line-left","line-right","auto"]);break;case"size":x.percent(y,_);break;case"align":x.alt(y,_,["start",R,"end","left","right"]);break}},/:/,/\s/),w.region=x.get("region",null),w.vertical=x.get("vertical","");var A=x.get("line","auto");A==="auto"&&k.line===-1&&(A=-1),w.line=A,w.lineAlign=x.get("lineAlign","start"),w.snapToLines=x.get("snapToLines",!0),w.size=x.get("size",100),w.align=x.get("align",R);var S=x.get("position","auto");S==="auto"&&k.position===50&&(S=w.align==="start"||w.align==="left"?0:w.align==="end"||w.align==="right"?100:50),w.position=S}function h(){u=u.replace(/^\s+/,"")}if(h(),r.startTime=a(),h(),u.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+s);u=u.substr(3),h(),r.endTime=a(),h(),o(u,r)}function v(u){return u.replace(/<br(?: \/)?>/gi,`
|
|
`)}var m=function(){function u(){this.state="INITIAL",this.buffer="",this.decoder=new F,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var r=u.prototype;return r.parse=function(s){var a=this;s&&(a.buffer+=a.decoder.decode(s,{stream:!0}));function o(){var S=a.buffer,y=0;for(S=v(S);y<S.length&&S[y]!=="\r"&&S[y]!==`
|
|
`;)++y;var _=S.substr(0,y);return S[y]==="\r"&&++y,S[y]===`
|
|
`&&++y,a.buffer=S.substr(y),_}function h(S){B(S,function(y,_){},/:/)}try{var O="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;O=o();var w=O.match(/^()?WEBVTT([ \t].*)?$/);if(!w||!w[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var x=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;x?x=!1:O=o();switch(a.state){case"HEADER":/:/.test(O)?h(O):O||(a.state="ID");continue;case"NOTE":O||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(O)){a.state="NOTE";break}if(!O)continue;if(a.cue=new Q.default(0,0,""),a.state="CUE",O.indexOf("-->")===-1){a.cue.id=O;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{b(O,a.cue,a.regionList)}catch(S){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var A=O.indexOf("-->")!==-1;if(!O||A&&(x=!0)){a.oncue&&a.cue&&a.oncue(a.cue),a.cue=null,a.state="ID";continue}if(a.cue===null)continue;a.cue.text&&(a.cue.text+=`
|
|
`),a.cue.text+=O}continue;case"BADCUE":O||(a.state="ID")}}}catch(S){a.state==="CUETEXT"&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state=a.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},r.flush=function(){var s=this;try{if((s.cue||s.state==="HEADER")&&(s.buffer+=`
|
|
|
|
`,s.parse()),s.state==="INITIAL"||s.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(a){s.onparsingerror&&s.onparsingerror(a)}return s.onflush&&s.onflush(),this},u}()},"./src/utils/webvtt-parser.ts":function(ce,Y,N){"use strict";N.r(Y),N.d(Y,"generateCueId",function(){return m}),N.d(Y,"parseWebVTT",function(){return r});var Q=N("./src/polyfills/number.ts"),F=N("./src/utils/vttparser.ts"),D=N("./src/demux/id3.ts"),G=N("./src/utils/timescale-conversion.ts"),B=N("./src/remux/mp4-remuxer.ts"),k=/\r\n|\n\r|\n|\r/g,R=function(s,a,o){return o===void 0&&(o=0),s.substr(o,a.length)===a},b=function(s){var a=parseInt(s.substr(-3)),o=parseInt(s.substr(-6,2)),h=parseInt(s.substr(-9,2)),O=s.length>9?parseInt(s.substr(0,s.indexOf(":"))):0;if(!Object(Q.isFiniteNumber)(a)||!Object(Q.isFiniteNumber)(o)||!Object(Q.isFiniteNumber)(h)||!Object(Q.isFiniteNumber)(O))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+s);return a+=1e3*o,a+=60*1e3*h,a+=60*60*1e3*O,a},v=function(s){for(var a=5381,o=s.length;o;)a=a*33^s.charCodeAt(--o);return(a>>>0).toString()};function m(c,s,a){return v(c.toString())+v(s.toString())+v(a)}var u=function(s,a,o){var h=s[a],O=s[h.prevCC];if(!O||!O.new&&h.new){s.ccOffset=s.presentationOffset=h.start,h.new=!1;return}for(;(w=O)!==null&&w!==void 0&&w.new;){var w;s.ccOffset+=h.start-O.start,h.new=!1,h=O,O=s[h.prevCC]}s.presentationOffset=o};function r(c,s,a,o,h,O,w,x){var A=new F.VTTParser,S=Object(D.utf8ArrayToStr)(new Uint8Array(c)).trim().replace(k,`
|
|
`).split(`
|
|
`),y=[],_=Object(G.toMpegTsClockFromTimescale)(s,a),p="00:00.000",d=0,g=0,l,E=!0,U=!1;A.oncue=function(P){var j=o[h],H=o.ccOffset,I=(d-_)/9e4;if(j!=null&&j.new&&(g!==void 0?H=o.ccOffset=j.start:u(o,h,I)),I&&(H=I-o.presentationOffset),U){var T=P.endTime-P.startTime,K=Object(B.normalizePts)((P.startTime+H-g)*9e4,O*9e4)/9e4;P.startTime=K,P.endTime=K+T}var J=P.text.trim();P.text=decodeURIComponent(encodeURIComponent(J)),P.id||(P.id=m(P.startTime,P.endTime,J)),P.endTime>0&&y.push(P)},A.onparsingerror=function(P){l=P},A.onflush=function(){if(l){x(l);return}w(y)},S.forEach(function(P){if(E)if(R(P,"X-TIMESTAMP-MAP=")){E=!1,U=!0,P.substr(16).split(",").forEach(function(j){R(j,"LOCAL:")?p=j.substr(6):R(j,"MPEGTS:")&&(d=parseInt(j.substr(7)))});try{g=b(p)/1e3}catch(j){U=!1,l=j}return}else P===""&&(E=!1);A.parse(P+`
|
|
`)}),A.flush()}},"./src/utils/xhr-loader.ts":function(ce,Y,N){"use strict";N.r(Y);var Q=N("./src/utils/logger.ts"),F=N("./src/loader/load-stats.ts"),D=/^age:\s*[\d.]+\s*$/m,G=function(){function B(R){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=R?R.xhrSetup:null,this.stats=new F.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 b=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),b&&(b.onreadystatechange=null,b.onprogress=null,b.readyState!==4&&(this.stats.aborted=!0,b.abort()))},k.abort=function(){var b;this.abortInternal(),(b=this.callbacks)!==null&&b!==void 0&&b.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},k.load=function(b,v,m){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=b,this.config=v,this.callbacks=m,this.retryDelay=v.retryDelay,this.loadInternal()},k.loadInternal=function(){var b=this.config,v=this.context;if(!b)return;var m=this.loader=new self.XMLHttpRequest,u=this.stats;u.loading.first=0,u.loaded=0;var r=this.xhrSetup;try{if(r)try{r(m,v.url)}catch(a){m.open("GET",v.url,!0),r(m,v.url)}m.readyState||m.open("GET",v.url,!0);var c=this.context.headers;if(c)for(var s in c)m.setRequestHeader(s,c[s])}catch(a){this.callbacks.onError({code:m.status,text:a.message},v,m);return}v.rangeEnd&&m.setRequestHeader("Range","bytes="+v.rangeStart+"-"+(v.rangeEnd-1)),m.onreadystatechange=this.readystatechange.bind(this),m.onprogress=this.loadprogress.bind(this),m.responseType=v.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),b.timeout),m.send()},k.readystatechange=function(){var b=this.context,v=this.loader,m=this.stats;if(!b||!v)return;var u=v.readyState,r=this.config;if(m.aborted)return;if(u>=2)if(self.clearTimeout(this.requestTimeout),m.loading.first===0&&(m.loading.first=Math.max(self.performance.now(),m.loading.start)),u===4){v.onreadystatechange=null,v.onprogress=null;var c=v.status;if(c>=200&&c<300){m.loading.end=Math.max(self.performance.now(),m.loading.first);var s,a;if(b.responseType==="arraybuffer"?(s=v.response,a=s.byteLength):(s=v.responseText,a=s.length),m.loaded=m.total=a,!this.callbacks)return;var o=this.callbacks.onProgress;if(o&&o(m,b,s,v),!this.callbacks)return;var h={url:v.responseURL,data:s};this.callbacks.onSuccess(h,m,b,v)}else m.retry>=r.maxRetry||c>=400&&c<499?(Q.logger.error(c+" while loading "+b.url),this.callbacks.onError({code:c,text:v.statusText},b,v)):(Q.logger.warn(c+" while loading "+b.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,r.maxRetryDelay),m.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.timeout)},k.loadtimeout=function(){Q.logger.warn("timeout while loading "+this.context.url);var b=this.callbacks;b&&(this.abortInternal(),b.onTimeout(this.stats,this.context,this.loader))},k.loadprogress=function(b){var v=this.stats;v.loaded=b.loaded,b.lengthComputable&&(v.total=b.total)},k.getCacheAge=function(){var b=null;if(this.loader&&D.test(this.loader.getAllResponseHeaders())){var v=this.loader.getResponseHeader("age");b=v?parseFloat(v):null}return b},B}();Y.default=G}}).default})},vHTk:function(ut,Ke,$){ut.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wCXF:function(ut,Ke,$){"use strict";$.d(Ke,"a",function(){return ot});var ce=$("rePB"),Y=$("VTBJ"),N=$("KQm4"),Q=$("U8pU"),F=$("ODXe"),D=$("q1tI"),G=$("TSYQ"),B=$.n(G),k=$("Gytx"),R=$.n(k),b=$("Kwbf"),v=$("t23M"),m=$("qx4F"),u=$("6eGT"),r=$("IBYe"),c=$("Ff2n"),s=$("c+Xe"),a=$("fyJ8"),o=$("biw7");function h(Ie,Re,ze,Ve,De){var Me=ze[Ie]||{},be=ze[Re]||{},ve,ge;Me.fixed==="left"?ve=Ve.left[Ie]:be.fixed==="right"&&(ge=Ve.right[Re]);var le=!1,ue=!1,ye=!1,xe=!1,we=ze[Re+1],ke=ze[Ie-1];if(De==="rtl"){if(ve!==void 0){var We=ke&&ke.fixed==="left";xe=!We}else if(ge!==void 0){var Je=we&&we.fixed==="right";ye=!Je}}else if(ve!==void 0){var Qe=we&&we.fixed==="left";le=!Qe}else if(ge!==void 0){var Ze=ke&&ke.fixed==="right";ue=!Ze}return{fixLeft:ve,fixRight:ge,lastFixLeft:le,firstFixRight:ue,lastFixRight:ye,firstFixLeft:xe,isSticky:Ve.isSticky}}var O=$("sR1s");function w(Ie){var Re=Ie.cells,ze=Ie.stickyOffsets,Ve=Ie.flattenColumns,De=Ie.rowComponent,Me=Ie.cellComponent,be=Ie.onHeaderRow,ve=Ie.index,ge=D.useContext(o.a),le=ge.prefixCls,ue=ge.direction,ye;be&&(ye=be(Re.map(function(we){return we.column}),ve));var xe=Object(O.a)(Re.map(function(we){return we.column}));return D.createElement(De,Object.assign({},ye),Re.map(function(we,ke){var We=we.column,Je=h(we.colStart,we.colEnd,Ve,ze,ue),Qe;return We&&We.onHeaderCell&&(Qe=we.column.onHeaderCell(We)),D.createElement(a.a,Object.assign({},we,{ellipsis:We.ellipsis,align:We.align,component:Me,prefixCls:le,key:xe[ke]},Je,{additionalProps:Qe,rowType:"header"}))}))}w.displayName="HeaderRow";var x=w;function A(Ie){var Re=[];function ze(be,ve){var ge=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;Re[ge]=Re[ge]||[];var le=ve,ue=be.filter(Boolean).map(function(ye){var xe={key:ye.key,className:ye.className||"",children:ye.title,column:ye,colStart:le},we=1,ke=ye.children;return ke&&ke.length>0&&(we=ze(ke,le,ge+1).reduce(function(We,Je){return We+Je},0),xe.hasSubColumns=!0),"colSpan"in ye&&(we=ye.colSpan),"rowSpan"in ye&&(xe.rowSpan=ye.rowSpan),xe.colSpan=we,xe.colEnd=xe.colStart+we-1,Re[ge].push(xe),le+=we,we});return ue}ze(Ie,0);for(var Ve=Re.length,De=function(ve){Re[ve].forEach(function(ge){!("rowSpan"in ge)&&!ge.hasSubColumns&&(ge.rowSpan=Ve-ve)})},Me=0;Me<Ve;Me+=1)De(Me);return Re}function S(Ie){var Re=Ie.stickyOffsets,ze=Ie.columns,Ve=Ie.flattenColumns,De=Ie.onHeaderRow,Me=D.useContext(o.a),be=Me.prefixCls,ve=Me.getComponent,ge=D.useMemo(function(){return A(ze)},[ze]),le=ve(["header","wrapper"],"thead"),ue=ve(["header","row"],"tr"),ye=ve(["header","cell"],"th");return D.createElement(le,{className:"".concat(be,"-thead")},ge.map(function(xe,we){var ke=D.createElement(x,{key:we,flattenColumns:Ve,cells:xe,stickyOffsets:Re,rowComponent:ue,cellComponent:ye,onHeaderRow:De,index:we});return ke}))}var y=S,_=$("hW8S");function p(Ie){for(var Re=Ie.colWidths,ze=Ie.columns,Ve=Ie.columCount,De=[],Me=Ve||ze.length,be=!1,ve=Me-1;ve>=0;ve-=1){var ge=Re[ve],le=ze&&ze[ve],ue=le&&le[_.a];(ge||ue||be)&&(De.unshift(D.createElement("col",Object.assign({key:ve,style:{width:ge,minWidth:ge}},ue))),be=!0)}return D.createElement("colgroup",null,De)}var d=p;function g(Ie,Re){return Object(D.useMemo)(function(){for(var ze=[],Ve=0;Ve<Re;Ve+=1){var De=Ie[Ve];if(De!==void 0)ze[Ve]=De;else return null}return ze},[Ie.join("_"),Re])}var l=D.forwardRef(function(Ie,Re){var ze=Ie.noData,Ve=Ie.columns,De=Ie.flattenColumns,Me=Ie.colWidths,be=Ie.columCount,ve=Ie.stickyOffsets,ge=Ie.direction,le=Ie.fixHeader,ue=Ie.offsetHeader,ye=Ie.stickyClassName,xe=Ie.onScroll,we=Object(c.a)(Ie,["noData","columns","flattenColumns","colWidths","columCount","stickyOffsets","direction","fixHeader","offsetHeader","stickyClassName","onScroll"]),ke=D.useContext(o.a),We=ke.prefixCls,Je=ke.scrollbarSize,Qe=ke.isSticky,Ze=Qe&&!le?0:Je,bt=D.useRef(null),yt=D.useCallback(function(Lt){Object(s.b)(Re,Lt),Object(s.b)(bt,Lt)},[]);D.useEffect(function(){var Lt;function gt(je){var rt=je.currentTarget,it=je.deltaX;it&&(xe({currentTarget:rt,scrollLeft:rt.scrollLeft+it}),je.preventDefault())}return(Lt=bt.current)===null||Lt===void 0||Lt.addEventListener("wheel",gt),function(){var je;(je=bt.current)===null||je===void 0||je.removeEventListener("wheel",gt)}},[]);var lt=De[De.length-1],wt={fixed:lt?lt.fixed:null,onHeaderCell:function(){return{className:"".concat(We,"-cell-scrollbar")}}},xt=Object(D.useMemo)(function(){return Ze?[].concat(Object(N.a)(Ve),[wt]):Ve},[Ze,Ve]),Ct=Object(D.useMemo)(function(){return Ze?[].concat(Object(N.a)(De),[wt]):De},[Ze,De]),Mt=Object(D.useMemo)(function(){var Lt=ve.right,gt=ve.left;return Object(Y.a)(Object(Y.a)({},ve),{},{left:ge==="rtl"?[].concat(Object(N.a)(gt.map(function(je){return je+Ze})),[0]):gt,right:ge==="rtl"?Lt:[].concat(Object(N.a)(Lt.map(function(je){return je+Ze})),[0]),isSticky:Qe})},[Ze,ve,Qe]),Ot=g(Me,be);return D.createElement("div",{style:Object(Y.a)({overflow:"hidden"},Qe?{top:ue}:{}),ref:yt,className:B()("".concat(We,"-header"),Object(ce.a)({},ye,!!ye))},D.createElement("table",{style:{tableLayout:"fixed",visibility:ze||Ot?null:"hidden"}},D.createElement(d,{colWidths:Ot?[].concat(Object(N.a)(Ot),[Ze]):[],columCount:be+1,columns:Ct}),D.createElement(y,Object.assign({},we,{stickyOffsets:Mt,columns:xt,flattenColumns:Ct}))))});l.displayName="FixedHeader";var E=l,U=D.createContext(null),P=U;function j(Ie){var Re=Ie.prefixCls,ze=Ie.children,Ve=Ie.component,De=Ie.cellComponent,Me=Ie.fixHeader,be=Ie.fixColumn,ve=Ie.horizonScroll,ge=Ie.className,le=Ie.expanded,ue=Ie.componentWidth,ye=Ie.colSpan,xe=D.useContext(o.a),we=xe.scrollbarSize;return D.useMemo(function(){var ke=ze;return be&&(ke=D.createElement("div",{style:{width:ue-(Me?we:0),position:"sticky",left:0,overflow:"hidden"},className:"".concat(Re,"-expanded-row-fixed")},ke)),D.createElement(Ve,{className:ge,style:{display:le?null:"none"}},D.createElement(a.a,{component:De,prefixCls:Re,colSpan:ye},ke))},[ze,Ve,Me,ve,ge,le,ue,ye,we])}var H=j;function I(Ie){var Re=Ie.className,ze=Ie.style,Ve=Ie.record,De=Ie.index,Me=Ie.rowKey,be=Ie.getRowKey,ve=Ie.rowExpandable,ge=Ie.expandedKeys,le=Ie.onRow,ue=Ie.indent,ye=ue===void 0?0:ue,xe=Ie.rowComponent,we=Ie.cellComponent,ke=Ie.childrenColumnName,We=D.useContext(o.a),Je=We.prefixCls,Qe=We.fixedInfoList,Ze=D.useContext(P),bt=Ze.fixHeader,yt=Ze.fixColumn,lt=Ze.horizonScroll,wt=Ze.componentWidth,xt=Ze.flattenColumns,Ct=Ze.expandableType,Mt=Ze.expandRowByClick,Ot=Ze.onTriggerExpand,Lt=Ze.rowClassName,gt=Ze.expandedRowClassName,je=Ze.indentSize,rt=Ze.expandIcon,it=Ze.expandedRowRender,et=Ze.expandIconColumnIndex,Tt=D.useState(!1),kt=Object(F.a)(Tt,2),Dt=kt[0],vt=kt[1],dt=ge&&ge.has(Ie.recordKey);D.useEffect(function(){dt&&vt(!0)},[dt]);var Vt=Ct==="row"&&(!ve||ve(Ve)),sn=Ct==="nest",gn=ke&&Ve&&Ve[ke],Kt=Vt||sn,vn;le&&(vn=le(Ve,De));var Mn=function(C){if(Mt&&Kt&&Ot(Ve,C),vn&&vn.onClick){for(var L,W=arguments.length,te=new Array(W>1?W-1:0),X=1;X<W;X++)te[X-1]=arguments[X];(L=vn).onClick.apply(L,[C].concat(te))}},Wn;typeof Lt=="string"?Wn=Lt:typeof Lt=="function"&&(Wn=Lt(Ve,De,ye));var $e=Object(O.a)(xt),ct=D.createElement(xe,Object.assign({},vn,{"data-row-key":Me,className:B()(Re,"".concat(Je,"-row"),"".concat(Je,"-row-level-").concat(ye),Wn,vn&&vn.className),style:Object(Y.a)(Object(Y.a)({},ze),vn?vn.style:null),onClick:Mn}),xt.map(function(V,C){var L=V.render,W=V.dataIndex,te=V.className,X=$e[C],Oe=Qe[C],Ye;C===(et||0)&&sn&&(Ye=D.createElement(D.Fragment,null,D.createElement("span",{style:{paddingLeft:"".concat(je*ye,"px")},className:"".concat(Je,"-row-indent indent-level-").concat(ye)}),rt({prefixCls:Je,expanded:dt,expandable:gn,record:Ve,onExpand:Ot})));var ft;return V.onCell&&(ft=V.onCell(Ve,De)),D.createElement(a.a,Object.assign({className:te,ellipsis:V.ellipsis,align:V.align,component:we,prefixCls:Je,key:X,record:Ve,index:De,dataIndex:W,render:L,shouldCellUpdate:V.shouldCellUpdate},Oe,{appendNode:Ye,additionalProps:ft}))})),Jt;if(Vt&&(Dt||dt)){var hn=it(Ve,De,ye+1,dt),_n=gt&>(Ve,De,ye);Jt=D.createElement(H,{expanded:dt,className:B()("".concat(Je,"-expanded-row"),"".concat(Je,"-expanded-row-level-").concat(ye+1),_n),prefixCls:Je,fixHeader:bt,fixColumn:yt,horizonScroll:lt,component:xe,componentWidth:wt,cellComponent:we,colSpan:xt.length},hn)}var cn;return gn&&dt&&(cn=(Ve[ke]||[]).map(function(V,C){var L=be(V,C);return D.createElement(I,Object.assign({},Ie,{key:L,rowKey:L,record:V,recordKey:L,index:C,indent:ye+1}))})),D.createElement(D.Fragment,null,ct,Jt,cn)}I.displayName="BodyRow";var T=I,K=D.createContext(null),J=K;function ie(Ie){var Re=Ie.columnKey,ze=Ie.onColumnResize,Ve=D.useRef();return D.useEffect(function(){Ve.current&&ze(Re,Ve.current.offsetWidth)},[]),D.createElement(v.a,{onResize:function(Me){var be=Me.offsetWidth;ze(Re,be)}},D.createElement("td",{ref:Ve,style:{padding:0,border:0,height:0}},D.createElement("div",{style:{height:0,overflow:"hidden"}},"\xA0")))}function pe(Ie){var Re=Ie.data,ze=Ie.getRowKey,Ve=Ie.measureColumnWidth,De=Ie.expandedKeys,Me=Ie.onRow,be=Ie.rowExpandable,ve=Ie.emptyNode,ge=Ie.childrenColumnName,le=D.useContext(J),ue=le.onColumnResize,ye=D.useContext(o.a),xe=ye.prefixCls,we=ye.getComponent,ke=D.useContext(P),We=ke.fixHeader,Je=ke.horizonScroll,Qe=ke.flattenColumns,Ze=ke.componentWidth;return D.useMemo(function(){var bt=we(["body","wrapper"],"tbody"),yt=we(["body","row"],"tr"),lt=we(["body","cell"],"td"),wt;Re.length?wt=Re.map(function(Ct,Mt){var Ot=ze(Ct,Mt);return D.createElement(T,{key:Ot,rowKey:Ot,record:Ct,recordKey:Ot,index:Mt,rowComponent:yt,cellComponent:lt,expandedKeys:De,onRow:Me,getRowKey:ze,rowExpandable:be,childrenColumnName:ge})}):wt=D.createElement(H,{expanded:!0,className:"".concat(xe,"-placeholder"),prefixCls:xe,fixHeader:We,fixColumn:Je,horizonScroll:Je,component:yt,componentWidth:Ze,cellComponent:lt,colSpan:Qe.length},ve);var xt=Object(O.a)(Qe);return D.createElement(bt,{className:"".concat(xe,"-tbody")},Ve&&D.createElement("tr",{"aria-hidden":"true",className:"".concat(xe,"-measure-row"),style:{height:0}},xt.map(function(Ct){return D.createElement(ie,{key:Ct,columnKey:Ct,onColumnResize:ue})})),wt)},[Re,xe,Me,Ve,De,ze,we,Ze,ve,Qe])}var _e=D.memo(pe);_e.displayName="Body";var Te=_e,he=$("wRmb"),re=$("xEkU"),fe=$.n(re);function ae(Ie){var Re=Object(D.useRef)(Ie),ze=Object(D.useState)({}),Ve=Object(F.a)(ze,2),De=Ve[1],Me=Object(D.useRef)(null),be=Object(D.useRef)([]);function ve(ge){Me.current===null&&(be.current=[],Me.current=fe()(function(){be.current.forEach(function(le){Re.current=le(Re.current)}),Me.current=null,De({})})),be.current.push(ge)}return Object(D.useEffect)(function(){return function(){fe.a.cancel(Me.current)}},[]),[Re.current,ve]}function oe(Ie){var Re=Object(D.useRef)(Ie),ze=Object(D.useRef)(null);function Ve(){window.clearTimeout(ze.current)}function De(be){Re.current=be,Ve(),ze.current=window.setTimeout(function(){Re.current=null,ze.current=null},100)}function Me(){return Re.current}return Object(D.useEffect)(function(){return Ve},[]),[De,Me]}function Z(Ie,Re,ze){var Ve=Object(D.useMemo)(function(){for(var De=[],Me=[],be=0,ve=0,ge=0;ge<Re;ge+=1)if(ze==="rtl"){Me[ge]=ve,ve+=Ie[ge]||0;var le=Re-ge-1;De[le]=be,be+=Ie[le]||0}else{De[ge]=be,be+=Ie[ge]||0;var ue=Re-ge-1;Me[ue]=ve,ve+=Ie[ue]||0}return{left:De,right:Me}},[Ie,Re,ze]);return Ve}var ne=Z;function se(Ie){var Re=Ie.className,ze=Ie.children;return D.createElement("div",{className:Re},ze)}var me=se,Se=$("n6Qo");function Ee(Ie){var Re,ze=Ie.prefixCls,Ve=Ie.record,De=Ie.onExpand,Me=Ie.expanded,be=Ie.expandable,ve="".concat(ze,"-row-expand-icon");if(!be)return D.createElement("span",{className:B()(ve,"".concat(ze,"-row-spaced"))});var ge=function(ue){De(Ve,ue),ue.stopPropagation()};return D.createElement("span",{className:B()(ve,(Re={},Object(ce.a)(Re,"".concat(ze,"-row-expanded"),Me),Object(ce.a)(Re,"".concat(ze,"-row-collapsed"),!Me),Re)),onClick:ge})}function Le(Ie,Re,ze){var Ve=[];function De(Me){(Me||[]).forEach(function(be,ve){Ve.push(Re(be,ve)),De(be[ze])})}return De(Ie),Ve}var Pe=$("zT1h"),Be=$("y0+3"),He=function(Re,ze){var Ve,De,Me=Re.scrollBodyRef,be=Re.onScroll,ve=Re.offsetScroll,ge=D.useContext(o.a),le=ge.prefixCls,ue=((Ve=Me.current)===null||Ve===void 0?void 0:Ve.scrollWidth)||0,ye=((De=Me.current)===null||De===void 0?void 0:De.clientWidth)||0,xe=ue&&ye*(ye/ue),we=D.useRef(),ke=ae({scrollLeft:0,isHiddenScrollBar:!1}),We=Object(F.a)(ke,2),Je=We[0],Qe=We[1],Ze=D.useRef({delta:0,x:0}),bt=D.useState(!1),yt=Object(F.a)(bt,2),lt=yt[0],wt=yt[1],xt=function(){wt(!1)},Ct=function(je){je.persist(),Ze.current.delta=je.pageX-Je.scrollLeft,Ze.current.x=0,wt(!0),je.preventDefault()},Mt=function(je){var rt,it=je||((rt=window)===null||rt===void 0?void 0:rt.event),et=it.buttons;if(!lt||et===0){lt&&wt(!1);return}var Tt=Ze.current.x+je.pageX-Ze.current.x-Ze.current.delta;Tt<=0&&(Tt=0),Tt+xe>=ye&&(Tt=ye-xe),be({scrollLeft:Tt/ye*(ue+2)}),Ze.current.x=je.pageX},Ot=function(){var je=Object(Be.b)(Me.current).top,rt=je+Me.current.offsetHeight,it=document.documentElement.scrollTop+window.innerHeight;rt-Object(m.a)()<=it||je>=it-ve?Qe(function(et){return Object(Y.a)(Object(Y.a)({},et),{},{isHiddenScrollBar:!0})}):Qe(function(et){return Object(Y.a)(Object(Y.a)({},et),{},{isHiddenScrollBar:!1})})},Lt=function(je){Qe(function(rt){return Object(Y.a)(Object(Y.a)({},rt),{},{scrollLeft:je/ue*ye||0})})};return D.useImperativeHandle(ze,function(){return{setScrollLeft:Lt}}),D.useEffect(function(){var gt=Object(Pe.a)(document.body,"mouseup",xt,!1),je=Object(Pe.a)(document.body,"mousemove",Mt,!1);return Ot(),function(){gt.remove(),je.remove()}},[xe,lt]),D.useEffect(function(){var gt=Object(Pe.a)(window,"scroll",Ot,!1),je=Object(Pe.a)(window,"resize",Ot,!1);return function(){gt.remove(),je.remove()}},[]),D.useEffect(function(){Je.isHiddenScrollBar||Qe(function(gt){var je,rt;return Object(Y.a)(Object(Y.a)({},gt),{},{scrollLeft:Me.current.scrollLeft/((je=Me.current)===null||je===void 0?void 0:je.scrollWidth)*((rt=Me.current)===null||rt===void 0?void 0:rt.clientWidth)})})},[Je.isHiddenScrollBar]),ue<=ye||!xe||Je.isHiddenScrollBar?null:D.createElement("div",{style:{height:Object(m.a)(),width:ye,bottom:ve},className:"".concat(le,"-sticky-scroll")},D.createElement("div",{onMouseDown:Ct,ref:we,className:B()("".concat(le,"-sticky-scroll-bar"),Object(ce.a)({},"".concat(le,"-sticky-scroll-bar-active"),lt)),style:{width:"".concat(xe,"px"),transform:"translate3d(".concat(Je.scrollLeft,"px, 0, 0)")}}))},Ge=D.forwardRef(He);function Ue(Ie,Re){return D.useMemo(function(){var ze=!!Ie;return{isSticky:ze,stickyClassName:ze?"".concat(Re,"-sticky-header"):"",offsetHeader:Object(Q.a)(Ie)==="object"&&Ie.offsetHeader||0,offsetScroll:Object(Q.a)(Ie)==="object"&&Ie.offsetScroll||0}},[Ie,Re])}var tt=[],nt={},ot="rc-table-internal-hook",st=D.memo(function(Ie){var Re=Ie.children;return Re},function(Ie,Re){return R()(Ie.props,Re.props)?Ie.pingLeft!==Re.pingLeft||Ie.pingRight!==Re.pingRight:!1});function mt(Ie){var Re,ze=Ie.prefixCls,Ve=Ie.className,De=Ie.rowClassName,Me=Ie.style,be=Ie.data,ve=Ie.rowKey,ge=Ie.scroll,le=Ie.tableLayout,ue=Ie.direction,ye=Ie.title,xe=Ie.footer,we=Ie.summary,ke=Ie.id,We=Ie.showHeader,Je=Ie.components,Qe=Ie.emptyText,Ze=Ie.onRow,bt=Ie.onHeaderRow,yt=Ie.internalHooks,lt=Ie.transformColumns,wt=Ie.internalRefs,xt=Ie.sticky,Ct=be||tt,Mt=!!Ct.length,Ot=D.useState(0),Lt=Object(F.a)(Ot,2),gt=Lt[0],je=Lt[1];D.useEffect(function(){je(Object(m.a)())});var rt=D.useMemo(function(){return Object(O.c)(Je,{})},[Je]),it=D.useCallback(function(mn,un){return Object(O.b)(rt,mn)||un},[rt]),et=D.useMemo(function(){return typeof ve=="function"?ve:function(mn){var un=mn&&mn[ve];return un}},[ve]),Tt=Object(_.c)(Ie),kt=Tt.expandIcon,Dt=Tt.expandedRowKeys,vt=Tt.defaultExpandedRowKeys,dt=Tt.defaultExpandAllRows,Vt=Tt.expandedRowRender,sn=Tt.onExpand,gn=Tt.onExpandedRowsChange,Kt=Tt.expandRowByClick,vn=Tt.rowExpandable,Mn=Tt.expandIconColumnIndex,Wn=Tt.expandedRowClassName,$e=Tt.childrenColumnName,ct=Tt.indentSize,Jt=kt||Ee,hn=$e||"children",_n=D.useMemo(function(){return Vt?"row":Ie.expandable&&yt===ot&&Ie.expandable.__PARENT_RENDER_ICON__||Ct.some(function(mn){return mn&&Object(Q.a)(mn)==="object"&&mn[hn]})?"nest":!1},[!!Vt,Ct]),cn=D.useState(function(){return vt||(dt?Le(Ct,et,hn):[])}),V=Object(F.a)(cn,2),C=V[0],L=V[1],W=D.useMemo(function(){return new Set(Dt||C||[])},[Dt,C]),te=D.useCallback(function(mn){var un=et(mn,Ct.indexOf(mn)),dn,fi=W.has(un);fi?(W.delete(un),dn=Object(N.a)(W)):dn=[].concat(Object(N.a)(W),[un]),L(dn),sn&&sn(!fi,mn),gn&&gn(dn)},[et,W,Ct,sn,gn]),X=D.useState(0),Oe=Object(F.a)(X,2),Ye=Oe[0],ft=Oe[1],At=Object(he.b)(Object(Y.a)(Object(Y.a)(Object(Y.a)({},Ie),Tt),{},{expandable:!!Vt,expandedKeys:W,getRowKey:et,onTriggerExpand:te,expandIcon:Jt,expandIconColumnIndex:Mn,direction:ue}),yt===ot?lt:null),qe=Object(F.a)(At,2),Pt=qe[0],Ft=qe[1],fn=D.useMemo(function(){return{columns:Pt,flattenColumns:Ft}},[Pt,Ft]),Nn=D.useRef(),In=D.useRef(),Tn=D.useRef(),ei=D.useState(!1),_i=Object(F.a)(ei,2),Ht=_i[0],Bt=_i[1],Gt=D.useState(!1),Yt=Object(F.a)(Gt,2),Qt=Yt[0],tn=Yt[1],bn=ae(new Map),Dn=Object(F.a)(bn,2),Un=Dn[0],Sn=Dn[1],Fn=Object(O.a)(Ft),ti=Fn.map(function(mn){return Un.get(mn)}),Ei=D.useMemo(function(){return ti},[ti.join("_")]),ni=ne(Ei,Ft.length,ue),ln=ge&&Object(O.d)(ge.y),zt=ge&&Object(O.d)(ge.x),wn=zt&&Ft.some(function(mn){var un=mn.fixed;return un}),Xt=D.useRef(),nn=Ue(xt,ze),rn=nn.isSticky,ii=nn.offsetHeader,kn=nn.offsetScroll,en=nn.stickyClassName,xi,Qn,Ii;ln&&(Qn={overflowY:"scroll",maxHeight:ge.y}),zt&&(xi={overflowX:"auto"},ln||(Qn={overflowY:"hidden"}),Ii={width:ge.x===!0?"auto":ge.x,minWidth:"100%"});var wi=D.useCallback(function(mn,un){Sn(function(dn){var fi=new Map(dn);return fi.set(mn,un),fi})},[]),Ti=oe(null),Mi=Object(F.a)(Ti,2),gi=Mi[0],Ni=Mi[1];function Ui(mn,un){if(!un)return;typeof un=="function"?un(mn):un.scrollLeft!==mn&&(un.scrollLeft=mn)}var ci=function(un){var dn=un.currentTarget,fi=un.scrollLeft,Fi=typeof fi=="number"?fi:dn.scrollLeft,Bi=dn||nt;if(!Ni()||Ni()===Bi){var xr;gi(Bi),Ui(Fi,In.current),Ui(Fi,Tn.current),Ui(Fi,(xr=Xt.current)===null||xr===void 0?void 0:xr.setScrollLeft)}if(dn){var Vr=dn.scrollWidth,ga=dn.clientWidth;Bt(Fi>0),tn(Fi<Vr-ga)}},Yi=function(){Tn.current&&ci({currentTarget:Tn.current})},It=function(un){var dn=un.width;Yi(),ft(Nn.current?Nn.current.offsetWidth:dn)};D.useEffect(function(){return Yi},[]),D.useEffect(function(){zt&&Yi()},[zt]),D.useEffect(function(){yt===ot&&wt&&(wt.body.current=Tn.current)});var Wt=it(["table"],"table"),Nt=D.useMemo(function(){return le||(wn?ge.x==="max-content"?"auto":"fixed":ln||Ft.some(function(mn){var un=mn.ellipsis;return un})?"fixed":"auto")},[ln,wn,Ft,le]),$t,on={colWidths:Ei,columCount:Ft.length,stickyOffsets:ni,onHeaderRow:bt,fixHeader:ln},En=D.useMemo(function(){return Mt?null:typeof Qe=="function"?Qe():Qe},[Mt,Qe]),an=D.createElement(Te,{data:Ct,measureColumnWidth:ln||zt||rn,expandedKeys:W,rowExpandable:vn,getRowKey:et,onRow:Ze,emptyNode:En,childrenColumnName:hn}),Rn=D.createElement(d,{colWidths:Ft.map(function(mn){var un=mn.width;return un}),columns:Ft}),$n=we&&D.createElement(Se.b,null,we(Ct)),Zt=it(["body"]);if(ln||rn){var vi;typeof Zt=="function"?(vi=Zt(Ct,{scrollbarSize:gt,ref:Tn,onScroll:ci}),on.colWidths=Ft.map(function(mn,un){var dn=mn.width,fi=un===Pt.length-1?dn-gt:dn;return typeof fi=="number"&&!Number.isNaN(fi)?fi:(Object(b.a)(!1,"When use `components.body` with render props. Each column should have a fixed value."),0)})):vi=D.createElement("div",{style:Object(Y.a)(Object(Y.a)({},xi),Qn),onScroll:ci,ref:Tn,className:B()("".concat(ze,"-body"))},D.createElement(Wt,{style:Object(Y.a)(Object(Y.a)({},Ii),{},{tableLayout:Nt})},Rn,an,$n),rn&&D.createElement(Ge,{ref:Xt,offsetScroll:kn,scrollBodyRef:Tn,onScroll:ci})),$t=D.createElement(D.Fragment,null,We!==!1&&D.createElement(E,Object.assign({noData:!Ct.length},on,fn,{direction:ue,offsetHeader:ii,stickyClassName:en,ref:In,onScroll:ci})),vi)}else $t=D.createElement("div",{style:Object(Y.a)(Object(Y.a)({},xi),Qn),className:B()("".concat(ze,"-content")),onScroll:ci,ref:Tn},D.createElement(Wt,{style:Object(Y.a)(Object(Y.a)({},Ii),{},{tableLayout:Nt})},Rn,We!==!1&&D.createElement(y,Object.assign({},on,fn)),an,$n));var pn=Object(_.b)(Ie),Kn=D.createElement("div",Object.assign({className:B()(ze,Ve,(Re={},Object(ce.a)(Re,"".concat(ze,"-rtl"),ue==="rtl"),Object(ce.a)(Re,"".concat(ze,"-ping-left"),Ht),Object(ce.a)(Re,"".concat(ze,"-ping-right"),Qt),Object(ce.a)(Re,"".concat(ze,"-layout-fixed"),le==="fixed"),Object(ce.a)(Re,"".concat(ze,"-fixed-header"),ln),Object(ce.a)(Re,"".concat(ze,"-fixed-column"),wn),Object(ce.a)(Re,"".concat(ze,"-scroll-horizontal"),zt),Object(ce.a)(Re,"".concat(ze,"-has-fix-left"),Ft[0]&&Ft[0].fixed),Object(ce.a)(Re,"".concat(ze,"-has-fix-right"),Ft[Ft.length-1]&&Ft[Ft.length-1].fixed==="right"),Re)),style:Me,id:ke,ref:Nn},pn),D.createElement(st,{pingLeft:Ht,pingRight:Qt,props:Object(Y.a)(Object(Y.a)({},Ie),{},{stickyOffsets:ni,mergedExpandedKeys:W})},ye&&D.createElement(me,{className:"".concat(ze,"-title")},ye(Ct)),D.createElement("div",{className:"".concat(ze,"-container")},$t),xe&&D.createElement(me,{className:"".concat(ze,"-footer")},xe(Ct))));zt&&(Kn=D.createElement(v.a,{onResize:It},Kn));var Gn=D.useMemo(function(){return{prefixCls:ze,getComponent:it,scrollbarSize:gt,direction:ue,fixedInfoList:Ft.map(function(mn,un){return h(un,un,Ft,ni,ue)}),isSticky:rn}},[ze,it,gt,ue,Ft,ni,ue,rn]),hi=D.useMemo(function(){return Object(Y.a)(Object(Y.a)({},fn),{},{tableLayout:Nt,rowClassName:De,expandedRowClassName:Wn,componentWidth:Ye,fixHeader:ln,fixColumn:wn,horizonScroll:zt,expandIcon:Jt,expandableType:_n,expandRowByClick:Kt,expandedRowRender:Vt,onTriggerExpand:te,expandIconColumnIndex:Mn,indentSize:ct})},[fn,Nt,De,Wn,Ye,ln,wn,zt,Jt,_n,Kt,Vt,te,Mn,ct]),ma=D.useMemo(function(){return{onColumnResize:wi}},[wi]);return D.createElement(o.a.Provider,{value:Gn},D.createElement(P.Provider,{value:hi},D.createElement(J.Provider,{value:ma},Kn)))}mt.Column=r.a,mt.ColumnGroup=u.a,mt.Summary=Se.a,mt.defaultProps={rowKey:"key",prefixCls:"rc-table",emptyText:function(){return"No Data"}};var ht=Ke.b=mt},wRmb:function(ut,Ke,$){"use strict";$.d(Ke,"a",function(){return R});var ce=$("rePB"),Y=$("KQm4"),N=$("VTBJ"),Q=$("Ff2n"),F=$("q1tI"),D=$.n(F),G=$("Kwbf"),B=$("Zm9Q"),k=$("hW8S");function R(r){return Object(B.a)(r).filter(function(c){return F.isValidElement(c)}).map(function(c){var s=c.key,a=c.props,o=a.children,h=Object(Q.a)(a,["children"]),O=Object(N.a)({key:s},h);return o&&(O.children=R(o)),O})}function b(r){return r.reduce(function(c,s){var a=s.fixed,o=a===!0?"left":a,h=s.children;return h&&h.length>0?[].concat(Object(Y.a)(c),Object(Y.a)(b(h).map(function(O){return Object(N.a)({fixed:o},O)}))):[].concat(Object(Y.a)(c),[Object(N.a)(Object(N.a)({},s),{},{fixed:o})])},[])}function v(r){for(var c=!0,s=0;s<r.length;s+=1){var a=r[s];if(c&&a.fixed!=="left")c=!1;else if(!c&&a.fixed==="left"){Object(G.a)(!1,"Index ".concat(s-1," of `columns` missing `fixed='left'` prop."));break}}for(var o=!0,h=r.length-1;h>=0;h-=1){var O=r[h];if(o&&O.fixed!=="right")o=!1;else if(!o&&O.fixed==="right"){Object(G.a)(!1,"Index ".concat(h+1," of `columns` missing `fixed='right'` prop."));break}}}function m(r){return r.map(function(c){var s=c.fixed,a=Object(Q.a)(c,["fixed"]),o=s;return s==="left"?o="right":s==="right"&&(o="left"),Object(N.a)({fixed:o},a)})}function u(r,c){var s=r.prefixCls,a=r.columns,o=r.children,h=r.expandable,O=r.expandedKeys,w=r.getRowKey,x=r.onTriggerExpand,A=r.expandIcon,S=r.rowExpandable,y=r.expandIconColumnIndex,_=r.direction,p=r.expandRowByClick,d=F.useMemo(function(){return a||R(o)},[a,o]),g=F.useMemo(function(){if(h){var U,P=y||0,j=d[P],H=(U={},Object(ce.a)(U,k.a,{className:"".concat(s,"-expand-icon-col")}),Object(ce.a)(U,"title",""),Object(ce.a)(U,"fixed",j?j.fixed:null),Object(ce.a)(U,"className","".concat(s,"-row-expand-icon-cell")),Object(ce.a)(U,"render",function(K,J,ie){var pe=w(J,ie),_e=O.has(pe),Te=S?S(J):!0,he=A({prefixCls:s,expanded:_e,expandable:Te,record:J,onExpand:x});return p?F.createElement("span",{onClick:function(fe){return fe.stopPropagation()}},he):he}),U),I=d.slice();return P>=0&&I.splice(P,0,H),I}return d},[h,d,w,O,A,_]),l=F.useMemo(function(){var U=g;return c&&(U=c(U)),U.length||(U=[{render:function(){return null}}]),U},[c,g,_]),E=F.useMemo(function(){return _==="rtl"?m(b(l)):b(l)},[l,_]);return[l,E]}Ke.b=u},"y0+3":function(ut,Ke,$){"use strict";$.d(Ke,"a",function(){return b}),$.d(Ke,"b",function(){return m});var ce=/margin|padding|width|height|max|min|offset/,Y={left:!0,top:!0},N={cssFloat:1,styleFloat:1,float:1};function Q(u){return u.nodeType===1?u.ownerDocument.defaultView.getComputedStyle(u,null):{}}function F(u,r,c){if(r=r.toLowerCase(),c==="auto"){if(r==="height")return u.offsetHeight;if(r==="width")return u.offsetWidth}return r in Y||(Y[r]=ce.test(r)),Y[r]?parseFloat(c)||0:c}function D(u,r){var c=arguments.length,s=Q(u);return r=N[r]?"cssFloat"in u.style?"cssFloat":"styleFloat":r,c===1?s:F(u,r,s[r]||u.style[r])}function G(u,r,c){var s=arguments.length;if(r=N[r]?"cssFloat"in u.style?"cssFloat":"styleFloat":r,s===3)return typeof c=="number"&&ce.test(r)&&(c="".concat(c,"px")),u.style[r]=c,c;for(var a in r)r.hasOwnProperty(a)&&G(u,a,r[a]);return Q(u)}function B(u){return u===document.body?document.documentElement.clientWidth:u.offsetWidth}function k(u){return u===document.body?window.innerHeight||document.documentElement.clientHeight:u.offsetHeight}function R(){var u=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),r=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);return{width:u,height:r}}function b(){var u=document.documentElement.clientWidth,r=window.innerHeight||document.documentElement.clientHeight;return{width:u,height:r}}function v(){return{scrollLeft:Math.max(document.documentElement.scrollLeft,document.body.scrollLeft),scrollTop:Math.max(document.documentElement.scrollTop,document.body.scrollTop)}}function m(u){var r=u.getBoundingClientRect(),c=document.documentElement;return{left:r.left+(window.pageXOffset||c.scrollLeft)-(c.clientLeft||document.body.clientLeft||0),top:r.top+(window.pageYOffset||c.scrollTop)-(c.clientTop||document.body.clientTop||0)}}},yFVG:function(ut,Ke,$){ut.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"}}}]);
|