You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
361 lines
983 KiB
361 lines
983 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[272,7,9,16],{"+NIl":function(Ot,ct,le){(function(de){de(le("VrN/"))})(function(de){"use strict";de.defineMode("stex",function(X,k){"use strict";function H(O,w){O.cmdState.push(w)}function C(O){return O.cmdState.length>0?O.cmdState[O.cmdState.length-1]:null}function M(O){var w=O.cmdState.pop();w&&w.closeBracket()}function W(O){for(var w=O.cmdState,g=w.length-1;g>=0;g--){var u=w[g];if(u.name=="DEFAULT")continue;return u}return{styleIdentifier:function(){return null}}}function B(O,w,g){return function(){this.name=O,this.bracketNo=0,this.style=w,this.styles=g,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var P={};P.importmodule=B("importmodule","tag",["string","builtin"]),P.documentclass=B("documentclass","tag",["","atom"]),P.usepackage=B("usepackage","tag",["atom"]),P.begin=B("begin","tag",["atom"]),P.end=B("end","tag",["atom"]),P.label=B("label","tag",["atom"]),P.ref=B("ref","tag",["atom"]),P.eqref=B("eqref","tag",["atom"]),P.cite=B("cite","tag",["atom"]),P.bibitem=B("bibitem","tag",["atom"]),P.Bibitem=B("Bibitem","tag",["atom"]),P.RBibitem=B("RBibitem","tag",["atom"]),P.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function R(O,w){O.f=w}function y(O,w){var g;if(O.match(/^\\[a-zA-Z@]+/)){var u=O.current().slice(1);return g=P.hasOwnProperty(u)?P[u]:P.DEFAULT,g=new g,H(w,g),R(w,_),g.style}if(O.match(/^\\[$&%#{}_]/))return"tag";if(O.match(/^\\[,;!\/\\]/))return"tag";if(O.match("\\["))return R(w,function(s,l){return T(s,l,"\\]")}),"keyword";if(O.match("\\("))return R(w,function(s,l){return T(s,l,"\\)")}),"keyword";if(O.match("$$"))return R(w,function(s,l){return T(s,l,"$$")}),"keyword";if(O.match("$"))return R(w,function(s,l){return T(s,l,"$")}),"keyword";var o=O.next();if(o=="%")return O.skipToEnd(),"comment";if(o=="}"||o=="]"){if(g=C(w),g)g.closeBracket(o),R(w,_);else return"error";return"bracket"}else return o=="{"||o=="["?(g=P.DEFAULT,g=new g,H(w,g),"bracket"):/\d/.test(o)?(O.eatWhile(/[\w.%]/),"atom"):(O.eatWhile(/[\w\-_]/),g=W(w),g.name=="begin"&&(g.argument=O.current()),g.styleIdentifier())}function T(O,w,g){if(O.eatSpace())return null;if(g&&O.match(g))return R(w,y),"keyword";if(O.match(/^\\[a-zA-Z@]+/))return"tag";if(O.match(/^[a-zA-Z]+/))return"variable-2";if(O.match(/^\\[$&%#{}_]/))return"tag";if(O.match(/^\\[,;!\/]/))return"tag";if(O.match(/^[\^_&]/))return"tag";if(O.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(O.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var u=O.next();return u=="{"||u=="}"||u=="["||u=="]"||u=="("||u==")"?"bracket":u=="%"?(O.skipToEnd(),"comment"):"error"}function _(O,w){var g=O.peek(),u;return g=="{"||g=="["?(u=C(w),u.openBracket(g),O.eat(g),R(w,y),"bracket"):/[ \t\r]/.test(g)?(O.eat(g),null):(R(w,y),M(w),y(O,w))}return{startState:function(){var O=k.inMathMode?function(w,g){return T(w,g)}:y;return{cmdState:[],f:O}},copyState:function(O){return{cmdState:O.cmdState.slice(),f:O.f}},token:function(O,w){return w.f(O,w)},blankLine:function(O){O.f=y,O.cmdState.length=0},lineComment:"%"}}),de.defineMIME("text/x-stex","stex"),de.defineMIME("text/x-latex","stex")})},"19Vz":function(Ot,ct,le){(function(de){de(le("VrN/"))})(function(de){de.defineOption("placeholder","",function(B,P,R){var y=R&&R!=de.Init;if(P&&!y)B.on("blur",C),B.on("change",M),B.on("swapDoc",M),de.on(B.getInputField(),"compositionupdate",B.state.placeholderCompose=function(){H(B)}),M(B);else if(!P&&y){B.off("blur",C),B.off("change",M),B.off("swapDoc",M),de.off(B.getInputField(),"compositionupdate",B.state.placeholderCompose),X(B);var T=B.getWrapperElement();T.className=T.className.replace(" CodeMirror-empty","")}P&&!B.hasFocus()&&C(B)});function X(B){B.state.placeholder&&(B.state.placeholder.parentNode.removeChild(B.state.placeholder),B.state.placeholder=null)}function k(B){X(B);var P=B.state.placeholder=document.createElement("pre");P.style.cssText="height: 0; overflow: visible",P.style.direction=B.getOption("direction"),P.className="CodeMirror-placeholder CodeMirror-line-like";var R=B.getOption("placeholder");typeof R=="string"&&(R=document.createTextNode(R)),P.appendChild(R),B.display.lineSpace.insertBefore(P,B.display.lineSpace.firstChild)}function H(B){setTimeout(function(){var P=!1,R=B.getInputField();R.nodeName=="TEXTAREA"?P=!R.value:B.lineCount()==1&&(P=!/[^\u200b]/.test(R.querySelector(".CodeMirror-line").textContent)),P?k(B):X(B)},20)}function C(B){W(B)&&k(B)}function M(B){var P=B.getWrapperElement(),R=W(B);P.className=P.className.replace(" CodeMirror-empty","")+(R?" CodeMirror-empty":""),R?k(B):X(B)}function W(B){return B.lineCount()===1&&B.getLine(0)===""}})},"1eCo":function(Ot,ct,le){(function(de){de(le("VrN/"))})(function(de){"use strict";var X={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},k={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};de.defineMode("xml",function(H,C){var M=H.indentUnit,W={},B=C.htmlMode?X:k;for(var P in B)W[P]=B[P];for(var P in C)W[P]=C[P];var R,y;function T(a,x){function m(z){return x.tokenize=z,z(a,x)}var S=a.next();if(S=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?m(w("atom","]]>")):null:a.match("--")?m(w("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),m(g(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),x.tokenize=w("meta","?>"),"meta"):(R=a.eat("/")?"closeTag":"openTag",x.tokenize=_,"tag bracket");if(S=="&"){var I;return a.eat("#")?a.eat("x")?I=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):I=a.eatWhile(/[\d]/)&&a.eat(";"):I=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),I?"atom":"error"}else return a.eatWhile(/[^&<]/),null}T.isInText=!0;function _(a,x){var m=a.next();if(m==">"||m=="/"&&a.eat(">"))return x.tokenize=T,R=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return R="equals",null;if(m=="<"){x.tokenize=T,x.state=l,x.tagName=x.tagStart=null;var S=x.tokenize(a,x);return S?S+" tag error":"tag error"}else return/[\'\"]/.test(m)?(x.tokenize=O(m),x.stringStartCol=a.column(),x.tokenize(a,x)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function O(a){var x=function(m,S){for(;!m.eol();)if(m.next()==a){S.tokenize=_;break}return"string"};return x.isInAttribute=!0,x}function w(a,x){return function(m,S){for(;!m.eol();){if(m.match(x)){S.tokenize=T;break}m.next()}return a}}function g(a){return function(x,m){for(var S;(S=x.next())!=null;){if(S=="<")return m.tokenize=g(a+1),m.tokenize(x,m);if(S==">")if(a==1){m.tokenize=T;break}else return m.tokenize=g(a-1),m.tokenize(x,m)}return"meta"}}function u(a,x,m){this.prev=a.context,this.tagName=x,this.indent=a.indented,this.startOfLine=m,(W.doNotIndent.hasOwnProperty(x)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function s(a,x){for(var m;;){if(!a.context)return;if(m=a.context.tagName,!W.contextGrabbers.hasOwnProperty(m)||!W.contextGrabbers[m].hasOwnProperty(x))return;o(a)}}function l(a,x,m){return a=="openTag"?(m.tagStart=x.column(),b):a=="closeTag"?p:l}function b(a,x,m){return a=="word"?(m.tagName=x.current(),y="tag",v):W.allowMissingTagName&&a=="endTag"?(y="tag bracket",v(a,x,m)):(y="error",b)}function p(a,x,m){if(a=="word"){var S=x.current();return m.context&&m.context.tagName!=S&&W.implicitlyClosed.hasOwnProperty(m.context.tagName)&&o(m),m.context&&m.context.tagName==S||W.matchClosing===!1?(y="tag",h):(y="tag error",L)}else return W.allowMissingTagName&&a=="endTag"?(y="tag bracket",h(a,x,m)):(y="error",L)}function h(a,x,m){return a!="endTag"?(y="error",h):(o(m),l)}function L(a,x,m){return y="error",h(a,x,m)}function v(a,x,m){if(a=="word")return y="attribute",c;if(a=="endTag"||a=="selfcloseTag"){var S=m.tagName,I=m.tagStart;return m.tagName=m.tagStart=null,a=="selfcloseTag"||W.autoSelfClosers.hasOwnProperty(S)?s(m,S):(s(m,S),m.context=new u(m,S,I==m.indented)),l}return y="error",v}function c(a,x,m){return a=="equals"?f:(W.allowMissing||(y="error"),v(a,x,m))}function f(a,x,m){return a=="string"?d:a=="word"&&W.allowUnquoted?(y="string",v):(y="error",v(a,x,m))}function d(a,x,m){return a=="string"?d:v(a,x,m)}return{startState:function(a){var x={tokenize:T,state:l,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(x.baseIndent=a),x},token:function(a,x){if(!x.tagName&&a.sol()&&(x.indented=a.indentation()),a.eatSpace())return null;R=null;var m=x.tokenize(a,x);return(m||R)&&m!="comment"&&(y=null,x.state=x.state(R||m,a,x),y&&(m=y=="error"?m+" error":y)),m},indent:function(a,x,m){var S=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+M;if(S&&S.noIndent)return de.Pass;if(a.tokenize!=_&&a.tokenize!=T)return m?m.match(/^(\s*)/)[0].length:0;if(a.tagName)return W.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+M*(W.multilineTagIndentFactor||1);if(W.alignCDATA&&/<!\[CDATA\[/.test(x))return 0;var I=x&&/^<(\/)?([\w_:\.-]*)/.exec(x);if(I&&I[1])for(;S;)if(S.tagName==I[2]){S=S.prev;break}else if(W.implicitlyClosed.hasOwnProperty(S.tagName))S=S.prev;else break;else if(I)for(;S;){var z=W.contextGrabbers[S.tagName];if(z&&z.hasOwnProperty(I[2]))S=S.prev;else break}for(;S&&S.prev&&!S.startOfLine;)S=S.prev;return S?S.indent+M:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:W.htmlMode?"html":"xml",helperType:W.htmlMode?"html":"xml",skipAttribute:function(a){a.state==f&&(a.state=v)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var x=[],m=a.context;m;m=m.prev)m.tagName&&x.push(m.tagName);return x.reverse()}}}),de.defineMIME("text/xml","xml"),de.defineMIME("application/xml","xml"),de.mimeModes.hasOwnProperty("text/html")||de.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"3TLj":function(Ot,ct,le){Ot.exports={flex_box_center:"flex_box_center____TbjK",flex_space_between:"flex_space_between___2coRZ",flex_box_vertical_center:"flex_box_vertical_center___3NVFE",flex_box_center_end:"flex_box_center_end___3GKhy",flex_box_column:"flex_box_column___2SLfn",bg:"bg___3oKWe",formWrap:"formWrap___2Y1wq"}},"5v/u":function(Ot,ct,le){"use strict";le.r(ct);var de=le("5NDa"),X=le("5rEg"),k=le("2qtc"),H=le("kLXV"),C=le("9og8"),M=le("k1fw"),W=le("y8nQ"),B=le("Vl3Y"),P=le("tJVT"),R=le("PpiC"),y=le("Znn+"),T=le("ZTPi"),_=le("WmNS"),O=le.n(_),w=le("q1tI"),g=le.n(w),u=le("9kvl"),o=le("Ot1p"),s=le("HBuW"),l=le("3TLj"),b=le.n(l),p=le("xKgJ"),h=le("UqFu"),L=le("9ZNV"),v=le("nuEh"),c=T.a.TabPane,f=function(a){var x,m,S=a.shixunsDetail,I=a.dispatch,z=a.match,Y=a.practiceSetting,ie=Object(R.a)(a,["shixunsDetail","dispatch","match","practiceSetting"]),G=B.a.useForm(),j=Object(P.a)(G,1),oe=j[0],ye=Object(w.useState)({}),Ce=Object(P.a)(ye,2),De=Ce[0],Ye=Ce[1],Ie=S.challengesNew,Ve=Object(w.useRef)(null),Ne=Y.selectQuestionParams,Ue=Y.id,Ae=Y.newQuestion,F=Object(w.useState)(!0),A=Object(P.a)(F,2),D=A[0],K=A[1];Object(w.useEffect)(function(){K(!0),I({type:"shixunsDetail/getChallengesNew",payload:Object(M.a)({},z.params)}),K(!1)},[z.params]);var J=function(){var Xe=Object(C.a)(O.a.mark(function Be(He){var ze,rt,it;return O.a.wrap(function(et){for(;;)switch(et.prev=et.next){case 0:return ze=Object(M.a)({},De),rt=!(!He.unity_3d_routes||He.unity_3d_routes==""),ze.identifier=z.params.id,ze.st=1,et.next=6,Object(s.b)(Object(M.a)(Object(M.a)({},ze),{},{unity_3d_routes:rt?He.unity_3d_routes:null,unity_3d:rt}));case 6:it=et.sent,it.status===1&&(u.d.replace("/shixuns/".concat(z.params.id,"/edit/").concat(it.challenge_id,"/editquestion?tab=2")),setTimeout(function(){I({type:"practiceSetting/setParams",payload:{newQuestion:null}}),I({type:"practiceSetting/setUpdateIndex"})},200));case 8:case"end":return et.stop()}},Be)}));return function(He){return Xe.apply(this,arguments)}}(),U=function(){je()},me=function(Be){clearTimeout(Ve.current),Ve.current=setTimeout(function(){"subject"in Be&&Ae&&I({type:"practiceSetting/setParams",payload:{newQuestion:{st:1,name:Be==null?void 0:Be.subject}}});var He=oe.getFieldsValue(),ze=He.subject,rt=He.task_pass;ze!==""||rt!==Object(h.a)(Ie.task_pass_default)?I({type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!0}}):I({type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!1}})},500)},Me=function(Be){Ye(Object(M.a)({},oe.getFieldsValue())),me(Be)},je=function(){var Be,He=function(){u.d.push("/shixuns/".concat(Ue,"/challenges")),I({type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!1}})};Y!=null&&(Be=Y.sideBar)!==null&&Be!==void 0&&Be.confirmLeave?H.a.confirm({title:"\u79BB\u5F00\u6B64\u9875\u63D0\u793A",content:"\u7CFB\u7EDF\u53EF\u80FD\u4E0D\u4F1A\u4FDD\u5B58\u60A8\u6240\u505A\u7684\u66F4\u6539\u3002",okText:"\u79BB\u5F00",cancelText:"\u53D6\u6D88",onOk:function(){He()}}):He()};return g.a.createElement("section",{className:b.a.bg},g.a.createElement(T.a,{activeKey:"1"},g.a.createElement(c,{tab:"\u672C\u5173\u4EFB\u52A1",key:"1"},g.a.createElement(B.a,{form:oe,className:b.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:Me,onFinish:J},g.a.createElement("div",{className:b.a.fieldWrap},g.a.createElement(B.a.Item,{initialValue:"",name:"subject",label:"\u4EFB\u52A1\u540D\u79F0:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EFB\u52A1\u540D\u79F0"}]},g.a.createElement(X.a,{bordered:!1,maxLength:60,suffix:"".concat(((x=De.subject)===null||x===void 0?void 0:x.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"}))),g.a.createElement("div",{className:b.a.mdWrap},g.a.createElement(B.a.Item,{name:"task_pass",label:"\u8FC7\u5173\u4EFB\u52A1:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u4E1A\u7684\u7B80\u4ECB"},{max:35e3,message:"\u6700\u5927\u9650\u523635000\u4E2A\u5B57\u7B26"}]},g.a.createElement(o.a,{watch:!0,defaultValue:Ie.task_pass_default}))),Object(p.o)()&&g.a.createElement("div",{className:b.a.fieldWrap},g.a.createElement(B.a.Item,{initialValue:"",name:"unity_3d_routes",label:"\u5D4C\u5165\u7B2C\u4E09\u65B9\u5E73\u53F0:"},g.a.createElement(X.a,{bordered:!1,maxLength:60,suffix:"".concat(((m=De.unity_3d_routes)===null||m===void 0?void 0:m.length)||0,"/60"),placeholder:"\u8BF7\u8F93\u5165\u7B2C\u4E09\u65B9\u5E73\u53F0\u5730\u5740"}))),g.a.createElement(B.a.Item,{noStyle:!0},g.a.createElement(L.a,{okButtonProps:{htmlType:"submit"},className:"customFixedButton",onCancel:U}))))),g.a.createElement(v.a,{loading:D}))};ct.default=Object(u.a)(function(d){var a=d.shixunsDetail,x=d.practiceSetting;return{shixunsDetail:a,practiceSetting:x}})(f)},"7Cbv":function(Ot,ct,le){"use strict";var de=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),X=new Uint8Array(16);function k(){if(!de)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return de(X)}var H=/^(?:[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 C(_){return typeof _=="string"&&H.test(_)}for(var M=C,W=[],B=0;B<256;++B)W.push((B+256).toString(16).substr(1));function P(_){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,w=(W[_[O+0]]+W[_[O+1]]+W[_[O+2]]+W[_[O+3]]+"-"+W[_[O+4]]+W[_[O+5]]+"-"+W[_[O+6]]+W[_[O+7]]+"-"+W[_[O+8]]+W[_[O+9]]+"-"+W[_[O+10]]+W[_[O+11]]+W[_[O+12]]+W[_[O+13]]+W[_[O+14]]+W[_[O+15]]).toLowerCase();if(!M(w))throw TypeError("Stringified UUID is invalid");return w}var R=P;function y(_,O,w){_=_||{};var g=_.random||(_.rng||k)();if(g[6]=g[6]&15|64,g[8]=g[8]&63|128,O){w=w||0;for(var u=0;u<16;++u)O[w+u]=g[u];return O}return R(g)}var T=ct.a=y},"7ahc":function(Ot,ct,le){"use strict";le.d(ct,"a",function(){return b});var de=le("k1fw"),X=le("0Owb"),k=le("+L6B"),H=le("2/Rp"),C=le("y8nQ"),M=le("Vl3Y"),W=le("tJVT"),B=le("OaEy"),P=le("2fM7"),R=le("q1tI"),y=le.n(R),T=le("VrN/"),_=le.n(T),O=le("p77/"),w=le.n(O),g=le("c5Ni"),u=le.n(g),o=P.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},l={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"]};ct.b=function(p){var h=p.callback,L=p.onCancel,v=Object(R.useState)("python"),c=Object(W.a)(v,2),f=c[0],d=c[1];function a(m){d(l[m][1])}function x(m){h(m)}return y.a.createElement(M.a,Object(X.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:x}),y.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},y.a.createElement(P.a,{onChange:a},Object.keys(l).map(function(m){return y.a.createElement(o,{key:m,value:m},l[m][0])}))),y.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},y.a.createElement(b,{mode:f})),y.a.createElement("div",{className:"flex-container flex-end"},y.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),y.a.createElement(H.a,{type:"ghost",onClick:L},"\u53D6\u6D88")))};function b(p){var h=p.value,L=p.onChange,v=p.mode,c=p.options,f=c===void 0?{}:c,d=Object(R.useRef)(),a=Object(R.useState)(),x=Object(W.a)(a,2),m=x[0],S=x[1];return Object(R.useEffect)(function(){if(m){function I(z){var Y=z.getValue();L&&L(Y)}return m.on("change",I),function(){m.off("change",I)}}},[m,L]),Object(R.useEffect)(function(){m&&m.setOption("mode",v)},[m,v]),Object(R.useEffect)(function(){m&&((h!==m.getValue()||h==="")&&setTimeout(function(){m.setValue(h||" ")},300))},[m,h]),Object(R.useEffect)(function(){if(d.current&&!m){var I=_.a.fromTextArea(d.current,Object(de.a)({mode:v,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},f));S(I)}},[d.current,m]),y.a.createElement("div",{className:"my-codemirror-container"},y.a.createElement("textarea",{ref:d}))}},"7ixt":function(Ot,ct,le){"use strict";le.d(ct,"a",function(){return k});var de={adjustX:1,adjustY:1},X=[0,0],k={left:{points:["cr","cl"],overflow:de,offset:[-4,0],targetOffset:X},right:{points:["cl","cr"],overflow:de,offset:[4,0],targetOffset:X},top:{points:["bc","tc"],overflow:de,offset:[0,-4],targetOffset:X},bottom:{points:["tc","bc"],overflow:de,offset:[0,4],targetOffset:X},topLeft:{points:["bl","tl"],overflow:de,offset:[0,-4],targetOffset:X},leftTop:{points:["tr","tl"],overflow:de,offset:[-4,0],targetOffset:X},topRight:{points:["br","tr"],overflow:de,offset:[0,-4],targetOffset:X},rightTop:{points:["tl","tr"],overflow:de,offset:[4,0],targetOffset:X},bottomRight:{points:["tr","br"],overflow:de,offset:[0,4],targetOffset:X},rightBottom:{points:["bl","br"],overflow:de,offset:[4,0],targetOffset:X},bottomLeft:{points:["tl","bl"],overflow:de,offset:[0,4],targetOffset:X},leftBottom:{points:["br","bl"],overflow:de,offset:[-4,0],targetOffset:X}},H=k},"8EBN":function(Ot,ct,le){(function(de){de(le("VrN/"))})(function(de){"use strict";de.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var X=0;X<de.modeInfo.length;X++){var k=de.modeInfo[X];k.mimes&&(k.mime=k.mimes[0])}de.findModeByMIME=function(H){H=H.toLowerCase();for(var C=0;C<de.modeInfo.length;C++){var M=de.modeInfo[C];if(M.mime==H)return M;if(M.mimes){for(var W=0;W<M.mimes.length;W++)if(M.mimes[W]==H)return M}}if(/\+xml$/.test(H))return de.findModeByMIME("application/xml");if(/\+json$/.test(H))return de.findModeByMIME("application/json")},de.findModeByExtension=function(H){H=H.toLowerCase();for(var C=0;C<de.modeInfo.length;C++){var M=de.modeInfo[C];if(M.ext){for(var W=0;W<M.ext.length;W++)if(M.ext[W]==H)return M}}},de.findModeByFileName=function(H){for(var C=0;C<de.modeInfo.length;C++){var M=de.modeInfo[C];if(M.file&&M.file.test(H))return M}var W=H.lastIndexOf("."),B=W>-1&&H.substring(W+1,H.length);if(B)return de.findModeByExtension(B)},de.findModeByName=function(H){H=H.toLowerCase();for(var C=0;C<de.modeInfo.length;C++){var M=de.modeInfo[C];if(M.name.toLowerCase()==H)return M;if(M.alias){for(var W=0;W<M.alias.length;W++)if(M.alias[W].toLowerCase()==H)return M}}}})},"8hTe":function(Ot,ct,le){Ot.exports={button:"button___1wy9m"}},"9Bee":function(Ot,ct,le){"use strict";var de=le("DYRE"),X=le("zeV3"),k=le("+L6B"),H=le("2/Rp"),C=le("k1fw"),M=le("9og8"),W=le("tJVT"),B=le("WmNS"),P=le.n(B),R=le("q1tI"),y=le.n(R),T=le("vg9a"),_=le("DlQD"),O=le.n(_),w=le("rUJ1");function g(se,Z){var Q=se.match(/^(\s+)(?:```)/);if(Q===null)return Z;var ae=Q[1];return Z.split(`
|
|
`).map(function(ue){var ee=ue.match(/^\s+/);if(ee===null)return ue;var ne=Object(W.a)(ee,1),he=ne[0];return he.length>=ae.length?ue.slice(ae.length):ue}).join(`
|
|
`)}var u=[],o=["<ul>"],s=new O.a.Renderer,l=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function b(){u.length=0,o=["<ul>"]}var p={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function h(se,Z,Q,ae){if(Z>=se.length||se[Z].level<=Q)return Z;var ue=se[Z];ae.push("<li><a href='#"+ue.anchor+"'>"+ue.text+"</a>"),Z++;var ee=[];return Z=h(se,Z,ue.level,ee),ee.length>0&&(ae.push("<ul>"),ee.forEach(function(ne){ae.push(ne)}),ae.push("</ul>")),ae.push("</li>"),Z=h(se,Z,Q,ae),Z}function L(){return h(u,0,0,o),o.push("</ul>"),o.join("")}var v={heading:function(Z){var Q=l.exec(Z);if(Q)return{type:"heading",raw:Q[0],depth:Q[1].length,text:Q[2]}},fences:function(Z){var Q=this.rules.block.fences.exec(Z);if(Q){var ae=Q[0],ue=g(ae,Q[3]||""),ee=Q[2]?Q[2].trim():Q[2];if(["latex","katex","math"].indexOf(ee)>=0){var ne=d(),he=ue;ue=ne,a[ne]={type:"block",expression:he}}return{type:"code",raw:ae,lang:ee,text:ue}}}},c=/(?:\${2})([^\n`]+?)(?:\${2})/gi,f=0,d=function(){return"__special_katext_id_".concat(f++,"__")},a={};function x(){return a}function m(){f=0,a={}}function S(se){return se=se.replace(c,function(Z,Q){var ae=d();return a[ae]={type:"inline",expression:Q},ae}),se}var I=s.listitem;s.listitem=function(se){return I(S(se))};var z=s.paragraph;s.paragraph=function(se){return z(S(se))};var Y=s.tablecell;s.tablecell=function(se,Z){return Y(S(se),Z)},s.code=function(se,Z,Q){var ae=(Z||"").match(/\S*/)[0];return ae?["latex","katex","math"].indexOf(ae)>=0?"<p class='editormd-tex'>".concat(se,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(Z,'">').concat(Q?se:Object(w.escape)(se,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(Q?se:Object(w.escape)(se,!0))+"</code></pre>"},s.heading=function(se,Z,Q){var ae=this.options.headerPrefix+Q.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return u.push({anchor:ae,level:Z,text:se}),"<h"+Z+' id="'+ae+'">'+se+"</h"+Z+">"},O.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),O.a.use({tokenizer:v,renderer:s});var ie=O.a,G=le("SJMd"),j=le("ulZh"),oe=le.n(j),ye=le("m3rI"),Ce=le("Oy/b"),De=le("p5ED"),Ye=le("ErOA"),Ie=le("STEk");/* **********************************
|
|
cropro version 1.2.0
|
|
@license SEE LICENSE IN LICENSE
|
|
|
|
copyright Alan Mendelevich
|
|
see README and LICENSE for details
|
|
********************************** *//*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var Ve=function(se,Z){return(Ve=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(Q,ae){Q.__proto__=ae}||function(Q,ae){for(var ue in ae)Object.prototype.hasOwnProperty.call(ae,ue)&&(Q[ue]=ae[ue])})(se,Z)};function Ne(se,Z){if(typeof Z!="function"&&Z!==null)throw new TypeError("Class extends value "+String(Z)+" is not a constructor or null");function Q(){this.constructor=se}Ve(se,Z),se.prototype=Z===null?Object.create(Z):(Q.prototype=Z.prototype,new Q)}function Ue(se,Z,Q,ae){return new(Q||(Q=Promise))(function(ue,ee){function ne(Ee){try{pe(ae.next(Ee))}catch(ke){ee(ke)}}function he(Ee){try{pe(ae.throw(Ee))}catch(ke){ee(ke)}}function pe(Ee){var ke;Ee.done?ue(Ee.value):(ke=Ee.value,ke instanceof Q?ke:new Q(function(We){We(ke)})).then(ne,he)}pe((ae=ae.apply(se,Z||[])).next())})}function Ae(se,Z){var Q,ae,ue,ee,ne={label:0,sent:function(){if(1&ue[0])throw ue[1];return ue[1]},trys:[],ops:[]};return ee={next:he(0),throw:he(1),return:he(2)},typeof Symbol=="function"&&(ee[Symbol.iterator]=function(){return this}),ee;function he(pe){return function(Ee){return function(ke){if(Q)throw new TypeError("Generator is already executing.");for(;ne;)try{if(Q=1,ae&&(ue=2&ke[0]?ae.return:ke[0]?ae.throw||((ue=ae.return)&&ue.call(ae),0):ae.next)&&!(ue=ue.call(ae,ke[1])).done)return ue;switch(ae=0,ue&&(ke=[2&ke[0],ue.value]),ke[0]){case 0:case 1:ue=ke;break;case 4:return ne.label++,{value:ke[1],done:!1};case 5:ne.label++,ae=ke[1],ke=[0];continue;case 7:ke=ne.ops.pop(),ne.trys.pop();continue;default:if(!(ue=ne.trys,(ue=ue.length>0&&ue[ue.length-1])||ke[0]!==6&&ke[0]!==2)){ne=0;continue}if(ke[0]===3&&(!ue||ke[1]>ue[0]&&ke[1]<ue[3])){ne.label=ke[1];break}if(ke[0]===6&&ne.label<ue[1]){ne.label=ue[1],ue=ke;break}if(ue&&ne.label<ue[2]){ne.label=ue[2],ne.ops.push(ke);break}ue[2]&&ne.ops.pop(),ne.trys.pop();continue}ke=Z.call(se,ne)}catch(We){ke=[6,We],ae=0}finally{Q=ue=0}if(5&ke[0])throw ke[1];return{value:ke[0]?ke[1]:void 0,done:!0}}([pe,Ee])}}}var F=function(){function se(){}return se.addKey=function(Z){se.key=Z},Object.defineProperty(se,"isLicensed",{get:function(){return!!se.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(se.key)},enumerable:!1,configurable:!0}),se}(),A=function(){function se(){}return se.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},se.setAttributes=function(Z,Q){for(var ae=0,ue=Q;ae<ue.length;ae++){var ee=ue[ae],ne=ee[0],he=ee[1];Z.setAttribute(ne,he)}},se.createRect=function(Z,Q,ae){var ue=document.createElementNS("http://www.w3.org/2000/svg","rect");return ue.setAttribute("width",Z.toString()),ue.setAttribute("height",Q.toString()),ae&&se.setAttributes(ue,ae),ue},se.createLine=function(Z,Q,ae,ue,ee){var ne=document.createElementNS("http://www.w3.org/2000/svg","line");return ne.setAttribute("x1",Z.toString()),ne.setAttribute("y1",Q.toString()),ne.setAttribute("x2",ae.toString()),ne.setAttribute("y2",ue.toString()),ee&&se.setAttributes(ne,ee),ne},se.createPolygon=function(Z,Q){var ae=document.createElementNS("http://www.w3.org/2000/svg","polygon");return ae.setAttribute("points",Z),Q&&se.setAttributes(ae,Q),ae},se.createCircle=function(Z,Q){var ae=document.createElementNS("http://www.w3.org/2000/svg","circle");return ae.setAttribute("cx",(Z/2).toString()),ae.setAttribute("cy",(Z/2).toString()),ae.setAttribute("r",Z.toString()),Q&&se.setAttributes(ae,Q),ae},se.createEllipse=function(Z,Q,ae){var ue=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return ue.setAttribute("cx",(Z/2).toString()),ue.setAttribute("cy",(Q/2).toString()),ue.setAttribute("rx",(Z/2).toString()),ue.setAttribute("ry",(Q/2).toString()),ae&&se.setAttributes(ue,ae),ue},se.createGroup=function(Z){var Q=document.createElementNS("http://www.w3.org/2000/svg","g");return Z&&se.setAttributes(Q,Z),Q},se.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},se.createMarker=function(Z,Q,ae,ue,ee,ne,he){var pe=document.createElementNS("http://www.w3.org/2000/svg","marker");return se.setAttributes(pe,[["id",Z],["orient",Q],["markerWidth",ae.toString()],["markerHeight",ue.toString()],["refX",ee.toString()],["refY",ne.toString()]]),pe.appendChild(he),pe},se.createText=function(Z){var Q=document.createElementNS("http://www.w3.org/2000/svg","text");return Q.setAttribute("x","0"),Q.setAttribute("y","0"),Z&&se.setAttributes(Q,Z),Q},se.createTSpan=function(Z,Q){var ae=document.createElementNS("http://www.w3.org/2000/svg","tspan");return ae.textContent=Z,Q&&se.setAttributes(ae,Q),ae},se.createImage=function(Z){var Q=document.createElementNS("http://www.w3.org/2000/svg","image");return Z&&se.setAttributes(Q,Z),Q},se.createPoint=function(Z,Q){var ae=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return ae.x=Z,ae.y=Q,ae},se.createPath=function(Z,Q){var ae=document.createElementNS("http://www.w3.org/2000/svg","path");return ae.setAttribute("d",Z),Q&&se.setAttributes(ae,Q),ae},se.createElement=function(Z,Q){var ae=document.createElementNS("http://www.w3.org/2000/svg",Z);return Q&&se.setAttributes(ae,Q),ae},se.getHollowRectanglePath=function(Z,Q,ae,ue,ee,ne,he,pe){return"M"+Z+","+Q+"V"+(Q+ue)+"H"+(Z+ae)+"V"+Q+"H"+ee+"V"+ne+"H"+(ee+he)+"V"+(ne+pe)+"H"+ee+"V"+Q+"Z"},se}(),D=function(){function se(Z){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+Z+"_"}return Object.defineProperty(se.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(se.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(se.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),se.prototype.addClass=function(Z){return this.styleSheet===void 0&&this.addStyleSheet(),Z.name=""+this.classNamePrefix+Z.localName,this.classes.push(Z),this.styleSheet.sheet.insertRule("."+Z.name+" {"+Z.style+"}",this.styleSheet.sheet.cssRules.length),Z},se.prototype.addRule=function(Z){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(Z),this.styleSheet.sheet.insertRule(Z.selector+" {"+Z.style+"}",this.styleSheet.sheet.cssRules.length)},se.prototype.addStyleSheet=function(){var Z;this.styleSheet=document.createElement("style"),((Z=this.styleSheetRoot)!==null&&Z!==void 0?Z:document.head).appendChild(this.styleSheet),this.addRule(new K("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new K("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new K("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new J("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new J("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},se.prototype.removeStyleSheet=function(){var Z;this.styleSheet&&(((Z=this.styleSheetRoot)!==null&&Z!==void 0?Z:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},se}(),K=function(se,Z){this.selector=se,this.style=Z},J=function(se,Z){this.localName=se,this.style=Z},U=function(){function se(){this.blocks=[],this.display=""}return se.prototype.addButtonBlock=function(Z){Z.className=this.blockClassName,Z.buttonClassName=this.buttonClassName,Z.buttonColorsClassName=this.buttonColorsClassName,Z.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(Z)},se.prototype.addElementBlock=function(Z){Z.className===void 0&&(Z.className=this.blockClassName),this.blocks.push(Z)},se.prototype.getUI=function(){var Z=document.createElement("div");return Z.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,Z.style.display=this.display,this.blocks.forEach(function(Q){return Z.appendChild(Q.getUI())}),Z},se}(),me=function(){function se(){}return se.prototype.getUI=function(){var Z=document.createElement("div");if(Z.className=this.className,this.minWidth!==void 0&&(Z.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":Z.style.justifyContent="flex-start";break;case"center":Z.style.justifyContent="center";break;case"end":Z.style.justifyContent="flex-end"}return Z.style.whiteSpace="nowrap",Z},se}(),Me=function(se){function Z(){var Q=se!==null&&se.apply(this,arguments)||this;return Q.buttons=[],Q}return Ne(Z,se),Z.prototype.addButton=function(Q){Q.className=this.buttonClassName,Q.colorsClassName=this.buttonColorsClassName,Q.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(Q)},Z.prototype.getUI=function(){var Q=se.prototype.getUI.call(this);return this.buttons.forEach(function(ae){return Q.appendChild(ae.getUI())}),Q},Z}(me),je=function(){function se(Z,Q){this._isActive=!1,this._isHidden=!1,this._icon=Z,this.title=Q,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(se.prototype,"icon",{get:function(){return this._icon},set:function(Z){this._icon=Z,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"isActive",{get:function(){return this._isActive},set:function(Z){this._isActive=Z,this.adjustClassName()},enumerable:!1,configurable:!0}),se.prototype.getUI=function(){var Z=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 Z.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},se.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,"")))},se.prototype.hide=function(){this._isHidden=!0},se}(),Xe=function(se){function Z(){var Q=se!==null&&se.apply(this,arguments)||this;return Q.elements=[],Q}return Ne(Z,se),Z.prototype.addElement=function(Q){this.elements.push(Q)},Z.prototype.getUI=function(){var Q=se.prototype.getUI.call(this);return this.elements.forEach(function(ae){return Q.appendChild(ae)}),Q},Z}(me),Be=function(){function se(Z,Q){this.horizontal=Z,this.vertical=Q}return Object.defineProperty(se.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),se.prototype.getVerticalLength=function(Z){return Z/this.ratio},se.prototype.getHorizontalLength=function(Z){return Z*this.ratio},se}(),He=function(){function se(){}return se.getIcon=function(Z,Q){if(Z>0&&Q>0){var ae=new Be(Z,Q),ue=ae.ratio>=1?20:ae.getHorizontalLength(20),ee=ae.ratio<1?20:ae.getVerticalLength(20),ne=document.createElementNS("http://www.w3.org/2000/svg","svg");ne.setAttribute("xmlns","http://www.w3.org/2000/svg"),ne.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ne);var he=A.createDefs();ne.appendChild(he);var pe=A.createElement("clipPath",[["id","text-bg-clip"]]);he.appendChild(pe);var Ee=A.createPath(A.getHollowRectanglePath((24-ue)/2,(24-ee)/2,ue,ee,(24-ue)/2+2,(24-ee)/2+2,ue-4,ee-4));ne.appendChild(Ee);var ke=A.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);ke.appendChild(A.createTSpan(Z+":"+Q)),ne.appendChild(ke);var We=ke.getBBox();A.setAttributes(ke,[["x",((24-We.width)/2).toString()],["y",((24-We.height)/2-We.y).toString()]]);var qe=A.createPath(A.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(We.width))/2,(24-Math.ceil(We.height))/2,Math.ceil(We.width),Math.ceil(We.height)));return pe.appendChild(qe),A.setAttributes(Ee,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ne),ne.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>'},se}(),ze=function(se){function Z(Q,ae,ue){var ee=se.call(this,Q,ae)||this;return ee.isDropdownOpen=!1,ee.onClick=ee.dropdownButtonClicked,ee.dropdownButtons=ue,ee}return Ne(Z,se),Z.prototype.setupDropdown=function(){var Q=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(ae){ae.className=Q.className,ae.colorsClassName=Q.colorsClassName,Q.dropdownBlock.appendChild(ae.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},Z.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},Z.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},Z.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},Z.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},Z.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},Z}(je),rt=function(){function se(Z,Q){this.GRIP_SIZE=10,this.color=Z,this.fillColor=Q,this.visual=A.createGroup(),this.visual.appendChild(A.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(A.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return se.prototype.ownsTarget=function(Z){return Z===this.visual||Z===this.visual.childNodes[0]||Z===this.visual.childNodes[1]},se.prototype.setCenter=function(Z,Q){this.visual.childNodes.forEach(function(ae){return A.setAttributes(ae,[["cx",Z.toString()],["cy",Q.toString()]])})},se}(),it=function(){function se(Z,Q,ae,ue){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=Z,this.canvasHeight=Q,this.margin=ae,this.container=ue,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(se.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(Z){this._aspectRatio=Z,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(Z){this._isGridVisible=Z,this.gridContainer&&A.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(Z){this._zoomFactor=Z,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),se.prototype.open=function(){var Z=this;this.cropShadeElement=A.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=A.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var Q=0;Q<this.numberOfGridLines;Q++)this.horizontalGridLines.push(A.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(A.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(ae){return Z.gridContainer.appendChild(ae)}),this.verticalGridLines.forEach(function(ae){return Z.gridContainer.appendChild(ae)}),this.cropRectElement=A.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new rt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new rt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new rt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new rt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},se.prototype.setCropRectangle=function(Z){this.cropRect=Z;var Q=Object.assign({},this.cropRect);this.zoomFactor!==1&&(Q.width=this.cropRect.width*this.zoomFactor,Q.height=this.cropRect.height*this.zoomFactor,Q.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-Q.width/2,Q.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-Q.height/2),A.setAttributes(this.cropRectElement,[["x",Q.x.toString()],["y",Q.y.toString()],["width",Q.width.toString()],["height",Q.height.toString()]]);var ae=Q.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(ee,ne){var he=Q.y+ae*(ne+1);A.setAttributes(ee,[["x1",""+Q.x],["y1",""+he],["x2",""+(Q.x+Q.width)],["y2",""+he]])});var ue=Q.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(ee,ne){var he=Q.x+ue*(ne+1);A.setAttributes(ee,[["x1",""+he],["y1",""+Q.y],["x2",""+he],["y2",""+(Q.y+Q.height)]])}),A.setAttributes(this.cropShadeElement,[["d",A.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,Q.x,Q.y,Q.width,Q.height)]]),this.topLeftGrip.setCenter(Q.x,Q.y),this.topRightGrip.setCenter(Q.x+Q.width,Q.y),this.bottomLeftGrip.setCenter(Q.x,Q.y+Q.height),this.bottomRightGrip.setCenter(Q.x+Q.width,Q.y+Q.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},se.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)},se.prototype.clientToLocalCoordinates=function(Z,Q){var ae=this.container.getBoundingClientRect();return{x:Z-ae.left+this.margin,y:Q-ae.top+this.margin}},se.prototype.onPointerDown=function(Z){this.container.setPointerCapture(Z.pointerId),this.previousPoint=this.clientToLocalCoordinates(Z.clientX,Z.clientY),this.cropRectElement===Z.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(Z.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(Z.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(Z.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(Z.target)&&(this.activeGrip=this.bottomRightGrip)},se.prototype.onPointerMove=function(Z){if(this.isMoving)this.move(this.clientToLocalCoordinates(Z.clientX,Z.clientY));else if(this.activeGrip){var Q=this.clientToLocalCoordinates(Z.clientX,Z.clientY);this.resize(Q)}Z.preventDefault()},se.prototype.onPointerUp=function(Z){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(Z.pointerId)},se.prototype.move=function(Z){var Q=Z.x-this.previousPoint.x,ae=Z.y-this.previousPoint.y;this.zoomFactor!==1&&(Q=-Q/this.zoomFactor,ae=-ae/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+Q),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+ae),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=Z},se.prototype.resize=function(Z){var Q=Object.assign({},this.cropRect),ae=Z.x-this.previousPoint.x,ue=Z.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:Q.x+ae<this.margin&&(ae=this.margin-Q.x),Q.x+=ae,Q.width=this.cropRect.x+this.cropRect.width-Q.x;break;case this.bottomRightGrip:case this.topRightGrip:Q.width+ae>this.canvasWidth*this.zoomFactor&&(ae=this.canvasWidth*this.zoomFactor-Q.width),Q.width+=ae}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(Q.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(ae),Q.height=this.aspectRatio.getVerticalLength(Q.width)):(Q.y+=ue,Q.height=this.cropRect.y+this.cropRect.height-Q.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?Q.height=this.aspectRatio.getVerticalLength(Q.width):Q.height+=ue}Q.width<10&&(Q.x=this.cropRect.x,Q.width=10),Q.height<10&&(Q.y=this.cropRect.y,Q.height=10),this.previousPoint=Z,Q.x>=this.margin&&Q.y>=this.margin&&Q.x-this.margin+Q.width<=this.canvasWidth&&Q.y-this.margin+Q.height<=this.canvasHeight&&(this.cropRect=Q,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},se.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var Z=this.cropRect.x+this.cropRect.width/2,Q=this.cropRect.y+this.cropRect.height/2,ae=this.aspectRatio.getHorizontalLength(this.cropRect.height),ue=this.aspectRatio.getVerticalLength(this.cropRect.width);ae/this.canvasWidth<ue/this.canvasHeight?this.cropRect.width=ae:this.cropRect.height=ue,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=Z-this.cropRect.width/2,this.cropRect.y=Q-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},se.prototype.getRescaledRect=function(Z,Q,ae,ue,ee,ne){var he=ae/Z,pe=ue/Q;return{x:(ee.x-ne)*he+ne,y:(ee.y-ne)*pe+ne,width:ee.width*he,height:ee.height*pe}},se.prototype.scaleCanvas=function(Z,Q){var ae=this.getRescaledRect(this.canvasWidth,this.canvasHeight,Z,Q,this.cropRect,this.margin);this.canvasWidth=Z,this.canvasHeight=Q,this.onCropChange&&this.onCropChange(ae),this.setCropRectangle(ae)},se}(),lt=function(){function se(Z){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=Z,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(se.prototype,"angle",{get:function(){return this._angle},set:function(Z){this._angle=Z,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),se.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},se.prototype.onPointerDown=function(Z){this.controlContainer.setPointerCapture(Z.pointerId),this.isDragging=!0,this.previousPoint={x:Z.clientX,y:Z.clientY}},se.prototype.onPointerMove=function(Z){this.isDragging&&(this.onAngleChange&&this.onAngleChange((Z.clientX-this.previousPoint.x)/5),this.previousPoint.x=Z.clientX)},se.prototype.onPointerUp=function(Z){this.isDragging&&this.onAngleChange&&this.onAngleChange((Z.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(Z.pointerId)},se.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var Z=this.angleLabelText.getBBox();A.setAttributes(this.angleLabelElement,[["x",((this.width-Z.width)/2).toString()],["y",(this.height/2).toString()]])}},se.prototype.positionScaleShape=function(){if(this.scaleShape){var Z=this.scaleShape.transform.baseVal.getItem(0);Z.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(Z,0)}},se.prototype.getVisual=function(){var Z=document.createElementNS("http://www.w3.org/2000/svg","svg");Z.setAttribute("xmlns","http://www.w3.org/2000/svg"),Z.setAttribute("width",this.width+"px"),Z.setAttribute("height",this.height+"px"),Z.setAttribute("viewBox","0 0 "+this.width+" "+this.height),Z.style.flexShrink="0",document.body.appendChild(Z);for(var Q="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,ae=1;ae<=this.width/5+10;ae++){var ue=ae%5==0?this.height/3:this.height/6;Q+="h4v"+-ue+"h1v"+ue}Q+="v1H0Z",this.scaleShape=A.createPath(Q);var ee=A.createTransform();this.scaleShape.transform.baseVal.appendItem(ee),Z.appendChild(this.scaleShape),this.angleLabelElement=A.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=A.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ne=A.createTSpan("");return ne.innerHTML="°",this.angleLabelElement.appendChild(ne),Z.appendChild(this.angleLabelElement),document.body.removeChild(Z),Z},se}(),et=function(){function se(){this.naturalSize=!1,this.imageType="image/png"}return se.prototype.rasterize=function(Z,Q,ae,ue,ee,ne,he){var pe=this;return new Promise(function(Ee){var ke=document.createElement("canvas");ke.width=Z.width.baseVal.value-2*ue,ke.height=Z.height.baseVal.value-2*ue;var We=1,qe=1;pe.naturalSize===!0?(We=Q.naturalWidth/(Z.width.baseVal.value-2*ue)/ne,qe=Q.naturalHeight/(Z.height.baseVal.value-2*ue)/he,ke.width=Q.naturalWidth/ne,ke.height=Q.naturalHeight/he):pe.width!==void 0&&pe.height!==void 0&&(We=pe.width/ae.width,qe=pe.height/ae.height,ke.width*=We,ke.height*=qe);var ft=ke.getContext("2d");ft.translate(ke.width/2,ke.height/2),ft.rotate(ee*Math.PI/180),ft.scale(ne,he),ft.translate(-ke.width/2,-ke.height/2),ft.drawImage(Q,0,0,ke.width,ke.height);var gt=document.createElement("canvas");gt.width=ae.width*We,gt.height=ae.height*qe,gt.getContext("2d").putImageData(ft.getImageData((ae.x-ue)*We,(ae.y-ue)*qe,ae.width*We,ae.height*qe),0,0),Ee(gt.toDataURL(pe.imageType,pe.imageQuality))})},se}(),St=function(){function se(Z){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=se.instanceCounter++,this.styles=new D(this.instanceNo),this.target=Z,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(se.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(Z){this._zoomToCropEnabled=Z,Z?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(Z){this._isGridVisible=Z,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"gridLines",{get:function(){return this._gridLines},set:function(Z){this._gridLines=Z,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(Z){this._rotationAngle=Z,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"aspectRatio",{get:function(){var Z;return(Z=this._aspectRatio)!==null&&Z!==void 0?Z:this.aspectRatios[0]},set:function(Z){this._aspectRatio=Z},enumerable:!1,configurable:!0}),se.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},se.prototype.show=function(){this.showUI(),this.open()},se.prototype.close=function(Z){Z===void 0&&(Z=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),Z||this.closeEventListeners.forEach(function(Q){return Q()}),this._isOpen=!1)},se.prototype.addRenderEventListener=function(Z){this.renderEventListeners.push(Z)},se.prototype.removeRenderEventListener=function(Z){this.renderEventListeners.indexOf(Z)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(Z),1)},se.prototype.addCloseEventListener=function(Z){this.closeEventListeners.push(Z)},se.prototype.removeCloseEventListener=function(Z){this.closeEventListeners.indexOf(Z)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(Z),1)},se.prototype.setupResizeObserver=function(){var Z=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){Z.resize(Z.target.clientWidth,Z.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))},se.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var Z=1*this.target.clientWidth/this.target.clientHeight,Q=this.contentDiv.clientWidth/Z>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*Z:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,ae=Q+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/Z;this.resize(Q,ae)}},se.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},se.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",A.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},se.prototype.resize=function(Z,Q){this.imageWidth=Math.round(Z),this.imageHeight=Math.round(Q),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},se.prototype.setEditingTarget=function(){var Z=document.createElement("canvas");Z.width=this.target.naturalWidth,Z.height=this.target.naturalHeight,Z.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var Q=Z.toDataURL();A.setAttributes(this.editingTarget,[["href",Q]]),this.setEditingTargetSize()},se.prototype.setTopLeft=function(){var Z=this.target.getBoundingClientRect(),Q=this.editorCanvas.getBoundingClientRect();this.left=Z.left-Q.left-this.CANVAS_MARGIN,this.top=Z.top-Q.top-this.CANVAS_MARGIN},se.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=A.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=A.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=A.createGroup(),this.editingTargetRotationScaleContainer=A.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var Z=A.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(Z);var Q=A.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(Q),this.editingTargetContainer=A.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)},se.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},se.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=A.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new it(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()},se.prototype.zoomToCrop=function(){if(this.cropRect){var Z=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,Q=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=Z+"px "+Q+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-Z+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-Q+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},se.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)},se.prototype.cropRectChanged=function(Z){this.cropRect=Z,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},se.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},se.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"},se.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},se.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 Z=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,Q=this.target.offsetTop>Z+this.CANVAS_MARGIN?this.target.offsetTop-(Z+this.CANVAS_MARGIN):0;this.coverDiv.style.top=Q+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},se.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},se.prototype.addTopToolbar=function(){var Z=this;this.topToolbar=new U,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var Q=new Me;Q.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(Q);var ae=[];this.aspectRatios.forEach(function(qe){var ft=new je(He.getIcon(qe.horizontal,qe.vertical),qe.horizontal===0&&qe.vertical===0?"FREE":qe.horizontal+":"+qe.vertical);ft.onClick=function(){return Z.ratioButtonClicked(qe)},ae.push(ft)}),this.aspectRatioButton=new ze(He.getIcon(0,0),"Aspect ratio",ae),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,Q.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var ue=new je('<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");ue.isActive=this.isGridVisible,ue.onClick=function(){Z.isGridVisible=!Z.isGridVisible,ue.isActive=Z.isGridVisible},Q.addButton(ue);var ee=new je('<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(ee.isActive=this.zoomToCropEnabled,ee.onClick=function(){Z.zoomToCropEnabled=!Z.zoomToCropEnabled,ee.isActive=Z.zoomToCropEnabled},Q.addButton(ee),!F.isLicensed){var ne=new Xe;this.topToolbar.addElementBlock(ne);var he=document.createElement("div");he.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var pe=document.createElement("a");pe.style.color="currentColor",pe.href="https://markerjs.com/products/cropro",pe.target="_blank",pe.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',he.appendChild(pe),ne.addElement(he)}var Ee=new Me;Ee.minWidth=3*this.toolbarHeight+"px",Ee.contentAlign="end",this.topToolbar.addButtonBlock(Ee);var ke=new je('<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");ke.onClick=this.startRenderAndClose,Ee.addButton(ke),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(ke.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var We=new je('<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");We.onClick=this.close,Ee.addButton(We),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(We.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},se.prototype.addBottomToolbar=function(){var Z=this;this.bottomToolbar=new U,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var Q=new Me;Q.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(Q);var ae=new je('<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");ae.onClick=this.rotateLeftButtonClicked,Q.addButton(ae);var ue=new je('<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");ue.onClick=this.rotateRightButtonClicked,Q.addButton(ue);var ee=new Xe;ee.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(ee),this.straightener=new lt("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(Ee){Z.rotateBy(Ee),Z.straightener.angle=Z.rotationAngle},ee.addElement(this.straightener.getUI());var ne=new Me;ne.minWidth=2*this.toolbarHeight+"px",ne.contentAlign="end",this.bottomToolbar.addButtonBlock(ne);var he=new je('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");he.onClick=this.flipHorizontallyButtonClicked,ne.addButton(he);var pe=new je('<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");pe.onClick=this.flipVerticallyButtonClicked,ne.addButton(pe)},se.prototype.ratioButtonClicked=function(Z){this.aspectRatio=Z,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},se.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=He.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},se.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Be(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},se.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},se.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},se.prototype.restoreState=function(Z){if(Z){var Q=this.cropLayer.getRescaledRect(Z.width,Z.height,this.imageWidth,this.imageHeight,Z.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(Q),this.cropRectChanged(Q),this.flippedHorizontally=Z.flippedHorizontally,this.flippedVertically=Z.flippedVertically,this.applyFlip(),this.rotationAngle=Z.rotationAngle,this.applyRotation()}},se.prototype.clientToLocalCoordinates=function(Z,Q){var ae=this.cropImage.getBoundingClientRect();return{x:Z-ae.left,y:Q-ae.top}},se.prototype.onWindowResize=function(){this.positionUI()},se.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var Z=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=Z+"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()},se.prototype.rotateLeftButtonClicked=function(){var Z=this.rotationAngle-90;this.rotationAngle%90!=0&&(Z+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(Z)},se.prototype.rotateRightButtonClicked=function(){var Z=this.rotationAngle+90;this.rotationAngle%90!=0&&(Z-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(Z)},se.prototype.rotateTo=function(Z){Z=(Z=Z>180?Z-360:Z)<=-180?Z+360:Z,this.rotationAngle=Z,this.applyRotation()},se.prototype.rotateBy=function(Z){this.rotateTo((this.rotationAngle+Z)%360)},se.prototype.applyRotation=function(){var Z=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var Q=this.editingTargetRotationContainer.transform.baseVal.getItem(0);Q.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(Q,0);var ae=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/ae.width,this.imageHeight/ae.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=Z},se.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},se.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},se.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},se.prototype.startRenderAndClose=function(){return Ue(this,void 0,void 0,function(){var Z,Q;return Ae(this,function(ae){switch(ae.label){case 0:return[4,this.render()];case 1:return Z=ae.sent(),Q=this.getState(),this.renderEventListeners.forEach(function(ue){return ue(Z,Q)}),this.close(!0),[2]}})})},se.prototype.render=function(){return Ue(this,void 0,void 0,function(){var Z;return Ae(this,function(Q){switch(Q.label){case 0:return(Z=new et).naturalSize=this.renderAtNaturalSize,Z.imageType=this.renderImageType,Z.imageQuality=this.renderImageQuality,Z.width=this.renderWidth,Z.height=this.renderHeight,this.unzoomFromCrop(),A.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,Z.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return Q.sent(),[4,Z.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,Q.sent()]}})})},se.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new J("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 J("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new J("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var Z=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new J("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*Z)+`px;
|
|
height: `+(this.toolbarHeight-2*Z)+`px;
|
|
padding: `+Z+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new J("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new J("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new K("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new K("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new J("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 J("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new J("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 J("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*Z)+`px;
|
|
padding: `+Z+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new J("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},se.instanceCounter=0,se}(),ut=le("8hTe"),ht=le.n(ut),Fe=/<pre[^>]*>/g;function bt(se){var Z=document.createElement("div");return Z.innerHTML=se,Z.childNodes.length===0?"":Z.childNodes[0].nodeValue}var mt=ct.a=function(se){var Z=se.value,Q=Z===void 0?"":Z,ae=se.edit,ue=ae===void 0?!1:ae,ee=se.className,ne=se.showTextOnly,he=se.showLines,pe=se.replaces,Ee=se.zoomImg,ke=se.hasMask,We=se.style,qe=We===void 0?{}:We,ft=se.stylesPrev,gt=ft===void 0?{}:ft,Wt=String(Q),Ct=Object(R.useRef)(),vt=Object(R.useRef)(),ir=Object(R.useState)(""),zt=Object(W.a)(ir,2),br=zt[0],vr=zt[1],It=Object(R.useState)("office"),Wr=Object(W.a)(It,2),en=Wr[0],Ir=Wr[1],an=function(){var Jt=new St(vt.current);Jt.displayMode="popup",Jt.addRenderEventListener(function(){var Kr=Object(M.a)(P.a.mark(function Nt(Pt){var or;return P.a.wrap(function(kr){for(;;)switch(kr.prev=kr.next){case 0:return Ct.current.style.display="none",kr.next=3,Object(Ye.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Pt}});case 3:or=kr.sent,or!=null&&or.id&&pe(vt.current.getAttribute("src").replace(ye.a.API_SERVER,""),"/api/attachments/".concat(or==null?void 0:or.id,"?type=").concat(or.content_type));case 5:case"end":return kr.stop()}},Nt)}));return function(Nt){return Kr.apply(this,arguments)}}()),Jt.show()},un=function(){var Jt=new Ie.a(vt.current);Jt.settings.displayMode="popup",Jt.addEventListener("render",function(){var Kr=Object(M.a)(P.a.mark(function Nt(Pt){var or;return P.a.wrap(function(kr){for(;;)switch(kr.prev=kr.next){case 0:if(Ct.current.style.display="none",!vt.current){kr.next=6;break}return kr.next=4,Object(Ye.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:Pt.dataUrl}});case 4:or=kr.sent,or!=null&&or.id&&pe(vt.current.getAttribute("src").replace(ye.a.API_SERVER,""),"/api/attachments/".concat(or==null?void 0:or.id,"?type=").concat(or.content_type));case 6:case"end":return kr.stop()}},Nt)}));return function(Nt){return Kr.apply(this,arguments)}}()),Jt.show(),window.markerArea=Jt},Kn=Object(R.useMemo)(function(){Ct.current&&(Ct.current.style.zIndex=-1);try{var dt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Jt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Kr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Wt=Wt.replace(dt,"("+ye.a.API_SERVER+"/api/attachments/").replace(Jt,'"'+ye.a.API_SERVER+"/api/attachments/").replace(Kr,'"'+ye.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(vn){}var Nt=ie(Wt),Pt=x();if(Wt.match(/\[TOC\]/)&&(Nt=Nt.replace("<p>[TOC]</p>",L()),b()),Nt=Nt.replace(/(__special_katext_id_\d+__)/g,function(vn,kr){var Qe=Pt[kr],kt=Qe.type,zn=Qe.expression;return Object(Ce.renderToString)(bt(zn)||"",{displayMode:kt==="block",throwOnError:!1,output:"html"})}),Nt=Nt.replace(/▁/g,"\u2581\u2581\u2581"),m(),ne){var or=document.createElement("div");return or.innerHTML=Nt,or.innerText}return setTimeout(function(){return ei()},500),Nt},[Wt]),Hr=Object(R.useRef)();p.WebkitLineClamp=he,he&&(qe=Object(C.a)(Object(C.a)({},qe),p));function Bn(dt){var Jt=dt.target;if(Jt.tagName.toUpperCase()==="IMG"){if(Ee){var Kr=Jt.getAttribute("src");vr(Kr),Ir("image")}}else if(Jt.tagName.toUpperCase()==="A"){var Nt=Jt.getAttribute("href");if(Nt.indexOf("office")>-1)dt.preventDefault(),vr(Nt),Ir("office");else if(Nt.indexOf("application/pdf")>-1)dt.preventDefault(),vr(Nt),Ir("pdf");else if(Nt.indexOf("text/html")>-1)dt.preventDefault(),vr(Nt),Ir("html");else if(Nt.startsWith("#")){dt.preventDefault();var Pt=document.getElementById(Nt.replace("#",""));Pt&&Pt.scrollIntoView(!0)}}}var ei=function(){var Jt,Kr=(Jt=Hr.current)===null||Jt===void 0?void 0:Jt.querySelectorAll("video");Kr==null||Kr.forEach(function(Nt){if(Nt.oncontextmenu=function(){return!1},Nt.src.indexOf(".m3u8")>-1&&!Nt.canPlayType("application/vnd.apple.mpegurl")){if(oe.a.isSupported()){var Pt=new oe.a;Pt.loadSource(Nt.src),Pt.attachMedia(Nt)}}})};Object(R.useEffect)(function(){if(Hr.current&&Kn&&(Kn.match(Fe)&&window.PR.prettyPrint()),Hr.current)return Hr.current.addEventListener("click",Bn),function(){Hr.current.removeEventListener("click",Bn),m(),b()}},[Kn,Hr.current,Bn]);var Sr=function(Jt){if(!ue)return;Jt.target.nodeName==="IMG"?(Ct.current.style.zIndex=1,Ct.current.style.display="flex",Ct.current.style.width=Jt.target.clientWidth+"px",Ct.current.style.height=Jt.target.clientHeight+"px",Ct.current.style.top=Jt.target.offsetTop+"px",Ct.current.style.left=Jt.target.offsetLeft+"px",vt.current.src=Jt.target.getAttribute("src")):Ct.current.style.display="none"};return y.a.createElement("div",{style:{position:"relative"}},y.a.createElement("div",{ref:Hr,style:Object(C.a)({},qe),className:"".concat(ee||""," markdown-body ").concat(ht.a.mdBody),onMouseOver:Sr,dangerouslySetInnerHTML:{__html:Kn}}),y.a.createElement("div",{ref:Ct,className:ht.a.button},y.a.createElement(X.a,null,y.a.createElement(H.a,{onClick:function(){return an()}},"\u88C1\u526A"),y.a.createElement(H.a,{onClick:function(){return un()}},"\u7F16\u8F91"))),y.a.createElement("img",{ref:vt,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),y.a.createElement(De.a,{close:!0,data:br,type:br!=null&&br.length?en:"",style:Object(C.a)({},gt),onClose:function(){return vr("")}}))}},"9VGf":function(Ot,ct,le){"use strict";le.d(ct,"a",function(){return k});var de=le("q1tI"),X=le.n(de);function k(H,C){var M=Object(de.useRef)();Object(de.useEffect)(function(){M.current=H}),Object(de.useEffect)(function(){function W(){M.current()}if(C!==null){var B=setInterval(W,C);return function(){return clearInterval(B)}}},[C])}},"9ZNV":function(Ot,ct,le){"use strict";le.d(ct,"a",function(){return R});var de=le("0Owb"),X=le("+L6B"),k=le("2/Rp"),H=le("q1tI"),C=le.n(H),M=le("UUDw"),W=le.n(M),B=le("TSYQ"),P=le.n(B),R=function(T){var _=T.cancelText,O=_===void 0?"\u53D6\u6D88":_,w=T.okText,g=w===void 0?"\u786E\u5B9A":w,u=T.loading,o=u===void 0?!1:u,s=T.hasOkBtn,l=s===void 0?!0:s,b=T.okButtonProps,p=b===void 0?{}:b,h=T.onCancel,L=h===void 0?function(){}:h,v=T.onOk,c=v===void 0?function(){}:v,f=T.className,d=f===void 0?"":f;return C.a.createElement("div",{className:P()(W.a.buttonFixed,d)},C.a.createElement("div",{className:W.a.buttonWrap},C.a.createElement(k.a,{size:"large",className:"".concat(W.a.button," mr20"),onClick:L},O),l&&C.a.createElement(k.a,Object(de.a)({size:"large",type:"primary",className:"".concat(W.a.button," mr20"),loading:o,onClick:c},p),g)))}},Bd2K:function(Ot,ct,le){(function(de){de(le("VrN/"),le("osHv"))})(function(de){de.defineOption("autoCloseTags",!1,function(P,R,y){if(y!=de.Init&&y&&P.removeKeyMap("autoCloseTags"),!R)return;var T={name:"autoCloseTags"};(typeof R!="object"||R.whenClosing!==!1)&&(T["'/'"]=function(_){return M(_)}),(typeof R!="object"||R.whenOpening!==!1)&&(T["'>'"]=function(_){return H(_)}),P.addKeyMap(T)});var X=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],k=["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 H(P){if(P.getOption("disableInput"))return de.Pass;for(var R=P.listSelections(),y=[],T=P.getOption("autoCloseTags"),_=0;_<R.length;_++){if(!R[_].empty())return de.Pass;var O=R[_].head,w=P.getTokenAt(O),g=de.innerMode(P.getMode(),w.state),u=g.state,o=g.mode.xmlCurrentTag&&g.mode.xmlCurrentTag(u),s=o&&o.name;if(!s)return de.Pass;var l=g.mode.configuration=="html",b=typeof T=="object"&&T.dontCloseTags||l&&X,p=typeof T=="object"&&T.indentTags||l&&k;w.end>O.ch&&(s=s.slice(0,s.length-w.end+O.ch));var h=s.toLowerCase();if(!s||w.type=="string"&&(w.end!=O.ch||!/[\"\']/.test(w.string.charAt(w.string.length-1))||w.string.length==1)||w.type=="tag"&&o.close||w.string.indexOf("/")==O.ch-w.start-1||b&&W(b,h)>-1||B(P,g.mode.xmlCurrentContext&&g.mode.xmlCurrentContext(u)||[],s,O,!0))return de.Pass;var L=typeof T=="object"&&T.emptyTags;if(L&&W(L,s)>-1){y[_]={text:"/>",newPos:de.Pos(O.line,O.ch+2)};continue}var v=p&&W(p,h)>-1;y[_]={indent:v,text:">"+(v?`
|
|
|
|
`:"")+"</"+s+">",newPos:v?de.Pos(O.line+1,0):de.Pos(O.line,O.ch+1)}}for(var c=typeof T=="object"&&T.dontIndentOnAutoClose,_=R.length-1;_>=0;_--){var f=y[_];P.replaceRange(f.text,R[_].head,R[_].anchor,"+insert");var d=P.listSelections().slice(0);d[_]={head:f.newPos,anchor:f.newPos},P.setSelections(d),!c&&f.indent&&(P.indentLine(f.newPos.line,null,!0),P.indentLine(f.newPos.line+1,null,!0))}}function C(P,R){for(var y=P.listSelections(),T=[],_=R?"/":"</",O=P.getOption("autoCloseTags"),w=typeof O=="object"&&O.dontIndentOnSlash,g=0;g<y.length;g++){if(!y[g].empty())return de.Pass;var u=y[g].head,o=P.getTokenAt(u),s=de.innerMode(P.getMode(),o.state),l=s.state;if(R&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=u.ch-1))return de.Pass;var b,p=s.mode.name!="xml"&&P.getMode().name=="htmlmixed";if(p&&s.mode.name=="javascript")b=_+"script";else if(p&&s.mode.name=="css")b=_+"style";else{var h=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(l);if(!h||h.length&&B(P,h,h[h.length-1],u))return de.Pass;b=_+h[h.length-1]}P.getLine(u.line).charAt(o.end)!=">"&&(b+=">"),T[g]=b}if(P.replaceSelections(T),y=P.listSelections(),!w)for(var g=0;g<y.length;g++)(g==y.length-1||y[g].head.line<y[g+1].head.line)&&P.indentLine(y[g].head.line)}function M(P){return P.getOption("disableInput")?de.Pass:C(P,!0)}de.commands.closeTag=function(P){return C(P)};function W(P,R){if(P.indexOf)return P.indexOf(R);for(var y=0,T=P.length;y<T;++y)if(P[y]==R)return y;return-1}function B(P,R,y,T,_){if(!de.scanForClosingTag)return!1;var O=Math.min(P.lastLine()+1,T.line+500),w=de.scanForClosingTag(P,T,null,O);if(!w||w.tag!=y)return!1;for(var g=_?1:0,u=R.length-1;u>=0&&R[u]==y;u--)++g;T=w.to;for(var u=1;u<g;u++){var o=de.scanForClosingTag(P,T,null,O);if(!o||o.tag!=y)return!1;T=o.to}return!0}})},BjJ7:function(Ot,ct,le){"use strict";le.d(ct,"d",function(){return X}),le.d(ct,"c",function(){return k}),le.d(ct,"e",function(){return H}),le.d(ct,"b",function(){return C}),le.d(ct,"a",function(){return W});var de=le("m3rI");function X(B){var P=!0;if(B.length>0){for(var R=0;R<B.length;R++)if(B[R].compile_success==0||!B[R].compile_success){P=!1;break}}else P=!1;return P}function k(B){for(var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",R=[],y=0;y<B.length;y++){var T=B[y],_=P?"".concat(P,"/").concat(T.name):"".concat(T.name);R.push({title:T.name,isLeaf:!(T.type==="tree"),key:_})}return R}function H(B,P,R){for(var y=0;y<B.length;y++){var T=B[y];if(T.key===P){T.children=R;break}T.children&&H(T.children,P,R)}return B}function C(B,P,R){var y;return function(){var T=this,_=arguments,O=function(){y=null,R||B.apply(T,_)},w=R&&!y;clearTimeout(y),y=setTimeout(O,P),w&&B.apply(T,_)}}var M=!0,W=de.a.API_SERVER},"C+DQ":function(Ot,ct,le){},DlQD:function(Ot,ct,le){(function(de,X){Ot.exports=X()})(this,function(){"use strict";function de(Q,ae){for(var ue=0;ue<ae.length;ue++){var ee=ae[ue];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(Q,ee.key,ee)}}function X(Q,ae,ue){return ae&&de(Q.prototype,ae),ue&&de(Q,ue),Q}function k(Q,ae){if(!Q)return;if(typeof Q=="string")return H(Q,ae);var ue=Object.prototype.toString.call(Q).slice(8,-1);if(ue==="Object"&&Q.constructor&&(ue=Q.constructor.name),ue==="Map"||ue==="Set")return Array.from(Q);if(ue==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ue))return H(Q,ae)}function H(Q,ae){(ae==null||ae>Q.length)&&(ae=Q.length);for(var ue=0,ee=new Array(ae);ue<ae;ue++)ee[ue]=Q[ue];return ee}function C(Q,ae){var ue;if(typeof Symbol=="undefined"||Q[Symbol.iterator]==null){if(Array.isArray(Q)||(ue=k(Q))||ae&&Q&&typeof Q.length=="number"){ue&&(Q=ue);var ee=0;return function(){return ee>=Q.length?{done:!0}:{done:!1,value:Q[ee++]}}}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 ue=Q[Symbol.iterator](),ue.next.bind(ue)}function M(Q,ae){return ae={exports:{}},Q(ae,ae.exports),ae.exports}var W=M(function(Q){function ae(){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 ue(ee){Q.exports.defaults=ee}Q.exports={defaults:ae(),getDefaults:ae,changeDefaults:ue}}),B=W.defaults,P=W.getDefaults,R=W.changeDefaults,y=/[&<>"']/,T=/[&<>"']/g,_=/[<>"']|&(?!#?\w+;)/,O=/[<>"']|&(?!#?\w+;)/g,w={"&":"&","<":"<",">":">",'"':""","'":"'"},g=function(ae){return w[ae]};function u(Q,ae){if(ae){if(y.test(Q))return Q.replace(T,g)}else if(_.test(Q))return Q.replace(O,g);return Q}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(Q){return Q.replace(o,function(ae,ue){return ue=ue.toLowerCase(),ue==="colon"?":":ue.charAt(0)==="#"?ue.charAt(1)==="x"?String.fromCharCode(parseInt(ue.substring(2),16)):String.fromCharCode(+ue.substring(1)):""})}var l=/(^|[^\[])\^/g;function b(Q,ae){Q=Q.source||Q,ae=ae||"";var ue={replace:function(ne,he){return he=he.source||he,he=he.replace(l,"$1"),Q=Q.replace(ne,he),ue},getRegex:function(){return new RegExp(Q,ae)}};return ue}var p=/[^\w:]/g,h=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function L(Q,ae,ue){if(Q){var ee;try{ee=decodeURIComponent(s(ue)).replace(p,"").toLowerCase()}catch(ne){return null}if(ee.indexOf("javascript:")===0||ee.indexOf("vbscript:")===0||ee.indexOf("data:")===0)return null}ae&&!h.test(ue)&&(ue=a(ae,ue));try{ue=encodeURI(ue).replace(/%25/g,"%")}catch(ne){return null}return ue}var v={},c=/^[^:]+:\/*[^/]*$/,f=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(Q,ae){v[" "+Q]||(c.test(Q)?v[" "+Q]=Q+"/":v[" "+Q]=I(Q,"/",!0)),Q=v[" "+Q];var ue=Q.indexOf(":")===-1;return ae.substring(0,2)==="//"?ue?ae:Q.replace(f,"$1")+ae:ae.charAt(0)==="/"?ue?ae:Q.replace(d,"$1")+ae:Q+ae}var x={exec:function(){}};function m(Q){for(var ae=1,ue,ee;ae<arguments.length;ae++){ue=arguments[ae];for(ee in ue)Object.prototype.hasOwnProperty.call(ue,ee)&&(Q[ee]=ue[ee])}return Q}function S(Q,ae){var ue=Q.replace(/\|/g,function(he,pe,Ee){for(var ke=!1,We=pe;--We>=0&&Ee[We]==="\\";)ke=!ke;return ke?"|":" |"}),ee=ue.split(/ \|/),ne=0;if(ee.length>ae)ee.splice(ae);else for(;ee.length<ae;)ee.push("");for(;ne<ee.length;ne++)ee[ne]=ee[ne].trim().replace(/\\\|/g,"|");return ee}function I(Q,ae,ue){var ee=Q.length;if(ee===0)return"";for(var ne=0;ne<ee;){var he=Q.charAt(ee-ne-1);if(he===ae&&!ue)ne++;else if(he!==ae&&ue)ne++;else break}return Q.substr(0,ee-ne)}function z(Q,ae){if(Q.indexOf(ae[1])===-1)return-1;for(var ue=Q.length,ee=0,ne=0;ne<ue;ne++)if(Q[ne]==="\\")ne++;else if(Q[ne]===ae[0])ee++;else if(Q[ne]===ae[1]&&(ee--,ee<0))return ne;return-1}function Y(Q){Q&&Q.sanitize&&!Q.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var ie={escape:u,unescape:s,edit:b,cleanUrl:L,resolveUrl:a,noopTest:x,merge:m,splitCells:S,rtrim:I,findClosingBracket:z,checkSanitizeDeprecation:Y},G=W.defaults,j=ie.rtrim,oe=ie.splitCells,ye=ie.escape,Ce=ie.findClosingBracket;function De(Q,ae,ue){var ee=ae.href,ne=ae.title?ye(ae.title):null,he=Q[1].replace(/\\([\[\]])/g,"$1");return Q[0].charAt(0)!=="!"?{type:"link",raw:ue,href:ee,title:ne,text:he}:{type:"image",raw:ue,href:ee,title:ne,text:ye(he)}}function Ye(Q,ae){var ue=Q.match(/^(\s+)(?:```)/);if(ue===null)return ae;var ee=ue[1];return ae.split(`
|
|
`).map(function(ne){var he=ne.match(/^\s+/);if(he===null)return ne;var pe=he[0];return pe.length>=ee.length?ne.slice(ee.length):ne}).join(`
|
|
`)}var Ie=function(){function Q(ue){this.options=ue||G}var ae=Q.prototype;return ae.space=function(ee){var ne=this.rules.block.newline.exec(ee);if(ne)return ne[0].length>1?{type:"space",raw:ne[0]}:{raw:`
|
|
`}},ae.code=function(ee,ne){var he=this.rules.block.code.exec(ee);if(he){var pe=ne[ne.length-1];if(pe&&pe.type==="paragraph")return{raw:he[0],text:he[0].trimRight()};var Ee=he[0].replace(/^ {4}/gm,"");return{type:"code",raw:he[0],codeBlockStyle:"indented",text:this.options.pedantic?Ee:j(Ee,`
|
|
`)}}},ae.fences=function(ee){var ne=this.rules.block.fences.exec(ee);if(ne){var he=ne[0],pe=Ye(he,ne[3]||"");return{type:"code",raw:he,lang:ne[2]?ne[2].trim():ne[2],text:pe}}},ae.heading=function(ee){var ne=this.rules.block.heading.exec(ee);if(ne)return{type:"heading",raw:ne[0],depth:ne[1].length,text:ne[2]}},ae.nptable=function(ee){var ne=this.rules.block.nptable.exec(ee);if(ne){var he={type:"table",header:oe(ne[1].replace(/^ *| *\| *$/g,"")),align:ne[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ne[3]?ne[3].replace(/\n$/,"").split(`
|
|
`):[],raw:ne[0]};if(he.header.length===he.align.length){var pe=he.align.length,Ee;for(Ee=0;Ee<pe;Ee++)/^ *-+: *$/.test(he.align[Ee])?he.align[Ee]="right":/^ *:-+: *$/.test(he.align[Ee])?he.align[Ee]="center":/^ *:-+ *$/.test(he.align[Ee])?he.align[Ee]="left":he.align[Ee]=null;for(pe=he.cells.length,Ee=0;Ee<pe;Ee++)he.cells[Ee]=oe(he.cells[Ee],he.header.length);return he}}},ae.hr=function(ee){var ne=this.rules.block.hr.exec(ee);if(ne)return{type:"hr",raw:ne[0]}},ae.blockquote=function(ee){var ne=this.rules.block.blockquote.exec(ee);if(ne){var he=ne[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ne[0],text:he}}},ae.list=function(ee){var ne=this.rules.block.list.exec(ee);if(ne){for(var he=ne[0],pe=ne[2],Ee=pe.length>1,ke=pe[pe.length-1]===")",We={type:"list",raw:he,ordered:Ee,start:Ee?+pe.slice(0,-1):"",loose:!1,items:[]},qe=ne[0].match(this.rules.block.item),ft=!1,gt,Wt,Ct,vt,ir,zt,br,vr=qe.length,It=0;It<vr;It++)gt=qe[It],he=gt,Wt=gt.length,gt=gt.replace(/^ *([*+-]|\d+[.)]) */,""),~gt.indexOf(`
|
|
`)&&(Wt-=gt.length,gt=this.options.pedantic?gt.replace(/^ {1,4}/gm,""):gt.replace(new RegExp("^ {1,"+Wt+"}","gm"),"")),It!==vr-1&&(Ct=this.rules.block.bullet.exec(qe[It+1])[0],(Ee?Ct.length===1||!ke&&Ct[Ct.length-1]===")":Ct.length>1||this.options.smartLists&&Ct!==pe)&&(vt=qe.slice(It+1).join(`
|
|
`),We.raw=We.raw.substring(0,We.raw.length-vt.length),It=vr-1)),ir=ft||/\n\n(?!\s*$)/.test(gt),It!==vr-1&&(ft=gt.charAt(gt.length-1)===`
|
|
`,ir||(ir=ft)),ir&&(We.loose=!0),zt=/^\[[ xX]\] /.test(gt),br=void 0,zt&&(br=gt[1]!==" ",gt=gt.replace(/^\[[ xX]\] +/,"")),We.items.push({type:"list_item",raw:he,task:zt,checked:br,loose:ir,text:gt});return We}},ae.html=function(ee){var ne=this.rules.block.html.exec(ee);if(ne)return{type:this.options.sanitize?"paragraph":"html",raw:ne[0],pre:!this.options.sanitizer&&(ne[1]==="pre"||ne[1]==="script"||ne[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ne[0]):ye(ne[0]):ne[0]}},ae.def=function(ee){var ne=this.rules.block.def.exec(ee);if(ne){ne[3]&&(ne[3]=ne[3].substring(1,ne[3].length-1));var he=ne[1].toLowerCase().replace(/\s+/g," ");return{tag:he,raw:ne[0],href:ne[2],title:ne[3]}}},ae.table=function(ee){var ne=this.rules.block.table.exec(ee);if(ne){var he={type:"table",header:oe(ne[1].replace(/^ *| *\| *$/g,"")),align:ne[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ne[3]?ne[3].replace(/\n$/,"").split(`
|
|
`):[]};if(he.header.length===he.align.length){he.raw=ne[0];var pe=he.align.length,Ee;for(Ee=0;Ee<pe;Ee++)/^ *-+: *$/.test(he.align[Ee])?he.align[Ee]="right":/^ *:-+: *$/.test(he.align[Ee])?he.align[Ee]="center":/^ *:-+ *$/.test(he.align[Ee])?he.align[Ee]="left":he.align[Ee]=null;for(pe=he.cells.length,Ee=0;Ee<pe;Ee++)he.cells[Ee]=oe(he.cells[Ee].replace(/^ *\| *| *\| *$/g,""),he.header.length);return he}}},ae.lheading=function(ee){var ne=this.rules.block.lheading.exec(ee);if(ne)return{type:"heading",raw:ne[0],depth:ne[2].charAt(0)==="="?1:2,text:ne[1]}},ae.paragraph=function(ee){var ne=this.rules.block.paragraph.exec(ee);if(ne)return{type:"paragraph",raw:ne[0],text:ne[1].charAt(ne[1].length-1)===`
|
|
`?ne[1].slice(0,-1):ne[1]}},ae.text=function(ee,ne){var he=this.rules.block.text.exec(ee);if(he){var pe=ne[ne.length-1];return pe&&pe.type==="text"?{raw:he[0],text:he[0]}:{type:"text",raw:he[0],text:he[0]}}},ae.escape=function(ee){var ne=this.rules.inline.escape.exec(ee);if(ne)return{type:"escape",raw:ne[0],text:ye(ne[1])}},ae.tag=function(ee,ne,he){var pe=this.rules.inline.tag.exec(ee);if(pe)return!ne&&/^<a /i.test(pe[0])?ne=!0:ne&&/^<\/a>/i.test(pe[0])&&(ne=!1),!he&&/^<(pre|code|kbd|script)(\s|>)/i.test(pe[0])?he=!0:he&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(pe[0])&&(he=!1),{type:this.options.sanitize?"text":"html",raw:pe[0],inLink:ne,inRawBlock:he,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(pe[0]):ye(pe[0]):pe[0]}},ae.link=function(ee){var ne=this.rules.inline.link.exec(ee);if(ne){var he=Ce(ne[2],"()");if(he>-1){var pe=ne[0].indexOf("!")===0?5:4,Ee=pe+ne[1].length+he;ne[2]=ne[2].substring(0,he),ne[0]=ne[0].substring(0,Ee).trim(),ne[3]=""}var ke=ne[2],We="";if(this.options.pedantic){var qe=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ke);qe?(ke=qe[1],We=qe[3]):We=""}else We=ne[3]?ne[3].slice(1,-1):"";ke=ke.trim().replace(/^<([\s\S]*)>$/,"$1");var ft=De(ne,{href:ke&&ke.replace(this.rules.inline._escapes,"$1"),title:We&&We.replace(this.rules.inline._escapes,"$1")},ne[0]);return ft}},ae.reflink=function(ee,ne){var he;if((he=this.rules.inline.reflink.exec(ee))||(he=this.rules.inline.nolink.exec(ee))){var pe=(he[2]||he[1]).replace(/\s+/g," ");if(pe=ne[pe.toLowerCase()],!pe||!pe.href){var Ee=he[0].charAt(0);return{type:"text",raw:Ee,text:Ee}}var ke=De(he,pe,he[0]);return ke}},ae.strong=function(ee,ne,he){he===void 0&&(he="");var pe=this.rules.inline.strong.start.exec(ee);if(pe&&(!pe[1]||pe[1]&&(he===""||this.rules.inline.punctuation.exec(he)))){ne=ne.slice(-1*ee.length);var Ee=pe[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Ee.lastIndex=0;for(var ke;(pe=Ee.exec(ne))!=null;)if(ke=this.rules.inline.strong.middle.exec(ne.slice(0,pe.index+3)),ke)return{type:"strong",raw:ee.slice(0,ke[0].length),text:ee.slice(2,ke[0].length-2)}}},ae.em=function(ee,ne,he){he===void 0&&(he="");var pe=this.rules.inline.em.start.exec(ee);if(pe&&(!pe[1]||pe[1]&&(he===""||this.rules.inline.punctuation.exec(he)))){ne=ne.slice(-1*ee.length);var Ee=pe[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Ee.lastIndex=0;for(var ke;(pe=Ee.exec(ne))!=null;)if(ke=this.rules.inline.em.middle.exec(ne.slice(0,pe.index+2)),ke)return{type:"em",raw:ee.slice(0,ke[0].length),text:ee.slice(1,ke[0].length-1)}}},ae.codespan=function(ee){var ne=this.rules.inline.code.exec(ee);if(ne){var he=ne[2].replace(/\n/g," "),pe=/[^ ]/.test(he),Ee=he.startsWith(" ")&&he.endsWith(" ");return pe&&Ee&&(he=he.substring(1,he.length-1)),he=ye(he,!0),{type:"codespan",raw:ne[0],text:he}}},ae.br=function(ee){var ne=this.rules.inline.br.exec(ee);if(ne)return{type:"br",raw:ne[0]}},ae.del=function(ee){var ne=this.rules.inline.del.exec(ee);if(ne)return{type:"del",raw:ne[0],text:ne[1]}},ae.autolink=function(ee,ne){var he=this.rules.inline.autolink.exec(ee);if(he){var pe,Ee;return he[2]==="@"?(pe=ye(this.options.mangle?ne(he[1]):he[1]),Ee="mailto:"+pe):(pe=ye(he[1]),Ee=pe),{type:"link",raw:he[0],text:pe,href:Ee,tokens:[{type:"text",raw:pe,text:pe}]}}},ae.url=function(ee,ne){var he;if(he=this.rules.inline.url.exec(ee)){var pe,Ee;if(he[2]==="@")pe=ye(this.options.mangle?ne(he[0]):he[0]),Ee="mailto:"+pe;else{var ke;do ke=he[0],he[0]=this.rules.inline._backpedal.exec(he[0])[0];while(ke!==he[0]);pe=ye(he[0]),he[1]==="www."?Ee="http://"+pe:Ee=pe}return{type:"link",raw:he[0],text:pe,href:Ee,tokens:[{type:"text",raw:pe,text:pe}]}}},ae.inlineText=function(ee,ne,he){var pe=this.rules.inline.text.exec(ee);if(pe){var Ee;return ne?Ee=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(pe[0]):ye(pe[0]):pe[0]:Ee=ye(this.options.smartypants?he(pe[0]):pe[0]),{type:"text",raw:pe[0],text:Ee}}},Q}(),Ve=ie.noopTest,Ne=ie.edit,Ue=ie.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:Ve,table:Ve,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=Ne(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=Ne(Ae.item,"gm").replace(/bull/g,Ae.bullet).getRegex(),Ae.list=Ne(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=Ne(Ae.html,"i").replace("comment",Ae._comment).replace("tag",Ae._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ae.paragraph=Ne(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=Ne(Ae.blockquote).replace("paragraph",Ae.paragraph).getRegex(),Ae.normal=Ue({},Ae),Ae.gfm=Ue({},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=Ne(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=Ne(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=Ue({},Ae.normal,{html:Ne(`^ *(?: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:Ve,paragraph:Ne(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 F={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ve,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:Ve,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};F._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",F.punctuation=Ne(F.punctuation).replace(/punctuation/g,F._punctuation).getRegex(),F._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",F._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",F.em.start=Ne(F.em.start).replace(/punctuation/g,F._punctuation).getRegex(),F.em.middle=Ne(F.em.middle).replace(/punctuation/g,F._punctuation).replace(/overlapSkip/g,F._overlapSkip).getRegex(),F.em.endAst=Ne(F.em.endAst,"g").replace(/punctuation/g,F._punctuation).getRegex(),F.em.endUnd=Ne(F.em.endUnd,"g").replace(/punctuation/g,F._punctuation).getRegex(),F.strong.start=Ne(F.strong.start).replace(/punctuation/g,F._punctuation).getRegex(),F.strong.middle=Ne(F.strong.middle).replace(/punctuation/g,F._punctuation).replace(/blockSkip/g,F._blockSkip).getRegex(),F.strong.endAst=Ne(F.strong.endAst,"g").replace(/punctuation/g,F._punctuation).getRegex(),F.strong.endUnd=Ne(F.strong.endUnd,"g").replace(/punctuation/g,F._punctuation).getRegex(),F.blockSkip=Ne(F._blockSkip,"g").getRegex(),F.overlapSkip=Ne(F._overlapSkip,"g").getRegex(),F._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,F._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,F._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])?)+(?![-_])/,F.autolink=Ne(F.autolink).replace("scheme",F._scheme).replace("email",F._email).getRegex(),F._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,F.tag=Ne(F.tag).replace("comment",Ae._comment).replace("attribute",F._attribute).getRegex(),F._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,F._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,F._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,F.link=Ne(F.link).replace("label",F._label).replace("href",F._href).replace("title",F._title).getRegex(),F.reflink=Ne(F.reflink).replace("label",F._label).getRegex(),F.reflinkSearch=Ne(F.reflinkSearch,"g").replace("reflink",F.reflink).replace("nolink",F.nolink).getRegex(),F.normal=Ue({},F),F.pedantic=Ue({},F.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Ne(/^!?\[(label)\]\((.*?)\)/).replace("label",F._label).getRegex(),reflink:Ne(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",F._label).getRegex()}),F.gfm=Ue({},F.normal,{escape:Ne(F.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),F.gfm.url=Ne(F.gfm.url,"i").replace("email",F.gfm._extended_email).getRegex(),F.breaks=Ue({},F.gfm,{br:Ne(F.br).replace("{2,}","*").getRegex(),text:Ne(F.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var A={block:Ae,inline:F},D=W.defaults,K=A.block,J=A.inline;function U(Q){return Q.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function me(Q){var ae="",ue,ee,ne=Q.length;for(ue=0;ue<ne;ue++)ee=Q.charCodeAt(ue),Math.random()>.5&&(ee="x"+ee.toString(16)),ae+="&#"+ee+";";return ae}var Me=function(){function Q(ue){this.tokens=[],this.tokens.links=Object.create(null),this.options=ue||D,this.options.tokenizer=this.options.tokenizer||new Ie,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var ee={block:K.normal,inline:J.normal};this.options.pedantic?(ee.block=K.pedantic,ee.inline=J.pedantic):this.options.gfm&&(ee.block=K.gfm,this.options.breaks?ee.inline=J.breaks:ee.inline=J.gfm),this.tokenizer.rules=ee}Q.lex=function(ee,ne){var he=new Q(ne);return he.lex(ee)};var ae=Q.prototype;return ae.lex=function(ee){return ee=ee.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(ee,this.tokens,!0),this.inline(this.tokens),this.tokens},ae.blockTokens=function(ee,ne,he){ne===void 0&&(ne=[]),he===void 0&&(he=!0),ee=ee.replace(/^ +$/gm,"");for(var pe,Ee,ke,We;ee;){if(pe=this.tokenizer.space(ee)){ee=ee.substring(pe.raw.length),pe.type&&ne.push(pe);continue}if(pe=this.tokenizer.code(ee,ne)){ee=ee.substring(pe.raw.length),pe.type?ne.push(pe):(We=ne[ne.length-1],We.raw+=`
|
|
`+pe.raw,We.text+=`
|
|
`+pe.text);continue}if(pe=this.tokenizer.fences(ee)){ee=ee.substring(pe.raw.length),ne.push(pe);continue}if(pe=this.tokenizer.heading(ee)){ee=ee.substring(pe.raw.length),ne.push(pe);continue}if(pe=this.tokenizer.nptable(ee)){ee=ee.substring(pe.raw.length),ne.push(pe);continue}if(pe=this.tokenizer.hr(ee)){ee=ee.substring(pe.raw.length),ne.push(pe);continue}if(pe=this.tokenizer.blockquote(ee)){ee=ee.substring(pe.raw.length),pe.tokens=this.blockTokens(pe.text,[],he),ne.push(pe);continue}if(pe=this.tokenizer.list(ee)){for(ee=ee.substring(pe.raw.length),ke=pe.items.length,Ee=0;Ee<ke;Ee++)pe.items[Ee].tokens=this.blockTokens(pe.items[Ee].text,[],!1);ne.push(pe);continue}if(pe=this.tokenizer.html(ee)){ee=ee.substring(pe.raw.length),ne.push(pe);continue}if(he&&(pe=this.tokenizer.def(ee))){ee=ee.substring(pe.raw.length),this.tokens.links[pe.tag]||(this.tokens.links[pe.tag]={href:pe.href,title:pe.title});continue}if(pe=this.tokenizer.table(ee)){ee=ee.substring(pe.raw.length),ne.push(pe);continue}if(pe=this.tokenizer.lheading(ee)){ee=ee.substring(pe.raw.length),ne.push(pe);continue}if(he&&(pe=this.tokenizer.paragraph(ee))){ee=ee.substring(pe.raw.length),ne.push(pe);continue}if(pe=this.tokenizer.text(ee,ne)){ee=ee.substring(pe.raw.length),pe.type?ne.push(pe):(We=ne[ne.length-1],We.raw+=`
|
|
`+pe.raw,We.text+=`
|
|
`+pe.text);continue}if(ee){var qe="Infinite loop on byte: "+ee.charCodeAt(0);if(this.options.silent){console.error(qe);break}else throw new Error(qe)}}return ne},ae.inline=function(ee){var ne,he,pe,Ee,ke,We,qe=ee.length;for(ne=0;ne<qe;ne++){We=ee[ne];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:[]},Ee=We.header.length,he=0;he<Ee;he++)We.tokens.header[he]=[],this.inlineTokens(We.header[he],We.tokens.header[he]);for(Ee=We.cells.length,he=0;he<Ee;he++)for(ke=We.cells[he],We.tokens.cells[he]=[],pe=0;pe<ke.length;pe++)We.tokens.cells[he][pe]=[],this.inlineTokens(ke[pe],We.tokens.cells[he][pe]);break}case"blockquote":{this.inline(We.tokens);break}case"list":{for(Ee=We.items.length,he=0;he<Ee;he++)this.inline(We.items[he].tokens);break}}}return ee},ae.inlineTokens=function(ee,ne,he,pe,Ee){ne===void 0&&(ne=[]),he===void 0&&(he=!1),pe===void 0&&(pe=!1),Ee===void 0&&(Ee="");var ke,We=ee,qe;if(this.tokens.links){var ft=Object.keys(this.tokens.links);if(ft.length>0)for(;(qe=this.tokenizer.rules.inline.reflinkSearch.exec(We))!=null;)ft.includes(qe[0].slice(qe[0].lastIndexOf("[")+1,-1))&&(We=We.slice(0,qe.index)+"["+"a".repeat(qe[0].length-2)+"]"+We.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(qe=this.tokenizer.rules.inline.blockSkip.exec(We))!=null;)We=We.slice(0,qe.index)+"["+"a".repeat(qe[0].length-2)+"]"+We.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;ee;){if(ke=this.tokenizer.escape(ee)){ee=ee.substring(ke.raw.length),ne.push(ke);continue}if(ke=this.tokenizer.tag(ee,he,pe)){ee=ee.substring(ke.raw.length),he=ke.inLink,pe=ke.inRawBlock,ne.push(ke);continue}if(ke=this.tokenizer.link(ee)){ee=ee.substring(ke.raw.length),ke.type==="link"&&(ke.tokens=this.inlineTokens(ke.text,[],!0,pe)),ne.push(ke);continue}if(ke=this.tokenizer.reflink(ee,this.tokens.links)){ee=ee.substring(ke.raw.length),ke.type==="link"&&(ke.tokens=this.inlineTokens(ke.text,[],!0,pe)),ne.push(ke);continue}if(ke=this.tokenizer.strong(ee,We,Ee)){ee=ee.substring(ke.raw.length),ke.tokens=this.inlineTokens(ke.text,[],he,pe),ne.push(ke);continue}if(ke=this.tokenizer.em(ee,We,Ee)){ee=ee.substring(ke.raw.length),ke.tokens=this.inlineTokens(ke.text,[],he,pe),ne.push(ke);continue}if(ke=this.tokenizer.codespan(ee)){ee=ee.substring(ke.raw.length),ne.push(ke);continue}if(ke=this.tokenizer.br(ee)){ee=ee.substring(ke.raw.length),ne.push(ke);continue}if(ke=this.tokenizer.del(ee)){ee=ee.substring(ke.raw.length),ke.tokens=this.inlineTokens(ke.text,[],he,pe),ne.push(ke);continue}if(ke=this.tokenizer.autolink(ee,me)){ee=ee.substring(ke.raw.length),ne.push(ke);continue}if(!he&&(ke=this.tokenizer.url(ee,me))){ee=ee.substring(ke.raw.length),ne.push(ke);continue}if(ke=this.tokenizer.inlineText(ee,pe,U)){ee=ee.substring(ke.raw.length),Ee=ke.raw.slice(-1),ne.push(ke);continue}if(ee){var gt="Infinite loop on byte: "+ee.charCodeAt(0);if(this.options.silent){console.error(gt);break}else throw new Error(gt)}}return ne},X(Q,null,[{key:"rules",get:function(){return{block:K,inline:J}}}]),Q}(),je=W.defaults,Xe=ie.cleanUrl,Be=ie.escape,He=function(){function Q(ue){this.options=ue||je}var ae=Q.prototype;return ae.code=function(ee,ne,he){var pe=(ne||"").match(/\S*/)[0];if(this.options.highlight){var Ee=this.options.highlight(ee,pe);Ee!=null&&Ee!==ee&&(he=!0,ee=Ee)}return pe?'<pre><code class="'+this.options.langPrefix+Be(pe,!0)+'">'+(he?ee:Be(ee,!0))+`</code></pre>
|
|
`:"<pre><code>"+(he?ee:Be(ee,!0))+`</code></pre>
|
|
`},ae.blockquote=function(ee){return`<blockquote>
|
|
`+ee+`</blockquote>
|
|
`},ae.html=function(ee){return ee},ae.heading=function(ee,ne,he,pe){return this.options.headerIds?"<h"+ne+' id="'+this.options.headerPrefix+pe.slug(he)+'">'+ee+"</h"+ne+`>
|
|
`:"<h"+ne+">"+ee+"</h"+ne+`>
|
|
`},ae.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},ae.list=function(ee,ne,he){var pe=ne?"ol":"ul",Ee=ne&&he!==1?' start="'+he+'"':"";return"<"+pe+Ee+`>
|
|
`+ee+"</"+pe+`>
|
|
`},ae.listitem=function(ee){return"<li>"+ee+`</li>
|
|
`},ae.checkbox=function(ee){return"<input "+(ee?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ae.paragraph=function(ee){return"<p>"+ee+`</p>
|
|
`},ae.table=function(ee,ne){return ne&&(ne="<tbody>"+ne+"</tbody>"),`<table>
|
|
<thead>
|
|
`+ee+`</thead>
|
|
`+ne+`</table>
|
|
`},ae.tablerow=function(ee){return`<tr>
|
|
`+ee+`</tr>
|
|
`},ae.tablecell=function(ee,ne){var he=ne.header?"th":"td",pe=ne.align?"<"+he+' align="'+ne.align+'">':"<"+he+">";return pe+ee+"</"+he+`>
|
|
`},ae.strong=function(ee){return"<strong>"+ee+"</strong>"},ae.em=function(ee){return"<em>"+ee+"</em>"},ae.codespan=function(ee){return"<code>"+ee+"</code>"},ae.br=function(){return this.options.xhtml?"<br/>":"<br>"},ae.del=function(ee){return"<del>"+ee+"</del>"},ae.link=function(ee,ne,he){if(ee=Xe(this.options.sanitize,this.options.baseUrl,ee),ee===null)return he;var pe='<a href="'+Be(ee)+'"';return ne&&(pe+=' title="'+ne+'"'),pe+=">"+he+"</a>",pe},ae.image=function(ee,ne,he){if(ee=Xe(this.options.sanitize,this.options.baseUrl,ee),ee===null)return he;var pe='<img src="'+ee+'" alt="'+he+'"';return ne&&(pe+=' title="'+ne+'"'),pe+=this.options.xhtml?"/>":">",pe},ae.text=function(ee){return ee},Q}(),ze=function(){function Q(){}var ae=Q.prototype;return ae.strong=function(ee){return ee},ae.em=function(ee){return ee},ae.codespan=function(ee){return ee},ae.del=function(ee){return ee},ae.html=function(ee){return ee},ae.text=function(ee){return ee},ae.link=function(ee,ne,he){return""+he},ae.image=function(ee,ne,he){return""+he},ae.br=function(){return""},Q}(),rt=function(){function Q(){this.seen={}}var ae=Q.prototype;return ae.slug=function(ee){var ne=ee.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ne)){var he=ne;do this.seen[he]++,ne=he+"-"+this.seen[he];while(this.seen.hasOwnProperty(ne))}return this.seen[ne]=0,ne},Q}(),it=W.defaults,lt=ie.unescape,et=function(){function Q(ue){this.options=ue||it,this.options.renderer=this.options.renderer||new He,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new ze,this.slugger=new rt}Q.parse=function(ee,ne){var he=new Q(ne);return he.parse(ee)};var ae=Q.prototype;return ae.parse=function(ee,ne){ne===void 0&&(ne=!0);var he="",pe,Ee,ke,We,qe,ft,gt,Wt,Ct,vt,ir,zt,br,vr,It,Wr,en,Ir,an=ee.length;for(pe=0;pe<an;pe++){vt=ee[pe];switch(vt.type){case"space":continue;case"hr":{he+=this.renderer.hr();continue}case"heading":{he+=this.renderer.heading(this.parseInline(vt.tokens),vt.depth,lt(this.parseInline(vt.tokens,this.textRenderer)),this.slugger);continue}case"code":{he+=this.renderer.code(vt.text,vt.lang,vt.escaped);continue}case"table":{for(Wt="",gt="",We=vt.header.length,Ee=0;Ee<We;Ee++)gt+=this.renderer.tablecell(this.parseInline(vt.tokens.header[Ee]),{header:!0,align:vt.align[Ee]});for(Wt+=this.renderer.tablerow(gt),Ct="",We=vt.cells.length,Ee=0;Ee<We;Ee++){for(ft=vt.tokens.cells[Ee],gt="",qe=ft.length,ke=0;ke<qe;ke++)gt+=this.renderer.tablecell(this.parseInline(ft[ke]),{header:!1,align:vt.align[ke]});Ct+=this.renderer.tablerow(gt)}he+=this.renderer.table(Wt,Ct);continue}case"blockquote":{Ct=this.parse(vt.tokens),he+=this.renderer.blockquote(Ct);continue}case"list":{for(ir=vt.ordered,zt=vt.start,br=vt.loose,We=vt.items.length,Ct="",Ee=0;Ee<We;Ee++)It=vt.items[Ee],Wr=It.checked,en=It.task,vr="",It.task&&(Ir=this.renderer.checkbox(Wr),br?It.tokens.length>0&&It.tokens[0].type==="text"?(It.tokens[0].text=Ir+" "+It.tokens[0].text,It.tokens[0].tokens&&It.tokens[0].tokens.length>0&&It.tokens[0].tokens[0].type==="text"&&(It.tokens[0].tokens[0].text=Ir+" "+It.tokens[0].tokens[0].text)):It.tokens.unshift({type:"text",text:Ir}):vr+=Ir),vr+=this.parse(It.tokens,br),Ct+=this.renderer.listitem(vr,en,Wr);he+=this.renderer.list(Ct,ir,zt);continue}case"html":{he+=this.renderer.html(vt.text);continue}case"paragraph":{he+=this.renderer.paragraph(this.parseInline(vt.tokens));continue}case"text":{for(Ct=vt.tokens?this.parseInline(vt.tokens):vt.text;pe+1<an&&ee[pe+1].type==="text";)vt=ee[++pe],Ct+=`
|
|
`+(vt.tokens?this.parseInline(vt.tokens):vt.text);he+=ne?this.renderer.paragraph(Ct):Ct;continue}default:{var un='Token with "'+vt.type+'" type was not found.';if(this.options.silent){console.error(un);return}else throw new Error(un)}}}return he},ae.parseInline=function(ee,ne){ne=ne||this.renderer;var he="",pe,Ee,ke=ee.length;for(pe=0;pe<ke;pe++){Ee=ee[pe];switch(Ee.type){case"escape":{he+=ne.text(Ee.text);break}case"html":{he+=ne.html(Ee.text);break}case"link":{he+=ne.link(Ee.href,Ee.title,this.parseInline(Ee.tokens,ne));break}case"image":{he+=ne.image(Ee.href,Ee.title,Ee.text);break}case"strong":{he+=ne.strong(this.parseInline(Ee.tokens,ne));break}case"em":{he+=ne.em(this.parseInline(Ee.tokens,ne));break}case"codespan":{he+=ne.codespan(Ee.text);break}case"br":{he+=ne.br();break}case"del":{he+=ne.del(this.parseInline(Ee.tokens,ne));break}case"text":{he+=ne.text(Ee.text);break}default:{var We='Token with "'+Ee.type+'" type was not found.';if(this.options.silent){console.error(We);return}else throw new Error(We)}}}return he},Q}(),St=ie.merge,ut=ie.checkSanitizeDeprecation,ht=ie.escape,Fe=W.getDefaults,bt=W.changeDefaults,mt=W.defaults;function se(Q,ae,ue){if(typeof Q=="undefined"||Q===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Q!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Q)+", string expected");if(typeof ae=="function"&&(ue=ae,ae=null),ae=St({},se.defaults,ae||{}),ut(ae),ue){var ee=ae.highlight,ne;try{ne=Me.lex(Q,ae)}catch(ke){return ue(ke)}var he=function(We){var qe;if(!We)try{qe=et.parse(ne,ae)}catch(ft){We=ft}return ae.highlight=ee,We?ue(We):ue(null,qe)};if(!ee||ee.length<3)return he();if(delete ae.highlight,!ne.length)return he();var pe=0;se.walkTokens(ne,function(ke){ke.type==="code"&&(pe++,setTimeout(function(){ee(ke.text,ke.lang,function(We,qe){if(We)return he(We);qe!=null&&qe!==ke.text&&(ke.text=qe,ke.escaped=!0),pe--,pe===0&&he()})},0))}),pe===0&&he();return}try{var Ee=Me.lex(Q,ae);return ae.walkTokens&&se.walkTokens(Ee,ae.walkTokens),et.parse(Ee,ae)}catch(ke){if(ke.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,ae.silent)return"<p>An error occurred:</p><pre>"+ht(ke.message+"",!0)+"</pre>";throw ke}}se.options=se.setOptions=function(Q){return St(se.defaults,Q),bt(se.defaults),se},se.getDefaults=Fe,se.defaults=mt,se.use=function(Q){var ae=St({},Q);if(Q.renderer&&function(){var ee=se.defaults.renderer||new He,ne=function(Ee){var ke=ee[Ee];ee[Ee]=function(){for(var We=arguments.length,qe=new Array(We),ft=0;ft<We;ft++)qe[ft]=arguments[ft];var gt=Q.renderer[Ee].apply(ee,qe);return gt===!1&&(gt=ke.apply(ee,qe)),gt}};for(var he in Q.renderer)ne(he);ae.renderer=ee}(),Q.tokenizer&&function(){var ee=se.defaults.tokenizer||new Ie,ne=function(Ee){var ke=ee[Ee];ee[Ee]=function(){for(var We=arguments.length,qe=new Array(We),ft=0;ft<We;ft++)qe[ft]=arguments[ft];var gt=Q.tokenizer[Ee].apply(ee,qe);return gt===!1&&(gt=ke.apply(ee,qe)),gt}};for(var he in Q.tokenizer)ne(he);ae.tokenizer=ee}(),Q.walkTokens){var ue=se.defaults.walkTokens;ae.walkTokens=function(ee){Q.walkTokens(ee),ue&&ue(ee)}}se.setOptions(ae)},se.walkTokens=function(Q,ae){for(var ue=C(Q),ee;!(ee=ue()).done;){var ne=ee.value;ae(ne);switch(ne.type){case"table":{for(var he=C(ne.tokens.header),pe;!(pe=he()).done;){var Ee=pe.value;se.walkTokens(Ee,ae)}for(var ke=C(ne.tokens.cells),We;!(We=ke()).done;)for(var qe=We.value,ft=C(qe),gt;!(gt=ft()).done;){var Wt=gt.value;se.walkTokens(Wt,ae)}break}case"list":{se.walkTokens(ne.items,ae);break}default:ne.tokens&&se.walkTokens(ne.tokens,ae)}}},se.Parser=et,se.parser=et.parse,se.Renderer=He,se.TextRenderer=ze,se.Lexer=Me,se.lexer=Me.lex,se.Tokenizer=Ie,se.Slugger=rt,se.parse=se;var Z=se;return Z})},ELLl:function(Ot,ct,le){(function(de){de(le("VrN/"))})(function(de){var X={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},k=de.Pos;de.defineOption("autoCloseBrackets",!1,function(w,g,u){u&&u!=de.Init&&(w.removeKeyMap(C),w.state.closeBrackets=null),g&&(M(H(g,"pairs")),w.state.closeBrackets=g,w.addKeyMap(C))});function H(w,g){return g=="pairs"&&typeof w=="string"?w:typeof w=="object"&&w[g]!=null?w[g]:X[g]}var C={Backspace:P,Enter:R};function M(w){for(var g=0;g<w.length;g++){var u=w.charAt(g),o="'"+u+"'";C[o]||(C[o]=W(u))}}M(X.pairs+"`");function W(w){return function(g){return T(g,w)}}function B(w){var g=w.state.closeBrackets;if(!g||g.override)return g;var u=w.getModeAt(w.getCursor());return u.closeBrackets||g}function P(w){var g=B(w);if(!g||w.getOption("disableInput"))return de.Pass;for(var u=H(g,"pairs"),o=w.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return de.Pass;var l=_(w,o[s].head);if(!l||u.indexOf(l)%2!=0)return de.Pass}for(var s=o.length-1;s>=0;s--){var b=o[s].head;w.replaceRange("",k(b.line,b.ch-1),k(b.line,b.ch+1),"+delete")}}function R(w){var g=B(w),u=g&&H(g,"explode");if(!u||w.getOption("disableInput"))return de.Pass;for(var o=w.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return de.Pass;var l=_(w,o[s].head);if(!l||u.indexOf(l)%2!=0)return de.Pass}w.operation(function(){var b=w.lineSeparator()||`
|
|
`;w.replaceSelection(b+b,null),w.execCommand("goCharLeft"),o=w.listSelections();for(var p=0;p<o.length;p++){var h=o[p].head.line;w.indentLine(h,null,!0),w.indentLine(h+1,null,!0)}})}function y(w){var g=de.cmpPos(w.anchor,w.head)>0;return{anchor:new k(w.anchor.line,w.anchor.ch+(g?-1:1)),head:new k(w.head.line,w.head.ch+(g?1:-1))}}function T(w,g){var u=B(w);if(!u||w.getOption("disableInput"))return de.Pass;var o=H(u,"pairs"),s=o.indexOf(g);if(s==-1)return de.Pass;for(var l=H(u,"closeBefore"),b=H(u,"triples"),p=o.charAt(s+1)==g,h=w.listSelections(),L=s%2==0,v,c=0;c<h.length;c++){var f=h[c],d=f.head,a,x=w.getRange(d,k(d.line,d.ch+1));if(L&&!f.empty())a="surround";else if((p||!L)&&x==g)p&&O(w,d)?a="both":b.indexOf(g)>=0&&w.getRange(d,k(d.line,d.ch+3))==g+g+g?a="skipThree":a="skip";else if(p&&d.ch>1&&b.indexOf(g)>=0&&w.getRange(k(d.line,d.ch-2),d)==g+g){if(d.ch>2&&/\bstring/.test(w.getTokenTypeAt(k(d.line,d.ch-2))))return de.Pass;a="addFour"}else if(p){var m=d.ch==0?" ":w.getRange(k(d.line,d.ch-1),d);if(!de.isWordChar(x)&&m!=g&&!de.isWordChar(m))a="both";else return de.Pass}else if(L&&(x.length===0||/\s/.test(x)||l.indexOf(x)>-1))a="both";else return de.Pass;if(!v)v=a;else if(v!=a)return de.Pass}var S=s%2?o.charAt(s-1):g,I=s%2?g:o.charAt(s+1);w.operation(function(){if(v=="skip")w.execCommand("goCharRight");else if(v=="skipThree")for(var z=0;z<3;z++)w.execCommand("goCharRight");else if(v=="surround"){for(var Y=w.getSelections(),z=0;z<Y.length;z++)Y[z]=S+Y[z]+I;w.replaceSelections(Y,"around"),Y=w.listSelections().slice();for(var z=0;z<Y.length;z++)Y[z]=y(Y[z]);w.setSelections(Y)}else v=="both"?(w.replaceSelection(S+I,null),w.triggerElectric(S+I),w.execCommand("goCharLeft")):v=="addFour"&&(w.replaceSelection(S+S+S+S,"before"),w.execCommand("goCharRight"))})}function _(w,g){var u=w.getRange(k(g.line,g.ch-1),k(g.line,g.ch+1));return u.length==2?u:null}function O(w,g){var u=w.getTokenAt(k(g.line,g.ch+1));return/\bstring/.test(u.type)&&u.start==g.ch&&(g.ch==0||!/\bstring/.test(w.getTokenTypeAt(g)))}})},F8wB:function(Ot,ct,le){Ot.exports={loading:"loading___1SIOG"}},Gytx:function(Ot,ct){Ot.exports=function(de,X,k,H){var C=k?k.call(H,de,X):void 0;if(C!==void 0)return!!C;if(de===X)return!0;if(typeof de!="object"||!de||typeof X!="object"||!X)return!1;var M=Object.keys(de),W=Object.keys(X);if(M.length!==W.length)return!1;for(var B=Object.prototype.hasOwnProperty.bind(X),P=0;P<M.length;P++){var R=M[P];if(!B(R))return!1;var y=de[R],T=X[R];if(C=k?k.call(H,y,T,R):void 0,C===!1||C===void 0&&y!==T)return!1}return!0}},HmJG:function(Ot,ct,le){},I8Z2:function(Ot,ct,le){"use strict";le.d(ct,"a",function(){return H}),le.d(ct,"b",function(){return _}),le.d(ct,"c",function(){return w});var de=le("q1tI"),X=function(){var g=function(u,o){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,l){s.__proto__=l}||function(s,l){for(var b in l)l.hasOwnProperty(b)&&(s[b]=l[b])},g(u,o)};return function(u,o){g(u,o);function s(){this.constructor=u}u.prototype=o===null?Object.create(o):(s.prototype=o.prototype,new s)}}(),k=de.createContext(null),H=function(g){X(u,g);function u(){return g!==null&&g.apply(this,arguments)||this}return u.prototype.render=function(){return de.createElement(k.Provider,{value:this.props.store},this.props.children)},u}(de.Component),C=le("Gytx"),M=le.n(C),W=le("2mql"),B=le.n(W),P=function(){var g=function(u,o){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,l){s.__proto__=l}||function(s,l){for(var b in l)l.hasOwnProperty(b)&&(s[b]=l[b])},g(u,o)};return function(u,o){g(u,o);function s(){this.constructor=u}u.prototype=o===null?Object.create(o):(s.prototype=o.prototype,new s)}}(),R=function(){return R=Object.assign||function(g){for(var u,o=1,s=arguments.length;o<s;o++){u=arguments[o];for(var l in u)Object.prototype.hasOwnProperty.call(u,l)&&(g[l]=u[l])}return g},R.apply(this,arguments)};function y(g){return g.displayName||g.name||"Component"}var T=function(){return{}};function _(g,u){u===void 0&&(u={});var o=!!g,s=g||T;return function(b){var p=function(L){P(v,L);function v(c,f){var d=L.call(this,c,f)||this;return d.unsubscribe=null,d.handleChange=function(){if(!d.unsubscribe)return;var a=s(d.store.getState(),d.props);d.setState({subscribed:a})},d.store=d.context,d.state={subscribed:s(d.store.getState(),c),store:d.store,props:c},d}return v.getDerivedStateFromProps=function(c,f){return g&&g.length===2&&c!==f.props?{subscribed:s(f.store.getState(),c),props:c}:{props:c}},v.prototype.componentDidMount=function(){this.trySubscribe()},v.prototype.componentWillUnmount=function(){this.tryUnsubscribe()},v.prototype.shouldComponentUpdate=function(c,f){return!M()(this.props,c)||!M()(this.state.subscribed,f.subscribed)},v.prototype.trySubscribe=function(){o&&(this.unsubscribe=this.store.subscribe(this.handleChange),this.handleChange())},v.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)},v.prototype.render=function(){var c=R(R(R({},this.props),this.state.subscribed),{store:this.store});return de.createElement(b,R({},c,{ref:this.props.miniStoreForwardedRef}))},v.displayName="Connect("+y(b)+")",v.contextType=k,v}(de.Component);if(u.forwardRef){var h=de.forwardRef(function(L,v){return de.createElement(p,R({},L,{miniStoreForwardedRef:v}))});return B()(h,b)}return B()(p,b)}}var O=function(){return O=Object.assign||function(g){for(var u,o=1,s=arguments.length;o<s;o++){u=arguments[o];for(var l in u)Object.prototype.hasOwnProperty.call(u,l)&&(g[l]=u[l])}return g},O.apply(this,arguments)};function w(g){var u=g,o=[];function s(p){u=O(O({},u),p);for(var h=0;h<o.length;h++)o[h]()}function l(){return u}function b(p){return o.push(p),function(){var L=o.indexOf(p);o.splice(L,1)}}return{setState:s,getState:l,subscribe:b}}},LdHM:function(Ot,ct,le){"use strict";le.d(ct,"b",function(){return l}),le.d(ct,"a",function(){return p});var de=le("1OyB"),X=le("vuIU"),k=le("Ji7U"),H=le("LK+K"),C=le("q1tI"),M=le("rePB"),W=le("Ff2n"),B=le("ODXe"),P=le("4IlW"),R=le("bX4T"),y=le("YrtM"),T=le("TSYQ"),_=le.n(T),O=le("+nKL"),w=le("8OUc"),g=function(oe,ye){var Ce=oe.prefixCls,De=oe.id,Ye=oe.flattenOptions,Ie=oe.childrenAsData,Ve=oe.values,Ne=oe.searchValue,Ue=oe.multiple,Ae=oe.defaultActiveFirstOption,F=oe.height,A=oe.itemHeight,D=oe.notFoundContent,K=oe.open,J=oe.menuItemSelectedIcon,U=oe.virtual,me=oe.onSelect,Me=oe.onToggleOpen,je=oe.onActiveValue,Xe=oe.onScroll,Be=oe.onMouseEnter,He="".concat(Ce,"-item"),ze=Object(y.a)(function(){return Ye},[K,Ye],function(Z,Q){return Q[0]&&Z[1]!==Q[1]}),rt=C.useRef(null),it=function(Q){Q.preventDefault()},lt=function(Q){rt.current&&rt.current.scrollTo({index:Q})},et=function(Q){for(var ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ue=ze.length,ee=0;ee<ue;ee+=1){var ne=(Q+ee*ae+ue)%ue,he=ze[ne],pe=he.group,Ee=he.data;if(!pe&&!Ee.disabled)return ne}return-1},St=C.useState(function(){return et(0)}),ut=Object(B.a)(St,2),ht=ut[0],Fe=ut[1],bt=function(Q){Fe(Q);var ae=ze[Q];if(!ae){je(null,-1);return}je(ae.data.value,Q)};C.useEffect(function(){bt(Ae!==!1?et(0):-1)},[ze.length,Ne]),C.useEffect(function(){var Z=setTimeout(function(){if(!Ue&&K&&Ve.size===1){var Q=Array.from(Ve)[0],ae=ze.findIndex(function(ue){var ee=ue.data;return ee.value===Q});bt(ae),lt(ae)}});return function(){return clearTimeout(Z)}},[K]);var mt=function(Q){Q!==void 0&&me(Q,{selected:!Ve.has(Q)}),Ue||Me(!1)};if(C.useImperativeHandle(ye,function(){return{onKeyDown:function(Q){var ae=Q.which;switch(ae){case P.a.UP:case P.a.DOWN:{var ue=0;if(ae===P.a.UP?ue=-1:ae===P.a.DOWN&&(ue=1),ue!==0){var ee=et(ht+ue,ue);lt(ee),bt(ee)}break}case P.a.ENTER:{var ne=ze[ht];ne&&!ne.data.disabled?mt(ne.data.value):mt(void 0),K&&Q.preventDefault();break}case P.a.ESC:Me(!1)}},onKeyUp:function(){},scrollTo:function(Q){lt(Q)}}}),ze.length===0)return C.createElement("div",{role:"listbox",id:"".concat(De,"_list"),className:"".concat(He,"-empty"),onMouseDown:it},D);function se(Z){var Q=ze[Z];if(!Q)return null;var ae=Q.data||{},ue=ae.value,ee=ae.label,ne=ae.children,he=Object(R.a)(ae,!0),pe=Ie?ne:ee;return Q?C.createElement("div",Object.assign({"aria-label":typeof pe=="string"?pe:null},he,{key:Z,role:"option",id:"".concat(De,"_list_").concat(Z),"aria-selected":Ve.has(ue)}),ue):null}return C.createElement(C.Fragment,null,C.createElement("div",{role:"listbox",id:"".concat(De,"_list"),style:{height:0,width:0,overflow:"hidden"}},se(ht-1),se(ht),se(ht+1)),C.createElement(O.a,{itemKey:"key",ref:rt,data:ze,height:F,itemHeight:A,fullHeight:!1,onMouseDown:it,onScroll:Xe,virtual:U,onMouseEnter:Be},function(Z,Q){var ae,ue=Z.group,ee=Z.groupOption,ne=Z.data,he=ne.label,pe=ne.key;if(ue)return C.createElement("div",{className:_()(He,"".concat(He,"-group"))},he!==void 0?he:pe);var Ee=ne.disabled,ke=ne.value,We=ne.title,qe=ne.children,ft=ne.style,gt=ne.className,Wt=Object(W.a)(ne,["disabled","value","title","children","style","className"]),Ct=Ve.has(ke),vt="".concat(He,"-option"),ir=_()(He,vt,gt,(ae={},Object(M.a)(ae,"".concat(vt,"-grouped"),ee),Object(M.a)(ae,"".concat(vt,"-active"),ht===Q&&!Ee),Object(M.a)(ae,"".concat(vt,"-disabled"),Ee),Object(M.a)(ae,"".concat(vt,"-selected"),Ct),ae)),zt=Ie?qe:he,br=!J||typeof J=="function"||Ct;return C.createElement("div",Object.assign({},Wt,{"aria-selected":Ct,className:ir,title:We,onMouseMove:function(){if(ht===Q||Ee)return;bt(Q)},onClick:function(){Ee||mt(ke)},style:ft}),C.createElement("div",{className:"".concat(vt,"-content")},zt||ke),C.isValidElement(J)||Ct,br&&C.createElement(w.a,{className:"".concat(He,"-option-state"),customizeIcon:J,customizeIconProps:{isSelected:Ct}},Ct?"\u2713":null))}))},u=C.forwardRef(g);u.displayName="OptionList";var o=u,s=function(){return null};s.isSelectOption=!0;var l=s,b=function(){return null};b.isSelectOptGroup=!0;var p=b,h=le("VTBJ"),L=le("Zm9Q");function v(j){var oe=j.key,ye=j.props,Ce=ye.children,De=ye.value,Ye=Object(W.a)(ye,["children","value"]);return Object(h.a)({key:oe,value:De!==void 0?De:oe,children:Ce},Ye)}function c(j){var oe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(L.a)(j).map(function(ye,Ce){if(!C.isValidElement(ye)||!ye.type)return null;var De=ye.type.isSelectOptGroup,Ye=ye.key,Ie=ye.props,Ve=Ie.children,Ne=Object(W.a)(Ie,["children"]);return oe||!De?v(ye):Object(h.a)(Object(h.a)({key:"__RC_SELECT_GRP__".concat(Ye===null?Ce:Ye,"__"),label:Ye},Ne),{},{options:c(Ve)})}).filter(function(ye){return ye})}var f=le("2Qr1"),d=le("qNPg"),a=le("U8pU"),x=le("Kwbf"),m=le("WKfj");function S(j){var oe=j.mode,ye=j.options,Ce=j.children,De=j.backfill,Ye=j.allowClear,Ie=j.placeholder,Ve=j.getInputElement,Ne=j.showSearch,Ue=j.onSearch,Ae=j.defaultOpen,F=j.autoFocus,A=j.labelInValue,D=j.value,K=j.inputValue,J=j.optionLabelProp,U=oe==="multiple"||oe==="tags",me=Ne!==void 0?Ne:U||oe==="combobox",Me=ye||c(Ce);if(Object(x.a)(oe!=="tags"||Me.every(function(He){return!He.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),oe==="tags"||oe==="combobox"){var je=Me.some(function(He){return He.options?He.options.some(function(ze){return typeof("value"in ze?ze.value:ze.key)=="number"}):typeof("value"in He?He.value:He.key)=="number"});Object(x.a)(!je,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(x.a)(oe!=="combobox"||!J,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(x.a)(oe==="combobox"||!De,"`backfill` only works with `combobox` mode."),Object(x.a)(oe==="combobox"||!Ve,"`getInputElement` only work with `combobox` mode."),Object(x.b)(oe!=="combobox"||!Ve||!Ye||!Ie,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Ue&&!me&&oe!=="combobox"&&oe!=="tags"&&Object(x.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(x.b)(!Ae||F,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),D!=null){var Xe=Object(m.d)(D);Object(x.a)(!A||Xe.every(function(He){return Object(a.a)(He)==="object"&&("key"in He||"value"in He)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(x.a)(!U||Array.isArray(D),"`value` should be array when `mode` is `multiple` or `tags`")}if(Ce){var Be=null;Object(L.a)(Ce).some(function(He){if(!C.isValidElement(He)||!He.type)return!1;var ze=He.type;if(ze.isSelectOption)return!1;if(ze.isSelectOptGroup){var rt=Object(L.a)(He.props.children).every(function(it){return!C.isValidElement(it)||!He.type||it.type.isSelectOption?!0:(Be=it.type,!1)});return!rt}return Be=ze,!0}),Be&&Object(x.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Be.displayName||Be.name||Be,"`.")),Object(x.a)(K===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var I=S,z=Object(d.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:c,flattenOptions:f.d,getLabeledValue:f.e,filterOptions:f.b,isValueDisabled:f.g,findValueOption:f.c,warningProps:I,fillOptionsWithMissingValue:f.a}),Y=function(j){Object(k.a)(ye,j);var oe=Object(H.a)(ye);function ye(){var Ce;return Object(de.a)(this,ye),Ce=oe.apply(this,arguments),Ce.selectRef=C.createRef(),Ce.focus=function(){Ce.selectRef.current.focus()},Ce.blur=function(){Ce.selectRef.current.blur()},Ce}return Object(X.a)(ye,[{key:"render",value:function(){return C.createElement(z,Object.assign({ref:this.selectRef},this.props))}}]),ye}(C.Component);Y.Option=l,Y.OptGroup=p;var ie=Y,G=ct.c=ie},M8RZ:function(Ot,ct,le){"use strict";le.d(ct,"a",function(){return P});var de=le("fWQN"),X=le("mtLc"),k=le("yKVA"),H=le("879j"),C=le("q1tI"),M=le.n(C),W=le("i8i4"),B=le.n(W),P=function(R){Object(k.a)(T,R);var y=Object(H.a)(T);function T(_){var O;Object(de.a)(this,T),O=y.call(this,_);var w=window.document;return O.node=w.createElement("div"),w.body.appendChild(O.node),O}return Object(X.a)(T,[{key:"render",value:function(){var O=this.props.children;return Object(W.createPortal)(O,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),T}(M.a.Component)},OLES:function(Ot,ct,le){"use strict";var de=le("U8pU"),X=le("VTBJ"),k=le("Ff2n"),H=le("q1tI"),C=le("uciX"),M=le("7ixt"),W=function(_){var O=_.overlay,w=_.prefixCls,g=_.id,u=_.overlayInnerStyle;return H.createElement("div",{className:"".concat(w,"-inner"),id:g,role:"tooltip",style:u},typeof O=="function"?O():O)},B=W,P=function(_,O){var w=_.overlayClassName,g=_.trigger,u=g===void 0?["hover"]:g,o=_.mouseEnterDelay,s=o===void 0?0:o,l=_.mouseLeaveDelay,b=l===void 0?.1:l,p=_.overlayStyle,h=_.prefixCls,L=h===void 0?"rc-tooltip":h,v=_.children,c=_.onVisibleChange,f=_.afterVisibleChange,d=_.transitionName,a=_.animation,x=_.placement,m=x===void 0?"right":x,S=_.align,I=S===void 0?{}:S,z=_.destroyTooltipOnHide,Y=z===void 0?!1:z,ie=_.defaultVisible,G=_.getTooltipContainer,j=_.overlayInnerStyle,oe=Object(k.a)(_,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),ye=Object(H.useRef)(null);Object(H.useImperativeHandle)(O,function(){return ye.current});var Ce=Object(X.a)({},oe);"visible"in _&&(Ce.popupVisible=_.visible);var De=function(){var Ue=_.arrowContent,Ae=Ue===void 0?null:Ue,F=_.overlay,A=_.id;return[H.createElement("div",{className:"".concat(L,"-arrow"),key:"arrow"},Ae),H.createElement(B,{key:"content",prefixCls:L,id:A,overlay:F,overlayInnerStyle:j})]},Ye=!1,Ie=!1;if(typeof Y=="boolean")Ye=Y;else if(Y&&Object(de.a)(Y)==="object"){var Ve=Y.keepParent;Ye=Ve===!0,Ie=Ve===!1}return H.createElement(C.a,Object.assign({popupClassName:w,prefixCls:L,popup:De,action:u,builtinPlacements:M.a,popupPlacement:m,ref:ye,popupAlign:I,getPopupContainer:G,onPopupVisibleChange:c,afterPopupVisibleChange:f,popupTransitionName:d,popupAnimation:a,defaultPopupVisible:ie,destroyPopupOnHide:Ye,autoDestroy:Ie,mouseLeaveDelay:b,popupStyle:p,mouseEnterDelay:s},Ce),v)},R=Object(H.forwardRef)(P),y=ct.a=R},Ot1p:function(Ot,ct,le){"use strict";var de=le("2qtc"),X=le("kLXV"),k=le("rAM+"),H=le("miYZ"),C=le("tsqr"),M=le("9og8"),W=le("tJVT"),B=le("jrin"),P=le("WmNS"),R=le.n(P),y=le("q1tI"),T=le.n(y),_=le("VrN/"),O=le.n(_),w=le("bdgK"),g=le("p77/"),u=le("Bd2K"),o=le("ELLl"),s=le("19Vz"),l=le("lZu9"),b=le("+NIl"),p=le("kSUc"),h=le("9Bee"),L=function(Ee){var ke=Ee.value,We=ke===void 0?"":ke,qe=Ee.className,ft=Ee.showTextOnly,gt=Ee.showLines,Wt=Ee.style,Ct=Wt===void 0?{}:Wt,vt=Object(y.useMemo)(function(){return""},[We]);return T.a.createElement(T.a.Fragment,null,T.a.createElement("div",{dangerouslySetInnerHTML:{__html:vt}}))},v=le("0Owb"),c=le("dejd"),f=le("C+DQ"),d=le("1vsH"),a=le("m3rI"),x=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function m(Ee){var ke=Ee.onActionCallback,We=Ee.title,qe=Ee.icon,ft=Ee.actionName,gt=Ee.className,Wt=gt===void 0?"":gt,Ct=Ee.children;function vt(){ke(ft)}return T.a.createElement("a",{title:We,className:Wt,onClick:vt},T.a.createElement("i",{className:"md-iconfont ".concat(qe)}),Ct)}var S=function(Ee){var ke=Ee.watch,We=Ee.showNullButton,qe=Ee.onActionCallback,ft=Ee.fullScreen,gt=Ee.insertTemp,Wt=Ee.hidetoolBar,Ct=Ee.uuid,vt=Ee.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(d.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(d.F)("_educoder_session"),"&key=").concat(Ct,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var ir=[].concat(x,[{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 T.a.createElement("ul",{className:"markdown-toolbar-container"},!Wt&&ir.map(function(zt,br){return T.a.createElement("li",{key:br},zt.actionName?T.a.createElement(m,Object(v.a)({},zt,{onActionCallback:qe})):T.a.createElement("span",{className:"v-line"}))}),We?T.a.createElement("li",null,T.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:qe},T.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,gt&&T.a.createElement("li",null,T.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(gt),onActionCallback:qe},T.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),T.a.createElement("li",{className:"btn-full-screen"},T.a.createElement(m,{icon:"".concat(ft?"icon-shrink":"icon-enlarge"),title:ft?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:qe})))},I=le("M8RZ"),z=le("+L6B"),Y=le("2/Rp"),ie=le("y8nQ"),G=le("Vl3Y"),j=le("5NDa"),oe=le("5rEg"),ye={labelCol:{span:4},wrapperCol:{span:20}},Ce=function(Ee){var ke=Ee.callback,We=Ee.onCancel;function qe(ft){ke(ft)}return T.a.createElement(G.a,Object(v.a)({},ye,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:qe}),T.a.createElement(G.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},T.a.createElement(oe.a,null)),T.a.createElement(G.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},T.a.createElement(oe.a,null)),T.a.createElement("div",{className:"flex-container flex-end"},T.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement(Y.a,{type:"ghost",onClick:We},"\u53D6\u6D88")))},De=le("7ahc"),Ye=le("HmJG"),Ie=le("BjJ7"),Ve=G.a.useForm,Ne={width:280,marginRight:10},Ue={labelCol:{span:5},wrapperCol:{span:19}},Ae=function(Ee){var ke=Ee.callback,We=Ee.onCancel,qe=Ve(),ft=Object(W.a)(qe,1),gt=ft[0];function Wt(ir){ke(ir)}function Ct(ir,zt){if(ir.status===-1){C.b.error(ir.message);return}gt.setFieldsValue({src:"/api/attachments/".concat(ir.id),type:zt.type})}function vt(ir){var zt=ir.target.files[0];A(zt,Ct)}return T.a.createElement(G.a,Object(v.a)({form:gt},Ue,{className:"upload-image-panel",onFinish:Wt}),T.a.createElement(G.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},T.a.createElement("div",{className:"flex-container"},T.a.createElement(G.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},T.a.createElement(oe.a,{style:Ne})),T.a.createElement(F,{onFileChange:vt}))),T.a.createElement(G.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},T.a.createElement(oe.a,{style:{width:264}})),T.a.createElement(G.a.Item,{style:{textAlign:"right"}},T.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement(Y.a,{type:"ghost",onClick:We},"\u53D6\u6D88")))};function F(Ee){var ke=Ee.onFileChange;return T.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",T.a.createElement("input",{type:"file",onChange:ke}))}function A(Ee,ke){if(!Ee)throw new String("\u6CA1\u6709\u6587\u4EF6");var We=new FormData;We.append("editormd-image-file",Ee),We.append("file_param_name","editormd-image-file"),We.append("byxhr","true");var qe=new window.XMLHttpRequest;qe.withCredentials=!0,qe.addEventListener("load",function(ft){ke(JSON.parse(ft.target.responseText),Ee)},!1),qe.addEventListener("error",function(ft){console.error(ft)},!1),qe.open("POST","".concat(Ie.a,"/api/attachments.json")),qe.send(We)}var D=le("giR+"),K=le("fyUT"),J=le("7Kak"),U=le("9yH6"),me=U.a.Group,Me={margin:"0 8px"},je=function(Ee){var ke=Ee.callback,We=Ee.onCancel;function qe(ft){ke(ft)}return T.a.createElement(G.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:qe},T.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},T.a.createElement("span",{style:Me},"\u5355\u5143\u683C\u6570\uFF1A"),T.a.createElement("span",{style:Me},"\u884C\u6570"),T.a.createElement(G.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},T.a.createElement(K.a,null)),T.a.createElement("span",{style:Me},"\u5217\u6570"),T.a.createElement(G.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},T.a.createElement(K.a,null))),T.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},T.a.createElement("span",{style:Me},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),T.a.createElement(G.a.Item,{name:"align"},T.a.createElement(me,null,T.a.createElement(U.a,{value:"default"},T.a.createElement("i",{className:"fa fa-align-justify"})),T.a.createElement(U.a,{value:"left"},T.a.createElement("i",{className:"fa fa-align-left"})),T.a.createElement(U.a,{value:"center"},T.a.createElement("i",{className:"fa fa-align-center"})),T.a.createElement(U.a,{value:"right"},T.a.createElement("i",{className:"fa fa-align-right"}))))),T.a.createElement("div",{className:"flex-container flex-end"},T.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement(Y.a,{type:"ghost",onClick:We},"\u53D6\u6D88")))},Xe=le("ErOA"),Be=le("7Cbv"),He="link",ze="upload-image",rt="code-block",it="add-table",lt="------------",et={default:lt,left:":".concat(lt),center:":".concat(lt,":"),right:"".concat(lt,":")},St=le("9VGf"),ut,ht;function Fe(){}var bt=0,mt=1e4,se="\u2581",Z=`
|
|
**\u6A21\u677F\u6807\u9898**
|
|
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function Q(Ee){return/^\d+$/.test(Ee)?"".concat(Ee,"px"):Ee}var ae=navigator.platform.toUpperCase().indexOf("MAC")>=0,ue=ae?"Cmd":"Ctrl",ee=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],ne=(ut={},Object(B.a)(ut,ue+"-B","bold"),Object(B.a)(ut,ue+"-I","italic"),ut),he=(ht={},Object(B.a)(ht,He,"\u6DFB\u52A0\u94FE\u63A5"),Object(B.a)(ht,rt,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(B.a)(ht,ze,"\u6DFB\u52A0\u6587\u4EF6"),Object(B.a)(ht,it,"\u6DFB\u52A0\u8868\u683C"),ht),pe=ct.a=function(Ee){var ke=Ee.defaultValue,We=ke===void 0?"":ke,qe=Ee.onChange,ft=Ee.width,gt=ft===void 0?"100%":ft,Wt=Ee.height,Ct=Wt===void 0?400:Wt,vt=Ee.miniToolbar,ir=vt===void 0?!1:vt,zt=Ee.isFocus,br=zt===void 0?!1:zt,vr=Ee.watch,It=Ee.insertTemp,Wr=Ee.mode,en=Wr===void 0?"markdown":Wr,Ir=Ee.id,an=Ir===void 0?"markdown-editor-id":Ir,un=Ee.showResizeBar,Kn=un===void 0?!1:un,Hr=Ee.noStorage,Bn=Hr===void 0?!1:Hr,ei=Ee.showNullButton,Sr=ei===void 0?!1:ei,dt=Ee.hidetoolBar,Jt=dt===void 0?!1:dt,Kr=Ee.fullScreen,Nt=Kr===void 0?!1:Kr,Pt=Ee.onBlur,or=Ee.onCMBeforeChange,vn=Ee.onFullScreen,kr=Ee.className,Qe=kr===void 0?"":kr,kt=Ee.disablePaste,zn=kt===void 0?!1:kt,fi=Ee.placeholder,wi=fi===void 0?"":fi,Gn=Ee.values,Ai=Gn===void 0?"":Gn,Rt=Object(y.useState)(null),la=Object(W.a)(Rt,2),tt=la[0],Vn=la[1],yn=Object(y.useState)(We),Ki=Object(W.a)(yn,2),pi=Ki[0],Dn=Ki[1],Li=Object(y.useState)(vr),zi=Object(W.a)(Li,2),An=zi[0],Gi=zi[1],ua=Object(y.useState)(Nt),Oi=Object(W.a)(ua,2),Mn=Oi[0],Vi=Oi[1],Pa=Object(y.useState)(""),Xi=Object(W.a)(Pa,2),Qr=Xi[0],ti=Xi[1],Ia=Object(y.useState)(0),ri=Object(W.a)(Ia,2),bn=ri[0],Yi=ri[1],Na=Object(y.useState)(Ct),da=Object(W.a)(Na,2),ca=da[0],ki=da[1],_n=Object(y.useState)(!1),$i=Object(W.a)(_n,2),Ua=$i[0],Qi=$i[1],ni=Object(y.useRef)(Object(Be.a)()),mi=Object(y.useRef)(!1),Fn=Object(y.useRef)(),jn=Object(y.useRef)(),Wn=Object(y.useRef)(),Xn=Object(y.useRef)(),gi=Object(y.useRef)(),ha=function(){var Et=Object(M.a)(R.a.mark(function _t(){var Tt,Gt;return R.a.wrap(function(dr){for(;;)switch(dr.prev=dr.next){case 0:return dr.next=2,Object(Xe.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:ni.current}});case 2:Gt=dr.sent,Gt!=null&&(Tt=Gt.attachments)!==null&&Tt!==void 0&&Tt.length&&(console.log("cm:",tt,jn),Gt.attachments.map(function(qt){qt.content_type.indexOf("image")>-1?tt.replaceSelection(".concat(qt.content_type,")")):qt.content_type.indexOf("video")>-1?tt.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):qt.content_type.indexOf("pdf")>-1?tt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(qt.id,"?type=").concat(qt.content_type,'&disposition=inline" target="_blank">').concat(qt.name,"</a>")):tt.replaceSelection("[".concat(qt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(qt.id,"?type=").concat(qt.content_type,")"))}));case 4:case"end":return dr.stop()}},_t)}));return function(){return Et.apply(this,arguments)}}();Object(y.useEffect)(function(){Dn(Ai),tt==null||tt.setValue(Ai)},[Ai]),Object(y.useEffect)(function(){vn==null||vn(Mn)},[Mn]),Object(y.useEffect)(function(){if(jn.current){var Et=O.a.fromTextArea(jn.current,{mode:en,lineNumbers:!ir,lineWrapping:!0,value:We,autoCloseTags:!0,autoCloseBrackets:!0});br&&Et.focus();function _t(Tt,Gt){if(zn){Gt.preventDefault();return}var rr=Gt.clipboardData;if(rr){var dr=rr.types.toString(),qt=rr.items;if(dr==="Files"||rr.types.indexOf("Files")>-1){if(Gt.preventDefault(),en=="stex")return;try{var Mr,cn=qt[1];((Mr=qt[0])===null||Mr===void 0?void 0:Mr.kind)==="file"&&(cn=qt[0]);var Xt=cn.getAsFile(),Yn=Xt.name.split(".").pop();A(Xt,function(sr){if(sr.id){var tn,Zr,On;(Xt==null||((tn=Xt.type)===null||tn===void 0)?void 0:tn.indexOf("image"))>-1?Et.replaceSelection(".concat(sr.content_type,")")):(Xt==null||((Zr=Xt.type)===null||Zr===void 0)?void 0:Zr.indexOf("video"))>-1?Et.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(sr.id,'"></video>')):(Xt==null||((On=Xt.type)===null||On===void 0)?void 0:On.indexOf("pdf"))>-1?Et.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(sr.id,"?type=").concat(Xt.type,'&disposition=inline" target="_blank">').concat(Xt.name,"</a>")):ee.includes(Yn)?Et.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(sr.id,'?type=office&disposition=inline" target="_blank">').concat(Xt.name,"</a>")):Et.replaceSelection("[".concat(Xt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(sr.id,"?type=").concat(sr.content_type,")"))}else(sr==null?void 0:sr.status)===401&&(document.location.href="/user/login")})}catch(sr){C.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return Et.on("paste",_t),Et.on("dragleave",function(Tt,Gt){Wn.current.classList.remove("mouse-hover-md")}),Et.on("dragover",function(Tt,Gt){Wn.current.classList.add("mouse-hover-md")}),Et.on("drop",function(Tt,Gt){Wn.current.classList.add("mouse-hover-md");var rr;if(rr=Gt.dataTransfer.files,rr.length>0){Gt.preventDefault(),Gt.stopPropagation();for(var dr=function(cn){var Xt=rr[cn],Yn=Xt.name.split(".").pop();A(Xt,function(sr){if(sr.id){var tn,Zr,On;(Xt==null||((tn=Xt.type)===null||tn===void 0)?void 0:tn.indexOf("image"))>-1?Et.replaceSelection(".concat(sr.content_type,")")):(Xt==null||((Zr=Xt.type)===null||Zr===void 0)?void 0:Zr.indexOf("video"))>-1?Et.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(sr.id,'"></video>')):(Xt==null||((On=Xt.type)===null||On===void 0)?void 0:On.indexOf("pdf"))>-1?Et.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(sr.id,"?type=").concat(Xt.type,'&disposition=inline" target="_blank">').concat(Xt.name,"</a>")):ee.includes(Yn)?Et.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(sr.id,'?type=office&disposition=inline" target="_blank">').concat(Xt.name,"</a>")):Et.replaceSelection("[".concat(Xt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(sr.id,"?type=").concat(sr.content_type,")"))}else(sr==null?void 0:sr.status)===401&&(document.location.href="/user/login")})},qt=0;qt<rr.length;qt++)dr(qt)}}),Vn(Et),function(){Et.off("paste",_t)}}},[]);var dn=Object(y.useCallback)(function(){if(Wn.current)try{}catch(Et){console.log(Et,"---- to set md editor body height")}},[ca,Wn,Mn]);Object(y.useEffect)(function(){function Et(){var Tt=new w.default(function(Gt){var rr=Object(k.a)(Gt),dr;try{for(rr.s();!(dr=rr.n()).done;){var qt=dr.value;(qt.target.offsetHeight>0||qt.target.offsetWidth>0)&&(dn(),tt.setSize("100%","100%"),tt.refresh())}}catch(Mr){rr.e(Mr)}finally{rr.f()}});return Tt.observe(jn.current.parentElement),Tt}if(tt){var _t=Et();return function(){_t.unobserve(jn.current.parentElement)}}},[tt,dn]),Object(y.useEffect)(function(){if(tt){for(var Et=[],_t=function(){var qt=Gt[Tt];rr=Object(W.a)(qt,2);var Mr=rr[0],cn=rr[1],Xt=Object(B.a)({},Mr,function(){fa(cn)});Et.push(Xt),tt.addKeyMap(Xt)},Tt=0,Gt=Object.entries(ne);Tt<Gt.length;Tt++){var rr;_t()}return Fn.current=setInterval(function(){mi.current&&ha()},4e3),function(){clearInterval(Fn.current);var dr=Object(k.a)(Et),qt;try{for(dr.s();!(qt=dr.n()).done;){var Mr=qt.value;tt.removeKeyMap(Mr)}}catch(cn){dr.e(cn)}finally{dr.f()}}}},[tt]),Object(y.useEffect)(function(){Nt!==Mn&&Vi(Nt)},[Nt]),Object(St.a)(function(){if(!Bn&&bn>0){var Et=new Date().getTime(),_t=window.sessionStorage.getItem(an);Et>=bn+mt&&(!_t||_t!==pi)&&(window.sessionStorage.setItem(an,pi),Qi(!0))}},mt),Object(y.useEffect)(function(){Gi(vr)},[tt,vr]),Object(y.useEffect)(function(){tt&&(br&&tt.focus())},[tt,br]),Object(y.useEffect)(function(){if(An&&tt){var Et=tt.getScrollerElement();function _t(Tt){var Gt=Tt.target;if(gi.current){var rr=Gt.scrollTop/Gt.scrollHeight;gi.current.scrollTop=gi.current.scrollHeight*rr}}return Et.addEventListener("scroll",_t),function(){Et.removeEventListener("scroll",_t)}}},[tt,An]),Object(y.useEffect)(function(){if(tt&&or){function Et(_t,Tt){or(_t,Tt)}return tt.on("beforeChange",Et),function(){tt.off("beforeChange",Et)}}},[tt,or]),Object(y.useEffect)(function(){if(tt&&Pt){function Et(){Pt(tt.getValue())}return tt.on("blur",Et),function(){tt.off("blur",Et)}}},[tt,Pt]),Object(y.useEffect)(function(){if(tt){function Et(_t){var Tt=_t.getValue();Dn(Tt),Yi(new Date().getTime()),_t.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),qe&&qe(Tt)}return tt.on("change",Et),function(){tt.off("change",Et)}}},[tt,qe]),Object(y.useEffect)(function(){tt&&(We==null?(tt.setValue(""),Dn("")):We!==tt.getValue()&&(tt.setValue(We),Dn(We),tt.setCursor(tt.lineCount(),0)))},[tt,We]);var fa=Object(y.useCallback)(function(Et){var _t=tt.getCursor(),Tt=tt.getSelection(),Gt=Tt.split(`
|
|
`);switch(Et){case"bold":return tt.replaceSelection("**"+Tt+"**"),Tt===""&&tt.setCursor(_t.line,_t.ch+2),tt.focus();case"italic":return tt.replaceSelection("*"+Tt+"*"),Tt===""&&tt.setCursor(_t.line,_t.ch+1),tt.focus();case"code":return tt.replaceSelection("`"+Tt+"`"),Tt===""&&tt.setCursor(_t.line,_t.ch+1),tt.focus();case"inline-latex":return tt.replaceSelection("`$$"+Tt+"$$`"),Tt===""&&tt.setCursor(_t.line,_t.ch+3),tt.focus();case"latex":return tt.replaceSelection("```latex\n"+Tt+"\n```"),tt.setCursor(_t.line+1,Tt.length+1),tt.focus();case"line-break":return tt.replaceSelection(`<br/>
|
|
`),tt.focus();case"list-ul":return Tt===""?tt.replaceSelection("- "+Tt):tt.replaceSelection(Gt.map(function(rr){return rr===""?"":"- ".concat(rr)}).join(`
|
|
`)),tt.focus();case"list-ol":return Tt===""?tt.replaceSelection("1. "+Tt):tt.replaceSelection(Gt.map(function(rr,dr){return rr===""?"":"".concat(dr+1,". ").concat(rr)}).join(`
|
|
`)),tt.focus();case"add-null-ch":return Tt===""&&tt.setCursor(_t.line,_t.ch+1),tt.replaceSelection(se),tt.focus();case"inster-template-1":return Tt===""&&tt.setCursor(_t.line,_t.ch),tt.replaceSelection(Z),tt.focus();case"eraser":return tt.setValue(""),tt.focus();case"trigger-watch":return Gi(!An),tt.focus();case"trigger-full-screen":return Vi(!Mn),tt.focus();case He:ti(He);return;case rt:ti(rt);return;case ze:ti(ze);return;case it:ti(it);return;default:throw new Error}},[tt,An,Mn]),Di=Object(y.useCallback)(function(Et){ti("");switch(Qr){case He:var _t=Et.title,Tt=Et.link;return tt.replaceSelection("[".concat(_t,"](").concat(Tt,")")),tt.focus();case rt:var Gt=Et.language,rr=Et.content;return tt.replaceSelection(["```"+Gt,rr,"```"].join(`
|
|
`)),tt.focus();case ze:var dr=Et.src,qt=Et.alt;return qt?tt.replaceSelection(".concat(dr,' "').concat(qt,'" )')):tt.replaceSelection("")),tt.focus();case it:for(var Mr=Et.row,cn=Et.col,Xt=Et.align,Yn=`
|
|
`,sr=0;sr<Mr;sr++){for(var tn=[],Zr=[],On=0;On<cn;On++)sr===1&&Zr.push(et[Xt]),tn.push(" ");sr===1&&(Yn+="| ".concat(Zr.join(" | "),` |
|
|
`)),Yn+="| ".concat(tn.join(cn===1?"":" | "),` |
|
|
`)}return tt.replaceSelection(Yn+`
|
|
`),tt.focus();default:throw new Error}},[tt,Qr]),ii=Object(y.useMemo)(function(){switch(Qr){case He:return T.a.createElement(Ce,{callback:Di,onCancel:xn});case rt:return T.a.createElement(De.b,{callback:Di,onCancel:xn});case ze:return T.a.createElement(Ae,{callback:Di,onCancel:xn});case it:return T.a.createElement(je,{callback:Di,onCancel:xn});default:return null}},[Qr]);function xn(){ti("")}Object(y.useEffect)(function(){if(Xn.current){var Et=Xn.current,_t=!1,Tt=0;function Gt(qt){_t=!0,Tt=qt.pageY}function rr(){_t=!1}function dr(qt){if(_t){var Mr=qt.pageY-Tt;Mr<0&&(Mr=0),Mr>300&&(Mr=300);var cn=Ct+Mr+"px";ki(cn)}}return Et.addEventListener("mousedown",Gt),document.addEventListener("mousemove",dr),document.addEventListener("mouseup",rr),function(){Et.removeEventListener("mousedown",Gt),document.removeEventListener("mousemove",dr),document.removeEventListener("mouseup",rr)}}},[tt,Xn]),Object(y.useEffect)(function(){ki(Ct)},[Ct]);var En=Q(gt),Zi=Q(ca),Ln={width:En,height:Zi},Ji=Object(y.useMemo)(function(){if(bn){var Et=new Date(bn),_t=Et.getHours(),Tt=Et.getMinutes(),Gt=Et.getSeconds();return _t=_t<10?"0"+_t:_t,Tt=Tt<10?"0"+Tt:Tt,Gt=Gt<10?"0"+Gt:Gt,"".concat(_t,":").concat(Tt,":").concat(Gt)}return 0},[bn]);function qi(){window.sessionStorage.removeItem(an),Qi(!1),Yi(0)}function vi(){Qi(!1),Yi(0),tt.setValue(window.sessionStorage.getItem(an))}function Ba(Et,_t){var Tt=tt.getValue();Tt=Tt.replace(Et,_t),Dn(Tt),tt==null||tt.setValue(Tt)}return T.a.createElement(y.Fragment,null,T.a.createElement("div",{className:"markdown-editor-wrapper",ref:Wn},T.a.createElement("div",{className:"markdown-editor-container ".concat(Qe," ").concat(An?"on-preview":""," ").concat(ir?"mini":""," ").concat(Mn?"full-screen":""),style:Ln},T.a.createElement(S,{insertTemp:It,watch:An,fullScreen:Mn,showNullButton:Sr,onActionCallback:fa,hidetoolBar:Jt,uuid:ni.current,setOpenPhones:function(){mi.current=!0}}),T.a.createElement("div",{className:"markdown-editor-body"},T.a.createElement("div",{className:"codemirror-container"},T.a.createElement("textarea",{ref:jn,placeholder:wi})),An?T.a.createElement("div",{ref:gi,className:"preview-container"},en==="stex"&&T.a.createElement(L,{value:pi}),en!=="stex"&&T.a.createElement(h.a,{edit:!0,value:pi,replaces:Ba})):null))),Kn?T.a.createElement("a",{ref:Xn,className:"editor-resize"}):null,T.a.createElement(I.a,null,he[Qr]?T.a.createElement(X.a,{centered:!0,title:he[Qr],visible:!0,onCancel:xn,footer:null,className:"markdown-popup-form"},ii):null))}},SJMd:function(Ot,ct){/**
|
|
* @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 le,de,X,k=!1,H,C;window.PR_SHOULD_USE_CONTINUATION=!0;var M,W;(function(){var B=window,P=["break,continue,do,else,for,if,return,while"],R=[P,"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"],y=[R,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],T=[y,"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"],_=[y,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],O=[y,"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"],w="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",g=[y,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],u="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[P,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],s=[P,"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"],l=[P,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],b=[T,O,_,g,u,o,s,l],p=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,h="str",L="kwd",v="com",c="typ",f="lit",d="pun",a="pln",x="tag",m="dec",S="src",I="atn",z="atv",Y="nocode",ie="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function G(me){for(var Me=0,je=!1,Xe=!1,Be=0,He=me.length;Be<He;++Be){var ze=me[Be];if(ze.ignoreCase)Xe=!0;else if(/[a-z]/i.test(ze.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){je=!0,Xe=!1;break}}var rt={b:8,t:9,n:10,v:11,f:12,r:13};function it(ht){var Fe=ht.charCodeAt(0);if(Fe!==92)return Fe;var bt=ht.charAt(1);return Fe=rt[bt],Fe||("0"<=bt&&bt<="7"?parseInt(ht.substring(1),8):bt==="u"||bt==="x"?parseInt(ht.substring(2),16):ht.charCodeAt(1))}function lt(ht){if(ht<32)return(ht<16?"\\x0":"\\x")+ht.toString(16);var Fe=String.fromCharCode(ht);return Fe==="\\"||Fe==="-"||Fe==="]"||Fe==="^"?"\\"+Fe:Fe}function et(ht){var Fe=ht.substring(1,ht.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")),bt=[],mt=Fe[0]==="^",se=["["];mt&&se.push("^");for(var Z=mt?1:0,Q=Fe.length;Z<Q;++Z){var ae=Fe[Z];if(/\\[bdsw]/i.test(ae))se.push(ae);else{var ue=it(ae),ee;Z+2<Q&&Fe[Z+1]==="-"?(ee=it(Fe[Z+2]),Z+=2):ee=ue,bt.push([ue,ee]),ee<65||ue>122||(ee<65||ue>90||bt.push([Math.max(65,ue)|32,Math.min(ee,90)|32]),ee<97||ue>122||bt.push([Math.max(97,ue)&~32,Math.min(ee,122)&~32]))}}bt.sort(function(Ee,ke){return Ee[0]-ke[0]||ke[1]-Ee[1]});for(var ne=[],he=[],Z=0;Z<bt.length;++Z){var pe=bt[Z];pe[0]<=he[1]+1?he[1]=Math.max(he[1],pe[1]):ne.push(he=pe)}for(var Z=0;Z<ne.length;++Z){var pe=ne[Z];se.push(lt(pe[0])),pe[1]>pe[0]&&(pe[1]+1>pe[0]&&se.push("-"),se.push(lt(pe[1])))}return se.push("]"),se.join("")}function St(ht){for(var Fe=ht.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")),bt=Fe.length,mt=[],se=0,Z=0;se<bt;++se){var Q=Fe[se];if(Q==="(")++Z;else if(Q.charAt(0)==="\\"){var ae=+Q.substring(1);ae&&(ae<=Z?mt[ae]=-1:Fe[se]=lt(ae))}}for(var se=1;se<mt.length;++se)mt[se]===-1&&(mt[se]=++Me);for(var se=0,Z=0;se<bt;++se){var Q=Fe[se];if(Q==="(")++Z,mt[Z]||(Fe[se]="(?:");else if(Q.charAt(0)==="\\"){var ae=+Q.substring(1);ae&&ae<=Z&&(Fe[se]="\\"+mt[ae])}}for(var se=0;se<bt;++se)Fe[se]==="^"&&Fe[se+1]!=="^"&&(Fe[se]="");if(ht.ignoreCase&&je)for(var se=0;se<bt;++se){var Q=Fe[se],ue=Q.charAt(0);Q.length>=2&&ue==="["?Fe[se]=et(Q):ue!=="\\"&&(Fe[se]=Q.replace(/[a-zA-Z]/g,function(he){var pe=he.charCodeAt(0);return"["+String.fromCharCode(pe&~32,pe|32)+"]"}))}return Fe.join("")}for(var ut=[],Be=0,He=me.length;Be<He;++Be){var ze=me[Be];if(ze.global||ze.multiline)throw new Error(""+ze);ut.push("(?:"+St(ze)+")")}return new RegExp(ut.join("|"),Xe?"gi":"g")}function j(me,Me){var je=/(?:^|\s)nocode(?:\s|$)/,Xe=[],Be=0,He=[],ze=0;function rt(it){var lt=it.nodeType;if(lt==1){if(je.test(it.className))return;for(var et=it.firstChild;et;et=et.nextSibling)rt(et);var St=it.nodeName.toLowerCase();(St==="br"||St==="li")&&(Xe[ze]=`
|
|
`,He[ze<<1]=Be++,He[ze++<<1|1]=it)}else if(lt==3||lt==4){var ut=it.nodeValue;ut.length&&(Me?ut=ut.replace(/\r\n?/g,`
|
|
`):ut=ut.replace(/[ \t\r\n]+/g," "),Xe[ze]=ut,He[ze<<1]=Be,Be+=ut.length,He[ze++<<1|1]=it)}}return rt(me),{sourceCode:Xe.join("").replace(/\n$/,""),spans:He}}function oe(me,Me,je,Xe,Be){if(!je)return;var He={sourceNode:me,pre:1,langExtension:null,numberLines:null,sourceCode:je,spans:null,basePos:Me,decorations:null};Xe(He),Be.push.apply(Be,He.decorations)}var ye=/\S/;function Ce(me){for(var Me=void 0,je=me.firstChild;je;je=je.nextSibling){var Xe=je.nodeType;Me=Xe===1?Me?me:je:Xe===3&&ye.test(je.nodeValue)?me:Me}return Me===me?void 0:Me}function De(me,Me){var je={},Xe;(function(){for(var ze=me.concat(Me),rt=[],it={},lt=0,et=ze.length;lt<et;++lt){var St=ze[lt],ut=St[3];if(ut)for(var ht=ut.length;--ht>=0;)je[ut.charAt(ht)]=St;var Fe=St[1],bt=""+Fe;it.hasOwnProperty(bt)||(rt.push(Fe),it[bt]=null)}rt.push(/[\0-\uffff]/),Xe=G(rt)})();var Be=Me.length,He=function(ze){for(var rt=ze.sourceCode,it=ze.basePos,lt=ze.sourceNode,et=[it,a],St=0,ut=rt.match(Xe)||[],ht={},Fe=0,bt=ut.length;Fe<bt;++Fe){var mt=ut[Fe],se=ht[mt],Z=void 0,Q;if(typeof se=="string")Q=!1;else{var ae=je[mt.charAt(0)];if(ae)Z=mt.match(ae[1]),se=ae[0];else{for(var ue=0;ue<Be;++ue)if(ae=Me[ue],Z=mt.match(ae[1]),Z){se=ae[0];break}Z||(se=a)}Q=se.length>=5&&se.substring(0,5)==="lang-",Q&&!(Z&&typeof Z[1]=="string")&&(Q=!1,se=S),Q||(ht[mt]=se)}var ee=St;if(St+=mt.length,!Q)et.push(it+ee,se);else{var ne=Z[1],he=mt.indexOf(ne),pe=he+ne.length;Z[2]&&(pe=mt.length-Z[2].length,he=pe-ne.length);var Ee=se.substring(5);oe(lt,it+ee,mt.substring(0,he),He,et),oe(lt,it+ee+he,ne,F(Ee,ne),et),oe(lt,it+ee+pe,mt.substring(pe),He,et)}}ze.decorations=et};return He}function Ye(me){var Me=[],je=[];me.tripleQuotedStrings?Me.push([h,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):me.multiLineStrings?Me.push([h,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Me.push([h,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),me.verbatimStrings&&je.push([h,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Xe=me.hashComments;Xe&&(me.cStyleComments?(Xe>1?Me.push([v,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Me.push([v,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),je.push([h,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Me.push([v,/^#[^\r\n]*/,null,"#"])),me.cStyleComments&&(je.push([v,/^\/\/[^\r\n]*/,null]),je.push([v,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Be=me.regexLiterals;if(Be){var He=Be>1?"":`
|
|
\r`,ze=He?".":"[\\S\\s]",rt="/(?=[^/*"+He+"])(?:[^/\\x5B\\x5C"+He+"]|\\x5C"+ze+"|\\x5B(?:[^\\x5C\\x5D"+He+"]|\\x5C"+ze+")*(?:\\x5D|$))+/";je.push(["lang-regex",RegExp("^"+ie+"("+rt+")")])}var it=me.types;it&&je.push([c,it]);var lt=(""+me.keywords).replace(/^ | $/g,"");lt.length&&je.push([L,new RegExp("^(?:"+lt.replace(/[\s,]+/g,"|")+")\\b"),null]),Me.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var et="^.[^\\s\\w.$@'\"`/\\\\]*";return me.regexLiterals&&(et+="(?!s*/)"),je.push([f,/^@[a-z_$][a-z_$@0-9]*/i,null],[c,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[f,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[d,new RegExp(et),null]),De(Me,je)}var Ie=Ye({keywords:b,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ve(me,Me,je){for(var Xe=/(?:^|\s)nocode(?:\s|$)/,Be=/\r\n?|\n/,He=me.ownerDocument,ze=He.createElement("li");me.firstChild;)ze.appendChild(me.firstChild);var rt=[ze];function it(Fe){var bt=Fe.nodeType;if(bt==1&&!Xe.test(Fe.className))if(Fe.nodeName==="br")lt(Fe),Fe.parentNode&&Fe.parentNode.removeChild(Fe);else for(var mt=Fe.firstChild;mt;mt=mt.nextSibling)it(mt);else if((bt==3||bt==4)&&je){var se=Fe.nodeValue,Z=se.match(Be);if(Z){var Q=se.substring(0,Z.index);Fe.nodeValue=Q;var ae=se.substring(Z.index+Z[0].length);if(ae){var ue=Fe.parentNode;ue.insertBefore(He.createTextNode(ae),Fe.nextSibling)}lt(Fe),Q||Fe.parentNode.removeChild(Fe)}}}function lt(Fe){for(;!Fe.nextSibling;)if(Fe=Fe.parentNode,!Fe)return;function bt(Z,Q){var ae=Q?Z.cloneNode(!1):Z,ue=Z.parentNode;if(ue){var ee=bt(ue,1),ne=Z.nextSibling;ee.appendChild(ae);for(var he=ne;he;he=ne)ne=he.nextSibling,ee.appendChild(he)}return ae}for(var mt=bt(Fe.nextSibling,0),se;(se=mt.parentNode)&&se.nodeType===1;)mt=se;rt.push(mt)}for(var et=0;et<rt.length;++et)it(rt[et]);Me===(Me|0)&&rt[0].setAttribute("value",Me);var St=He.createElement("ol");St.className="linenums";for(var ut=Math.max(0,Me-1|0)||0,et=0,ht=rt.length;et<ht;++et)ze=rt[et],ze.className="L"+(et+ut)%10,ze.firstChild||ze.appendChild(He.createTextNode("\xA0")),St.appendChild(ze);me.appendChild(St)}function Ne(me){var Me=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Me=Me&&+Me[1]<=8;var je=/\n/g,Xe=me.sourceCode,Be=Xe.length,He=0,ze=me.spans,rt=ze.length,it=0,lt=me.decorations,et=lt.length,St=0;lt[et]=Be;var ut,ht;for(ht=ut=0;ht<et;)lt[ht]!==lt[ht+2]?(lt[ut++]=lt[ht++],lt[ut++]=lt[ht++]):ht+=2;for(et=ut,ht=ut=0;ht<et;){for(var Fe=lt[ht],bt=lt[ht+1],mt=ht+2;mt+2<=et&<[mt+1]===bt;)mt+=2;lt[ut++]=Fe,lt[ut++]=bt,ht=mt}et=lt.length=ut;var se=me.sourceNode,Z="";se&&(Z=se.style.display,se.style.display="none");try{for(var Q=null;it<rt;){var ae=ze[it],ue=ze[it+2]||Be,ee=lt[St+2]||Be,mt=Math.min(ue,ee),ne=ze[it+1],he;if(ne.nodeType!==1&&(he=Xe.substring(He,mt))){Me&&(he=he.replace(je,"\r")),ne.nodeValue=he;var pe=ne.ownerDocument,Ee=pe.createElement("span");Ee.className=lt[St+1];var ke=ne.parentNode;ke.replaceChild(Ee,ne),Ee.appendChild(ne),He<ue&&(ze[it+1]=ne=pe.createTextNode(Xe.substring(mt,ue)),ke.insertBefore(ne,Ee.nextSibling))}He=mt,He>=ue&&(it+=2),He>=ee&&(St+=2)}}finally{se&&(se.style.display=Z)}}var Ue={};function Ae(me,Me){for(var je=Me.length;--je>=0;){var Xe=Me[je];Ue.hasOwnProperty(Xe)?B.console&&console.warn("cannot override language handler %s",Xe):Ue[Xe]=me}}function F(me,Me){return me&&Ue.hasOwnProperty(me)||(me=/^\s*</.test(Me)?"default-markup":"default-code"),Ue[me]}Ae(Ie,["default-code"]),Ae(De([],[[a,/^[^<?]+/],[m,/^<!\w[^>]*(?:>|$)/],[v,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[d,/^(?:<[%?]|[%?]>)/],["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(De([[a,/^[\s]+/,null,` \r
|
|
`],[z,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[x,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[I,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[d,/^[=<>\/]+/],["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(De([],[[z,/^[\s\S]+/]]),["uq.val"]),Ae(Ye({keywords:T,hashComments:!0,cStyleComments:!0,types:p}),["c","cc","cpp","cxx","cyc","m"]),Ae(Ye({keywords:"null,true,false"}),["json"]),Ae(Ye({keywords:O,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:p}),["cs"]),Ae(Ye({keywords:_,cStyleComments:!0}),["java"]),Ae(Ye({keywords:l,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),Ae(Ye({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),Ae(Ye({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),Ae(Ye({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),Ae(Ye({keywords:g,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),Ae(Ye({keywords:w,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),Ae(De([],[[h,/^[\s\S]+/]]),["regex"]);function A(me){var Me=me.langExtension;try{var je=j(me.sourceNode,me.pre),Xe=je.sourceCode;me.sourceCode=Xe,me.spans=je.spans,me.basePos=0,F(Me,Xe)(me),Ne(me)}catch(Be){B.console&&console.log(Be&&Be.stack||Be)}}function D(me,Me,je){var Xe=je||!1,Be=Me||null,He=document.createElement("div");He.innerHTML="<pre>"+me+"</pre>",He=He.firstChild,Xe&&Ve(He,Xe,!0);var ze={langExtension:Be,numberLines:Xe,sourceNode:He,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return A(ze),He.innerHTML}function K(me,Me){var je=Me||document.body,Xe=je.ownerDocument||document;function Be(ae){return je.getElementsByTagName(ae)}for(var He=[Be("pre"),Be("code"),Be("xmp")],ze=[],rt=0;rt<He.length;++rt)for(var it=0,lt=He[rt].length;it<lt;++it)ze.push(He[rt][it]);He=null;var et=Date;et.now||(et={now:function(){return+new Date}});var St=0,ut=/\blang(?:uage)?-([\w.]+)(?!\S)/,ht=/\bprettyprint\b/,Fe=/\bprettyprinted\b/,bt=/pre|xmp/i,mt=/^code$/i,se=/^(?:pre|code|xmp)$/i,Z={};function Q(){for(var ae=B.PR_SHOULD_USE_CONTINUATION?et.now()+250:Infinity;St<ze.length&&et.now()<ae;St++){for(var ue=ze[St],ee=Z,ne=ue;ne=ne.previousSibling;){var he=ne.nodeType,pe=(he===7||he===8)&&ne.nodeValue;if(pe?!/^\??prettify\b/.test(pe):he!==3||/\S/.test(ne.nodeValue))break;if(pe){ee={},pe.replace(/\b(\w+)=([\w:.%+-]+)/g,function(vr,It,Wr){ee[It]=Wr});break}}var Ee=ue.className;if((ee!==Z||ht.test(Ee))&&!Fe.test(Ee)){for(var ke=!1,We=ue.parentNode;We;We=We.parentNode){var qe=We.tagName;if(se.test(qe)&&We.className&&ht.test(We.className)){ke=!0;break}}if(!ke){ue.className+=" prettyprinted";var ft=ee.lang;if(!ft){ft=Ee.match(ut);var gt;!ft&&(gt=Ce(ue))&&mt.test(gt.tagName)&&(ft=gt.className.match(ut)),ft&&(ft=ft[1])}var Wt;if(bt.test(ue.tagName))Wt=1;else{var Ct=ue.currentStyle,vt=Xe.defaultView,ir=Ct?Ct.whiteSpace:vt&&vt.getComputedStyle?vt.getComputedStyle(ue,null).getPropertyValue("white-space"):0;Wt=ir&&ir.substring(0,3)==="pre"}var zt=ee.linenums;(zt=zt==="true"||+zt)||(zt=Ee.match(/\blinenums\b(?::(\d+))?/),zt=zt?zt[1]&&zt[1].length?+zt[1]:!0:!1),zt&&Ve(ue,zt,Wt);var br={langExtension:ft,sourceNode:ue,numberLines:zt,pre:Wt,sourceCode:null,basePos:null,spans:null,decorations:null};A(br)}}}St<ze.length?B.setTimeout(Q,250):typeof me=="function"&&me()}Q()}var J=B.PR={createSimpleLexer:De,registerLangHandler:Ae,sourceDecorator:Ye,PR_ATTRIB_NAME:I,PR_ATTRIB_VALUE:z,PR_COMMENT:v,PR_DECLARATION:m,PR_KEYWORD:L,PR_LITERAL:f,PR_NOCODE:Y,PR_PLAIN:a,PR_PUNCTUATION:d,PR_SOURCE:S,PR_STRING:h,PR_TAG:x,PR_TYPE:c,prettyPrintOne:k?B.prettyPrintOne=D:M=D,prettyPrint:W=k?B.prettyPrint=K:W=K},U=B.define;typeof U=="function"&&U.amd&&U("google-code-prettify",[],function(){return J})})()},STEk:function(Ot,ct,le){"use strict";le.d(ct,"a",function(){return Ae});/*! *****************************************************************************
|
|
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 de=function(F,A){return(de=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(D,K){D.__proto__=K}||function(D,K){for(var J in K)Object.prototype.hasOwnProperty.call(K,J)&&(D[J]=K[J])})(F,A)};function X(F,A){function D(){this.constructor=F}de(F,A),F.prototype=A===null?Object.create(A):(D.prototype=A.prototype,new D)}function k(F,A,D,K){return new(D||(D=Promise))(function(J,U){function me(Xe){try{je(K.next(Xe))}catch(Be){U(Be)}}function Me(Xe){try{je(K.throw(Xe))}catch(Be){U(Be)}}function je(Xe){var Be;Xe.done?J(Xe.value):(Be=Xe.value,Be instanceof D?Be:new D(function(He){He(Be)})).then(me,Me)}je((K=K.apply(F,A||[])).next())})}function H(F,A){var D,K,J,U,me={label:0,sent:function(){if(1&J[0])throw J[1];return J[1]},trys:[],ops:[]};return U={next:Me(0),throw:Me(1),return:Me(2)},typeof Symbol=="function"&&(U[Symbol.iterator]=function(){return this}),U;function Me(je){return function(Xe){return function(Be){if(D)throw new TypeError("Generator is already executing.");for(;me;)try{if(D=1,K&&(J=2&Be[0]?K.return:Be[0]?K.throw||((J=K.return)&&J.call(K),0):K.next)&&!(J=J.call(K,Be[1])).done)return J;switch(K=0,J&&(Be=[2&Be[0],J.value]),Be[0]){case 0:case 1:J=Be;break;case 4:return me.label++,{value:Be[1],done:!1};case 5:me.label++,K=Be[1],Be=[0];continue;case 7:Be=me.ops.pop(),me.trys.pop();continue;default:if(!(J=me.trys,(J=J.length>0&&J[J.length-1])||Be[0]!==6&&Be[0]!==2)){me=0;continue}if(Be[0]===3&&(!J||Be[1]>J[0]&&Be[1]<J[3])){me.label=Be[1];break}if(Be[0]===6&&me.label<J[1]){me.label=J[1],J=Be;break}if(J&&me.label<J[2]){me.label=J[2],me.ops.push(Be);break}J[2]&&me.ops.pop(),me.trys.pop();continue}Be=A.call(F,me)}catch(He){Be=[6,He],K=0}finally{D=J=0}if(5&Be[0])throw Be[1];return{value:Be[0]?Be[1]:void 0,done:!0}}([je,Xe])}}}function C(){for(var F=0,A=0,D=arguments.length;A<D;A++)F+=arguments[A].length;var K=Array(F),J=0;for(A=0;A<D;A++)for(var U=arguments[A],me=0,Me=U.length;me<Me;me++,J++)K[J]=U[me];return K}var M=function(){function F(){}return F.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},F.setAttributes=function(A,D){for(var K=0,J=D;K<J.length;K++){var U=J[K],me=U[0],Me=U[1];A.setAttribute(me,Me)}},F.createRect=function(A,D,K){var J=document.createElementNS("http://www.w3.org/2000/svg","rect");return J.setAttribute("width",A.toString()),J.setAttribute("height",D.toString()),K&&F.setAttributes(J,K),J},F.createLine=function(A,D,K,J,U){var me=document.createElementNS("http://www.w3.org/2000/svg","line");return me.setAttribute("x1",A.toString()),me.setAttribute("y1",D.toString()),me.setAttribute("x2",K.toString()),me.setAttribute("y2",J.toString()),U&&F.setAttributes(me,U),me},F.createPolygon=function(A,D){var K=document.createElementNS("http://www.w3.org/2000/svg","polygon");return K.setAttribute("points",A),D&&F.setAttributes(K,D),K},F.createCircle=function(A,D){var K=document.createElementNS("http://www.w3.org/2000/svg","circle");return K.setAttribute("cx",(A/2).toString()),K.setAttribute("cy",(A/2).toString()),K.setAttribute("r",A.toString()),D&&F.setAttributes(K,D),K},F.createEllipse=function(A,D,K){var J=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return J.setAttribute("cx",(A/2).toString()),J.setAttribute("cy",(D/2).toString()),J.setAttribute("rx",(A/2).toString()),J.setAttribute("ry",(D/2).toString()),K&&F.setAttributes(J,K),J},F.createGroup=function(A){var D=document.createElementNS("http://www.w3.org/2000/svg","g");return A&&F.setAttributes(D,A),D},F.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},F.createMarker=function(A,D,K,J,U,me,Me){var je=document.createElementNS("http://www.w3.org/2000/svg","marker");return F.setAttributes(je,[["id",A],["orient",D],["markerWidth",K.toString()],["markerHeight",J.toString()],["refX",U.toString()],["refY",me.toString()]]),je.appendChild(Me),je},F.createText=function(A){var D=document.createElementNS("http://www.w3.org/2000/svg","text");return D.setAttribute("x","0"),D.setAttribute("y","0"),A&&F.setAttributes(D,A),D},F.createTSpan=function(A,D){var K=document.createElementNS("http://www.w3.org/2000/svg","tspan");return K.textContent=A,D&&F.setAttributes(K,D),K},F.createImage=function(A){var D=document.createElementNS("http://www.w3.org/2000/svg","image");return A&&F.setAttributes(D,A),D},F.createPoint=function(A,D){var K=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return K.x=A,K.y=D,K},F.createPath=function(A,D){var K=document.createElementNS("http://www.w3.org/2000/svg","path");return K.setAttribute("d",A),D&&F.setAttributes(K,D),K},F}(),W=function(){function F(){}return F.addKey=function(A){F.key=A},Object.defineProperty(F,"isLicensed",{get:function(){return!!F.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(F.key)},enumerable:!1,configurable:!0}),F}(),B=function(){function F(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return F.prototype.rasterize=function(A,D,K){var J=this;return new Promise(function(U){var me=K!==void 0?K:document.createElement("canvas");A===null&&(J.markersOnly=!0,J.naturalSize=!1);var Me=document.createElementNS("http://www.w3.org/2000/svg","svg");Me.setAttribute("xmlns","http://www.w3.org/2000/svg"),Me.setAttribute("width",D.width.baseVal.valueAsString),Me.setAttribute("height",D.height.baseVal.valueAsString),Me.setAttribute("viewBox","0 0 "+D.viewBox.baseVal.width.toString()+" "+D.viewBox.baseVal.height.toString()),Me.innerHTML=D.innerHTML,J.naturalSize===!0?(Me.width.baseVal.value=A.naturalWidth,Me.height.baseVal.value=A.naturalHeight):J.width!==void 0&&J.height!==void 0&&(Me.width.baseVal.value=J.width,Me.height.baseVal.value=J.height),me.width=Me.width.baseVal.value,me.height=Me.height.baseVal.value;var je=Me.outerHTML,Xe=me.getContext("2d");J.markersOnly!==!0&&Xe.drawImage(A,0,0,me.width,me.height);var Be=window.URL,He=new Image(me.width,me.height);He.setAttribute("crossOrigin","anonymous");var ze=new Blob([je],{type:"image/svg+xml"}),rt=Be.createObjectURL(ze);He.onload=function(){Xe.drawImage(He,0,0),Be.revokeObjectURL(rt);var it=me.toDataURL(J.imageType,J.imageQuality);U(it)},He.src=rt})},F}(),P=function(){},R=function(){function F(A){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+A+"_"}return Object.defineProperty(F.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(F.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(F.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),F.prototype.addClass=function(A){return this.styleSheet===void 0&&this.addStyleSheet(),A.name=""+this.classNamePrefix+A.localName,this.classes.push(A),this.styleSheet.sheet.insertRule("."+A.name+" {"+A.style+"}",this.styleSheet.sheet.cssRules.length),A},F.prototype.addRule=function(A){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(A),this.styleSheet.sheet.insertRule(A.selector+" {"+A.style+"}",this.styleSheet.sheet.cssRules.length)},F.prototype.addStyleSheet=function(){var A;this.styleSheet=document.createElement("style"),((A=this.styleSheetRoot)!==null&&A!==void 0?A:document.head).appendChild(this.styleSheet),this.addRule(new y("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new y("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new y("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new T("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new T("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},F.prototype.removeStyleSheet=function(){var A;this.styleSheet&&(((A=this.styleSheetRoot)!==null&&A!==void 0?A:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},F}(),y=function(F,A){this.selector=F,this.style=A},T=function(F,A){this.localName=F,this.style=A},_=function(){function F(A,D,K,J,U){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=A,this.displayMode=D,this.markerItems=K,this.uiStyleSettings=J,this.styles=U,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return F.prototype.show=function(A){var D=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=A,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var K=document.createElement("div");K.className=this.toolbarBlockStyleClass.name,K.style.whiteSpace="nowrap",this.uiContainer.appendChild(K),this.addActionButton(K,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(K,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(K,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(K,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(K,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(K,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(K,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(K,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(U){var me=document.createElement("div");me.className=""+D.toolbarButtonStyleClass.name,me.setAttribute("data-type-name",U.typeName),me.innerHTML=U.icon,me.addEventListener("click",function(){D.markerToolbarButtonClicked(me,U)}),D.buttons.push(me),D.markerButtons.push(me)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var J=document.createElement("div");J.className=this.toolbarBlockStyleClass.name,J.style.whiteSpace="nowrap",J.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(J),this.addActionButton(J,'<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(J,'<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()},F.prototype.addButtonClickListener=function(A){this.buttonClickListeners.push(A)},F.prototype.removeButtonClickListener=function(A){this.buttonClickListeners.indexOf(A)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(A),1)},F.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},F.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var A=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var D=0;D<this.markerButtons.length;D++)D<A||D===A&&this.markerButtons.length-1===A?this.markerButtonBlock.appendChild(this.markerButtons[D]):(D===A&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[D]))}},F.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")},F.prototype.resetButtonStyles=function(){var A=this;this.buttons.forEach(function(D){D.className=D.className.replace(A.uiStyleSettings.toolbarButtonStyleColorsClassName?A.uiStyleSettings.toolbarButtonStyleColorsClassName:A.toolbarButtonStyleColorsClass.name,"").trim(),D.className=D.className.replace(A.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?A.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:A.toolbarActiveButtonStyleColorsClass.name,"").trim(),D.className+=" "+(A.uiStyleSettings.toolbarButtonStyleColorsClassName?A.uiStyleSettings.toolbarButtonStyleColorsClassName:A.toolbarButtonStyleColorsClass.name)})},F.prototype.addActionButton=function(A,D,K){var J=this,U=document.createElement("div");switch(U.className=""+this.toolbarButtonStyleClass.name,U.innerHTML=D,U.setAttribute("data-action",K),U.addEventListener("click",function(){J.actionToolbarButtonClicked(U,K)}),K){case"select":U.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":U.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":U.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":U.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":U.style.fill=this.uiStyleSettings.closeButtonColor}A.appendChild(U),this.buttons.push(U)},F.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new T("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 T("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new T("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new T("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 T("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var A=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new T("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*A)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*A)+`px;
|
|
padding: `+A+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new T("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new T("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new y("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new y("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},F.prototype.markerToolbarButtonClicked=function(A,D){this.setActiveButton(A),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(K){return K("marker",D)}),this.markerButtonOverflowBlock.style.display="none"},F.prototype.actionToolbarButtonClicked=function(A,D){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(K){return K("action",D)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},F.prototype.setActiveButton=function(A){this.resetButtonStyles(),A.className=A.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),A.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},F.prototype.setActiveMarkerButton=function(A){var D=this.markerButtons.find(function(K){return K.getAttribute("data-type-name")===A});D&&this.setActiveButton(D)},F.prototype.setCurrentMarker=function(A){var D=this;this.currentMarker=A,this.buttons.filter(function(K){return/delete|notes/.test(K.getAttribute("data-action"))}).forEach(function(K){D.currentMarker===void 0?(K.style.fillOpacity="0.4",K.style.pointerEvents="none"):(K.style.fillOpacity="1",K.style.pointerEvents="all")})},F}(),O=function(){function F(A,D,K,J){this.panels=[],this.panelButtons=[],this.markerjsContainer=A,this.displayMode=D,this.uiStyleSettings=K,this.styles=J,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return F.prototype.addStyles=function(){var A;this.toolboxStyleClass=this.styles.addClass(new T("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 T("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var D=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new T("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new T("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new T("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 T("toolbox-panel-row_colors",`
|
|
background-color: `+((A=this.uiStyleSettings.toolboxBackgroundColor)!==null&&A!==void 0?A:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new T("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*D)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*D)+`px;
|
|
padding: `+D+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new T("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new T("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new y("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new y("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},F.prototype.show=function(A){var D;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=A,this.uiContainer.className=this.toolboxStyleClass.name+" "+((D=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&D!==void 0?D:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},F.prototype.setPanelButtons=function(A){var D,K,J=this;this.panels=A,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((D=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&D!==void 0?D:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((K=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&K!==void 0?K:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(U){var me;U.uiStyleSettings=J.uiStyleSettings;var Me=document.createElement("div");Me.className=J.toolboxButtonStyleClass.name+" "+((me=J.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&me!==void 0?me:J.toolboxButtonStyleColorsClass.name),Me.innerHTML=U.icon,Me.title=U.title,Me.addEventListener("click",function(){J.panelButtonClick(U)}),J.panelButtons.push(Me),J.buttonRow.appendChild(Me)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},F.prototype.panelButtonClick=function(A){var D=this,K=-1;if(A!==this.activePanel){K=this.panels.indexOf(A),this.panelRow.innerHTML="";var J=A.getUi();J.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(J),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=A}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){D.displayMode==="inline"?D.panelRow.style.display="none":D.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(U,me){var Me,je;U.className=D.toolboxButtonStyleClass.name+" "+(me===K?""+((Me=D.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Me!==void 0?Me:D.toolboxActiveButtonStyleColorsClass.name):""+((je=D.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&je!==void 0?je:D.toolboxButtonStyleColorsClass.name))})},F}(),w=function(F,A){this.title=F,this.icon=A},g=function(F){function A(D,K,J,U){var me=F.call(this,D,U||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return me.colors=[],me.addTransparent=!1,me.colorBoxes=[],me.colors=K,me.currentColor=J,me.setCurrentColor=me.setCurrentColor.bind(me),me.getColorBox=me.getColorBox.bind(me),me}return X(A,F),A.prototype.getUi=function(){var D=this,K=document.createElement("div");return K.style.overflow="hidden",K.style.whiteSpace="nowrap",this.colors.forEach(function(J){var U=D.getColorBox(J);K.appendChild(U),D.colorBoxes.push(U)}),K},A.prototype.getColorBox=function(D){var K=this,J=this.uiStyleSettings.toolbarHeight/4,U=this.uiStyleSettings.toolbarHeight-J,me=document.createElement("div");me.style.display="inline-block",me.style.boxSizing="content-box",me.style.width=U-2+"px",me.style.height=U-2+"px",me.style.padding="1px",me.style.marginRight="2px",me.style.marginBottom="2px",me.style.borderWidth="2px",me.style.borderStyle="solid",me.style.borderRadius=(U+2)/2+"px",me.style.borderColor=D===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",me.addEventListener("click",function(){K.setCurrentColor(D,me)});var Me=document.createElement("div");return Me.style.display="inline-block",Me.style.width=U-2+"px",Me.style.height=U-2+"px",Me.style.backgroundColor=D,Me.style.borderRadius=U/2+"px",D==="transparent"&&(Me.style.fill=this.uiStyleSettings.toolboxAccentColor,Me.innerHTML=`<svg viewBox="0 0 24 24">
|
|
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
|
|
</svg>`),me.appendChild(Me),me},A.prototype.setCurrentColor=function(D,K){var J=this;this.currentColor=D,this.colorBoxes.forEach(function(U){U.style.borderColor=U===K?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(D)},A}(w),u=function(){function F(A,D,K){this._state="new",this._isSelected=!1,this._container=A,this._overlayContainer=D,this.globalSettings=K,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(F.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),F.prototype.ownsTarget=function(A){return!1},Object.defineProperty(F.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),F.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},F.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},F.prototype.pointerDown=function(A,D){},F.prototype.dblClick=function(A,D){},F.prototype.manipulate=function(A){},F.prototype.pointerUp=function(A){this.stateChanged()},F.prototype.dispose=function(){},F.prototype.addMarkerVisualToContainer=function(A){this.container.childNodes.length>0?this.container.insertBefore(A,this.container.childNodes[0]):this.container.appendChild(A)},F.prototype.getState=function(){return{typeName:F.typeName,state:this.state,notes:this.notes}},F.prototype.restoreState=function(A){this._state=A.state,this.notes=A.notes},F.prototype.scale=function(A,D){},F.prototype.colorChanged=function(A){this.onColorChanged&&this.onColorChanged(A),this.stateChanged()},F.prototype.fillColorChanged=function(A){this.onFillColorChanged&&this.onFillColorChanged(A),this.stateChanged()},F.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var A=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),A.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(A)&&this.onStateChanged(this)}},F.typeName="MarkerBase",F}(),o=function(){function F(){this.findGripByVisual=this.findGripByVisual.bind(this)}return F.prototype.findGripByVisual=function(A){return this.topLeft.ownsTarget(A)?this.topLeft:this.topCenter.ownsTarget(A)?this.topCenter:this.topRight.ownsTarget(A)?this.topRight:this.centerLeft.ownsTarget(A)?this.centerLeft:this.centerRight.ownsTarget(A)?this.centerRight:this.bottomLeft.ownsTarget(A)?this.bottomLeft:this.bottomCenter.ownsTarget(A)?this.bottomCenter:this.bottomRight.ownsTarget(A)?this.bottomRight:void 0},F}(),s=function(){function F(){this.GRIP_SIZE=10,this.visual=M.createGroup(),this.visual.appendChild(M.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(M.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return F.prototype.ownsTarget=function(A){return A===this.visual||A===this.visual.childNodes[0]||A===this.visual.childNodes[1]},F}(),l=function(){function F(){}return F.toITransformMatrix=function(A){return{a:A.a,b:A.b,c:A.c,d:A.d,e:A.e,f:A.f}},F.toSVGMatrix=function(A,D){return A.a=D.a,A.b=D.b,A.c=D.c,A.d=D.d,A.e=D.e,A.f=D.f,A},F}(),b=function(F){function A(D,K,J){var U=F.call(this,D,K,J)||this;return U.left=0,U.top=0,U.width=0,U.height=0,U.defaultSize={x:50,y:20},U.offsetX=0,U.offsetY=0,U.rotationAngle=0,U.CB_DISTANCE=10,U._suppressMarkerCreateEvent=!1,U.container.transform.baseVal.appendItem(M.createTransform()),U.setupControlBox(),U}return X(A,F),Object.defineProperty(A.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"visual",{get:function(){return this._visual},set:function(D){this._visual=D;var K=M.createTransform();this._visual.transform.baseVal.appendItem(K)},enumerable:!1,configurable:!0}),A.prototype.ownsTarget=function(D){return!!F.prototype.ownsTarget.call(this,D)||!!(this.controlGrips.findGripByVisual(D)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(D))},A.prototype.pointerDown=function(D,K){F.prototype.pointerDown.call(this,D,K),this.state==="new"&&(this.left=D.x,this.top=D.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var J=this.unrotatePoint(D);if(this.manipulationStartX=J.x,this.manipulationStartY=J.y,this.offsetX=J.x-this.left,this.offsetY=J.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(K),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(K)){this.activeGrip=this.rotatorGrip;var U=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=U.x-this.width/2,this.top=U.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var me=this.container.transform.baseVal.getItem(0);me.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(me,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},A.prototype.pointerUp=function(D){var K=this.state;F.prototype.pointerUp.call(this,D),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(D),this._state="select",K==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},A.prototype.moveVisual=function(D){this.visual.style.transform="translate("+D.x+"px, "+D.y+"px)"},A.prototype.manipulate=function(D){var K=this.unrotatePoint(D);this.state==="creating"?this.resize(D):this.state==="move"?(this.left=this.manipulationStartLeft+(K.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(K.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(K):this.state==="rotate"&&this.rotate(D)},A.prototype.resize=function(D){var K=this.manipulationStartLeft,J=this.manipulationStartWidth,U=this.manipulationStartTop,me=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:K=this.manipulationStartLeft+D.x-this.manipulationStartX,J=this.manipulationStartWidth+this.manipulationStartLeft-K;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:J=this.manipulationStartWidth+D.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:U=this.manipulationStartTop+D.y-this.manipulationStartY,me=this.manipulationStartHeight+this.manipulationStartTop-U;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:me=this.manipulationStartHeight+D.y-this.manipulationStartY}J>=0?(this.left=K,this.width=J):(this.left=K+J,this.width=-J),me>=0?(this.top=U,this.height=me):(this.top=U+me,this.height=-me),this.setSize()},A.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},A.prototype.rotate=function(D){if(Math.abs(D.x-this.centerX)>.1){var K=Math.sign(D.x-this.centerX);this.rotationAngle=180*Math.atan((D.y-this.centerY)/(D.x-this.centerX))/Math.PI+90*K,this.applyRotation()}},A.prototype.applyRotation=function(){var D=this.container.transform.baseVal.getItem(0);D.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(D,0)},A.prototype.rotatePoint=function(D){if(this.rotationAngle===0)return D;var K=this.container.getCTM(),J=M.createPoint(D.x,D.y);return{x:(J=J.matrixTransform(K)).x,y:J.y}},A.prototype.unrotatePoint=function(D){if(this.rotationAngle===0)return D;var K=this.container.getCTM();K=K.inverse();var J=M.createPoint(D.x,D.y);return{x:(J=J.matrixTransform(K)).x,y:J.y}},A.prototype.select=function(){F.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},A.prototype.deselect=function(){F.prototype.deselect.call(this),this.controlBox.style.display="none"},A.prototype.setupControlBox=function(){this.controlBox=M.createGroup();var D=M.createTransform();D.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(D),this.container.appendChild(this.controlBox),this.controlRect=M.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=M.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new o,this.addControlGrips(),this.controlBox.style.display="none"},A.prototype.adjustControlBox=function(){var D=this.controlBox.transform.baseVal.getItem(0);D.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(D,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()},A.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()},A.prototype.createGrip=function(){var D=new s;return D.visual.transform.baseVal.appendItem(M.createTransform()),this.controlBox.appendChild(D.visual),D},A.prototype.positionGrips=function(){var D=this.controlGrips.topLeft.GRIP_SIZE,K=-D/2,J=K,U=(this.width+this.CB_DISTANCE)/2-D/2,me=(this.height+this.CB_DISTANCE)/2-D/2,Me=this.height+this.CB_DISTANCE-D/2,je=this.width+this.CB_DISTANCE-D/2;this.positionGrip(this.controlGrips.topLeft.visual,K,J),this.positionGrip(this.controlGrips.topCenter.visual,U,J),this.positionGrip(this.controlGrips.topRight.visual,je,J),this.positionGrip(this.controlGrips.centerLeft.visual,K,me),this.positionGrip(this.controlGrips.centerRight.visual,je,me),this.positionGrip(this.controlGrips.bottomLeft.visual,K,Me),this.positionGrip(this.controlGrips.bottomCenter.visual,U,Me),this.positionGrip(this.controlGrips.bottomRight.visual,je,Me),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,U,J-3*this.CB_DISTANCE)},A.prototype.positionGrip=function(D,K,J){var U=D.transform.baseVal.getItem(0);U.setTranslate(K,J),D.transform.baseVal.replaceItem(U,0)},A.prototype.hideControlBox=function(){this.controlBox.style.display="none"},A.prototype.showControlBox=function(){this.controlBox.style.display=""},A.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:l.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:l.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},F.prototype.getState.call(this))},A.prototype.restoreState=function(D){F.prototype.restoreState.call(this,D);var K=D;this.left=K.left,this.top=K.top,this.width=K.width,this.height=K.height,this.rotationAngle=K.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(l.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,K.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(l.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,K.containerTransformMatrix))},A.prototype.scale=function(D,K){F.prototype.scale.call(this,D,K);var J=this.rotatePoint({x:this.left,y:this.top}),U=this.unrotatePoint({x:J.x*D,y:J.y*K});this.left=U.x,this.top=U.y,this.width=this.width*D,this.height=this.height*K,this.adjustControlBox()},A}(u),p=function(F){function A(D,K,J){var U=F.call(this,D,K,J)||this;return U.fillColor="transparent",U.strokeColor="transparent",U.strokeWidth=0,U.strokeDasharray="",U.opacity=1,U.setStrokeColor=U.setStrokeColor.bind(U),U.setFillColor=U.setFillColor.bind(U),U.setStrokeWidth=U.setStrokeWidth.bind(U),U.setStrokeDasharray=U.setStrokeDasharray.bind(U),U.createVisual=U.createVisual.bind(U),U}return X(A,F),A.prototype.ownsTarget=function(D){return!(!F.prototype.ownsTarget.call(this,D)&&D!==this.visual)},A.prototype.createVisual=function(){this.visual=M.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)},A.prototype.pointerDown=function(D,K){F.prototype.pointerDown.call(this,D,K),this.state==="new"&&(this.createVisual(),this.moveVisual(D),this._state="creating")},A.prototype.manipulate=function(D){F.prototype.manipulate.call(this,D)},A.prototype.resize=function(D){F.prototype.resize.call(this,D),this.setSize()},A.prototype.setSize=function(){F.prototype.setSize.call(this),M.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},A.prototype.pointerUp=function(D){F.prototype.pointerUp.call(this,D),this.setSize()},A.prototype.setStrokeColor=function(D){this.strokeColor=D,this.visual&&M.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(D),this.stateChanged()},A.prototype.setFillColor=function(D){this.fillColor=D,this.visual&&M.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},A.prototype.setStrokeWidth=function(D){this.strokeWidth=D,this.visual&&M.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},A.prototype.setStrokeDasharray=function(D){this.strokeDasharray=D,this.visual&&M.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},A.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},F.prototype.getState.call(this))},A.prototype.restoreState=function(D){var K=D;this.fillColor=K.fillColor,this.strokeColor=K.strokeColor,this.strokeWidth=K.strokeWidth,this.strokeDasharray=K.strokeDasharray,this.opacity=K.opacity,this.createVisual(),F.prototype.restoreState.call(this,D),this.setSize()},A.prototype.scale=function(D,K){F.prototype.scale.call(this,D,K),this.setSize()},A.title="Rectangle marker",A}(b),h=function(F){function A(D,K,J,U){var me=F.call(this,D,U||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return me.widths=[],me.widthBoxes=[],me.widths=K,me.currentWidth=J,me.setCurrentWidth=me.setCurrentWidth.bind(me),me}return X(A,F),A.prototype.getUi=function(){var D=this,K=document.createElement("div");return K.style.display="flex",K.style.overflow="hidden",K.style.flexGrow="2",this.widths.forEach(function(J){var U=document.createElement("div");U.style.display="flex",U.style.flexGrow="2",U.style.alignItems="center",U.style.justifyContent="space-between",U.style.padding="5px",U.style.borderWidth="2px",U.style.borderStyle="solid",U.style.borderColor=J===D.currentWidth?D.uiStyleSettings.toolboxAccentColor:"transparent",U.addEventListener("click",function(){D.setCurrentWidth(J,U)}),K.appendChild(U);var me=document.createElement("div");me.innerText=J.toString(),me.style.marginRight="5px",U.appendChild(me);var Me=document.createElement("div");Me.style.minHeight="20px",Me.style.flexGrow="2",Me.style.display="flex",Me.style.alignItems="center";var je=document.createElement("hr");je.style.minWidth="20px",je.style.border="0px",je.style.borderTop=J+"px solid "+D.uiStyleSettings.toolboxColor,je.style.flexGrow="2",Me.appendChild(je),U.appendChild(Me),D.widthBoxes.push(U)}),K},A.prototype.setCurrentWidth=function(D,K){var J=this;this.currentWidth=D,this.widthBoxes.forEach(function(U){U.style.borderColor=U===K?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},A}(w),L=function(F){function A(D,K,J,U){var me=F.call(this,D,U||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return me.styles=[],me.styleBoxes=[],me.styles=K,me.currentStyle=J,me.setCurrentStyle=me.setCurrentStyle.bind(me),me}return X(A,F),A.prototype.getUi=function(){var D=this,K=document.createElement("div");return K.style.display="flex",K.style.overflow="hidden",K.style.flexGrow="2",this.styles.forEach(function(J){var U=document.createElement("div");U.style.display="flex",U.style.alignItems="center",U.style.justifyContent="space-between",U.style.padding="5px",U.style.borderWidth="2px",U.style.borderStyle="solid",U.style.overflow="hidden",U.style.maxWidth=100/D.styles.length-5+"%",U.style.borderColor=J===D.currentStyle?D.uiStyleSettings.toolboxAccentColor:"transparent",U.addEventListener("click",function(){D.setCurrentStyle(J,U)}),K.appendChild(U);var me=document.createElement("div");me.style.minHeight="20px",me.style.flexGrow="2",me.style.overflow="hidden";var Me=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+D.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(J!==""?'stroke-dasharray="'+J+'"':"")+` />
|
|
</svg>`;me.innerHTML=Me,U.appendChild(me),D.styleBoxes.push(U)}),K},A.prototype.setCurrentStyle=function(D,K){var J=this;this.currentStyle=D,this.styleBoxes.forEach(function(U){U.style.borderColor=U===K?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},A}(w),v=function(F){function A(D,K,J){var U=F.call(this,D,K,J)||this;return U.strokeColor=J.defaultColor,U.strokeWidth=J.defaultStrokeWidth,U.strokeDasharray=J.defaultStrokeDasharray,U.strokePanel=new g("Line color",J.defaultColorSet,J.defaultColor),U.strokePanel.onColorChanged=U.setStrokeColor,U.strokeWidthPanel=new h("Line width",J.defaultStrokeWidths,J.defaultStrokeWidth),U.strokeWidthPanel.onWidthChanged=U.setStrokeWidth,U.strokeStylePanel=new L("Line style",J.defaultStrokeDasharrays,J.defaultStrokeDasharray),U.strokeStylePanel.onStyleChanged=U.setStrokeDasharray,U}return X(A,F),Object.defineProperty(A.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),A.prototype.getState=function(){var D=F.prototype.getState.call(this);return D.typeName=A.typeName,D},A.typeName="FrameMarker",A.title="Frame marker",A.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',A}(p),c=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},f=function(F){function A(D,K,J){var U=F.call(this,D,K,J)||this;return U.x1=0,U.y1=0,U.x2=0,U.y2=0,U.defaultLength=50,U.manipulationStartX=0,U.manipulationStartY=0,U.manipulationStartX1=0,U.manipulationStartY1=0,U.manipulationStartX2=0,U.manipulationStartY2=0,U.setupControlBox(),U}return X(A,F),A.prototype.ownsTarget=function(D){return!!F.prototype.ownsTarget.call(this,D)||!(!this.grip1.ownsTarget(D)&&!this.grip2.ownsTarget(D))},A.prototype.pointerDown=function(D,K){F.prototype.pointerDown.call(this,D,K),this.manipulationStartX=D.x,this.manipulationStartY=D.y,this.state==="new"&&(this.x1=D.x,this.y1=D.y,this.x2=D.x,this.y2=D.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(K)?this.activeGrip=this.grip1:this.grip2.ownsTarget(K)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},A.prototype.pointerUp=function(D){var K=this.state;F.prototype.pointerUp.call(this,D),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(D),this._state="select",K==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},A.prototype.adjustVisual=function(){},A.prototype.manipulate=function(D){this.state==="creating"?this.resize(D):this.state==="move"?(this.x1=this.manipulationStartX1+D.x-this.manipulationStartX,this.y1=this.manipulationStartY1+D.y-this.manipulationStartY,this.x2=this.manipulationStartX2+D.x-this.manipulationStartX,this.y2=this.manipulationStartY2+D.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(D)},A.prototype.resize=function(D){switch(this.activeGrip){case this.grip1:this.x1=D.x,this.y1=D.y;break;case this.grip2:case void 0:this.x2=D.x,this.y2=D.y}this.adjustVisual(),this.adjustControlBox()},A.prototype.select=function(){F.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},A.prototype.deselect=function(){F.prototype.deselect.call(this),this.controlBox.style.display="none"},A.prototype.setupControlBox=function(){this.controlBox=M.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},A.prototype.adjustControlBox=function(){this.positionGrips()},A.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},A.prototype.createGrip=function(){var D=new s;return D.visual.transform.baseVal.appendItem(M.createTransform()),this.controlBox.appendChild(D.visual),D},A.prototype.positionGrips=function(){var D=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-D/2,this.y1-D/2),this.positionGrip(this.grip2.visual,this.x2-D/2,this.y2-D/2)},A.prototype.positionGrip=function(D,K,J){var U=D.transform.baseVal.getItem(0);U.setTranslate(K,J),D.transform.baseVal.replaceItem(U,0)},A.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},F.prototype.getState.call(this))},A.prototype.restoreState=function(D){F.prototype.restoreState.call(this,D);var K=D;this.x1=K.x1,this.y1=K.y1,this.x2=K.x2,this.y2=K.y2},A.prototype.scale=function(D,K){F.prototype.scale.call(this,D,K),this.x1=this.x1*D,this.y1=this.y1*K,this.x2=this.x2*D,this.y2=this.y2*K,this.adjustVisual(),this.adjustControlBox()},A}(u),d=function(F){function A(D,K,J){var U=F.call(this,D,K,J)||this;return U.strokeColor="transparent",U.strokeWidth=0,U.strokeDasharray="",U.setStrokeColor=U.setStrokeColor.bind(U),U.setStrokeWidth=U.setStrokeWidth.bind(U),U.setStrokeDasharray=U.setStrokeDasharray.bind(U),U.strokeColor=J.defaultColor,U.strokeWidth=J.defaultStrokeWidth,U.strokeDasharray=J.defaultStrokeDasharray,U.strokePanel=new g("Line color",J.defaultColorSet,J.defaultColor),U.strokePanel.onColorChanged=U.setStrokeColor,U.strokeWidthPanel=new h("Line width",J.defaultStrokeWidths,J.defaultStrokeWidth),U.strokeWidthPanel.onWidthChanged=U.setStrokeWidth,U.strokeStylePanel=new L("Line style",J.defaultStrokeDasharrays,J.defaultStrokeDasharray),U.strokeStylePanel.onStyleChanged=U.setStrokeDasharray,U}return X(A,F),A.prototype.ownsTarget=function(D){return!(!F.prototype.ownsTarget.call(this,D)&&D!==this.visual&&D!==this.selectorLine&&D!==this.visibleLine)},A.prototype.createVisual=function(){this.visual=M.createGroup(),this.selectorLine=M.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=M.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)},A.prototype.pointerDown=function(D,K){F.prototype.pointerDown.call(this,D,K),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},A.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()),M.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),M.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),M.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},A.prototype.setStrokeColor=function(D){this.strokeColor=D,this.adjustVisual(),this.colorChanged(D)},A.prototype.setStrokeWidth=function(D){this.strokeWidth=D,this.adjustVisual()},A.prototype.setStrokeDasharray=function(D){this.strokeDasharray=D,this.adjustVisual(),this.stateChanged()},Object.defineProperty(A.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),A.prototype.getState=function(){var D=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},F.prototype.getState.call(this));return D.typeName=A.typeName,D},A.prototype.restoreState=function(D){F.prototype.restoreState.call(this,D);var K=D;this.strokeColor=K.strokeColor,this.strokeWidth=K.strokeWidth,this.strokeDasharray=K.strokeDasharray,this.createVisual(),this.adjustVisual()},A.typeName="LineMarker",A.title="Line marker",A.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',A}(f),a=function(F){function A(D,K,J,U){var me=F.call(this,D,U||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return me.fonts=[],me.fontBoxes=[],me.fonts=K,me.currentFont=J,me.setCurrentFont=me.setCurrentFont.bind(me),me}return X(A,F),A.prototype.getUi=function(){var D=this,K=document.createElement("div");return K.style.overflow="hidden",K.style.flexGrow="2",this.fonts.forEach(function(J){var U=document.createElement("div");U.style.display="inline-block",U.style.alignItems="center",U.style.justifyContent="space-between",U.style.padding="5px",U.style.borderWidth="2px",U.style.borderStyle="solid",U.style.overflow="hidden",U.style.maxWidth=100/D.fonts.length-5+"%",U.style.borderColor=J===D.currentFont?D.uiStyleSettings.toolboxAccentColor:"transparent",U.addEventListener("click",function(){D.setCurrentFont(J,U)}),K.appendChild(U);var me=document.createElement("div");me.style.display="flex",me.style.minHeight="20px",me.style.flexGrow="2",me.style.fontFamily=J,me.style.overflow="hidden";var Me=document.createElement("div");Me.style.whiteSpace="nowrap",Me.style.overflow="hidden",Me.style.textOverflow="ellipsis",Me.innerHTML="The quick brown fox jumps over the lazy dog",me.appendChild(Me),U.appendChild(me),D.fontBoxes.push(U)}),K},A.prototype.setCurrentFont=function(D,K){var J=this;this.currentFont=D,this.fontBoxes.forEach(function(U){U.style.borderColor=U===K?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},A}(w),x=function(F){function A(D,K,J){var U=F.call(this,D,K,J)||this;return U.color="transparent",U.padding=5,U.DEFAULT_TEXT="your text here",U.text=U.DEFAULT_TEXT,U.isMoved=!1,U.color=J.defaultColor,U.fontFamily=J.defaultFontFamily,U.defaultSize={x:100,y:30},U.setColor=U.setColor.bind(U),U.setFont=U.setFont.bind(U),U.renderText=U.renderText.bind(U),U.sizeText=U.sizeText.bind(U),U.textEditDivClicked=U.textEditDivClicked.bind(U),U.showTextEditor=U.showTextEditor.bind(U),U.setSize=U.setSize.bind(U),U.positionTextEditor=U.positionTextEditor.bind(U),U.colorPanel=new g("Color",J.defaultColorSet,J.defaultColor),U.colorPanel.onColorChanged=U.setColor,U.fontFamilyPanel=new a("Font",J.defaultFontFamilies,J.defaultFontFamily),U.fontFamilyPanel.onFontChanged=U.setFont,U}return X(A,F),A.prototype.ownsTarget=function(D){if(F.prototype.ownsTarget.call(this,D)||D===this.visual||D===this.textElement||D===this.bgRectangle)return!0;var K=!1;return this.textElement.childNodes.forEach(function(J){J===D&&(K=!0)}),K},A.prototype.createVisual=function(){this.visual=M.createGroup(),this.bgRectangle=M.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=M.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(M.createTransform()),this.textElement.transform.baseVal.appendItem(M.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},A.prototype.pointerDown=function(D,K){F.prototype.pointerDown.call(this,D,K),this.isMoved=!1,this.pointerDownPoint=D,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(D),this._state="creating")},A.prototype.renderText=function(){var D=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(K){D.textElement.appendChild(M.createTSpan(K.trim()===""?" ":K.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},A.prototype.getTextScale=function(){var D=this.textElement.getBBox(),K=1;if(D.width>0&&D.height>0){var J=(1*this.width-this.width*this.padding*2/100)/D.width,U=(1*this.height-this.height*this.padding*2/100)/D.height;K=Math.min(J,U)}return K},A.prototype.getTextPosition=function(D){var K=this.textElement.getBBox(),J=0,U=0;return K.width>0&&K.height>0&&(J=(this.width-K.width*D)/2,U=this.height/2-K.height*D/2),{x:J,y:U}},A.prototype.sizeText=function(){var D=this.textElement.getBBox(),K=this.getTextScale(),J=this.getTextPosition(K);J.y-=D.y*K,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+J.x+"px, "+J.y+"px) scale("+K+", "+K+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(J.x,J.y),this.textElement.transform.baseVal.getItem(1).setScale(K,K))},A.prototype.manipulate=function(D){F.prototype.manipulate.call(this,D),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(D.x-this.pointerDownPoint.x)>5||Math.abs(D.y-this.pointerDownPoint.y)>5)},A.prototype.resize=function(D){F.prototype.resize.call(this,D),this.isMoved=!0,this.setSize(),this.sizeText()},A.prototype.setSize=function(){F.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(M.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),M.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},A.prototype.pointerUp=function(D){var K=this.state;K==="creating"&&(this._suppressMarkerCreateEvent=!0),F.prototype.pointerUp.call(this,D),this.setSize(),(K==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},A.prototype.showTextEditor=function(){var D=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(K){K.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var K=Number.parseFloat(D.textEditor.style.fontSize);D.textEditor.clientWidth>=Number.parseInt(D.textEditor.style.maxWidth)&&K>.9;)K-=.1,D.textEditor.style.fontSize=Math.max(K,.9)+"em"}),this.textEditor.addEventListener("keyup",function(K){K.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(K){if(K.clipboardData){var J=K.clipboardData.getData("text"),U=window.getSelection();if(!U.rangeCount)return!1;U.deleteFromDocument(),U.getRangeAt(0).insertNode(document.createTextNode(J)),K.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){D.textEditDivClicked(D.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},A.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var D=this.getTextScale(),K=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),J=this.textElement.getBBox(),U={x:J.width*D,y:J.height*D};K.x-=U.x/2,K.y-=U.y/2,this.textEditor.style.top=K.y+"px",this.textEditor.style.left=K.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-K.x+"px",this.textEditor.style.fontSize=Math.max(16*D,12)+"px",this.textElement.style.display="none"}},A.prototype.textEditDivClicked=function(D){this.text=D.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},A.prototype.select=function(){F.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},A.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),F.prototype.deselect.call(this)},A.prototype.dblClick=function(D,K){F.prototype.dblClick.call(this,D,K),this.showTextEditor()},A.prototype.setColor=function(D){this.textElement&&M.setAttributes(this.textElement,[["fill",D]]),this.color=D,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(D)},A.prototype.setFont=function(D){this.textElement&&M.setAttributes(this.textElement,[["font-family",D]]),this.fontFamily=D,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},A.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},A.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(A.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),A.prototype.getState=function(){var D=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},F.prototype.getState.call(this));return D.typeName=A.typeName,D},A.prototype.restoreState=function(D){var K=D;this.color=K.color,this.fontFamily=K.fontFamily,this.padding=K.padding,this.text=K.text,this.createVisual(),F.prototype.restoreState.call(this,D),this.setSize()},A.prototype.scale=function(D,K){F.prototype.scale.call(this,D,K),this.setSize(),this.sizeText(),this.positionTextEditor()},A.typeName="TextMarker",A.title="Text marker",A.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>',A}(b),m=function(F){function A(D,K,J){var U=F.call(this,D,K,J)||this;return U.color="transparent",U.lineWidth=3,U.drawing=!1,U.pixelRatio=1,U.color=J.defaultColor,U.lineWidth=J.defaultStrokeWidth,U.pixelRatio=J.freehandPixelRatio,U.setColor=U.setColor.bind(U),U.addCanvas=U.addCanvas.bind(U),U.finishCreation=U.finishCreation.bind(U),U.setLineWidth=U.setLineWidth.bind(U),U.colorPanel=new g("Color",J.defaultColorSet,J.defaultColor),U.colorPanel.onColorChanged=U.setColor,U.lineWidthPanel=new h("Line width",J.defaultStrokeWidths,J.defaultStrokeWidth),U.lineWidthPanel.onWidthChanged=U.setLineWidth,U}return X(A,F),A.prototype.ownsTarget=function(D){return!(!F.prototype.ownsTarget.call(this,D)&&D!==this.visual&&D!==this.drawingImage)},A.prototype.createVisual=function(){this.visual=M.createGroup(),this.drawingImage=M.createImage(),this.visual.appendChild(this.drawingImage);var D=M.createTransform();this.visual.transform.baseVal.appendItem(D),this.addMarkerVisualToContainer(this.visual)},A.prototype.pointerDown=function(D,K){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(D.x,D.y),this.drawing=!0):F.prototype.pointerDown.call(this,D,K)},A.prototype.manipulate=function(D){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(D.x,D.y),this.canvasContext.stroke()):F.prototype.manipulate.call(this,D)},A.prototype.resize=function(D){F.prototype.resize.call(this,D),M.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),M.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},A.prototype.pointerUp=function(D){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):F.prototype.pointerUp.call(this,D)},A.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)},A.prototype.select=function(){this.state==="creating"&&this.finishCreation(),F.prototype.select.call(this)},A.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),F.prototype.deselect.call(this)},A.prototype.finishCreation=function(){for(var D=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),K=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],J=K[0],U=K[1],me=K[2],Me=K[3],je=!1,Xe=0;Xe<this.canvasElement.height;Xe++)for(var Be=0;Be<this.canvasElement.width;Be++)D.data[Xe*this.canvasElement.width*4+4*Be+3]>0&&(je=!0,Xe<U&&(U=Xe),Be<J&&(J=Be),Xe>Me&&(Me=Xe),Be>me&&(me=Be));if(je){this.left=J/this.pixelRatio,this.top=U/this.pixelRatio,this.width=(me-J)/this.pixelRatio,this.height=(Me-U)/this.pixelRatio;var He=document.createElement("canvas");He.width=me-J,He.height=Me-U,He.getContext("2d").putImageData(this.canvasContext.getImageData(J,U,me-J,Me-U),0,0),this.drawingImgUrl=He.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},A.prototype.setDrawingImage=function(){M.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),M.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},A.prototype.setColor=function(D){this.color=D,this.colorChanged(D)},A.prototype.setLineWidth=function(D){this.lineWidth=D},Object.defineProperty(A.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),A.prototype.getState=function(){var D=Object.assign({drawingImgUrl:this.drawingImgUrl},F.prototype.getState.call(this));return D.typeName=A.typeName,D},A.prototype.restoreState=function(D){this.createVisual(),F.prototype.restoreState.call(this,D),this.drawingImgUrl=D.drawingImgUrl,this.setDrawingImage()},A.prototype.scale=function(D,K){F.prototype.scale.call(this,D,K),this.setDrawingImage()},A.typeName="FreehandMarker",A.title="Freehand marker",A.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>',A}(b),S=function(F){function A(D,K,J){var U=F.call(this,D,J||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return U.typeBoxes=[],U.currentType=K,U.setCurrentType=U.setCurrentType.bind(U),U}return X(A,F),A.prototype.getUi=function(){var D=this,K=document.createElement("div");K.style.display="flex",K.style.overflow="hidden",K.style.flexGrow="2";for(var J=function(Me){var je="both";switch(Me){case 0:je="both";break;case 1:je="start";break;case 2:je="end";break;case 3:je="none"}var Xe=document.createElement("div");if(Xe.style.display="flex",Xe.style.flexGrow="2",Xe.style.alignItems="center",Xe.style.justifyContent="space-between",Xe.style.padding="5px",Xe.style.borderWidth="2px",Xe.style.borderStyle="solid",Xe.style.borderColor=je===U.currentType?U.uiStyleSettings.toolboxAccentColor:"transparent",Xe.addEventListener("click",function(){D.setCurrentType(je,Xe)}),K.appendChild(Xe),je==="both"||je==="start"){var Be=document.createElement("div");Be.style.display="flex",Be.style.alignItems="center",Be.style.minHeight="20px",Be.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="`+(U.uiStyleSettings!==void 0?U.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Be.style.marginLeft="5px",Xe.appendChild(Be)}var He=document.createElement("div");He.style.display="flex",He.style.alignItems="center",He.style.minHeight="20px",He.style.flexGrow="2";var ze=document.createElement("hr");if(ze.style.minWidth="20px",ze.style.border="0px",ze.style.borderTop="3px solid "+(U.uiStyleSettings!==void 0?U.uiStyleSettings.toolboxColor:"#eeeeee"),ze.style.flexGrow="2",He.appendChild(ze),Xe.appendChild(He),je==="both"||je==="end"){var rt=document.createElement("div");rt.style.display="flex",rt.style.alignItems="center",rt.style.minHeight="20px",rt.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="`+(U.uiStyleSettings!==void 0?U.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,rt.style.marginRight="5px",Xe.appendChild(rt)}U.typeBoxes.push(Xe)},U=this,me=0;me<4;me++)J(me);return K},A.prototype.setCurrentType=function(D,K){var J=this;this.currentType=D,this.typeBoxes.forEach(function(U){U.style.borderColor=U===K?J.uiStyleSettings!==void 0?J.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},A}(w),I=function(F){function A(D,K,J){var U=F.call(this,D,K,J)||this;return U.arrowType="end",U.arrowBaseHeight=10,U.arrowBaseWidth=10,U.getArrowPoints=U.getArrowPoints.bind(U),U.setArrowType=U.setArrowType.bind(U),U.arrowTypePanel=new S("Arrow type","end"),U.arrowTypePanel.onArrowTypeChanged=U.setArrowType,U}return X(A,F),A.prototype.ownsTarget=function(D){return!(!F.prototype.ownsTarget.call(this,D)&&D!==this.arrow1&&D!==this.arrow2)},A.prototype.getArrowPoints=function(D,K){var J=this.arrowBaseWidth+2*this.strokeWidth,U=this.arrowBaseHeight+2*this.strokeWidth;return D-J/2+","+(K+U/2)+" "+D+","+(K-U/2)+" "+(D+J/2)+","+(K+U/2)},A.prototype.createTips=function(){this.arrow1=M.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(M.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=M.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(M.createTransform()),this.visual.appendChild(this.arrow2)},A.prototype.pointerDown=function(D,K){F.prototype.pointerDown.call(this,D,K),this.state==="creating"&&this.createTips()},A.prototype.adjustVisual=function(){if(F.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",M.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),M.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var D=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),K=this.arrow1.transform.baseVal.getItem(0);K.setRotate(D,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(K,0);var J=this.arrow2.transform.baseVal.getItem(0);J.setRotate(D+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(J,0)}},A.prototype.setArrowType=function(D){this.arrowType=D,this.adjustVisual(),this.stateChanged()},Object.defineProperty(A.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),A.prototype.getState=function(){var D=Object.assign({arrowType:this.arrowType},F.prototype.getState.call(this));return D.typeName=A.typeName,D},A.prototype.restoreState=function(D){F.prototype.restoreState.call(this,D);var K=D;this.arrowType=K.arrowType,this.createTips(),this.adjustVisual()},A.typeName="ArrowMarker",A.title="Arrow marker",A.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',A}(d),z=function(F){function A(D,K,J){var U=F.call(this,D,K,J)||this;return U.fillColor=J.defaultFillColor,U.strokeWidth=0,U.fillPanel=new g("Color",J.defaultColorSet,J.defaultFillColor),U.fillPanel.onColorChanged=U.setFillColor,U}return X(A,F),Object.defineProperty(A.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),A.prototype.getState=function(){var D=F.prototype.getState.call(this);return D.typeName=A.typeName,D},A.typeName="CoverMarker",A.title="Cover marker",A.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',A}(p),Y=function(F){function A(D,K,J,U){var me=F.call(this,D,U||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return me.opacities=[],me.opacityBoxes=[],me.opacities=K,me.currentOpacity=J,me.setCurrentOpacity=me.setCurrentOpacity.bind(me),me}return X(A,F),A.prototype.getUi=function(){var D=this,K=document.createElement("div");return K.style.display="flex",K.style.overflow="hidden",K.style.flexGrow="2",K.style.justifyContent="space-between",this.opacities.forEach(function(J){var U=document.createElement("div");U.style.display="flex",U.style.alignItems="center",U.style.justifyContent="center",U.style.padding="5px",U.style.borderWidth="2px",U.style.borderStyle="solid",U.style.borderColor=J===D.currentOpacity?D.uiStyleSettings.toolboxAccentColor:"transparent",U.addEventListener("click",function(){D.setCurrentOpacity(J,U)}),K.appendChild(U);var me=document.createElement("div");me.innerText=100*J+"%",U.appendChild(me),D.opacityBoxes.push(U)}),K},A.prototype.setCurrentOpacity=function(D,K){var J=this;this.currentOpacity=D,this.opacityBoxes.forEach(function(U){U.style.borderColor=U===K?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},A}(w),ie=function(F){function A(D,K,J){var U=F.call(this,D,K,J)||this;return U.setOpacity=U.setOpacity.bind(U),U.fillColor=J.defaultHighlightColor,U.strokeWidth=0,U.opacity=J.defaultHighlightOpacity,U.fillPanel=new g("Color",J.defaultColorSet,U.fillColor),U.fillPanel.onColorChanged=U.setFillColor,U.opacityPanel=new Y("Opacity",J.defaultOpacitySteps,U.opacity),U.opacityPanel.onOpacityChanged=U.setOpacity,U}return X(A,F),A.prototype.setOpacity=function(D){this.opacity=D,this.visual&&M.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(A.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),A.prototype.getState=function(){var D=F.prototype.getState.call(this);return D.typeName=A.typeName,D},A.typeName="HighlightMarker",A.title="Highlight marker",A.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>',A}(z),G='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',j=function(F){function A(D,K,J){var U=F.call(this,D,K,J)||this;return U.bgColor="transparent",U.tipPosition={x:0,y:0},U.tipBase1Position={x:0,y:0},U.tipBase2Position={x:0,y:0},U.tipMoving=!1,U.color=J.defaultStrokeColor,U.bgColor=J.defaultFillColor,U.fontFamily=J.defaultFontFamily,U.defaultSize={x:100,y:30},U.setBgColor=U.setBgColor.bind(U),U.getTipPoints=U.getTipPoints.bind(U),U.positionTip=U.positionTip.bind(U),U.setTipPoints=U.setTipPoints.bind(U),U.colorPanel=new g("Text color",J.defaultColorSet,U.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>'),U.colorPanel.onColorChanged=U.setColor,U.bgColorPanel=new g("Fill color",J.defaultColorSet,U.bgColor,G),U.bgColorPanel.onColorChanged=U.setBgColor,U.fontFamilyPanel=new a("Font",J.defaultFontFamilies,J.defaultFontFamily),U.fontFamilyPanel.onFontChanged=U.setFont,U.tipGrip=new s,U.tipGrip.visual.transform.baseVal.appendItem(M.createTransform()),U.controlBox.appendChild(U.tipGrip.visual),U}return X(A,F),A.prototype.ownsTarget=function(D){return F.prototype.ownsTarget.call(this,D)||this.tipGrip.ownsTarget(D)||this.tip===D},A.prototype.createTip=function(){M.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=M.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},A.prototype.pointerDown=function(D,K){this.state==="new"&&F.prototype.pointerDown.call(this,D,K),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(K)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):F.prototype.pointerDown.call(this,D,K)},A.prototype.pointerUp=function(D){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,F.prototype.pointerUp.call(this,D);else{var K=this.state==="creating";F.prototype.pointerUp.call(this,D),this.setTipPoints(K),this.positionTip()}},A.prototype.manipulate=function(D){if(this.tipMoving){var K=this.unrotatePoint(D);this.tipPosition={x:K.x-this.manipulationStartLeft,y:K.y-this.manipulationStartTop},this.positionTip()}else F.prototype.manipulate.call(this,D)},A.prototype.setBgColor=function(D){this.bgRectangle&&this.tip&&(M.setAttributes(this.bgRectangle,[["fill",D]]),M.setAttributes(this.tip,[["fill",D]])),this.bgColor=D,this.fillColorChanged(D)},A.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},A.prototype.setTipPoints=function(D){D===void 0&&(D=!1);var K=Math.min(this.height/2,15),J=this.height/5;D&&(this.tipPosition={x:K+J/2,y:this.height+20});var U=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?U<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(J=this.width/5,K=Math.min(this.width/2,15),this.tipBase1Position={x:K,y:0},this.tipBase2Position={x:K+J,y:0}):(this.tipBase1Position={x:0,y:K},this.tipBase2Position={x:0,y:K+J}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?U<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(J=this.width/5,K=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-K-J,y:0},this.tipBase2Position={x:this.width-K,y:0}):(this.tipBase1Position={x:this.width,y:K},this.tipBase2Position={x:this.width,y:K+J}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?U<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(J=this.width/5,K=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-K-J,y:this.height},this.tipBase2Position={x:this.width-K,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-K-J},this.tipBase2Position={x:this.width,y:this.height-K}):U<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(J=this.width/5,K=Math.min(this.width/2,15),this.tipBase1Position={x:K,y:this.height},this.tipBase2Position={x:K+J,y:this.height}):(this.tipBase1Position={x:0,y:this.height-K},this.tipBase2Position={x:0,y:this.height-K-J})},A.prototype.resize=function(D){F.prototype.resize.call(this,D),this.positionTip()},A.prototype.positionTip=function(){M.setAttributes(this.tip,[["points",this.getTipPoints()]]);var D=this.tipGrip.visual.transform.baseVal.getItem(0);D.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(D,0)},Object.defineProperty(A.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),A.prototype.select=function(){this.positionTip(),F.prototype.select.call(this)},A.prototype.getState=function(){var D=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},F.prototype.getState.call(this));return D.typeName=A.typeName,D},A.prototype.restoreState=function(D){var K=D;this.bgColor=K.bgColor,this.tipPosition=K.tipPosition,F.prototype.restoreState.call(this,D),this.createTip(),this.setTipPoints()},A.prototype.scale=function(D,K){F.prototype.scale.call(this,D,K),this.tipPosition={x:this.tipPosition.x*D,y:this.tipPosition.y*K},this.positionTip()},A.typeName="CalloutMarker",A.title="Callout marker",A.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>',A}(x),oe=function(F){function A(D,K,J){var U=F.call(this,D,K,J)||this;return U.fillColor="transparent",U.strokeColor="transparent",U.strokeWidth=0,U.strokeDasharray="",U.opacity=1,U.strokeColor=J.defaultColor,U.strokeWidth=J.defaultStrokeWidth,U.strokeDasharray=J.defaultStrokeDasharray,U.fillColor=J.defaultFillColor,U.setStrokeColor=U.setStrokeColor.bind(U),U.setFillColor=U.setFillColor.bind(U),U.setStrokeWidth=U.setStrokeWidth.bind(U),U.setStrokeDasharray=U.setStrokeDasharray.bind(U),U.setOpacity=U.setOpacity.bind(U),U.createVisual=U.createVisual.bind(U),U.strokePanel=new g("Line color",C(J.defaultColorSet,["transparent"]),J.defaultColor),U.strokePanel.onColorChanged=U.setStrokeColor,U.fillPanel=new g("Fill color",C(J.defaultColorSet,["transparent"]),U.fillColor,G),U.fillPanel.onColorChanged=U.setFillColor,U.strokeWidthPanel=new h("Line width",J.defaultStrokeWidths,J.defaultStrokeWidth),U.strokeWidthPanel.onWidthChanged=U.setStrokeWidth,U.strokeStylePanel=new L("Line style",J.defaultStrokeDasharrays,J.defaultStrokeDasharray),U.strokeStylePanel.onStyleChanged=U.setStrokeDasharray,U.opacityPanel=new Y("Opacity",J.defaultOpacitySteps,U.opacity),U.opacityPanel.onOpacityChanged=U.setOpacity,U}return X(A,F),A.prototype.ownsTarget=function(D){return!(!F.prototype.ownsTarget.call(this,D)&&D!==this.visual)},A.prototype.createVisual=function(){this.visual=M.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)},A.prototype.pointerDown=function(D,K){F.prototype.pointerDown.call(this,D,K),this.state==="new"&&(this.createVisual(),this.moveVisual(D),this._state="creating")},A.prototype.manipulate=function(D){F.prototype.manipulate.call(this,D)},A.prototype.resize=function(D){F.prototype.resize.call(this,D),this.setSize()},A.prototype.setSize=function(){F.prototype.setSize.call(this),M.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},A.prototype.pointerUp=function(D){F.prototype.pointerUp.call(this,D),this.setSize()},A.prototype.setStrokeColor=function(D){this.strokeColor=D,this.visual&&M.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(D),this.stateChanged()},A.prototype.setFillColor=function(D){this.fillColor=D,this.visual&&M.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(D),this.stateChanged()},A.prototype.setStrokeWidth=function(D){this.strokeWidth=D,this.visual&&M.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},A.prototype.setStrokeDasharray=function(D){this.strokeDasharray=D,this.visual&&M.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},A.prototype.setOpacity=function(D){this.opacity=D,this.visual&&M.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(A.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),A.prototype.getState=function(){var D=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},F.prototype.getState.call(this));return D.typeName=A.typeName,D},A.prototype.restoreState=function(D){var K=D;this.fillColor=K.fillColor,this.strokeColor=K.strokeColor,this.strokeWidth=K.strokeWidth,this.strokeDasharray=K.strokeDasharray,this.opacity=K.opacity,this.createVisual(),F.prototype.restoreState.call(this,D),this.setSize()},A.prototype.scale=function(D,K){F.prototype.scale.call(this,D,K),this.setSize()},A.typeName="EllipseMarker",A.title="Ellipse marker",A.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>',A}(b),ye=function(F){function A(D,K,J){return F.call(this,D,K,J)||this}return X(A,F),Object.defineProperty(A.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),A.prototype.ownsTarget=function(D){return!(!F.prototype.ownsTarget.call(this,D)&&D!==this.tip1&&D!==this.tip2)},A.prototype.createTips=function(){this.tip1=M.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(M.createTransform()),this.visual.appendChild(this.tip1),this.tip2=M.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(M.createTransform()),this.visual.appendChild(this.tip2)},A.prototype.pointerDown=function(D,K){F.prototype.pointerDown.call(this,D,K),this.state==="creating"&&this.createTips()},A.prototype.adjustVisual=function(){if(F.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(M.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()]]),M.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 D=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),K=this.tip1.transform.baseVal.getItem(0);K.setRotate(D,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(K,0);var J=this.tip2.transform.baseVal.getItem(0);J.setRotate(D+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(J,0)}},Object.defineProperty(A.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),A.prototype.getState=function(){var D=F.prototype.getState.call(this);return D.typeName=A.typeName,D},A.prototype.restoreState=function(D){F.prototype.restoreState.call(this,D),this.createTips(),this.adjustVisual()},A.typeName="MeasurementMarker",A.title="Measurement marker",A.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>',A}(d),Ce=function(F){function A(D,K,J){var U=F.call(this,D,K,J)||this;return U.strokePanel.colors=J.defaultColorSet,U.fillColor="transparent",U}return X(A,F),Object.defineProperty(A.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),A.prototype.getState=function(){var D=F.prototype.getState.call(this);return D.typeName=A.typeName,D},A.typeName="EllipseFrameMarker",A.title="Ellipse frame marker",A.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>',A}(oe),De=function(){function F(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(F.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),F.prototype.addUndoStep=function(A){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(A)||(this.undoStack.push(A),JSON.stringify(this.lastRedoStep)!==JSON.stringify(A)&&this.redoStack.splice(0,this.redoStack.length))},F.prototype.replaceLastUndoStep=function(A){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=A)},F.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},F.prototype.undo=function(){if(this.undoStack.length>1){var A=this.undoStack.pop();return A!==void 0&&this.redoStack.push(A),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},F.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},F}(),Ye=function(F){function A(D,K,J){var U=F.call(this,D,K,J)||this;return U.strokeColor="transparent",U.strokeWidth=0,U.strokeDasharray="",U.curveX=0,U.curveY=0,U.manipulationStartCurveX=0,U.manipulationStartCurveY=0,U.setStrokeColor=U.setStrokeColor.bind(U),U.setStrokeWidth=U.setStrokeWidth.bind(U),U.setStrokeDasharray=U.setStrokeDasharray.bind(U),U.positionGrips=U.positionGrips.bind(U),U.addControlGrips=U.addControlGrips.bind(U),U.adjustVisual=U.adjustVisual.bind(U),U.setupControlBox=U.setupControlBox.bind(U),U.resize=U.resize.bind(U),U.strokeColor=J.defaultColor,U.strokeWidth=J.defaultStrokeWidth,U.strokeDasharray=J.defaultStrokeDasharray,U.strokePanel=new g("Line color",J.defaultColorSet,J.defaultColor),U.strokePanel.onColorChanged=U.setStrokeColor,U.strokeWidthPanel=new h("Line width",J.defaultStrokeWidths,J.defaultStrokeWidth),U.strokeWidthPanel.onWidthChanged=U.setStrokeWidth,U.strokeStylePanel=new L("Line style",J.defaultStrokeDasharrays,J.defaultStrokeDasharray),U.strokeStylePanel.onStyleChanged=U.setStrokeDasharray,U}return X(A,F),A.prototype.ownsTarget=function(D){return!(!F.prototype.ownsTarget.call(this,D)&&D!==this.visual&&D!==this.selectorCurve&&D!==this.visibleCurve&&!this.curveGrip.ownsTarget(D))},A.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},A.prototype.createVisual=function(){this.visual=M.createGroup(),this.selectorCurve=M.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=M.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)},A.prototype.pointerDown=function(D,K){F.prototype.pointerDown.call(this,D,K),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=D.x,this.curveY=D.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(K)&&(this.activeGrip=this.curveGrip,this._state="resize")},A.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),M.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),M.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),M.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},A.prototype.setupControlBox=function(){F.prototype.setupControlBox.call(this),this.curveControlLine1=M.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=M.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)},A.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,F.prototype.addControlGrips.call(this)},A.prototype.positionGrips=function(){F.prototype.positionGrips.call(this);var D=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-D/2,this.curveY-D/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()))},A.prototype.manipulate=function(D){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+D.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+D.y-this.manipulationStartY),F.prototype.manipulate.call(this,D)},A.prototype.resize=function(D){this.activeGrip===this.curveGrip&&(this.curveX=D.x,this.curveY=D.y),F.prototype.resize.call(this,D),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},A.prototype.setStrokeColor=function(D){this.strokeColor=D,this.adjustVisual(),this.colorChanged(D)},A.prototype.setStrokeWidth=function(D){this.strokeWidth=D,this.adjustVisual()},A.prototype.setStrokeDasharray=function(D){this.strokeDasharray=D,this.adjustVisual()},A.prototype.scale=function(D,K){this.curveX=this.curveX*D,this.curveY=this.curveY*K,F.prototype.scale.call(this,D,K)},Object.defineProperty(A.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),A.prototype.getState=function(){var D=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},F.prototype.getState.call(this));return D.typeName=A.typeName,D},A.prototype.restoreState=function(D){F.prototype.restoreState.call(this,D);var K=D;this.strokeColor=K.strokeColor,this.strokeWidth=K.strokeWidth,this.strokeDasharray=K.strokeDasharray,this.curveX=K.curveX,this.curveY=K.curveY,this.createVisual(),this.adjustVisual()},A.typeName="CurveMarker",A.title="Curve marker",A.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>',A}(f),Ie=function(){function F(A,D){D===void 0&&(D=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=A,this.cancelable=D}return Object.defineProperty(F.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),F.prototype.preventDefault=function(){this._defaultPrevented=!0},F}(),Ve=function(F){function A(D,K,J){var U=F.call(this,D,!1)||this;return U.dataUrl=K,U.state=J,U}return X(A,F),A}(Ie),Ne=function(F){function A(D,K,J){J===void 0&&(J=!1);var U=F.call(this,D,J)||this;return U.marker=K,U}return X(A,F),A}(Ie),Ue=function(){function F(){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 F.prototype.addEventListener=function(A,D){this[A].push(D)},F.prototype.removeEventListener=function(A,D){var K=this[A].indexOf(D);K>-1&&this[A].splice(K,1)},F}(),Ae=function(){function F(A){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new c,this._isOpen=!1,this.undoRedoManager=new De,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 Ue,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=F.instanceCounter++,this.styles=new R(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=A,this.targetRoot=document.body,this.width=A.clientWidth,this.height=A.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(F.prototype,"ALL_MARKER_TYPES",{get:function(){return[v,m,I,x,Ce,oe,ie,j,ye,z,d,Ye]},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[v,m,I,x,oe,ie,j]},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"BASIC_MARKER_TYPES",{get:function(){return[v,m,I,x,ie]},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(A){var D=this;this._availableMarkerTypes.splice(0),A.forEach(function(K){if(typeof K=="string"){var J=D.ALL_MARKER_TYPES.find(function(U){return U.typeName===K});J!==void 0&&D._availableMarkerTypes.push(J)}else D._availableMarkerTypes.push(K)})},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(A){this._zoomLevel=A,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(F.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),F.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),W.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},F.prototype.show=function(){var A=this;this.styles.styleSheetRoot===void 0&&P.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=P.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(D){return D(new Ie(A))})},F.prototype.render=function(){return k(this,void 0,void 0,function(){var A;return H(this,function(D){switch(D.label){case 0:return this.setCurrentMarker(),(A=new B).naturalSize=this.renderAtNaturalSize,A.imageType=this.renderImageType,A.imageQuality=this.renderImageQuality,A.markersOnly=this.renderMarkersOnly,A.width=this.renderWidth,A.height=this.renderHeight,[4,A.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return D.sent(),[4,A.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,D.sent()]}})})},F.prototype.close=function(A){var D=this;if(A===void 0&&(A=!1),this.isOpen){var K=!1;A||this.eventListeners.beforeclose.forEach(function(J){var U=new Ie(D,!0);J(U),U.defaultPrevented&&(K=!0)}),K||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(J){return J(new Ie(D))}),this.detachEvents(),this._isOpen=!1)}},F.prototype.addMarkersToToolbar=function(){for(var A,D=[],K=0;K<arguments.length;K++)D[K]=arguments[K];(A=this._availableMarkerTypes).push.apply(A,D)},F.prototype.addRenderEventListener=function(A){this.addEventListener("render",function(D){A(D.dataUrl,D.state)})},F.prototype.removeRenderEventListener=function(A){},F.prototype.addCloseEventListener=function(A){this.addEventListener("close",function(){A()})},F.prototype.removeCloseEventListener=function(A){},F.prototype.setupResizeObserver=function(){var A=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){A.resize(A.target.clientWidth,A.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return A.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},F.prototype.onPopupTargetResize=function(){var A=1*this.target.clientWidth/this.target.clientHeight,D=this.editorCanvas.clientWidth/A>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*A:this.editorCanvas.clientWidth,K=D<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/A;this.resize(D,K)},F.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},F.prototype.resize=function(A,D){this._isResizing=!0;var K=A/this.imageWidth,J=D/this.imageHeight;this.imageWidth=Math.round(A),this.imageHeight=Math.round(D),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(K,J),this._isResizing=!1},F.prototype.scaleMarkers=function(A,D){var K,J=this;this._currentMarker&&this._currentMarker instanceof x?this._currentMarker.scale(A,D):(K=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(U){U!==J._currentMarker&&U.scale(A,D)}),K!==void 0&&this.setCurrentMarker(K)},F.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"},F.prototype.setTopLeft=function(){var A=this.editingTarget.getBoundingClientRect(),D=this.editorCanvas.getBoundingClientRect();this.left=A.left-D.left,this.top=A.top-D.top},F.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)},F.prototype.addDefs=function(){for(var A,D=[],K=0;K<arguments.length;K++)D[K]=arguments[K];this.defs=M.createDefs(),this.addDefsToImage(),(A=this.defs).append.apply(A,D)},F.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},F.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)},F.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},F.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},F.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)},F.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},F.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)},F.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 A=document.createElement("a");A.href="https://markerjs.com/",A.target="_blank",A.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>',A.title="Powered by marker.js",A.style.display="grid",A.style.alignItems="center",A.style.justifyItems="center",A.style.padding="3px",A.style.width="20px",A.style.height="20px",this.logoUI.appendChild(A),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},F.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")},F.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"},F.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},F.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 A=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=A+"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 _(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 O(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},F.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},F.prototype.removeMarker=function(A){this.markerImage.removeChild(A.container),this.markers.indexOf(A)>-1&&this.markers.splice(this.markers.indexOf(A),1),A.dispose()},F.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())},F.prototype.toolbarButtonClicked=function(A,D){if(A==="marker"&&D!==void 0)this.createNewMarker(D);else if(A==="action")switch(D){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()}},F.prototype.deleteSelectedMarker=function(){var A=this;if(this._currentMarker!==void 0){var D=!1;if(this.eventListeners.markerbeforedelete.forEach(function(J){var U=new Ne(A,A._currentMarker,!0);J(U),U.defaultPrevented&&(D=!0)}),!D){var K=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(J){return J(new Ne(A,K))})}}},F.prototype.clear=function(){var A=this,D=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(me){var Me=new Ne(A,void 0,!0);me(Me),Me.defaultPrevented&&(D=!0)}),!D)){this.setCurrentMarker();for(var K=function(me){var Me=J.markers[me];J.setCurrentMarker(J.markers[me]),J._currentMarker.dispose(),J.markerImage.removeChild(J._currentMarker.container),J.markers.splice(J.markers.indexOf(J._currentMarker),1),J.eventListeners.markerdelete.forEach(function(je){return je(new Ne(A,Me))})},J=this,U=this.markers.length-1;U>=0;U--)K(U);this.addUndoStep()}},Object.defineProperty(F.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),F.prototype.showNotesEditor=function(){var A;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=(A=this._currentMarker.notes)!==null&&A!==void 0?A:"",this.overlayContainer.appendChild(this.notesArea))},F.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)},F.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},F.prototype.addUndoStep=function(){var A=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var D=this.getState(),K=this.undoRedoManager.getLastUndoStep();if(!K||K.width===D.width&&K.height===D.height){var J=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(D),J<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(U){return U(new Ie(A))})}else this.undoRedoManager.replaceLastUndoStep(D),this.eventListeners.statechange.forEach(function(U){return U(new Ie(A))})}},F.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},F.prototype.undoStep=function(){var A=this,D=this.undoRedoManager.undo();D!==void 0&&(this.restoreState(D),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(K){return K(new Ie(A))}))},F.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},F.prototype.redoStep=function(){var A=this,D=this.undoRedoManager.redo();D!==void 0&&(this.restoreState(D),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(K){return K(new Ie(A))}))},F.prototype.stepZoom=function(){var A=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=A<this.zoomSteps.length-1?this.zoomSteps[A+1]:this.zoomSteps[0]},F.prototype.panTo=function(A){this.contentDiv.scrollBy({left:this.prevPanPoint.x-A.x,top:this.prevPanPoint.y-A.y}),this.prevPanPoint=A},F.prototype.startRenderAndClose=function(){return k(this,void 0,void 0,function(){var A,D,K=this;return H(this,function(J){switch(J.label){case 0:return[4,this.render()];case 1:return A=J.sent(),D=this.getState(),this.eventListeners.render.forEach(function(U){return U(new Ve(K,A,D))}),this.close(!0),[2]}})})},F.prototype.getState=function(A){A===!0&&this.setCurrentMarker();var D={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(K){return D.markers.push(K.getState())}),D},F.prototype.restoreState=function(A){var D=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);A.markers.forEach(function(K){var J=D._availableMarkerTypes.find(function(me){return me.typeName===K.typeName});if(J!==void 0){var U=D.addNewMarker(J);U.restoreState(K),D.markers.push(U)}}),A.width&&A.height&&(A.width!==this.imageWidth||A.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/A.width,this.imageHeight/A.height),this.eventListeners.restorestate.forEach(function(K){return K(new Ie(D))})},F.prototype.addNewMarker=function(A){var D=M.createGroup();return this.markerImage.appendChild(D),new A(D,this.overlayContainer,this.settings)},F.prototype.createNewMarker=function(A){var D,K=this;(D=typeof A=="string"?this._availableMarkerTypes.find(function(J){return J.typeName===A}):A)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(D),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(D.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(J){return J(new Ne(K,K._currentMarker))}))},F.prototype.markerCreated=function(A){var D=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(A),this.setCurrentMarker(A),A instanceof m&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(m):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(K){return K(new Ne(D,D._currentMarker))})},F.prototype.colorChanged=function(A){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=A,this.settings.defaultStrokeColor=A)},F.prototype.fillColorChanged=function(A){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=A)},F.prototype.markerStateChanged=function(A){var D=this;this.eventListeners.markerchange.forEach(function(K){return K(new Ne(D,A))})},F.prototype.setCurrentMarker=function(A){var D=this;this._currentMarker!==A&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(K){return K(new Ne(D,D._currentMarker))})),this._currentMarker=A,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(K){return K(new Ne(D,D._currentMarker))}))},F.prototype.onPointerDown=function(A){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||A.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var D=this.markers.find(function(K){return K.ownsTarget(A.target)});D!==void 0?(this.setCurrentMarker(D),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(A.clientX,A.clientY),A.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:A.clientX,y:A.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(A.clientX,A.clientY))},F.prototype.onDblClick=function(A){if(this._isFocused||this.focus(),this.mode==="select"){var D=this.markers.find(function(K){return K.ownsTarget(A.target)});D!==void 0&&D!==this._currentMarker&&this.setCurrentMarker(D),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(A.clientX,A.clientY),A.target):this.setCurrentMarker()}},F.prototype.onPointerMove=function(A){this.touchPoints!==1&&A.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||A.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(A.clientX,A.clientY)):this.zoomLevel>1&&this.panTo({x:A.clientX,y:A.clientY}))},F.prototype.onPointerUp=function(A){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(A.clientX,A.clientY)),this.isDragging=!1,this.addUndoStep()},F.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},F.prototype.onKeyUp=function(A){this._currentMarker===void 0||this.notesArea!==void 0||A.key!=="Delete"&&A.key!=="Backspace"||this.deleteSelectedMarker()},F.prototype.clientToLocalCoordinates=function(A,D){var K=this.markerImage.getBoundingClientRect();return{x:(A-K.left)/this.zoomLevel,y:(D-K.top)/this.zoomLevel}},F.prototype.onWindowResize=function(){this.positionUI()},F.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var A=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=A+"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()},F.prototype.addLicenseKey=function(A){W.addKey(A)},F.prototype.addEventListener=function(A,D){this.eventListeners.addEventListener(A,D)},F.prototype.removeEventListener=function(A,D){this.eventListeners.removeEventListener(A,D)},F.prototype.renderState=function(A){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(A),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(F.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),F.prototype.focus=function(){var A=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(D){return D(new Ie(A))}))},F.prototype.blur=function(){var A=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(D){return D(new Ie(A))}))},F.instanceCounter=0,F}()},UUDw:function(Ot,ct,le){Ot.exports={buttonFixed:"buttonFixed___2zLVJ",button:"button___-JgFH",buttonWrap:"buttonWrap___aZhhk"}},UqFu:function(Ot,ct,le){"use strict";le.d(ct,"a",function(){return de});var de=function(k){var H=document.createElement("textarea");return H.value=k,H.value}},"VrN/":function(Ot,ct,le){(function(de,X){Ot.exports=X()})(this,function(){"use strict";var de=navigator.userAgent,X=navigator.platform,k=/gecko\/\d/i.test(de),H=/MSIE \d/.test(de),C=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(de),M=/Edge\/(\d+)/.exec(de),W=H||C||M,B=W&&(H?document.documentMode||6:+(M||C)[1]),P=!M&&/WebKit\//.test(de),R=P&&/Qt\/\d+\.\d+/.test(de),y=!M&&/Chrome\//.test(de),T=/Opera\//.test(de),_=/Apple Computer/.test(navigator.vendor),O=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(de),w=/PhantomJS/.test(de),g=!M&&/AppleWebKit/.test(de)&&/Mobile\/\w+/.test(de),u=/Android/.test(de),o=g||u||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(de),s=g||/Mac/.test(X),l=/\bCrOS\b/.test(de),b=/win/i.test(X),p=T&&de.match(/Version\/(\d*\.\d*)/);p&&(p=Number(p[1])),p&&p>=15&&(T=!1,P=!0);var h=s&&(R||T&&(p==null||p<12.11)),L=k||W&&B>=9;function v(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var c=function(e,t){var n=e.className,r=v(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function f(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function d(e,t){return f(e).appendChild(t)}function a(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var E=0;E<t.length;++E)i.appendChild(t[E]);return i}function x(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var m;document.createRange?m=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:m=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function S(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function I(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function z(e,t){var n=e.className;v(t).test(n)||(e.className+=(n?" ":"")+t)}function Y(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!v(n[r]).test(t)&&(t+=" "+n[r]);return t}var ie=function(e){e.select()};g?ie=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:W&&(ie=function(e){try{e.select()}catch(t){}});function G(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function j(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function oe(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var E=r||0,N=i||0;;){var V=e.indexOf(" ",E);if(V<0||V>=t)return N+(t-E);N+=V-E,N+=n-N%n,E=V+1}}var ye=function(){this.id=null,this.f=null,this.time=0,this.handler=G(this.onTimeout,this)};ye.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ye.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function Ce(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var De=50,Ye={toString:function(){return"CodeMirror.Pass"}},Ie={scroll:!1},Ve={origin:"*mouse"},Ne={origin:"+move"};function Ue(e,t,n){for(var r=0,i=0;;){var E=e.indexOf(" ",r);E==-1&&(E=e.length);var N=E-r;if(E==e.length||i+N>=t)return r+Math.min(N,t-i);if(i+=E-r,i+=n-i%n,r=E+1,i>=t)return r}}var Ae=[""];function F(e){for(;Ae.length<=e;)Ae.push(A(Ae)+" ");return Ae[e]}function A(e){return e[e.length-1]}function D(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function K(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function J(){}function U(e,t){var n;return Object.create?n=Object.create(e):(J.prototype=e,n=new J),t&&j(t,n),n}var me=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Me(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||me.test(e))}function je(e,t){return t?t.source.indexOf("\\w")>-1&&Me(e)?!0:t.test(e):Me(e)}function Xe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Be=/[\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 He(e){return e.charCodeAt(0)>=768&&Be.test(e)}function ze(e,t,n){for(;(n<0?t>0:t<e.length)&&He(e.charAt(t));)t+=n;return t}function rt(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,E=r<0?Math.ceil(i):Math.floor(i);if(E==t)return e(E)?t:n;e(E)?n=E:t=E+r}}function it(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,E=0;E<e.length;++E){var N=e[E];(N.from<n&&N.to>t||t==n&&N.to==t)&&(r(Math.max(N.from,t),Math.min(N.to,n),N.level==1?"rtl":"ltr",E),i=!0)}i||r(t,n,"ltr")}var lt=null;function et(e,t,n){var r;lt=null;for(var i=0;i<e.length;++i){var E=e[i];if(E.from<t&&E.to>t)return i;E.to==t&&(E.from!=E.to&&n=="before"?r=i:lt=i),E.from==t&&(E.from!=E.to&&n!="before"?r=i:lt=i)}return r!=null?r:lt}var St=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(te){return te<=247?e.charAt(te):1424<=te&&te<=1524?"R":1536<=te&&te<=1785?t.charAt(te-1536):1774<=te&&te<=2220?"r":8192<=te&&te<=8203?"w":te==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,E=/[LRr]/,N=/[Lb1n]/,V=/[1n]/;function $(te,ve,Se){this.level=te,this.from=ve,this.to=Se}return function(te,ve){var Se=ve=="ltr"?"L":"R";if(te.length==0||ve=="ltr"&&!r.test(te))return!1;for(var Pe=te.length,_e=[],Ge=0;Ge<Pe;++Ge)_e.push(n(te.charCodeAt(Ge)));for(var $e=0,nt=Se;$e<Pe;++$e){var ot=_e[$e];ot=="m"?_e[$e]=nt:nt=ot}for(var pt=0,st=Se;pt<Pe;++pt){var yt=_e[pt];yt=="1"&&st=="r"?_e[pt]="n":E.test(yt)&&(st=yt,yt=="r"&&(_e[pt]="R"))}for(var Mt=1,At=_e[0];Mt<Pe-1;++Mt){var Vt=_e[Mt];Vt=="+"&&At=="1"&&_e[Mt+1]=="1"?_e[Mt]="1":Vt==","&&At==_e[Mt+1]&&(At=="1"||At=="n")&&(_e[Mt]=At),At=Vt}for(var Er=0;Er<Pe;++Er){var Jr=_e[Er];if(Jr==",")_e[Er]="N";else if(Jr=="%"){var Dr=void 0;for(Dr=Er+1;Dr<Pe&&_e[Dr]=="%";++Dr);for(var kn=Er&&_e[Er-1]=="!"||Dr<Pe&&_e[Dr]=="1"?"1":"N",Cn=Er;Cn<Dr;++Cn)_e[Cn]=kn;Er=Dr-1}}for(var Fr=0,Tn=Se;Fr<Pe;++Fr){var nn=_e[Fr];Tn=="L"&&nn=="1"?_e[Fr]="L":E.test(nn)&&(Tn=nn)}for(var $r=0;$r<Pe;++$r)if(i.test(_e[$r])){var jr=void 0;for(jr=$r+1;jr<Pe&&i.test(_e[jr]);++jr);for(var Pr=($r?_e[$r-1]:Se)=="L",wn=(jr<Pe?_e[jr]:Se)=="L",_a=Pr==wn?Pr?"L":"R":Se,Hi=$r;Hi<jr;++Hi)_e[Hi]=_a;$r=jr-1}for(var ln=[],hi,qr=0;qr<Pe;)if(N.test(_e[qr])){var ps=qr;for(++qr;qr<Pe&&N.test(_e[qr]);++qr);ln.push(new $(0,ps,qr))}else{var Ti=qr,oa=ln.length,sa=ve=="rtl"?1:0;for(++qr;qr<Pe&&_e[qr]!="L";++qr);for(var gn=Ti;gn<qr;)if(V.test(_e[gn])){Ti<gn&&(ln.splice(oa,0,new $(1,Ti,gn)),oa+=sa);var Ra=gn;for(++gn;gn<qr&&V.test(_e[gn]);++gn);ln.splice(oa,0,new $(2,Ra,gn)),oa+=sa,Ti=gn}else++gn;Ti<qr&&ln.splice(oa,0,new $(1,Ti,qr))}return ve=="ltr"&&(ln[0].level==1&&(hi=te.match(/^\s+/))&&(ln[0].from=hi[0].length,ln.unshift(new $(0,0,hi[0].length))),A(ln).level==1&&(hi=te.match(/\s+$/))&&(A(ln).to-=hi[0].length,ln.push(new $(0,Pe-hi[0].length,Pe)))),ve=="rtl"?ln.reverse():ln}}();function ut(e,t){var n=e.order;return n==null&&(n=e.order=St(e.text,t)),n}var ht=[],Fe=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||ht).concat(n)}};function bt(e,t){return e._handlers&&e._handlers[t]||ht}function mt(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var E=Ce(i,n);E>-1&&(r[t]=i.slice(0,E).concat(i.slice(E+1)))}}}function se(e,t){var n=bt(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Z(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),se(e,n||t.type,e,t),he(t)||t.codemirrorIgnore}function Q(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)Ce(n,t[r])==-1&&n.push(t[r])}function ae(e,t){return bt(e,t).length>0}function ue(e){e.prototype.on=function(t,n){Fe(this,t,n)},e.prototype.off=function(t,n){mt(this,t,n)}}function ee(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ne(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function he(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function pe(e){ee(e),ne(e)}function Ee(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)),s&&e.ctrlKey&&t==1&&(t=3),t}var We=function(){if(W&&B<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),qe;function ft(e){if(qe==null){var t=a("span","\u200B");d(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(qe=t.offsetWidth<=1&&t.offsetHeight>2&&!(W&&B<8))}var n=qe?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var gt;function Wt(e){if(gt!=null)return gt;var t=d(e,document.createTextNode("A\u062EA")),n=m(t,0,1).getBoundingClientRect(),r=m(t,1,2).getBoundingClientRect();return f(e),!n||n.left==n.right?!1:gt=r.right-n.right<3}var Ct=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
|
|
`,t);i==-1&&(i=e.length);var E=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),N=E.indexOf("\r");N!=-1?(n.push(E.slice(0,N)),t+=N+1):(n.push(E),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},vt=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},ir=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),zt=null;function br(e){if(zt!=null)return zt;var t=d(e,a("span","x")),n=t.getBoundingClientRect(),r=m(t,0,1).getBoundingClientRect();return zt=Math.abs(n.left-r.left)>1}var vr={},It={};function Wr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),vr[e]=t}function en(e,t){It[e]=t}function Ir(e){if(typeof e=="string"&&It.hasOwnProperty(e))e=It[e];else if(e&&typeof e.name=="string"&&It.hasOwnProperty(e.name)){var t=It[e.name];typeof t=="string"&&(t={name:t}),e=U(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ir("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ir("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function an(e,t){t=Ir(t);var n=vr[t.name];if(!n)return an(e,"text/plain");var r=n(e,t);if(un.hasOwnProperty(t.name)){var i=un[t.name];for(var E in i){if(!i.hasOwnProperty(E))continue;r.hasOwnProperty(E)&&(r["_"+E]=r[E]),r[E]=i[E]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var N in t.modeProps)r[N]=t.modeProps[N];return r}var un={};function Kn(e,t){var n=un.hasOwnProperty(e)?un[e]:un[e]={};j(t,n)}function Hr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Bn(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function ei(e,t,n){return e.startState?e.startState(t,n):!0}var Sr=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Sr.prototype.eol=function(){return this.pos>=this.string.length},Sr.prototype.sol=function(){return this.pos==this.lineStart},Sr.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Sr.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Sr.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},Sr.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Sr.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Sr.prototype.skipToEnd=function(){this.pos=this.string.length},Sr.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Sr.prototype.backUp=function(e){this.pos-=e},Sr.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=oe(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?oe(this.string,this.lineStart,this.tabSize):0)},Sr.prototype.indentation=function(){return oe(this.string,null,this.tabSize)-(this.lineStart?oe(this.string,this.lineStart,this.tabSize):0)},Sr.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(N){return n?N.toLowerCase():N},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var E=this.string.slice(this.pos).match(e);return E&&E.index>0?null:(E&&t!==!1&&(this.pos+=E[0].length),E)}},Sr.prototype.current=function(){return this.string.slice(this.start,this.pos)},Sr.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Sr.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Sr.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 n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],E=i.chunkSize();if(t<E){n=i;break}t-=E}return n.lines[t]}function Jt(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(E){var N=E.text;i==n.line&&(N=N.slice(0,n.ch)),i==t.line&&(N=N.slice(t.ch)),r.push(N),++i}),r}function Kr(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function Nt(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Pt(e){if(e.parent==null)return null;for(var t=e.parent,n=Ce(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;!(r.children[i]==t);++i)n+=r.children[i].chunkSize();return n+t.first}function or(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],E=i.height;if(t<E){e=i;continue e}t-=E,n+=i.chunkSize()}return n}while(!e.lines);for(var N=0;N<e.lines.length;++N){var V=e.lines[N],$=V.height;if(t<$)break;t-=$}return n+N}function vn(e,t){return t>=e.first&&t<e.first+e.size}function kr(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Qe(e,t,n){if(n===void 0&&(n=null),!(this instanceof Qe))return new Qe(e,t,n);this.line=e,this.ch=t,this.sticky=n}function kt(e,t){return e.line-t.line||e.ch-t.ch}function zn(e,t){return e.sticky==t.sticky&&kt(e,t)==0}function fi(e){return Qe(e.line,e.ch)}function wi(e,t){return kt(e,t)<0?t:e}function Gn(e,t){return kt(e,t)<0?e:t}function Ai(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function Rt(e,t){if(t.line<e.first)return Qe(e.first,0);var n=e.first+e.size-1;return t.line>n?Qe(n,dt(e,n).text.length):la(t,dt(e,t.line).text.length)}function la(e,t){var n=e.ch;return n==null||n>t?Qe(e.line,t):n<0?Qe(e.line,0):e}function tt(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=Rt(e,t[r]);return n}var Vn=function(e,t){this.state=e,this.lookAhead=t},yn=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};yn.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},yn.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}},yn.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},yn.fromSaved=function(e,t,n){return t instanceof Vn?new yn(e,Hr(e.mode,t.state),n,t.lookAhead):new yn(e,Hr(e.mode,t),n)},yn.prototype.save=function(e){var t=e!==!1?Hr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Vn(t,this.maxLookAhead):t};function Ki(e,t,n,r){var i=[e.state.modeGen],E={};Mn(e,t.text,e.doc.mode,n,function(te,ve){return i.push(te,ve)},E,r);for(var N=n.state,V=function(te){n.baseTokens=i;var ve=e.state.overlays[te],Se=1,Pe=0;n.state=!0,Mn(e,t.text,ve.mode,n,function(_e,Ge){for(var $e=Se;Pe<_e;){var nt=i[Se];nt>_e&&i.splice(Se,1,_e,i[Se+1],nt),Se+=2,Pe=Math.min(_e,nt)}if(!Ge)return;if(ve.opaque)i.splice($e,Se-$e,_e,"overlay "+Ge),Se=$e+2;else for(;$e<Se;$e+=2){var ot=i[$e+1];i[$e+1]=(ot?ot+" ":"")+"overlay "+Ge}},E),n.state=N,n.baseTokens=null,n.baseTokenPos=1},$=0;$<e.state.overlays.length;++$)V($);return{styles:i,classes:E.bgClass||E.textClass?E:null}}function pi(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Dn(e,Pt(t)),i=t.text.length>e.options.maxHighlightLength&&Hr(e.doc.mode,r.state),E=Ki(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=E.styles,E.classes?t.styleClasses=E.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Dn(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new yn(r,!0,t);var E=Vi(e,t,n),N=E>r.first&&dt(r,E-1).stateAfter,V=N?yn.fromSaved(r,N,E):new yn(r,ei(r.mode),E);return r.iter(E,t,function($){Li(e,$.text,V);var te=V.line;$.stateAfter=te==t-1||te%5==0||te>=i.viewFrom&&te<i.viewTo?V.save():null,V.nextLine()}),n&&(r.modeFrontier=V.line),V}function Li(e,t,n,r){var i=e.doc.mode,E=new Sr(t,e.options.tabSize,n);for(E.start=E.pos=r||0,t==""&&zi(i,n.state);!E.eol();)An(i,E,n.state),E.start=E.pos}function zi(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Bn(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function An(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Bn(e,n).mode);var E=e.token(t,n);if(t.pos>t.start)return E}throw new Error("Mode "+e.name+" failed to advance stream.")}var Gi=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function ua(e,t,n,r){var i=e.doc,E=i.mode,N;t=Rt(i,t);var V=dt(i,t.line),$=Dn(e,t.line,n),te=new Sr(V.text,e.options.tabSize,$),ve;for(r&&(ve=[]);(r||te.pos<t.ch)&&!te.eol();)te.start=te.pos,N=An(E,te,$.state),r&&ve.push(new Gi(te,N,Hr(i.mode,$.state)));return r?ve:new Gi(te,N,$.state)}function Oi(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function Mn(e,t,n,r,i,E,N){var V=n.flattenSpans;V==null&&(V=e.options.flattenSpans);var $=0,te=null,ve=new Sr(t,e.options.tabSize,r),Se,Pe=e.options.addModeClass&&[null];for(t==""&&Oi(zi(n,r.state),E);!ve.eol();){if(ve.pos>e.options.maxHighlightLength?(V=!1,N&&Li(e,t,r,ve.pos),ve.pos=t.length,Se=null):Se=Oi(An(n,ve,r.state,Pe),E),Pe){var _e=Pe[0].name;_e&&(Se="m-"+(Se?_e+" "+Se:_e))}if(!V||te!=Se){for(;$<ve.start;)$=Math.min(ve.start,$+5e3),i($,te);te=Se}ve.start=ve.pos}for(;$<ve.pos;){var Ge=Math.min(ve.pos,$+5e3);i(Ge,te),$=Ge}}function Vi(e,t,n){for(var r,i,E=e.doc,N=n?-1:t-(e.doc.mode.innerMode?1e3:100),V=t;V>N;--V){if(V<=E.first)return E.first;var $=dt(E,V-1),te=$.stateAfter;if(te&&(!n||V+(te instanceof Vn?te.lookAhead:0)<=E.modeFrontier))return V;var ve=oe($.text,null,e.options.tabSize);(i==null||r>ve)&&(i=V-1,r=ve)}return i}function Pa(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,r=t-1;r>n;r--){var i=dt(e,r).stateAfter;if(i&&(!(i instanceof Vn)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Xi=!1,Qr=!1;function ti(){Xi=!0}function Ia(){Qr=!0}function ri(e,t,n){this.marker=e,this.from=t,this.to=n}function bn(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Yi(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Na(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function da(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var E=e[i],N=E.marker,V=E.from==null||(N.inclusiveLeft?E.from<=t:E.from<t);if(V||E.from==t&&N.type=="bookmark"&&(!n||!E.marker.insertLeft)){var $=E.to==null||(N.inclusiveRight?E.to>=t:E.to>t);(r||(r=[])).push(new ri(N,E.from,$?null:E.to))}}return r}function ca(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var E=e[i],N=E.marker,V=E.to==null||(N.inclusiveRight?E.to>=t:E.to>t);if(V||E.from==t&&N.type=="bookmark"&&(!n||E.marker.insertLeft)){var $=E.from==null||(N.inclusiveLeft?E.from<=t:E.from<t);(r||(r=[])).push(new ri(N,$?null:E.from-t,E.to==null?null:E.to-t))}}return r}function ki(e,t){if(t.full)return null;var n=vn(e,t.from.line)&&dt(e,t.from.line).markedSpans,r=vn(e,t.to.line)&&dt(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,E=t.to.ch,N=kt(t.from,t.to)==0,V=da(n,i,N),$=ca(r,E,N),te=t.text.length==1,ve=A(t.text).length+(te?i:0);if(V)for(var Se=0;Se<V.length;++Se){var Pe=V[Se];if(Pe.to==null){var _e=bn($,Pe.marker);_e?te&&(Pe.to=_e.to==null?null:_e.to+ve):Pe.to=i}}if($)for(var Ge=0;Ge<$.length;++Ge){var $e=$[Ge];if($e.to!=null&&($e.to+=ve),$e.from==null){var nt=bn(V,$e.marker);nt||($e.from=ve,te&&(V||(V=[])).push($e))}else $e.from+=ve,te&&(V||(V=[])).push($e)}V&&(V=_n(V)),$&&$!=V&&($=_n($));var ot=[V];if(!te){var pt=t.text.length-2,st;if(pt>0&&V)for(var yt=0;yt<V.length;++yt)V[yt].to==null&&(st||(st=[])).push(new ri(V[yt].marker,null,null));for(var Mt=0;Mt<pt;++Mt)ot.push(st);ot.push($)}return ot}function _n(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function $i(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(_e){if(_e.markedSpans)for(var Ge=0;Ge<_e.markedSpans.length;++Ge){var $e=_e.markedSpans[Ge].marker;$e.readOnly&&(!r||Ce(r,$e)==-1)&&(r||(r=[])).push($e)}}),!r)return null;for(var i=[{from:t,to:n}],E=0;E<r.length;++E)for(var N=r[E],V=N.find(0),$=0;$<i.length;++$){var te=i[$];if(kt(te.to,V.from)<0||kt(te.from,V.to)>0)continue;var ve=[$,1],Se=kt(te.from,V.from),Pe=kt(te.to,V.to);(Se<0||!N.inclusiveLeft&&!Se)&&ve.push({from:te.from,to:V.from}),(Pe>0||!N.inclusiveRight&&!Pe)&&ve.push({from:V.to,to:te.to}),i.splice.apply(i,ve),$+=ve.length-3}return i}function Ua(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function Qi(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function ni(e){return e.inclusiveLeft?-1:0}function mi(e){return e.inclusiveRight?1:0}function Fn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),E=kt(r.from,i.from)||ni(e)-ni(t);if(E)return-E;var N=kt(r.to,i.to)||mi(e)-mi(t);return N||t.id-e.id}function jn(e,t){var n=Qr&&e.markedSpans,r;if(n)for(var i=void 0,E=0;E<n.length;++E)i=n[E],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||Fn(r,i.marker)<0)&&(r=i.marker);return r}function Wn(e){return jn(e,!0)}function Xn(e){return jn(e,!1)}function gi(e,t){var n=Qr&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var E=n[i];E.marker.collapsed&&(E.from==null||E.from<t)&&(E.to==null||E.to>t)&&(!r||Fn(r,E.marker)<0)&&(r=E.marker)}return r}function ha(e,t,n,r,i){var E=dt(e,t),N=Qr&&E.markedSpans;if(N)for(var V=0;V<N.length;++V){var $=N[V];if(!$.marker.collapsed)continue;var te=$.marker.find(0),ve=kt(te.from,n)||ni($.marker)-ni(i),Se=kt(te.to,r)||mi($.marker)-mi(i);if(ve>=0&&Se<=0||ve<=0&&Se>=0)continue;if(ve<=0&&($.marker.inclusiveRight&&i.inclusiveLeft?kt(te.to,n)>=0:kt(te.to,n)>0)||ve>=0&&($.marker.inclusiveRight&&i.inclusiveLeft?kt(te.from,r)<=0:kt(te.from,r)<0))return!0}}function dn(e){for(var t;t=Wn(e);)e=t.find(-1,!0).line;return e}function fa(e){for(var t;t=Xn(e);)e=t.find(1,!0).line;return e}function Di(e){for(var t,n;t=Xn(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function ii(e,t){var n=dt(e,t),r=dn(n);return n==r?t:Pt(r)}function xn(e,t){if(t>e.lastLine())return t;var n=dt(e,t),r;if(!En(e,n))return t;for(;r=Xn(n);)n=r.find(1,!0).line;return Pt(n)+1}function En(e,t){var n=Qr&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i){if(r=n[i],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&Zi(e,t,r))return!0}}function Zi(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return Zi(e,r.line,bn(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,E=0;E<t.markedSpans.length;++E)if(i=t.markedSpans[E],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Zi(e,t,i))return!0}function Ln(e){e=dn(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var E=n.parent;E;n=E,E=n.parent)for(var N=0;N<E.children.length;++N){var V=E.children[N];if(V==n)break;t+=V.height}return t}function Ji(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Wn(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Xn(r);){var E=n.find(0,!0);t-=r.text.length-E.from.ch,r=E.to.line,t+=r.text.length-E.to.ch}return t}function qi(e){var t=e.display,n=e.doc;t.maxLine=dt(n,n.first),t.maxLineLength=Ji(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=Ji(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var vi=function(e,t,n){this.text=e,Qi(this,t),this.height=n?n(this):1};vi.prototype.lineNo=function(){return Pt(this)},ue(vi);function Ba(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Ua(e),Qi(e,n);var i=r?r(e):1;i!=e.height&&Nt(e,i)}function Et(e){e.parent=null,Ua(e)}var _t={},Tt={};function Gt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Tt:_t;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function rr(e,t){var n=x("span",null,null,P?"padding-right: .1px":null),r={pre:x("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var E=i?t.rest[i-1]:t.line,N=void 0;r.pos=0,r.addToken=qt,Wt(e.display.measure)&&(N=ut(E,e.doc.direction))&&(r.addToken=cn(r.addToken,N)),r.map=[];var V=t!=e.display.externalMeasured&&Pt(E);Yn(E,r,pi(e,E,V)),E.styleClasses&&(E.styleClasses.bgClass&&(r.bgClass=Y(E.styleClasses.bgClass,r.bgClass||"")),E.styleClasses.textClass&&(r.textClass=Y(E.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ft(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(P){var $=r.content.lastChild;(/\bcm-tab\b/.test($.className)||$.querySelector&&$.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return se(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=Y(r.pre.className,r.textClass||"")),r}function dr(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function qt(e,t,n,r,i,E,N){if(!t)return;var V=e.splitSpaces?Mr(t,e.trailingSpace):t,$=e.cm.state.specialChars,te=!1,ve;if(!$.test(t))e.col+=t.length,ve=document.createTextNode(V),e.map.push(e.pos,e.pos+t.length,ve),W&&B<9&&(te=!0),e.pos+=t.length;else{ve=document.createDocumentFragment();for(var Se=0;;){$.lastIndex=Se;var Pe=$.exec(t),_e=Pe?Pe.index-Se:t.length-Se;if(_e){var Ge=document.createTextNode(V.slice(Se,Se+_e));W&&B<9?ve.appendChild(a("span",[Ge])):ve.appendChild(Ge),e.map.push(e.pos,e.pos+_e,Ge),e.col+=_e,e.pos+=_e}if(!Pe)break;Se+=_e+1;var $e=void 0;if(Pe[0]==" "){var nt=e.cm.options.tabSize,ot=nt-e.col%nt;$e=ve.appendChild(a("span",F(ot),"cm-tab")),$e.setAttribute("role","presentation"),$e.setAttribute("cm-text"," "),e.col+=ot}else Pe[0]=="\r"||Pe[0]==`
|
|
`?($e=ve.appendChild(a("span",Pe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),$e.setAttribute("cm-text",Pe[0]),e.col+=1):($e=e.cm.options.specialCharPlaceholder(Pe[0]),$e.setAttribute("cm-text",Pe[0]),W&&B<9?ve.appendChild(a("span",[$e])):ve.appendChild($e),e.col+=1);e.map.push(e.pos,e.pos+1,$e),e.pos++}}if(e.trailingSpace=V.charCodeAt(t.length-1)==32,n||r||i||te||E||N){var pt=n||"";r&&(pt+=r),i&&(pt+=i);var st=a("span",[ve],pt,E);if(N)for(var yt in N)N.hasOwnProperty(yt)&&yt!="style"&&yt!="class"&&st.setAttribute(yt,N[yt]);return e.content.appendChild(st)}e.content.appendChild(ve)}function Mr(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var E=e.charAt(i);E==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(E="\xA0"),r+=E,n=E==" "}return r}function cn(e,t){return function(n,r,i,E,N,V,$){i=i?i+" cm-force-border":"cm-force-border";for(var te=n.pos,ve=te+r.length;;){for(var Se=void 0,Pe=0;Pe<t.length&&!(Se=t[Pe],Se.to>te&&Se.from<=te);Pe++);if(Se.to>=ve)return e(n,r,i,E,N,V,$);e(n,r.slice(0,Se.to-te),i,E,null,V,$),E=null,r=r.slice(Se.to-te),te=Se.to}}}function Xt(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Yn(e,t,n){var r=e.markedSpans,i=e.text,E=0;if(!r){for(var N=1;N<n.length;N+=2)t.addToken(t,i.slice(E,E=n[N]),Gt(n[N+1],t.cm.options));return}for(var V=i.length,$=0,te=1,ve="",Se,Pe,_e=0,Ge,$e,nt,ot,pt;;){if(_e==$){Ge=$e=nt=Pe="",pt=null,ot=null,_e=Infinity;for(var st=[],yt=void 0,Mt=0;Mt<r.length;++Mt){var At=r[Mt],Vt=At.marker;if(Vt.type=="bookmark"&&At.from==$&&Vt.widgetNode)st.push(Vt);else if(At.from<=$&&(At.to==null||At.to>$||Vt.collapsed&&At.to==$&&At.from==$)){if(At.to!=null&&At.to!=$&&_e>At.to&&(_e=At.to,$e=""),Vt.className&&(Ge+=" "+Vt.className),Vt.css&&(Pe=(Pe?Pe+";":"")+Vt.css),Vt.startStyle&&At.from==$&&(nt+=" "+Vt.startStyle),Vt.endStyle&&At.to==_e&&(yt||(yt=[])).push(Vt.endStyle,At.to),Vt.title&&((pt||(pt={})).title=Vt.title),Vt.attributes)for(var Er in Vt.attributes)(pt||(pt={}))[Er]=Vt.attributes[Er];Vt.collapsed&&(!ot||Fn(ot.marker,Vt)<0)&&(ot=At)}else At.from>$&&_e>At.from&&(_e=At.from)}if(yt)for(var Jr=0;Jr<yt.length;Jr+=2)yt[Jr+1]==_e&&($e+=" "+yt[Jr]);if(!ot||ot.from==$)for(var Dr=0;Dr<st.length;++Dr)Xt(t,0,st[Dr]);if(ot&&(ot.from||0)==$){if(Xt(t,(ot.to==null?V+1:ot.to)-$,ot.marker,ot.from==null),ot.to==null)return;ot.to==$&&(ot=!1)}}if($>=V)break;for(var kn=Math.min(V,_e);;){if(ve){var Cn=$+ve.length;if(!ot){var Fr=Cn>kn?ve.slice(0,kn-$):ve;t.addToken(t,Fr,Se?Se+Ge:Ge,nt,$+Fr.length==_e?$e:"",Pe,pt)}if(Cn>=kn){ve=ve.slice(kn-$),$=kn;break}$=Cn,nt=""}ve=i.slice(E,E=n[te++]),Se=Gt(n[te++],t.cm.options)}}}function sr(e,t,n){this.line=t,this.rest=Di(t),this.size=this.rest?Pt(A(this.rest))-n+1:1,this.node=this.text=null,this.hidden=En(e,t)}function tn(e,t,n){for(var r=[],i,E=t;E<n;E=i){var N=new sr(e.doc,dt(e.doc,E),E);i=E+N.size,r.push(N)}return r}var Zr=null;function On(e){Zr?Zr.ops.push(e):e.ownsGroup=Zr={ops:[e],delayedCallbacks:[]}}function Fa(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Ko(e,t){var n=e.ownsGroup;if(!n)return;try{Fa(n)}finally{Zr=null,t(n)}}var Mi=null;function _r(e,t){var n=bt(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Zr?i=Zr.delayedCallbacks:Mi?i=Mi:(i=Mi=[],setTimeout(go,0));for(var E=function(V){i.push(function(){return n[V].apply(null,r)})},N=0;N<n.length;++N)E(N)}function go(){var e=Mi;Mi=null;for(var t=0;t<e.length;++t)e[t]()}function vo(e,t,n,r){for(var i=0;i<t.changes.length;i++){var E=t.changes[i];E=="text"?yo(e,t):E=="gutter"?Ha(e,t,n,r):E=="class"?Wa(e,t):E=="widget"&&Go(e,t,r)}t.changes=null}function ea(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),W&&B<8&&(e.node.style.zIndex=2)),e.node}function zo(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=ea(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function ja(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):rr(e,t)}function yo(e,t){var n=t.text.className,r=ja(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,Wa(e,t)):n&&(t.text.className=n)}function Wa(e,t){zo(e,t),t.line.wrapClass?ea(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Ha(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=ea(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var E=t.line.gutterMarkers;if(e.options.lineNumbers||E){var N=ea(t),V=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(V),N.insertBefore(V,t.text),t.line.gutterClass&&(V.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!E||!E["CodeMirror-linenumbers"])&&(t.lineNumber=V.appendChild(a("div",kr(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),E)for(var $=0;$<e.display.gutterSpecs.length;++$){var te=e.display.gutterSpecs[$].className,ve=E.hasOwnProperty(te)&&E[te];ve&&V.appendChild(a("div",[ve],"CodeMirror-gutter-elt","left: "+r.gutterLeft[te]+"px; width: "+r.gutterWidth[te]+"px"))}}}function Go(e,t,n){t.alignable&&(t.alignable=null);for(var r=v("CodeMirror-linewidget"),i=t.node.firstChild,E=void 0;i;i=E)E=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Ka(e,t,n)}function bo(e,t,n,r){var i=ja(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),Wa(e,t),Ha(e,t,n,r),Ka(e,t,r),t.node}function Ka(e,t,n){if(xo(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)xo(e,t.rest[r],t,n,!1)}function xo(e,t,n,r,i){if(!t.widgets)return;for(var E=ea(n),N=0,V=t.widgets;N<V.length;++N){var $=V[N],te=a("div",[$.node],"CodeMirror-linewidget"+($.className?" "+$.className:""));$.handleMouseEvents||te.setAttribute("cm-ignore-events","true"),Vo($,te,n,r),e.display.input.setUneditable(te),i&&$.above?E.insertBefore(te,n.gutter||n.text):E.appendChild(te),_r($,"redraw")}}function Vo(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function _i(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!S(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),d(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function $n(e,t){for(var n=Ee(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function za(e){return e.lineSpace.offsetTop}function fe(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Te(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=d(e.measure,a("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Le(e){return De-e.display.nativeBarWidth}function ge(e){return e.display.scroller.clientWidth-Le(e)-e.display.barWidth}function q(e){return e.display.scroller.clientHeight-Le(e)-e.display.barHeight}function ce(e,t,n){var r=e.options.lineWrapping,i=r&&ge(e);if(!t.measure.heights||r&&t.measure.width!=i){var E=t.measure.heights=[];if(r){t.measure.width=i;for(var N=t.text.firstChild.getClientRects(),V=0;V<N.length-1;V++){var $=N[V],te=N[V+1];Math.abs($.bottom-te.bottom)>2&&E.push(($.bottom+te.top)/2-n.top)}}E.push(n.bottom-n.top)}}function re(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(Pt(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function be(e,t){t=dn(t);var n=Pt(t),r=e.display.externalMeasured=new sr(e.doc,t,n);r.lineN=n;var i=r.built=rr(e,r);return r.text=i.pre,d(e.display.lineMeasure,i.pre),r}function xe(e,t,n,r){return Re(e,we(e,t),n,r)}function Oe(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[xr(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function we(e,t){var n=Pt(t),r=Oe(e,n);r&&!r.text?r=null:r&&r.changes&&(vo(e,r,n,Ar(e)),e.curOp.forceUpdate=!0),r||(r=be(e,t));var i=re(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Re(e,t,n,r,i){t.before&&(n=-1);var E=n+(r||""),N;return t.cache.hasOwnProperty(E)?N=t.cache[E]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(ce(e,t.view,t.rect),t.hasHeights=!0),N=at(e,t,n,r),N.bogus||(t.cache[E]=N)),{left:N.left,right:N.right,top:i?N.rtop:N.top,bottom:i?N.rbottom:N.bottom}}var Ke={left:0,right:0,top:0,bottom:0};function Je(e,t,n){for(var r,i,E,N,V,$,te=0;te<e.length;te+=3)if(V=e[te],$=e[te+1],t<V?(i=0,E=1,N="left"):t<$?(i=t-V,E=i+1):(te==e.length-3||t==$&&e[te+3]>t)&&(E=$-V,i=E-1,t>=$&&(N="right")),i!=null){if(r=e[te+2],V==$&&n==(r.insertLeft?"left":"right")&&(N=n),n=="left"&&i==0)for(;te&&e[te-2]==e[te-3]&&e[te-1].insertLeft;)r=e[(te-=3)+2],N="left";if(n=="right"&&i==$-V)for(;te<e.length-3&&e[te+3]==e[te+4]&&!e[te+5].insertLeft;)r=e[(te+=3)+2],N="right";break}return{node:r,start:i,end:E,collapse:N,coverStart:V,coverEnd:$}}function Ze(e,t){var n=Ke;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var i=e.length-1;i>=0&&!((n=e[i]).left!=n.right);i--);return n}function at(e,t,n,r){var i=Je(t.map,n,r),E=i.node,N=i.start,V=i.end,$=i.collapse,te;if(E.nodeType==3){for(var ve=0;ve<4;ve++){for(;N&&He(t.line.text.charAt(i.coverStart+N));)--N;for(;i.coverStart+V<i.coverEnd&&He(t.line.text.charAt(i.coverStart+V));)++V;if(W&&B<9&&N==0&&V==i.coverEnd-i.coverStart?te=E.parentNode.getBoundingClientRect():te=Ze(m(E,N,V).getClientRects(),r),te.left||te.right||N==0)break;V=N,N=N-1,$="right"}W&&B<11&&(te=Dt(e.display.measure,te))}else{N>0&&($=r="right");var Se;e.options.lineWrapping&&(Se=E.getClientRects()).length>1?te=Se[r=="right"?Se.length-1:0]:te=E.getBoundingClientRect()}if(W&&B<9&&!N&&(!te||!te.left&&!te.right)){var Pe=E.parentNode.getClientRects()[0];Pe?te={left:Pe.left,right:Pe.left+zr(e.display),top:Pe.top,bottom:Pe.bottom}:te=Ke}for(var _e=te.top-t.rect.top,Ge=te.bottom-t.rect.top,$e=(_e+Ge)/2,nt=t.view.measure.heights,ot=0;ot<nt.length-1&&!($e<nt[ot]);ot++);var pt=ot?nt[ot-1]:0,st=nt[ot],yt={left:($=="right"?te.right:te.left)-t.rect.left,right:($=="left"?te.left:te.right)-t.rect.left,top:pt,bottom:st};return!te.left&&!te.right&&(yt.bogus=!0),e.options.singleCursorHeightPerLine||(yt.rtop=_e,yt.rbottom=Ge),yt}function Dt(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!br(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function Ht(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 Ut(e){e.display.externalMeasure=null,f(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Ht(e.display.view[t])}function Bt(e){Ut(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Kt(){return y&&u?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function jt(){return y&&u?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Ft(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=_i(e.widgets[n]));return t}function er(e,t,n,r,i){if(!i){var E=Ft(t);n.top+=E,n.bottom+=E}if(r=="line")return n;r||(r="local");var N=Ln(t);if(r=="local"?N+=za(e.display):N-=e.display.viewOffset,r=="page"||r=="window"){var V=e.display.lineSpace.getBoundingClientRect();N+=V.top+(r=="window"?0:jt());var $=V.left+(r=="window"?0:Kt());n.left+=$,n.right+=$}return n.top+=N,n.bottom+=N,n}function Yt(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=Kt(),i-=jt();else if(n=="local"||!n){var E=e.display.sizer.getBoundingClientRect();r+=E.left,i+=E.top}var N=e.display.lineSpace.getBoundingClientRect();return{left:r-N.left,top:i-N.top}}function Cr(e,t,n,r,i){return r||(r=dt(e.doc,t.line)),er(e,r,xe(e,r,t.ch,i),n)}function $t(e,t,n,r,i,E){r=r||dt(e.doc,t.line),i||(i=we(e,r));function N(Ge,$e){var nt=Re(e,i,Ge,$e?"right":"left",E);return $e?nt.left=nt.right:nt.right=nt.left,er(e,r,nt,n)}var V=ut(r,e.doc.direction),$=t.ch,te=t.sticky;if($>=r.text.length?($=r.text.length,te="before"):$<=0&&($=0,te="after"),!V)return N(te=="before"?$-1:$,te=="before");function ve(Ge,$e,nt){var ot=V[$e],pt=ot.level==1;return N(nt?Ge-1:Ge,pt!=nt)}var Se=et(V,$,te),Pe=lt,_e=ve($,Se,te=="before");return Pe!=null&&(_e.other=ve($,Pe,te!="before")),_e}function Lt(e,t){var n=0;t=Rt(e.doc,t),e.options.lineWrapping||(n=zr(e.display)*t.ch);var r=dt(e.doc,t.line),i=Ln(r)+za(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function wt(e,t,n,r,i){var E=Qe(e,t,n);return E.xRel=i,r&&(E.outside=r),E}function Qt(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return wt(r.first,0,null,-1,-1);var i=or(r,n),E=r.first+r.size-1;if(i>E)return wt(r.first+r.size-1,dt(r,E).text.length,null,1,1);t<0&&(t=0);for(var N=dt(r,i);;){var V=Tr(e,N,i,t,n),$=gi(N,V.ch+(V.xRel>0||V.outside>0?1:0));if(!$)return V;var te=$.find(1);if(te.line==i)return te;N=dt(r,i=te.line)}}function tr(e,t,n,r){r-=Ft(t);var i=t.text.length,E=rt(function(N){return Re(e,n,N-1).bottom<=r},i,0);return i=rt(function(N){return Re(e,n,N).top>r},E,i),{begin:E,end:i}}function xt(e,t,n,r){n||(n=we(e,t));var i=er(e,t,Re(e,n,r),"line").top;return tr(e,t,n,i)}function nr(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Tr(e,t,n,r,i){i-=Ln(t);var E=we(e,t),N=Ft(t),V=0,$=t.text.length,te=!0,ve=ut(t,e.doc.direction);if(ve){var Se=(e.options.lineWrapping?pr:ar)(e,t,n,E,ve,r,i);te=Se.level!=1,V=te?Se.from:Se.to-1,$=te?Se.to:Se.from-1}var Pe=null,_e=null,Ge=rt(function(Mt){var At=Re(e,E,Mt);return At.top+=N,At.bottom+=N,nr(At,r,i,!1)?(At.top<=i&&At.left<=r&&(Pe=Mt,_e=At),!0):!1},V,$),$e,nt,ot=!1;if(_e){var pt=r-_e.left<_e.right-r,st=pt==te;Ge=Pe+(st?0:1),nt=st?"after":"before",$e=pt?_e.left:_e.right}else{!te&&(Ge==$||Ge==V)&&Ge++,nt=Ge==0?"after":Ge==t.text.length?"before":Re(e,E,Ge-(te?1:0)).bottom+N<=i==te?"after":"before";var yt=$t(e,Qe(n,Ge,nt),"line",t,E);$e=yt.left,ot=i<yt.top?-1:i>=yt.bottom?1:0}return Ge=ze(t.text,Ge,1),wt(n,Ge,nt,ot,r-$e)}function ar(e,t,n,r,i,E,N){var V=rt(function(Se){var Pe=i[Se],_e=Pe.level!=1;return nr($t(e,Qe(n,_e?Pe.to:Pe.from,_e?"before":"after"),"line",t,r),E,N,!0)},0,i.length-1),$=i[V];if(V>0){var te=$.level!=1,ve=$t(e,Qe(n,te?$.from:$.to,te?"after":"before"),"line",t,r);nr(ve,E,N,!0)&&ve.top>N&&($=i[V-1])}return $}function pr(e,t,n,r,i,E,N){var V=tr(e,t,r,N),$=V.begin,te=V.end;/\s/.test(t.text.charAt(te-1))&&te--;for(var ve=null,Se=null,Pe=0;Pe<i.length;Pe++){var _e=i[Pe];if(_e.from>=te||_e.to<=$)continue;var Ge=_e.level!=1,$e=Re(e,r,Ge?Math.min(te,_e.to)-1:Math.max($,_e.from)).right,nt=$e<E?E-$e+1e9:$e-E;(!ve||Se>nt)&&(ve=_e,Se=nt)}return ve||(ve=i[i.length-1]),ve.from<$&&(ve={from:$,to:ve.to,level:ve.level}),ve.to>te&&(ve={from:ve.from,to:te,level:ve.level}),ve}var hr;function Rr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(hr==null){hr=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)hr.appendChild(document.createTextNode("x")),hr.appendChild(a("br"));hr.appendChild(document.createTextNode("x"))}d(e.measure,hr);var n=hr.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),f(e.measure),n||1}function zr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");d(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Ar(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,E=t.gutters.firstChild,N=0;E;E=E.nextSibling,++N){var V=e.display.gutterSpecs[N].className;n[V]=E.offsetLeft+E.clientLeft+i,r[V]=E.clientWidth}return{fixedPos:on(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function on(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Rn(e){var t=Rr(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/zr(e.display)-3);return function(i){if(En(e.doc,i))return 0;var E=0;if(i.widgets)for(var N=0;N<i.widgets.length;N++)i.widgets[N].height&&(E+=i.widgets[N].height);return n?E+(Math.ceil(i.text.length/r)||1)*t:E+t}}function hn(e){var t=e.doc,n=Rn(e);t.iter(function(r){var i=n(r);i!=r.height&&Nt(r,i)})}function Gr(e,t,n,r){var i=e.display;if(!n&&Ee(t).getAttribute("cm-not-content")=="true")return null;var E,N,V=i.lineSpace.getBoundingClientRect();try{E=t.clientX-V.left,N=t.clientY-V.top}catch(Se){return null}var $=Qt(e,E,N),te;if(r&&$.xRel>0&&(te=dt(e.doc,$.line).text).length==$.ch){var ve=oe(te,te.length,e.options.tabSize)-te.length;$=Qe($.line,Math.max(0,Math.round((E-Te(e.display).left)/zr(e.display))-ve))}return $}function xr(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function mr(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Qr&&ii(e.doc,t)<i.viewTo&&wr(e);else if(n<=i.viewFrom)Qr&&xn(e.doc,n+r)>i.viewFrom?wr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)wr(e);else if(t<=i.viewFrom){var E=Pn(e,n,n+r,1);E?(i.view=i.view.slice(E.index),i.viewFrom=E.lineN,i.viewTo+=r):wr(e)}else if(n>=i.viewTo){var N=Pn(e,t,t,-1);N?(i.view=i.view.slice(0,N.index),i.viewTo=N.lineN):wr(e)}else{var V=Pn(e,t,t,-1),$=Pn(e,n,n+r,1);V&&$?(i.view=i.view.slice(0,V.index).concat(tn(e,V.lineN,$.lineN)).concat(i.view.slice($.index)),i.viewTo+=r):wr(e)}var te=i.externalMeasured;te&&(n<te.lineN?te.lineN+=r:t<te.lineN+te.size&&(i.externalMeasured=null))}function Lr(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var E=r.view[xr(e,t)];if(E.node==null)return;var N=E.changes||(E.changes=[]);Ce(N,n)==-1&&N.push(n)}function wr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Pn(e,t,n,r){var i=xr(e,t),E,N=e.display.view;if(!Qr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var V=e.display.viewFrom,$=0;$<i;$++)V+=N[$].size;if(V!=t){if(r>0){if(i==N.length-1)return null;E=V+N[i].size-t,i++}else E=V-t;t+=E,n+=E}for(;ii(e.doc,n)!=n;){if(i==(r<0?0:N.length-1))return null;n+=r*N[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function ai(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=tn(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=tn(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(xr(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(tn(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,xr(e,n)))),r.viewTo=n}function oi(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function fr(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Hn(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),E=r.selection=document.createDocumentFragment(),N=0;N<n.sel.ranges.length;N++){if(!t&&N==n.sel.primIndex)continue;var V=n.sel.ranges[N];if(V.from().line>=e.display.viewTo||V.to().line<e.display.viewFrom)continue;var $=V.empty();($||e.options.showCursorWhenSelecting)&&si(e,V.head,i),$||cr(e,V,E)}return r}function si(e,t,n){var r=$t(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(a("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var E=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));E.style.display="",E.style.left=r.other.left+"px",E.style.top=r.other.top+"px",E.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function yr(e,t){return e.top-t.top||e.left-t.left}function cr(e,t,n){var r=e.display,i=e.doc,E=document.createDocumentFragment(),N=Te(e.display),V=N.left,$=Math.max(r.sizerWidth,ge(e)-r.sizer.offsetLeft)-N.right,te=i.direction=="ltr";function ve(st,yt,Mt,At){yt<0&&(yt=0),yt=Math.round(yt),At=Math.round(At),E.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+st+`px;
|
|
top: `+yt+"px; width: "+(Mt==null?$-st:Mt)+`px;
|
|
height: `+(At-yt)+"px"))}function Se(st,yt,Mt){var At=dt(i,st),Vt=At.text.length,Er,Jr;function Dr(Fr,Tn){return Cr(e,Qe(st,Fr),"div",At,Tn)}function kn(Fr,Tn,nn){var $r=xt(e,At,null,Fr),jr=Tn=="ltr"==(nn=="after")?"left":"right",Pr=nn=="after"?$r.begin:$r.end-(/\s/.test(At.text.charAt($r.end-1))?2:1);return Dr(Pr,jr)[jr]}var Cn=ut(At,i.direction);return it(Cn,yt||0,Mt==null?Vt:Mt,function(Fr,Tn,nn,$r){var jr=nn=="ltr",Pr=Dr(Fr,jr?"left":"right"),wn=Dr(Tn-1,jr?"right":"left"),_a=yt==null&&Fr==0,Hi=Mt==null&&Tn==Vt,ln=$r==0,hi=!Cn||$r==Cn.length-1;if(wn.top-Pr.top<=3){var qr=(te?_a:Hi)&&ln,ps=(te?Hi:_a)&&hi,Ti=qr?V:(jr?Pr:wn).left,oa=ps?$:(jr?wn:Pr).right;ve(Ti,Pr.top,oa-Ti,Pr.bottom)}else{var sa,gn,Ra,ms;jr?(sa=te&&_a&&ln?V:Pr.left,gn=te?$:kn(Fr,nn,"before"),Ra=te?V:kn(Tn,nn,"after"),ms=te&&Hi&&hi?$:wn.right):(sa=te?kn(Fr,nn,"before"):V,gn=!te&&_a&&ln?$:Pr.right,Ra=!te&&Hi&&hi?V:wn.left,ms=te?kn(Tn,nn,"after"):$),ve(sa,Pr.top,gn-sa,Pr.bottom),Pr.bottom<wn.top&&ve(V,Pr.bottom,null,wn.top),ve(Ra,wn.top,ms-Ra,wn.bottom)}(!Er||yr(Pr,Er)<0)&&(Er=Pr),yr(wn,Er)<0&&(Er=wn),(!Jr||yr(Pr,Jr)<0)&&(Jr=Pr),yr(wn,Jr)<0&&(Jr=wn)}),{start:Er,end:Jr}}var Pe=t.from(),_e=t.to();if(Pe.line==_e.line)Se(Pe.line,Pe.ch,_e.ch);else{var Ge=dt(i,Pe.line),$e=dt(i,_e.line),nt=dn(Ge)==dn($e),ot=Se(Pe.line,Pe.ch,nt?Ge.text.length+1:null).end,pt=Se(_e.line,nt?0:null,_e.ch).start;nt&&(ot.top<pt.top-2?(ve(ot.right,ot.top,null,ot.bottom),ve(V,pt.top,pt.left,pt.bottom)):ve(ot.right,ot.top,pt.left-ot.right,ot.bottom)),ot.bottom<pt.top&&ve(V,ot.bottom,null,pt.top)}n.appendChild(E)}function Vr(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Ri(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function Eo(e){e.state.focused||(e.display.input.focus(),li(e))}function Ga(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Ri(e))},100)}function li(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(se(e,"focus",e,t),e.state.focused=!0,z(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),P&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Vr(e)}function Ri(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(se(e,"blur",e,t),e.state.focused=!1,c(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function pa(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],E=e.options.lineWrapping,N=void 0,V=0;if(i.hidden)continue;if(W&&B<8){var $=i.node.offsetTop+i.node.offsetHeight;N=$-n,n=$}else{var te=i.node.getBoundingClientRect();N=te.bottom-te.top,!E&&i.text.firstChild&&(V=i.text.firstChild.getBoundingClientRect().right-te.left-1)}var ve=i.line.height-N;if((ve>.005||ve<-.005)&&(Nt(i.line,N),Va(i.line),i.rest))for(var Se=0;Se<i.rest.length;Se++)Va(i.rest[Se]);if(V>e.display.sizerWidth){var Pe=Math.ceil(V/zr(e.display));Pe>e.display.maxLineLength&&(e.display.maxLineLength=Pe,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function Va(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function ma(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-za(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,E=or(t,r),N=or(t,i);if(n&&n.ensure){var V=n.ensure.from.line,$=n.ensure.to.line;V<E?(E=V,N=or(t,Ln(dt(t,V))+e.wrapper.clientHeight)):Math.min($,t.lastLine())>=N&&(E=or(t,Ln(dt(t,$))-e.wrapper.clientHeight),N=$)}return{from:E,to:Math.max(N,E+1)}}function Xo(e,t){if(Z(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!w){var E=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-za(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Le(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(E),E.scrollIntoView(i),e.display.lineSpace.removeChild(E)}}function Yo(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Qe(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Qe(t.line,t.ch+1,"before"):t);for(var E=0;E<5;E++){var N=!1,V=$t(e,t),$=!n||n==t?V:$t(e,n);i={left:Math.min(V.left,$.left),top:Math.min(V.top,$.top)-r,right:Math.max(V.left,$.left),bottom:Math.max(V.bottom,$.bottom)+r};var te=Xa(e,i),ve=e.doc.scrollTop,Se=e.doc.scrollLeft;if(te.scrollTop!=null&&(Ni(e,te.scrollTop),Math.abs(e.doc.scrollTop-ve)>1&&(N=!0)),te.scrollLeft!=null&&(In(e,te.scrollLeft),Math.abs(e.doc.scrollLeft-Se)>1&&(N=!0)),!N)break}return i}function So(e,t){var n=Xa(e,t);n.scrollTop!=null&&Ni(e,n.scrollTop),n.scrollLeft!=null&&In(e,n.scrollLeft)}function Xa(e,t){var n=e.display,r=Rr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,E=q(e),N={};t.bottom-t.top>E&&(t.bottom=t.top+E);var V=e.doc.height+fe(n),$=t.top<r,te=t.bottom>V-r;if(t.top<i)N.scrollTop=$?0:t.top;else if(t.bottom>i+E){var ve=Math.min(t.top,(te?V:t.bottom)-E);ve!=i&&(N.scrollTop=ve)}var Se=e.options.fixedGutter?0:n.gutters.offsetWidth,Pe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-Se,_e=ge(e)-n.gutters.offsetWidth,Ge=t.right-t.left>_e;return Ge&&(t.right=t.left+_e),t.left<10?N.scrollLeft=0:t.left<Pe?N.scrollLeft=Math.max(0,t.left+Se-(Ge?0:10)):t.right>_e+Pe-3&&(N.scrollLeft=t.right+(Ge?0:10)-_e),N}function Ya(e,t){if(t==null)return;ga(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Pi(e){ga(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Ii(e,t,n){(t!=null||n!=null)&&ga(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function $o(e,t){ga(e),e.curOp.scrollToPos=t}function ga(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=Lt(e,t.from),r=Lt(e,t.to);ta(e,n,r,t.margin)}}function ta(e,t,n,r){var i=Xa(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});Ii(e,i.scrollLeft,i.scrollTop)}function Ni(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;k||ia(e,{top:t}),Ui(e,t,!0),k&&ia(e),na(e,100)}function Ui(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function In(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Zt(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function yi(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+fe(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Le(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var ui=function(e,t,n){this.cm=n;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),Fe(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Fe(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,W&&B<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};ui.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var E=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+E)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},ui.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},ui.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},ui.prototype.zeroWidthHack=function(){var e=s&&!O?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ye,this.disableVert=new ye},ui.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),E=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);E!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},ui.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ra=function(){};ra.prototype.update=function(){return{bottom:0,right:0}},ra.prototype.setScrollLeft=function(){},ra.prototype.setScrollTop=function(){},ra.prototype.clear=function(){};function bi(e,t){t||(t=yi(e));var n=e.display.barWidth,r=e.display.barHeight;va(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&pa(e),va(e,yi(e)),n=e.display.barWidth,r=e.display.barHeight}function va(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var $a={native:ui,null:ra};function ya(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&c(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new $a[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Fe(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?In(e,t):Ni(e,t)},e),e.display.scrollbars.addClass&&z(e.display.wrapper,e.display.scrollbars.addClass)}var Qa=0;function di(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Qa},On(e.curOp)}function xi(e){var t=e.curOp;t&&Ko(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;Co(n)})}function Co(e){for(var t=e.ops,n=0;n<t.length;n++)Qo(t[n]);for(var r=0;r<t.length;r++)Zo(t[r]);for(var i=0;i<t.length;i++)Jo(t[i]);for(var E=0;E<t.length;E++)Za(t[E]);for(var N=0;N<t.length;N++)qo(t[N])}function Qo(e){var t=e.cm,n=t.display;To(t),e.updateMaxLine&&qi(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Nn(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Zo(e){e.updatedDisplay=e.mustUpdate&&Ei(e.cm,e.update)}function Jo(e){var t=e.cm,n=t.display;e.updatedDisplay&&pa(t),e.barMeasure=yi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=xe(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Le(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-ge(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Za(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&In(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==I();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&bi(t,e.barMeasure),e.updatedDisplay&&ur(t,e.barMeasure),e.selectionChanged&&Vr(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&Eo(e.cm)}function qo(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&ba(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&Ui(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&In(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=Yo(t,Rt(r,e.scrollToPos.from),Rt(r,e.scrollToPos.to),e.scrollToPos.margin);Xo(t,i)}var E=e.maybeHiddenMarkers,N=e.maybeUnhiddenMarkers;if(E)for(var V=0;V<E.length;++V)E[V].lines.length||se(E[V],"hide");if(N)for(var $=0;$<N.length;++$)N[$].lines.length&&se(N[$],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&se(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function fn(e,t){if(e.curOp)return t();di(e);try{return t()}finally{xi(e)}}function Nr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);di(e);try{return t.apply(e,arguments)}finally{xi(e)}}}function rn(e){return function(){if(this.curOp)return e.apply(this,arguments);di(this);try{return e.apply(this,arguments)}finally{xi(this)}}}function Ur(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);di(t);try{return e.apply(this,arguments)}finally{xi(t)}}}function na(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,G(es,e))}function es(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=Dn(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(E){if(r.line>=e.display.viewFrom){var N=E.styles,V=E.text.length>e.options.maxHighlightLength?Hr(t.mode,r.state):null,$=Ki(e,E,r,!0);V&&(r.state=V),E.styles=$.styles;var te=E.styleClasses,ve=$.classes;ve?E.styleClasses=ve:te&&(E.styleClasses=null);for(var Se=!N||N.length!=E.styles.length||te!=ve&&(!te||!ve||te.bgClass!=ve.bgClass||te.textClass!=ve.textClass),Pe=0;!Se&&Pe<N.length;++Pe)Se=N[Pe]!=E.styles[Pe];Se&&i.push(r.line),E.stateAfter=r.save(),r.nextLine()}else E.text.length<=e.options.maxHighlightLength&&Li(e,E.text,r),E.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return na(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&fn(e,function(){for(var E=0;E<i.length;E++)Lr(e,i[E],"text")})}var Nn=function(e,t,n){var r=e.display;this.viewport=t,this.visible=ma(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=ge(e),this.force=n,this.dims=Ar(e),this.events=[]};Nn.prototype.signal=function(e,t){ae(e,t)&&this.events.push(arguments)},Nn.prototype.finish=function(){for(var e=0;e<this.events.length;e++)se.apply(null,this.events[e])};function To(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Le(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Le(e)+"px",t.scrollbarsClipped=!0)}function wo(e){if(e.hasFocus())return null;var t=I();if(!t||!S(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&S(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function Ao(e){if(!e||!e.activeElt||e.activeElt==I())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&S(document.body,e.anchorNode)&&S(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function Ei(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return wr(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&oi(e)==0)return!1;Xr(e)&&(wr(e),t.dims=Ar(e));var i=r.first+r.size,E=Math.max(t.visible.from-e.options.viewportMargin,r.first),N=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<E&&E-n.viewFrom<20&&(E=Math.max(r.first,n.viewFrom)),n.viewTo>N&&n.viewTo-N<20&&(N=Math.min(i,n.viewTo)),Qr&&(E=ii(e.doc,E),N=xn(e.doc,N));var V=E!=n.viewFrom||N!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;ai(e,E,N),n.viewOffset=Ln(dt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var $=oi(e);if(!V&&$==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var te=wo(e);return $>4&&(n.lineDiv.style.display="none"),Lo(e,n.updateLineNumbers,t.dims),$>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,Ao(te),f(n.cursorDiv),f(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,V&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,na(e,400)),n.updateLineNumbers=null,!0}function ba(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==ge(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+fe(e.display)-q(e),n.top)}),t.visible=ma(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=ma(e.display,e.doc,n));if(!Ei(e,t))break;pa(e);var i=yi(e);fr(e),bi(e,i),ur(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function ia(e,t){var n=new Nn(e,t);if(Ei(e,n)){pa(e),ba(e,n);var r=yi(e);fr(e),bi(e,r),ur(e,r),n.finish()}}function Lo(e,t,n){var r=e.display,i=e.options.lineNumbers,E=r.lineDiv,N=E.firstChild;function V(Ge){var $e=Ge.nextSibling;return P&&s&&e.display.currentWheelTarget==Ge?Ge.style.display="none":Ge.parentNode.removeChild(Ge),$e}for(var $=r.view,te=r.viewFrom,ve=0;ve<$.length;ve++){var Se=$[ve];if(!Se.hidden)if(!Se.node||Se.node.parentNode!=E){var Pe=bo(e,Se,te,n);E.insertBefore(Pe,N)}else{for(;N!=Se.node;)N=V(N);var _e=i&&t!=null&&t<=te&&Se.lineNumber;Se.changes&&(Ce(Se.changes,"gutter")>-1&&(_e=!1),vo(e,Se,te,n)),_e&&(f(Se.lineNumber),Se.lineNumber.appendChild(document.createTextNode(kr(e.options,te)))),N=Se.node.nextSibling}te+=Se.size}for(;N;)N=V(N)}function xa(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function ur(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+Le(e)+"px"}function Zt(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=on(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,E=r+"px",N=0;N<n.length;N++)if(!n[N].hidden){e.options.fixedGutter&&(n[N].gutter&&(n[N].gutter.style.left=E),n[N].gutterBackground&&(n[N].gutterBackground.style.left=E));var V=n[N].alignable;if(V)for(var $=0;$<V.length;$++)V[$].style.left=E}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Xr(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=kr(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(a("div",[a("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),E=i.firstChild.offsetWidth,N=i.offsetWidth-E;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(E,r.lineGutter.offsetWidth-N)+1,r.lineNumWidth=r.lineNumInnerWidth+N,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",xa(e.display),!0}return!1}function pn(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var E=e[i],N=null;if(typeof E!="string"&&(N=E.style,E=E.className),E=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:E,style:N})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Bi(e){var t=e.gutters,n=e.gutterSpecs;f(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],E=i.className,N=i.style,V=t.appendChild(a("div",null,"CodeMirror-gutter "+E));N&&(V.style.cssText=N),E=="CodeMirror-linenumbers"&&(e.lineGutter=V,V.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",xa(e)}function Qn(e){Bi(e.display),mr(e),Zt(e)}function aa(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=x("div",null,"CodeMirror-code"),i.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=a("div",null,"CodeMirror-cursors"),i.measure=a("div",null,"CodeMirror-measure"),i.lineMeasure=a("div",null,"CodeMirror-measure"),i.lineSpace=x("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var E=x("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[E],null,"position: relative"),i.sizer=a("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=a("div",null,null,"position: absolute; height: "+De+"px; width: 1px;"),i.gutters=a("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=a("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=a("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),W&&B<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!P&&!(k&&o)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=pn(r.gutters,r.lineNumbers),Bi(i),n.init(i)}var ci=0,Yr=null;W?Yr=-.53:k?Yr=15:y?Yr=-.7:_&&(Yr=-1/3);function Ea(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function Ja(e){var t=Ea(e);return t.x*=Yr,t.y*=Yr,t}function qa(e,t){var n=Ea(t),r=n.x,i=n.y,E=e.display,N=E.scroller,V=N.scrollWidth>N.clientWidth,$=N.scrollHeight>N.clientHeight;if(!(r&&V||i&&$))return;if(i&&s&&P){e:for(var te=t.target,ve=E.view;te!=N;te=te.parentNode)for(var Se=0;Se<ve.length;Se++)if(ve[Se].node==te){e.display.currentWheelTarget=te;break e}}if(r&&!k&&!T&&Yr!=null){i&&$&&Ni(e,Math.max(0,N.scrollTop+i*Yr)),In(e,Math.max(0,N.scrollLeft+r*Yr)),(!i||i&&$)&&ee(t),E.wheelStartX=null;return}if(i&&Yr!=null){var Pe=i*Yr,_e=e.doc.scrollTop,Ge=_e+E.wrapper.clientHeight;Pe<0?_e=Math.max(0,_e+Pe-50):Ge=Math.min(e.doc.height,Ge+Pe+50),ia(e,{top:_e,bottom:Ge})}ci<20&&(E.wheelStartX==null?(E.wheelStartX=N.scrollLeft,E.wheelStartY=N.scrollTop,E.wheelDX=r,E.wheelDY=i,setTimeout(function(){if(E.wheelStartX==null)return;var $e=N.scrollLeft-E.wheelStartX,nt=N.scrollTop-E.wheelStartY,ot=nt&&E.wheelDY&&nt/E.wheelDY||$e&&E.wheelDX&&$e/E.wheelDX;if(E.wheelStartX=E.wheelStartY=null,!ot)return;Yr=(Yr*ci+ot)/(ci+1),++ci},200)):(E.wheelDX+=r,E.wheelDY+=i))}var mn=function(e,t){this.ranges=e,this.primIndex=t};mn.prototype.primary=function(){return this.ranges[this.primIndex]},mn.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!zn(n.anchor,r.anchor)||!zn(n.head,r.head))return!1}return!0},mn.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new lr(fi(this.ranges[t].anchor),fi(this.ranges[t].head));return new mn(e,this.primIndex)},mn.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},mn.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(kt(t,r.from())>=0&&kt(e,r.to())<=0)return n}return-1};var lr=function(e,t){this.anchor=e,this.head=t};lr.prototype.from=function(){return Gn(this.anchor,this.head)},lr.prototype.to=function(){return wi(this.anchor,this.head)},lr.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Un(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(Pe,_e){return kt(Pe.from(),_e.from())}),n=Ce(t,i);for(var E=1;E<t.length;E++){var N=t[E],V=t[E-1],$=kt(V.to(),N.from());if(r&&!N.empty()?$>0:$>=0){var te=Gn(V.from(),N.from()),ve=wi(V.to(),N.to()),Se=V.empty()?N.from()==N.head:V.from()==V.head;E<=n&&--n,t.splice(--E,2,new lr(Se?ve:te,Se?te:ve))}}return new mn(t,n)}function Zn(e,t){return new mn([new lr(e,t||e)],0)}function Jn(e){return e.text?Qe(e.from.line+e.text.length-1,A(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function eo(e,t){if(kt(e,t.from)<0)return e;if(kt(e,t.to)<=0)return Jn(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Jn(t).ch-t.to.ch),Qe(n,r)}function Sa(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new lr(eo(i.anchor,t),eo(i.head,t)))}return Un(e.cm,n,e.sel.primIndex)}function Oo(e,t,n){return e.line==t.line?Qe(n.line,e.ch-t.ch+n.ch):Qe(n.line+(e.line-t.line),e.ch)}function ko(e,t,n){for(var r=[],i=Qe(e.first,0),E=i,N=0;N<t.length;N++){var V=t[N],$=Oo(V.from,i,E),te=Oo(Jn(V),i,E);if(i=V.to,E=te,n=="around"){var ve=e.sel.ranges[N],Se=kt(ve.head,ve.anchor)<0;r[N]=new lr(Se?te:$,Se?$:te)}else r[N]=new lr($,$)}return new mn(r,e.sel.primIndex)}function Si(e){e.doc.mode=an(e.options,e.doc.modeOption),to(e)}function to(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,na(e,100),e.state.modeGen++,e.curOp&&mr(e)}function gs(e,t){return t.from.ch==0&&t.to.ch==0&&A(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function ts(e,t,n,r){function i(pt){return n?n[pt]:null}function E(pt,st,yt){Ba(pt,st,yt,r),_r(pt,"change",pt,t)}function N(pt,st){for(var yt=[],Mt=pt;Mt<st;++Mt)yt.push(new vi(te[Mt],i(Mt),r));return yt}var V=t.from,$=t.to,te=t.text,ve=dt(e,V.line),Se=dt(e,$.line),Pe=A(te),_e=i(te.length-1),Ge=$.line-V.line;if(t.full)e.insert(0,N(0,te.length)),e.remove(te.length,e.size-te.length);else if(gs(e,t)){var $e=N(0,te.length-1);E(Se,Se.text,_e),Ge&&e.remove(V.line,Ge),$e.length&&e.insert(V.line,$e)}else if(ve==Se)if(te.length==1)E(ve,ve.text.slice(0,V.ch)+Pe+ve.text.slice($.ch),_e);else{var nt=N(1,te.length-1);nt.push(new vi(Pe+ve.text.slice($.ch),_e,r)),E(ve,ve.text.slice(0,V.ch)+te[0],i(0)),e.insert(V.line+1,nt)}else if(te.length==1)E(ve,ve.text.slice(0,V.ch)+te[0]+Se.text.slice($.ch),i(0)),e.remove(V.line+1,Ge);else{E(ve,ve.text.slice(0,V.ch)+te[0],i(0)),E(Se,Pe+Se.text.slice($.ch),_e);var ot=N(1,te.length-1);Ge>1&&e.remove(V.line+1,Ge-1),e.insert(V.line+1,ot)}_r(e,"change",e,t)}function Fi(e,t,n){function r(i,E,N){if(i.linked)for(var V=0;V<i.linked.length;++V){var $=i.linked[V];if($.doc==E)continue;var te=N&&$.sharedHist;if(n&&!te)continue;t($.doc,te),r($.doc,i,te)}}r(e,null,!0)}function vs(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,hn(e),Si(e),ys(e),e.options.lineWrapping||qi(e),e.options.mode=t.modeOption,mr(e)}function ys(e){(e.doc.direction=="rtl"?z:c)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){fn(e,function(){ys(e),mr(e)})}function Do(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function rs(e,t){var n={from:fi(t.from),to:Jn(t),text:Jt(e,t.from,t.to)};return Es(e,n,t.from.line,t.to.line+1),Fi(e,function(r){return Es(r,n,t.from.line,t.to.line+1)},!0),n}function bs(e){for(;e.length;){var t=A(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return bs(e.done),A(e.done);if(e.done.length&&!A(e.done).ranges)return A(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),A(e.done)}function xs(e,t,n,r){var i=e.history;i.undone.length=0;var E=+new Date,N,V;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>E-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(N=pl(i,i.lastOp==r)))V=A(N.changes),kt(t.from,t.to)==0&&kt(t.from,V.to)==0?V.to=Jn(t):N.changes.push(rs(e,t));else{var $=A(i.done);for((!$||!$.ranges)&&Mo(e.sel,i.done),N={changes:[rs(e,t)],generation:i.generation},i.done.push(N);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=E,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,V||se(e,"historyAdded")}function ml(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var i=e.history,E=r&&r.origin;n==i.lastSelOp||E&&i.lastSelOrigin==E&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==E||ml(e,E,A(i.done),t))?i.done[i.done.length-1]=t:Mo(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=E,i.lastSelOp=n,r&&r.clearRedo!==!1&&bs(i.undone)}function Mo(e,t){var n=A(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Es(e,t,n,r){var i=t["spans_"+e.id],E=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(N){N.markedSpans&&((i||(i=t["spans_"+e.id]={}))[E]=N.markedSpans),++E})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(vl(n[i]));return r}function Ss(e,t){var n=yl(e,t),r=ki(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var E=n[i],N=r[i];if(E&&N){e:for(var V=0;V<N.length;++V){for(var $=N[V],te=0;te<E.length;++te)if(E[te].marker==$.marker)continue e;E.push($)}}else N&&(n[i]=N)}return n}function Ca(e,t,n){for(var r=[],i=0;i<e.length;++i){var E=e[i];if(E.ranges){r.push(n?mn.prototype.deepCopy.call(E):E);continue}var N=E.changes,V=[];r.push({changes:V});for(var $=0;$<N.length;++$){var te=N[$],ve=void 0;if(V.push({from:te.from,to:te.to,text:te.text}),t)for(var Se in te)(ve=Se.match(/^spans_(\d+)$/))&&(Ce(t,Number(ve[1]))>-1&&(A(V)[Se]=te[Se],delete te[Se]))}}return r}function ns(e,t,n,r){if(r){var i=e.anchor;if(n){var E=kt(t,i)<0;E!=kt(n,i)<0?(i=t,t=n):E!=kt(t,n)<0&&(t=n)}return new lr(i,t)}else return new lr(n||t,t)}function _o(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),sn(e,new mn([ns(e.sel.primary(),t,n,i)],0),r)}function Cs(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),E=0;E<e.sel.ranges.length;E++)r[E]=ns(e.sel.ranges[E],t[E],null,i);var N=Un(e.cm,r,e.sel.primIndex);sn(e,N,n)}function is(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,sn(e,Un(e.cm,i,e.sel.primIndex),r)}function Ts(e,t,n,r){sn(e,Zn(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var E=0;E<i.length;E++)this.ranges[E]=new lr(Rt(e,i[E].anchor),Rt(e,i[E].head))},origin:n&&n.origin};return se(e,"beforeSelectionChange",e,r),e.cm&&se(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Un(e.cm,r.ranges,r.ranges.length-1):t}function ws(e,t,n){var r=e.history.done,i=A(r);i&&i.ranges?(r[r.length-1]=t,Ro(e,t,n)):sn(e,t,n)}function sn(e,t,n){Ro(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Ro(e,t,n){(ae(e,"beforeSelectionChange")||e.cm&&ae(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(kt(t.primary().head,e.sel.primary().head)<0?-1:1);As(e,Os(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Pi(e.cm)}function As(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Q(e.cm)),_r(e,"cursorActivity",e)}function Ls(e){As(e,Os(e,e.sel,null,!1))}function Os(e,t,n,r){for(var i,E=0;E<t.ranges.length;E++){var N=t.ranges[E],V=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[E],$=Po(e,N.anchor,V&&V.anchor,n,r),te=Po(e,N.head,V&&V.head,n,r);(i||$!=N.anchor||te!=N.head)&&(i||(i=t.ranges.slice(0,E)),i[E]=new lr($,te))}return i?Un(e.cm,i,t.primIndex):t}function Ta(e,t,n,r,i){var E=dt(e,t.line);if(E.markedSpans)for(var N=0;N<E.markedSpans.length;++N){var V=E.markedSpans[N],$=V.marker,te="selectLeft"in $?!$.selectLeft:$.inclusiveLeft,ve="selectRight"in $?!$.selectRight:$.inclusiveRight;if((V.from==null||(te?V.from<=t.ch:V.from<t.ch))&&(V.to==null||(ve?V.to>=t.ch:V.to>t.ch))){if(i&&(se($,"beforeCursorEnter"),$.explicitlyCleared))if(E.markedSpans){--N;continue}else break;if(!$.atomic)continue;if(n){var Se=$.find(r<0?1:-1),Pe=void 0;if((r<0?ve:te)&&(Se=ks(e,Se,-r,Se&&Se.line==t.line?E:null)),Se&&Se.line==t.line&&(Pe=kt(Se,n))&&(r<0?Pe<0:Pe>0))return Ta(e,Se,t,r,i)}var _e=$.find(r<0?-1:1);return(r<0?te:ve)&&(_e=ks(e,_e,r,_e.line==t.line?E:null)),_e?Ta(e,_e,t,r,i):null}}return t}function Po(e,t,n,r,i){var E=r||1,N=Ta(e,t,n,E,i)||!i&&Ta(e,t,n,E,!0)||Ta(e,t,n,-E,i)||!i&&Ta(e,t,n,-E,!0);return N||(e.cantEdit=!0,Qe(e.first,0))}function ks(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?Rt(e,Qe(t.line-1)):null:n>0&&t.ch==(r||dt(e,t.line)).text.length?t.line<e.first+e.size-1?Qe(t.line+1,0):null:new Qe(t.line,t.ch+n)}function Ds(e){e.setSelection(Qe(e.firstLine(),0),Qe(e.lastLine()),Ie)}function Ms(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,E,N,V){i&&(r.from=Rt(e,i)),E&&(r.to=Rt(e,E)),N&&(r.text=N),V!==void 0&&(r.origin=V)}),se(e,"beforeChange",e,r),e.cm&&se(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function wa(e,t,n){if(e.cm){if(!e.cm.curOp)return Nr(e.cm,wa)(e,t,n);if(e.cm.state.suppressEdits)return}if((ae(e,"beforeChange")||e.cm&&ae(e.cm,"beforeChange"))&&(t=Ms(e,t,!0),!t))return;var r=Xi&&!n&&$i(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)_s(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else _s(e,t)}function _s(e,t){if(t.text.length==1&&t.text[0]==""&&kt(t.from,t.to)==0)return;var n=Sa(e,t);xs(e,t,n,e.cm?e.cm.curOp.id:NaN),ro(e,t,n,ki(e,t));var r=[];Fi(e,function(i,E){!E&&Ce(r,i.history)==-1&&(Ns(i.history,t),r.push(i.history)),ro(i,t,null,ki(i,t))})}function Io(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,E,N=e.sel,V=t=="undo"?i.done:i.undone,$=t=="undo"?i.undone:i.done,te=0;te<V.length&&!(E=V[te],n?E.ranges&&!E.equals(e.sel):!E.ranges);te++);if(te==V.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(E=V.pop(),E.ranges){if(Mo(E,$),n&&!E.equals(e.sel)){sn(e,E,{clearRedo:!1});return}N=E}else if(r){V.push(E);return}else break;var ve=[];Mo(N,$),$.push({changes:ve,generation:i.generation}),i.generation=E.generation||++i.maxGeneration;for(var Se=ae(e,"beforeChange")||e.cm&&ae(e.cm,"beforeChange"),Pe=function($e){var nt=E.changes[$e];if(nt.origin=t,Se&&!Ms(e,nt,!1))return V.length=0,{};ve.push(rs(e,nt));var ot=$e?Sa(e,nt):A(V);ro(e,nt,ot,Ss(e,nt)),!$e&&e.cm&&e.cm.scrollIntoView({from:nt.from,to:Jn(nt)});var pt=[];Fi(e,function(st,yt){!yt&&Ce(pt,st.history)==-1&&(Ns(st.history,nt),pt.push(st.history)),ro(st,nt,null,Ss(st,nt))})},_e=E.changes.length-1;_e>=0;--_e){var Ge=Pe(_e);if(Ge)return Ge.v}}function Rs(e,t){if(t==0)return;if(e.first+=t,e.sel=new mn(D(e.sel.ranges,function(i){return new lr(Qe(i.anchor.line+t,i.anchor.ch),Qe(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){mr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Lr(e.cm,r,"gutter")}}function ro(e,t,n,r){if(e.cm&&!e.cm.curOp)return Nr(e.cm,ro)(e,t,n,r);if(t.to.line<e.first){Rs(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Rs(e,i),t={from:Qe(e.first,0),to:Qe(t.to.line+i,t.to.ch),text:[A(t.text)],origin:t.origin}}var E=e.lastLine();t.to.line>E&&(t={from:t.from,to:Qe(E,dt(e,E).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Jt(e,t.from,t.to),n||(n=Sa(e,t)),e.cm?xl(e.cm,t,r):ts(e,t,r),Ro(e,n,Ie),e.cantEdit&&Po(e,Qe(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,n){var r=e.doc,i=e.display,E=t.from,N=t.to,V=!1,$=E.line;e.options.lineWrapping||($=Pt(dn(dt(r,E.line))),r.iter($,N.line+1,function(_e){if(_e==i.maxLine)return V=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Q(e),ts(r,t,n,Rn(e)),e.options.lineWrapping||(r.iter($,E.line+t.text.length,function(_e){var Ge=Ji(_e);Ge>i.maxLineLength&&(i.maxLine=_e,i.maxLineLength=Ge,i.maxLineChanged=!0,V=!1)}),V&&(e.curOp.updateMaxLine=!0)),Pa(r,E.line),na(e,400);var te=t.text.length-(N.line-E.line)-1;t.full?mr(e):E.line==N.line&&t.text.length==1&&!gs(e.doc,t)?Lr(e,E.line,"text"):mr(e,E.line,N.line+1,te);var ve=ae(e,"changes"),Se=ae(e,"change");if(Se||ve){var Pe={from:E,to:N,text:t.text,removed:t.removed,origin:t.origin};Se&&_r(e,"change",e,Pe),ve&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Pe)}e.display.selForContextMenu=null}function Aa(e,t,n,r,i){var E;r||(r=n),kt(r,n)<0&&(E=[r,n],n=E[0],r=E[1]),typeof t=="string"&&(t=e.splitLines(t)),wa(e,{from:n,to:r,text:t,origin:i})}function Ps(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Is(e,t,n,r){for(var i=0;i<e.length;++i){var E=e[i],N=!0;if(E.ranges){E.copied||(E=e[i]=E.deepCopy(),E.copied=!0);for(var V=0;V<E.ranges.length;V++)Ps(E.ranges[V].anchor,t,n,r),Ps(E.ranges[V].head,t,n,r);continue}for(var $=0;$<E.changes.length;++$){var te=E.changes[$];if(n<te.from.line)te.from=Qe(te.from.line+r,te.from.ch),te.to=Qe(te.to.line+r,te.to.ch);else if(t<=te.to.line){N=!1;break}}N||(e.splice(0,i+1),i=0)}}function Ns(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Is(e.done,n,r,i),Is(e.undone,n,r,i)}function no(e,t,n,r){var i=t,E=t;return typeof t=="number"?E=dt(e,Ai(e,t)):i=Pt(t),i==null?null:(r(E,i)&&e.cm&&Lr(e.cm,i,n),E)}function io(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}io.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,Et(i),_r(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function ao(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}ao.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var E=Math.min(t,i-e),N=r.height;if(r.removeInner(e,E),this.height-=N-r.height,i==E&&(this.children.splice(n--,1),r.parent=null),(t-=E)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof io))){var V=[];this.collapse(V),this.children=[new io(V)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],E=i.chunkSize();if(e<=E){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var N=i.lines.length%25+25,V=N;V<i.lines.length;){var $=new io(i.lines.slice(V,V+=25));i.height-=$.height,this.children.splice(++r,0,$),$.parent=this}i.lines=i.lines.slice(0,N),this.maybeSpill()}break}e-=E}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new ao(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=Ce(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new ao(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],E=i.chunkSize();if(e<E){var N=Math.min(t,E-e);if(i.iterN(e,N,n))return!0;if((t-=N)==0)break;e=0}else e-=E}}};var oo=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};oo.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Pt(n);if(r==null||!t)return;for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var E=_i(this);Nt(n,Math.max(0,n.height-E)),e&&(fn(e,function(){Us(e,n,-E),Lr(e,r,"widget")}),_r(e,"lineWidgetCleared",e,this,r))},oo.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=_i(this)-t;if(!i)return;En(this.doc,r)||Nt(r,r.height+i),n&&fn(n,function(){n.curOp.forceUpdate=!0,Us(n,r,i),_r(n,"lineWidgetChanged",n,e,Pt(r))})},ue(oo);function Us(e,t,n){Ln(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ya(e,n)}function El(e,t,n,r){var i=new oo(e,n,r),E=e.cm;return E&&i.noHScroll&&(E.display.alignWidgets=!0),no(e,t,"widget",function(N){var V=N.widgets||(N.widgets=[]);if(i.insertAt==null?V.push(i):V.splice(Math.min(V.length-1,Math.max(0,i.insertAt)),0,i),i.line=N,E&&!En(e,N)){var $=Ln(N)<e.scrollTop;Nt(N,N.height+_i(i)),$&&Ya(E,i.height),E.curOp.forceUpdate=!0}return!0}),E&&_r(E,"lineWidgetAdded",E,i,typeof t=="number"?t:Pt(t)),i}var Bs=0,ji=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++Bs};ji.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&di(e),ae(this,"clear")){var n=this.find();n&&_r(this,"clear",n.from,n.to)}for(var r=null,i=null,E=0;E<this.lines.length;++E){var N=this.lines[E],V=bn(N.markedSpans,this);e&&!this.collapsed?Lr(e,Pt(N),"text"):e&&(V.to!=null&&(i=Pt(N)),V.from!=null&&(r=Pt(N))),N.markedSpans=Yi(N.markedSpans,V),V.from==null&&this.collapsed&&!En(this.doc,N)&&e&&Nt(N,Rr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var $=0;$<this.lines.length;++$){var te=dn(this.lines[$]),ve=Ji(te);ve>e.display.maxLineLength&&(e.display.maxLine=te,e.display.maxLineLength=ve,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&mr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ls(e.doc)),e&&_r(e,"markerCleared",e,this,r,i),t&&xi(e),this.parent&&this.parent.clear()},ji.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var E=this.lines[i],N=bn(E.markedSpans,this);if(N.from!=null&&(n=Qe(t?E:Pt(E),N.from),e==-1))return n;if(N.to!=null&&(r=Qe(t?E:Pt(E),N.to),e==1))return r}return n&&{from:n,to:r}},ji.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;fn(r,function(){var i=t.line,E=Pt(t.line),N=Oe(r,E);if(N&&(Ht(N),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!En(n.doc,i)&&n.height!=null){var V=n.height;n.height=null;var $=_i(n)-V;$&&Nt(i,i.height+$)}_r(r,"markerChanged",r,e)})},ji.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||Ce(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},ji.prototype.detachLine=function(e){if(this.lines.splice(Ce(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ue(ji);function La(e,t,n,r,i){if(r&&r.shared)return Sl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Nr(e.cm,La)(e,t,n,r,i);var E=new ji(e,i),N=kt(t,n);if(r&&j(r,E,!1),N>0||N==0&&E.clearWhenEmpty!==!1)return E;if(E.replacedWith&&(E.collapsed=!0,E.widgetNode=x("span",[E.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||E.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(E.widgetNode.insertLeft=!0)),E.collapsed){if(ha(e,t.line,t,n,E)||t.line!=n.line&&ha(e,n.line,t,n,E))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ia()}E.addToHistory&&xs(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var V=t.line,$=e.cm,te;if(e.iter(V,n.line+1,function(Se){$&&E.collapsed&&!$.options.lineWrapping&&dn(Se)==$.display.maxLine&&(te=!0),E.collapsed&&V!=t.line&&Nt(Se,0),Na(Se,new ri(E,V==t.line?t.ch:null,V==n.line?n.ch:null)),++V}),E.collapsed&&e.iter(t.line,n.line+1,function(Se){En(e,Se)&&Nt(Se,0)}),E.clearOnEnter&&Fe(E,"beforeCursorEnter",function(){return E.clear()}),E.readOnly&&(ti(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),E.collapsed&&(E.id=++Bs,E.atomic=!0),$){if(te&&($.curOp.updateMaxLine=!0),E.collapsed)mr($,t.line,n.line+1);else if(E.className||E.startStyle||E.endStyle||E.css||E.attributes||E.title)for(var ve=t.line;ve<=n.line;ve++)Lr($,ve,"text");E.atomic&&Ls($.doc),_r($,"markerAdded",$,E)}return E}var so=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};so.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();_r(this,"clear")},so.prototype.find=function(e,t){return this.primary.find(e,t)},ue(so);function Sl(e,t,n,r,i){r=j(r),r.shared=!1;var E=[La(e,t,n,r,i)],N=E[0],V=r.widgetNode;return Fi(e,function($){V&&(r.widgetNode=V.cloneNode(!0)),E.push(La($,Rt($,t),Rt($,n),r,i));for(var te=0;te<$.linked.length;++te)if($.linked[te].isParent)return;N=A(E)}),new so(E,N)}function Fs(e){return e.findMarks(Qe(e.first,0),e.clipPos(Qe(e.lastLine())),function(t){return t.parent})}function Cl(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),E=e.clipPos(i.from),N=e.clipPos(i.to);if(kt(E,N)){var V=La(e,E,N,r.primary,r.primary.type);r.markers.push(V),V.parent=r}}}function Tl(e){for(var t=function(r){var i=e[r],E=[i.primary.doc];Fi(i.primary.doc,function($){return E.push($)});for(var N=0;N<i.markers.length;N++){var V=i.markers[N];Ce(E,V.doc)==-1&&(V.parent=null,i.markers.splice(N--,1))}},n=0;n<e.length;n++)t(n)}var wl=0,Sn=function(e,t,n,r,i){if(!(this instanceof Sn))return new Sn(e,t,n,r,i);n==null&&(n=0),ao.call(this,[new io([new vi("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var E=Qe(n,0);this.sel=Zn(E),this.history=new Do(null),this.id=++wl,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),ts(this,{from:E,to:E,text:e}),sn(this,Zn(E),Ie)};Sn.prototype=U(ao.prototype,{constructor:Sn,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Kr(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Ur(function(e){var t=Qe(this.first,0),n=this.first+this.size-1;wa(this,{from:t,to:Qe(n,dt(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Ii(this.cm,0,0),sn(this,Zn(t),Ie)}),replaceRange:function(e,t,n,r){t=Rt(this,t),n=n?Rt(this,n):t,Aa(this,e,t,n,r)},getRange:function(e,t,n){var r=Jt(this,Rt(this,e),Rt(this,t));return n===!1?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(vn(this,e))return dt(this,e)},getLineNumber:function(e){return Pt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=dt(this,e)),dn(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return Rt(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Ur(function(e,t,n){Ts(this,Rt(this,typeof e=="number"?Qe(e,t||0):e),null,n)}),setSelection:Ur(function(e,t,n){Ts(this,Rt(this,e),Rt(this,t||e),n)}),extendSelection:Ur(function(e,t,n){_o(this,Rt(this,e),t&&Rt(this,t),n)}),extendSelections:Ur(function(e,t){Cs(this,tt(this,e),t)}),extendSelectionsBy:Ur(function(e,t){var n=D(this.sel.ranges,e);Cs(this,tt(this,n),t)}),setSelections:Ur(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new lr(Rt(this,e[i].anchor),Rt(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),sn(this,Un(this.cm,r,t),n)}),addSelection:Ur(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new lr(Rt(this,e),Rt(this,t||e))),sn(this,Un(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var i=Jt(this,t[r].from(),t[r].to());n=n?n.concat(i):i}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=Jt(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:Ur(function(e,t,n){for(var r=[],i=this.sel,E=0;E<i.ranges.length;E++){var N=i.ranges[E];r[E]={from:N.from(),to:N.to(),text:this.splitLines(e[E]),origin:n}}for(var V=t&&t!="end"&&ko(this,r,t),$=r.length-1;$>=0;$--)wa(this,r[$]);V?ws(this,V):this.cm&&Pi(this.cm)}),undo:Ur(function(){Io(this,"undo")}),redo:Ur(function(){Io(this,"redo")}),undoSelection:Ur(function(){Io(this,"undo",!0)}),redoSelection:Ur(function(){Io(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Do(this.history.maxGeneration),Fi(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:Ca(this.history.done),undone:Ca(this.history.undone)}},setHistory:function(e){var t=this.history=new Do(this.history.maxGeneration);t.done=Ca(e.done.slice(0),null,!0),t.undone=Ca(e.undone.slice(0),null,!0)},setGutterMarker:Ur(function(e,t,n){return no(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Xe(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Ur(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&no(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Xe(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!vn(this,e))return null;if(t=e,e=dt(this,e),!e)return null}else if(t=Pt(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:Ur(function(e,t,n){return no(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(v(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Ur(function(e,t,n){return no(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",E=r[i];if(E)if(n==null)r[i]=null;else{var N=E.match(v(n));if(!N)return!1;var V=N.index+N[0].length;r[i]=E.slice(0,N.index)+(!N.index||V==E.length?"":" ")+E.slice(V)||null}else return!1;return!0})}),addLineWidget:Ur(function(e,t,n){return El(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return La(this,Rt(this,e),Rt(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=Rt(this,e),La(this,e,e,n,"bookmark")},findMarksAt:function(e){e=Rt(this,e);var t=[],n=dt(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=Rt(this,e),t=Rt(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(E){var N=E.markedSpans;if(N)for(var V=0;V<N.length;V++){var $=N[V];!($.to!=null&&i==e.line&&e.ch>=$.to||$.from==null&&i!=e.line||$.from!=null&&i==t.line&&$.from>=t.ch)&&(!n||n($.marker))&&r.push($.marker.parent||$.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var E=i.text.length+r;if(E>e)return t=e,!0;e-=E,++n}),Rt(this,Qe(n,t))},indexFromPos:function(e){e=Rt(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+n}),t},copy:function(e){var t=new Sn(Kr(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new Sn(Kr(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Cl(r,Fs(this)),r},unlinkDoc:function(e){if(e instanceof Or&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Tl(Fs(this));break}if(e.history==this.history){var r=[e.id];Fi(e,function(i){return r.push(i.id)},!0),e.history=new Do(null),e.history.done=Ca(this.history.done,r),e.history.undone=Ca(this.history.undone,r)}},iterLinkedDocs:function(e){Fi(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Ct(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Ur(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)})}),Sn.prototype.eachLine=Sn.prototype.iter;var js=0;function Al(e){var t=this;if(Ws(t),Z(t,e)||$n(t.display,e))return;ee(e),W&&(js=+new Date);var n=Gr(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,E=Array(i),N=0,V=function(){++N==i&&Nr(t,function(){n=Rt(t.doc,n);var _e={from:n,to:n,text:t.doc.splitLines(E.filter(function(Ge){return Ge!=null}).join(t.doc.lineSeparator())),origin:"paste"};wa(t.doc,_e),ws(t.doc,Zn(Rt(t.doc,n),Rt(t.doc,Jn(_e))))})()},$=function(_e,Ge){if(t.options.allowDropFileTypes&&Ce(t.options.allowDropFileTypes,_e.type)==-1){V();return}var $e=new FileReader;$e.onerror=function(){return V()},$e.onload=function(){var nt=$e.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(nt)){V();return}E[Ge]=nt,V()},$e.readAsText(_e)},te=0;te<r.length;te++)$(r[te],te);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var ve=e.dataTransfer.getData("Text");if(ve){var Se;if(t.state.draggingText&&!t.state.draggingText.copy&&(Se=t.listSelections()),Ro(t.doc,Zn(n,n)),Se)for(var Pe=0;Pe<Se.length;++Pe)Aa(t.doc,"",Se[Pe].anchor,Se[Pe].head,"drag");t.replaceSelection(ve,"around","paste"),t.display.input.focus()}}catch(_e){}}}function Ll(e,t){if(W&&(!e.state.draggingText||+new Date-js<100)){pe(t);return}if(Z(e,t)||$n(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!_){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",T&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),T&&n.parentNode.removeChild(n)}}function Ol(e,t){var n=Gr(e,t);if(!n)return;var r=document.createDocumentFragment();si(e,n,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),d(e.display.dragCursor,r)}function Ws(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Hs(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var E=0;E<n.length;E++)e(n[E])})}var Ks=!1;function kl(){if(Ks)return;Dl(),Ks=!0}function Dl(){var e;Fe(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,Hs(Ml)},100))}),Fe(window,"blur",function(){return Hs(Ri)})}function Ml(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Wi={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},lo=0;lo<10;lo++)Wi[lo+48]=Wi[lo+96]=String(lo);for(var No=65;No<=90;No++)Wi[No]=String.fromCharCode(No);for(var uo=1;uo<=12;uo++)Wi[uo+111]=Wi[uo+63235]="F"+uo;var Ci={};Ci.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"},Ci.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"},Ci.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"},Ci.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"]},Ci.default=s?Ci.macDefault:Ci.pcDefault;function _l(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,E,N=0;N<t.length-1;N++){var V=t[N];if(/^(cmd|meta|m)$/i.test(V))E=!0;else if(/^a(lt)?$/i.test(V))n=!0;else if(/^(c|ctrl|control)$/i.test(V))r=!0;else if(/^s(hift)?$/i.test(V))i=!0;else throw new Error("Unrecognized modifier name: "+V)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),E&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Rl(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var i=D(n.split(" "),_l),E=0;E<i.length;E++){var N=void 0,V=void 0;E==i.length-1?(V=i.join(" "),N=r):(V=i.slice(0,E+1).join(" "),N="...");var $=t[V];if(!$)t[V]=N;else if($!=N)throw new Error("Inconsistent bindings for "+V)}delete e[n]}for(var te in t)e[te]=t[te];return e}function Oa(e,t,n,r){t=Uo(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Oa(e,t.fallthrough,n,r);for(var E=0;E<t.fallthrough.length;E++){var N=Oa(e,t.fallthrough[E],n,r);if(N)return N}}}function zs(e){var t=typeof e=="string"?e:Wi[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function Gs(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(h?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(h?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function Vs(e,t){if(T&&e.keyCode==34&&e.char)return!1;var n=Wi[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),Gs(n,e,t))}function Uo(e){return typeof e=="string"?Ci[e]:e}function ka(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var E=t(n[i]);r.length&&kt(E.from,A(r).to)<=0;){var N=r.pop();if(kt(N.from,E.from)<0){E.from=N.from;break}}r.push(E)}fn(e,function(){for(var V=r.length-1;V>=0;V--)Aa(e.doc,"",r[V].from,r[V].to,"+delete");Pi(e)})}function as(e,t,n){var r=ze(e.text,t+n,n);return r<0||r>e.text.length?null:r}function os(e,t,n){var r=as(e,t.ch,n);return r==null?null:new Qe(t.line,r,n<0?"after":"before")}function ss(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var E=ut(n,t.doc.direction);if(E){var N=i<0?A(E):E[0],V=i<0==(N.level==1),$=V?"after":"before",te;if(N.level>0||t.doc.direction=="rtl"){var ve=we(t,n);te=i<0?n.text.length-1:0;var Se=Re(t,ve,te).top;te=rt(function(Pe){return Re(t,ve,Pe).top==Se},i<0==(N.level==1)?N.from:N.to-1,te),$=="before"&&(te=as(n,te,1))}else te=i<0?N.to:N.from;return new Qe(r,te,$)}}return new Qe(r,i<0?n.text.length:0,i<0?"before":"after")}function Pl(e,t,n,r){var i=ut(t,e.doc.direction);if(!i)return os(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var E=et(i,n.ch,n.sticky),N=i[E];if(e.doc.direction=="ltr"&&N.level%2==0&&(r>0?N.to>n.ch:N.from<n.ch))return os(t,n,r);var V=function(ot,pt){return as(t,ot instanceof Qe?ot.ch:ot,pt)},$,te=function(ot){return e.options.lineWrapping?($=$||we(e,t),xt(e,t,$,ot)):{begin:0,end:t.text.length}},ve=te(n.sticky=="before"?V(n,-1):n.ch);if(e.doc.direction=="rtl"||N.level==1){var Se=N.level==1==r<0,Pe=V(n,Se?1:-1);if(Pe!=null&&(Se?Pe<=N.to&&Pe<=ve.end:Pe>=N.from&&Pe>=ve.begin)){var _e=Se?"before":"after";return new Qe(n.line,Pe,_e)}}var Ge=function(ot,pt,st){for(var yt=function(Er,Jr){return Jr?new Qe(n.line,V(Er,1),"before"):new Qe(n.line,Er,"after")};ot>=0&&ot<i.length;ot+=pt){var Mt=i[ot],At=pt>0==(Mt.level!=1),Vt=At?st.begin:V(st.end,-1);if(Mt.from<=Vt&&Vt<Mt.to)return yt(Vt,At);if(Vt=At?Mt.from:V(Mt.to,-1),st.begin<=Vt&&Vt<st.end)return yt(Vt,At)}},$e=Ge(E+r,r,ve);if($e)return $e;var nt=r>0?ve.end:V(ve.begin,-1);return nt!=null&&!(r>0&&nt==t.text.length)&&($e=Ge(r>0?0:i.length-1,r,te(nt)),$e)?$e:null}var co={selectAll:Ds,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Ie)},killLine:function(e){return ka(e,function(t){if(t.empty()){var n=dt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Qe(t.head.line+1,0)}:{from:t.head,to:Qe(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return ka(e,function(t){return{from:Qe(t.from().line,0),to:Rt(e.doc,Qe(t.to().line+1,0))}})},delLineLeft:function(e){return ka(e,function(t){return{from:Qe(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return ka(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return ka(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Qe(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Qe(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return Xs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return Ys(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},Ne)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},Ne)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?Ys(e,t.head):r},Ne)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var E=n[i].from(),N=oe(e.getLine(E.line),E.ch,r);t.push(F(r-N%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return fn(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,E=dt(e.doc,i.line).text;if(E){if(i.ch==E.length&&(i=new Qe(i.line,i.ch-1)),i.ch>0)i=new Qe(i.line,i.ch+1),e.replaceRange(E.charAt(i.ch-1)+E.charAt(i.ch-2),Qe(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var N=dt(e.doc,i.line-1).text;N&&(i=new Qe(i.line,1),e.replaceRange(E.charAt(0)+e.doc.lineSeparator()+N.charAt(N.length-1),Qe(i.line-1,N.length-1),i,"+transpose"))}}n.push(new lr(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return fn(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);Pi(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Xs(e,t){var n=dt(e.doc,t),r=dn(n);return r!=n&&(t=Pt(r)),ss(!0,e,r,t,1)}function Il(e,t){var n=dt(e.doc,t),r=fa(n);return r!=n&&(t=Pt(r)),ss(!0,e,n,t,-1)}function Ys(e,t){var n=Xs(e,t.line),r=dt(e.doc,n.line),i=ut(r,e.doc.direction);if(!i||i[0].level==0){var E=Math.max(n.ch,r.text.search(/\S/)),N=t.line==n.line&&t.ch<=E&&t.ch;return Qe(n.line,N?0:E,n.sticky)}return n}function Bo(e,t,n){if(typeof t=="string"&&(t=co[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Ye}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Nl(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Oa(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Oa(t,e.options.extraKeys,n,e)||Oa(t,e.options.keyMap,n,e)}var Ul=new ye;function ho(e,t,n,r){var i=e.state.keySeq;if(i){if(zs(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ul.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),$s(e,i+" "+t,n,r))return!0}return $s(e,t,n,r)}function $s(e,t,n,r){var i=Nl(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&_r(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(ee(n),Vr(e)),!!i}function Qs(e,t){var n=Vs(t,!0);return n?t.shiftKey&&!e.state.keySeq?ho(e,"Shift-"+n,t,function(r){return Bo(e,r,!0)})||ho(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return Bo(e,r)}):ho(e,n,t,function(r){return Bo(e,r)}):!1}function Bl(e,t,n){return ho(e,"'"+n+"'",t,function(r){return Bo(e,r,!0)})}var ls=null;function Zs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=I(),Z(t,e))return;W&&B<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=Qs(t,e);T&&(ls=r?n:null,!r&&n==88&&!ir&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),k&&!s&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Fl(t)}function Fl(e){var t=e.display.lineDiv;z(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(c(t,"CodeMirror-crosshair"),mt(document,"keyup",n),mt(document,"mouseover",n))}Fe(document,"keyup",n),Fe(document,"mouseover",n)}function Js(e){e.keyCode==16&&(this.doc.sel.shift=!1),Z(this,e)}function qs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if($n(t.display,e)||Z(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(T&&n==ls){ls=null,ee(e);return}if(T&&(!e.which||e.which<10)&&Qs(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Bl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,us=function(e,t,n){this.time=e,this.pos=t,this.button=n};us.prototype.compare=function(e,t,n){return this.time+jl>e&&kt(t,this.pos)==0&&n==this.button};var fo,po;function Wl(e,t){var n=+new Date;return po&&po.compare(n,e,t)?(fo=po=null,"triple"):fo&&fo.compare(n,e,t)?(po=new us(n,e,t),fo=null,"double"):(fo=new us(n,e,t),po=null,"single")}function el(e){var t=this,n=t.display;if(Z(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,$n(n,e)){P||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(ds(t,e))return;var r=Gr(t,e),i=ke(e),E=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,E,e))return;i==1?r?zl(t,r,E,e):Ee(e)==n.scroller&&ee(e):i==2?(r&&_o(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(L?t.display.input.onContextMenu(e):Ga(t))}function Hl(e,t,n,r,i){var E="Click";return r=="double"?E="Double"+E:r=="triple"&&(E="Triple"+E),E=(t==1?"Left":t==2?"Middle":"Right")+E,ho(e,Gs(E,i),i,function(N){if(typeof N=="string"&&(N=co[N]),!N)return!1;var V=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),V=N(e,n)!=Ye}finally{e.state.suppressEdits=!1}return V})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var E=l?n.shiftKey&&n.metaKey:n.altKey;i.unit=E?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=s?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(s?n.altKey:n.ctrlKey)),i}function zl(e,t,n,r){W?setTimeout(G(Eo,e),0):e.curOp.focus=I();var i=Kl(e,n,r),E=e.doc.sel,N;e.options.dragDrop&&We&&!e.isReadOnly()&&n=="single"&&(N=E.contains(t))>-1&&(kt((N=E.ranges[N]).from(),t)<0||t.xRel>0)&&(kt(N.to(),t)>0||t.xRel<0)?Gl(e,r,t,i):Vl(e,r,t,i)}function Gl(e,t,n,r){var i=e.display,E=!1,N=Nr(e,function(te){P&&(i.scroller.draggable=!1),e.state.draggingText=!1,mt(i.wrapper.ownerDocument,"mouseup",N),mt(i.wrapper.ownerDocument,"mousemove",V),mt(i.scroller,"dragstart",$),mt(i.scroller,"drop",N),E||(ee(te),r.addNew||_o(e.doc,n,null,null,r.extend),P&&!_||W&&B==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),V=function(te){E=E||Math.abs(t.clientX-te.clientX)+Math.abs(t.clientY-te.clientY)>=10},$=function(){return E=!0};P&&(i.scroller.draggable=!0),e.state.draggingText=N,N.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Fe(i.wrapper.ownerDocument,"mouseup",N),Fe(i.wrapper.ownerDocument,"mousemove",V),Fe(i.scroller,"dragstart",$),Fe(i.scroller,"drop",N),Ga(e),setTimeout(function(){return i.input.focus()},20)}function tl(e,t,n){if(n=="char")return new lr(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new lr(Qe(t.line,0),Rt(e.doc,Qe(t.line+1,0)));var r=n(e,t);return new lr(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,E=e.doc;ee(t);var N,V,$=E.sel,te=$.ranges;if(r.addNew&&!r.extend?(V=E.sel.contains(n),V>-1?N=te[V]:N=new lr(n,n)):(N=E.sel.primary(),V=E.sel.primIndex),r.unit=="rectangle")r.addNew||(N=new lr(n,n)),n=Gr(e,t,!0,!0),V=-1;else{var ve=tl(e,n,r.unit);r.extend?N=ns(N,ve.anchor,ve.head,r.extend):N=ve}r.addNew?V==-1?(V=te.length,sn(E,Un(e,te.concat([N]),V),{scroll:!1,origin:"*mouse"})):te.length>1&&te[V].empty()&&r.unit=="char"&&!r.extend?(sn(E,Un(e,te.slice(0,V).concat(te.slice(V+1)),0),{scroll:!1,origin:"*mouse"}),$=E.sel):is(E,V,N,Ve):(V=0,sn(E,new mn([N],0),Ve),$=E.sel);var Se=n;function Pe(st){if(kt(Se,st)==0)return;if(Se=st,r.unit=="rectangle"){for(var yt=[],Mt=e.options.tabSize,At=oe(dt(E,n.line).text,n.ch,Mt),Vt=oe(dt(E,st.line).text,st.ch,Mt),Er=Math.min(At,Vt),Jr=Math.max(At,Vt),Dr=Math.min(n.line,st.line),kn=Math.min(e.lastLine(),Math.max(n.line,st.line));Dr<=kn;Dr++){var Cn=dt(E,Dr).text,Fr=Ue(Cn,Er,Mt);Er==Jr?yt.push(new lr(Qe(Dr,Fr),Qe(Dr,Fr))):Cn.length>Fr&&yt.push(new lr(Qe(Dr,Fr),Qe(Dr,Ue(Cn,Jr,Mt))))}yt.length||yt.push(new lr(n,n)),sn(E,Un(e,$.ranges.slice(0,V).concat(yt),V),{origin:"*mouse",scroll:!1}),e.scrollIntoView(st)}else{var Tn=N,nn=tl(e,st,r.unit),$r=Tn.anchor,jr;kt(nn.anchor,$r)>0?(jr=nn.head,$r=Gn(Tn.from(),nn.anchor)):(jr=nn.anchor,$r=wi(Tn.to(),nn.head));var Pr=$.ranges.slice(0);Pr[V]=Xl(e,new lr(Rt(E,$r),jr)),sn(E,Un(e,Pr,V),Ve)}}var _e=i.wrapper.getBoundingClientRect(),Ge=0;function $e(st){var yt=++Ge,Mt=Gr(e,st,!0,r.unit=="rectangle");if(!Mt)return;if(kt(Mt,Se)!=0){e.curOp.focus=I(),Pe(Mt);var At=ma(i,E);(Mt.line>=At.to||Mt.line<At.from)&&setTimeout(Nr(e,function(){Ge==yt&&$e(st)}),150)}else{var Vt=st.clientY<_e.top?-20:st.clientY>_e.bottom?20:0;Vt&&setTimeout(Nr(e,function(){if(Ge!=yt)return;i.scroller.scrollTop+=Vt,$e(st)}),50)}}function nt(st){e.state.selectingText=!1,Ge=Infinity,st&&(ee(st),i.input.focus()),mt(i.wrapper.ownerDocument,"mousemove",ot),mt(i.wrapper.ownerDocument,"mouseup",pt),E.history.lastSelOrigin=null}var ot=Nr(e,function(st){st.buttons===0||!ke(st)?nt(st):$e(st)}),pt=Nr(e,nt);e.state.selectingText=pt,Fe(i.wrapper.ownerDocument,"mousemove",ot),Fe(i.wrapper.ownerDocument,"mouseup",pt)}function Xl(e,t){var n=t.anchor,r=t.head,i=dt(e.doc,n.line);if(kt(n,r)==0&&n.sticky==r.sticky)return t;var E=ut(i);if(!E)return t;var N=et(E,n.ch,n.sticky),V=E[N];if(V.from!=n.ch&&V.to!=n.ch)return t;var $=N+(V.from==n.ch==(V.level!=1)?0:1);if($==0||$==E.length)return t;var te;if(r.line!=n.line)te=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ve=et(E,r.ch,r.sticky),Se=ve-N||(r.ch-n.ch)*(V.level==1?-1:1);ve==$-1||ve==$?te=Se<0:te=Se>0}var Pe=E[$+(te?-1:0)],_e=te==(Pe.level==1),Ge=_e?Pe.from:Pe.to,$e=_e?"after":"before";return n.ch==Ge&&n.sticky==$e?t:new lr(new Qe(n.line,Ge,$e),r)}function rl(e,t,n,r){var i,E;if(t.touches)i=t.touches[0].clientX,E=t.touches[0].clientY;else try{i=t.clientX,E=t.clientY}catch(Pe){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&ee(t);var N=e.display,V=N.lineDiv.getBoundingClientRect();if(E>V.bottom||!ae(e,n))return he(t);E-=V.top-N.viewOffset;for(var $=0;$<e.display.gutterSpecs.length;++$){var te=N.gutters.childNodes[$];if(te&&te.getBoundingClientRect().right>=i){var ve=or(e.doc,E),Se=e.display.gutterSpecs[$];return se(e,n,e,ve,Se.className,t),he(t)}}}function ds(e,t){return rl(e,t,"gutterClick",!0)}function nl(e,t){if($n(e.display,t)||Yl(e,t))return;if(Z(e,t,"contextmenu"))return;L||e.display.input.onContextMenu(t)}function Yl(e,t){return ae(e,"gutterContextMenu")?rl(e,t,"gutterContextMenu",!1):!1}function il(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Bt(e)}var Da={toString:function(){return"CodeMirror.Init"}},al={},Fo={};function $l(e){var t=e.optionHandlers;function n(r,i,E,N){e.defaults[r]=i,E&&(t[r]=N?function(V,$,te){te!=Da&&E(V,$,te)}:E)}e.defineOption=n,e.Init=Da,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Si(r)},!0),n("indentUnit",2,Si,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){to(r),Bt(r),mr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var E=[],N=r.doc.first;r.doc.iter(function($){for(var te=0;;){var ve=$.text.indexOf(i,te);if(ve==-1)break;te=ve+i.length,E.push(Qe(N,ve))}N++});for(var V=E.length-1;V>=0;V--)Aa(r.doc,i,E[V],Qe(E[V].line,E[V].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,E){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),E!=Da&&r.refresh()}),n("specialCharPlaceholder",dr,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!b),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){il(r),Qn(r)},!0),n("keyMap","default",function(r,i,E){var N=Uo(i),V=E!=Da&&Uo(E);V&&V.detach&&V.detach(r,N),N.attach&&N.attach(r,V||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Zl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=pn(i,r.options.lineNumbers),Qn(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?on(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return bi(r)},!0),n("scrollbarStyle","native",function(r){ya(r),bi(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=pn(r.options.gutters,i),Qn(r)},!0),n("firstLineNumber",1,Qn,!0),n("lineNumberFormatter",function(r){return r},Qn,!0),n("showCursorWhenSelecting",!1,fr,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Ri(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Ql),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,fr,!0),n("singleCursorHeightPerLine",!0,fr,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,to,!0),n("addModeClass",!1,to,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,to,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Ql(e,t,n){var r=n&&n!=Da;if(!t!=!r){var i=e.display.dragFunctions,E=t?Fe:mt;E(e.display.scroller,"dragstart",i.start),E(e.display.scroller,"dragenter",i.enter),E(e.display.scroller,"dragover",i.over),E(e.display.scroller,"dragleave",i.leave),E(e.display.scroller,"drop",i.drop)}}function Zl(e){e.options.lineWrapping?(z(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(c(e.display.wrapper,"CodeMirror-wrap"),qi(e)),hn(e),mr(e),Bt(e),setTimeout(function(){return bi(e)},100)}function Or(e,t){var n=this;if(!(this instanceof Or))return new Or(e,t);this.options=t=t?j(t):{},j(al,t,!1);var r=t.value;typeof r=="string"?r=new Sn(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Or.inputStyles[t.inputStyle](this),E=this.display=new aa(e,r,i,t);E.wrapper.CodeMirror=this,il(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),ya(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 ye,keySeq:null,specialChars:null},t.autofocus&&!o&&E.input.focus(),W&&B<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Jl(this),kl(),di(this),this.curOp.forceUpdate=!0,vs(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&li(n)},20):Ri(this);for(var N in Fo)Fo.hasOwnProperty(N)&&Fo[N](this,t[N],Da);Xr(this),t.finishInit&&t.finishInit(this);for(var V=0;V<cs.length;++V)cs[V](this);xi(this),P&&t.lineWrapping&&getComputedStyle(E.lineDiv).textRendering=="optimizelegibility"&&(E.lineDiv.style.textRendering="auto")}Or.defaults=al,Or.optionHandlers=Fo;function Jl(e){var t=e.display;Fe(t.scroller,"mousedown",Nr(e,el)),W&&B<11?Fe(t.scroller,"dblclick",Nr(e,function($){if(Z(e,$))return;var te=Gr(e,$);if(!te||ds(e,$)||$n(e.display,$))return;ee($);var ve=e.findWordAt(te);_o(e.doc,ve.anchor,ve.head)})):Fe(t.scroller,"dblclick",function($){return Z(e,$)||ee($)}),Fe(t.scroller,"contextmenu",function($){return nl(e,$)}),Fe(t.input.getField(),"contextmenu",function($){t.scroller.contains($.target)||nl(e,$)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function E($){if($.touches.length!=1)return!1;var te=$.touches[0];return te.radiusX<=1&&te.radiusY<=1}function N($,te){if(te.left==null)return!0;var ve=te.left-$.left,Se=te.top-$.top;return ve*ve+Se*Se>20*20}Fe(t.scroller,"touchstart",function($){if(!Z(e,$)&&!E($)&&!ds(e,$)){t.input.ensurePolled(),clearTimeout(n);var te=+new Date;t.activeTouch={start:te,moved:!1,prev:te-r.end<=300?r:null},$.touches.length==1&&(t.activeTouch.left=$.touches[0].pageX,t.activeTouch.top=$.touches[0].pageY)}}),Fe(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Fe(t.scroller,"touchend",function($){var te=t.activeTouch;if(te&&!$n(t,$)&&te.left!=null&&!te.moved&&new Date-te.start<300){var ve=e.coordsChar(t.activeTouch,"page"),Se;!te.prev||N(te,te.prev)?Se=new lr(ve,ve):!te.prev.prev||N(te,te.prev.prev)?Se=e.findWordAt(ve):Se=new lr(Qe(ve.line,0),Rt(e.doc,Qe(ve.line+1,0))),e.setSelection(Se.anchor,Se.head),e.focus(),ee($)}i()}),Fe(t.scroller,"touchcancel",i),Fe(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Ni(e,t.scroller.scrollTop),In(e,t.scroller.scrollLeft,!0),se(e,"scroll",e))}),Fe(t.scroller,"mousewheel",function($){return qa(e,$)}),Fe(t.scroller,"DOMMouseScroll",function($){return qa(e,$)}),Fe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function($){Z(e,$)||pe($)},over:function($){Z(e,$)||(Ol(e,$),pe($))},start:function($){return Ll(e,$)},drop:Nr(e,Al),leave:function($){Z(e,$)||Ws(e)}};var V=t.input.getField();Fe(V,"keyup",function($){return Js.call(e,$)}),Fe(V,"keydown",Nr(e,Zs)),Fe(V,"keypress",Nr(e,qs)),Fe(V,"focus",function($){return li(e,$)}),Fe(V,"blur",function($){return Ri(e,$)})}var cs=[];Or.defineInitHook=function(e){return cs.push(e)};function mo(e,t,n,r){var i=e.doc,E;n==null&&(n="add"),n=="smart"&&(i.mode.indent?E=Dn(e,t).state:n="prev");var N=e.options.tabSize,V=dt(i,t),$=oe(V.text,null,N);V.stateAfter&&(V.stateAfter=null);var te=V.text.match(/^\s*/)[0],ve;if(!r&&!/\S/.test(V.text))ve=0,n="not";else if(n=="smart"&&(ve=i.mode.indent(E,V.text.slice(te.length),V.text),ve==Ye||ve>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?ve=oe(dt(i,t-1).text,null,N):ve=0:n=="add"?ve=$+e.options.indentUnit:n=="subtract"?ve=$-e.options.indentUnit:typeof n=="number"&&(ve=$+n),ve=Math.max(0,ve);var Se="",Pe=0;if(e.options.indentWithTabs)for(var _e=Math.floor(ve/N);_e;--_e)Pe+=N,Se+=" ";if(Pe<ve&&(Se+=F(ve-Pe)),Se!=te)return Aa(i,Se,Qe(t,0),Qe(t,te.length),"+input"),V.stateAfter=null,!0;for(var Ge=0;Ge<i.sel.ranges.length;Ge++){var $e=i.sel.ranges[Ge];if($e.head.line==t&&$e.head.ch<te.length){var nt=Qe(t,te.length);is(i,Ge,new lr(nt,nt));break}}}var qn=null;function jo(e){qn=e}function hs(e,t,n,r,i){var E=e.doc;e.display.shift=!1,r||(r=E.sel);var N=+new Date-200,V=i=="paste"||e.state.pasteIncoming>N,$=Ct(t),te=null;if(V&&r.ranges.length>1)if(qn&&qn.text.join(`
|
|
`)==t){if(r.ranges.length%qn.text.length==0){te=[];for(var ve=0;ve<qn.text.length;ve++)te.push(E.splitLines(qn.text[ve]))}}else $.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(te=D($,function(ot){return[ot]}));for(var Se=e.curOp.updateInput,Pe=r.ranges.length-1;Pe>=0;Pe--){var _e=r.ranges[Pe],Ge=_e.from(),$e=_e.to();_e.empty()&&(n&&n>0?Ge=Qe(Ge.line,Ge.ch-n):e.state.overwrite&&!V?$e=Qe($e.line,Math.min(dt(E,$e.line).text.length,$e.ch+A($).length)):V&&qn&&qn.lineWise&&qn.text.join(`
|
|
`)==$.join(`
|
|
`)&&(Ge=$e=Qe(Ge.line,0)));var nt={from:Ge,to:$e,text:te?te[Pe%te.length]:$,origin:i||(V?"paste":e.state.cutIncoming>N?"cut":"+input")};wa(e.doc,nt),_r(e,"inputRead",e,nt)}t&&!V&&sl(e,t),Pi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=Se),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ol(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&fn(t,function(){return hs(t,n,0,null,"paste")}),!0}function sl(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var E=e.getModeAt(i.head),N=!1;if(E.electricChars){for(var V=0;V<E.electricChars.length;V++)if(t.indexOf(E.electricChars.charAt(V))>-1){N=mo(e,i.head.line,"smart");break}}else E.electricInput&&(E.electricInput.test(dt(e.doc,i.head.line).text.slice(0,i.head.ch))&&(N=mo(e,i.head.line,"smart")));N&&_r(e,"electricInput",e,i.head.line)}}function ll(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,E={anchor:Qe(i,0),head:Qe(i+1,0)};n.push(E),t.push(e.getRange(E.anchor,E.head))}return{text:t,ranges:n}}function ul(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function dl(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return P?e.style.width="1000px":e.setAttribute("wrap","off"),g&&(e.style.border="1px solid black"),ul(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,i){var E=this.options,N=E[r];if(E[r]==i&&r!="mode")return;E[r]=i,t.hasOwnProperty(r)&&Nr(this,t[r])(this,i,N),se(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](Uo(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,E=0;E<i.length;++E)if(i[E]==r||i[E].name==r)return i.splice(E,1),!0},addOverlay:rn(function(r,i){var E=r.token?r:e.getMode(this.options,r);if(E.startState)throw new Error("Overlays may not be stateful.");K(this.state.overlays,{mode:E,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(N){return N.priority}),this.state.modeGen++,mr(this)}),removeOverlay:rn(function(r){for(var i=this.state.overlays,E=0;E<i.length;++E){var N=i[E].modeSpec;if(N==r||typeof r=="string"&&N.name==r){i.splice(E,1),this.state.modeGen++,mr(this);return}}}),indentLine:rn(function(r,i,E){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),vn(this.doc,r)&&mo(this,r,i,E)}),indentSelection:rn(function(r){for(var i=this.doc.sel.ranges,E=-1,N=0;N<i.length;N++){var V=i[N];if(V.empty())V.head.line>E&&(mo(this,V.head.line,r,!0),E=V.head.line,N==this.doc.sel.primIndex&&Pi(this));else{var $=V.from(),te=V.to(),ve=Math.max(E,$.line);E=Math.min(this.lastLine(),te.line-(te.ch?0:1))+1;for(var Se=ve;Se<E;++Se)mo(this,Se,r);var Pe=this.doc.sel.ranges;$.ch==0&&i.length==Pe.length&&Pe[N].from().ch>0&&is(this.doc,N,new lr($,Pe[N].to()),Ie)}}}),getTokenAt:function(r,i){return ua(this,r,i)},getLineTokens:function(r,i){return ua(this,Qe(r),i,!0)},getTokenTypeAt:function(r){r=Rt(this.doc,r);var i=pi(this,dt(this.doc,r.line)),E=0,N=(i.length-1)/2,V=r.ch,$;if(V==0)$=i[2];else for(;;){var te=E+N>>1;if((te?i[te*2-1]:0)>=V)N=te;else if(i[te*2+1]<V)E=te+1;else{$=i[te*2+2];break}}var ve=$?$.indexOf("overlay "):-1;return ve<0?$:ve==0?null:$.slice(0,ve-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var E=[];if(!n.hasOwnProperty(i))return E;var N=n[i],V=this.getModeAt(r);if(typeof V[i]=="string")N[V[i]]&&E.push(N[V[i]]);else if(V[i])for(var $=0;$<V[i].length;$++){var te=N[V[i][$]];te&&E.push(te)}else V.helperType&&N[V.helperType]?E.push(N[V.helperType]):N[V.name]&&E.push(N[V.name]);for(var ve=0;ve<N._global.length;ve++){var Se=N._global[ve];Se.pred(V,this)&&Ce(E,Se.val)==-1&&E.push(Se.val)}return E},getStateAfter:function(r,i){var E=this.doc;return r=Ai(E,r==null?E.first+E.size-1:r),Dn(this,r+1,i).state},cursorCoords:function(r,i){var E,N=this.doc.sel.primary();return r==null?E=N.head:typeof r=="object"?E=Rt(this.doc,r):E=r?N.from():N.to(),$t(this,E,i||"page")},charCoords:function(r,i){return Cr(this,Rt(this.doc,r),i||"page")},coordsChar:function(r,i){return r=Yt(this,r,i||"page"),Qt(this,r.left,r.top)},lineAtHeight:function(r,i){return r=Yt(this,{top:r,left:0},i||"page").top,or(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,E){var N=!1,V;if(typeof r=="number"){var $=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>$&&(r=$,N=!0),V=dt(this.doc,r)}else V=r;return er(this,V,{top:0,left:0},i||"page",E||N).top+(N?this.doc.height-Ln(V):0)},defaultTextHeight:function(){return Rr(this.display)},defaultCharWidth:function(){return zr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,E,N,V){var $=this.display;r=$t(this,Rt(this.doc,r));var te=r.bottom,ve=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),$.sizer.appendChild(i),N=="over")te=r.top;else if(N=="above"||N=="near"){var Se=Math.max($.wrapper.clientHeight,this.doc.height),Pe=Math.max($.sizer.clientWidth,$.lineSpace.clientWidth);(N=="above"||r.bottom+i.offsetHeight>Se)&&r.top>i.offsetHeight?te=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=Se&&(te=r.bottom),ve+i.offsetWidth>Pe&&(ve=Pe-i.offsetWidth)}i.style.top=te+"px",i.style.left=i.style.right="",V=="right"?(ve=$.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(V=="left"?ve=0:V=="middle"&&(ve=($.sizer.clientWidth-i.offsetWidth)/2),i.style.left=ve+"px"),E&&So(this,{left:ve,top:te,right:ve+i.offsetWidth,bottom:te+i.offsetHeight})},triggerOnKeyDown:rn(Zs),triggerOnKeyPress:rn(qs),triggerOnKeyUp:Js,triggerOnMouseDown:rn(el),execCommand:function(r){if(co.hasOwnProperty(r))return co[r].call(null,this)},triggerElectric:rn(function(r){sl(this,r)}),findPosH:function(r,i,E,N){var V=1;i<0&&(V=-1,i=-i);for(var $=Rt(this.doc,r),te=0;te<i&&!($=fs(this.doc,$,V,E,N),$.hitSide);++te);return $},moveH:rn(function(r,i){var E=this;this.extendSelectionsBy(function(N){return E.display.shift||E.doc.extend||N.empty()?fs(E.doc,N.head,r,i,E.options.rtlMoveVisually):r<0?N.from():N.to()},Ne)}),deleteH:rn(function(r,i){var E=this.doc.sel,N=this.doc;E.somethingSelected()?N.replaceSelection("",null,"+delete"):ka(this,function(V){var $=fs(N,V.head,r,i,!1);return r<0?{from:$,to:V.head}:{from:V.head,to:$}})}),findPosV:function(r,i,E,N){var V=1,$=N;i<0&&(V=-1,i=-i);for(var te=Rt(this.doc,r),ve=0;ve<i;++ve){var Se=$t(this,te,"div");if($==null?$=Se.left:Se.left=$,te=cl(this,Se,V,E),te.hitSide)break}return te},moveV:rn(function(r,i){var E=this,N=this.doc,V=[],$=!this.display.shift&&!N.extend&&N.sel.somethingSelected();if(N.extendSelectionsBy(function(ve){if($)return r<0?ve.from():ve.to();var Se=$t(E,ve.head,"div");ve.goalColumn!=null&&(Se.left=ve.goalColumn),V.push(Se.left);var Pe=cl(E,Se,r,i);return i=="page"&&ve==N.sel.primary()&&Ya(E,Cr(E,Pe,"div").top-Se.top),Pe},Ne),V.length)for(var te=0;te<N.sel.ranges.length;te++)N.sel.ranges[te].goalColumn=V[te]}),findWordAt:function(r){var i=this.doc,E=dt(i,r.line).text,N=r.ch,V=r.ch;if(E){var $=this.getHelper(r,"wordChars");(r.sticky=="before"||V==E.length)&&N?--N:++V;for(var te=E.charAt(N),ve=je(te,$)?function(Se){return je(Se,$)}:/\s/.test(te)?function(Se){return/\s/.test(Se)}:function(Se){return!/\s/.test(Se)&&!je(Se)};N>0&&ve(E.charAt(N-1));)--N;for(;V<E.length&&ve(E.charAt(V));)++V}return new lr(Qe(r.line,N),Qe(r.line,V))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?z(this.display.cursorDiv,"CodeMirror-overwrite"):c(this.display.cursorDiv,"CodeMirror-overwrite"),se(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==I()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:rn(function(r,i){Ii(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Le(this)-this.display.barHeight,width:r.scrollWidth-Le(this)-this.display.barWidth,clientHeight:q(this),clientWidth:ge(this)}},scrollIntoView:rn(function(r,i){r==null?(r={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof r=="number"?r={from:Qe(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?$o(this,r):ta(this,r.from,r.to,r.margin)}),setSize:rn(function(r,i){var E=this,N=function($){return typeof $=="number"||/^\d+$/.test(String($))?$+"px":$};r!=null&&(this.display.wrapper.style.width=N(r)),i!=null&&(this.display.wrapper.style.height=N(i)),this.options.lineWrapping&&Ut(this);var V=this.display.viewFrom;this.doc.iter(V,this.display.viewTo,function($){if($.widgets){for(var te=0;te<$.widgets.length;te++)if($.widgets[te].noHScroll){Lr(E,V,"widget");break}}++V}),this.curOp.forceUpdate=!0,se(this,"refresh",this)}),operation:function(r){return fn(this,r)},startOperation:function(){return di(this)},endOperation:function(){return xi(this)},refresh:rn(function(){var r=this.display.cachedTextHeight;mr(this),this.curOp.forceUpdate=!0,Bt(this),Ii(this,this.doc.scrollLeft,this.doc.scrollTop),xa(this.display),(r==null||Math.abs(r-Rr(this.display))>.5||this.options.lineWrapping)&&hn(this),se(this,"refresh",this)}),swapDoc:rn(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),vs(this,r),Bt(this),this.display.input.reset(),Ii(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,_r(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ue(e),e.registerHelper=function(r,i,E){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=E},e.registerGlobalHelper=function(r,i,E,N){e.registerHelper(r,i,N),n[r]._global.push({pred:E,val:N})}}function fs(e,t,n,r,i){var E=t,N=n,V=dt(e,t.line),$=i&&e.direction=="rtl"?-n:n;function te(){var pt=t.line+$;return pt<e.first||pt>=e.first+e.size?!1:(t=new Qe(pt,t.ch,t.sticky),V=dt(e,pt))}function ve(pt){var st;if(r=="codepoint"){var yt=V.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(yt)?st=null:st=new Qe(t.line,Math.max(0,Math.min(V.text.length,t.ch+n*(yt>=55296&&yt<56320?2:1))),-n)}else i?st=Pl(e.cm,V,t,n):st=os(V,t,n);if(st==null)if(!pt&&te())t=ss(i,e.cm,V,t.line,$);else return!1;else t=st;return!0}if(r=="char"||r=="codepoint")ve();else if(r=="column")ve(!0);else if(r=="word"||r=="group")for(var Se=null,Pe=r=="group",_e=e.cm&&e.cm.getHelper(t,"wordChars"),Ge=!0;!(n<0&&!ve(!Ge));Ge=!1){var $e=V.text.charAt(t.ch)||`
|
|
`,nt=je($e,_e)?"w":Pe&&$e==`
|
|
`?"n":!Pe||/\s/.test($e)?null:"p";if(Pe&&!Ge&&!nt&&(nt="s"),Se&&Se!=nt){n<0&&(n=1,ve(),t.sticky="after");break}if(nt&&(Se=nt),n>0&&!ve(!Ge))break}var ot=Po(e,t,E,N,!0);return zn(E,ot)&&(ot.hitSide=!0),ot}function cl(e,t,n,r){var i=e.doc,E=t.left,N;if(r=="page"){var V=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),$=Math.max(V-.5*Rr(e.display),3);N=(n>0?t.bottom:t.top)+n*$}else r=="line"&&(N=n>0?t.bottom+3:t.top-3);for(var te;!(te=Qt(e,E,N),!te.outside);){if(n<0?N<=0:N>=i.height){te.hitSide=!0;break}N+=n*5}return te}var gr=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ye,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};gr.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;ul(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function E(V){for(var $=V.target;$;$=$.parentNode){if($==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test($.className))break}return!1}Fe(i,"paste",function(V){if(!E(V)||Z(r,V)||ol(V,r))return;B<=11&&setTimeout(Nr(r,function(){return t.updateFromDOM()}),20)}),Fe(i,"compositionstart",function(V){t.composing={data:V.data,done:!1}}),Fe(i,"compositionupdate",function(V){t.composing||(t.composing={data:V.data,done:!1})}),Fe(i,"compositionend",function(V){t.composing&&(V.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Fe(i,"touchstart",function(){return n.forceCompositionEnd()}),Fe(i,"input",function(){t.composing||t.readFromDOMSoon()});function N(V){if(!E(V)||Z(r,V))return;if(r.somethingSelected())jo({lineWise:!1,text:r.getSelections()}),V.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var $=ll(r);jo({lineWise:!0,text:$.text}),V.type=="cut"&&r.operation(function(){r.setSelections($.ranges,0,Ie),r.replaceSelection("",null,"cut")})}else return;if(V.clipboardData){V.clipboardData.clearData();var te=qn.text.join(`
|
|
`);if(V.clipboardData.setData("Text",te),V.clipboardData.getData("Text")==te){V.preventDefault();return}}var ve=dl(),Se=ve.firstChild;r.display.lineSpace.insertBefore(ve,r.display.lineSpace.firstChild),Se.value=qn.text.join(`
|
|
`);var Pe=document.activeElement;ie(Se),setTimeout(function(){r.display.lineSpace.removeChild(ve),Pe.focus(),Pe==i&&n.showPrimarySelection()},50)}Fe(i,"copy",N),Fe(i,"cut",N)},gr.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},gr.prototype.prepareSelection=function(){var e=Hn(this.cm,!1);return e.focus=document.activeElement==this.div,e},gr.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},gr.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},gr.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var E=Wo(t,e.anchorNode,e.anchorOffset),N=Wo(t,e.focusNode,e.focusOffset);if(E&&!E.bad&&N&&!N.bad&&kt(Gn(E,N),r)==0&&kt(wi(E,N),i)==0)return;var V=t.display.view,$=r.line>=t.display.viewFrom&&hl(t,r)||{node:V[0].measure.map[2],offset:0},te=i.line<t.display.viewTo&&hl(t,i);if(!te){var ve=V[V.length-1].measure,Se=ve.maps?ve.maps[ve.maps.length-1]:ve.map;te={node:Se[Se.length-1],offset:Se[Se.length-2]-Se[Se.length-3]}}if(!$||!te){e.removeAllRanges();return}var Pe=e.rangeCount&&e.getRangeAt(0),_e;try{_e=m($.node,$.offset,te.offset,te.node)}catch(Ge){}_e&&(!k&&t.state.focused?(e.collapse($.node,$.offset),_e.collapsed||(e.removeAllRanges(),e.addRange(_e))):(e.removeAllRanges(),e.addRange(_e)),Pe&&e.anchorNode==null?e.addRange(Pe):k&&this.startGracePeriod()),this.rememberSelection()},gr.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)},gr.prototype.showMultipleSelections=function(e){d(this.cm.display.cursorDiv,e.cursors),d(this.cm.display.selectionDiv,e.selection)},gr.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},gr.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return S(this.div,t)},gr.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},gr.prototype.blur=function(){this.div.blur()},gr.prototype.getField=function(){return this.div},gr.prototype.supportsTouch=function(){return!0},gr.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():fn(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)},gr.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},gr.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(u&&y&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=Wo(t,e.anchorNode,e.anchorOffset),r=Wo(t,e.focusNode,e.focusOffset);n&&r&&fn(t,function(){sn(t.doc,Zn(n,r),Ie),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},gr.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Qe(r.line-1,dt(e.doc,r.line-1).length)),i.ch==dt(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Qe(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var E,N,V;r.line==t.viewFrom||(E=xr(e,r.line))==0?(N=Pt(t.view[0].line),V=t.view[0].node):(N=Pt(t.view[E].line),V=t.view[E-1].node.nextSibling);var $=xr(e,i.line),te,ve;if($==t.view.length-1?(te=t.viewTo-1,ve=t.lineDiv.lastChild):(te=Pt(t.view[$+1].line)-1,ve=t.view[$+1].node.previousSibling),!V)return!1;for(var Se=e.doc.splitLines(tu(e,V,ve,N,te)),Pe=Jt(e.doc,Qe(N,0),Qe(te,dt(e.doc,te).text.length));Se.length>1&&Pe.length>1;)if(A(Se)==A(Pe))Se.pop(),Pe.pop(),te--;else if(Se[0]==Pe[0])Se.shift(),Pe.shift(),N++;else break;for(var _e=0,Ge=0,$e=Se[0],nt=Pe[0],ot=Math.min($e.length,nt.length);_e<ot&&$e.charCodeAt(_e)==nt.charCodeAt(_e);)++_e;for(var pt=A(Se),st=A(Pe),yt=Math.min(pt.length-(Se.length==1?_e:0),st.length-(Pe.length==1?_e:0));Ge<yt&&pt.charCodeAt(pt.length-Ge-1)==st.charCodeAt(st.length-Ge-1);)++Ge;if(Se.length==1&&Pe.length==1&&N==r.line)for(;_e&&_e>r.ch&&pt.charCodeAt(pt.length-Ge-1)==st.charCodeAt(st.length-Ge-1);)_e--,Ge++;Se[Se.length-1]=pt.slice(0,pt.length-Ge).replace(/^\u200b+/,""),Se[0]=Se[0].slice(_e).replace(/\u200b+$/,"");var Mt=Qe(N,_e),At=Qe(te,Pe.length?A(Pe).length-Ge:0);if(Se.length>1||Se[0]||kt(Mt,At))return Aa(e.doc,Se,Mt,At,"+input"),!0},gr.prototype.ensurePolled=function(){this.forceCompositionEnd()},gr.prototype.reset=function(){this.forceCompositionEnd()},gr.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},gr.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)},gr.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&fn(this.cm,function(){return mr(e.cm)})},gr.prototype.setUneditable=function(e){e.contentEditable="false"},gr.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Nr(this.cm,hs)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},gr.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},gr.prototype.onContextMenu=function(){},gr.prototype.resetPosition=function(){},gr.prototype.needsContentAttribute=!0;function hl(e,t){var n=Oe(e,t.line);if(!n||n.hidden)return null;var r=dt(e.doc,t.line),i=re(n,r,t.line),E=ut(r,e.doc.direction),N="left";if(E){var V=et(E,t.ch);N=V%2?"right":"left"}var $=Je(i.map,t.ch,N);return $.offset=$.collapse=="right"?$.end:$.start,$}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Ma(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var E="",N=!1,V=e.doc.lineSeparator(),$=!1;function te(_e){return function(Ge){return Ge.id==_e}}function ve(){N&&(E+=V,$&&(E+=V),N=$=!1)}function Se(_e){_e&&(ve(),E+=_e)}function Pe(_e){if(_e.nodeType==1){var Ge=_e.getAttribute("cm-text");if(Ge){Se(Ge);return}var $e=_e.getAttribute("cm-marker"),nt;if($e){var ot=e.findMarks(Qe(r,0),Qe(i+1,0),te(+$e));ot.length&&(nt=ot[0].find(0))&&Se(Jt(e.doc,nt.from,nt.to).join(V));return}if(_e.getAttribute("contenteditable")=="false")return;var pt=/^(pre|div|p|li|table|br)$/i.test(_e.nodeName);if(!/^br$/i.test(_e.nodeName)&&_e.textContent.length==0)return;pt&&ve();for(var st=0;st<_e.childNodes.length;st++)Pe(_e.childNodes[st]);/^(pre|p)$/i.test(_e.nodeName)&&($=!0),pt&&(N=!0)}else _e.nodeType==3&&Se(_e.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Pe(t),t==n);)t=t.nextSibling,$=!1;return E}function Wo(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Ma(e.clipPos(Qe(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var E=e.display.view[i];if(E.node==r)return ru(E,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!S(r,t))return Ma(Qe(Pt(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var E=e.rest?A(e.rest):e.line;return Ma(Qe(Pt(E),E.text.length),i)}var N=t.nodeType==3?t:null,V=t;for(!N&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(N=t.firstChild,n&&(n=N.nodeValue.length));V.parentNode!=r;)V=V.parentNode;var $=e.measure,te=$.maps;function ve(nt,ot,pt){for(var st=-1;st<(te?te.length:0);st++)for(var yt=st<0?$.map:te[st],Mt=0;Mt<yt.length;Mt+=3){var At=yt[Mt+2];if(At==nt||At==ot){var Vt=Pt(st<0?e.line:e.rest[st]),Er=yt[Mt]+pt;return(pt<0||At!=nt)&&(Er=yt[Mt+(pt?1:0)]),Qe(Vt,Er)}}}var Se=ve(N,V,n);if(Se)return Ma(Se,i);for(var Pe=V.nextSibling,_e=N?N.nodeValue.length-n:0;Pe;Pe=Pe.nextSibling){if(Se=ve(Pe,Pe.firstChild,0),Se)return Ma(Qe(Se.line,Se.ch-_e),i);_e+=Pe.textContent.length}for(var Ge=V.previousSibling,$e=n;Ge;Ge=Ge.previousSibling){if(Se=ve(Ge,Ge.firstChild,-1),Se)return Ma(Qe(Se.line,Se.ch+$e),i);$e+=Ge.textContent.length}}var Br=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ye,this.hasSelection=!1,this.composing=null};Br.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),g&&(i.style.width="0px"),Fe(i,"input",function(){W&&B>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Fe(i,"paste",function(N){if(Z(r,N)||ol(N,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function E(N){if(Z(r,N))return;if(r.somethingSelected())jo({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var V=ll(r);jo({lineWise:!0,text:V.text}),N.type=="cut"?r.setSelections(V.ranges,null,Ie):(n.prevInput="",i.value=V.text.join(`
|
|
`),ie(i))}else return;N.type=="cut"&&(r.state.cutIncoming=+new Date)}Fe(i,"cut",E),Fe(i,"copy",E),Fe(e.scroller,"paste",function(N){if($n(e,N)||Z(r,N))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var V=new Event("paste");V.clipboardData=N.clipboardData,i.dispatchEvent(V)}),Fe(e.lineSpace,"selectstart",function(N){$n(e,N)||ee(N)}),Fe(i,"compositionstart",function(){var N=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:N,range:r.markText(N,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Fe(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Br.prototype.createField=function(e){this.wrapper=dl(),this.textarea=this.wrapper.firstChild},Br.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Br.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=Hn(e);if(e.options.moveInputWithCursor){var i=$t(e,n.sel.primary().head,"div"),E=t.wrapper.getBoundingClientRect(),N=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+N.top-E.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+N.left-E.left))}return r},Br.prototype.showSelection=function(e){var t=this.cm,n=t.display;d(n.cursorDiv,e.cursors),d(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Br.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&ie(this.textarea),W&&B>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",W&&B>=9&&(this.hasSelection=null))},Br.prototype.getField=function(){return this.textarea},Br.prototype.supportsTouch=function(){return!1},Br.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||I()!=this.textarea))try{this.textarea.focus()}catch(e){}},Br.prototype.blur=function(){this.textarea.blur()},Br.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Br.prototype.receivedFocus=function(){this.slowPoll()},Br.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()})},Br.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},Br.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||vt(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(W&&B>=9&&this.hasSelection===i||s&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var E=i.charCodeAt(0);if(E==8203&&!r&&(r="\u200B"),E==8666)return this.reset(),this.cm.execCommand("undo")}for(var N=0,V=Math.min(r.length,i.length);N<V&&r.charCodeAt(N)==i.charCodeAt(N);)++N;return fn(t,function(){hs(t,i.slice(N),r.length-N,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
|
|
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Br.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Br.prototype.onKeyPress=function(){W&&B>=9&&(this.hasSelection=null),this.fastPoll()},Br.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var E=Gr(n,e),N=r.scroller.scrollTop;if(!E||T)return;var V=n.options.resetSelectionOnContextMenu;V&&n.doc.sel.contains(E)==-1&&Nr(n,sn)(n.doc,Zn(E),Ie);var $=i.style.cssText,te=t.wrapper.style.cssText,ve=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-ve.top-5)+"px; left: "+(e.clientX-ve.left-5)+`px;
|
|
z-index: 1000; background: `+(W?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var Se;P&&(Se=window.scrollY),r.input.focus(),P&&window.scrollTo(null,Se),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=_e,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function Pe(){if(i.selectionStart!=null){var $e=n.somethingSelected(),nt="\u200B"+($e?i.value:"");i.value="\u21DA",i.value=nt,t.prevInput=$e?"":"\u200B",i.selectionStart=1,i.selectionEnd=nt.length,r.selForContextMenu=n.doc.sel}}function _e(){if(t.contextMenuPending!=_e)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=te,i.style.cssText=$,W&&B<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=N),i.selectionStart!=null){(!W||W&&B<9)&&Pe();var $e=0,nt=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Nr(n,Ds)(n):$e++<10?r.detectingSelectAll=setTimeout(nt,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(nt,200)}}if(W&&B>=9&&Pe(),L){pe(e);var Ge=function(){mt(window,"mouseup",Ge),setTimeout(_e,20)};Fe(window,"mouseup",Ge)}else setTimeout(_e,50)},Br.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Br.prototype.setUneditable=function(){},Br.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?j(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=I();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=V.getValue()}var i;if(e.form&&(Fe(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var E=e.form;i=E.submit;try{var N=E.submit=function(){r(),E.submit=i,E.submit(),E.submit=N}}catch($){}}t.finishInit=function($){$.save=r,$.getTextArea=function(){return e},$.toTextArea=function(){$.toTextArea=isNaN,r(),e.parentNode.removeChild($.getWrapperElement()),e.style.display="",e.form&&(mt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var V=Or(function($){return e.parentNode.insertBefore($,e.nextSibling)},t);return V}function iu(e){e.off=mt,e.on=Fe,e.wheelEventPixels=Ja,e.Doc=Sn,e.splitLines=Ct,e.countColumn=oe,e.findColumn=Ue,e.isWordChar=Me,e.Pass=Ye,e.signal=se,e.Line=vi,e.changeEnd=Jn,e.scrollbarModel=$a,e.Pos=Qe,e.cmpPos=kt,e.modes=vr,e.mimeModes=It,e.resolveMode=Ir,e.getMode=an,e.modeExtensions=un,e.extendMode=Kn,e.copyState=Hr,e.startState=ei,e.innerMode=Bn,e.commands=co,e.keyMap=Ci,e.keyName=Vs,e.isModifierKey=zs,e.lookupKey=Oa,e.normalizeKeyMap=Rl,e.StringStream=Sr,e.SharedTextMarker=so,e.TextMarker=ji,e.LineWidget=oo,e.e_preventDefault=ee,e.e_stopPropagation=ne,e.e_stop=pe,e.addClass=z,e.contains=S,e.rmClass=c,e.keyNames=Wi}$l(Or),ql(Or);var au="iter insert remove copy getEditor constructor".split(" ");for(var Ho in Sn.prototype)Sn.prototype.hasOwnProperty(Ho)&&Ce(au,Ho)<0&&(Or.prototype[Ho]=function(e){return function(){return e.apply(this.doc,arguments)}}(Sn.prototype[Ho]));return ue(Sn),Or.inputStyles={textarea:Br,contenteditable:gr},Or.defineMode=function(e){!Or.defaults.mode&&e!="null"&&(Or.defaults.mode=e),Wr.apply(this,arguments)},Or.defineMIME=en,Or.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Or.defineMIME("text/plain","null"),Or.defineExtension=function(e,t){Or.prototype[e]=t},Or.defineDocExtension=function(e,t){Sn.prototype[e]=t},Or.fromTextArea=nu,iu(Or),Or.version="5.58.2",Or})},Y1PL:function(Ot,ct,le){"use strict";le.r(ct),le.d(ct,"ResizableTextArea",function(){return Ce});var de=le("wx14"),X=le("1OyB"),k=le("vuIU"),H=le("Ji7U"),C=le("LK+K"),M=le("q1tI"),W=le("VTBJ"),B=le("rePB"),P=le("Zm9Q"),R=le("Kwbf"),y=le("c+Xe"),T=le("m+aA"),_=le("bdgK"),O=new Map;function w(Ie){Ie.forEach(function(Ve){var Ne,Ue=Ve.target;(Ne=O.get(Ue))===null||Ne===void 0||Ne.forEach(function(Ae){return Ae(Ue)})})}var g=new _.default(w),u=null,o=null;function s(Ie,Ve){O.has(Ie)||(O.set(Ie,new Set),g.observe(Ie)),O.get(Ie).add(Ve)}function l(Ie,Ve){O.has(Ie)&&(O.get(Ie).delete(Ve),O.get(Ie).size||(g.unobserve(Ie),O.delete(Ie)))}var b=function(Ie){Object(H.a)(Ne,Ie);var Ve=Object(C.a)(Ne);function Ne(){return Object(X.a)(this,Ne),Ve.apply(this,arguments)}return Object(k.a)(Ne,[{key:"render",value:function(){return this.props.children}}]),Ne}(M.Component),p=M.createContext(null);function h(Ie){var Ve=Ie.children,Ne=Ie.onBatchResize,Ue=M.useRef(0),Ae=M.useRef([]),F=M.useContext(p),A=M.useCallback(function(D,K,J){Ue.current+=1;var U=Ue.current;Ae.current.push({size:D,element:K,data:J}),Promise.resolve().then(function(){U===Ue.current&&(Ne==null||Ne(Ae.current),Ae.current=[])}),F==null||F(D,K,J)},[Ne,F]);return M.createElement(p.Provider,{value:A},Ve)}function L(Ie){var Ve=Ie.children,Ne=Ie.disabled,Ue=M.useRef(null),Ae=M.useRef(null),F=M.useContext(p),A=M.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),D=M.isValidElement(Ve)&&Object(y.c)(Ve),K=D?Ve.ref:null,J=M.useMemo(function(){return Object(y.a)(K,Ue)},[K,Ue]),U=M.useRef(Ie);U.current=Ie;var me=M.useCallback(function(Me){var je=U.current,Xe=je.onResize,Be=je.data,He=Me.getBoundingClientRect(),ze=He.width,rt=He.height,it=Me.offsetWidth,lt=Me.offsetHeight,et=Math.floor(ze),St=Math.floor(rt);if(A.current.width!==et||A.current.height!==St||A.current.offsetWidth!==it||A.current.offsetHeight!==lt){var ut={width:et,height:St,offsetWidth:it,offsetHeight:lt};A.current=ut;var ht=it===Math.round(ze)?ze:it,Fe=lt===Math.round(rt)?rt:lt,bt=Object(W.a)(Object(W.a)({},ut),{},{offsetWidth:ht,offsetHeight:Fe});F==null||F(bt,Me,Be),Xe&&Promise.resolve().then(function(){Xe(bt,Me)})}},[]);return M.useEffect(function(){var Me=Object(T.a)(Ue.current)||Object(T.a)(Ae.current);return Me&&!Ne&&s(Me,me),function(){return l(Me,me)}},[Ue.current,Ne]),M.createElement(b,{ref:Ae},D?M.cloneElement(Ve,{ref:J}):Ve)}var v="rc-observer-key";function c(Ie){var Ve=Ie.children,Ne=Object(P.a)(Ve);return Ne.map(function(Ue,Ae){var F=(Ue==null?void 0:Ue.key)||"".concat(v,"-").concat(Ae);return M.createElement(L,Object(de.a)({},Ie,{key:F}),Ue)})}c.Collection=h;var f=c,d=le("bT9E"),a=le("TSYQ"),x=le.n(a),m=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,S=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],I={},z;function Y(Ie){var Ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ne=Ie.getAttribute("id")||Ie.getAttribute("data-reactid")||Ie.getAttribute("name");if(Ve&&I[Ne])return I[Ne];var Ue=window.getComputedStyle(Ie),Ae=Ue.getPropertyValue("box-sizing")||Ue.getPropertyValue("-moz-box-sizing")||Ue.getPropertyValue("-webkit-box-sizing"),F=parseFloat(Ue.getPropertyValue("padding-bottom"))+parseFloat(Ue.getPropertyValue("padding-top")),A=parseFloat(Ue.getPropertyValue("border-bottom-width"))+parseFloat(Ue.getPropertyValue("border-top-width")),D=S.map(function(J){return"".concat(J,":").concat(Ue.getPropertyValue(J))}).join(";"),K={sizingStyle:D,paddingSize:F,borderSize:A,boxSizing:Ae};return Ve&&Ne&&(I[Ne]=K),K}function ie(Ie){var Ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Ue=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;z||(z=document.createElement("textarea"),z.setAttribute("tab-index","-1"),z.setAttribute("aria-hidden","true"),document.body.appendChild(z)),Ie.getAttribute("wrap")?z.setAttribute("wrap",Ie.getAttribute("wrap")):z.removeAttribute("wrap");var Ae=Y(Ie,Ve),F=Ae.paddingSize,A=Ae.borderSize,D=Ae.boxSizing,K=Ae.sizingStyle;z.setAttribute("style","".concat(K,";").concat(m)),z.value=Ie.value||Ie.placeholder||"";var J=Number.MIN_SAFE_INTEGER,U=Number.MAX_SAFE_INTEGER,me=z.scrollHeight,Me;if(D==="border-box"?me+=A:D==="content-box"&&(me-=F),Ne!==null||Ue!==null){z.value=" ";var je=z.scrollHeight-F;Ne!==null&&(J=je*Ne,D==="border-box"&&(J=J+F+A),me=Math.max(J,me)),Ue!==null&&(U=je*Ue,D==="border-box"&&(U=U+F+A),Me=me>U?"":"hidden",me=Math.min(U,me))}return{height:me,minHeight:J,maxHeight:U,overflowY:Me,resize:"none"}}var G=le("Gytx"),j=le.n(G),oe;(function(Ie){Ie[Ie.NONE=0]="NONE",Ie[Ie.RESIZING=1]="RESIZING",Ie[Ie.RESIZED=2]="RESIZED"})(oe||(oe={}));var ye=function(Ie){Object(H.a)(Ne,Ie);var Ve=Object(C.a)(Ne);function Ne(Ue){var Ae;return Object(X.a)(this,Ne),Ae=Ve.call(this,Ue),Ae.nextFrameActionId=void 0,Ae.resizeFrameId=void 0,Ae.textArea=void 0,Ae.saveTextArea=function(F){Ae.textArea=F},Ae.handleResize=function(F){var A=Ae.state.resizeStatus,D=Ae.props,K=D.autoSize,J=D.onResize;if(A!==oe.NONE)return;typeof J=="function"&&J(F),K&&Ae.resizeOnNextFrame()},Ae.resizeOnNextFrame=function(){cancelAnimationFrame(Ae.nextFrameActionId),Ae.nextFrameActionId=requestAnimationFrame(Ae.resizeTextarea)},Ae.resizeTextarea=function(){var F=Ae.props.autoSize;if(!F||!Ae.textArea)return;var A=F.minRows,D=F.maxRows,K=ie(Ae.textArea,!1,A,D);Ae.setState({textareaStyles:K,resizeStatus:oe.RESIZING},function(){cancelAnimationFrame(Ae.resizeFrameId),Ae.resizeFrameId=requestAnimationFrame(function(){Ae.setState({resizeStatus:oe.RESIZED},function(){Ae.resizeFrameId=requestAnimationFrame(function(){Ae.setState({resizeStatus:oe.NONE}),Ae.fixFirefoxAutoScroll()})})})})},Ae.renderTextArea=function(){var F=Ae.props,A=F.prefixCls,D=A===void 0?"rc-textarea":A,K=F.autoSize,J=F.onResize,U=F.className,me=F.disabled,Me=Ae.state,je=Me.textareaStyles,Xe=Me.resizeStatus,Be=Object(d.a)(Ae.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),He=x()(D,U,Object(B.a)({},"".concat(D,"-disabled"),me));"value"in Be&&(Be.value=Be.value||"");var ze=Object(W.a)(Object(W.a)(Object(W.a)({},Ae.props.style),je),Xe===oe.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return M.createElement(f,{onResize:Ae.handleResize,disabled:!(K||J)},M.createElement("textarea",Object(de.a)({},Be,{className:He,style:ze,ref:Ae.saveTextArea})))},Ae.state={textareaStyles:{},resizeStatus:oe.NONE},Ae}return Object(k.a)(Ne,[{key:"componentDidUpdate",value:function(Ae){(Ae.value!==this.props.value||!j()(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,F=this.textArea.selectionEnd;this.textArea.setSelectionRange(Ae,F)}}catch(A){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Ne}(M.Component),Ce=ye,De=function(Ie){Object(H.a)(Ne,Ie);var Ve=Object(C.a)(Ne);function Ne(Ue){var Ae;Object(X.a)(this,Ne),Ae=Ve.call(this,Ue),Ae.resizableTextArea=void 0,Ae.focus=function(){Ae.resizableTextArea.textArea.focus()},Ae.saveTextArea=function(A){Ae.resizableTextArea=A},Ae.handleChange=function(A){var D=Ae.props.onChange;Ae.setValue(A.target.value,function(){Ae.resizableTextArea.resizeTextarea()}),D&&D(A)},Ae.handleKeyDown=function(A){var D=Ae.props,K=D.onPressEnter,J=D.onKeyDown;A.keyCode===13&&K&&K(A),J&&J(A)};var F=typeof Ue.value=="undefined"||Ue.value===null?Ue.defaultValue:Ue.value;return Ae.state={value:F},Ae}return Object(k.a)(Ne,[{key:"setValue",value:function(Ae,F){"value"in this.props||this.setState({value:Ae},F)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return M.createElement(Ce,Object(de.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}}]),Ne}(M.Component),Ye=ct.default=De},bT9E:function(Ot,ct,le){"use strict";le.d(ct,"a",function(){return X});var de=le("VTBJ");function X(k,H){var C=Object(de.a)({},k);return Array.isArray(H)&&H.forEach(function(M){delete C[M]}),C}},c5Ni:function(Ot,ct,le){},dejd:function(Ot,ct,le){},dmUQ:function(Ot,ct,le){"use strict";var de=le("Ff2n"),X=le("rePB"),k=le("1OyB"),H=le("vuIU"),C=le("Ji7U"),M=le("md7G"),W=le("foSv"),B=le("q1tI"),P=le.n(B),R=le("TSYQ"),y=le.n(R),T=le("4IlW");function _(d,a){var x=Object.keys(d);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(d);a&&(m=m.filter(function(S){return Object.getOwnPropertyDescriptor(d,S).enumerable})),x.push.apply(x,m)}return x}function O(d){for(var a=1;a<arguments.length;a++){var x=arguments[a]!=null?arguments[a]:{};a%2?_(Object(x),!0).forEach(function(m){Object(X.a)(d,m,x[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(x)):_(Object(x)).forEach(function(m){Object.defineProperty(d,m,Object.getOwnPropertyDescriptor(x,m))})}return d}function w(d){var a=g();return function(){var m=Object(W.a)(d),S;if(a){var I=Object(W.a)(this).constructor;S=Reflect.construct(m,arguments,I)}else S=m.apply(this,arguments);return Object(M.a)(this,S)}}function g(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(d){return!1}}function u(){}function o(d){d.preventDefault()}var s=function(a){return a.replace(/[^\w.-]+/g,"")},l=200,b=600,p=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,h=function(a){return a!=null},L=function(a,x){return x===a||typeof x=="number"&&typeof a=="number"&&isNaN(x)&&isNaN(a)},v=function(d){Object(C.a)(x,d);var a=w(x);function x(m){var S;Object(k.a)(this,x),S=a.call(this,m),S.onKeyDown=function(Y){var ie=S.props,G=ie.onKeyDown,j=ie.onPressEnter;if(Y.keyCode===T.a.UP){var oe=S.getRatio(Y);S.up(Y,oe,null),S.stop()}else if(Y.keyCode===T.a.DOWN){var ye=S.getRatio(Y);S.down(Y,ye,null),S.stop()}else Y.keyCode===T.a.ENTER&&j&&j(Y);if(S.recordCursorPosition(),S.lastKeyCode=Y.keyCode,G){for(var Ce=arguments.length,De=new Array(Ce>1?Ce-1:0),Ye=1;Ye<Ce;Ye++)De[Ye-1]=arguments[Ye];G.apply(void 0,[Y].concat(De))}},S.onKeyUp=function(Y){var ie=S.props.onKeyUp;if(S.stop(),S.recordCursorPosition(),ie){for(var G=arguments.length,j=new Array(G>1?G-1:0),oe=1;oe<G;oe++)j[oe-1]=arguments[oe];ie.apply(void 0,[Y].concat(j))}},S.onChange=function(Y){var ie=S.props.onChange;S.state.focused&&(S.inputting=!0),S.rawInput=S.props.parser(S.getValueFromEvent(Y)),S.setState({inputValue:S.rawInput}),ie(S.toNumber(S.rawInput))},S.onMouseUp=function(){var Y=S.props.onMouseUp;S.recordCursorPosition(),Y&&Y.apply(void 0,arguments)},S.onFocus=function(){var Y;S.setState({focused:!0}),(Y=S.props).onFocus.apply(Y,arguments)},S.onBlur=function(){var Y=S.props.onBlur;S.inputting=!1,S.setState({focused:!1});var ie=S.getCurrentValidValue(S.state.inputValue),G=S.setValue(ie,u);if(Y){var j=S.input.value,oe=S.getInputDisplayValue({focus:!1,value:G});S.input.value=oe&&Number(oe),Y.apply(void 0,arguments),S.input.value=j}},S.getRatio=function(Y){var ie=1;return Y.metaKey||Y.ctrlKey?ie=.1:Y.shiftKey&&(ie=10),ie},S.getFullNum=function(Y){return isNaN(Y)?Y:/e/i.test(String(Y))?Number(Y).toFixed(18).replace(/\.?0+$/,""):Y},S.getPrecision=function(Y){if(h(S.props.precision))return S.props.precision;var ie=String(Y);if(ie.indexOf("e-")>=0)return parseInt(ie.slice(ie.indexOf("e-")+2),10);var G=0;return ie.indexOf(".")>=0&&(G=ie.length-ie.indexOf(".")-1),G},S.getInputDisplayValue=function(Y){var ie=Y||S.state,G=ie.focused,j=ie.inputValue,oe=ie.value,ye;G?ye=j:ye=S.toPrecisionAsStep(oe),ye==null&&(ye="");var Ce=S.formatWrapper(ye);return h(S.props.decimalSeparator)&&(Ce=Ce.toString().replace(".",S.props.decimalSeparator)),Ce},S.recordCursorPosition=function(){try{S.cursorStart=S.input.selectionStart,S.cursorEnd=S.input.selectionEnd,S.currentValue=S.input.value,S.cursorBefore=S.input.value.substring(0,S.cursorStart),S.cursorAfter=S.input.value.substring(S.cursorEnd)}catch(Y){}},S.restoreByAfter=function(Y){if(Y===void 0)return!1;var ie=S.input.value,G=ie.lastIndexOf(Y);if(G===-1)return!1;var j=S.cursorBefore.length;return S.lastKeyCode===T.a.DELETE&&S.cursorBefore.charAt(j-1)===Y[0]?(S.fixCaret(j,j),!0):G+Y.length===ie.length?(S.fixCaret(G,G),!0):!1},S.partRestoreByAfter=function(Y){return Y===void 0?!1:Array.prototype.some.call(Y,function(ie,G){var j=Y.substring(G);return S.restoreByAfter(j)})},S.isNotCompleteNumber=function(Y){return isNaN(Y)||Y===""||Y===null||Y&&Y.toString().indexOf(".")===Y.toString().length-1},S.stop=function(){S.autoStepTimer&&clearTimeout(S.autoStepTimer)},S.down=function(Y,ie,G){S.pressingUpOrDown=!0,S.step("down",Y,ie,G)},S.up=function(Y,ie,G){S.pressingUpOrDown=!0,S.step("up",Y,ie,G)},S.saveInput=function(Y){S.input=Y};var I=m.value;I===void 0&&(I=m.defaultValue),S.state={focused:m.autoFocus};var z=S.getValidValue(S.toNumber(I));return S.state=O(O({},S.state),{},{inputValue:S.toPrecisionAsStep(z),value:z}),S}return Object(H.a)(x,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(S){var I=this.props,z=I.value,Y=I.onChange,ie=I.max,G=I.min,j=this.state.focused;if(S){if(!L(S.value,z)||!L(S.max,ie)||!L(S.min,G)){var oe=j?z:this.getValidValue(z),ye;this.pressingUpOrDown?ye=oe:this.inputting?ye=this.rawInput:ye=this.toPrecisionAsStep(oe),this.setState({value:oe,inputValue:ye})}var Ce="value"in this.props?z:this.state.value;"max"in this.props&&S.max!==ie&&typeof Ce=="number"&&Ce>ie&&Y&&Y(ie),"min"in this.props&&S.min!==G&&typeof Ce=="number"&&Ce<G&&Y&&Y(G)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var De=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===T.a.BACKSPACE?De=this.cursorStart-1:this.lastKeyCode===T.a.DELETE&&(De=this.cursorStart):De=this.input.value.length,this.fixCaret(De,De)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case T.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case T.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ye){}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(S){var I=S;return I===""?I="":this.isNotCompleteNumber(parseFloat(I))?I=this.state.value:I=this.getValidValue(I),this.toNumber(I)}},{key:"getValueFromEvent",value:function(S){var I=S.target.value.trim().replace(/。/g,".");return h(this.props.decimalSeparator)&&(I=I.replace(this.props.decimalSeparator,".")),I}},{key:"getValidValue",value:function(S){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,Y=parseFloat(S);return isNaN(Y)?S:(Y<I&&(Y=I),Y>z&&(Y=z),Y)}},{key:"setValue",value:function(S,I){var z=this.props.precision,Y=this.isNotCompleteNumber(parseFloat(S))?null:parseFloat(S),ie=this.state.value,G=ie===void 0?null:ie,j=this.state.inputValue,oe=j===void 0?null:j,ye=typeof Y=="number"?Y.toFixed(z):"".concat(Y),Ce=Y!==G||ye!=="".concat(oe);return"value"in this.props?(oe=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:oe},I)):this.setState({value:Y,inputValue:this.toPrecisionAsStep(S)},I),Ce&&this.props.onChange(Y),Y}},{key:"getMaxPrecision",value:function(S){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,z=this.props,Y=z.precision,ie=z.step;if(h(Y))return Y;var G=this.getPrecision(I),j=this.getPrecision(ie),oe=this.getPrecision(S);return S?Math.max(oe,G+j):G+j}},{key:"getPrecisionFactor",value:function(S){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,z=this.getMaxPrecision(S,I);return Math.pow(10,z)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(S){return this.props.formatter?this.props.formatter(S):S}},{key:"toPrecisionAsStep",value:function(S){if(this.isNotCompleteNumber(S)||S==="")return S;var I=Math.abs(this.getMaxPrecision(S));return isNaN(I)?S.toString():Number(S).toFixed(I)}},{key:"toNumber",value:function(S){var I=this.props.precision,z=this.state.focused,Y=S&&S.length>16&&z;return this.isNotCompleteNumber(S)||Y?S:h(I)?Math.round(S*Math.pow(10,I))/Math.pow(10,I):Number(S)}},{key:"upStep",value:function(S,I){var z=this.props.step,Y=this.getPrecisionFactor(S,I),ie=Math.abs(this.getMaxPrecision(S,I)),G=((Y*S+Y*z*I)/Y).toFixed(ie);return this.toNumber(G)}},{key:"downStep",value:function(S,I){var z=this.props.step,Y=this.getPrecisionFactor(S,I),ie=Math.abs(this.getMaxPrecision(S,I)),G=((Y*S-Y*z*I)/Y).toFixed(ie);return this.toNumber(G)}},{key:"step",value:function(S,I){var z=this,Y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,ie=arguments.length>3?arguments[3]:void 0;this.stop(),I&&(I.persist(),I.preventDefault());var G=this.props;if(G.disabled)return;var j=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(j))return;var oe=this["".concat(S,"Step")](j,Y),ye=oe>G.max||oe<G.min;if(oe>G.max?oe=G.max:oe<G.min&&(oe=G.min),this.setValue(oe,null),this.setState({focused:!0},function(){z.pressingUpOrDown=!1}),ye)return;this.autoStepTimer=setTimeout(function(){z[S](I,Y,!0)},ie?l:b)}},{key:"fixCaret",value:function(S,I){if(S===void 0||I===void 0||!this.input||!this.input.value)return;try{var z=this.input.selectionStart,Y=this.input.selectionEnd;(S!==z||I!==Y)&&this.input.setSelectionRange(S,I)}catch(ie){}}},{key:"render",value:function(){var S,I=this.props,z=I.prefixCls,Y=I.disabled,ie=I.readOnly,G=I.useTouch,j=I.autoComplete,oe=I.upHandler,ye=I.downHandler,Ce=I.className,De=I.max,Ye=I.min,Ie=I.style,Ve=I.title,Ne=I.onMouseEnter,Ue=I.onMouseLeave,Ae=I.onMouseOver,F=I.onMouseOut,A=I.required,D=I.onClick,K=I.tabIndex,J=I.type,U=I.placeholder,me=I.id,Me=I.inputMode,je=I.pattern,Xe=I.step,Be=I.maxLength,He=I.autoFocus,ze=I.name,rt=I.onPaste,it=I.onInput,lt=Object(de.a)(I,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),et=this.state,St=et.value,ut=et.focused,ht=y()(z,(S={},Object(X.a)(S,Ce,!!Ce),Object(X.a)(S,"".concat(z,"-disabled"),Y),Object(X.a)(S,"".concat(z,"-focused"),ut),S)),Fe={};Object.keys(lt).forEach(function(pe){(pe.substr(0,5)==="data-"||pe.substr(0,5)==="aria-"||pe==="role")&&(Fe[pe]=lt[pe])});var bt=!ie&&!Y,mt=this.getInputDisplayValue(null),se=(St||St===0)&&(isNaN(St)||Number(St)>=De),Z=(St||St===0)&&(isNaN(St)||Number(St)<=Ye),Q=se||Y||ie,ae=Z||Y||ie,ue=y()("".concat(z,"-handler"),"".concat(z,"-handler-up"),Object(X.a)({},"".concat(z,"-handler-up-disabled"),Q)),ee=y()("".concat(z,"-handler"),"".concat(z,"-handler-down"),Object(X.a)({},"".concat(z,"-handler-down-disabled"),ae)),ne=G?{onTouchStart:Q?u:this.up,onTouchEnd:this.stop}:{onMouseDown:Q?u:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},he=G?{onTouchStart:ae?u:this.down,onTouchEnd:this.stop}:{onMouseDown:ae?u:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return P.a.createElement("div",{className:ht,style:Ie,title:Ve,onMouseEnter:Ne,onMouseLeave:Ue,onMouseOver:Ae,onMouseOut:F,onFocus:function(){return null},onBlur:function(){return null}},P.a.createElement("div",{className:"".concat(z,"-handler-wrap")},P.a.createElement("span",Object.assign({unselectable:"on"},ne,{role:"button","aria-label":"Increase Value","aria-disabled":Q,className:ue}),oe||P.a.createElement("span",{unselectable:"on",className:"".concat(z,"-handler-up-inner"),onClick:o})),P.a.createElement("span",Object.assign({unselectable:"on"},he,{role:"button","aria-label":"Decrease Value","aria-disabled":ae,className:ee}),ye||P.a.createElement("span",{unselectable:"on",className:"".concat(z,"-handler-down-inner"),onClick:o}))),P.a.createElement("div",{className:"".concat(z,"-input-wrap")},P.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ye,"aria-valuemax":De,"aria-valuenow":St,required:A,type:J,placeholder:U,onPaste:rt,onClick:D,onMouseUp:this.onMouseUp,className:"".concat(z,"-input"),tabIndex:K,autoComplete:j,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:bt?this.onKeyDown:u,onKeyUp:bt?this.onKeyUp:u,autoFocus:He,maxLength:Be,readOnly:ie,disabled:Y,max:De,min:Ye,step:Xe,name:ze,title:Ve,id:me,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(mt),pattern:je,inputMode:Me,onInput:it},Fe))))}}]),x}(P.a.Component);v.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:p,min:-p,step:1,style:{},onChange:u,onKeyDown:u,onPressEnter:u,onFocus:u,onBlur:u,parser:s,required:!1,autoComplete:"off"};var c=v,f=ct.a=c},k3GJ:function(Ot,ct,le){"use strict";le.d(ct,"a",function(){return bo});var de=le("rePB"),X=le("ODXe"),k=le("Ff2n"),H=le("VTBJ"),C=le("q1tI"),M=le("TSYQ"),W=le.n(M),B=le("Zm9Q"),P=le("6cGi"),R=le("KQm4"),y=le("xEkU"),T=le.n(y),_=le("t23M");function O(fe){var Te=Object(C.useRef)(),Le=Object(C.useRef)(!1);function ge(){for(var q=arguments.length,ce=new Array(q),re=0;re<q;re++)ce[re]=arguments[re];Le.current||(T.a.cancel(Te.current),Te.current=T()(function(){fe.apply(void 0,ce)}))}return Object(C.useEffect)(function(){return function(){Le.current=!0,T.a.cancel(Te.current)}},[]),ge}function w(fe){var Te=Object(C.useRef)([]),Le=Object(C.useState)({}),ge=Object(X.a)(Le,2),q=ge[1],ce=Object(C.useRef)(typeof fe=="function"?fe():fe),re=O(function(){var xe=ce.current;Te.current.forEach(function(Oe){xe=Oe(xe)}),Te.current=[],ce.current=xe,q({})});function be(xe){Te.current.push(xe),re()}return[ce.current,be]}var g=le("4IlW");function u(fe,Te){var Le,ge=fe.prefixCls,q=fe.id,ce=fe.active,re=fe.rtl,be=fe.tab,xe=be.key,Oe=be.tab,we=be.disabled,Re=be.closeIcon,Ke=fe.tabBarGutter,Je=fe.tabPosition,Ze=fe.closable,at=fe.renderWrapper,Dt=fe.removeAriaLabel,Ht=fe.editable,Ut=fe.onClick,Bt=fe.onRemove,Kt=fe.onFocus,jt="".concat(ge,"-tab");C.useEffect(function(){return Bt},[]);var Ft={};Je==="top"||Je==="bottom"?Ft[re?"marginLeft":"marginRight"]=Ke:Ft.marginBottom=Ke;var er=Ht&&Ze!==!1&&!we;function Yt(Lt){if(we)return;Ut(Lt)}function Cr(Lt){Lt.preventDefault(),Lt.stopPropagation(),Ht.onEdit("remove",{key:xe,event:Lt})}var $t=C.createElement("div",{key:xe,ref:Te,className:W()(jt,(Le={},Object(de.a)(Le,"".concat(jt,"-with-remove"),er),Object(de.a)(Le,"".concat(jt,"-active"),ce),Object(de.a)(Le,"".concat(jt,"-disabled"),we),Le)),style:Ft,onClick:Yt},C.createElement("div",{role:"tab","aria-selected":ce,id:q&&"".concat(q,"-tab-").concat(xe),className:"".concat(jt,"-btn"),"aria-controls":q&&"".concat(q,"-panel-").concat(xe),"aria-disabled":we,tabIndex:we?null:0,onClick:function(wt){wt.stopPropagation(),Yt(wt)},onKeyDown:function(wt){[g.a.SPACE,g.a.ENTER].includes(wt.which)&&(wt.preventDefault(),Yt(wt))},onFocus:Kt},Oe),er&&C.createElement("button",{type:"button","aria-label":Dt||"remove",tabIndex:0,className:"".concat(jt,"-remove"),onClick:function(wt){wt.stopPropagation(),Cr(wt)}},Re||Ht.removeIcon||"\xD7"));return at&&($t=at($t)),$t}var o=C.forwardRef(u),s={width:0,height:0,left:0,top:0};function l(fe,Te,Le){return Object(C.useMemo)(function(){for(var ge,q=new Map,ce=Te.get((ge=fe[0])===null||ge===void 0?void 0:ge.key)||s,re=ce.left+ce.width,be=0;be<fe.length;be+=1){var xe=fe[be].key,Oe=Te.get(xe);if(!Oe){var we;Oe=Te.get((we=fe[be-1])===null||we===void 0?void 0:we.key)||s}var Re=q.get(xe)||Object(H.a)({},Oe);Re.right=re-Re.left-Re.width,q.set(xe,Re)}return q},[fe.map(function(ge){return ge.key}).join("_"),Te,Le])}var b={width:0,height:0,left:0,top:0,right:0};function p(fe,Te,Le,ge,q){var ce=q.tabs,re=q.tabPosition,be=q.rtl,xe,Oe,we;["top","bottom"].includes(re)?(xe="width",Oe=be?"right":"left",we=Math.abs(Te.left)):(xe="height",Oe="top",we=-Te.top);var Re=Te[xe],Ke=Le[xe],Je=ge[xe],Ze=Re;return Ke+Je>Re&&(Ze=Re-Je),Object(C.useMemo)(function(){if(!ce.length)return[0,0];for(var at=ce.length,Dt=at,Ht=0;Ht<at;Ht+=1){var Ut=fe.get(ce[Ht].key)||b;if(Ut[Oe]+Ut[xe]>we+Ze){Dt=Ht-1;break}}for(var Bt=0,Kt=at-1;Kt>=0;Kt-=1){var jt=fe.get(ce[Kt].key)||b;if(jt[Oe]<we){Bt=Kt+1;break}}return[Bt,Dt]},[fe,we,Ze,re,ce.map(function(at){return at.key}).join("_"),be])}var h=le("wx14"),L=le("1OyB"),v=le("vuIU"),c=le("JX7q"),f=le("Ji7U"),d=le("LK+K"),a=le("I8Z2"),x=le("bT9E"),m=le("2GS6"),S=le("Gytx"),I=le.n(S),z=le("U8pU"),Y=/iPhone/i,ie=/iPod/i,G=/iPad/i,j=/\bAndroid(?:.+)Mobile\b/i,oe=/Android/i,ye=/\bAndroid(?:.+)SD4930UR\b/i,Ce=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,De=/Windows Phone/i,Ye=/\bWindows(?:.+)ARM\b/i,Ie=/BlackBerry/i,Ve=/BB10/i,Ne=/Opera Mini/i,Ue=/\b(CriOS|Chrome)(?:.+)Mobile/i,Ae=/Mobile(?:.+)Firefox\b/i;function F(fe,Te){return fe.test(Te)}function A(fe){var Te=fe||(typeof navigator!="undefined"?navigator.userAgent:""),Le=(Te||"").split("[FBAN");if(typeof Le[1]!="undefined"){var ge=Le,q=Object(X.a)(ge,1);Te=q[0]}if(Le=Te.split("Twitter"),typeof Le[1]!="undefined"){var ce=Le,re=Object(X.a)(ce,1);Te=re[0]}var be={apple:{phone:F(Y,Te)&&!F(De,Te),ipod:F(ie,Te),tablet:!F(Y,Te)&&F(G,Te)&&!F(De,Te),device:(F(Y,Te)||F(ie,Te)||F(G,Te))&&!F(De,Te)},amazon:{phone:F(ye,Te),tablet:!F(ye,Te)&&F(Ce,Te),device:F(ye,Te)||F(Ce,Te)},android:{phone:!F(De,Te)&&F(ye,Te)||!F(De,Te)&&F(j,Te),tablet:!F(De,Te)&&!F(ye,Te)&&!F(j,Te)&&(F(Ce,Te)||F(oe,Te)),device:!F(De,Te)&&(F(ye,Te)||F(Ce,Te)||F(j,Te)||F(oe,Te))||F(/\bokhttp\b/i,Te)},windows:{phone:F(De,Te),tablet:F(Ye,Te),device:F(De,Te)||F(Ye,Te)},other:{blackberry:F(Ie,Te),blackberry10:F(Ve,Te),opera:F(Ne,Te),firefox:F(Ae,Te),chrome:F(Ue,Te),device:F(Ie,Te)||F(Ve,Te)||F(Ne,Te)||F(Ae,Te)||F(Ue,Te)},any:null,phone:null,tablet:null};return be.any=be.apple.device||be.android.device||be.windows.device||be.other.device,be.phone=be.apple.phone||be.android.phone||be.windows.phone,be.tablet=be.apple.tablet||be.android.tablet||be.windows.tablet,be}var D=Object(H.a)(Object(H.a)({},A()),{},{isMobile:A}),K=D;function J(){}function U(fe,Te,Le){var ge=Te||"";return fe.key||"".concat(ge,"item_").concat(Le)}function me(fe){return"".concat(fe,"-menu-")}function Me(fe,Te){var Le=-1;C.Children.forEach(fe,function(ge){Le+=1,ge&&ge.type&&ge.type.isMenuItemGroup?C.Children.forEach(ge.props.children,function(q){Le+=1,Te(q,Le)}):Te(ge,Le)})}function je(fe,Te,Le){if(!fe||Le.find)return;C.Children.forEach(fe,function(ge){if(ge){var q=ge.type;if(!q||!(q.isSubMenu||q.isMenuItem||q.isMenuItemGroup))return;Te.indexOf(ge.key)!==-1?Le.find=!0:ge.props.children&&je(ge.props.children,Te,Le)}})}var Xe=["defaultSelectedKeys","selectedKeys","defaultOpenKeys","openKeys","mode","getPopupContainer","onSelect","onDeselect","onDestroy","openTransitionName","openAnimation","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","triggerSubMenuAction","level","selectable","multiple","onOpenChange","visible","focusable","defaultActiveFirst","prefixCls","inlineIndent","parentMenu","title","rootPrefixCls","eventKey","active","onItemHover","onTitleMouseEnter","onTitleMouseLeave","onTitleClick","popupAlign","popupOffset","isOpen","renderMenuItem","manualRef","subMenuKey","disabled","index","isSelected","store","activeKey","builtinPlacements","overflowedIndicator","motion","attribute","value","popupClassName","inlineCollapsed","menu","theme","itemIcon","expandIcon"],Be=function(Te){var Le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ge=Te&&typeof Te.getBoundingClientRect=="function"&&Te.getBoundingClientRect().width;if(ge){if(Le){var q=getComputedStyle(Te),ce=q.marginLeft,re=q.marginRight;ge+=+ce.replace("px","")+ +re.replace("px","")}ge=+ge.toFixed(6)}return ge||0},He=function(Te,Le,ge){Te&&Object(z.a)(Te.style)==="object"&&(Te.style[Le]=ge)},ze=function(){return K.any},rt=le("bdgK"),it=le("i8i4"),lt=le.n(it),et=le("wgJM"),St=le("l4aY"),ut=le("m+aA"),ht=le("c+Xe"),Fe=le("zT1h"),bt=le("QC+M");function mt(fe,Te,Le){return Le?fe[0]===Te[0]:fe[0]===Te[0]&&fe[1]===Te[1]}function se(fe,Te,Le){var ge=fe[Te]||{};return Object(H.a)(Object(H.a)({},ge),Le)}function Z(fe,Te,Le,ge){for(var q=Le.points,ce=Object.keys(fe),re=0;re<ce.length;re+=1){var be=ce[re];if(mt(fe[be].points,q,ge))return"".concat(Te,"-placement-").concat(be)}return""}var Q=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var fe=navigator.userAgent||navigator.vendor||window.opera;return!!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(fe)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(fe==null?void 0:fe.substr(0,4)))},ae=le("MNnm");function ue(fe,Te){var Le={};return Le[fe.toLowerCase()]=Te.toLowerCase(),Le["Webkit".concat(fe)]="webkit".concat(Te),Le["Moz".concat(fe)]="moz".concat(Te),Le["ms".concat(fe)]="MS".concat(Te),Le["O".concat(fe)]="o".concat(Te.toLowerCase()),Le}function ee(fe,Te){var Le={animationend:ue("Animation","AnimationEnd"),transitionend:ue("Transition","TransitionEnd")};return fe&&("AnimationEvent"in Te||delete Le.animationend.animation,"TransitionEvent"in Te||delete Le.transitionend.transition),Le}var ne=ee(Object(ae.a)(),typeof window!="undefined"?window:{}),he={};if(Object(ae.a)()){var pe=document.createElement("div");he=pe.style}var Ee={};function ke(fe){if(Ee[fe])return Ee[fe];var Te=ne[fe];if(Te)for(var Le=Object.keys(Te),ge=Le.length,q=0;q<ge;q+=1){var ce=Le[q];if(Object.prototype.hasOwnProperty.call(Te,ce)&&ce in he)return Ee[fe]=Te[ce],Ee[fe]}return""}var We=ke("animationend"),qe=ke("transitionend"),ft=!!(We&&qe),gt=We||"animationend",Wt=qe||"transitionend";function Ct(fe,Te){if(!fe)return null;if(Object(z.a)(fe)==="object"){var Le=Te.replace(/-\w/g,function(ge){return ge[1].toUpperCase()});return fe[Le]}return"".concat(fe,"-").concat(Te)}var vt="none",ir="appear",zt="enter",br="leave",vr="none",It="prepare",Wr="start",en="active",Ir="end";function an(fe){var Te=Object(C.useRef)(!1),Le=Object(C.useState)(fe),ge=Object(X.a)(Le,2),q=ge[0],ce=ge[1];function re(be){Te.current||ce(be)}return Object(C.useEffect)(function(){return function(){Te.current=!0}},[]),[q,re]}var un=Object(ae.a)()?C.useLayoutEffect:C.useEffect,Kn=un,Hr=function(){var fe=C.useRef(null);function Te(){et.a.cancel(fe.current)}function Le(ge){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;Te();var ce=Object(et.a)(function(){q<=1?ge({isCanceled:function(){return ce!==fe.current}}):Le(ge,q-1)});fe.current=ce}return C.useEffect(function(){return function(){Te()}},[]),[Le,Te]},Bn=[It,Wr,en,Ir],ei=!1,Sr=!0;function dt(fe){return fe===en||fe===Ir}var Jt=function(fe,Te){var Le=C.useState(vr),ge=Object(X.a)(Le,2),q=ge[0],ce=ge[1],re=Hr(),be=Object(X.a)(re,2),xe=be[0],Oe=be[1];function we(){ce(It)}return Kn(function(){if(q!==vr&&q!==Ir){var Re=Bn.indexOf(q),Ke=Bn[Re+1],Je=Te(q);Je===ei?ce(Ke):xe(function(Ze){function at(){if(Ze.isCanceled())return;ce(Ke)}Je===!0?at():Promise.resolve(Je).then(at)})}},[fe,q]),C.useEffect(function(){return function(){Oe()}},[]),[we,q]},Kr=function(fe){var Te=Object(C.useRef)(),Le=Object(C.useRef)(fe);Le.current=fe;var ge=C.useCallback(function(re){Le.current(re)},[]);function q(re){re&&(re.removeEventListener(Wt,ge),re.removeEventListener(gt,ge))}function ce(re){Te.current&&Te.current!==re&&q(Te.current),re&&re!==Te.current&&(re.addEventListener(Wt,ge),re.addEventListener(gt,ge),Te.current=re)}return C.useEffect(function(){return function(){q(Te.current)}},[]),[ce,q]};function Nt(fe,Te,Le,ge){var q=ge.motionEnter,ce=q===void 0?!0:q,re=ge.motionAppear,be=re===void 0?!0:re,xe=ge.motionLeave,Oe=xe===void 0?!0:xe,we=ge.motionDeadline,Re=ge.motionLeaveImmediately,Ke=ge.onAppearPrepare,Je=ge.onEnterPrepare,Ze=ge.onLeavePrepare,at=ge.onAppearStart,Dt=ge.onEnterStart,Ht=ge.onLeaveStart,Ut=ge.onAppearActive,Bt=ge.onEnterActive,Kt=ge.onLeaveActive,jt=ge.onAppearEnd,Ft=ge.onEnterEnd,er=ge.onLeaveEnd,Yt=ge.onVisibleChanged,Cr=an(),$t=Object(X.a)(Cr,2),Lt=$t[0],wt=$t[1],Qt=an(vt),tr=Object(X.a)(Qt,2),xt=tr[0],nr=tr[1],Tr=an(null),ar=Object(X.a)(Tr,2),pr=ar[0],hr=ar[1],Rr=Object(C.useRef)(!1),zr=Object(C.useRef)(null),Ar=Object(C.useRef)(!1),on=Object(C.useRef)(null);function Rn(){var yr=Le();return yr||on.current}var hn=Object(C.useRef)(!1);function Gr(yr){var cr=Rn();if(yr&&!yr.deadline&&yr.target!==cr)return;var Vr;xt===ir&&hn.current?Vr=jt==null?void 0:jt(cr,yr):xt===zt&&hn.current?Vr=Ft==null?void 0:Ft(cr,yr):xt===br&&hn.current&&(Vr=er==null?void 0:er(cr,yr)),Vr!==!1&&!Ar.current&&(nr(vt),hr(null))}var xr=Kr(Gr),mr=Object(X.a)(xr,1),Lr=mr[0],wr=C.useMemo(function(){var yr,cr,Vr;switch(xt){case"appear":return yr={},Object(de.a)(yr,It,Ke),Object(de.a)(yr,Wr,at),Object(de.a)(yr,en,Ut),yr;case"enter":return cr={},Object(de.a)(cr,It,Je),Object(de.a)(cr,Wr,Dt),Object(de.a)(cr,en,Bt),cr;case"leave":return Vr={},Object(de.a)(Vr,It,Ze),Object(de.a)(Vr,Wr,Ht),Object(de.a)(Vr,en,Kt),Vr;default:return{}}},[xt]),Pn=Jt(xt,function(yr){if(yr===It){var cr=wr[It];return cr?cr(Rn()):ei}if(fr in wr){var Vr;hr(((Vr=wr[fr])===null||Vr===void 0?void 0:Vr.call(wr,Rn(),null))||null)}return fr===en&&(Lr(Rn()),we>0&&(clearTimeout(zr.current),zr.current=setTimeout(function(){Gr({deadline:!0})},we))),Sr}),ai=Object(X.a)(Pn,2),oi=ai[0],fr=ai[1],Hn=dt(fr);hn.current=Hn,Kn(function(){wt(Te);var yr=Rr.current;if(Rr.current=!0,!fe)return;var cr;!yr&&Te&&be&&(cr=ir),yr&&Te&&ce&&(cr=zt),(yr&&!Te&&Oe||!yr&&Re&&!Te&&Oe)&&(cr=br),cr&&(nr(cr),oi())},[Te]),Object(C.useEffect)(function(){(xt===ir&&!be||xt===zt&&!ce||xt===br&&!Oe)&&nr(vt)},[be,ce,Oe]),Object(C.useEffect)(function(){return function(){clearTimeout(zr.current),Ar.current=!0}},[]),Object(C.useEffect)(function(){Lt!==void 0&&xt===vt&&(Yt==null||Yt(Lt))},[Lt,xt]);var si=pr;return wr[It]&&fr===Wr&&(si=Object(H.a)({transition:"none"},si)),[xt,fr,si,Lt!=null?Lt:Te]}var Pt=function(fe){Object(f.a)(Le,fe);var Te=Object(d.a)(Le);function Le(){return Object(L.a)(this,Le),Te.apply(this,arguments)}return Object(v.a)(Le,[{key:"render",value:function(){return this.props.children}}]),Le}(C.Component),or=Pt;function vn(fe){var Te=fe;Object(z.a)(fe)==="object"&&(Te=fe.transitionSupport);function Le(q){return!!(q.motionName&&Te)}var ge=C.forwardRef(function(q,ce){var re=q.visible,be=re===void 0?!0:re,xe=q.removeOnLeave,Oe=xe===void 0?!0:xe,we=q.forceRender,Re=q.children,Ke=q.motionName,Je=q.leavedClassName,Ze=q.eventProps,at=Le(q),Dt=Object(C.useRef)(),Ht=Object(C.useRef)();function Ut(){try{return Object(ut.a)(Dt.current||Ht.current)}catch(nr){return null}}var Bt=Nt(at,be,Ut,q),Kt=Object(X.a)(Bt,4),jt=Kt[0],Ft=Kt[1],er=Kt[2],Yt=Kt[3],Cr=C.useRef(Yt);Yt&&(Cr.current=!0);var $t=Object(C.useRef)(ce);$t.current=ce;var Lt=C.useCallback(function(nr){Dt.current=nr,Object(ht.b)($t.current,nr)},[]),wt,Qt=Object(H.a)(Object(H.a)({},Ze),{},{visible:be});if(!Re)wt=null;else if(jt===vt||!Le(q))Yt?wt=Re(Object(H.a)({},Qt),Lt):!Oe&&Cr.current?wt=Re(Object(H.a)(Object(H.a)({},Qt),{},{className:Je}),Lt):we?wt=Re(Object(H.a)(Object(H.a)({},Qt),{},{style:{display:"none"}}),Lt):wt=null;else{var tr,xt;Ft===It?xt="prepare":dt(Ft)?xt="active":Ft===Wr&&(xt="start"),wt=Re(Object(H.a)(Object(H.a)({},Qt),{},{className:W()(Ct(Ke,jt),(tr={},Object(de.a)(tr,Ct(Ke,"".concat(jt,"-").concat(xt)),xt),Object(de.a)(tr,Ke,typeof Ke=="string"),tr)),style:er}),Lt)}return C.createElement(or,{ref:Ht},wt)});return ge.displayName="CSSMotion",ge}var kr=vn(ft),Qe="add",kt="keep",zn="remove",fi="removed";function wi(fe){var Te;return fe&&Object(z.a)(fe)==="object"&&"key"in fe?Te=fe:Te={key:fe},Object(H.a)(Object(H.a)({},Te),{},{key:String(Te.key)})}function Gn(){var fe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return fe.map(wi)}function Ai(){var fe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],Le=[],ge=0,q=Te.length,ce=Gn(fe),re=Gn(Te);ce.forEach(function(Oe){for(var we=!1,Re=ge;Re<q;Re+=1){var Ke=re[Re];if(Ke.key===Oe.key){ge<Re&&(Le=Le.concat(re.slice(ge,Re).map(function(Je){return Object(H.a)(Object(H.a)({},Je),{},{status:Qe})})),ge=Re),Le.push(Object(H.a)(Object(H.a)({},Ke),{},{status:kt})),ge+=1,we=!0;break}}we||Le.push(Object(H.a)(Object(H.a)({},Oe),{},{status:zn}))}),ge<q&&(Le=Le.concat(re.slice(ge).map(function(Oe){return Object(H.a)(Object(H.a)({},Oe),{},{status:Qe})})));var be={};Le.forEach(function(Oe){var we=Oe.key;be[we]=(be[we]||0)+1});var xe=Object.keys(be).filter(function(Oe){return be[Oe]>1});return xe.forEach(function(Oe){Le=Le.filter(function(we){var Re=we.key,Ke=we.status;return Re!==Oe||Ke!==zn}),Le.forEach(function(we){we.key===Oe&&(we.status=kt)})}),Le}var Rt=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function la(fe){var Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:kr,Le=function(ge){Object(f.a)(ce,ge);var q=Object(d.a)(ce);function ce(){var re;return Object(L.a)(this,ce),re=q.apply(this,arguments),re.state={keyEntities:[]},re.removeKey=function(be){re.setState(function(xe){var Oe=xe.keyEntities;return{keyEntities:Oe.map(function(we){return we.key!==be?we:Object(H.a)(Object(H.a)({},we),{},{status:fi})})}})},re}return Object(v.a)(ce,[{key:"render",value:function(){var be=this,xe=this.state.keyEntities,Oe=this.props,we=Oe.component,Re=Oe.children,Ke=Oe.onVisibleChanged,Je=Object(k.a)(Oe,["component","children","onVisibleChanged"]),Ze=we||C.Fragment,at={};return Rt.forEach(function(Dt){at[Dt]=Je[Dt],delete Je[Dt]}),delete Je.keys,C.createElement(Ze,Je,xe.map(function(Dt){var Ht=Dt.status,Ut=Object(k.a)(Dt,["status"]),Bt=Ht===Qe||Ht===kt;return C.createElement(Te,Object(h.a)({},at,{key:Ut.key,visible:Bt,eventProps:Ut,onVisibleChanged:function(jt){Ke==null||Ke(jt,{key:Ut.key}),jt||be.removeKey(Ut.key)}}),Re)}))}}],[{key:"getDerivedStateFromProps",value:function(be,xe){var Oe=be.keys,we=xe.keyEntities,Re=Gn(Oe),Ke=Ai(we,Re);return{keyEntities:Ke.filter(function(Je){var Ze=we.find(function(at){var Dt=at.key;return Je.key===Dt});return!(Ze&&Ze.status===fi&&Je.status===zn)})}}}]),ce}(C.Component);return Le.defaultProps={component:"div"},Le}var tt=la(ft),Vn=kr;function yn(fe){var Te=fe.prefixCls,Le=fe.motion,ge=fe.animation,q=fe.transitionName;return Le||(ge?{motionName:"".concat(Te,"-").concat(ge)}:q?{motionName:q}:null)}function Ki(fe){var Te=fe.prefixCls,Le=fe.visible,ge=fe.zIndex,q=fe.mask,ce=fe.maskMotion,re=fe.maskAnimation,be=fe.maskTransitionName;if(!q)return null;var xe={};return(ce||be||re)&&(xe=Object(H.a)({motionAppear:!0},yn({motion:ce,prefixCls:Te,transitionName:be,animation:re}))),C.createElement(Vn,Object(h.a)({},xe,{visible:Le,removeOnLeave:!0}),function(Oe){var we=Oe.className;return C.createElement("div",{style:{zIndex:ge},className:W()("".concat(Te,"-mask"),we)})})}var pi=le("9mu1"),Dn=le("o0o1"),Li=le.n(Dn),zi=le("HaE+"),An=["measure","align",null,"motion"],Gi=function(fe,Te){var Le=Object(C.useState)(null),ge=Object(X.a)(Le,2),q=ge[0],ce=ge[1],re=Object(C.useRef)(),be=Object(C.useRef)(!1);function xe(Re){be.current||ce(Re)}function Oe(){et.a.cancel(re.current)}function we(Re){Oe(),re.current=Object(et.a)(function(){xe(function(Ke){switch(q){case"align":return"motion";case"motion":return"stable";default:}return Ke}),Re==null||Re()})}return Object(C.useEffect)(function(){xe("measure")},[fe]),Object(C.useEffect)(function(){switch(q){case"measure":Te();break;default:}q&&(re.current=Object(et.a)(Object(zi.a)(Li.a.mark(function Re(){var Ke,Je;return Li.a.wrap(function(at){for(;;)switch(at.prev=at.next){case 0:Ke=An.indexOf(q),Je=An[Ke+1],Je&&Ke!==-1&&xe(Je);case 3:case"end":return at.stop()}},Re)}))))},[q]),Object(C.useEffect)(function(){return function(){be.current=!0,Oe()}},[]),[q,we]},ua=function(fe){var Te=C.useState({width:0,height:0}),Le=Object(X.a)(Te,2),ge=Le[0],q=Le[1];function ce(be){q({width:be.offsetWidth,height:be.offsetHeight})}var re=C.useMemo(function(){var be={};if(fe){var xe=ge.width,Oe=ge.height;fe.indexOf("height")!==-1&&Oe?be.height=Oe:fe.indexOf("minHeight")!==-1&&Oe&&(be.minHeight=Oe),fe.indexOf("width")!==-1&&xe?be.width=xe:fe.indexOf("minWidth")!==-1&&xe&&(be.minWidth=xe)}return be},[fe,ge]);return[re,ce]},Oi=C.forwardRef(function(fe,Te){var Le=fe.visible,ge=fe.prefixCls,q=fe.className,ce=fe.style,re=fe.children,be=fe.zIndex,xe=fe.stretch,Oe=fe.destroyPopupOnHide,we=fe.forceRender,Re=fe.align,Ke=fe.point,Je=fe.getRootDomNode,Ze=fe.getClassNameFromAlign,at=fe.onAlign,Dt=fe.onMouseEnter,Ht=fe.onMouseLeave,Ut=fe.onMouseDown,Bt=fe.onTouchStart,Kt=Object(C.useRef)(),jt=Object(C.useRef)(),Ft=Object(C.useState)(),er=Object(X.a)(Ft,2),Yt=er[0],Cr=er[1],$t=ua(xe),Lt=Object(X.a)($t,2),wt=Lt[0],Qt=Lt[1];function tr(){xe&&Qt(Je())}var xt=Gi(Le,tr),nr=Object(X.a)(xt,2),Tr=nr[0],ar=nr[1],pr=Object(C.useRef)();function hr(){return Ke||Je}function Rr(){var xr;(xr=Kt.current)===null||xr===void 0||xr.forceAlign()}function zr(xr,mr){var Lr=Ze(mr);Yt!==Lr&&Cr(Lr),Tr==="align"&&(Yt!==Lr?Promise.resolve().then(function(){Rr()}):ar(function(){var wr;(wr=pr.current)===null||wr===void 0||wr.call(pr)}),at==null||at(xr,mr))}var Ar=Object(H.a)({},yn(fe));["onAppearEnd","onEnterEnd","onLeaveEnd"].forEach(function(xr){var mr=Ar[xr];Ar[xr]=function(Lr,wr){return ar(),mr==null?void 0:mr(Lr,wr)}});function on(){return new Promise(function(xr){pr.current=xr})}C.useEffect(function(){!Ar.motionName&&Tr==="motion"&&ar()},[Ar.motionName,Tr]),C.useImperativeHandle(Te,function(){return{forceAlign:Rr,getElement:function(){return jt.current}}});var Rn=Object(H.a)(Object(H.a)({},wt),{},{zIndex:be,opacity:Tr==="motion"||Tr==="stable"||!Le?void 0:0,pointerEvents:Tr==="stable"?void 0:"none"},ce),hn=!0;(Re==null?void 0:Re.points)&&(Tr==="align"||Tr==="stable")&&(hn=!1);var Gr=re;return C.Children.count(re)>1&&(Gr=C.createElement("div",{className:"".concat(ge,"-content")},re)),C.createElement(Vn,Object(h.a)({visible:Le,ref:jt,leavedClassName:"".concat(ge,"-hidden")},Ar,{onAppearPrepare:on,onEnterPrepare:on,removeOnLeave:Oe,forceRender:we}),function(xr,mr){var Lr=xr.className,wr=xr.style,Pn=W()(ge,q,Yt,Lr);return C.createElement(pi.a,{target:hr(),key:"popup",ref:Kt,monitorWindowResize:!0,disabled:hn,align:Re,onAlign:zr},C.createElement("div",{ref:mr,className:Pn,onMouseEnter:Dt,onMouseLeave:Ht,onMouseDownCapture:Ut,onTouchStartCapture:Bt,style:Object(H.a)(Object(H.a)({},wr),Rn)},Gr))})});Oi.displayName="PopupInner";var Mn=Oi,Vi=C.forwardRef(function(fe,Te){var Le=fe.prefixCls,ge=fe.visible,q=fe.zIndex,ce=fe.children,re=fe.mobile;re=re===void 0?{}:re;var be=re.popupClassName,xe=re.popupStyle,Oe=re.popupMotion,we=Oe===void 0?{}:Oe,Re=re.popupRender,Ke=C.useRef();C.useImperativeHandle(Te,function(){return{forceAlign:function(){},getElement:function(){return Ke.current}}});var Je=Object(H.a)({zIndex:q},xe),Ze=ce;return C.Children.count(ce)>1&&(Ze=C.createElement("div",{className:"".concat(Le,"-content")},ce)),Re&&(Ze=Re(Ze)),C.createElement(Vn,Object(h.a)({visible:ge,ref:Ke,removeOnLeave:!0},we),function(at,Dt){var Ht=at.className,Ut=at.style,Bt=W()(Le,be,Ht);return C.createElement("div",{ref:Dt,className:Bt,style:Object(H.a)(Object(H.a)({},Ut),Je)},Ze)})});Vi.displayName="MobilePopupInner";var Pa=Vi,Xi=["visible","mobile"],Qr=C.forwardRef(function(fe,Te){var Le=fe.visible,ge=fe.mobile,q=Object(k.a)(fe,Xi),ce=Object(C.useState)(Le),re=Object(X.a)(ce,2),be=re[0],xe=re[1],Oe=Object(C.useState)(!1),we=Object(X.a)(Oe,2),Re=we[0],Ke=we[1],Je=Object(H.a)(Object(H.a)({},q),{},{visible:be});Object(C.useEffect)(function(){xe(Le),Le&&ge&&Ke(Q())},[Le,ge]);var Ze=Re?C.createElement(Pa,Object(h.a)({},Je,{mobile:ge,ref:Te})):C.createElement(Mn,Object(h.a)({},Je,{ref:Te}));return C.createElement("div",null,C.createElement(Ki,Je),Ze)});Qr.displayName="Popup";var ti=Qr,Ia=C.createContext(null),ri=Ia;function bn(){}function Yi(){return""}function Na(fe){return fe?fe.ownerDocument:window.document}var da=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];function ca(fe){var Te=function(Le){Object(f.a)(q,Le);var ge=Object(d.a)(q);function q(ce){var re;Object(L.a)(this,q),re=ge.call(this,ce),re.popupRef=C.createRef(),re.triggerRef=C.createRef(),re.attachId=void 0,re.clickOutsideHandler=void 0,re.touchOutsideHandler=void 0,re.contextMenuOutsideHandler1=void 0,re.contextMenuOutsideHandler2=void 0,re.mouseDownTimeout=void 0,re.focusTime=void 0,re.preClickTime=void 0,re.preTouchTime=void 0,re.delayTimer=void 0,re.hasPopupMouseDown=void 0,re.onMouseEnter=function(xe){var Oe=re.props.mouseEnterDelay;re.fireEvents("onMouseEnter",xe),re.delaySetPopupVisible(!0,Oe,Oe?null:xe)},re.onMouseMove=function(xe){re.fireEvents("onMouseMove",xe),re.setPoint(xe)},re.onMouseLeave=function(xe){re.fireEvents("onMouseLeave",xe),re.delaySetPopupVisible(!1,re.props.mouseLeaveDelay)},re.onPopupMouseEnter=function(){re.clearDelayTimer()},re.onPopupMouseLeave=function(xe){var Oe;if(xe.relatedTarget&&!xe.relatedTarget.setTimeout&&Object(St.a)((Oe=re.popupRef.current)===null||Oe===void 0?void 0:Oe.getElement(),xe.relatedTarget))return;re.delaySetPopupVisible(!1,re.props.mouseLeaveDelay)},re.onFocus=function(xe){re.fireEvents("onFocus",xe),re.clearDelayTimer(),re.isFocusToShow()&&(re.focusTime=Date.now(),re.delaySetPopupVisible(!0,re.props.focusDelay))},re.onMouseDown=function(xe){re.fireEvents("onMouseDown",xe),re.preClickTime=Date.now()},re.onTouchStart=function(xe){re.fireEvents("onTouchStart",xe),re.preTouchTime=Date.now()},re.onBlur=function(xe){re.fireEvents("onBlur",xe),re.clearDelayTimer(),re.isBlurToHide()&&re.delaySetPopupVisible(!1,re.props.blurDelay)},re.onContextMenu=function(xe){xe.preventDefault(),re.fireEvents("onContextMenu",xe),re.setPopupVisible(!0,xe)},re.onContextMenuClose=function(){re.isContextMenuToShow()&&re.close()},re.onClick=function(xe){if(re.fireEvents("onClick",xe),re.focusTime){var Oe;if(re.preClickTime&&re.preTouchTime?Oe=Math.min(re.preClickTime,re.preTouchTime):re.preClickTime?Oe=re.preClickTime:re.preTouchTime&&(Oe=re.preTouchTime),Math.abs(Oe-re.focusTime)<20)return;re.focusTime=0}re.preClickTime=0,re.preTouchTime=0,re.isClickToShow()&&(re.isClickToHide()||re.isBlurToHide())&&xe&&xe.preventDefault&&xe.preventDefault();var we=!re.state.popupVisible;(re.isClickToHide()&&!we||we&&re.isClickToShow())&&re.setPopupVisible(!re.state.popupVisible,xe)},re.onPopupMouseDown=function(){if(re.hasPopupMouseDown=!0,clearTimeout(re.mouseDownTimeout),re.mouseDownTimeout=window.setTimeout(function(){re.hasPopupMouseDown=!1},0),re.context){var xe;(xe=re.context).onPopupMouseDown.apply(xe,arguments)}},re.onDocumentClick=function(xe){if(re.props.mask&&!re.props.maskClosable)return;var Oe=xe.target,we=re.getRootDomNode(),Re=re.getPopupDomNode();(!Object(St.a)(we,Oe)||re.isContextMenuOnly())&&!Object(St.a)(Re,Oe)&&!re.hasPopupMouseDown&&re.close()},re.getRootDomNode=function(){var xe=re.props.getTriggerDOMNode;if(xe)return xe(re.triggerRef.current);try{var Oe=Object(ut.a)(re.triggerRef.current);if(Oe)return Oe}catch(we){}return lt.a.findDOMNode(Object(c.a)(re))},re.getPopupClassNameFromAlign=function(xe){var Oe=[],we=re.props,Re=we.popupPlacement,Ke=we.builtinPlacements,Je=we.prefixCls,Ze=we.alignPoint,at=we.getPopupClassNameFromAlign;return Re&&Ke&&Oe.push(Z(Ke,Je,xe,Ze)),at&&Oe.push(at(xe)),Oe.join(" ")},re.getComponent=function(){var xe=re.props,Oe=xe.prefixCls,we=xe.destroyPopupOnHide,Re=xe.popupClassName,Ke=xe.onPopupAlign,Je=xe.popupMotion,Ze=xe.popupAnimation,at=xe.popupTransitionName,Dt=xe.popupStyle,Ht=xe.mask,Ut=xe.maskAnimation,Bt=xe.maskTransitionName,Kt=xe.maskMotion,jt=xe.zIndex,Ft=xe.popup,er=xe.stretch,Yt=xe.alignPoint,Cr=xe.mobile,$t=xe.forceRender,Lt=re.state,wt=Lt.popupVisible,Qt=Lt.point,tr=re.getPopupAlign(),xt={};return re.isMouseEnterToShow()&&(xt.onMouseEnter=re.onPopupMouseEnter),re.isMouseLeaveToHide()&&(xt.onMouseLeave=re.onPopupMouseLeave),xt.onMouseDown=re.onPopupMouseDown,xt.onTouchStart=re.onPopupMouseDown,C.createElement(ti,Object(h.a)({prefixCls:Oe,destroyPopupOnHide:we,visible:wt,point:Yt&&Qt,className:Re,align:tr,onAlign:Ke,animation:Ze,getClassNameFromAlign:re.getPopupClassNameFromAlign},xt,{stretch:er,getRootDomNode:re.getRootDomNode,style:Dt,mask:Ht,zIndex:jt,transitionName:at,maskAnimation:Ut,maskTransitionName:Bt,maskMotion:Kt,ref:re.popupRef,motion:Je,mobile:Cr,forceRender:$t}),typeof Ft=="function"?Ft():Ft)},re.attachParent=function(xe){et.a.cancel(re.attachId);var Oe=re.props,we=Oe.getPopupContainer,Re=Oe.getDocument,Ke=re.getRootDomNode(),Je;we?(Ke||we.length===0)&&(Je=we(Ke)):Je=Re(re.getRootDomNode()).body,Je?Je.appendChild(xe):re.attachId=Object(et.a)(function(){re.attachParent(xe)})},re.getContainer=function(){var xe=re.props.getDocument,Oe=xe(re.getRootDomNode()).createElement("div");return Oe.style.position="absolute",Oe.style.top="0",Oe.style.left="0",Oe.style.width="100%",re.attachParent(Oe),Oe},re.setPoint=function(xe){var Oe=re.props.alignPoint;if(!Oe||!xe)return;re.setState({point:{pageX:xe.pageX,pageY:xe.pageY}})},re.handlePortalUpdate=function(){re.state.prevPopupVisible!==re.state.popupVisible&&re.props.afterPopupVisibleChange(re.state.popupVisible)},re.triggerContextValue={onPopupMouseDown:re.onPopupMouseDown};var be;return"popupVisible"in ce?be=!!ce.popupVisible:be=!!ce.defaultPopupVisible,re.state={prevPopupVisible:be,popupVisible:be},da.forEach(function(xe){re["fire".concat(xe)]=function(Oe){re.fireEvents(xe,Oe)}}),re}return Object(v.a)(q,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var re=this.props,be=this.state;if(be.popupVisible){var xe;!this.clickOutsideHandler&&(this.isClickToHide()||this.isContextMenuToShow())&&(xe=re.getDocument(this.getRootDomNode()),this.clickOutsideHandler=Object(Fe.a)(xe,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(xe=xe||re.getDocument(this.getRootDomNode()),this.touchOutsideHandler=Object(Fe.a)(xe,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(xe=xe||re.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=Object(Fe.a)(xe,"scroll",this.onContextMenuClose)),!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=Object(Fe.a)(window,"blur",this.onContextMenuClose));return}this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),et.a.cancel(this.attachId)}},{key:"getPopupDomNode",value:function(){var re;return((re=this.popupRef.current)===null||re===void 0?void 0:re.getElement())||null}},{key:"getPopupAlign",value:function(){var re=this.props,be=re.popupPlacement,xe=re.popupAlign,Oe=re.builtinPlacements;return be&&Oe?se(Oe,be,xe):xe}},{key:"setPopupVisible",value:function(re,be){var xe=this.props.alignPoint,Oe=this.state.popupVisible;this.clearDelayTimer(),Oe!==re&&("popupVisible"in this.props||this.setState({popupVisible:re,prevPopupVisible:Oe}),this.props.onPopupVisibleChange(re)),xe&&be&&re&&this.setPoint(be)}},{key:"delaySetPopupVisible",value:function(re,be,xe){var Oe=this,we=be*1e3;if(this.clearDelayTimer(),we){var Re=xe?{pageX:xe.pageX,pageY:xe.pageY}:null;this.delayTimer=window.setTimeout(function(){Oe.setPopupVisible(re,Re),Oe.clearDelayTimer()},we)}else this.setPopupVisible(re,xe)}},{key:"clearDelayTimer",value:function(){this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null)}},{key:"clearOutsideHandler",value:function(){this.clickOutsideHandler&&(this.clickOutsideHandler.remove(),this.clickOutsideHandler=null),this.contextMenuOutsideHandler1&&(this.contextMenuOutsideHandler1.remove(),this.contextMenuOutsideHandler1=null),this.contextMenuOutsideHandler2&&(this.contextMenuOutsideHandler2.remove(),this.contextMenuOutsideHandler2=null),this.touchOutsideHandler&&(this.touchOutsideHandler.remove(),this.touchOutsideHandler=null)}},{key:"createTwoChains",value:function(re){var be=this.props.children.props,xe=this.props;return be[re]&&xe[re]?this["fire".concat(re)]:be[re]||xe[re]}},{key:"isClickToShow",value:function(){var re=this.props,be=re.action,xe=re.showAction;return be.indexOf("click")!==-1||xe.indexOf("click")!==-1}},{key:"isContextMenuOnly",value:function(){var re=this.props.action;return re==="contextMenu"||re.length===1&&re[0]==="contextMenu"}},{key:"isContextMenuToShow",value:function(){var re=this.props,be=re.action,xe=re.showAction;return be.indexOf("contextMenu")!==-1||xe.indexOf("contextMenu")!==-1}},{key:"isClickToHide",value:function(){var re=this.props,be=re.action,xe=re.hideAction;return be.indexOf("click")!==-1||xe.indexOf("click")!==-1}},{key:"isMouseEnterToShow",value:function(){var re=this.props,be=re.action,xe=re.showAction;return be.indexOf("hover")!==-1||xe.indexOf("mouseEnter")!==-1}},{key:"isMouseLeaveToHide",value:function(){var re=this.props,be=re.action,xe=re.hideAction;return be.indexOf("hover")!==-1||xe.indexOf("mouseLeave")!==-1}},{key:"isFocusToShow",value:function(){var re=this.props,be=re.action,xe=re.showAction;return be.indexOf("focus")!==-1||xe.indexOf("focus")!==-1}},{key:"isBlurToHide",value:function(){var re=this.props,be=re.action,xe=re.hideAction;return be.indexOf("focus")!==-1||xe.indexOf("blur")!==-1}},{key:"forcePopupAlign",value:function(){if(this.state.popupVisible){var re;(re=this.popupRef.current)===null||re===void 0||re.forceAlign()}}},{key:"fireEvents",value:function(re,be){var xe=this.props.children.props[re];xe&&xe(be);var Oe=this.props[re];Oe&&Oe(be)}},{key:"close",value:function(){this.setPopupVisible(!1)}},{key:"render",value:function(){var re=this.state.popupVisible,be=this.props,xe=be.children,Oe=be.forceRender,we=be.alignPoint,Re=be.className,Ke=be.autoDestroy,Je=C.Children.only(xe),Ze={key:"trigger"};this.isContextMenuToShow()?Ze.onContextMenu=this.onContextMenu:Ze.onContextMenu=this.createTwoChains("onContextMenu"),this.isClickToHide()||this.isClickToShow()?(Ze.onClick=this.onClick,Ze.onMouseDown=this.onMouseDown,Ze.onTouchStart=this.onTouchStart):(Ze.onClick=this.createTwoChains("onClick"),Ze.onMouseDown=this.createTwoChains("onMouseDown"),Ze.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?(Ze.onMouseEnter=this.onMouseEnter,we&&(Ze.onMouseMove=this.onMouseMove)):Ze.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?Ze.onMouseLeave=this.onMouseLeave:Ze.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(Ze.onFocus=this.onFocus,Ze.onBlur=this.onBlur):(Ze.onFocus=this.createTwoChains("onFocus"),Ze.onBlur=this.createTwoChains("onBlur"));var at=W()(Je&&Je.props&&Je.props.className,Re);at&&(Ze.className=at);var Dt=Object(H.a)({},Ze);Object(ht.c)(Je)&&(Dt.ref=Object(ht.a)(this.triggerRef,Je.ref));var Ht=C.cloneElement(Je,Dt),Ut;return(re||this.popupRef.current||Oe)&&(Ut=C.createElement(fe,{key:"portal",getContainer:this.getContainer,didUpdate:this.handlePortalUpdate},this.getComponent())),!re&&Ke&&(Ut=null),C.createElement(ri.Provider,{value:this.triggerContextValue},Ht,Ut)}}],[{key:"getDerivedStateFromProps",value:function(re,be){var xe=re.popupVisible,Oe={};return xe!==void 0&&be.popupVisible!==xe&&(Oe.popupVisible=xe,Oe.prevPopupVisible=be.popupVisible),Oe}}]),q}(C.Component);return Te.contextType=ri,Te.defaultProps={prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:Yi,getDocument:Na,onPopupVisibleChange:bn,afterPopupVisibleChange:bn,onPopupAlign:bn,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[],autoDestroy:!1},Te}var ki=ca(bt.a),_n={adjustX:1,adjustY:1},$i={topLeft:{points:["bl","tl"],overflow:_n,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:_n,offset:[0,7]},leftTop:{points:["tr","tl"],overflow:_n,offset:[-4,0]},rightTop:{points:["tl","tr"],overflow:_n,offset:[4,0]}},Ua={topLeft:{points:["bl","tl"],overflow:_n,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:_n,offset:[0,7]},rightTop:{points:["tr","tl"],overflow:_n,offset:[-4,0]},leftTop:{points:["tl","tr"],overflow:_n,offset:[4,0]}},Qi=$i,ni=0,mi={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"},Fn=function(Te,Le,ge){var q=me(Le),ce=Te.getState();Te.setState({defaultActiveFirst:Object(H.a)(Object(H.a)({},ce.defaultActiveFirst),{},Object(de.a)({},q,ge))})},jn=function(fe){Object(f.a)(Le,fe);var Te=Object(d.a)(Le);function Le(ge){var q;Object(L.a)(this,Le),q=Te.call(this,ge),q.onDestroy=function(we){q.props.onDestroy(we)},q.onKeyDown=function(we){var Re=we.keyCode,Ke=q.menuInstance,Je=q.props.store,Ze=q.getVisible();if(Re===g.a.ENTER)return q.onTitleClick(we),Fn(Je,q.props.eventKey,!0),!0;if(Re===g.a.RIGHT)return Ze?Ke.onKeyDown(we):(q.triggerOpenChange(!0),Fn(Je,q.props.eventKey,!0)),!0;if(Re===g.a.LEFT){var at;if(Ze)at=Ke.onKeyDown(we);else return;return at||(q.triggerOpenChange(!1),at=!0),at}return Ze&&(Re===g.a.UP||Re===g.a.DOWN)?Ke.onKeyDown(we):void 0},q.onOpenChange=function(we){q.props.onOpenChange(we)},q.onPopupVisibleChange=function(we){q.triggerOpenChange(we,we?"mouseenter":"mouseleave")},q.onMouseEnter=function(we){var Re=q.props,Ke=Re.eventKey,Je=Re.onMouseEnter,Ze=Re.store;Fn(Ze,q.props.eventKey,!1),Je({key:Ke,domEvent:we})},q.onMouseLeave=function(we){var Re=q.props,Ke=Re.parentMenu,Je=Re.eventKey,Ze=Re.onMouseLeave;Ke.subMenuInstance=Object(c.a)(q),Ze({key:Je,domEvent:we})},q.onTitleMouseEnter=function(we){var Re=q.props,Ke=Re.eventKey,Je=Re.onItemHover,Ze=Re.onTitleMouseEnter;Je({key:Ke,hover:!0}),Ze({key:Ke,domEvent:we})},q.onTitleMouseLeave=function(we){var Re=q.props,Ke=Re.parentMenu,Je=Re.eventKey,Ze=Re.onItemHover,at=Re.onTitleMouseLeave;Ke.subMenuInstance=Object(c.a)(q),Ze({key:Je,hover:!1}),at({key:Je,domEvent:we})},q.onTitleClick=function(we){var Re=Object(c.a)(q),Ke=Re.props;if(Ke.onTitleClick({key:Ke.eventKey,domEvent:we}),Ke.triggerSubMenuAction==="hover")return;q.triggerOpenChange(!q.getVisible(),"click"),Fn(Ke.store,q.props.eventKey,!1)},q.onSubMenuClick=function(we){typeof q.props.onClick=="function"&&q.props.onClick(q.addKeyPath(we))},q.onSelect=function(we){q.props.onSelect(we)},q.onDeselect=function(we){q.props.onDeselect(we)},q.getPrefixCls=function(){return"".concat(q.props.rootPrefixCls,"-submenu")},q.getActiveClassName=function(){return"".concat(q.getPrefixCls(),"-active")},q.getDisabledClassName=function(){return"".concat(q.getPrefixCls(),"-disabled")},q.getSelectedClassName=function(){return"".concat(q.getPrefixCls(),"-selected")},q.getOpenClassName=function(){return"".concat(q.props.rootPrefixCls,"-submenu-open")},q.getVisible=function(){return q.state.isOpen},q.getMode=function(){return q.state.mode},q.saveMenuInstance=function(we){q.menuInstance=we},q.addKeyPath=function(we){return Object(H.a)(Object(H.a)({},we),{},{keyPath:(we.keyPath||[]).concat(q.props.eventKey)})},q.triggerOpenChange=function(we,Re){var Ke=q.props.eventKey,Je=function(){q.onOpenChange({key:Ke,item:Object(c.a)(q),trigger:Re,open:we})};Re==="mouseenter"?q.mouseenterTimeout=setTimeout(function(){Je()},0):Je()},q.isChildrenSelected=function(){var we={find:!1};return je(q.props.children,q.props.selectedKeys,we),we.find},q.isInlineMode=function(){return q.getMode()==="inline"},q.adjustWidth=function(){if(!q.subMenuTitle||!q.menuInstance)return;var we=it.findDOMNode(q.menuInstance);if(we.offsetWidth>=q.subMenuTitle.offsetWidth)return;we.style.minWidth="".concat(q.subMenuTitle.offsetWidth,"px")},q.saveSubMenuTitle=function(we){q.subMenuTitle=we},q.getBaseProps=function(){var we=Object(c.a)(q),Re=we.props,Ke=q.getMode();return{mode:Ke==="horizontal"?"vertical":Ke,visible:q.getVisible(),level:Re.level+1,inlineIndent:Re.inlineIndent,focusable:!1,onClick:q.onSubMenuClick,onSelect:q.onSelect,onDeselect:q.onDeselect,onDestroy:q.onDestroy,selectedKeys:Re.selectedKeys,eventKey:"".concat(Re.eventKey,"-menu-"),openKeys:Re.openKeys,motion:Re.motion,onOpenChange:q.onOpenChange,subMenuOpenDelay:Re.subMenuOpenDelay,parentMenu:Object(c.a)(q),subMenuCloseDelay:Re.subMenuCloseDelay,forceSubMenuRender:Re.forceSubMenuRender,triggerSubMenuAction:Re.triggerSubMenuAction,builtinPlacements:Re.builtinPlacements,defaultActiveFirst:Re.store.getState().defaultActiveFirst[me(Re.eventKey)],multiple:Re.multiple,prefixCls:Re.rootPrefixCls,id:q.internalMenuId,manualRef:q.saveMenuInstance,itemIcon:Re.itemIcon,expandIcon:Re.expandIcon,direction:Re.direction}},q.getMotion=function(we,Re){var Ke=Object(c.a)(q),Je=Ke.haveRendered,Ze=q.props,at=Ze.motion,Dt=Ze.rootPrefixCls,Ht=Object(H.a)(Object(H.a)({},at),{},{leavedClassName:"".concat(Dt,"-hidden"),removeOnLeave:!1,motionAppear:Je||!Re||we!=="inline"});return Ht};var ce=ge.store,re=ge.eventKey,be=ce.getState(),xe=be.defaultActiveFirst;q.isRootMenu=!1;var Oe=!1;return xe&&(Oe=xe[re]),Fn(ce,re,Oe),q.state={mode:ge.mode,isOpen:ge.isOpen},q}return Object(v.a)(Le,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var q=this,ce=this.props,re=ce.mode,be=ce.parentMenu,xe=ce.manualRef,Oe=ce.isOpen,we=function(){q.setState({mode:re,isOpen:Oe})},Re=Oe!==this.state.isOpen,Ke=re!==this.state.mode;if((Ke||Re)&&(et.a.cancel(this.updateStateRaf),Ke?this.updateStateRaf=Object(et.a)(we):we()),xe&&xe(this),re!=="horizontal"||!(be==null?void 0:be.isRootMenu)||!Oe)return;this.minWidthTimeout=setTimeout(function(){return q.adjustWidth()},0)}},{key:"componentWillUnmount",value:function(){var q=this.props,ce=q.onDestroy,re=q.eventKey;ce&&ce(re),this.minWidthTimeout&&clearTimeout(this.minWidthTimeout),this.mouseenterTimeout&&clearTimeout(this.mouseenterTimeout),et.a.cancel(this.updateStateRaf)}},{key:"renderPopupMenu",value:function(q,ce){var re=this.getBaseProps();return C.createElement(qi,Object(h.a)({},re,{id:this.internalMenuId,className:q,style:ce}),this.props.children)}},{key:"renderChildren",value:function(){var q=this,ce=this.getBaseProps(),re=ce.mode,be=ce.visible,xe=ce.forceSubMenuRender,Oe=ce.direction,we=this.getMotion(re,be);if(this.haveRendered=!0,this.haveOpened=this.haveOpened||be||xe,!this.haveOpened)return C.createElement("div",null);var Re=W()("".concat(ce.prefixCls,"-sub"),Object(de.a)({},"".concat(ce.prefixCls,"-rtl"),Oe==="rtl"));return this.isInlineMode()?C.createElement(Vn,Object(h.a)({visible:ce.visible,forceRender:xe},we),function(Ke){var Je=Ke.className,Ze=Ke.style,at=W()(Re,Je);return q.renderPopupMenu(at,Ze)}):this.renderPopupMenu(Re)}},{key:"render",value:function(){var q,ce,re,be=Object(H.a)({},this.props),xe=this.getVisible(),Oe=this.getPrefixCls(),we=this.isInlineMode(),Re=this.getMode(),Ke=W()(Oe,"".concat(Oe,"-").concat(Re),(q={},Object(de.a)(q,be.className,!!be.className),Object(de.a)(q,this.getOpenClassName(),xe),Object(de.a)(q,this.getActiveClassName(),be.active||xe&&!we),Object(de.a)(q,this.getDisabledClassName(),be.disabled),Object(de.a)(q,this.getSelectedClassName(),this.isChildrenSelected()),q));this.internalMenuId||(be.eventKey?this.internalMenuId="".concat(be.eventKey,"$Menu"):(ni+=1,this.internalMenuId="$__$".concat(ni,"$Menu")));var Je={},Ze={},at={};be.disabled||(Je={onMouseLeave:this.onMouseLeave,onMouseEnter:this.onMouseEnter},Ze={onClick:this.onTitleClick},at={onMouseEnter:this.onTitleMouseEnter,onMouseLeave:this.onTitleMouseLeave});var Dt={},Ht=be.direction,Ut=Ht==="rtl";we&&(Ut?Dt.paddingRight=be.inlineIndent*be.level:Dt.paddingLeft=be.inlineIndent*be.level);var Bt={};this.getVisible()&&(Bt={"aria-owns":this.internalMenuId});var Kt=null;Re!=="horizontal"&&(Kt=this.props.expandIcon,typeof this.props.expandIcon=="function"&&(Kt=C.createElement(this.props.expandIcon,Object(H.a)({},this.props))));var jt=C.createElement("div",Object(h.a)({ref:this.saveSubMenuTitle,style:Dt,className:"".concat(Oe,"-title"),role:"button"},at,Ze,{"aria-expanded":xe},Bt,{"aria-haspopup":"true",title:typeof be.title=="string"?be.title:void 0}),be.title,Kt||C.createElement("i",{className:"".concat(Oe,"-arrow")})),Ft=this.renderChildren(),er=((ce=be.parentMenu)===null||ce===void 0?void 0:ce.isRootMenu)?be.parentMenu.props.getPopupContainer:function(hr){return hr.parentNode},Yt=mi[Re],Cr=be.popupOffset?{offset:be.popupOffset}:{},$t=W()((re={},Object(de.a)(re,be.popupClassName,be.popupClassName&&!we),Object(de.a)(re,"".concat(Oe,"-rtl"),Ut),re)),Lt=be.disabled,wt=be.triggerSubMenuAction,Qt=be.subMenuOpenDelay,tr=be.forceSubMenuRender,xt=be.subMenuCloseDelay,nr=be.builtinPlacements;Xe.forEach(function(hr){return delete be[hr]}),delete be.onClick;var Tr=Ut?Object(H.a)(Object(H.a)({},Ua),nr):Object(H.a)(Object(H.a)({},$i),nr);delete be.direction;var ar=this.getBaseProps(),pr=we?null:this.getMotion(ar.mode,ar.visible);return C.createElement("li",Object(h.a)({},be,Je,{className:Ke,role:"menuitem"}),C.createElement(ki,{prefixCls:Oe,popupClassName:W()("".concat(Oe,"-popup"),$t),getPopupContainer:er,builtinPlacements:Tr,popupPlacement:Yt,popupVisible:we?!1:xe,popupAlign:Cr,popup:we?null:Ft,action:Lt||we?[]:[wt],mouseEnterDelay:Qt,mouseLeaveDelay:xt,onPopupVisibleChange:this.onPopupVisibleChange,forceRender:tr,popupMotion:pr},jt),we?Ft:null)}}]),Le}(C.Component);jn.defaultProps={onMouseEnter:J,onMouseLeave:J,onTitleMouseEnter:J,onTitleMouseLeave:J,onTitleClick:J,manualRef:J,mode:"vertical",title:""};var Wn=Object(a.b)(function(fe,Te){var Le=fe.openKeys,ge=fe.activeKey,q=fe.selectedKeys,ce=Te.eventKey,re=Te.subMenuKey;return{isOpen:Le.indexOf(ce)>-1,active:ge[re]===ce,selectedKeys:q}})(jn);Wn.isSubMenu=!0;var Xn=Wn,gi="menuitem-overflowed",ha=.5,dn=function(fe){Object(f.a)(Le,fe);var Te=Object(d.a)(Le);function Le(){var ge;return Object(L.a)(this,Le),ge=Te.apply(this,arguments),ge.resizeObserver=null,ge.mutationObserver=null,ge.originalTotalWidth=0,ge.overflowedItems=[],ge.menuItemSizes=[],ge.cancelFrameId=null,ge.state={lastVisibleIndex:void 0},ge.childRef=C.createRef(),ge.getMenuItemNodes=function(){var q=ge.props.prefixCls,ce=ge.childRef.current;return ce?[].slice.call(ce.children).filter(function(re){return re.className.split(" ").indexOf("".concat(q,"-overflowed-submenu"))<0}):[]},ge.getOverflowedSubMenuItem=function(q,ce,re){var be=ge.props,xe=be.overflowedIndicator,Oe=be.level,we=be.mode,Re=be.prefixCls,Ke=be.theme;if(Oe!==1||we!=="horizontal")return null;var Je=ge.props.children[0],Ze=Je.props,at=Ze.children,Dt=Ze.title,Ht=Ze.style,Ut=Object(k.a)(Ze,["children","title","style"]),Bt=Object(H.a)({},Ht),Kt="".concat(q,"-overflowed-indicator"),jt="".concat(q,"-overflowed-indicator");ce.length===0&&re!==!0?Bt=Object(H.a)(Object(H.a)({},Bt),{},{display:"none"}):re&&(Bt=Object(H.a)(Object(H.a)({},Bt),{},{visibility:"hidden",position:"absolute"}),Kt="".concat(Kt,"-placeholder"),jt="".concat(jt,"-placeholder"));var Ft=Ke?"".concat(Re,"-").concat(Ke):"",er={};return Xe.forEach(function(Yt){Ut[Yt]!==void 0&&(er[Yt]=Ut[Yt])}),C.createElement(Xn,Object(h.a)({title:xe,className:"".concat(Re,"-overflowed-submenu"),popupClassName:Ft},er,{key:Kt,eventKey:jt,disabled:!1,style:Bt}),ce)},ge.setChildrenWidthAndResize=function(){if(ge.props.mode!=="horizontal")return;var q=ge.childRef.current;if(!q)return;var ce=q.children;if(!ce||ce.length===0)return;var re=q.children[ce.length-1];He(re,"display","inline-block");var be=ge.getMenuItemNodes(),xe=be.filter(function(Oe){return Oe.className.split(" ").indexOf(gi)>=0});xe.forEach(function(Oe){He(Oe,"display","inline-block")}),ge.menuItemSizes=be.map(function(Oe){return Be(Oe,!0)}),xe.forEach(function(Oe){He(Oe,"display","none")}),ge.overflowedIndicatorWidth=Be(q.children[q.children.length-1],!0),ge.originalTotalWidth=ge.menuItemSizes.reduce(function(Oe,we){return Oe+we},0),ge.handleResize(),He(re,"display","none")},ge.handleResize=function(){if(ge.props.mode!=="horizontal")return;var q=ge.childRef.current;if(!q)return;var ce=Be(q);ge.overflowedItems=[];var re=0,be;ge.originalTotalWidth>ce+ha&&(be=-1,ge.menuItemSizes.forEach(function(xe){re+=xe,re+ge.overflowedIndicatorWidth<=ce&&(be+=1)})),ge.setState({lastVisibleIndex:be})},ge}return Object(v.a)(Le,[{key:"componentDidMount",value:function(){var q=this;if(this.setChildrenWidthAndResize(),this.props.level===1&&this.props.mode==="horizontal"){var ce=this.childRef.current;if(!ce)return;this.resizeObserver=new rt.default(function(re){re.forEach(function(){var be=q.cancelFrameId;cancelAnimationFrame(be),q.cancelFrameId=requestAnimationFrame(q.setChildrenWidthAndResize)})}),[].slice.call(ce.children).concat(ce).forEach(function(re){q.resizeObserver.observe(re)}),typeof MutationObserver!="undefined"&&(this.mutationObserver=new MutationObserver(function(){q.resizeObserver.disconnect(),[].slice.call(ce.children).concat(ce).forEach(function(re){q.resizeObserver.observe(re)}),q.setChildrenWidthAndResize()}),this.mutationObserver.observe(ce,{attributes:!1,childList:!0,subTree:!1}))}}},{key:"componentWillUnmount",value:function(){this.resizeObserver&&this.resizeObserver.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),cancelAnimationFrame(this.cancelFrameId)}},{key:"renderChildren",value:function(q){var ce=this,re=this.state.lastVisibleIndex;return(q||[]).reduce(function(be,xe,Oe){var we=xe;if(ce.props.mode==="horizontal"){var Re=ce.getOverflowedSubMenuItem(xe.props.eventKey,[]);re!==void 0&&ce.props.className.indexOf("".concat(ce.props.prefixCls,"-root"))!==-1&&(Oe>re&&(we=C.cloneElement(xe,{style:{display:"none"},eventKey:"".concat(xe.props.eventKey,"-hidden"),className:"".concat(gi)})),Oe===re+1&&(ce.overflowedItems=q.slice(re+1).map(function(Je){return C.cloneElement(Je,{key:Je.props.eventKey,mode:"vertical-left"})}),Re=ce.getOverflowedSubMenuItem(xe.props.eventKey,ce.overflowedItems)));var Ke=[].concat(Object(R.a)(be),[Re,we]);return Oe===q.length-1&&Ke.push(ce.getOverflowedSubMenuItem(xe.props.eventKey,[],!0)),Ke}return[].concat(Object(R.a)(be),[we])},[])}},{key:"render",value:function(){var q=this.props,ce=q.visible,re=q.prefixCls,be=q.overflowedIndicator,xe=q.mode,Oe=q.level,we=q.tag,Re=q.children,Ke=q.theme,Je=Object(k.a)(q,["visible","prefixCls","overflowedIndicator","mode","level","tag","children","theme"]),Ze=we;return C.createElement(Ze,Object(h.a)({ref:this.childRef},Je),this.renderChildren(Re))}}]),Le}(C.Component);dn.defaultProps={tag:"div",className:""};var fa=dn;function Di(fe){return fe.length?fe.every(function(Te){return!!Te.props.disabled}):!0}function ii(fe,Te,Le){var ge=fe.getState();fe.setState({activeKey:Object(H.a)(Object(H.a)({},ge.activeKey),{},Object(de.a)({},Te,Le))})}function xn(fe){return fe.eventKey||"0-menu-"}function En(fe,Te){var Le=Te,ge=fe.children,q=fe.eventKey;if(Le){var ce;if(Me(ge,function(re,be){re&&re.props&&!re.props.disabled&&Le===U(re,q,be)&&(ce=!0)}),ce)return Le}return Le=null,fe.defaultActiveFirst&&Me(ge,function(re,be){!Le&&re&&!re.props.disabled&&(Le=U(re,q,be))}),Le}function Zi(fe){if(!fe)return;var Te=this.instanceArray.indexOf(fe);Te!==-1?this.instanceArray[Te]=fe:this.instanceArray.push(fe)}var Ln=function(fe){Object(f.a)(Le,fe);var Te=Object(d.a)(Le);function Le(ge){var q;return Object(L.a)(this,Le),q=Te.call(this,ge),q.onKeyDown=function(ce,re){var be=ce.keyCode,xe;if(q.getFlatInstanceArray().forEach(function(we){we&&we.props.active&&we.onKeyDown&&(xe=we.onKeyDown(ce))}),xe)return 1;var Oe=null;return(be===g.a.UP||be===g.a.DOWN)&&(Oe=q.step(be===g.a.UP?-1:1)),Oe?(ce.preventDefault(),ii(q.props.store,xn(q.props),Oe.props.eventKey),typeof re=="function"&&re(Oe),1):void 0},q.onItemHover=function(ce){var re=ce.key,be=ce.hover;ii(q.props.store,xn(q.props),be?re:null)},q.onDeselect=function(ce){q.props.onDeselect(ce)},q.onSelect=function(ce){q.props.onSelect(ce)},q.onClick=function(ce){q.props.onClick(ce)},q.onOpenChange=function(ce){q.props.onOpenChange(ce)},q.onDestroy=function(ce){q.props.onDestroy(ce)},q.getFlatInstanceArray=function(){return q.instanceArray},q.step=function(ce){var re=q.getFlatInstanceArray(),be=q.props.store.getState().activeKey[xn(q.props)],xe=re.length;if(!xe)return null;ce<0&&(re=re.concat().reverse());var Oe=-1;if(re.every(function(Je,Ze){return Je&&Je.props.eventKey===be?(Oe=Ze,!1):!0}),!q.props.defaultActiveFirst&&Oe!==-1&&Di(re.slice(Oe,xe-1)))return;var we=(Oe+1)%xe,Re=we;do{var Ke=re[Re];if(!Ke||Ke.props.disabled)Re=(Re+1)%xe;else return Ke}while(Re!==we);return null},q.renderCommonMenuItem=function(ce,re,be){var xe=q.props.store.getState(),Oe=Object(c.a)(q),we=Oe.props,Re=U(ce,we.eventKey,re),Ke=ce.props;if(!Ke||typeof ce.type=="string")return ce;var Je=Re===xe.activeKey,Ze=Object(H.a)(Object(H.a)({mode:Ke.mode||we.mode,level:we.level,inlineIndent:we.inlineIndent,renderMenuItem:q.renderMenuItem,rootPrefixCls:we.prefixCls,index:re,parentMenu:we.parentMenu,manualRef:Ke.disabled?void 0:Object(m.a)(ce.ref,Zi.bind(Object(c.a)(q))),eventKey:Re,active:!Ke.disabled&&Je,multiple:we.multiple,onClick:function(Dt){(Ke.onClick||J)(Dt),q.onClick(Dt)},onItemHover:q.onItemHover,motion:we.motion,subMenuOpenDelay:we.subMenuOpenDelay,subMenuCloseDelay:we.subMenuCloseDelay,forceSubMenuRender:we.forceSubMenuRender,onOpenChange:q.onOpenChange,onDeselect:q.onDeselect,onSelect:q.onSelect,builtinPlacements:we.builtinPlacements,itemIcon:Ke.itemIcon||q.props.itemIcon,expandIcon:Ke.expandIcon||q.props.expandIcon},be),{},{direction:we.direction});return(we.mode==="inline"||ze())&&(Ze.triggerSubMenuAction="click"),C.cloneElement(ce,Object(H.a)(Object(H.a)({},Ze),{},{key:Re||re}))},q.renderMenuItem=function(ce,re,be){if(!ce)return null;var xe=q.props.store.getState(),Oe={openKeys:xe.openKeys,selectedKeys:xe.selectedKeys,triggerSubMenuAction:q.props.triggerSubMenuAction,subMenuKey:be};return q.renderCommonMenuItem(ce,re,Oe)},ge.store.setState({activeKey:Object(H.a)(Object(H.a)({},ge.store.getState().activeKey),{},Object(de.a)({},ge.eventKey,En(ge,ge.activeKey)))}),q.instanceArray=[],q}return Object(v.a)(Le,[{key:"componentDidMount",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"shouldComponentUpdate",value:function(q){return this.props.visible||q.visible||this.props.className!==q.className||!I()(this.props.style,q.style)}},{key:"componentDidUpdate",value:function(q){var ce=this.props,re="activeKey"in ce?ce.activeKey:ce.store.getState().activeKey[xn(ce)],be=En(ce,re);if(be!==re)ii(ce.store,xn(ce),be);else if("activeKey"in q){var xe=En(q,q.activeKey);be!==xe&&ii(ce.store,xn(ce),be)}}},{key:"render",value:function(){var q=this,ce=Object(h.a)({},this.props);this.instanceArray=[];var re=W()(ce.prefixCls,ce.className,"".concat(ce.prefixCls,"-").concat(ce.mode)),be={className:re,role:ce.role||"menu"};ce.id&&(be.id=ce.id),ce.focusable&&(be.tabIndex=0,be.onKeyDown=this.onKeyDown);var xe=ce.prefixCls,Oe=ce.eventKey,we=ce.visible,Re=ce.level,Ke=ce.mode,Je=ce.overflowedIndicator,Ze=ce.theme;return Xe.forEach(function(at){return delete ce[at]}),delete ce.onClick,C.createElement(fa,Object(h.a)({},ce,{prefixCls:xe,mode:Ke,tag:"ul",level:Re,theme:Ze,visible:we,overflowedIndicator:Je},be),Object(B.a)(ce.children).map(function(at,Dt){return q.renderMenuItem(at,Dt,Oe||"0-menu-")}))}}]),Le}(C.Component);Ln.defaultProps={prefixCls:"rc-menu",className:"",mode:"vertical",level:1,inlineIndent:24,visible:!0,focusable:!0,style:{},manualRef:J};var Ji=Object(a.b)()(Ln),qi=Ji,vi=le("Kwbf");function Ba(fe,Te,Le){var ge=fe.prefixCls,q=fe.motion,ce=fe.defaultMotions,re=ce===void 0?{}:ce,be=fe.openAnimation,xe=fe.openTransitionName,Oe=Te.switchingModeFromInline;if(q)return q;if(Object(z.a)(be)==="object"&&be)Object(vi.a)(!1,"Object type of `openAnimation` is removed. Please use `motion` instead.");else if(typeof be=="string")return{motionName:"".concat(ge,"-open-").concat(be)};if(xe)return{motionName:xe};var we=re[Le];return we||(Oe?null:re.other)}var Et=function(fe){Object(f.a)(Le,fe);var Te=Object(d.a)(Le);function Le(ge){var q;Object(L.a)(this,Le),q=Te.call(this,ge),q.onSelect=function(be){var xe=Object(c.a)(q),Oe=xe.props;if(Oe.selectable){var we=q.store.getState(),Re=we.selectedKeys,Ke=be.key;Oe.multiple?Re=Re.concat([Ke]):Re=[Ke],"selectedKeys"in Oe||q.store.setState({selectedKeys:Re}),Oe.onSelect(Object(H.a)(Object(H.a)({},be),{},{selectedKeys:Re}))}},q.onClick=function(be){var xe=q.getRealMenuMode(),Oe=Object(c.a)(q),we=Oe.store,Re=Oe.props.onOpenChange;xe!=="inline"&&!("openKeys"in q.props)&&(we.setState({openKeys:[]}),Re([])),q.props.onClick(be)},q.onKeyDown=function(be,xe){q.innerMenu.getWrappedInstance().onKeyDown(be,xe)},q.onOpenChange=function(be){var xe=Object(c.a)(q),Oe=xe.props,we=q.store.getState().openKeys.concat(),Re=!1,Ke=function(Ze){var at=!1;if(Ze.open)at=we.indexOf(Ze.key)===-1,at&&we.push(Ze.key);else{var Dt=we.indexOf(Ze.key);at=Dt!==-1,at&&we.splice(Dt,1)}Re=Re||at};Array.isArray(be)?be.forEach(Ke):Ke(be),Re&&("openKeys"in q.props||q.store.setState({openKeys:we}),Oe.onOpenChange(we))},q.onDeselect=function(be){var xe=Object(c.a)(q),Oe=xe.props;if(Oe.selectable){var we=q.store.getState().selectedKeys.concat(),Re=be.key,Ke=we.indexOf(Re);Ke!==-1&&we.splice(Ke,1),"selectedKeys"in Oe||q.store.setState({selectedKeys:we}),Oe.onDeselect(Object(H.a)(Object(H.a)({},be),{},{selectedKeys:we}))}},q.onMouseEnter=function(be){q.restoreModeVerticalFromInline();var xe=q.props.onMouseEnter;xe&&xe(be)},q.onTransitionEnd=function(be){var xe=be.propertyName==="width"&&be.target===be.currentTarget,Oe=be.target.className,we=Object.prototype.toString.call(Oe)==="[object SVGAnimatedString]"?Oe.animVal:Oe,Re=be.propertyName==="font-size"&&we.indexOf("anticon")>=0;(xe||Re)&&q.restoreModeVerticalFromInline()},q.setInnerMenu=function(be){q.innerMenu=be},q.isRootMenu=!0;var ce=ge.defaultSelectedKeys,re=ge.defaultOpenKeys;return"selectedKeys"in ge&&(ce=ge.selectedKeys||[]),"openKeys"in ge&&(re=ge.openKeys||[]),q.store=Object(a.c)({selectedKeys:ce,openKeys:re,activeKey:{"0-menu-":En(ge,ge.activeKey)}}),q.state={switchingModeFromInline:!1,prevProps:ge,inlineOpenKeys:[],store:q.store},q}return Object(v.a)(Le,[{key:"componentDidMount",value:function(){this.updateMiniStore(),this.updateMenuDisplay()}},{key:"componentDidUpdate",value:function(q){var ce=this.props,re=ce.siderCollapsed,be=ce.inlineCollapsed,xe=ce.onOpenChange;(!q.inlineCollapsed&&be||!q.siderCollapsed&&re)&&xe([]),this.updateMiniStore(),this.updateMenuDisplay()}},{key:"updateMenuDisplay",value:function(){var q=this.props.collapsedWidth,ce=this.store,re=this.prevOpenKeys,be=this.getInlineCollapsed()&&(q===0||q==="0"||q==="0px");be?(this.prevOpenKeys=ce.getState().openKeys.concat(),this.store.setState({openKeys:[]})):re&&(this.store.setState({openKeys:re}),this.prevOpenKeys=null)}},{key:"getRealMenuMode",value:function(){var q=this.props.mode,ce=this.state.switchingModeFromInline,re=this.getInlineCollapsed();return ce&&re?"inline":re?"vertical":q}},{key:"getInlineCollapsed",value:function(){var q=this.props,ce=q.inlineCollapsed,re=q.siderCollapsed;return re!==void 0?re:ce}},{key:"restoreModeVerticalFromInline",value:function(){var q=this.state.switchingModeFromInline;q&&this.setState({switchingModeFromInline:!1})}},{key:"updateMiniStore",value:function(){"selectedKeys"in this.props&&this.store.setState({selectedKeys:this.props.selectedKeys||[]}),"openKeys"in this.props&&this.store.setState({openKeys:this.props.openKeys||[]})}},{key:"render",value:function(){var q=Object(H.a)({},Object(x.a)(this.props,["collapsedWidth","siderCollapsed","defaultMotions"])),ce=this.getRealMenuMode();return q.className+=" ".concat(q.prefixCls,"-root"),q.direction==="rtl"&&(q.className+=" ".concat(q.prefixCls,"-rtl")),q=Object(H.a)(Object(H.a)({},q),{},{mode:ce,onClick:this.onClick,onOpenChange:this.onOpenChange,onDeselect:this.onDeselect,onSelect:this.onSelect,onMouseEnter:this.onMouseEnter,onTransitionEnd:this.onTransitionEnd,parentMenu:this,motion:Ba(this.props,this.state,ce)}),delete q.openAnimation,delete q.openTransitionName,C.createElement(a.a,{store:this.store},C.createElement(qi,Object(h.a)({},q,{ref:this.setInnerMenu}),this.props.children))}}],[{key:"getDerivedStateFromProps",value:function(q,ce){var re=ce.prevProps,be=ce.store,xe=be.getState(),Oe={},we={prevProps:q};return re.mode==="inline"&&q.mode!=="inline"&&(we.switchingModeFromInline=!0),"openKeys"in q?Oe.openKeys=q.openKeys||[]:((q.inlineCollapsed&&!re.inlineCollapsed||q.siderCollapsed&&!re.siderCollapsed)&&(we.switchingModeFromInline=!0,we.inlineOpenKeys=xe.openKeys,Oe.openKeys=[]),(!q.inlineCollapsed&&re.inlineCollapsed||!q.siderCollapsed&&re.siderCollapsed)&&(Oe.openKeys=ce.inlineOpenKeys,we.inlineOpenKeys=[])),Object.keys(Oe).length&&be.setState(Oe),we}}]),Le}(C.Component);Et.defaultProps={selectable:!0,onClick:J,onSelect:J,onOpenChange:J,onDeselect:J,defaultSelectedKeys:[],defaultOpenKeys:[],subMenuOpenDelay:.1,subMenuCloseDelay:.1,triggerSubMenuAction:"hover",prefixCls:"rc-menu",className:"",mode:"vertical",style:{},builtinPlacements:{},overflowedIndicator:C.createElement("span",null,"\xB7\xB7\xB7")};var _t=Et,Tt=function(fe){Object(f.a)(Le,fe);var Te=Object(d.a)(Le);function Le(){var ge;return Object(L.a)(this,Le),ge=Te.apply(this,arguments),ge.onKeyDown=function(q){var ce=q.keyCode;return ce===g.a.ENTER?(ge.onClick(q),!0):void 0},ge.onMouseLeave=function(q){var ce=ge.props,re=ce.eventKey,be=ce.onItemHover,xe=ce.onMouseLeave;be({key:re,hover:!1}),xe({key:re,domEvent:q})},ge.onMouseEnter=function(q){var ce=ge.props,re=ce.eventKey,be=ce.onItemHover,xe=ce.onMouseEnter;be({key:re,hover:!0}),xe({key:re,domEvent:q})},ge.onClick=function(q){var ce=ge.props,re=ce.eventKey,be=ce.multiple,xe=ce.onClick,Oe=ce.onSelect,we=ce.onDeselect,Re=ce.isSelected,Ke={key:re,keyPath:[re],item:Object(c.a)(ge),domEvent:q};xe(Ke),be?Re?we(Ke):Oe(Ke):Re||Oe(Ke)},ge.saveNode=function(q){ge.node=q},ge}return Object(v.a)(Le,[{key:"componentDidMount",value:function(){this.callRef()}},{key:"componentDidUpdate",value:function(){this.callRef()}},{key:"componentWillUnmount",value:function(){var q=this.props;q.onDestroy&&q.onDestroy(q.eventKey)}},{key:"getPrefixCls",value:function(){return"".concat(this.props.rootPrefixCls,"-item")}},{key:"getActiveClassName",value:function(){return"".concat(this.getPrefixCls(),"-active")}},{key:"getSelectedClassName",value:function(){return"".concat(this.getPrefixCls(),"-selected")}},{key:"getDisabledClassName",value:function(){return"".concat(this.getPrefixCls(),"-disabled")}},{key:"callRef",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"render",value:function(){var q,ce=Object(H.a)({},this.props),re=W()(this.getPrefixCls(),ce.className,(q={},Object(de.a)(q,this.getActiveClassName(),!ce.disabled&&ce.active),Object(de.a)(q,this.getSelectedClassName(),ce.isSelected),Object(de.a)(q,this.getDisabledClassName(),ce.disabled),q)),be=Object(H.a)(Object(H.a)({},ce.attribute),{},{title:typeof ce.title=="string"?ce.title:void 0,className:re,role:ce.role||"menuitem","aria-disabled":ce.disabled});ce.role==="option"?be=Object(H.a)(Object(H.a)({},be),{},{role:"option","aria-selected":ce.isSelected}):(ce.role===null||ce.role==="none")&&(be.role="none");var xe={onClick:ce.disabled?null:this.onClick,onMouseLeave:ce.disabled?null:this.onMouseLeave,onMouseEnter:ce.disabled?null:this.onMouseEnter},Oe=Object(H.a)({},ce.style);ce.mode==="inline"&&(ce.direction==="rtl"?Oe.paddingRight=ce.inlineIndent*ce.level:Oe.paddingLeft=ce.inlineIndent*ce.level),Xe.forEach(function(Re){return delete ce[Re]}),delete ce.direction;var we=this.props.itemIcon;return typeof this.props.itemIcon=="function"&&(we=C.createElement(this.props.itemIcon,this.props)),C.createElement("li",Object(h.a)({},Object(x.a)(ce,["onClick","onMouseEnter","onMouseLeave","onSelect"]),be,xe,{style:Oe,ref:this.saveNode}),ce.children,we)}}]),Le}(C.Component);Tt.isMenuItem=!0,Tt.defaultProps={onSelect:J,onMouseEnter:J,onMouseLeave:J,manualRef:J};var Gt=Object(a.b)(function(fe,Te){var Le=fe.activeKey,ge=fe.selectedKeys,q=Te.eventKey,ce=Te.subMenuKey;return{active:Le[ce]===q,isSelected:Array.isArray(ge)?ge.indexOf(q)!==-1:ge===q}})(Tt),rr=Gt,dr=function(fe){Object(f.a)(Le,fe);var Te=Object(d.a)(Le);function Le(){var ge;return Object(L.a)(this,Le),ge=Te.apply(this,arguments),ge.renderInnerMenuItem=function(q){var ce=ge.props,re=ce.renderMenuItem,be=ce.index;return re(q,be,ge.props.subMenuKey)},ge}return Object(v.a)(Le,[{key:"render",value:function(){var q=Object(h.a)({},this.props),ce=q.className,re=ce===void 0?"":ce,be=q.rootPrefixCls,xe="".concat(be,"-item-group-title"),Oe="".concat(be,"-item-group-list"),we=q.title,Re=q.children;return Xe.forEach(function(Ke){return delete q[Ke]}),delete q.direction,C.createElement("li",Object(h.a)({},q,{onClick:function(Je){return Je.stopPropagation()},className:"".concat(re," ").concat(be,"-item-group")}),C.createElement("div",{className:xe,title:typeof we=="string"?we:void 0},we),C.createElement("ul",{className:Oe},C.Children.map(Re,this.renderInnerMenuItem)))}}]),Le}(C.Component);dr.isMenuItemGroup=!0,dr.defaultProps={disabled:!0};var qt=dr,Mr=function(Te){var Le=Te.className,ge=Te.rootPrefixCls,q=Te.style;return C.createElement("li",{className:"".concat(Le," ").concat(ge,"-item-divider"),style:q})};Mr.defaultProps={disabled:!0,className:"",style:{}};var cn=Mr,Xt=_t,Yn=le("eDIo");function sr(fe,Te){var Le=fe.prefixCls,ge=fe.editable,q=fe.locale,ce=fe.style;return!ge||ge.showAdd===!1?null:C.createElement("button",{ref:Te,type:"button",className:"".concat(Le,"-nav-add"),style:ce,"aria-label":(q==null?void 0:q.addAriaLabel)||"Add tab",onClick:function(be){ge.onEdit("add",{event:be})}},ge.addIcon||"+")}var tn=C.forwardRef(sr);function Zr(fe,Te){var Le=fe.prefixCls,ge=fe.id,q=fe.tabs,ce=fe.locale,re=fe.mobile,be=fe.moreIcon,xe=be===void 0?"More":be,Oe=fe.moreTransitionName,we=fe.style,Re=fe.className,Ke=fe.editable,Je=fe.tabBarGutter,Ze=fe.rtl,at=fe.onTabClick,Dt=Object(C.useState)(!1),Ht=Object(X.a)(Dt,2),Ut=Ht[0],Bt=Ht[1],Kt=Object(C.useState)(null),jt=Object(X.a)(Kt,2),Ft=jt[0],er=jt[1],Yt="".concat(ge,"-more-popup"),Cr="".concat(Le,"-dropdown"),$t=Ft!==null?"".concat(Yt,"-").concat(Ft):null,Lt=ce==null?void 0:ce.dropdownAriaLabel,wt=C.createElement(Xt,{onClick:function(pr){var hr=pr.key,Rr=pr.domEvent;at(hr,Rr),Bt(!1)},id:Yt,tabIndex:-1,role:"listbox","aria-activedescendant":$t,selectedKeys:[Ft],"aria-label":Lt!==void 0?Lt:"expanded dropdown"},q.map(function(ar){return C.createElement(rr,{key:ar.key,id:"".concat(Yt,"-").concat(ar.key),role:"option","aria-controls":ge&&"".concat(ge,"-panel-").concat(ar.key),disabled:ar.disabled},ar.tab)}));function Qt(ar){for(var pr=q.filter(function(on){return!on.disabled}),hr=pr.findIndex(function(on){return on.key===Ft})||0,Rr=pr.length,zr=0;zr<Rr;zr+=1){hr=(hr+ar+Rr)%Rr;var Ar=pr[hr];if(!Ar.disabled){er(Ar.key);return}}}function tr(ar){var pr=ar.which;if(!Ut){[g.a.DOWN,g.a.SPACE,g.a.ENTER].includes(pr)&&(Bt(!0),ar.preventDefault());return}switch(pr){case g.a.UP:Qt(-1),ar.preventDefault();break;case g.a.DOWN:Qt(1),ar.preventDefault();break;case g.a.ESC:Bt(!1);break;case g.a.SPACE:case g.a.ENTER:Ft!==null&&at(Ft,ar);break}}Object(C.useEffect)(function(){var ar=document.getElementById($t);ar&&ar.scrollIntoView&&ar.scrollIntoView(!1)},[Ft]),Object(C.useEffect)(function(){Ut||er(null)},[Ut]);var xt=Object(de.a)({},Ze?"marginLeft":"marginRight",Je);q.length||(xt.visibility="hidden",xt.order=1);var nr=W()(Object(de.a)({},"".concat(Cr,"-rtl"),Ze)),Tr=re?null:C.createElement(Yn.a,{prefixCls:Cr,overlay:wt,trigger:["hover"],visible:Ut,transitionName:Oe,onVisibleChange:Bt,overlayClassName:nr,mouseEnterDelay:.1,mouseLeaveDelay:.1},C.createElement("button",{type:"button",className:"".concat(Le,"-nav-more"),style:xt,tabIndex:-1,"aria-hidden":"true","aria-haspopup":"listbox","aria-controls":Yt,id:"".concat(ge,"-more"),"aria-expanded":Ut,onKeyDown:tr},xe));return C.createElement("div",{className:W()("".concat(Le,"-nav-operations"),Re),style:we,ref:Te},Tr,C.createElement(tn,{prefixCls:Le,locale:ce,editable:Ke}))}var On=C.forwardRef(Zr),Fa=Object(C.createContext)(null),Ko=.1,Mi=.01,_r=20,go=Math.pow(.995,_r);function vo(){var fe=navigator.userAgent||navigator.vendor||window.opera;return!!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(fe)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(fe.substr(0,4)))}function ea(fe,Te){var Le=Object(C.useState)(),ge=Object(X.a)(Le,2),q=ge[0],ce=ge[1],re=Object(C.useState)(0),be=Object(X.a)(re,2),xe=be[0],Oe=be[1],we=Object(C.useState)(0),Re=Object(X.a)(we,2),Ke=Re[0],Je=Re[1],Ze=Object(C.useState)(),at=Object(X.a)(Ze,2),Dt=at[0],Ht=at[1],Ut=Object(C.useRef)();function Bt(Lt){var wt=Lt.touches[0],Qt=wt.screenX,tr=wt.screenY;ce({x:Qt,y:tr}),window.clearInterval(Ut.current)}function Kt(Lt){if(!q)return;Lt.preventDefault();var wt=Lt.touches[0],Qt=wt.screenX,tr=wt.screenY;ce({x:Qt,y:tr});var xt=Qt-q.x,nr=tr-q.y;Te(xt,nr);var Tr=Date.now();Oe(Tr),Je(Tr-xe),Ht({x:xt,y:nr})}function jt(){if(!q)return;if(ce(null),Ht(null),Dt){var Lt=Dt.x/Ke,wt=Dt.y/Ke,Qt=Math.abs(Lt),tr=Math.abs(wt);if(Math.max(Qt,tr)<Ko)return;var xt=Lt,nr=wt;Ut.current=window.setInterval(function(){if(Math.abs(xt)<Mi&&Math.abs(nr)<Mi){window.clearInterval(Ut.current);return}xt*=go,nr*=go,Te(xt*_r,nr*_r)},_r)}}var Ft=Object(C.useRef)(0),er=Object(C.useRef)(!1),Yt=Object(C.useRef)();function Cr(Lt){var wt=Lt.deltaX,Qt=Lt.deltaY,tr=0,xt=Math.abs(wt),nr=Math.abs(Qt);xt===nr?tr=Yt.current==="x"?wt:Qt:xt>nr?(tr=wt,Yt.current="x"):(tr=Qt,Yt.current="y");var Tr=Date.now();Tr-Ft.current>100&&(er.current=!1),(Te(-tr,-tr)||er.current)&&(Lt.preventDefault(),er.current=!0),Ft.current=Tr}var $t=Object(C.useRef)(null);$t.current={onTouchStart:Bt,onTouchMove:Kt,onTouchEnd:jt,onWheel:Cr},C.useEffect(function(){function Lt(xt){$t.current.onTouchStart(xt)}function wt(xt){$t.current.onTouchMove(xt)}function Qt(xt){$t.current.onTouchEnd(xt)}function tr(xt){$t.current.onWheel(xt)}return document.addEventListener("touchmove",wt,{passive:!1}),document.addEventListener("touchend",Qt,{passive:!1}),fe.current.addEventListener("touchstart",Lt,{passive:!1}),fe.current.addEventListener("wheel",tr),function(){document.removeEventListener("touchmove",wt),document.removeEventListener("touchend",Qt)}},[])}function zo(){var fe=Object(C.useRef)(new Map);function Te(ge){return fe.current.has(ge)||fe.current.set(ge,C.createRef()),fe.current.get(ge)}function Le(ge){fe.current.delete(ge)}return[Te,Le]}function ja(fe,Te){var Le=C.useRef(fe),ge=C.useState({}),q=Object(X.a)(ge,2),ce=q[1];function re(be){var xe=typeof be=="function"?be(Le.current):be;xe!==Le.current&&Te(xe,Le.current),Le.current=xe,ce({})}return[Le.current,re]}var yo=function(Te){var Le=Te.position,ge=Te.prefixCls,q=Te.extra;if(!q)return null;var ce,re=q;return Le==="right"&&(ce=re.right||!re.left&&re||null),Le==="left"&&(ce=re.left||null),ce?C.createElement("div",{className:"".concat(ge,"-extra-content")},ce):null};function Wa(fe,Te){var Le,ge=C.useContext(Fa),q=ge.prefixCls,ce=ge.tabs,re=fe.className,be=fe.style,xe=fe.id,Oe=fe.animated,we=fe.activeKey,Re=fe.rtl,Ke=fe.extra,Je=fe.editable,Ze=fe.locale,at=fe.tabPosition,Dt=fe.tabBarGutter,Ht=fe.children,Ut=fe.onTabClick,Bt=fe.onTabScroll,Kt=Object(C.useRef)(),jt=Object(C.useRef)(),Ft=Object(C.useRef)(),er=Object(C.useRef)(),Yt=zo(),Cr=Object(X.a)(Yt,2),$t=Cr[0],Lt=Cr[1],wt=at==="top"||at==="bottom",Qt=ja(0,function(ur,Zt){wt&&Bt&&Bt({direction:ur>Zt?"left":"right"})}),tr=Object(X.a)(Qt,2),xt=tr[0],nr=tr[1],Tr=ja(0,function(ur,Zt){!wt&&Bt&&Bt({direction:ur>Zt?"top":"bottom"})}),ar=Object(X.a)(Tr,2),pr=ar[0],hr=ar[1],Rr=Object(C.useState)(0),zr=Object(X.a)(Rr,2),Ar=zr[0],on=zr[1],Rn=Object(C.useState)(0),hn=Object(X.a)(Rn,2),Gr=hn[0],xr=hn[1],mr=Object(C.useState)(0),Lr=Object(X.a)(mr,2),wr=Lr[0],Pn=Lr[1],ai=Object(C.useState)(0),oi=Object(X.a)(ai,2),fr=oi[0],Hn=oi[1],si=Object(C.useState)(null),yr=Object(X.a)(si,2),cr=yr[0],Vr=yr[1],Eo=Object(C.useState)(null),Ga=Object(X.a)(Eo,2),li=Ga[0],Ri=Ga[1],pa=Object(C.useState)(0),Va=Object(X.a)(pa,2),ma=Va[0],Xo=Va[1],Yo=Object(C.useState)(0),So=Object(X.a)(Yo,2),Xa=So[0],Ya=So[1],Pi=w(new Map),Ii=Object(X.a)(Pi,2),$o=Ii[0],ga=Ii[1],ta=l(ce,$o,Ar),Ni="".concat(q,"-nav-operations-hidden"),Ui=0,In=0;wt?Re?(Ui=0,In=Math.max(0,Ar-cr)):(Ui=Math.min(0,cr-Ar),In=0):(Ui=Math.min(0,li-Gr),In=0);function yi(ur){return ur<Ui?[Ui,!1]:ur>In?[In,!1]:[ur,!0]}var ui=Object(C.useRef)(),ra=Object(C.useState)(),bi=Object(X.a)(ra,2),va=bi[0],$a=bi[1];function ya(){$a(Date.now())}function Qa(){window.clearTimeout(ui.current)}ea(Kt,function(ur,Zt){var Xr=!1;function pn(Bi,Qn){Bi(function(aa){var ci=yi(aa+Qn),Yr=Object(X.a)(ci,2),Ea=Yr[0],Ja=Yr[1];return Xr=Ja,Ea})}if(wt){if(cr>=Ar)return Xr;pn(nr,ur)}else{if(li>=Gr)return Xr;pn(hr,Zt)}return Qa(),ya(),Xr}),Object(C.useEffect)(function(){return Qa(),va&&(ui.current=window.setTimeout(function(){$a(0)},100)),Qa},[va]);function di(){var ur=arguments.length>0&&arguments[0]!==void 0?arguments[0]:we,Zt=ta.get(ur);if(!Zt)return;if(wt){var Xr=xt;Re?Zt.right<xt?Xr=Zt.right:Zt.right+Zt.width>xt+cr&&(Xr=Zt.right+Zt.width-cr):Zt.left<-xt?Xr=-Zt.left:Zt.left+Zt.width>-xt+cr&&(Xr=-(Zt.left+Zt.width-cr)),hr(0),nr(yi(Xr)[0])}else{var pn=pr;Zt.top<-pr?pn=-Zt.top:Zt.top+Zt.height>-pr+li&&(pn=-(Zt.top+Zt.height-li)),nr(0),hr(yi(pn)[0])}}var xi=p(ta,{width:cr,height:li,left:xt,top:pr},{width:wr,height:fr},{width:ma,height:Xa},Object(H.a)(Object(H.a)({},fe),{},{tabs:ce})),Co=Object(X.a)(xi,2),Qo=Co[0],Zo=Co[1],Jo=ce.map(function(ur){var Zt=ur.key;return C.createElement(o,{id:xe,prefixCls:q,key:Zt,rtl:Re,tab:ur,closable:ur.closable,editable:Je,active:Zt===we,tabPosition:at,tabBarGutter:Dt,renderWrapper:Ht,removeAriaLabel:Ze==null?void 0:Ze.removeAriaLabel,ref:$t(Zt),onClick:function(pn){Ut(Zt,pn)},onRemove:function(){Lt(Zt)},onFocus:function(){di(Zt),ya(),Re||(Kt.current.scrollLeft=0),Kt.current.scrollTop=0}})}),Za=O(function(){var ur,Zt,Xr,pn,Bi,Qn,aa,ci,Yr,Ea=((ur=Kt.current)===null||ur===void 0?void 0:ur.offsetWidth)||0,Ja=((Zt=Kt.current)===null||Zt===void 0?void 0:Zt.offsetHeight)||0,qa=((Xr=er.current)===null||Xr===void 0?void 0:Xr.offsetWidth)||0,mn=((pn=er.current)===null||pn===void 0?void 0:pn.offsetHeight)||0,lr=((Bi=Ft.current)===null||Bi===void 0?void 0:Bi.offsetWidth)||0,Un=((Qn=Ft.current)===null||Qn===void 0?void 0:Qn.offsetHeight)||0;Vr(Ea),Ri(Ja),Xo(qa),Ya(mn);var Zn=(((aa=jt.current)===null||aa===void 0?void 0:aa.offsetWidth)||0)-qa,Jn=(((ci=jt.current)===null||ci===void 0?void 0:ci.offsetHeight)||0)-mn;on(Zn),xr(Jn);var eo=(Yr=Ft.current)===null||Yr===void 0?void 0:Yr.className.includes(Ni);Pn(Zn-(eo?0:lr)),Hn(Jn-(eo?0:Un)),ga(function(){var Sa=new Map;return ce.forEach(function(Oo){var ko=Oo.key,Si=$t(ko).current;Si&&Sa.set(ko,{width:Si.offsetWidth,height:Si.offsetHeight,left:Si.offsetLeft,top:Si.offsetTop})}),Sa})}),qo=ce.slice(0,Qo),fn=ce.slice(Zo+1),Nr=[].concat(Object(R.a)(qo),Object(R.a)(fn)),rn=Object(C.useState)(),Ur=Object(X.a)(rn,2),na=Ur[0],es=Ur[1],Nn=ta.get(we),To=Object(C.useRef)();function wo(){T.a.cancel(To.current)}Object(C.useEffect)(function(){var ur={};return Nn&&(wt?(Re?ur.right=Nn.right:ur.left=Nn.left,ur.width=Nn.width):(ur.top=Nn.top,ur.height=Nn.height)),wo(),To.current=T()(function(){es(ur)}),wo},[Nn,wt,Re]),Object(C.useEffect)(function(){di()},[we,Nn,ta,wt]),Object(C.useEffect)(function(){Za()},[Re,Dt,we,ce.map(function(ur){return ur.key}).join("_")]);var Ao=!!Nr.length,Ei="".concat(q,"-nav-wrap"),ba,ia,Lo,xa;return wt?Re?(ia=xt>0,ba=xt+cr<Ar):(ba=xt<0,ia=-xt+cr<Ar):(Lo=pr<0,xa=-pr+li<Gr),C.createElement("div",{ref:Te,role:"tablist",className:W()("".concat(q,"-nav"),re),style:be,onKeyDown:function(){ya()}},C.createElement(yo,{position:"left",extra:Ke,prefixCls:q}),C.createElement(_.a,{onResize:Za},C.createElement("div",{className:W()(Ei,(Le={},Object(de.a)(Le,"".concat(Ei,"-ping-left"),ba),Object(de.a)(Le,"".concat(Ei,"-ping-right"),ia),Object(de.a)(Le,"".concat(Ei,"-ping-top"),Lo),Object(de.a)(Le,"".concat(Ei,"-ping-bottom"),xa),Le)),ref:Kt},C.createElement(_.a,{onResize:Za},C.createElement("div",{ref:jt,className:"".concat(q,"-nav-list"),style:{transform:"translate(".concat(xt,"px, ").concat(pr,"px)"),transition:va?"none":void 0}},Jo,C.createElement(tn,{ref:er,prefixCls:q,locale:Ze,editable:Je,style:{visibility:Ao?"hidden":null}}),C.createElement("div",{className:W()("".concat(q,"-ink-bar"),Object(de.a)({},"".concat(q,"-ink-bar-animated"),Oe.inkBar)),style:na}))))),C.createElement(On,Object.assign({},fe,{ref:Ft,prefixCls:q,tabs:Nr,className:!Ao&&Ni})),C.createElement(yo,{position:"right",extra:Ke,prefixCls:q}))}var Ha=C.forwardRef(Wa);function Go(fe){var Te=fe.id,Le=fe.activeKey,ge=fe.animated,q=fe.tabPosition,ce=fe.rtl,re=fe.destroyInactiveTabPane,be=C.useContext(Fa),xe=be.prefixCls,Oe=be.tabs,we=ge.tabPane,Re=Oe.findIndex(function(Ke){return Ke.key===Le});return C.createElement("div",{className:W()("".concat(xe,"-content-holder"))},C.createElement("div",{className:W()("".concat(xe,"-content"),"".concat(xe,"-content-").concat(q),Object(de.a)({},"".concat(xe,"-content-animated"),we)),style:Re&&we?Object(de.a)({},ce?"marginRight":"marginLeft","-".concat(Re,"00%")):null},Oe.map(function(Ke){return C.cloneElement(Ke.node,{key:Ke.key,prefixCls:xe,tabKey:Ke.key,id:Te,animated:we,active:Ke.key===Le,destroyInactiveTabPane:re})})))}function bo(fe){var Te=fe.prefixCls,Le=fe.forceRender,ge=fe.className,q=fe.style,ce=fe.id,re=fe.active,be=fe.animated,xe=fe.destroyInactiveTabPane,Oe=fe.tabKey,we=fe.children,Re=C.useState(Le),Ke=Object(X.a)(Re,2),Je=Ke[0],Ze=Ke[1];C.useEffect(function(){re?Ze(!0):xe&&Ze(!1)},[re,xe]);var at={};return re||(be?(at.visibility="hidden",at.height=0,at.overflowY="hidden"):at.display="none"),C.createElement("div",{id:ce&&"".concat(ce,"-panel-").concat(Oe),role:"tabpanel",tabIndex:re?0:-1,"aria-labelledby":ce&&"".concat(ce,"-tab-").concat(Oe),"aria-hidden":!re,style:Object(H.a)(Object(H.a)({},at),q),className:W()("".concat(Te,"-tabpane"),re&&"".concat(Te,"-tabpane-active"),ge)},(re||Je||Le)&&we)}var Ka=0;function xo(fe){return Object(B.a)(fe).map(function(Te){if(C.isValidElement(Te)){var Le=Te.key!==void 0?String(Te.key):void 0;return Object(H.a)(Object(H.a)({key:Le},Te.props),{},{node:Te})}return null}).filter(function(Te){return Te})}function Vo(fe,Te){var Le,ge=fe.id,q=fe.prefixCls,ce=q===void 0?"rc-tabs":q,re=fe.className,be=fe.children,xe=fe.direction,Oe=fe.activeKey,we=fe.defaultActiveKey,Re=fe.editable,Ke=fe.animated,Je=fe.tabPosition,Ze=Je===void 0?"top":Je,at=fe.tabBarGutter,Dt=fe.tabBarStyle,Ht=fe.tabBarExtraContent,Ut=fe.locale,Bt=fe.moreIcon,Kt=fe.moreTransitionName,jt=fe.destroyInactiveTabPane,Ft=fe.renderTabBar,er=fe.onChange,Yt=fe.onTabClick,Cr=fe.onTabScroll,$t=Object(k.a)(fe,["id","prefixCls","className","children","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","moreIcon","moreTransitionName","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll"]),Lt=xo(be),wt=xe==="rtl",Qt;Ke===!1?Qt={inkBar:!1,tabPane:!1}:Qt=Object(H.a)({inkBar:!0,tabPane:!1},Ke!==!0?Ke:null);var tr=Object(C.useState)(!1),xt=Object(X.a)(tr,2),nr=xt[0],Tr=xt[1];Object(C.useEffect)(function(){Tr(vo())},[]);var ar=Object(P.a)(function(){var fr;return(fr=Lt[0])===null||fr===void 0?void 0:fr.key},{value:Oe,defaultValue:we}),pr=Object(X.a)(ar,2),hr=pr[0],Rr=pr[1],zr=Object(C.useState)(function(){return Lt.findIndex(function(fr){return fr.key===hr})}),Ar=Object(X.a)(zr,2),on=Ar[0],Rn=Ar[1];Object(C.useEffect)(function(){var fr=Lt.findIndex(function(si){return si.key===hr});if(fr===-1){var Hn;fr=Math.max(0,Math.min(on,Lt.length-1)),Rr((Hn=Lt[fr])===null||Hn===void 0?void 0:Hn.key)}Rn(fr)},[Lt.map(function(fr){return fr.key}).join("_"),hr,on]);var hn=Object(P.a)(null,{value:ge}),Gr=Object(X.a)(hn,2),xr=Gr[0],mr=Gr[1],Lr=Ze;nr&&!["left","right"].includes(Ze)&&(Lr="top"),Object(C.useEffect)(function(){ge||(mr("rc-tabs-".concat(Ka)),Ka+=1)},[]);function wr(fr,Hn){Yt==null||Yt(fr,Hn),Rr(fr),er==null||er(fr)}var Pn={id:xr,activeKey:hr,animated:Qt,tabPosition:Lr,rtl:wt,mobile:nr},ai,oi=Object(H.a)(Object(H.a)({},Pn),{},{editable:Re,locale:Ut,moreIcon:Bt,moreTransitionName:Kt,tabBarGutter:at,onTabClick:wr,onTabScroll:Cr,extra:Ht,style:Dt,panes:be});return Ft?ai=Ft(oi,Ha):ai=C.createElement(Ha,Object.assign({},oi)),C.createElement(Fa.Provider,{value:{tabs:Lt,prefixCls:ce}},C.createElement("div",Object.assign({ref:Te,id:ge,className:W()(ce,"".concat(ce,"-").concat(Lr),(Le={},Object(de.a)(Le,"".concat(ce,"-mobile"),nr),Object(de.a)(Le,"".concat(ce,"-editable"),Re),Object(de.a)(Le,"".concat(ce,"-rtl"),wt),Le),re)},$t),ai,C.createElement(Go,Object.assign({destroyInactiveTabPane:jt},Pn,{animated:Qt}))))}var _i=C.forwardRef(Vo);_i.TabPane=bo;var $n=_i,za=ct.b=$n},kSUc:function(Ot,ct,le){},lZu9:function(Ot,ct,le){(function(de){de(le("VrN/"),le("1eCo"),le("8EBN"))})(function(de){"use strict";de.defineMode("markdown",function(X,k){var H=de.getMode(X,"text/html"),C=H.name=="null";function M(G){if(de.findModeByName){var j=de.findModeByName(G);j&&(G=j.mime||j.mimes[0])}var oe=de.getMode(X,G);return oe.name=="null"?null:oe}k.highlightFormatting===void 0&&(k.highlightFormatting=!1),k.maxBlockquoteDepth===void 0&&(k.maxBlockquoteDepth=0),k.taskLists===void 0&&(k.taskLists=!1),k.strikethrough===void 0&&(k.strikethrough=!1),k.emoji===void 0&&(k.emoji=!1),k.fencedCodeBlockHighlighting===void 0&&(k.fencedCodeBlockHighlighting=!0),k.fencedCodeBlockDefaultMode===void 0&&(k.fencedCodeBlockDefaultMode="text/plain"),k.xml===void 0&&(k.xml=!0),k.tokenTypeOverrides===void 0&&(k.tokenTypeOverrides={});var W={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var B in W)W.hasOwnProperty(B)&&k.tokenTypeOverrides[B]&&(W[B]=k.tokenTypeOverrides[B]);var P=/^([*\-_])(?:\s*\1){2,}\s*$/,R=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,y=/^\[(x| )\](?=\s)/i,T=k.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,_=/^ {0,3}(?:\={1,}|-{2,})\s*$/,O=/^[^#!\[\]*_\\<>` "'(~:]+/,w=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,g=/^\s*\[[^\]]+?\]:.*$/,u=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function s(G,j,oe){return j.f=j.inline=oe,oe(G,j)}function l(G,j,oe){return j.f=j.block=oe,oe(G,j)}function b(G){return!G||!/\S/.test(G.string)}function p(G){if(G.linkTitle=!1,G.linkHref=!1,G.linkText=!1,G.em=!1,G.strong=!1,G.strikethrough=!1,G.quote=0,G.indentedCode=!1,G.f==L){var j=C;if(!j){var oe=de.innerMode(H,G.htmlState);j=oe.mode.name=="xml"&&oe.state.tagStart===null&&!oe.state.context&&oe.state.tokenize.isInText}j&&(G.f=d,G.block=h,G.htmlState=null)}return G.trailingSpace=0,G.trailingSpaceNewLine=!1,G.prevLine=G.thisLine,G.thisLine={stream:null},null}function h(G,j){var oe=G.column()===j.indentation,ye=b(j.prevLine.stream),Ce=j.indentedCode,De=j.prevLine.hr,Ye=j.list!==!1,Ie=(j.listStack[j.listStack.length-1]||0)+3;j.indentedCode=!1;var Ve=j.indentation;if(j.indentationDiff===null&&(j.indentationDiff=j.indentation,Ye)){for(j.list=null;Ve<j.listStack[j.listStack.length-1];)j.listStack.pop(),j.listStack.length?j.indentation=j.listStack[j.listStack.length-1]:j.list=!1;j.list!==!1&&(j.indentationDiff=Ve-j.listStack[j.listStack.length-1])}var Ne=!ye&&!De&&!j.prevLine.header&&(!Ye||!Ce)&&!j.prevLine.fencedCodeEnd,Ue=(j.list===!1||De||ye)&&j.indentation<=Ie&&G.match(P),Ae=null;if(j.indentationDiff>=4&&(Ce||j.prevLine.fencedCodeEnd||j.prevLine.header||ye))return G.skipToEnd(),j.indentedCode=!0,W.code;if(G.eatSpace())return null;if(oe&&j.indentation<=Ie&&(Ae=G.match(T))&&Ae[1].length<=6)return j.quote=0,j.header=Ae[1].length,j.thisLine.header=!0,k.highlightFormatting&&(j.formatting="header"),j.f=j.inline,c(j);if(j.indentation<=Ie&&G.eat(">"))return j.quote=oe?1:j.quote+1,k.highlightFormatting&&(j.formatting="quote"),G.eatSpace(),c(j);if(!Ue&&!j.setext&&oe&&j.indentation<=Ie&&(Ae=G.match(R))){var F=Ae[1]?"ol":"ul";return j.indentation=Ve+G.current().length,j.list=!0,j.quote=0,j.listStack.push(j.indentation),j.em=!1,j.strong=!1,j.code=!1,j.strikethrough=!1,k.taskLists&&G.match(y,!1)&&(j.taskList=!0),j.f=j.inline,k.highlightFormatting&&(j.formatting=["list","list-"+F]),c(j)}else{if(oe&&j.indentation<=Ie&&(Ae=G.match(w,!0)))return j.quote=0,j.fencedEndRE=new RegExp(Ae[1]+"+ *$"),j.localMode=k.fencedCodeBlockHighlighting&&M(Ae[2]||k.fencedCodeBlockDefaultMode),j.localMode&&(j.localState=de.startState(j.localMode)),j.f=j.block=v,k.highlightFormatting&&(j.formatting="code-block"),j.code=-1,c(j);if(j.setext||(!Ne||!Ye)&&!j.quote&&j.list===!1&&!j.code&&!Ue&&!g.test(G.string)&&(Ae=G.lookAhead(1))&&(Ae=Ae.match(_)))return j.setext?(j.header=j.setext,j.setext=0,G.skipToEnd(),k.highlightFormatting&&(j.formatting="header")):(j.header=Ae[0].charAt(0)=="="?1:2,j.setext=j.header),j.thisLine.header=!0,j.f=j.inline,c(j);if(Ue)return G.skipToEnd(),j.hr=!0,j.thisLine.hr=!0,W.hr;if(G.peek()==="[")return s(G,j,I)}return s(G,j,j.inline)}function L(G,j){var oe=H.token(G,j.htmlState);if(!C){var ye=de.innerMode(H,j.htmlState);(ye.mode.name=="xml"&&ye.state.tagStart===null&&!ye.state.context&&ye.state.tokenize.isInText||j.md_inside&&G.current().indexOf(">")>-1)&&(j.f=d,j.block=h,j.htmlState=null)}return oe}function v(G,j){var oe=j.listStack[j.listStack.length-1]||0,ye=j.indentation<oe,Ce=oe+3;if(j.fencedEndRE&&j.indentation<=Ce&&(ye||G.match(j.fencedEndRE))){k.highlightFormatting&&(j.formatting="code-block");var De;return ye||(De=c(j)),j.localMode=j.localState=null,j.block=h,j.f=d,j.fencedEndRE=null,j.code=0,j.thisLine.fencedCodeEnd=!0,ye?l(G,j,j.block):De}else return j.localMode?j.localMode.token(G,j.localState):(G.skipToEnd(),W.code)}function c(G){var j=[];if(G.formatting){j.push(W.formatting),typeof G.formatting=="string"&&(G.formatting=[G.formatting]);for(var oe=0;oe<G.formatting.length;oe++)j.push(W.formatting+"-"+G.formatting[oe]),G.formatting[oe]==="header"&&j.push(W.formatting+"-"+G.formatting[oe]+"-"+G.header),G.formatting[oe]==="quote"&&(!k.maxBlockquoteDepth||k.maxBlockquoteDepth>=G.quote?j.push(W.formatting+"-"+G.formatting[oe]+"-"+G.quote):j.push("error"))}if(G.taskOpen)return j.push("meta"),j.length?j.join(" "):null;if(G.taskClosed)return j.push("property"),j.length?j.join(" "):null;if(G.linkHref?j.push(W.linkHref,"url"):(G.strong&&j.push(W.strong),G.em&&j.push(W.em),G.strikethrough&&j.push(W.strikethrough),G.emoji&&j.push(W.emoji),G.linkText&&j.push(W.linkText),G.code&&j.push(W.code),G.image&&j.push(W.image),G.imageAltText&&j.push(W.imageAltText,"link"),G.imageMarker&&j.push(W.imageMarker)),G.header&&j.push(W.header,W.header+"-"+G.header),G.quote&&(j.push(W.quote),!k.maxBlockquoteDepth||k.maxBlockquoteDepth>=G.quote?j.push(W.quote+"-"+G.quote):j.push(W.quote+"-"+k.maxBlockquoteDepth)),G.list!==!1){var ye=(G.listStack.length-1)%3;ye?ye===1?j.push(W.list2):j.push(W.list3):j.push(W.list1)}return G.trailingSpaceNewLine?j.push("trailing-space-new-line"):G.trailingSpace&&j.push("trailing-space-"+(G.trailingSpace%2?"a":"b")),j.length?j.join(" "):null}function f(G,j){return G.match(O,!0)?c(j):void 0}function d(G,j){var oe=j.text(G,j);if(typeof oe!="undefined")return oe;if(j.list)return j.list=null,c(j);if(j.taskList){var ye=G.match(y,!0)[1]===" ";return ye?j.taskOpen=!0:j.taskClosed=!0,k.highlightFormatting&&(j.formatting="task"),j.taskList=!1,c(j)}if(j.taskOpen=!1,j.taskClosed=!1,j.header&&G.match(/^#+$/,!0))return k.highlightFormatting&&(j.formatting="header"),c(j);var Ce=G.next();if(j.linkTitle){j.linkTitle=!1;var De=Ce;Ce==="("&&(De=")"),De=(De+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ye="^\\s*(?:[^"+De+"\\\\]+|\\\\\\\\|\\\\.)"+De;if(G.match(new RegExp(Ye),!0))return W.linkHref}if(Ce==="`"){var Ie=j.formatting;k.highlightFormatting&&(j.formatting="code"),G.eatWhile("`");var Ve=G.current().length;if(j.code==0&&(!j.quote||Ve==1))return j.code=Ve,c(j);if(Ve==j.code){var Ne=c(j);return j.code=0,Ne}else return j.formatting=Ie,c(j)}else if(j.code)return c(j);if(Ce==="\\"&&(G.next(),k.highlightFormatting)){var Ue=c(j),Ae=W.formatting+"-escape";return Ue?Ue+" "+Ae:Ae}if(Ce==="!"&&G.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return j.imageMarker=!0,j.image=!0,k.highlightFormatting&&(j.formatting="image"),c(j);if(Ce==="["&&j.imageMarker&&G.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return j.imageMarker=!1,j.imageAltText=!0,k.highlightFormatting&&(j.formatting="image"),c(j);if(Ce==="]"&&j.imageAltText){k.highlightFormatting&&(j.formatting="image");var Ue=c(j);return j.imageAltText=!1,j.image=!1,j.inline=j.f=x,Ue}if(Ce==="["&&!j.image)return j.linkText&&G.match(/^.*?\]/)||(j.linkText=!0,k.highlightFormatting&&(j.formatting="link")),c(j);if(Ce==="]"&&j.linkText){k.highlightFormatting&&(j.formatting="link");var Ue=c(j);return j.linkText=!1,j.inline=j.f=G.match(/\(.*?\)| ?\[.*?\]/,!1)?x:d,Ue}if(Ce==="<"&&G.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){j.f=j.inline=a,k.highlightFormatting&&(j.formatting="link");var Ue=c(j);return Ue?Ue+=" ":Ue="",Ue+W.linkInline}if(Ce==="<"&&G.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){j.f=j.inline=a,k.highlightFormatting&&(j.formatting="link");var Ue=c(j);return Ue?Ue+=" ":Ue="",Ue+W.linkEmail}if(k.xml&&Ce==="<"&&G.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var F=G.string.indexOf(">",G.pos);if(F!=-1){var A=G.string.substring(G.start,F);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(A)&&(j.md_inside=!0)}return G.backUp(1),j.htmlState=de.startState(H),l(G,j,L)}if(k.xml&&Ce==="<"&&G.match(/^\/\w*?>/))return j.md_inside=!1,"tag";if(Ce==="*"||Ce==="_"){for(var D=1,K=G.pos==1?" ":G.string.charAt(G.pos-2);D<3&&G.eat(Ce);)D++;var J=G.peek()||" ",U=!/\s/.test(J)&&(!u.test(J)||/\s/.test(K)||u.test(K)),me=!/\s/.test(K)&&(!u.test(K)||/\s/.test(J)||u.test(J)),Me=null,je=null;if(D%2&&(!j.em&&U&&(Ce==="*"||!me||u.test(K))?Me=!0:j.em==Ce&&me&&(Ce==="*"||!U||u.test(J))&&(Me=!1)),D>1&&(!j.strong&&U&&(Ce==="*"||!me||u.test(K))?je=!0:j.strong==Ce&&me&&(Ce==="*"||!U||u.test(J))&&(je=!1)),je!=null||Me!=null){k.highlightFormatting&&(j.formatting=Me==null?"strong":je==null?"em":"strong em"),Me===!0&&(j.em=Ce),je===!0&&(j.strong=Ce);var Ne=c(j);return Me===!1&&(j.em=!1),je===!1&&(j.strong=!1),Ne}}else if(Ce===" "&&(G.eat("*")||G.eat("_"))){if(G.peek()===" ")return c(j);G.backUp(1)}if(k.strikethrough){if(Ce==="~"&&G.eatWhile(Ce)){if(j.strikethrough){k.highlightFormatting&&(j.formatting="strikethrough");var Ne=c(j);return j.strikethrough=!1,Ne}else if(G.match(/^[^\s]/,!1))return j.strikethrough=!0,k.highlightFormatting&&(j.formatting="strikethrough"),c(j)}else if(Ce===" "&&G.match(/^~~/,!0)){if(G.peek()===" ")return c(j);G.backUp(2)}}if(k.emoji&&Ce===":"&&G.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){j.emoji=!0,k.highlightFormatting&&(j.formatting="emoji");var Xe=c(j);return j.emoji=!1,Xe}return Ce===" "&&(G.match(/^ +$/,!1)?j.trailingSpace++:j.trailingSpace&&(j.trailingSpaceNewLine=!0)),c(j)}function a(G,j){var oe=G.next();if(oe===">"){j.f=j.inline=d,k.highlightFormatting&&(j.formatting="link");var ye=c(j);return ye?ye+=" ":ye="",ye+W.linkInline}return G.match(/^[^>]+/,!0),W.linkInline}function x(G,j){if(G.eatSpace())return null;var oe=G.next();return oe==="("||oe==="["?(j.f=j.inline=S(oe==="("?")":"]"),k.highlightFormatting&&(j.formatting="link-string"),j.linkHref=!0,c(j)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function S(G){return function(j,oe){var ye=j.next();if(ye===G){oe.f=oe.inline=d,k.highlightFormatting&&(oe.formatting="link-string");var Ce=c(oe);return oe.linkHref=!1,Ce}return j.match(m[G]),oe.linkHref=!0,c(oe)}}function I(G,j){return G.match(/^([^\]\\]|\\.)*\]:/,!1)?(j.f=z,G.next(),k.highlightFormatting&&(j.formatting="link"),j.linkText=!0,c(j)):s(G,j,d)}function z(G,j){if(G.match(/^\]:/,!0)){j.f=j.inline=Y,k.highlightFormatting&&(j.formatting="link");var oe=c(j);return j.linkText=!1,oe}return G.match(/^([^\]\\]|\\.)+/,!0),W.linkText}function Y(G,j){return G.eatSpace()?null:(G.match(/^[^\s]+/,!0),G.peek()===void 0?j.linkTitle=!0:G.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),j.f=j.inline=d,W.linkHref+" url")}var ie={startState:function(){return{f:h,prevLine:{stream:null},thisLine:{stream:null},block:h,htmlState:null,indentation:0,inline:d,text:f,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(G){return{f:G.f,prevLine:G.prevLine,thisLine:G.thisLine,block:G.block,htmlState:G.htmlState&&de.copyState(H,G.htmlState),indentation:G.indentation,localMode:G.localMode,localState:G.localMode?de.copyState(G.localMode,G.localState):null,inline:G.inline,text:G.text,formatting:!1,linkText:G.linkText,linkTitle:G.linkTitle,linkHref:G.linkHref,code:G.code,em:G.em,strong:G.strong,strikethrough:G.strikethrough,emoji:G.emoji,header:G.header,setext:G.setext,hr:G.hr,taskList:G.taskList,list:G.list,listStack:G.listStack.slice(0),quote:G.quote,indentedCode:G.indentedCode,trailingSpace:G.trailingSpace,trailingSpaceNewLine:G.trailingSpaceNewLine,md_inside:G.md_inside,fencedEndRE:G.fencedEndRE}},token:function(G,j){if(j.formatting=!1,G!=j.thisLine.stream){if(j.header=0,j.hr=!1,G.match(/^\s*$/,!0))return p(j),null;if(j.prevLine=j.thisLine,j.thisLine={stream:G},j.taskList=!1,j.trailingSpace=0,j.trailingSpaceNewLine=!1,!j.localState&&(j.f=j.block,j.f!=L)){var oe=G.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(j.indentation=oe,j.indentationDiff=null,oe>0)return null}}return j.f(G,j)},innerMode:function(G){return G.block==L?{state:G.htmlState,mode:H}:G.localState?{state:G.localState,mode:G.localMode}:{state:G,mode:ie}},indent:function(G,j,oe){return G.block==L&&H.indent?H.indent(G.htmlState,j,oe):G.localState&&G.localMode.indent?G.localMode.indent(G.localState,j,oe):de.Pass},blankLine:p,getType:c,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return ie},"xml"),de.defineMIME("text/markdown","markdown"),de.defineMIME("text/x-markdown","markdown")})},nuEh:function(Ot,ct,le){"use strict";var de=le("T2oS"),X=le("W9HT"),k=le("q1tI"),H=le.n(k),C=le("F8wB"),M=le.n(C),W=function(P){var R=P.loading;return R?H.a.createElement("div",{className:M.a.loading},H.a.createElement(X.a,null)):H.a.createElement(H.a.Fragment,null)};ct.a=W},osHv:function(Ot,ct,le){(function(de){de(le("VrN/"))})(function(de){"use strict";var X=de.Pos;function k(u,o){return u.line-o.line||u.ch-o.ch}var H="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",C=H+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",M=new RegExp("<(/?)(["+H+"]["+C+"]*)","g");function W(u,o,s,l){this.line=o,this.ch=s,this.cm=u,this.text=u.getLine(o),this.min=l?Math.max(l.from,u.firstLine()):u.firstLine(),this.max=l?Math.min(l.to-1,u.lastLine()):u.lastLine()}function B(u,o){var s=u.cm.getTokenTypeAt(X(u.line,o));return s&&/\btag\b/.test(s)}function P(u){return u.line>=u.max?void 0:(u.ch=0,u.text=u.cm.getLine(++u.line),!0)}function R(u){return u.line<=u.min?void 0:(u.text=u.cm.getLine(--u.line),u.ch=u.text.length,!0)}function y(u){for(;;){var o=u.text.indexOf(">",u.ch);if(o==-1){if(P(u))continue;return}if(!B(u,o+1)){u.ch=o+1;continue}var s=u.text.lastIndexOf("/",o),l=s>-1&&!/\S/.test(u.text.slice(s+1,o));return u.ch=o+1,l?"selfClose":"regular"}}function T(u){for(;;){var o=u.ch?u.text.lastIndexOf("<",u.ch-1):-1;if(o==-1){if(R(u))continue;return}if(!B(u,o+1)){u.ch=o;continue}M.lastIndex=o,u.ch=o;var s=M.exec(u.text);if(s&&s.index==o)return s}}function _(u){for(;;){M.lastIndex=u.ch;var o=M.exec(u.text);if(!o){if(P(u))continue;return}if(!B(u,o.index+1)){u.ch=o.index+1;continue}return u.ch=o.index+o[0].length,o}}function O(u){for(;;){var o=u.ch?u.text.lastIndexOf(">",u.ch-1):-1;if(o==-1){if(R(u))continue;return}if(!B(u,o+1)){u.ch=o;continue}var s=u.text.lastIndexOf("/",o),l=s>-1&&!/\S/.test(u.text.slice(s+1,o));return u.ch=o+1,l?"selfClose":"regular"}}function w(u,o){for(var s=[];;){var l=_(u),b,p=u.line,h=u.ch-(l?l[0].length:0);if(!l||!(b=y(u)))return;if(b=="selfClose")continue;if(l[1]){for(var L=s.length-1;L>=0;--L)if(s[L]==l[2]){s.length=L;break}if(L<0&&(!o||o==l[2]))return{tag:l[2],from:X(p,h),to:X(u.line,u.ch)}}else s.push(l[2])}}function g(u,o){for(var s=[];;){var l=O(u);if(!l)return;if(l=="selfClose"){T(u);continue}var b=u.line,p=u.ch,h=T(u);if(!h)return;if(h[1])s.push(h[2]);else{for(var L=s.length-1;L>=0;--L)if(s[L]==h[2]){s.length=L;break}if(L<0&&(!o||o==h[2]))return{tag:h[2],from:X(u.line,u.ch),to:X(b,p)}}}}de.registerHelper("fold","xml",function(u,o){for(var s=new W(u,o.line,0);;){var l=_(s);if(!l||s.line!=o.line)return;var b=y(s);if(!b)return;if(!l[1]&&b!="selfClose"){var p=X(s.line,s.ch),h=w(s,l[2]);return h&&k(h.from,p)>0?{from:p,to:h.from}:null}}}),de.findMatchingTag=function(u,o,s){var l=new W(u,o.line,o.ch,s);if(l.text.indexOf(">")==-1&&l.text.indexOf("<")==-1)return;var b=y(l),p=b&&X(l.line,l.ch),h=b&&T(l);if(!b||!h||k(l,o)>0)return;var L={from:X(l.line,l.ch),to:p,tag:h[2]};return b=="selfClose"?{open:L,close:null,at:"open"}:h[1]?{open:g(l,h[2]),close:L,at:"close"}:(l=new W(u,p.line,p.ch,s),{open:L,close:w(l,h[2]),at:"open"})},de.findEnclosingTag=function(u,o,s,l){for(var b=new W(u,o.line,o.ch,s);;){var p=g(b,l);if(!p)break;var h=new W(u,o.line,o.ch,s),L=w(h,p.tag);if(L)return{open:p,close:L}}},de.scanForClosingTag=function(u,o,s,l){var b=new W(u,o.line,o.ch,l?{from:0,to:l}:null);return w(b,s)}})},p5ED:function(Ot,ct,le){"use strict";var de=le("+L6B"),X=le("2/Rp"),k=le("5Dmo"),H=le("3S7+"),C=le("k1fw"),M=le("9og8"),W=le("tJVT"),B=le("WmNS"),P=le.n(B),R=le("q1tI"),y=le.n(R),T=le("vHTk"),_=le.n(T),O=le("yEEn"),w=le("ZW9T"),g=le("1vsH"),u=le("V0Rq"),o=le("m3rI");ct.a=function(s){var l,b,p,h,L,v,c,f=s.editOffice,d=f===void 0?"view":f,a=s.data,x=s.theme,m=s.type,S=s.filename,I=s.monacoEditor,z=s.className,Y=s.style,ie=s.close,G=s.onClose,j=s.hasMask,oe=s.disabledDownload,ye=Object(R.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),Ce=Object(W.a)(ye,2),De=Ce[0],Ye=Ce[1],Ie=Object(R.useState)(""),Ve=Object(W.a)(Ie,2),Ne=Ve[0],Ue=Ve[1],Ae=Object(R.useState)(),F=Object(W.a)(Ae,2),A=F[0],D=F[1],K=window.ENV==="build"?"/react/build":"",J=o.a.PROXY_SERVER||location.origin,U,me=1024*1024,Me=10*me,je=Object(R.useRef)();(l=a)!==null&&l!==void 0&&l.startsWith("/api")&&m!=="txt"&&(a=(o.a.API_SERVER||location.origin)+a),m==="office"&&(U=Object(g.T)(a).filesize,U>Me&&(m="other")),S&&I&&(I.filename=S),Object(R.useEffect)(function(){var ze,rt,it=(ze=document.cookie)===null||ze===void 0||((rt=ze.replace(/\s/g,""))===null||rt===void 0)?void 0:rt.split(";");it==null||it.map(function(lt){var et=lt.split("=");et[0]==="_educoder_session"&&Ue(et[1])})},[]),Object(R.useEffect)(function(){m==="office"&&Xe()},[m,a]);var Xe=function(){var ze=Object(M.a)(P.a.mark(function rt(){var it,lt,et;return P.a.wrap(function(ut){for(;;)switch(ut.prev=ut.next){case 0:return console.log("data:",a),it=a,a.startsWith("http")||(it=location.origin+it),lt=new URL(it).pathname.split("/").pop(),ut.next=6,Object(u.V)({attachment_id:lt});case 6:et=ut.sent,D(et);case 8:case"end":return ut.stop()}},rt)}));return function(){return ze.apply(this,arguments)}}(),Be=function(){if(a.startsWith("http")||a.startsWith("blob:")){He();return}Object(g.z)(S||"educoder",a,S)},He=function(){Object(g.x)(S||"educoder",decodeURIComponent(a))};return y.a.createElement("div",{style:Object(C.a)({},Y||{}),className:"".concat(j&&_.a.bgBlack," ").concat(m?_.a.wrp:"hide")},ie&&y.a.createElement("div",{className:_.a.close,ref:je},!oe&&y.a.createElement(H.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return je.current}},y.a.createElement("span",{onClick:He},y.a.createElement("i",{className:"icon-quxiaozhiding"}))),y.a.createElement(H.a,{title:"\u5173\u95ED",getPopupContainer:function(){return je.current}},y.a.createElement("span",{className:"",onClick:G},y.a.createElement("i",{className:"icon-guanbi1"})))),y.a.createElement("div",{className:"".concat(_.a[z]," ").concat(z," ").concat(_.a.monaco," ").concat(m==="txt"?"show":"hide")},m==="txt"&&y.a.createElement(w.b,I)),m==="audio"&&y.a.createElement("audio",{src:"".concat(((b=a)===null||b===void 0?void 0:b.indexOf("http://"))>-1||((p=a)===null||p===void 0?void 0:p.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(a),autoPlay:!0}),m==="video"&&y.a.createElement(y.a.Fragment,null,((h=a)===null||h===void 0?void 0:h.indexOf("http"))>-1?y.a.createElement("video",{controls:!0,src:"".concat(a),autoPlay:!0}):y.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(a),autoPlay:!0})),m==="office"&&A&&y.a.createElement("iframe",{src:"".concat(K,"/office.html?key=").concat(A.key,"&url=").concat(J+A.url,"&callbackUrl=").concat(J+A.callbackUrl,"&fileType=").concat(A.fileType,"&title=").concat(A.title,"&model=").concat(d,"&officeServer=").concat(o.a.OFFICE_SERVER,"&disabledDownload=").concat(!!oe)}),m==="html"&&y.a.createElement("iframe",{src:a+"&disposition=inline"}),m==="pdf"&&y.a.createElement("iframe",{src:"".concat(K,"/js/pdfview/index.html?url=").concat(a,"&disabledDownload=").concat(!!oe)}),m==="image"&&y.a.createElement("img",{src:"".concat(((L=a)===null||L===void 0?void 0:L.indexOf("http://"))>-1||((v=a)===null||v===void 0?void 0:v.indexOf("https://"))>-1||(c=a)!==null&&c!==void 0&&c.startsWith("/api")?"":"data:image/png;base64,").concat(a)}),m==="other"&&y.a.createElement("div",null,y.a.createElement(X.a,{type:"primary",size:"large",onClick:Be},y.a.createElement(O.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),m==="download"&&y.a.createElement(X.a,{type:"primary",size:"large",onClick:Be},y.a.createElement(O.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(Ot,ct,le){},rUJ1:function(Ot,ct){const le=/[&<>"']/,de=/[&<>"']/g,X=/[<>"']|&(?!#?\w+;)/,k=/[<>"']|&(?!#?\w+;)/g,H={"&":"&","<":"<",">":">",'"':""","'":"'"},C=v=>H[v];function M(v,c){if(c){if(le.test(v))return v.replace(de,C)}else if(X.test(v))return v.replace(k,C);return v}const W=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function B(v){return v.replace(W,(c,f)=>(f=f.toLowerCase(),f==="colon"?":":f.charAt(0)==="#"?f.charAt(1)==="x"?String.fromCharCode(parseInt(f.substring(2),16)):String.fromCharCode(+f.substring(1)):""))}const P=/(^|[^\[])\^/g;function R(v,c){v=v.source||v,c=c||"";const f={replace:(d,a)=>(a=a.source||a,a=a.replace(P,"$1"),v=v.replace(d,a),f),getRegex:()=>new RegExp(v,c)};return f}const y=/[^\w:]/g,T=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function _(v,c,f){if(v){let d;try{d=decodeURIComponent(B(f)).replace(y,"").toLowerCase()}catch(a){return null}if(d.indexOf("javascript:")===0||d.indexOf("vbscript:")===0||d.indexOf("data:")===0)return null}c&&!T.test(f)&&(f=o(c,f));try{f=encodeURI(f).replace(/%25/g,"%")}catch(d){return null}return f}const O={},w=/^[^:]+:\/*[^/]*$/,g=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(v,c){O[" "+v]||(w.test(v)?O[" "+v]=v+"/":O[" "+v]=p(v,"/",!0)),v=O[" "+v];const f=v.indexOf(":")===-1;return c.substring(0,2)==="//"?f?c:v.replace(g,"$1")+c:c.charAt(0)==="/"?f?c:v.replace(u,"$1")+c:v+c}const s={exec:function(){}};function l(v){let c=1,f,d;for(;c<arguments.length;c++){f=arguments[c];for(d in f)Object.prototype.hasOwnProperty.call(f,d)&&(v[d]=f[d])}return v}function b(v,c){const f=v.replace(/\|/g,(x,m,S)=>{let I=!1,z=m;for(;--z>=0&&S[z]==="\\";)I=!I;return I?"|":" |"}),d=f.split(/ \|/);let a=0;if(d.length>c)d.splice(c);else for(;d.length<c;)d.push("");for(;a<d.length;a++)d[a]=d[a].trim().replace(/\\\|/g,"|");return d}function p(v,c,f){const d=v.length;if(d===0)return"";let a=0;for(;a<d;){const x=v.charAt(d-a-1);if(x===c&&!f)a++;else if(x!==c&&f)a++;else break}return v.substr(0,d-a)}function h(v,c){if(v.indexOf(c[1])===-1)return-1;const f=v.length;let d=0,a=0;for(;a<f;a++)if(v[a]==="\\")a++;else if(v[a]===c[0])d++;else if(v[a]===c[1]&&(d--,d<0))return a;return-1}function L(v){v&&v.sanitize&&!v.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")}Ot.exports={escape:M,unescape:B,edit:R,cleanUrl:_,resolveUrl:o,noopTest:s,merge:l,splitCells:b,rtrim:p,findClosingBracket:h,checkSanitizeDeprecation:L}},t23M:function(Ot,ct,le){"use strict";var de=le("VTBJ"),X=le("1OyB"),k=le("vuIU"),H=le("Ji7U"),C=le("LK+K"),M=le("q1tI"),W=le.n(M),B=le("m+aA"),P=le("Zm9Q"),R=le("Kwbf"),y=le("c+Xe"),T=le("bdgK"),_="rc-observer-key",O=function(w){Object(H.a)(u,w);var g=Object(C.a)(u);function u(){var o;return Object(X.a)(this,u),o=g.apply(this,arguments),o.resizeObserver=null,o.childNode=null,o.currentElement=null,o.state={width:0,height:0,offsetHeight:0,offsetWidth:0},o.onResize=function(s){var l=o.props.onResize,b=s[0].target,p=b.getBoundingClientRect(),h=p.width,L=p.height,v=b.offsetWidth,c=b.offsetHeight,f=Math.floor(h),d=Math.floor(L);if(o.state.width!==f||o.state.height!==d||o.state.offsetWidth!==v||o.state.offsetHeight!==c){var a={width:f,height:d,offsetWidth:v,offsetHeight:c};o.setState(a),l&&Promise.resolve().then(function(){l(Object(de.a)(Object(de.a)({},a),{},{offsetWidth:v,offsetHeight:c}))})}},o.setChildNode=function(s){o.childNode=s},o}return Object(k.a)(u,[{key:"componentDidMount",value:function(){this.onComponentUpdated()}},{key:"componentDidUpdate",value:function(){this.onComponentUpdated()}},{key:"componentWillUnmount",value:function(){this.destroyObserver()}},{key:"onComponentUpdated",value:function(){var s=this.props.disabled;if(s){this.destroyObserver();return}var l=Object(B.a)(this.childNode||this),b=l!==this.currentElement;b&&(this.destroyObserver(),this.currentElement=l),!this.resizeObserver&&l&&(this.resizeObserver=new T.default(this.onResize),this.resizeObserver.observe(l))}},{key:"destroyObserver",value:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"render",value:function(){var s=this.props.children,l=Object(P.a)(s);if(l.length>1)Object(R.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(l.length===0)return Object(R.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var b=l[0];if(M.isValidElement(b)&&Object(y.c)(b)){var p=b.ref;l[0]=M.cloneElement(b,{ref:Object(y.a)(p,this.setChildNode)})}return l.length===1?l[0]:l.map(function(h,L){return!M.isValidElement(h)||"key"in h&&h.key!==null?h:M.cloneElement(h,{key:"".concat(_,"-").concat(L)})})}}]),u}(M.Component);O.displayName="ResizeObserver",ct.a=O},ulZh:function(Ot,ct,le){typeof window!="undefined"&&function(X,k){Ot.exports=k()}(this,function(){return function(de){var X={};function k(H){if(X[H])return X[H].exports;var C=X[H]={i:H,l:!1,exports:{}};return de[H].call(C.exports,C,C.exports,k),C.l=!0,C.exports}return k.m=de,k.c=X,k.d=function(H,C,M){k.o(H,C)||Object.defineProperty(H,C,{enumerable:!0,get:M})},k.r=function(H){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(H,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(H,"__esModule",{value:!0})},k.t=function(H,C){if(C&1&&(H=k(H)),C&8)return H;if(C&4&&typeof H=="object"&&H&&H.__esModule)return H;var M=Object.create(null);if(k.r(M),Object.defineProperty(M,"default",{enumerable:!0,value:H}),C&2&&typeof H!="string")for(var W in H)k.d(M,W,function(B){return H[B]}.bind(null,W));return M},k.n=function(H){var C=H&&H.__esModule?function(){return H.default}:function(){return H};return k.d(C,"a",C),C},k.o=function(H,C){return Object.prototype.hasOwnProperty.call(H,C)},k.p="/dist/",k(k.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(de,X,k){"use strict";var H=Object.prototype.hasOwnProperty,C="~";function M(){}Object.create&&(M.prototype=Object.create(null),new M().__proto__||(C=!1));function W(y,T,_){this.fn=y,this.context=T,this.once=_||!1}function B(y,T,_,O,w){if(typeof _!="function")throw new TypeError("The listener must be a function");var g=new W(_,O||y,w),u=C?C+T:T;return y._events[u]?y._events[u].fn?y._events[u]=[y._events[u],g]:y._events[u].push(g):(y._events[u]=g,y._eventsCount++),y}function P(y,T){--y._eventsCount===0?y._events=new M:delete y._events[T]}function R(){this._events=new M,this._eventsCount=0}R.prototype.eventNames=function(){var T=[],_,O;if(this._eventsCount===0)return T;for(O in _=this._events)H.call(_,O)&&T.push(C?O.slice(1):O);return Object.getOwnPropertySymbols?T.concat(Object.getOwnPropertySymbols(_)):T},R.prototype.listeners=function(T){var _=C?C+T:T,O=this._events[_];if(!O)return[];if(O.fn)return[O.fn];for(var w=0,g=O.length,u=new Array(g);w<g;w++)u[w]=O[w].fn;return u},R.prototype.listenerCount=function(T){var _=C?C+T:T,O=this._events[_];return O?O.fn?1:O.length:0},R.prototype.emit=function(T,_,O,w,g,u){var o=C?C+T:T;if(!this._events[o])return!1;var s=this._events[o],l=arguments.length,b,p;if(s.fn){s.once&&this.removeListener(T,s.fn,void 0,!0);switch(l){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,_),!0;case 3:return s.fn.call(s.context,_,O),!0;case 4:return s.fn.call(s.context,_,O,w),!0;case 5:return s.fn.call(s.context,_,O,w,g),!0;case 6:return s.fn.call(s.context,_,O,w,g,u),!0}for(p=1,b=new Array(l-1);p<l;p++)b[p-1]=arguments[p];s.fn.apply(s.context,b)}else{var h=s.length,L;for(p=0;p<h;p++){s[p].once&&this.removeListener(T,s[p].fn,void 0,!0);switch(l){case 1:s[p].fn.call(s[p].context);break;case 2:s[p].fn.call(s[p].context,_);break;case 3:s[p].fn.call(s[p].context,_,O);break;case 4:s[p].fn.call(s[p].context,_,O,w);break;default:if(!b)for(L=1,b=new Array(l-1);L<l;L++)b[L-1]=arguments[L];s[p].fn.apply(s[p].context,b)}}}return!0},R.prototype.on=function(T,_,O){return B(this,T,_,O,!1)},R.prototype.once=function(T,_,O){return B(this,T,_,O,!0)},R.prototype.removeListener=function(T,_,O,w){var g=C?C+T:T;if(!this._events[g])return this;if(!_)return P(this,g),this;var u=this._events[g];if(u.fn)u.fn===_&&(!w||u.once)&&(!O||u.context===O)&&P(this,g);else{for(var o=0,s=[],l=u.length;o<l;o++)(u[o].fn!==_||w&&!u[o].once||O&&u[o].context!==O)&&s.push(u[o]);s.length?this._events[g]=s.length===1?s[0]:s:P(this,g)}return this},R.prototype.removeAllListeners=function(T){var _;return T?(_=C?C+T:T,this._events[_]&&P(this,_)):(this._events=new M,this._eventsCount=0),this},R.prototype.off=R.prototype.removeListener,R.prototype.addListener=R.prototype.on,R.prefixed=C,R.EventEmitter=R,de.exports=R},"./node_modules/url-toolkit/src/url-toolkit.js":function(de,X,k){(function(H){var C=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,M=/^([^\/?#]*)([^]*)$/,W=/(?:\/|^)\.(?=\/)/g,B=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,P={buildAbsoluteURL:function(R,y,T){if(T=T||{},R=R.trim(),y=y.trim(),!y){if(!T.alwaysNormalize)return R;var _=P.parseURL(R);if(!_)throw new Error("Error trying to parse base URL.");return _.path=P.normalizePath(_.path),P.buildURLFromParts(_)}var O=P.parseURL(y);if(!O)throw new Error("Error trying to parse relative URL.");if(O.scheme)return T.alwaysNormalize?(O.path=P.normalizePath(O.path),P.buildURLFromParts(O)):y;var w=P.parseURL(R);if(!w)throw new Error("Error trying to parse base URL.");if(!w.netLoc&&w.path&&w.path[0]!=="/"){var g=M.exec(w.path);w.netLoc=g[1],w.path=g[2]}w.netLoc&&!w.path&&(w.path="/");var u={scheme:w.scheme,netLoc:O.netLoc,path:null,params:O.params,query:O.query,fragment:O.fragment};if(!O.netLoc&&(u.netLoc=w.netLoc,O.path[0]!=="/"))if(!O.path)u.path=w.path,O.params||(u.params=w.params,O.query||(u.query=w.query));else{var o=w.path,s=o.substring(0,o.lastIndexOf("/")+1)+O.path;u.path=P.normalizePath(s)}return u.path===null&&(u.path=T.alwaysNormalize?P.normalizePath(O.path):O.path),P.buildURLFromParts(u)},parseURL:function(R){var y=C.exec(R);return y?{scheme:y[1]||"",netLoc:y[2]||"",path:y[3]||"",params:y[4]||"",query:y[5]||"",fragment:y[6]||""}:null},normalizePath:function(R){for(R=R.split("").reverse().join("").replace(W,"");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}};de.exports=P})(this)},"./node_modules/webworkify-webpack/index.js":function(de,X,k){function H(T){var _={};function O(g){if(_[g])return _[g].exports;var u=_[g]={i:g,l:!1,exports:{}};return T[g].call(u.exports,u,u.exports,O),u.l=!0,u.exports}O.m=T,O.c=_,O.i=function(g){return g},O.d=function(g,u,o){O.o(g,u)||Object.defineProperty(g,u,{configurable:!1,enumerable:!0,get:o})},O.r=function(g){Object.defineProperty(g,"__esModule",{value:!0})},O.n=function(g){var u=g&&g.__esModule?function(){return g.default}:function(){return g};return O.d(u,"a",u),u},O.o=function(g,u){return Object.prototype.hasOwnProperty.call(g,u)},O.p="/",O.oe=function(g){throw console.error(g),g};var w=O(O.s=ENTRY_MODULE);return w.default||w}var C="[\\.|\\-|\\+|\\w|/|@]+",M="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+C+").*?\\)";function W(T){return(T+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function B(T){return!isNaN(1*T)}function P(T,_,O){var w={};w[O]=[];var g=_.toString(),u=g.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!u)return w;for(var o=u[1],s=new RegExp("(\\\\n|\\W)"+W(o)+M,"g"),l;l=s.exec(g);){if(l[3]==="dll-reference")continue;w[O].push(l[3])}for(s=new RegExp("\\("+W(o)+'\\("(dll-reference\\s('+C+'))"\\)\\)'+M,"g");l=s.exec(g);)T[l[2]]||(w[O].push(l[1]),T[l[2]]=k(l[1]).m),w[l[2]]=w[l[2]]||[],w[l[2]].push(l[4]);for(var b=Object.keys(w),p=0;p<b.length;p++)for(var h=0;h<w[b[p]].length;h++)B(w[b[p]][h])&&(w[b[p]][h]=1*w[b[p]][h]);return w}function R(T){var _=Object.keys(T);return _.reduce(function(O,w){return O||T[w].length>0},!1)}function y(T,_){for(var O={main:[_]},w={main:[]},g={main:{}};R(O);)for(var u=Object.keys(O),o=0;o<u.length;o++){var s=u[o],l=O[s],b=l.pop();if(g[s]=g[s]||{},g[s][b]||!T[s][b])continue;g[s][b]=!0,w[s]=w[s]||[],w[s].push(b);for(var p=P(T,T[s][b],s),h=Object.keys(p),L=0;L<h.length;L++)O[h[L]]=O[h[L]]||[],O[h[L]]=O[h[L]].concat(p[h[L]])}return w}de.exports=function(T,_){_=_||{};var O={main:k.m},w=_.all?{main:Object.keys(O.main)}:y(O,T),g="";Object.keys(w).filter(function(b){return b!=="main"}).forEach(function(b){for(var p=0;w[b][p];)p++;w[b].push(p),O[b][p]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",g=g+"var "+b+" = ("+H.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+w[b].map(function(h){return""+JSON.stringify(h)+": "+O[b][h].toString()}).join(",")+`});
|
|
`}),g=g+"new (("+H.toString().replace("ENTRY_MODULE",JSON.stringify(T))+")({"+w.main.map(function(b){return""+JSON.stringify(b)+": "+O.main[b].toString()}).join(",")+"}))(self);";var u=new window.Blob([g],{type:"text/javascript"});if(_.bare)return u;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,s=o.createObjectURL(u),l=new window.Worker(s);return l.objectURL=s,l}},"./src/config.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"hlsDefaultConfig",function(){return L}),k.d(X,"mergeConfig",function(){return c}),k.d(X,"enableStreamingMode",function(){return f});var H=k("./src/controller/abr-controller.ts"),C=k("./src/controller/audio-stream-controller.ts"),M=k("./src/controller/audio-track-controller.ts"),W=k("./src/controller/subtitle-stream-controller.ts"),B=k("./src/controller/subtitle-track-controller.ts"),P=k("./src/controller/buffer-controller.ts"),R=k("./src/controller/timeline-controller.ts"),y=k("./src/controller/cap-level-controller.ts"),T=k("./src/controller/fps-controller.ts"),_=k("./src/controller/eme-controller.ts"),O=k("./src/controller/cmcd-controller.ts"),w=k("./src/utils/xhr-loader.ts"),g=k("./src/utils/fetch-loader.ts"),u=k("./src/utils/cues.ts"),o=k("./src/utils/mediakeys-helper.ts"),s=k("./src/utils/logger.ts");function l(){return l=Object.assign||function(d){for(var a=1;a<arguments.length;a++){var x=arguments[a];for(var m in x)Object.prototype.hasOwnProperty.call(x,m)&&(d[m]=x[m])}return d},l.apply(this,arguments)}function b(d,a){var x=Object.keys(d);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(d);a&&(m=m.filter(function(S){return Object.getOwnPropertyDescriptor(d,S).enumerable})),x.push.apply(x,m)}return x}function p(d){for(var a=1;a<arguments.length;a++){var x=arguments[a]!=null?arguments[a]:{};a%2?b(Object(x),!0).forEach(function(m){h(d,m,x[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(x)):b(Object(x)).forEach(function(m){Object.defineProperty(d,m,Object.getOwnPropertyDescriptor(x,m))})}return d}function h(d,a,x){return a in d?Object.defineProperty(d,a,{value:x,enumerable:!0,configurable:!0,writable:!0}):d[a]=x,d}var L=p(p({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:w.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:H.default,bufferController:P.default,capLevelController:y.default,fpsController:T.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},v()),{},{subtitleStreamController:W.SubtitleStreamController,subtitleTrackController:B.default,timelineController:R.TimelineController,audioStreamController:C.default,audioTrackController:M.default,emeController:_.default,cmcdController:O.default});function v(){return{cueHandler:u.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function c(d,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return l({},d,a)}function f(d){var a=d.loader;if(a!==g.default&&a!==w.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),d.progressive=!1;else{var x=Object(g.fetchSupported)();x&&(d.loader=g.default,d.progressive=!0,d.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(de,X,k){"use strict";k.r(X);var H=k("./src/polyfills/number.ts"),C=k("./src/utils/ewma-bandwidth-estimator.ts"),M=k("./src/events.ts"),W=k("./src/utils/buffer-helper.ts"),B=k("./src/errors.ts"),P=k("./src/types/loader.ts"),R=k("./src/utils/logger.ts");function y(O,w){for(var g=0;g<w.length;g++){var u=w[g];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(O,u.key,u)}}function T(O,w,g){return w&&y(O.prototype,w),g&&y(O,g),O}var _=function(){function O(g){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=g;var u=g.config;this.bwEstimator=new C.default(u.abrEwmaSlowVoD,u.abrEwmaFastVoD,u.abrEwmaDefaultEstimate),this.registerListeners()}var w=O.prototype;return w.registerListeners=function(){var u=this.hls;u.on(M.Events.FRAG_LOADING,this.onFragLoading,this),u.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(M.Events.ERROR,this.onError,this)},w.unregisterListeners=function(){var u=this.hls;u.off(M.Events.FRAG_LOADING,this.onFragLoading,this),u.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(M.Events.ERROR,this.onError,this)},w.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},w.onFragLoading=function(u,o){var s=o.frag;if(s.type===P.PlaylistLevelType.MAIN&&!this.timer){var l;this.fragCurrent=s,this.partCurrent=(l=o.part)!=null?l:null,this.timer=self.setInterval(this.onCheck,100)}},w.onLevelLoaded=function(u,o){var s=this.hls.config;o.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},w._abandonRulesCheck=function(){var u=this.fragCurrent,o=this.partCurrent,s=this.hls,l=s.autoLevelEnabled,b=s.config,p=s.media;if(!u||!p)return;var h=o?o.stats:u.stats,L=o?o.duration:u.duration;if(h.aborted){R.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!l||p.paused||!p.playbackRate||!p.readyState)return;var v=performance.now()-h.loading.start,c=Math.abs(p.playbackRate);if(v<=500*L/c)return;var f=s.levels,d=s.minAutoLevel,a=f[u.level],x=h.total||Math.max(h.loaded,Math.round(L*a.maxBitrate/8)),m=Math.max(1,h.bwEstimate?h.bwEstimate/8:h.loaded*1e3/v),S=(x-h.loaded)/m,I=p.currentTime,z=(W.BufferHelper.bufferInfo(p,I,b.maxBufferHole).end-I)/c;if(z>=2*L/c||S<=z)return;var Y=Number.POSITIVE_INFINITY,ie;for(ie=u.level-1;ie>d;ie--){var G=f[ie].maxBitrate;if(Y=L*G/(8*.8*m),Y<z)break}if(Y>=S)return;var j=this.bwEstimator.getEstimate();R.logger.warn("Fragment "+u.sn+(o?" part "+o.index:"")+" of level "+u.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+ie+`
|
|
Current BW estimate: `+(Object(H.isFiniteNumber)(j)?(j/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+S.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+Y.toFixed(3)+` s
|
|
Time to underbuffer: `+z.toFixed(3)+" s"),s.nextLoadLevel=ie,this.bwEstimator.sample(v,h.loaded),this.clearTimer(),u.loader&&(this.fragCurrent=this.partCurrent=null,u.loader.abort()),s.trigger(M.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:u,part:o,stats:h})},w.onFragLoaded=function(u,o){var s=o.frag,l=o.part;if(s.type===P.PlaylistLevelType.MAIN&&Object(H.isFiniteNumber)(s.sn)){var b=l?l.stats:s.stats,p=l?l.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var h=this.hls.levels[s.level],L=(h.loaded?h.loaded.bytes:0)+b.loaded,v=(h.loaded?h.loaded.duration:0)+p;h.loaded={bytes:L,duration:v},h.realBitrate=Math.round(8*L/v)}if(s.bitrateTest){var c={stats:b,frag:s,part:l,id:s.type};this.onFragBuffered(M.Events.FRAG_BUFFERED,c),s.bitrateTest=!1}}},w.onFragBuffered=function(u,o){var s=o.frag,l=o.part,b=l?l.stats:s.stats;if(b.aborted)return;if(s.type!==P.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var p=b.parsing.end-b.loading.start;this.bwEstimator.sample(p,b.loaded),b.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=p/1e3:this.bitrateTestDelay=0},w.onError=function(u,o){switch(o.details){case B.ErrorDetails.FRAG_LOAD_ERROR:case B.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},w.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},w.getNextABRAutoLevel=function(){var u=this.fragCurrent,o=this.partCurrent,s=this.hls,l=s.maxAutoLevel,b=s.config,p=s.minAutoLevel,h=s.media,L=o?o.duration:u?u.duration:0,v=h?h.currentTime:0,c=h&&h.playbackRate!==0?Math.abs(h.playbackRate):1,f=this.bwEstimator?this.bwEstimator.getEstimate():b.abrEwmaDefaultEstimate,d=(W.BufferHelper.bufferInfo(h,v,b.maxBufferHole).end-v)/c,a=this.findBestLevel(f,p,l,d,b.abrBandWidthFactor,b.abrBandWidthUpFactor);if(a>=0)return a;R.logger.trace((d?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var x=L?Math.min(L,b.maxStarvationDelay):b.maxStarvationDelay,m=b.abrBandWidthFactor,S=b.abrBandWidthUpFactor;if(!d){var I=this.bitrateTestDelay;if(I){var z=L?Math.min(L,b.maxLoadingDelay):b.maxLoadingDelay;x=z-I,R.logger.trace("bitrate test took "+Math.round(1e3*I)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*x)+" ms"),m=S=1}}return a=this.findBestLevel(f,p,l,d+x,m,S),Math.max(a,0)},w.findBestLevel=function(u,o,s,l,b,p){for(var h,L=this.fragCurrent,v=this.partCurrent,c=this.lastLoadedFragLevel,f=this.hls.levels,d=f[c],a=!!(d!=null&&(h=d.details)!==null&&h!==void 0&&h.live),x=d==null?void 0:d.codecSet,m=v?v.duration:L?L.duration:0,S=s;S>=o;S--){var I=f[S];if(!I||x&&I.codecSet!==x)continue;var z=I.details,Y=(v?z==null?void 0:z.partTarget:z==null?void 0:z.averagetargetduration)||m,ie=void 0;S<=c?ie=b*u:ie=p*u;var G=f[S].maxBitrate,j=G*Y/ie;if(R.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+S+"/"+Math.round(ie)+"/"+G+"/"+Y+"/"+l+"/"+j),ie>G&&(!j||a&&!this.bitrateTestDelay||j<l))return S}return-1},T(O,[{key:"nextAutoLevel",get:function(){var u=this._nextAutoLevel,o=this.bwEstimator;if(u!==-1&&(!o||!o.canEstimate()))return u;var s=this.getNextABRAutoLevel();return u!==-1&&(s=Math.min(u,s)),s},set:function(u){this._nextAutoLevel=u}}]),O}();X.default=_},"./src/controller/audio-stream-controller.ts":function(de,X,k){"use strict";k.r(X);var H=k("./src/polyfills/number.ts"),C=k("./src/controller/base-stream-controller.ts"),M=k("./src/events.ts"),W=k("./src/utils/buffer-helper.ts"),B=k("./src/controller/fragment-tracker.ts"),P=k("./src/types/level.ts"),R=k("./src/types/loader.ts"),y=k("./src/loader/fragment.ts"),T=k("./src/demux/chunk-cache.ts"),_=k("./src/demux/transmuxer-interface.ts"),O=k("./src/types/transmuxer.ts"),w=k("./src/controller/fragment-finders.ts"),g=k("./src/utils/discontinuities.ts"),u=k("./src/errors.ts"),o=k("./src/utils/logger.ts");function s(){return s=Object.assign||function(L){for(var v=1;v<arguments.length;v++){var c=arguments[v];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(L[f]=c[f])}return L},s.apply(this,arguments)}function l(L,v){L.prototype=Object.create(v.prototype),L.prototype.constructor=L,b(L,v)}function b(L,v){return b=Object.setPrototypeOf||function(f,d){return f.__proto__=d,f},b(L,v)}var p=100,h=function(L){l(v,L);function v(f,d){var a;return a=L.call(this,f,d,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var c=v.prototype;return c.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},c._registerListeners=function(){var d=this.hls;d.on(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.on(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.on(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(M.Events.ERROR,this.onError,this),d.on(M.Events.BUFFER_RESET,this.onBufferReset,this),d.on(M.Events.BUFFER_CREATED,this.onBufferCreated,this),d.on(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.on(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},c._unregisterListeners=function(){var d=this.hls;d.off(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.off(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.off(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(M.Events.ERROR,this.onError,this),d.off(M.Events.BUFFER_RESET,this.onBufferReset,this),d.off(M.Events.BUFFER_CREATED,this.onBufferCreated,this),d.off(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},c.onInitPtsFound=function(d,a){var x=a.frag,m=a.id,S=a.initPTS;if(m==="main"){var I=x.cc;this.initPTS[x.cc]=S,this.log("InitPTS for cc: "+I+" found from main: "+S),this.videoTrackCC=I,this.state===C.State.WAITING_INIT_PTS&&this.tick()}},c.startLoad=function(d){if(!this.levels){this.startPosition=d,this.state=C.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(p),this.fragLoadError=0,a>0&&d===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=C.State.IDLE):(this.loadedmetadata=!1,this.state=C.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=d,this.tick()},c.doTick=function(){switch(this.state){case C.State.IDLE:this.doTickIdle();break;case C.State.WAITING_TRACK:{var d,a=this.levels,x=this.trackId,m=a==null||((d=a[x])===null||d===void 0)?void 0:d.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=C.State.WAITING_INIT_PTS}break}case C.State.FRAG_LOADING_WAITING_RETRY:{var S,I=performance.now(),z=this.retryDate;(!z||I>=z||(S=this.media)!==null&&S!==void 0&&S.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=C.State.IDLE);break}case C.State.WAITING_INIT_PTS:{var Y=this.waitingData;if(Y){var ie=Y.frag,G=Y.part,j=Y.cache,oe=Y.complete;if(this.initPTS[ie.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=C.State.FRAG_LOADING;var ye=j.flush(),Ce={frag:ie,part:G,payload:ye,networkDetails:null};this._handleFragmentLoadProgress(Ce),oe&&L.prototype._handleFragmentLoadComplete.call(this,Ce)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+ie.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var De=this.getLoadPosition(),Ye=W.BufferHelper.bufferInfo(this.mediaBuffer,De,this.config.maxBufferHole),Ie=Object(w.fragmentWithinToleranceTest)(Ye.end,this.config.maxFragLookUpTolerance,ie);Ie<0&&(o.logger.log("Waiting fragment cc ("+ie.cc+") @ "+ie.start+" cancelled because another fragment at "+Ye.end+" is needed"),this.clearWaitingFragment())}}else this.state=C.State.IDLE}}this.onTickEnd()},c.clearWaitingFragment=function(){var d=this.waitingData;d&&(this.fragmentTracker.removeFragment(d.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=C.State.IDLE)},c.onTickEnd=function(){var d=this.media;if(!d||!d.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:d,x=a.buffered;!this.loadedmetadata&&x.length&&(this.loadedmetadata=!0),this.lastCurrentTime=d.currentTime},c.doTickIdle=function(){var d,a,x=this.hls,m=this.levels,S=this.media,I=this.trackId,z=x.config;if(!m||!m[I])return;if(!S&&(this.startFragRequested||!z.startFragPrefetch))return;var Y=m[I],ie=Y.details;if(!ie||ie.live&&this.levelLastLoaded!==I||this.waitForCdnTuneIn(ie)){this.state=C.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,y.ElementaryStreamTypes.AUDIO,R.PlaylistLevelType.AUDIO));var G=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,R.PlaylistLevelType.AUDIO);if(G===null)return;var j=G.len,oe=this.getMaxBufferLength(),ye=this.audioSwitch;if(j>=oe&&!ye)return;if(!ye&&this._streamEnded(G,ie)){x.trigger(M.Events.BUFFER_EOS,{type:"audio"}),this.state=C.State.ENDED;return}var Ce=ie.fragments,De=Ce[0].start,Ye=G.end;if(ye){var Ie=this.getLoadPosition();Ye=Ie,ie.PTSKnown&&Ie<De&&((G.end>De||G.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),S.currentTime=De+.05))}var Ve=this.getNextFragment(Ye,ie);if(!Ve){this.bufferFlushed=!0;return}((d=Ve.decryptdata)===null||d===void 0?void 0:d.keyFormat)==="identity"&&!((a=Ve.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(Ve,ie):this.loadFragment(Ve,ie,Ye)},c.getMaxBufferLength=function(){var d=L.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,R.PlaylistLevelType.MAIN);return a===null?d:Math.max(d,a.len)},c.onMediaDetaching=function(){this.videoBuffer=null,L.prototype.onMediaDetaching.call(this)},c.onAudioTracksUpdated=function(d,a){var x=a.audioTracks;this.resetTransmuxer(),this.levels=x.map(function(m){return new P.Level(m)})},c.onAudioTrackSwitching=function(d,a){var x=!!a.url;this.trackId=a.id;var m=this.fragCurrent;m!=null&&m.loader&&m.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),x?this.setInterval(p):this.resetTransmuxer(),x?(this.audioSwitch=!0,this.state=C.State.IDLE):this.state=C.State.STOPPED,this.tick()},c.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},c.onLevelLoaded=function(d,a){this.mainDetails=a.details},c.onAudioTrackLoaded=function(d,a){var x,m=this.levels,S=a.details,I=a.id;if(!m){this.warn("Audio tracks were reset while loading level "+I);return}this.log("Track "+I+" loaded ["+S.startSN+","+S.endSN+"],duration:"+S.totalduration);var z=m[I],Y=0;if(S.live||(x=z.details)!==null&&x!==void 0&&x.live){var ie=this.mainDetails;if(S.fragments[0]||(S.deltaUpdateFailed=!0),S.deltaUpdateFailed||!ie)return;!z.details&&S.hasProgramDateTime&&ie.hasProgramDateTime?(Object(g.alignMediaPlaylistByPDT)(S,ie),Y=S.fragments[0].start):Y=this.alignPlaylists(S,z.details)}z.details=S,this.levelLastLoaded=I,!this.startFragRequested&&(this.mainDetails||!S.live)&&this.setStartPosition(z.details,Y),this.state===C.State.WAITING_TRACK&&!this.waitForCdnTuneIn(S)&&(this.state=C.State.IDLE),this.tick()},c._handleFragmentLoadProgress=function(d){var a,x=d.frag,m=d.part,S=d.payload,I=this.config,z=this.trackId,Y=this.levels;if(!Y){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+x.sn+" of level "+x.level+" will not be buffered");return}var ie=Y[z];console.assert(ie,"Audio track is defined on fragment load progress");var G=ie.details;console.assert(G,"Audio track details are defined on fragment load progress");var j=I.defaultAudioCodec||ie.audioCodec||"mp4a.40.2",oe=this.transmuxer;oe||(oe=this.transmuxer=new _.default(this.hls,R.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ye=this.initPTS[x.cc],Ce=(a=x.initSegment)===null||a===void 0?void 0:a.data;if(ye!==void 0){var De=!1,Ye=m?m.index:-1,Ie=Ye!==-1,Ve=new O.ChunkMetadata(x.level,x.sn,x.stats.chunkCount,S.byteLength,Ye,Ie);oe.push(S,Ce,j,"",x,m,G.totalduration,De,Ve,ye)}else{o.logger.log("Unknown video PTS for cc "+x.cc+", waiting for video PTS before demuxing audio frag "+x.sn+" of ["+G.startSN+" ,"+G.endSN+"],track "+z);var Ne=this.waitingData=this.waitingData||{frag:x,part:m,cache:new T.default,complete:!1},Ue=Ne.cache;Ue.push(new Uint8Array(S)),this.waitingVideoCC=this.videoTrackCC,this.state=C.State.WAITING_INIT_PTS}},c._handleFragmentLoadComplete=function(d){if(this.waitingData){this.waitingData.complete=!0;return}L.prototype._handleFragmentLoadComplete.call(this,d)},c.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},c.onBufferCreated=function(d,a){var x=a.tracks.audio;x&&(this.mediaBuffer=x.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},c.onFragBuffered=function(d,a){var x=a.frag,m=a.part;if(x.type!==R.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(x)){this.warn("Fragment "+x.sn+(m?" p: "+m.index:"")+" of level "+x.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}x.sn!=="initSegment"&&(this.fragPrevious=x,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(x,m)},c.onError=function(d,a){switch(a.details){case u.ErrorDetails.FRAG_LOAD_ERROR:case u.ErrorDetails.FRAG_LOAD_TIMEOUT:case u.ErrorDetails.KEY_LOAD_ERROR:case u.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.AUDIO,a);break;case u.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case u.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==C.State.ERROR&&this.state!==C.State.STOPPED&&(this.state=a.fatal?C.State.ERROR:C.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case u.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===C.State.PARSING||this.state===C.State.PARSED)){var x=!0,m=this.getFwdBufferInfo(this.mediaBuffer,R.PlaylistLevelType.AUDIO);m&&m.len>.5&&(x=!this.reduceMaxBufferLength(m.len)),x&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},c.onBufferFlushed=function(d,a){var x=a.type;x===y.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},c._handleTransmuxComplete=function(d){var a,x="audio",m=this.hls,S=d.remuxResult,I=d.chunkMeta,z=this.getCurrentContext(I);if(!z){this.warn("The loading context changed while buffering fragment "+I.sn+" of level "+I.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(I.level);return}var Y=z.frag,ie=z.part,G=S.audio,j=S.text,oe=S.id3,ye=S.initSegment;if(this.fragContextChanged(Y))return;if(this.state=C.State.PARSING,this.audioSwitch&&G&&this.completeAudioSwitch(),ye!=null&&ye.tracks&&(this._bufferInitSegment(ye.tracks,Y,I),m.trigger(M.Events.FRAG_PARSING_INIT_SEGMENT,{frag:Y,id:x,tracks:ye.tracks})),G){var Ce=G.startPTS,De=G.endPTS,Ye=G.startDTS,Ie=G.endDTS;ie&&(ie.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:Ce,endPTS:De,startDTS:Ye,endDTS:Ie}),Y.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,Ce,De,Ye,Ie),this.bufferFragmentData(G,Y,ie,I)}if(oe!=null&&(a=oe.samples)!==null&&a!==void 0&&a.length){var Ve=s({frag:Y,id:x},oe);m.trigger(M.Events.FRAG_PARSING_METADATA,Ve)}if(j){var Ne=s({frag:Y,id:x},j);m.trigger(M.Events.FRAG_PARSING_USERDATA,Ne)}},c._bufferInitSegment=function(d,a,x){if(this.state!==C.State.PARSING)return;d.video&&delete d.video;var m=d.audio;if(!m)return;m.levelCodec=m.codec,m.id="audio",this.log("Init audio buffer, container:"+m.container+", codecs[parsed]=["+m.codec+"]"),this.hls.trigger(M.Events.BUFFER_CODECS,d);var S=m.initSegment;if(S!=null&&S.byteLength){var I={type:"audio",frag:a,part:null,chunkMeta:x,parent:a.type,data:S};this.hls.trigger(M.Events.BUFFER_APPENDING,I)}this.tick()},c.loadFragment=function(d,a,x){var m=this.fragmentTracker.getState(d);this.fragCurrent=d,(this.audioSwitch||m===B.FragmentState.NOT_LOADED||m===B.FragmentState.PARTIAL)&&(d.sn==="initSegment"?this._loadInitSegment(d):a.live&&!Object(H.isFiniteNumber)(this.initPTS[d.cc])?(this.log("Waiting for video PTS in continuity counter "+d.cc+" of live stream before loading audio fragment "+d.sn+" of level "+this.trackId),this.state=C.State.WAITING_INIT_PTS):(this.startFragRequested=!0,L.prototype.loadFragment.call(this,d,a,x)))},c.completeAudioSwitch=function(){var d=this.hls,a=this.media,x=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,d.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:x})},v}(C.default);X.default=h},"./src/controller/audio-track-controller.ts":function(de,X,k){"use strict";k.r(X);var H=k("./src/events.ts"),C=k("./src/errors.ts"),M=k("./src/controller/base-playlist-controller.ts"),W=k("./src/types/loader.ts");function B(_,O){for(var w=0;w<O.length;w++){var g=O[w];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(_,g.key,g)}}function P(_,O,w){return O&&B(_.prototype,O),w&&B(_,w),_}function R(_,O){_.prototype=Object.create(O.prototype),_.prototype.constructor=_,y(_,O)}function y(_,O){return y=Object.setPrototypeOf||function(g,u){return g.__proto__=u,g},y(_,O)}var T=function(_){R(O,_);function O(g){var u;return u=_.call(this,g,"[audio-track-controller]")||this,u.tracks=[],u.groupId=null,u.tracksInGroup=[],u.trackId=-1,u.trackName="",u.selectDefaultTrack=!0,u.registerListeners(),u}var w=O.prototype;return w.registerListeners=function(){var u=this.hls;u.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),u.on(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.on(H.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(H.Events.ERROR,this.onError,this)},w.unregisterListeners=function(){var u=this.hls;u.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.off(H.Events.LEVEL_LOADING,this.onLevelLoading,this),u.off(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.off(H.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(H.Events.ERROR,this.onError,this)},w.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,_.prototype.destroy.call(this)},w.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},w.onManifestParsed=function(u,o){this.tracks=o.audioTracks||[]},w.onAudioTrackLoaded=function(u,o){var s=o.id,l=o.details,b=this.tracksInGroup[s];if(!b){this.warn("Invalid audio track id "+s);return}var p=b.details;b.details=o.details,this.log("audioTrack "+s+" loaded ["+l.startSN+"-"+l.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,o,p))},w.onLevelLoading=function(u,o){this.switchLevel(o.level)},w.onLevelSwitching=function(u,o){this.switchLevel(o.level)},w.switchLevel=function(u){var o=this.hls.levels[u];if(!(o!=null&&o.audioGroupIds))return;var s=o.audioGroupIds[o.urlId];if(this.groupId!==s){this.groupId=s;var l=this.tracks.filter(function(p){return!s||p.groupId===s});this.selectDefaultTrack&&!l.some(function(p){return p.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=l;var b={audioTracks:l};this.log("Updating audio tracks, "+l.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(H.Events.AUDIO_TRACKS_UPDATED,b),this.selectInitialTrack()}},w.onError=function(u,o){if(_.prototype.onError.call(this,u,o),o.fatal||!o.context)return;o.context.type===W.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},w.setAudioTrack=function(u){var o=this.tracksInGroup;if(u<0||u>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=o[this.trackId];this.log("Now switching to audio-track index "+u);var l=o[u],b=l.id,p=l.groupId,h=p===void 0?"":p,L=l.name,v=l.type,c=l.url;if(this.trackId=u,this.trackName=L,this.selectDefaultTrack=!1,this.hls.trigger(H.Events.AUDIO_TRACK_SWITCHING,{id:b,groupId:h,name:L,type:v,url:c}),l.details&&!l.details.live)return;var f=this.switchParams(l.url,s==null?void 0:s.details);this.loadPlaylist(f)},w.selectInitialTrack=function(){var u=this.tracksInGroup;console.assert(u.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,s=this.findTrackId(o)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(H.Events.ERROR,{type:C.ErrorTypes.MEDIA_ERROR,details:C.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},w.findTrackId=function(u){for(var o=this.tracksInGroup,s=0;s<o.length;s++){var l=o[s];if((!this.selectDefaultTrack||l.default)&&(!u||u===l.name))return l.id}return-1},w.loadPlaylist=function(u){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var s=o.id,l=o.groupId,b=o.url;if(u)try{b=u.addDirectives(b)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(H.Events.AUDIO_TRACK_LOADING,{url:b,id:s,groupId:l,deliveryDirectives:u||null})}},P(O,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(u){this.selectDefaultTrack=!1,this.setAudioTrack(u)}}]),O}(M.default);X.default=T},"./src/controller/base-playlist-controller.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"default",function(){return P});var H=k("./src/polyfills/number.ts"),C=k("./src/types/level.ts"),M=k("./src/controller/level-helper.ts"),W=k("./src/utils/logger.ts"),B=k("./src/errors.ts"),P=function(){function R(T,_){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=W.logger.log.bind(W.logger,_+":"),this.warn=W.logger.warn.bind(W.logger,_+":"),this.hls=T}var y=R.prototype;return y.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},y.onError=function(_,O){O.fatal&&O.type===B.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},y.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},y.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},y.stopLoad=function(){this.canLoad=!1,this.clearTimer()},y.switchParams=function(_,O){var w=O==null?void 0:O.renditionReports;if(w)for(var g=0;g<w.length;g++){var u=w[g],o=""+u.URI;if(o===_.substr(-o.length)){var s=parseInt(u["LAST-MSN"]),l=parseInt(u["LAST-PART"]);if(O&&this.hls.config.lowLatencyMode){var b=Math.min(O.age-O.partTarget,O.targetduration);l!==void 0&&b>O.partTarget&&(l+=1)}if(Object(H.isFiniteNumber)(s))return new C.HlsUrlParameters(s,Object(H.isFiniteNumber)(l)?l:void 0,C.HlsSkip.No)}}},y.loadPlaylist=function(_){},y.shouldLoadTrack=function(_){return this.canLoad&&_&&!!_.url&&(!_.details||_.details.live)},y.playlistLoaded=function(_,O,w){var g=this,u=O.details,o=O.stats,s=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(u.advancedDateTime=Date.now()-s,u.live||w!=null&&w.live){if(u.reloaded(w),w&&this.log("live playlist "+_+" "+(u.advanced?"REFRESHED "+u.lastPartSn+"-"+u.lastPartIndex:"MISSED")),w&&u.fragments.length>0&&Object(M.mergeDetails)(w,u),!this.canLoad||!u.live)return;var l,b=void 0,p=void 0;if(u.canBlockReload&&u.endSN&&u.advanced){var h=this.hls.config.lowLatencyMode,L=u.lastPartSn,v=u.endSN,c=u.lastPartIndex,f=c!==-1,d=L===v,a=h?0:c;f?(b=d?v+1:L,p=d?a:c+1):b=v+1;var x=u.age,m=x+u.ageHeader,S=Math.min(m-u.partTarget,u.targetduration*1.5);if(S>0){if(w&&S>w.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+w.tuneInGoal+" to: "+S+" with playlist age: "+u.age),S=0;else{var I=Math.floor(S/u.targetduration);if(b+=I,p!==void 0){var z=Math.round(S%u.targetduration/u.partTarget);p+=z}this.log("CDN Tune-in age: "+u.ageHeader+"s last advanced "+x.toFixed(2)+"s goal: "+S+" skip sn "+I+" to part "+p)}u.tuneInGoal=S}if(l=this.getDeliveryDirectives(u,O.deliveryDirectives,b,p),h||!d){this.loadPlaylist(l);return}}else l=this.getDeliveryDirectives(u,O.deliveryDirectives,b,p);var Y=Object(M.computeReloadInterval)(u,o);b!==void 0&&u.canBlockReload&&(Y-=u.partTarget||1),this.log("reload live playlist "+_+" in "+Math.round(Y)+" ms"),this.timer=self.setTimeout(function(){return g.loadPlaylist(l)},Y)}else this.clearTimer()},y.getDeliveryDirectives=function(_,O,w,g){var u=Object(C.getSkipValue)(_,w);return O!=null&&O.skip&&_.deltaUpdateFailed&&(w=O.msn,g=O.part,u=C.HlsSkip.No),new C.HlsUrlParameters(w,g,u)},y.retryLoadingOrFail=function(_){var O=this,w=this.hls.config,g=this.retryCount<w.levelLoadingMaxRetry;if(g){var u;if(this.retryCount++,_.details.indexOf("LoadTimeOut")>-1&&(u=_.context)!==null&&u!==void 0&&u.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+_.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*w.levelLoadingRetryDelay,w.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return O.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+_.details+'"')}}else this.warn('cannot recover from error "'+_.details+'"'),this.clearTimer(),_.fatal=!0;return g},R}()},"./src/controller/base-stream-controller.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"State",function(){return v}),k.d(X,"default",function(){return c});var H=k("./src/polyfills/number.ts"),C=k("./src/task-loop.ts"),M=k("./src/controller/fragment-tracker.ts"),W=k("./src/utils/buffer-helper.ts"),B=k("./src/utils/logger.ts"),P=k("./src/events.ts"),R=k("./src/errors.ts"),y=k("./src/types/transmuxer.ts"),T=k("./src/utils/mp4-tools.ts"),_=k("./src/utils/discontinuities.ts"),O=k("./src/controller/fragment-finders.ts"),w=k("./src/controller/level-helper.ts"),g=k("./src/loader/fragment-loader.ts"),u=k("./src/crypt/decrypter.ts"),o=k("./src/utils/time-ranges.ts"),s=k("./src/types/loader.ts");function l(f,d){for(var a=0;a<d.length;a++){var x=d[a];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(f,x.key,x)}}function b(f,d,a){return d&&l(f.prototype,d),a&&l(f,a),f}function p(f){if(f===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f}function h(f,d){f.prototype=Object.create(d.prototype),f.prototype.constructor=f,L(f,d)}function L(f,d){return L=Object.setPrototypeOf||function(x,m){return x.__proto__=m,x},L(f,d)}var v={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"},c=function(f){h(d,f);function d(x,m,S){var I;return I=f.call(this)||this,I.hls=void 0,I.fragPrevious=null,I.fragCurrent=null,I.fragmentTracker=void 0,I.transmuxer=null,I._state=v.STOPPED,I.media=void 0,I.mediaBuffer=void 0,I.config=void 0,I.bitrateTest=!1,I.lastCurrentTime=0,I.nextLoadPosition=0,I.startPosition=0,I.loadedmetadata=!1,I.fragLoadError=0,I.retryDate=0,I.levels=null,I.fragmentLoader=void 0,I.levelLastLoaded=null,I.startFragRequested=!1,I.decrypter=void 0,I.initPTS=[],I.onvseeking=null,I.onvended=null,I.logPrefix="",I.log=void 0,I.warn=void 0,I.logPrefix=S,I.log=B.logger.log.bind(B.logger,S+":"),I.warn=B.logger.warn.bind(B.logger,S+":"),I.hls=x,I.fragmentLoader=new g.default(x.config),I.fragmentTracker=m,I.config=x.config,I.decrypter=new u.default(x,x.config),x.on(P.Events.KEY_LOADED,I.onKeyLoaded,p(I)),I}var a=d.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(m){},a.stopLoad=function(){this.fragmentLoader.abort();var m=this.fragCurrent;m&&this.fragmentTracker.removeFragment(m),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=v.STOPPED},a._streamEnded=function(m,S){var I=this.fragCurrent,z=this.fragmentTracker;if(!S.live&&I&&I.sn===S.endSN&&!m.nextStart){var Y=z.getState(I);return Y===M.FragmentState.PARTIAL||Y===M.FragmentState.OK}return!1},a.onMediaAttached=function(m,S){var I=this.media=this.mediaBuffer=S.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),I.addEventListener("seeking",this.onvseeking),I.addEventListener("ended",this.onvended);var z=this.config;this.levels&&z.autoStartLoad&&this.state===v.STOPPED&&this.startLoad(z.startPosition)},a.onMediaDetaching=function(){var m=this.media;m!=null&&m.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),m&&(m.removeEventListener("seeking",this.onvseeking),m.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var m=this.config,S=this.fragCurrent,I=this.media,z=this.mediaBuffer,Y=this.state,ie=I?I.currentTime:0,G=W.BufferHelper.bufferInfo(z||I,ie,m.maxBufferHole);if(this.log("media seeking to "+(Object(H.isFiniteNumber)(ie)?ie.toFixed(3):ie)+", state: "+Y),Y===v.ENDED)this.resetLoadingState();else if(S&&!G.len){var j=m.maxFragLookUpTolerance,oe=S.start-j,ye=S.start+S.duration+j,Ce=ie>ye;(ie<oe||Ce)&&(Ce&&S.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),S.loader.abort()),this.resetLoadingState())}I&&(this.lastCurrentTime=ie),!this.loadedmetadata&&!G.len&&(this.nextLoadPosition=this.startPosition=ie),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(m,S){if(this.state!==v.KEY_LOADING||S.frag!==this.fragCurrent||!this.levels)return;this.state=v.IDLE;var I=this.levels[S.frag.level].details;I&&this.loadFragment(S.frag,I,S.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),f.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=v.STOPPED,this.hls.off(P.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,f.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(m,S){this.log("Loading key for "+m.sn+" of ["+S.startSN+"-"+S.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level),this.state=v.KEY_LOADING,this.fragCurrent=m,this.hls.trigger(P.Events.KEY_LOADING,{frag:m})},a.loadFragment=function(m,S,I){this._loadFragForPlayback(m,S,I)},a._loadFragForPlayback=function(m,S,I){var z=this,Y=function(G){if(z.fragContextChanged(m)){z.warn("Fragment "+m.sn+(G.part?" p: "+G.part.index:"")+" of level "+m.level+" was dropped during download."),z.fragmentTracker.removeFragment(m);return}m.stats.chunkCount++,z._handleFragmentLoadProgress(G)};this._doFragLoad(m,S,I,Y).then(function(ie){if(!ie)return;z.fragLoadError=0;var G=z.state;if(z.fragContextChanged(m)){(G===v.FRAG_LOADING||G===v.BACKTRACKING||!z.fragCurrent&&G===v.PARSING)&&(z.fragmentTracker.removeFragment(m),z.state=v.IDLE);return}if("payload"in ie&&(z.log("Loaded fragment "+m.sn+" of level "+m.level),z.hls.trigger(P.Events.FRAG_LOADED,ie),z.state===v.BACKTRACKING)){z.fragmentTracker.backtrack(m,ie),z.resetFragmentLoading(m);return}z._handleFragmentLoadComplete(ie)}).catch(function(ie){z.warn(ie),z.resetFragmentLoading(m)})},a.flushMainBuffer=function(m,S,I){if(I===void 0&&(I=null),!(m-S))return;var z={startOffset:m,endOffset:S,type:I};this.fragLoadError=0,this.hls.trigger(P.Events.BUFFER_FLUSHING,z)},a._loadInitSegment=function(m){var S=this;this._doFragLoad(m).then(function(I){if(!I||S.fragContextChanged(m)||!S.levels)throw new Error("init load aborted");return I}).then(function(I){var z=S.hls,Y=I.payload,ie=m.decryptdata;if(Y&&Y.byteLength>0&&ie&&ie.key&&ie.iv&&ie.method==="AES-128"){var G=self.performance.now();return S.decrypter.webCryptoDecrypt(new Uint8Array(Y),ie.key.buffer,ie.iv.buffer).then(function(j){var oe=self.performance.now();return z.trigger(P.Events.FRAG_DECRYPTED,{frag:m,payload:j,stats:{tstart:G,tdecrypt:oe}}),I.payload=j,I})}return I}).then(function(I){var z=S.fragCurrent,Y=S.hls,ie=S.levels;if(!ie)throw new Error("init load aborted, missing levels");var G=ie[m.level].details;console.assert(G,"Level details are defined when init segment is loaded");var j=m.stats;S.state=v.IDLE,S.fragLoadError=0,m.data=new Uint8Array(I.payload),j.parsing.start=j.buffering.start=self.performance.now(),j.parsing.end=j.buffering.end=self.performance.now(),I.frag===z&&Y.trigger(P.Events.FRAG_BUFFERED,{stats:j,frag:z,part:null,id:m.type}),S.tick()}).catch(function(I){S.warn(I),S.resetFragmentLoading(m)})},a.fragContextChanged=function(m){var S=this.fragCurrent;return!m||!S||m.level!==S.level||m.sn!==S.sn||m.urlId!==S.urlId},a.fragBufferedComplete=function(m,S){var I=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(S?" part: "+S.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+o.default.toString(W.BufferHelper.getBuffered(I))),this.state=v.IDLE,this.tick()},a._handleFragmentLoadComplete=function(m){var S=this.transmuxer;if(!S)return;var I=m.frag,z=m.part,Y=m.partsLoaded,ie=!Y||Y.length===0||Y.some(function(j){return!j}),G=new y.ChunkMetadata(I.level,I.sn,I.stats.chunkCount+1,0,z?z.index:-1,!ie);S.flush(G)},a._handleFragmentLoadProgress=function(m){},a._doFragLoad=function(m,S,I,z){var Y=this;if(I===void 0&&(I=null),!this.levels)throw new Error("frag load aborted, missing levels");if(I=Math.max(m.start,I||0),this.config.lowLatencyMode&&S){var ie=S.partList;if(ie&&z){I>m.end&&S.fragmentHint&&(m=S.fragmentHint);var G=this.getNextPart(ie,m,I);if(G>-1){var j=ie[G];return this.log("Loading part sn: "+m.sn+" p: "+j.index+" cc: "+m.cc+" of playlist ["+S.startSN+"-"+S.endSN+"] parts [0-"+G+"-"+(ie.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(I.toFixed(3))),this.nextLoadPosition=j.start+j.duration,this.state=v.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:m,part:ie[G],targetBufferTime:I}),this.doFragPartsLoad(m,ie,G,z).catch(function(oe){return Y.handleFragLoadError(oe)})}else if(!m.url||this.loadedEndOfParts(ie,I))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(S?"of ["+S.startSN+"-"+S.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(I.toFixed(3))),Object(H.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=v.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:m,targetBufferTime:I}),this.fragmentLoader.load(m,z).catch(function(oe){return Y.handleFragLoadError(oe)})},a.doFragPartsLoad=function(m,S,I,z){var Y=this;return new Promise(function(ie,G){var j=[],oe=function ye(Ce){var De=S[Ce];Y.fragmentLoader.loadPart(m,De,z).then(function(Ye){j[De.index]=Ye;var Ie=Ye.part;Y.hls.trigger(P.Events.FRAG_LOADED,Ye);var Ve=S[Ce+1];if(Ve&&Ve.fragment===m)ye(Ce+1);else return ie({frag:m,part:Ie,partsLoaded:j})}).catch(G)};oe(I)})},a.handleFragLoadError=function(m){var S=m.data;return S&&S.details===R.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(S.frag,S.part):this.hls.trigger(P.Events.ERROR,S),null},a._handleTransmuxerFlush=function(m){var S=this.getCurrentContext(m);if(!S||this.state!==v.PARSING){this.fragCurrent||(this.state=v.IDLE);return}var I=S.frag,z=S.part,Y=S.level,ie=self.performance.now();I.stats.parsing.end=ie,z&&(z.stats.parsing.end=ie),this.updateLevelTiming(I,z,Y,m.partial)},a.getCurrentContext=function(m){var S=this.levels,I=m.level,z=m.sn,Y=m.part;if(!S||!S[I])return this.warn("Levels object was unset while buffering fragment "+z+" of level "+I+". The current chunk will not be buffered."),null;var ie=S[I],G=Y>-1?Object(w.getPartWith)(ie,z,Y):null,j=G?G.fragment:Object(w.getFragmentWithSN)(ie,z,this.fragCurrent);return j?{frag:j,part:G,level:ie}:null},a.bufferFragmentData=function(m,S,I,z){if(!m||this.state!==v.PARSING)return;var Y=m.data1,ie=m.data2,G=Y;if(Y&&ie&&(G=Object(T.appendUint8Array)(Y,ie)),!G||!G.length)return;var j={type:m.type,frag:S,part:I,chunkMeta:z,parent:S.type,data:G};this.hls.trigger(P.Events.BUFFER_APPENDING,j),m.dropped&&m.independent&&!I&&this.flushBufferGap(S)},a.flushBufferGap=function(m){var S=this.media;if(!S)return;if(!W.BufferHelper.isBuffered(S,S.currentTime)){this.flushMainBuffer(0,m.start);return}var I=S.currentTime,z=W.BufferHelper.bufferInfo(S,I,0),Y=m.duration,ie=Math.min(this.config.maxFragLookUpTolerance*2,Y*.25),G=Math.max(Math.min(m.start-ie,z.end-ie),I+ie);m.start-G>ie&&this.flushMainBuffer(G,m.start)},a.getFwdBufferInfo=function(m,S){var I=this.config,z=this.getLoadPosition();if(!Object(H.isFiniteNumber)(z))return null;var Y=W.BufferHelper.bufferInfo(m,z,I.maxBufferHole);if(Y.len===0&&Y.nextStart!==void 0){var ie=this.fragmentTracker.getBufferedFrag(z,S);if(ie&&Y.nextStart<ie.end)return W.BufferHelper.bufferInfo(m,z,Math.max(Y.nextStart,I.maxBufferHole))}return Y},a.getMaxBufferLength=function(m){var S=this.config,I;return m?I=Math.max(8*S.maxBufferSize/m,S.maxBufferLength):I=S.maxBufferLength,Math.min(I,S.maxMaxBufferLength)},a.reduceMaxBufferLength=function(m){var S=this.config,I=m||S.maxBufferLength;return S.maxMaxBufferLength>=I?(S.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+S.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(m,S){var I,z,Y=S.fragments,ie=Y.length;if(!ie)return null;var G=this.config,j=Y[0].start,oe;if(S.live){var ye=G.initialLiveManifestSize;if(ie<ye)return this.warn("Not enough fragments to start playback (have: "+ie+", need: "+ye+")"),null;!S.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(oe=this.getInitialLiveFragment(S,Y),this.startPosition=oe?this.hls.liveSyncPosition||oe.start:m)}else m<=j&&(oe=Y[0]);if(!oe){var Ce=G.lowLatencyMode?S.partEnd:S.fragmentEnd;oe=this.getFragmentAtPosition(m,Ce,S)}return(I=oe)!==null&&I!==void 0&&I.initSegment&&!((z=oe)!==null&&z!==void 0&&z.initSegment.data)&&!this.bitrateTest&&(oe=oe.initSegment),oe},a.getNextPart=function(m,S,I){for(var z=-1,Y=!1,ie=!0,G=0,j=m.length;G<j;G++){var oe=m[G];if(ie=ie&&!oe.independent,z>-1&&I<oe.start)break;var ye=oe.loaded;!ye&&(Y||oe.independent||ie)&&oe.fragment===S&&(z=G),Y=ye}return z},a.loadedEndOfParts=function(m,S){var I=m[m.length-1];return I&&S>I.start&&I.loaded},a.getInitialLiveFragment=function(m,S){var I=this.fragPrevious,z=null;if(I){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+I.programDateTime),z=Object(O.findFragmentByPDT)(S,I.endProgramDateTime,this.config.maxFragLookUpTolerance)),!z){var Y=I.sn+1;if(Y>=m.startSN&&Y<=m.endSN){var ie=S[Y-m.startSN];I.cc===ie.cc&&(z=ie,this.log("Live playlist, switching playlist, load frag with next SN: "+z.sn))}z||(z=Object(O.findFragWithCC)(S,I.cc),z&&this.log("Live playlist, switching playlist, load frag with same CC: "+z.sn))}}else{var G=this.hls.liveSyncPosition;G!==null&&(z=this.getFragmentAtPosition(G,this.bitrateTest?m.fragmentEnd:m.edge,m))}return z},a.getFragmentAtPosition=function(m,S,I){var z=this.config,Y=this.fragPrevious,ie=I.fragments,G=I.endSN,j=I.fragmentHint,oe=z.maxFragLookUpTolerance,ye=!!(z.lowLatencyMode&&I.partList&&j);ye&&j&&!this.bitrateTest&&(ie=ie.concat(j),G=j.sn);var Ce;if(m<S){var De=m>S-oe?0:oe;Ce=Object(O.findFragmentByPTS)(Y,ie,m,De)}else Ce=ie[ie.length-1];if(Ce){var Ye=Ce.sn-I.startSN,Ie=Y&&Ce.level===Y.level,Ve=ie[Ye+1],Ne=this.fragmentTracker.getState(Ce);if(Ne===M.FragmentState.BACKTRACKED){Ce=null;for(var Ue=Ye;ie[Ue]&&this.fragmentTracker.getState(ie[Ue])===M.FragmentState.BACKTRACKED;)Y?Ce=ie[Ue--]:Ce=ie[--Ue];Ce||(Ce=Ve)}else Y&&Ce.sn===Y.sn&&!ye&&(Ie&&(Ce.sn<G&&this.fragmentTracker.getState(Ve)!==M.FragmentState.OK?(this.log("SN "+Ce.sn+" just loaded, load next one: "+Ve.sn),Ce=Ve):Ce=null))}return Ce},a.synchronizeToLiveEdge=function(m){var S=this.config,I=this.media;if(!I)return;var z=this.hls.liveSyncPosition,Y=I.currentTime,ie=m.fragments[0].start,G=m.edge,j=Y>=ie-S.maxFragLookUpTolerance&&Y<=G;if(z!==null&&I.duration>z&&(Y<z||!j)){var oe=S.liveMaxLatencyDuration!==void 0?S.liveMaxLatencyDuration:S.liveMaxLatencyDurationCount*m.targetduration;(!j&&I.readyState<4||Y<G-oe)&&(this.loadedmetadata||(this.nextLoadPosition=z),I.readyState&&(this.warn("Playback: "+Y.toFixed(3)+" is located too far from the end of live sliding playlist: "+G+", reset currentTime to : "+z.toFixed(3)),I.currentTime=z))}},a.alignPlaylists=function(m,S){var I=this.levels,z=this.levelLastLoaded,Y=this.fragPrevious,ie=z!==null?I[z]:null,G=m.fragments.length;if(!G)return this.warn("No fragments in live playlist"),0;var j=m.fragments[0].start,oe=!S,ye=m.alignedSliding&&Object(H.isFiniteNumber)(j);if(oe||!ye&&!j){Object(_.alignStream)(Y,ie,m);var Ce=m.fragments[0].start;return this.log("Live playlist sliding: "+Ce.toFixed(2)+" start-sn: "+(S?S.startSN:"na")+"->"+m.startSN+" prev-sn: "+(Y?Y.sn:"na")+" fragments: "+G),Ce}return j},a.waitForCdnTuneIn=function(m){var S=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*S)},a.setStartPosition=function(m,S){var I=this.startPosition;if(I<S&&(I=-1),I===-1||this.lastCurrentTime===-1){var z=m.startTimeOffset;Object(H.isFiniteNumber)(z)?(I=S+z,z<0&&(I+=m.totalduration),I=Math.min(Math.max(S,I),S+m.totalduration),this.log("Start time offset "+z+" found in playlist, adjust startPosition to "+I),this.startPosition=I):m.live?I=this.hls.liveSyncPosition||S:this.startPosition=I=0,this.lastCurrentTime=I}this.nextLoadPosition=I},a.getLoadPosition=function(){var m=this.media,S=0;return this.loadedmetadata&&m?S=m.currentTime:this.nextLoadPosition&&(S=this.nextLoadPosition),S},a.handleFragLoadAborted=function(m,S){this.transmuxer&&m.sn!=="initSegment"&&m.stats.aborted&&(this.warn("Fragment "+m.sn+(S?" part"+S.index:"")+" of level "+m.level+" was aborted"),this.resetFragmentLoading(m))},a.resetFragmentLoading=function(m){(!this.fragCurrent||!this.fragContextChanged(m))&&(this.state=v.IDLE)},a.onFragmentOrKeyLoadError=function(m,S){if(S.fatal)return;var I=S.frag;if(!I||I.type!==m)return;var z=this.fragCurrent;console.assert(z&&I.sn===z.sn&&I.level===z.level&&I.urlId===z.urlId,"Frag load error must match current frag to retry");var Y=this.config;if(this.fragLoadError+1<=Y.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(I.level))return;var ie=Math.min(Math.pow(2,this.fragLoadError)*Y.fragLoadingRetryDelay,Y.fragLoadingMaxRetryTimeout);this.warn("Fragment "+I.sn+" of "+m+" "+I.level+" failed to load, retrying in "+ie+"ms"),this.retryDate=self.performance.now()+ie,this.fragLoadError++,this.state=v.FRAG_LOADING_WAITING_RETRY}else S.levelRetry?(m===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=v.IDLE):(B.logger.error(S.details+" reaches max retry, redispatch as fatal ..."),S.fatal=!0,this.hls.stopLoad(),this.state=v.ERROR)},a.afterBufferFlushed=function(m,S,I){if(!m)return;var z=W.BufferHelper.getBuffered(m);this.fragmentTracker.detectEvictedFragments(S,z,I),this.state===v.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=v.IDLE},a.resetLiveStartWhenNotLoaded=function(m){if(!this.loadedmetadata){this.startFragRequested=!1;var S=this.levels?this.levels[m].details:null;if(S!=null&&S.live)return this.startPosition=-1,this.setStartPosition(S,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(m,S,I,z){var Y=this,ie=I.details;console.assert(!!ie,"level.details must be defined");var G=Object.keys(m.elementaryStreams).reduce(function(j,oe){var ye=m.elementaryStreams[oe];if(ye){var Ce=ye.endPTS-ye.startPTS;if(Ce<=0)return Y.warn("Could not parse fragment "+m.sn+" "+oe+" duration reliably ("+Ce+") resetting transmuxer to fallback to playlist timing"),Y.resetTransmuxer(),j||!1;var De=z?0:Object(w.updateFragPTSDTS)(ie,m,ye.startPTS,ye.endPTS,ye.startDTS,ye.endDTS);return Y.hls.trigger(P.Events.LEVEL_PTS_UPDATED,{details:ie,level:I,drift:De,type:oe,frag:m,start:ye.startPTS,end:ye.endPTS}),!0}return j},!1);G?(this.state=v.PARSED,this.hls.trigger(P.Events.FRAG_PARSED,{frag:m,part:S})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},b(d,[{key:"state",get:function(){return this._state},set:function(m){var S=this._state;S!==m&&(this._state=m,this.log(S+"->"+m))}}]),d}(C.default)},"./src/controller/buffer-controller.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"default",function(){return O});var H=k("./src/polyfills/number.ts"),C=k("./src/events.ts"),M=k("./src/utils/logger.ts"),W=k("./src/errors.ts"),B=k("./src/utils/buffer-helper.ts"),P=k("./src/utils/mediasource-helper.ts"),R=k("./src/loader/fragment.ts"),y=k("./src/controller/buffer-operation-queue.ts"),T=Object(P.getMediaSource)(),_=/([ha]vc.)(?:\.[^.,]+)+/,O=function(){function w(u){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var s=o.hls,l=o.media,b=o.mediaSource;M.logger.log("[buffer-controller]: Media source opened"),l&&(o.updateMediaElementDuration(),s.trigger(C.Events.MEDIA_ATTACHED,{media:l})),b&&b.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){M.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){M.logger.log("[buffer-controller]: Media source ended")},this.hls=u,this._initSourceBuffer(),this.registerListeners()}var g=w.prototype;return g.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},g.destroy=function(){this.unregisterListeners(),this.details=null},g.registerListeners=function(){var o=this.hls;o.on(C.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(C.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(C.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(C.Events.BUFFER_RESET,this.onBufferReset,this),o.on(C.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(C.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(C.Events.BUFFER_EOS,this.onBufferEos,this),o.on(C.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(C.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(C.Events.FRAG_PARSED,this.onFragParsed,this),o.on(C.Events.FRAG_CHANGED,this.onFragChanged,this)},g.unregisterListeners=function(){var o=this.hls;o.off(C.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(C.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(C.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(C.Events.BUFFER_RESET,this.onBufferReset,this),o.off(C.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(C.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(C.Events.BUFFER_EOS,this.onBufferEos,this),o.off(C.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(C.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(C.Events.FRAG_PARSED,this.onFragParsed,this),o.off(C.Events.FRAG_CHANGED,this.onFragChanged,this)},g._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new y.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},g.onManifestParsed=function(o,s){var l=2;(s.audio&&!s.video||!s.altAudio)&&(l=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=l,this.details=null,M.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},g.onMediaAttaching=function(o,s){var l=this.media=s.media;if(l&&T){var b=this.mediaSource=new T;b.addEventListener("sourceopen",this._onMediaSourceOpen),b.addEventListener("sourceended",this._onMediaSourceEnded),b.addEventListener("sourceclose",this._onMediaSourceClose),l.src=self.URL.createObjectURL(b),this._objectUrl=l.src}},g.onMediaDetaching=function(){var o=this.media,s=this.mediaSource,l=this._objectUrl;if(s){if(M.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(b){M.logger.warn("[buffer-controller]: onMediaDetaching: "+b.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(l&&self.URL.revokeObjectURL(l),o.src===l?(o.removeAttribute("src"),o.load()):M.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(C.Events.MEDIA_DETACHED,void 0)},g.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(s){var l=o.sourceBuffer[s];try{l&&(o.removeBufferListeners(s),o.mediaSource&&o.mediaSource.removeSourceBuffer(l),o.sourceBuffer[s]=void 0)}catch(b){M.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",b)}}),this._initSourceBuffer()},g.onBufferCodecs=function(o,s){var l=this,b=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(p){if(b){var h=l.tracks[p];if(h&&typeof h.buffer.changeType=="function"){var L=s[p],v=L.codec,c=L.levelCodec,f=L.container,d=(h.levelCodec||h.codec).replace(_,"$1"),a=(c||v).replace(_,"$1");if(d!==a){var x=f+";codecs="+(c||v);l.appendChangeType(p,x)}}}else l.pendingTracks[p]=s[p]}),b)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},g.appendChangeType=function(o,s){var l=this,b=this.operationQueue,p={execute:function(){var L=l.sourceBuffer[o];L&&(M.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+s),L.changeType(s)),b.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(L){M.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",L)}};b.append(p,o)},g.onBufferAppending=function(o,s){var l=this,b=this.hls,p=this.operationQueue,h=this.tracks,L=s.data,v=s.type,c=s.frag,f=s.part,d=s.chunkMeta,a=d.buffering[v],x=self.performance.now();a.start=x;var m=c.stats.buffering,S=f?f.stats.buffering:null;m.start===0&&(m.start=x),S&&S.start===0&&(S.start=x);var I=h.audio,z=v==="audio"&&d.id===1&&(I==null?void 0:I.container)==="audio/mpeg",Y={execute:function(){if(a.executeStart=self.performance.now(),z){var G=l.sourceBuffer[v];if(G){var j=c.start-G.timestampOffset;Math.abs(j)>=.1&&(M.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+c.start+" (delta: "+j+") sn: "+c.sn+")"),G.timestampOffset=c.start)}}l.appendExecutor(L,v)},onStart:function(){},onComplete:function(){var G=self.performance.now();a.executeEnd=a.end=G,m.first===0&&(m.first=G),S&&S.first===0&&(S.first=G);var j=l.sourceBuffer,oe={};for(var ye in j)oe[ye]=B.BufferHelper.getBuffered(j[ye]);l.appendError=0,l.hls.trigger(C.Events.BUFFER_APPENDED,{type:v,frag:c,part:f,chunkMeta:d,parent:c.type,timeRanges:oe})},onError:function(G){M.logger.error("[buffer-controller]: Error encountered while trying to append to the "+v+" SourceBuffer",G);var j={type:W.ErrorTypes.MEDIA_ERROR,parent:c.type,details:W.ErrorDetails.BUFFER_APPEND_ERROR,err:G,fatal:!1};G.code===DOMException.QUOTA_EXCEEDED_ERR?j.details=W.ErrorDetails.BUFFER_FULL_ERROR:(l.appendError++,j.details=W.ErrorDetails.BUFFER_APPEND_ERROR,l.appendError>b.config.appendErrorMaxRetry&&(M.logger.error("[buffer-controller]: Failed "+b.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),j.fatal=!0)),b.trigger(C.Events.ERROR,j)}};p.append(Y,v)},g.onBufferFlushing=function(o,s){var l=this,b=this.operationQueue,p=function(L){return{execute:l.removeExecutor.bind(l,L,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){l.hls.trigger(C.Events.BUFFER_FLUSHED,{type:L})},onError:function(c){M.logger.warn("[buffer-controller]: Failed to remove from "+L+" SourceBuffer",c)}}};s.type?b.append(p(s.type),s.type):this.getSourceBufferTypes().forEach(function(h){b.append(p(h),h)})},g.onFragParsed=function(o,s){var l=this,b=s.frag,p=s.part,h=[],L=p?p.elementaryStreams:b.elementaryStreams;L[R.ElementaryStreamTypes.AUDIOVIDEO]?h.push("audiovideo"):(L[R.ElementaryStreamTypes.AUDIO]&&h.push("audio"),L[R.ElementaryStreamTypes.VIDEO]&&h.push("video"));var v=function(){var f=self.performance.now();b.stats.buffering.end=f,p&&(p.stats.buffering.end=f);var d=p?p.stats:b.stats;l.hls.trigger(C.Events.FRAG_BUFFERED,{frag:b,part:p,stats:d,id:b.type})};h.length===0&&M.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+b.type+" level: "+b.level+" sn: "+b.sn),this.blockBuffers(v,h)},g.onFragChanged=function(o,s){this.flushBackBuffer()},g.onBufferEos=function(o,s){var l=this,b=this.getSourceBufferTypes().reduce(function(p,h){var L=l.sourceBuffer[h];return(!s.type||s.type===h)&&(L&&!L.ended&&(L.ended=!0,M.logger.log("[buffer-controller]: "+h+" sourceBuffer now EOS"))),p&&!!(!L||L.ended)},!0);b&&this.blockBuffers(function(){var p=l.mediaSource;if(!p||p.readyState!=="open")return;p.endOfStream()})},g.onLevelUpdated=function(o,s){var l=s.details;if(!l.fragments.length)return;this.details=l,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},g.flushBackBuffer=function(){var o=this.hls,s=this.details,l=this.media,b=this.sourceBuffer;if(!l||s===null)return;var p=this.getSourceBufferTypes();if(!p.length)return;var h=s.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(H.isFiniteNumber)(h)||h<0)return;var L=l.currentTime,v=s.levelTargetDuration,c=Math.max(h,v),f=Math.floor(L/v)*v-c;p.forEach(function(d){var a=b[d];if(a){var x=B.BufferHelper.getBuffered(a);x.length>0&&f>x.start(0)&&(o.trigger(C.Events.BACK_BUFFER_REACHED,{bufferEnd:f}),s.live&&o.trigger(C.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:f}),o.trigger(C.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:f,type:d}))}})},g.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,s=this.hls,l=this.media,b=this.mediaSource,p=o.fragments[0].start+o.totalduration,h=l.duration,L=Object(H.isFiniteNumber)(b.duration)?b.duration:0;o.live&&s.config.liveDurationInfinity?(M.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),b.duration=Infinity,this.updateSeekableRange(o)):(p>L&&p>h||!Object(H.isFiniteNumber)(h))&&(M.logger.log("[buffer-controller]: Updating Media Source duration to "+p.toFixed(3)),b.duration=p)},g.updateSeekableRange=function(o){var s=this.mediaSource,l=o.fragments,b=l.length;if(b&&o.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var p=Math.max(0,l[0].start),h=Math.max(p,p+o.totalduration);s.setLiveSeekableRange(p,h)}},g.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,s=this.operationQueue,l=this.pendingTracks,b=Object.keys(l).length;if(b&&!o||b===2){this.createSourceBuffers(l),this.pendingTracks={};var p=this.getSourceBufferTypes();if(p.length===0){this.hls.trigger(C.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}p.forEach(function(h){s.executeNext(h)})}},g.createSourceBuffers=function(o){var s=this.sourceBuffer,l=this.mediaSource;if(!l)throw Error("createSourceBuffers called when mediaSource was null");var b=0;for(var p in o)if(!s[p]){var h=o[p];if(!h)throw Error("source buffer exists for track "+p+", however track does not");var L=h.levelCodec||h.codec,v=h.container+";codecs="+L;M.logger.log("[buffer-controller]: creating sourceBuffer("+v+")");try{var c=s[p]=l.addSourceBuffer(v),f=p;this.addBufferListener(f,"updatestart",this._onSBUpdateStart),this.addBufferListener(f,"updateend",this._onSBUpdateEnd),this.addBufferListener(f,"error",this._onSBUpdateError),this.tracks[p]={buffer:c,codec:L,container:h.container,levelCodec:h.levelCodec,id:h.id},b++}catch(d){M.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+d.message),this.hls.trigger(C.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:d,mimeType:v})}}b&&this.hls.trigger(C.Events.BUFFER_CREATED,{tracks:this.tracks})},g._onSBUpdateStart=function(o){var s=this.operationQueue,l=s.current(o);l.onStart()},g._onSBUpdateEnd=function(o){var s=this.operationQueue,l=s.current(o);l.onComplete(),s.shiftAndExecuteNext(o)},g._onSBUpdateError=function(o,s){M.logger.error("[buffer-controller]: "+o+" SourceBuffer error",s),this.hls.trigger(C.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var l=this.operationQueue.current(o);l&&l.onError(s)},g.removeExecutor=function(o,s,l){var b=this.media,p=this.mediaSource,h=this.operationQueue,L=this.sourceBuffer,v=L[o];if(!b||!p||!v){M.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(o);return}var c=Object(H.isFiniteNumber)(b.duration)?b.duration:Infinity,f=Object(H.isFiniteNumber)(p.duration)?p.duration:Infinity,d=Math.max(0,s),a=Math.min(l,c,f);a>d?(M.logger.log("[buffer-controller]: Removing ["+d+","+a+"] from the "+o+" SourceBuffer"),console.assert(!v.updating,o+" sourceBuffer must not be updating"),v.remove(d,a)):h.shiftAndExecuteNext(o)},g.appendExecutor=function(o,s){var l=this.operationQueue,b=this.sourceBuffer,p=b[s];if(!p){M.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),l.shiftAndExecuteNext(s);return}p.ended=!1,console.assert(!p.updating,s+" sourceBuffer must not be updating"),p.appendBuffer(o)},g.blockBuffers=function(o,s){var l=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){M.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var b=this.operationQueue,p=s.map(function(h){return b.appendBlocker(h)});Promise.all(p).then(function(){o(),s.forEach(function(h){var L=l.sourceBuffer[h];(!L||!L.updating)&&b.shiftAndExecuteNext(h)})})},g.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},g.addBufferListener=function(o,s,l){var b=this.sourceBuffer[o];if(!b)return;var p=l.bind(this,o);this.listeners[o].push({event:s,listener:p}),b.addEventListener(s,p)},g.removeBufferListeners=function(o){var s=this.sourceBuffer[o];if(!s)return;this.listeners[o].forEach(function(l){s.removeEventListener(l.event,l.listener)})},w}()},"./src/controller/buffer-operation-queue.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"default",function(){return C});var H=k("./src/utils/logger.ts"),C=function(){function M(B){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=B}var W=M.prototype;return W.append=function(P,R){var y=this.queues[R];y.push(P),y.length===1&&this.buffers[R]&&this.executeNext(R)},W.insertAbort=function(P,R){var y=this.queues[R];y.unshift(P),this.executeNext(R)},W.appendBlocker=function(P){var R,y=new Promise(function(_){R=_}),T={execute:R,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(T,P),y},W.executeNext=function(P){var R=this.buffers,y=this.queues,T=R[P],_=y[P];if(_.length){var O=_[0];try{O.execute()}catch(w){H.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),O.onError(w),(!T||!T.updating)&&(_.shift(),this.executeNext(P))}}},W.shiftAndExecuteNext=function(P){this.queues[P].shift(),this.executeNext(P)},W.current=function(P){return this.queues[P][0]},M}()},"./src/controller/cap-level-controller.ts":function(de,X,k){"use strict";k.r(X);var H=k("./src/events.ts");function C(B,P){for(var R=0;R<P.length;R++){var y=P[R];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(B,y.key,y)}}function M(B,P,R){return P&&C(B.prototype,P),R&&C(B,R),B}var W=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 P=B.prototype;return P.setStreamController=function(y){this.streamController=y},P.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},P.registerListeners=function(){var y=this.hls;y.on(H.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.on(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.unregisterListener=function(){var y=this.hls;y.off(H.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),y.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),y.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),y.off(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),y.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.onFpsDropLevelCapping=function(y,T){B.isLevelAllowed(T.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(T.droppedLevel)},P.onMediaAttaching=function(y,T){this.media=T.media instanceof HTMLVideoElement?T.media:null},P.onManifestParsed=function(y,T){var _=this.hls;this.restrictedLevels=[],this.firstLevel=T.firstLevel,_.config.capLevelToPlayerSize&&T.video&&this.startCapping()},P.onBufferCodecs=function(y,T){var _=this.hls;_.config.capLevelToPlayerSize&&T.video&&this.startCapping()},P.onMediaDetaching=function(){this.stopCapping()},P.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var y=this.hls.levels;if(y.length){var T=this.hls;T.autoLevelCapping=this.getMaxLevel(y.length-1),T.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=T.autoLevelCapping}}},P.getMaxLevel=function(y){var T=this,_=this.hls.levels;if(!_.length)return-1;var O=_.filter(function(w,g){return B.isLevelAllowed(g,T.restrictedLevels)&&g<=y});return this.clientRect=null,B.getMaxLevelByMediaSize(O,this.mediaWidth,this.mediaHeight)},P.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()},P.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},P.getDimensions=function(){if(this.clientRect)return this.clientRect;var y=this.media,T={width:0,height:0};if(y){var _=y.getBoundingClientRect();T.width=_.width,T.height=_.height,!T.width&&!T.height&&(T.width=_.right-_.left||y.width||0,T.height=_.bottom-_.top||y.height||0)}return this.clientRect=T,T},B.isLevelAllowed=function(y,T){return T===void 0&&(T=[]),T.indexOf(y)===-1},B.getMaxLevelByMediaSize=function(y,T,_){if(!y||!y.length)return-1;for(var O=function(s,l){return l?s.width!==l.width||s.height!==l.height:!0},w=y.length-1,g=0;g<y.length;g+=1){var u=y[g];if((u.width>=T||u.height>=_)&&O(u,y[g+1])){w=g;break}}return w},M(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 y=1;try{y=self.devicePixelRatio}catch(T){}return y}}]),B}();X.default=W},"./src/controller/cmcd-controller.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"default",function(){return O});var H=k("./src/events.ts"),C=k("./src/types/cmcd.ts"),M=k("./src/utils/buffer-helper.ts"),W=k("./src/utils/logger.ts");function B(w,g){for(var u=0;u<g.length;u++){var o=g[u];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(w,o.key,o)}}function P(w,g,u){return g&&B(w.prototype,g),u&&B(w,u),w}function R(w,g){var u=typeof Symbol!="undefined"&&w[Symbol.iterator]||w["@@iterator"];if(u)return(u=u.call(w)).next.bind(u);if(Array.isArray(w)||(u=y(w))||g&&w&&typeof w.length=="number"){u&&(w=u);var o=0;return function(){return o>=w.length?{done:!0}:{done:!1,value:w[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y(w,g){if(!w)return;if(typeof w=="string")return T(w,g);var u=Object.prototype.toString.call(w).slice(8,-1);if(u==="Object"&&w.constructor&&(u=w.constructor.name),u==="Map"||u==="Set")return Array.from(w);if(u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u))return T(w,g)}function T(w,g){(g==null||g>w.length)&&(g=w.length);for(var u=0,o=new Array(g);u<g;u++)o[u]=w[u];return o}function _(){return _=Object.assign||function(w){for(var g=1;g<arguments.length;g++){var u=arguments[g];for(var o in u)Object.prototype.hasOwnProperty.call(u,o)&&(w[o]=u[o])}return w},_.apply(this,arguments)}var O=function(){function w(u){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(b){try{o.apply(b,{ot:C.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(p){W.logger.warn("Could not generate manifest CMCD data.",p)}},this.applyFragmentData=function(b){try{var p=b.frag,h=o.hls.levels[p.level],L=o.getObjectType(p),v={d:p.duration*1e3,ot:L};(L===C.CMCDObjectType.VIDEO||L===C.CMCDObjectType.AUDIO||L==C.CMCDObjectType.MUXED)&&(v.br=h.bitrate/1e3,v.tb=o.getTopBandwidth(L),v.bl=o.getBufferLength(L)),o.apply(b,v)}catch(c){W.logger.warn("Could not generate segment CMCD data.",c)}},this.hls=u;var s=this.config=u.config,l=s.cmcd;l!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=l.sessionId||w.uuid(),this.cid=l.contentId,this.useHeaders=l.useHeaders===!0,this.registerListeners())}var g=w.prototype;return g.registerListeners=function(){var o=this.hls;o.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(H.Events.BUFFER_CREATED,this.onBufferCreated,this)},g.unregisterListeners=function(){var o=this.hls;o.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(H.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},g.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},g.onMediaAttached=function(o,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},g.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},g.onBufferCreated=function(o,s){var l,b;this.audioBuffer=(l=s.tracks.audio)===null||l===void 0?void 0:l.buffer,this.videoBuffer=(b=s.tracks.video)===null||b===void 0?void 0:b.buffer},g.createData=function(){var o;return{v:C.CMCDVersion,sf:C.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},g.apply=function(o,s){s===void 0&&(s={}),_(s,this.createData());var l=s.ot===C.CMCDObjectType.INIT||s.ot===C.CMCDObjectType.VIDEO||s.ot===C.CMCDObjectType.MUXED;if(this.starved&&l&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var b=w.toHeaders(s);if(!Object.keys(b).length)return;o.headers||(o.headers={}),_(o.headers,b)}else{var p=w.toQuery(s);if(!p)return;o.url=w.appendQueryToUri(o.url,p)}},g.getObjectType=function(o){var s=o.type;return s==="subtitle"?C.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?C.CMCDObjectType.INIT:s==="audio"?C.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?C.CMCDObjectType.VIDEO:C.CMCDObjectType.MUXED:void 0},g.getTopBandwidth=function(o){for(var s=0,l=o===C.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,b=R(l),p;!(p=b()).done;){var h=p.value;h.bitrate>s&&(s=h.bitrate)}return s>0?s:NaN},g.getBufferLength=function(o){var s=this.hls.media,l=o===C.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!l||!s)return NaN;var b=M.BufferHelper.bufferInfo(l,s.currentTime,this.config.maxBufferHole);return b.len*1e3},g.createPlaylistLoader=function(){var o=this.config.pLoader,s=this.applyPlaylistData,l=o||this.config.loader;return function(){function b(h){this.loader=void 0,this.loader=new l(h)}var p=b.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(L,v,c){s(L),this.loader.load(L,v,c)},P(b,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),b}()},g.createFragmentLoader=function(){var o=this.config.fLoader,s=this.applyFragmentData,l=o||this.config.loader;return function(){function b(h){this.loader=void 0,this.loader=new l(h)}var p=b.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(L,v,c){s(L),this.loader.load(L,v,c)},P(b,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),b}()},w.uuid=function(){var o=URL.createObjectURL(new Blob),s=o.toString();return URL.revokeObjectURL(o),s.substr(s.lastIndexOf("/")+1)},w.serialize=function(o){for(var s=[],l=function(z){return!Number.isNaN(z)&&z!=null&&z!==""&&z!==!1},b=function(z){return Math.round(z)},p=function(z){return b(z/100)*100},h=function(z){return encodeURIComponent(z)},L={br:b,d:b,bl:p,dl:p,mtp:p,nor:h,rtp:p,tb:b},v=Object.keys(o||{}).sort(),c=R(v),f;!(f=c()).done;){var d=f.value,a=o[d];if(!l(a))continue;if(d==="v"&&a===1)continue;if(d=="pr"&&a===1)continue;var x=L[d];x&&(a=x(a));var m=typeof a,S=void 0;d==="ot"||d==="sf"||d==="st"?S=d+"="+a:m==="boolean"?S=d:m==="number"?S=d+"="+a:S=d+"="+JSON.stringify(a),s.push(S)}return s.join(",")},w.toHeaders=function(o){for(var s=Object.keys(o),l={},b=["Object","Request","Session","Status"],p=[{},{},{},{}],h={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},L=0,v=s;L<v.length;L++){var c=v[L],f=h[c]!=null?h[c]:1;p[f][c]=o[c]}for(var d=0;d<p.length;d++){var a=w.serialize(p[d]);a&&(l["CMCD-"+b[d]]=a)}return l},w.toQuery=function(o){return"CMCD="+encodeURIComponent(w.serialize(o))},w.appendQueryToUri=function(o,s){if(!s)return o;var l=o.includes("?")?"&":"?";return""+o+l+s},w}()},"./src/controller/eme-controller.ts":function(de,X,k){"use strict";k.r(X);var H=k("./src/events.ts"),C=k("./src/errors.ts"),M=k("./src/utils/logger.ts"),W=k("./src/utils/mediakeys-helper.ts");function B(O,w){for(var g=0;g<w.length;g++){var u=w[g];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(O,u.key,u)}}function P(O,w,g){return w&&B(O.prototype,w),g&&B(O,g),O}var R=3,y=function(w,g,u){var o={audioCapabilities:[],videoCapabilities:[]};return w.forEach(function(s){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:u.audioRobustness||""})}),g.forEach(function(s){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:u.videoRobustness||""})}),[o]},T=function(w,g,u,o){switch(w){case W.KeySystems.WIDEVINE:return y(g,u,o);default:throw new Error("Unknown key-system: "+w)}},_=function(){function O(g){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=g,this._config=g.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var w=O.prototype;return w.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},w._registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this)},w._unregisterListeners=function(){this.hls.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this)},w.getLicenseServerUrl=function(u){switch(u){case W.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+u+'"')},w._attemptKeySystemAccess=function(u,o,s){var l=this,b=T(u,o,s,this._drmSystemOptions);M.logger.log("Requesting encrypted media key-system access");var p=this.requestMediaKeySystemAccess(u,b);this.mediaKeysPromise=p.then(function(h){return l._onMediaKeySystemAccessObtained(u,h)}),p.catch(function(h){M.logger.error('Failed to obtain key-system "'+u+'" access:',h)})},w._onMediaKeySystemAccessObtained=function(u,o){var s=this;M.logger.log('Access for key-system "'+u+'" obtained');var l={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:u};this._mediaKeysList.push(l);var b=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(p){return l.mediaKeys=p,M.logger.log('Media-keys created for key-system "'+u+'"'),s._onMediaKeysCreated(),p});return b.catch(function(p){M.logger.error("Failed to create media-keys:",p)}),b},w._onMediaKeysCreated=function(){var u=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),u._onNewMediaKeySession(o.mediaKeysSession))})},w._onNewMediaKeySession=function(u){var o=this;M.logger.log("New key-system session "+u.sessionId),u.addEventListener("message",function(s){o._onKeySessionMessage(u,s.message)},!1)},w._onKeySessionMessage=function(u,o){M.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(s){M.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),u.update(s)})},w.onMediaEncrypted=function(u){var o=this;if(M.logger.log('Media is encrypted using "'+u.initDataType+'" init data type'),!this.mediaKeysPromise){M.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(H.Events.ERROR,{type:C.ErrorTypes.KEY_SYSTEM_ERROR,details:C.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(b){if(!o._media)return;o._attemptSetMediaKeys(b),o._generateRequestWithPreferredKeySession(u.initDataType,u.initData)};this.mediaKeysPromise.then(s).catch(s)},w._attemptSetMediaKeys=function(u){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){M.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:C.ErrorTypes.KEY_SYSTEM_ERROR,details:C.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}M.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},w._generateRequestWithPreferredKeySession=function(u,o){var s=this,l=this._mediaKeysList[0];if(!l){M.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:C.ErrorTypes.KEY_SYSTEM_ERROR,details:C.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(l.mediaKeysSessionInitialized){M.logger.warn("Key-Session already initialized but requested again");return}var b=l.mediaKeysSession;if(!b){M.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(H.Events.ERROR,{type:C.ErrorTypes.KEY_SYSTEM_ERROR,details:C.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){M.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(H.Events.ERROR,{type:C.ErrorTypes.KEY_SYSTEM_ERROR,details:C.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}M.logger.log('Generating key-session request for "'+u+'" init data type'),l.mediaKeysSessionInitialized=!0,b.generateRequest(u,o).then(function(){M.logger.debug("Key-session generation succeeded")}).catch(function(p){M.logger.error("Error generating key-session request:",p),s.hls.trigger(H.Events.ERROR,{type:C.ErrorTypes.KEY_SYSTEM_ERROR,details:C.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},w._createLicenseXhr=function(u,o,s){var l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,l,u,o,s);var b=this._licenseXhrSetup;if(b)try{b.call(this.hls,l,u),b=void 0}catch(p){M.logger.error(p)}try{l.readyState||l.open("POST",u,!0),b&&b.call(this.hls,l,u)}catch(p){throw new Error("issue setting up KeySystem license XHR "+p)}return l},w._onLicenseRequestReadyStageChange=function(u,o,s,l){switch(u.readyState){case 4:if(u.status===200){this._requestLicenseFailureCount=0,M.logger.log("License request succeeded");var b=u.response,p=this._licenseResponseCallback;if(p)try{b=p.call(this.hls,u,o)}catch(L){M.logger.error(L)}l(b)}else{if(M.logger.error("License Request XHR failed ("+o+"). Status: "+u.status+" ("+u.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>R){this.hls.trigger(H.Events.ERROR,{type:C.ErrorTypes.KEY_SYSTEM_ERROR,details:C.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var h=R-this._requestLicenseFailureCount+1;M.logger.warn("Retrying license request, "+h+" attempts left"),this._requestLicense(s,l)}break}},w._generateLicenseRequestChallenge=function(u,o){switch(u.mediaKeySystemDomain){case W.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+u.mediaKeySystemDomain)},w._requestLicense=function(u,o){M.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){M.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:C.ErrorTypes.KEY_SYSTEM_ERROR,details:C.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var l=this.getLicenseServerUrl(s.mediaKeySystemDomain),b=this._createLicenseXhr(l,u,o);M.logger.log("Sending license request to URL: "+l);var p=this._generateLicenseRequestChallenge(s,u);b.send(p)}catch(h){M.logger.error("Failure requesting DRM license: "+h),this.hls.trigger(H.Events.ERROR,{type:C.ErrorTypes.KEY_SYSTEM_ERROR,details:C.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},w.onMediaAttached=function(u,o){if(!this._emeEnabled)return;var s=o.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},w.onMediaDetached=function(){var u=this._media,o=this._mediaKeysList;if(!u)return;u.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return u.setMediaKeys(null)}).catch(function(){})},w.onManifestParsed=function(u,o){if(!this._emeEnabled)return;var s=o.levels.map(function(b){return b.audioCodec}).filter(function(b){return!!b}),l=o.levels.map(function(b){return b.videoCodec}).filter(function(b){return!!b});this._attemptKeySystemAccess(W.KeySystems.WIDEVINE,s,l)},P(O,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),O}();X.default=_},"./src/controller/fps-controller.ts":function(de,X,k){"use strict";k.r(X);var H=k("./src/events.ts"),C=k("./src/utils/logger.ts"),M=function(){function W(P){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=P,this.registerListeners()}var B=W.prototype;return B.setStreamController=function(R){this.streamController=R},B.registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},B.unregisterListeners=function(){this.hls.off(H.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,y){var T=this.hls.config;if(T.capLevelOnFPSDrop){var _=y.media instanceof self.HTMLVideoElement?y.media:null;this.media=_,_&&typeof _.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),T.fpsDroppedMonitoringPeriod)}},B.checkFPS=function(R,y,T){var _=performance.now();if(y){if(this.lastTime){var O=_-this.lastTime,w=T-this.lastDroppedFrames,g=y-this.lastDecodedFrames,u=1e3*w/O,o=this.hls;if(o.trigger(H.Events.FPS_DROP,{currentDropped:w,currentDecoded:g,totalDroppedFrames:T}),u>0&&w>o.config.fpsDroppedMonitoringThreshold*g){var s=o.currentLevel;C.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=s)&&(s=s-1,o.trigger(H.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:o.currentLevel}),o.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=_,this.lastDroppedFrames=T,this.lastDecodedFrames=y}},B.checkFPSInterval=function(){var R=this.media;if(R)if(this.isVideoPlaybackQualityAvailable){var y=R.getVideoPlaybackQuality();this.checkFPS(R,y.totalVideoFrames,y.droppedVideoFrames)}else this.checkFPS(R,R.webkitDecodedFrameCount,R.webkitDroppedFrameCount)},W}();X.default=M},"./src/controller/fragment-finders.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"findFragmentByPDT",function(){return M}),k.d(X,"findFragmentByPTS",function(){return W}),k.d(X,"fragmentWithinToleranceTest",function(){return B}),k.d(X,"pdtWithinToleranceTest",function(){return P}),k.d(X,"findFragWithCC",function(){return R});var H=k("./src/polyfills/number.ts"),C=k("./src/utils/binary-search.ts");function M(y,T,_){if(T===null||!Array.isArray(y)||!y.length||!Object(H.isFiniteNumber)(T))return null;var O=y[0].programDateTime;if(T<(O||0))return null;var w=y[y.length-1].endProgramDateTime;if(T>=(w||0))return null;_=_||0;for(var g=0;g<y.length;++g){var u=y[g];if(P(T,_,u))return u}return null}function W(y,T,_,O){_===void 0&&(_=0),O===void 0&&(O=0);var w=null;if(y?w=T[y.sn-T[0].sn+1]||null:_===0&&T[0].start===0&&(w=T[0]),w&&B(_,O,w)===0)return w;var g=C.default.search(T,B.bind(null,_,O));return g||w}function B(y,T,_){y===void 0&&(y=0),T===void 0&&(T=0);var O=Math.min(T,_.duration+(_.deltaPTS?_.deltaPTS:0));return _.start+_.duration-O<=y?1:_.start-O>y&&_.start?-1:0}function P(y,T,_){var O=Math.min(T,_.duration+(_.deltaPTS?_.deltaPTS:0))*1e3,w=_.endProgramDateTime||0;return w-O>y}function R(y,T){return C.default.search(y,function(_){return _.cc<T?1:_.cc>T?-1:0})}},"./src/controller/fragment-tracker.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"FragmentState",function(){return M}),k.d(X,"FragmentTracker",function(){return W});var H=k("./src/events.ts"),C=k("./src/types/loader.ts"),M;(function(R){R.NOT_LOADED="NOT_LOADED",R.BACKTRACKED="BACKTRACKED",R.APPENDING="APPENDING",R.PARTIAL="PARTIAL",R.OK="OK"})(M||(M={}));var W=function(){function R(T){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=T,this._registerListeners()}var y=R.prototype;return y._registerListeners=function(){var _=this.hls;_.on(H.Events.BUFFER_APPENDED,this.onBufferAppended,this),_.on(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),_.on(H.Events.FRAG_LOADED,this.onFragLoaded,this)},y._unregisterListeners=function(){var _=this.hls;_.off(H.Events.BUFFER_APPENDED,this.onBufferAppended,this),_.off(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),_.off(H.Events.FRAG_LOADED,this.onFragLoaded,this)},y.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},y.getAppendedFrag=function(_,O){if(O===C.PlaylistLevelType.MAIN){var w=this.activeFragment,g=this.activeParts;if(!w)return null;if(g)for(var u=g.length;u--;){var o=g[u],s=o?o.end:w.appendedPTS;if(o.start<=_&&s!==void 0&&_<=s)return u>9&&(this.activeParts=g.slice(u-9)),o}else if(w.start<=_&&w.appendedPTS!==void 0&&_<=w.appendedPTS)return w}return this.getBufferedFrag(_,O)},y.getBufferedFrag=function(_,O){for(var w=this.fragments,g=Object.keys(w),u=g.length;u--;){var o=w[g[u]];if((o==null?void 0:o.body.type)===O&&o.buffered){var s=o.body;if(s.start<=_&&_<=s.end)return s}}return null},y.detectEvictedFragments=function(_,O,w){var g=this;Object.keys(this.fragments).forEach(function(u){var o=g.fragments[u];if(!o)return;if(!o.buffered){o.body.type===w&&g.removeFragment(o.body);return}var s=o.range[_];if(!s)return;s.time.some(function(l){var b=!g.isTimeBuffered(l.startPTS,l.endPTS,O);return b&&g.removeFragment(o.body),b})})},y.detectPartialFragments=function(_){var O=this,w=this.timeRanges,g=_.frag,u=_.part;if(!w||g.sn==="initSegment")return;var o=P(g),s=this.fragments[o];if(!s)return;Object.keys(w).forEach(function(l){var b=g.elementaryStreams[l];if(!b)return;var p=w[l],h=u!==null||b.partial===!0;s.range[l]=O.getBufferedTimes(g,u,h,p)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},y.fragBuffered=function(_){var O=P(_),w=this.fragments[O];w&&(w.backtrack=w.loaded=null,w.buffered=!0)},y.getBufferedTimes=function(_,O,w,g){for(var u={time:[],partial:w},o=O?O.start:_.start,s=O?O.end:_.end,l=_.minEndPTS||s,b=_.maxStartPTS||o,p=0;p<g.length;p++){var h=g.start(p)-this.bufferPadding,L=g.end(p)+this.bufferPadding;if(b>=h&&l<=L){u.time.push({startPTS:Math.max(o,g.start(p)),endPTS:Math.min(s,g.end(p))});break}else if(o<L&&s>h)u.partial=!0,u.time.push({startPTS:Math.max(o,g.start(p)),endPTS:Math.min(s,g.end(p))});else if(s<=h)break}return u},y.getPartialFragment=function(_){var O=null,w,g,u,o=0,s=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach(function(b){var p=l[b];if(!p)return;B(p)&&(g=p.body.start-s,u=p.body.end+s,_>=g&&_<=u&&(w=Math.min(_-g,u-_),o<=w&&(O=p.body,o=w)))}),O},y.getState=function(_){var O=P(_),w=this.fragments[O];return w?w.buffered?B(w)?M.PARTIAL:M.OK:w.backtrack?M.BACKTRACKED:M.APPENDING:M.NOT_LOADED},y.backtrack=function(_,O){var w=P(_),g=this.fragments[w];if(!g||g.backtrack)return null;var u=g.backtrack=O||g.loaded;return g.loaded=null,u},y.getBacktrackData=function(_){var O=P(_),w=this.fragments[O];if(w){var g,u=w.backtrack;if(u!=null&&(g=u.payload)!==null&&g!==void 0&&g.byteLength)return u;this.removeFragment(_)}return null},y.isTimeBuffered=function(_,O,w){for(var g,u,o=0;o<w.length;o++){if(g=w.start(o)-this.bufferPadding,u=w.end(o)+this.bufferPadding,_>=g&&O<=u)return!0;if(O<=g)return!1}return!1},y.onFragLoaded=function(_,O){var w=O.frag,g=O.part;if(w.sn==="initSegment"||w.bitrateTest||g)return;var u=P(w);this.fragments[u]={body:w,loaded:O,backtrack:null,buffered:!1,range:Object.create(null)}},y.onBufferAppended=function(_,O){var w=this,g=O.frag,u=O.part,o=O.timeRanges;if(g.type===C.PlaylistLevelType.MAIN)if(this.activeFragment=g,u){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(u)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(l){var b=o[l];if(w.detectEvictedFragments(l,b),!u)for(var p=0;p<b.length;p++)g.appendedPTS=Math.max(b.end(p),g.appendedPTS||0)})},y.onFragBuffered=function(_,O){this.detectPartialFragments(O)},y.hasFragment=function(_){var O=P(_);return!!this.fragments[O]},y.removeFragmentsInRange=function(_,O,w){var g=this;Object.keys(this.fragments).forEach(function(u){var o=g.fragments[u];if(!o)return;if(o.buffered){var s=o.body;s.type===w&&s.start<O&&s.end>_&&g.removeFragment(s)}})},y.removeFragment=function(_){var O=P(_);_.stats.loaded=0,_.clearElementaryStreamInfo(),delete this.fragments[O]},y.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},R}();function B(R){var y,T;return R.buffered&&(((y=R.range.video)===null||y===void 0?void 0:y.partial)||((T=R.range.audio)===null||T===void 0?void 0:T.partial))}function P(R){return R.type+"_"+R.level+"_"+R.urlId+"_"+R.sn}},"./src/controller/gap-controller.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"STALL_MINIMUM_DURATION_MS",function(){return B}),k.d(X,"MAX_START_GAP_JUMP",function(){return P}),k.d(X,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return R}),k.d(X,"SKIP_BUFFER_RANGE_START",function(){return y}),k.d(X,"default",function(){return T});var H=k("./src/utils/buffer-helper.ts"),C=k("./src/errors.ts"),M=k("./src/events.ts"),W=k("./src/utils/logger.ts"),B=250,P=2,R=.1,y=.05,T=function(){function _(w,g,u,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=w,this.media=g,this.fragmentTracker=u,this.hls=o}var O=_.prototype;return O.destroy=function(){this.hls=this.fragmentTracker=this.media=null},O.poll=function(g){var u=this.config,o=this.media,s=this.stalled,l=o.currentTime,b=o.seeking,p=this.seeking&&!b,h=!this.seeking&&b;if(this.seeking=b,l!==g){if(this.moved=!0,s!==null){if(this.stallReported){var L=self.performance.now()-s;W.logger.warn("playback not stuck anymore @"+l+", after "+Math.round(L)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((h||p)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!H.BufferHelper.getBuffered(o).length)return;var v=H.BufferHelper.bufferInfo(o,l,0),c=v.len>0,f=v.nextStart||0;if(!c&&!f)return;if(b){var d=v.len>P,a=!f||f-l>P&&!this.fragmentTracker.getPartialFragment(l);if(d||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var x,m=Math.max(f,v.start||0)-l,S=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,I=S==null||((x=S.details)===null||x===void 0)?void 0:x.live,z=I?S.details.targetduration*2:P;if(m>0&&m<=z){this._trySkipBufferHole(null);return}}var Y=self.performance.now();if(s===null){this.stalled=Y;return}var ie=Y-s;!b&&ie>=B&&this._reportStall(v.len);var G=H.BufferHelper.bufferInfo(o,l,u.maxBufferHole);this._tryFixBufferStall(G,ie)},O._tryFixBufferStall=function(g,u){var o=this.config,s=this.fragmentTracker,l=this.media,b=l.currentTime,p=s.getPartialFragment(b);if(p){var h=this._trySkipBufferHole(p);if(h)return}g.len>o.maxBufferHole&&u>o.highBufferWatchdogPeriod*1e3&&(W.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},O._reportStall=function(g){var u=this.hls,o=this.media,s=this.stallReported;s||(this.stallReported=!0,W.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+g+")"),u.trigger(M.Events.ERROR,{type:C.ErrorTypes.MEDIA_ERROR,details:C.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:g}))},O._trySkipBufferHole=function(g){for(var u=this.config,o=this.hls,s=this.media,l=s.currentTime,b=0,p=H.BufferHelper.getBuffered(s),h=0;h<p.length;h++){var L=p.start(h);if(l+u.maxBufferHole>=b&&l<L){var v=Math.max(L+y,s.currentTime+R);return W.logger.warn("skipping hole, adjusting currentTime from "+l+" to "+v),this.moved=!0,this.stalled=null,s.currentTime=v,g&&o.trigger(M.Events.ERROR,{type:C.ErrorTypes.MEDIA_ERROR,details:C.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+l+" to "+v,frag:g}),v}b=p.end(h)}return 0},O._tryNudgeBuffer=function(){var g=this.config,u=this.hls,o=this.media,s=o.currentTime,l=(this.nudgeRetry||0)+1;if(this.nudgeRetry=l,l<g.nudgeMaxRetry){var b=s+l*g.nudgeOffset;W.logger.warn("Nudging 'currentTime' from "+s+" to "+b),o.currentTime=b,u.trigger(M.Events.ERROR,{type:C.ErrorTypes.MEDIA_ERROR,details:C.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else W.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+g.nudgeMaxRetry+" nudges"),u.trigger(M.Events.ERROR,{type:C.ErrorTypes.MEDIA_ERROR,details:C.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},_}()},"./src/controller/id3-track-controller.ts":function(de,X,k){"use strict";k.r(X);var H=k("./src/events.ts"),C=k("./src/utils/texttrack-utils.ts"),M=k("./src/demux/id3.ts"),W=.25,B=function(){function P(y){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=y,this._registerListeners()}var R=P.prototype;return R.destroy=function(){this._unregisterListeners()},R._registerListeners=function(){var T=this.hls;T.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.on(H.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),T.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R._unregisterListeners=function(){var T=this.hls;T.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.off(H.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),T.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R.onMediaAttached=function(T,_){this.media=_.media},R.onMediaDetaching=function(){if(!this.id3Track)return;Object(C.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},R.getID3Track=function(T){if(!this.media)return;for(var _=0;_<T.length;_++){var O=T[_];if(O.kind==="metadata"&&O.label==="id3")return Object(C.sendAddTrackEvent)(O,this.media),O}return this.media.addTextTrack("metadata","id3")},R.onFragParsingMetadata=function(T,_){if(!this.media)return;var O=_.frag,w=_.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var g=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,u=0;u<w.length;u++){var o=M.getID3Frames(w[u].data);if(o){var s=w[u].pts,l=u<w.length-1?w[u+1].pts:O.end,b=l-s;b<=0&&(l=s+W);for(var p=0;p<o.length;p++){var h=o[p];if(!M.isTimeStampFrame(h)){var L=new g(s,l,"");L.value=h,this.id3Track.addCue(L)}}}}},R.onBufferFlushing=function(T,_){var O=_.startOffset,w=_.endOffset,g=_.type;if(!g||g==="audio"){var u=this.id3Track;u&&Object(C.removeCuesInRange)(u,O,w)}},P}();X.default=B},"./src/controller/latency-controller.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"default",function(){return P});var H=k("./src/errors.ts"),C=k("./src/events.ts"),M=k("./src/utils/logger.ts");function W(R,y){for(var T=0;T<y.length;T++){var _=y[T];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(R,_.key,_)}}function B(R,y,T){return y&&W(R.prototype,y),T&&W(R,T),R}var P=function(){function R(T){var _=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 _.timeupdate()},this.hls=T,this.config=T.config,this.registerListeners()}var y=R.prototype;return y.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},y.registerListeners=function(){this.hls.on(C.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(C.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(C.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(C.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(C.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){this.hls.off(C.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(C.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(C.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(C.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(C.Events.ERROR,this.onError)},y.onMediaAttached=function(_,O){this.media=O.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},y.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},y.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},y.onLevelUpdated=function(_,O){var w=O.details;this.levelDetails=w,w.advanced&&this.timeupdate(),!w.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},y.onError=function(_,O){if(O.details!==H.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,M.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},y.timeupdate=function(){var _=this.media,O=this.levelDetails;if(!_||!O)return;this.currentTime=_.currentTime;var w=this.computeLatency();if(w===null)return;this._latency=w;var g=this.config,u=g.lowLatencyMode,o=g.maxLiveSyncPlaybackRate;if(!u||o===1)return;var s=this.targetLatency;if(s===null)return;var l=w-s,b=Math.min(this.maxLatency,s+O.targetduration),p=l<b;if(O.live&&p&&l>.05&&this.forwardBufferLength>1){var h=Math.min(2,Math.max(1,o)),L=Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20;_.playbackRate=Math.min(h,Math.max(1,L))}else _.playbackRate!==1&&_.playbackRate!==0&&(_.playbackRate=1)},y.estimateLiveEdge=function(){var _=this.levelDetails;return _===null?null:_.edge+_.age},y.computeLatency=function(){var _=this.estimateLiveEdge();return _===null?null:_-this.currentTime},B(R,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var _=this.config,O=this.levelDetails;return _.liveMaxLatencyDuration!==void 0?_.liveMaxLatencyDuration:O?_.liveMaxLatencyDurationCount*O.targetduration:0}},{key:"targetLatency",get:function(){var _=this.levelDetails;if(_===null)return null;var O=_.holdBack,w=_.partHoldBack,g=_.targetduration,u=this.config,o=u.liveSyncDuration,s=u.liveSyncDurationCount,l=u.lowLatencyMode,b=this.hls.userConfig,p=l&&w||O;(b.liveSyncDuration||b.liveSyncDurationCount||p===0)&&(p=o!==void 0?o:s*g);var h=g,L=1;return p+Math.min(this.stallCount*L,h)}},{key:"liveSyncPosition",get:function(){var _=this.estimateLiveEdge(),O=this.targetLatency,w=this.levelDetails;if(_===null||O===null||w===null)return null;var g=w.edge,u=_-O-this.edgeStalled,o=g-w.totalduration,s=g-(this.config.lowLatencyMode&&w.partTarget||w.targetduration);return Math.min(Math.max(o,u),s)}},{key:"drift",get:function(){var _=this.levelDetails;return _===null?1:_.drift}},{key:"edgeStalled",get:function(){var _=this.levelDetails;if(_===null)return 0;var O=(this.config.lowLatencyMode&&_.partTarget||_.targetduration)*3;return Math.max(_.age-O,0)}},{key:"forwardBufferLength",get:function(){var _=this.media,O=this.levelDetails;if(!_||!O)return 0;var w=_.buffered.length;return w?_.buffered.end(w-1):O.edge-this.currentTime}}]),R}()},"./src/controller/level-controller.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"default",function(){return u});var H=k("./src/types/level.ts"),C=k("./src/events.ts"),M=k("./src/errors.ts"),W=k("./src/utils/codecs.ts"),B=k("./src/controller/level-helper.ts"),P=k("./src/controller/base-playlist-controller.ts"),R=k("./src/types/loader.ts");function y(){return y=Object.assign||function(o){for(var s=1;s<arguments.length;s++){var l=arguments[s];for(var b in l)Object.prototype.hasOwnProperty.call(l,b)&&(o[b]=l[b])}return o},y.apply(this,arguments)}function T(o,s){for(var l=0;l<s.length;l++){var b=s[l];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(o,b.key,b)}}function _(o,s,l){return s&&T(o.prototype,s),l&&T(o,l),o}function O(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,w(o,s)}function w(o,s){return w=Object.setPrototypeOf||function(b,p){return b.__proto__=p,b},w(o,s)}var g=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),u=function(o){O(s,o);function s(b){var p;return p=o.call(this,b,"[level-controller]")||this,p._levels=[],p._firstLevel=-1,p._startLevel=void 0,p.currentLevelIndex=-1,p.manualLevelIndex=-1,p.onParsedComplete=void 0,p._registerListeners(),p}var l=s.prototype;return l._registerListeners=function(){var p=this.hls;p.on(C.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.on(C.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(C.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.on(C.Events.FRAG_LOADED,this.onFragLoaded,this),p.on(C.Events.ERROR,this.onError,this)},l._unregisterListeners=function(){var p=this.hls;p.off(C.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.off(C.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(C.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.off(C.Events.FRAG_LOADED,this.onFragLoaded,this),p.off(C.Events.ERROR,this.onError,this)},l.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},l.startLoad=function(){var p=this._levels;p.forEach(function(h){h.loadError=0}),o.prototype.startLoad.call(this)},l.onManifestLoaded=function(p,h){var L=[],v=[],c=[],f,d={},a,x=!1,m=!1,S=!1;if(h.levels.forEach(function(ie){var G=ie.attrs;x=x||!!(ie.width&&ie.height),m=m||!!ie.videoCodec,S=S||!!ie.audioCodec,g&&ie.audioCodec&&ie.audioCodec.indexOf("mp4a.40.34")!==-1&&(ie.audioCodec=void 0);var j=ie.bitrate+"-"+ie.attrs.RESOLUTION+"-"+ie.attrs.CODECS;a=d[j],a?a.url.push(ie.url):(a=new H.Level(ie),d[j]=a,L.push(a)),G&&(G.AUDIO&&Object(B.addGroupId)(a,"audio",G.AUDIO),G.SUBTITLES&&Object(B.addGroupId)(a,"text",G.SUBTITLES))}),(x||m)&&S&&(L=L.filter(function(ie){var G=ie.videoCodec,j=ie.width,oe=ie.height;return!!G||!!(j&&oe)})),L=L.filter(function(ie){var G=ie.audioCodec,j=ie.videoCodec;return(!G||Object(W.isCodecSupportedInMp4)(G,"audio"))&&(!j||Object(W.isCodecSupportedInMp4)(j,"video"))}),h.audioTracks&&(v=h.audioTracks.filter(function(ie){return!ie.audioCodec||Object(W.isCodecSupportedInMp4)(ie.audioCodec,"audio")}),Object(B.assignTrackIdsByGroup)(v)),h.subtitles&&(c=h.subtitles,Object(B.assignTrackIdsByGroup)(c)),L.length>0){f=L[0].bitrate,L.sort(function(ie,G){return ie.bitrate-G.bitrate}),this._levels=L;for(var I=0;I<L.length;I++)if(L[I].bitrate===f){this._firstLevel=I,this.log("manifest loaded, "+L.length+" level(s) found, first bitrate: "+f);break}var z=S&&!m,Y={levels:L,audioTracks:v,subtitleTracks:c,firstLevel:this._firstLevel,stats:h.stats,audio:S,video:m,altAudio:!z&&v.some(function(ie){return!!ie.url})};this.hls.trigger(C.Events.MANIFEST_PARSED,Y),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(C.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:h.url,reason:"no level with compatible codecs found in manifest"})},l.onError=function(p,h){if(o.prototype.onError.call(this,p,h),h.fatal)return;var L=h.context,v=this._levels[this.currentLevelIndex];if(L&&(L.type===R.PlaylistContextType.AUDIO_TRACK&&v.audioGroupIds&&L.groupId===v.audioGroupIds[v.urlId]||L.type===R.PlaylistContextType.SUBTITLE_TRACK&&v.textGroupIds&&L.groupId===v.textGroupIds[v.urlId])){this.redundantFailover(this.currentLevelIndex);return}var c=!1,f=!0,d;switch(h.details){case M.ErrorDetails.FRAG_LOAD_ERROR:case M.ErrorDetails.FRAG_LOAD_TIMEOUT:case M.ErrorDetails.KEY_LOAD_ERROR:case M.ErrorDetails.KEY_LOAD_TIMEOUT:if(h.frag){var a=this._levels[h.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(d=h.frag.level)):d=h.frag.level}break;case M.ErrorDetails.LEVEL_LOAD_ERROR:case M.ErrorDetails.LEVEL_LOAD_TIMEOUT:L&&(L.deliveryDirectives&&(f=!1),d=L.level),c=!0;break;case M.ErrorDetails.REMUX_ALLOC_ERROR:d=h.level,c=!0;break}d!==void 0&&this.recoverLevel(h,d,c,f)},l.recoverLevel=function(p,h,L,v){var c=p.details,f=this._levels[h];if(f.loadError++,L){var d=this.retryLoadingOrFail(p);if(d)p.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(v){var a=f.url.length;if(a>1&&f.loadError<a)p.levelRetry=!0,this.redundantFailover(h);else if(this.manualLevelIndex===-1){var x=h===0?this._levels.length-1:h-1;this.currentLevelIndex!==x&&this._levels[x].loadError===0&&(this.warn(c+": switch to "+x),p.levelRetry=!0,this.hls.nextAutoLevel=x)}}},l.redundantFailover=function(p){var h=this._levels[p],L=h.url.length;if(L>1){var v=(h.urlId+1)%L;this.warn("Switching to redundant URL-id "+v),this._levels.forEach(function(c){c.urlId=v}),this.level=p}},l.onFragLoaded=function(p,h){var L=h.frag;if(L!==void 0&&L.type===R.PlaylistLevelType.MAIN){var v=this._levels[L.level];v!==void 0&&(v.fragmentError=0,v.loadError=0)}},l.onLevelLoaded=function(p,h){var L,v=h.level,c=h.details,f=this._levels[v];if(!f){var d;this.warn("Invalid level index "+v),(d=h.deliveryDirectives)!==null&&d!==void 0&&d.skip&&(c.deltaUpdateFailed=!0);return}v===this.currentLevelIndex?(f.fragmentError===0&&(f.loadError=0,this.retryCount=0),this.playlistLoaded(v,h,f.details)):(L=h.deliveryDirectives)!==null&&L!==void 0&&L.skip&&(c.deltaUpdateFailed=!0)},l.onAudioTrackSwitched=function(p,h){var L=this.hls.levels[this.currentLevelIndex];if(!L)return;if(L.audioGroupIds){for(var v=-1,c=this.hls.audioTracks[h.id].groupId,f=0;f<L.audioGroupIds.length;f++)if(L.audioGroupIds[f]===c){v=f;break}v!==L.urlId&&(L.urlId=v,this.startLoad())}},l.loadPlaylist=function(p){var h=this.currentLevelIndex,L=this._levels[h];if(this.canLoad&&L&&L.url.length>0){var v=L.urlId,c=L.url[v];if(p)try{c=p.addDirectives(c)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Attempt loading level index "+h+(p?" at sn "+p.msn+" part "+p.part:"")+" with URL-id "+v+" "+c),this.clearTimer(),this.hls.trigger(C.Events.LEVEL_LOADING,{url:c,level:h,id:v,deliveryDirectives:p||null})}},l.removeLevel=function(p,h){var L=function(f,d){return d!==h},v=this._levels.filter(function(c,f){return f!==p?!0:c.url.length>1&&h!==void 0?(c.url=c.url.filter(L),c.audioGroupIds&&(c.audioGroupIds=c.audioGroupIds.filter(L)),c.textGroupIds&&(c.textGroupIds=c.textGroupIds.filter(L)),c.urlId=0,!0):!1}).map(function(c,f){var d=c.details;return d!=null&&d.fragments&&d.fragments.forEach(function(a){a.level=f}),c});this._levels=v,this.hls.trigger(C.Events.LEVELS_UPDATED,{levels:v})},_(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(p){var h,L=this._levels;if(L.length===0)return;if(this.currentLevelIndex===p&&(h=L[p])!==null&&h!==void 0&&h.details)return;if(p<0||p>=L.length){var v=p<0;if(this.hls.trigger(C.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.LEVEL_SWITCH_ERROR,level:p,fatal:v,reason:"invalid level idx"}),v)return;p=Math.min(p,L.length-1)}this.clearTimer();var c=this.currentLevelIndex,f=L[c],d=L[p];this.log("switching to level "+p+" from "+c),this.currentLevelIndex=p;var a=y({},d,{level:p,maxBitrate:d.maxBitrate,uri:d.uri,urlId:d.urlId});delete a._urlId,this.hls.trigger(C.Events.LEVEL_SWITCHING,a);var x=d.details;if(!x||x.live){var m=this.switchParams(d.uri,f==null?void 0:f.details);this.loadPlaylist(m)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(p){this.manualLevelIndex=p,this._startLevel===void 0&&(this._startLevel=p),p!==-1&&(this.level=p)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(p){this._firstLevel=p}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var p=this.hls.config.startLevel;return p!==void 0?p:this._firstLevel}else return this._startLevel},set:function(p){this._startLevel=p}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(p){this.level=p,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=p)}}]),s}(P.default)},"./src/controller/level-helper.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"addGroupId",function(){return M}),k.d(X,"assignTrackIdsByGroup",function(){return W}),k.d(X,"updatePTS",function(){return B}),k.d(X,"updateFragPTSDTS",function(){return R}),k.d(X,"mergeDetails",function(){return y}),k.d(X,"mapPartIntersection",function(){return T}),k.d(X,"mapFragmentIntersection",function(){return _}),k.d(X,"adjustSliding",function(){return O}),k.d(X,"addSliding",function(){return w}),k.d(X,"computeReloadInterval",function(){return g}),k.d(X,"getFragmentWithSN",function(){return u}),k.d(X,"getPartWith",function(){return o});var H=k("./src/polyfills/number.ts"),C=k("./src/utils/logger.ts");function M(s,l,b){switch(l){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(b);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(b);break}}function W(s){var l={};s.forEach(function(b){var p=b.groupId||"";b.id=l[p]=l[p]||0,l[p]++})}function B(s,l,b){var p=s[l],h=s[b];P(p,h)}function P(s,l){var b=l.startPTS;if(Object(H.isFiniteNumber)(b)){var p=0,h;l.sn>s.sn?(p=b-s.start,h=s):(p=s.start-b,h=l),h.duration!==p&&(h.duration=p)}else if(l.sn>s.sn){var L=s.cc===l.cc;L&&s.minEndPTS?l.start=s.start+(s.minEndPTS-s.start):l.start=s.start+s.duration}else l.start=Math.max(s.start-l.duration,0)}function R(s,l,b,p,h,L){var v=p-b;v<=0&&(C.logger.warn("Fragment should have a positive duration",l),p=b+l.duration,L=h+l.duration);var c=b,f=p,d=l.startPTS,a=l.endPTS;if(Object(H.isFiniteNumber)(d)){var x=Math.abs(d-b);Object(H.isFiniteNumber)(l.deltaPTS)?l.deltaPTS=Math.max(x,l.deltaPTS):l.deltaPTS=x,c=Math.max(b,d),b=Math.min(b,d),h=Math.min(h,l.startDTS),f=Math.min(p,a),p=Math.max(p,a),L=Math.max(L,l.endDTS)}l.duration=p-b;var m=b-l.start;l.appendedPTS=p,l.start=l.startPTS=b,l.maxStartPTS=c,l.startDTS=h,l.endPTS=p,l.minEndPTS=f,l.endDTS=L;var S=l.sn;if(!s||S<s.startSN||S>s.endSN)return 0;var I,z=S-s.startSN,Y=s.fragments;for(Y[z]=l,I=z;I>0;I--)P(Y[I],Y[I-1]);for(I=z;I<Y.length-1;I++)P(Y[I],Y[I+1]);return s.fragmentHint&&P(Y[Y.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,m}function y(s,l){for(var b=null,p=s.fragments,h=p.length-1;h>=0;h--){var L=p[h].initSegment;if(L){b=L;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var v=0,c;if(_(s,l,function(I,z){I.relurl&&(v=I.cc-z.cc),Object(H.isFiniteNumber)(I.startPTS)&&Object(H.isFiniteNumber)(I.endPTS)&&(z.start=z.startPTS=I.startPTS,z.startDTS=I.startDTS,z.appendedPTS=I.appendedPTS,z.maxStartPTS=I.maxStartPTS,z.endPTS=I.endPTS,z.endDTS=I.endDTS,z.minEndPTS=I.minEndPTS,z.duration=I.endPTS-I.startPTS,z.duration&&(c=z),l.PTSKnown=l.alignedSliding=!0),z.elementaryStreams=I.elementaryStreams,z.loader=I.loader,z.stats=I.stats,z.urlId=I.urlId,I.initSegment&&(z.initSegment=I.initSegment,b=I.initSegment)}),b){var f=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments;f.forEach(function(I){var z;(!I.initSegment||I.initSegment.relurl===((z=b)===null||z===void 0?void 0:z.relurl))&&(I.initSegment=b)})}if(l.skippedSegments&&(l.deltaUpdateFailed=l.fragments.some(function(I){return!I}),l.deltaUpdateFailed)){C.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var d=l.skippedSegments;d--;)l.fragments.shift();l.startSN=l.fragments[0].sn,l.startCC=l.fragments[0].cc}var a=l.fragments;if(v){C.logger.warn("discontinuity sliding from playlist, take drift into account");for(var x=0;x<a.length;x++)a[x].cc+=v}l.skippedSegments&&(l.startCC=l.fragments[0].cc),T(s.partList,l.partList,function(I,z){z.elementaryStreams=I.elementaryStreams,z.stats=I.stats}),c?R(l,c,c.startPTS,c.endPTS,c.startDTS,c.endDTS):O(s,l),a.length&&(l.totalduration=l.edge-a[0].start),l.driftStartTime=s.driftStartTime,l.driftStart=s.driftStart;var m=l.advancedDateTime;if(l.advanced&&m){var S=l.edge;l.driftStart||(l.driftStartTime=m,l.driftStart=S),l.driftEndTime=m,l.driftEnd=S}else l.driftEndTime=s.driftEndTime,l.driftEnd=s.driftEnd,l.advancedDateTime=s.advancedDateTime}function T(s,l,b){if(s&&l)for(var p=0,h=0,L=s.length;h<=L;h++){var v=s[h],c=l[h+p];v&&c&&v.index===c.index&&v.fragment.sn===c.fragment.sn?b(v,c):p--}}function _(s,l,b){for(var p=l.skippedSegments,h=Math.max(s.startSN,l.startSN)-l.startSN,L=(s.fragmentHint?1:0)+(p?l.endSN:Math.min(s.endSN,l.endSN))-l.startSN,v=l.startSN-s.startSN,c=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,f=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,d=h;d<=L;d++){var a=f[v+d],x=c[d];p&&!x&&d<p&&(x=l.fragments[d]=a),a&&x&&b(a,x)}}function O(s,l){var b=l.startSN+l.skippedSegments-s.startSN,p=s.fragments;if(b<0||b>=p.length)return;w(l,p[b].start)}function w(s,l){if(l){for(var b=s.fragments,p=s.skippedSegments;p<b.length;p++)b[p].start+=l;s.fragmentHint&&(s.fragmentHint.start+=l)}}function g(s,l){var b=1e3*s.levelTargetDuration,p=b/2,h=s.age,L=h>0&&h<b*3,v=l.loading.end-l.loading.start,c,f=s.availabilityDelay;if(s.updated===!1)if(L){var d=333*s.misses;c=Math.max(Math.min(p,v*2),d),s.availabilityDelay=(s.availabilityDelay||0)+c}else c=p;else L?(f=Math.min(f||b/2,h),s.availabilityDelay=f,c=f+b-h):c=b-v;return Math.round(c)}function u(s,l,b){if(!s||!s.details)return null;var p=s.details,h=p.fragments[l-p.startSN];return h||(h=p.fragmentHint,h&&h.sn===l?h:l<p.startSN&&b&&b.sn===l?b:null)}function o(s,l,b){if(!s||!s.details)return null;var p=s.details.partList;if(p)for(var h=p.length;h--;){var L=p[h];if(L.index===b&&L.fragment.sn===l)return L}return null}},"./src/controller/stream-controller.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"default",function(){return p});var H=k("./src/polyfills/number.ts"),C=k("./src/controller/base-stream-controller.ts"),M=k("./src/is-supported.ts"),W=k("./src/events.ts"),B=k("./src/utils/buffer-helper.ts"),P=k("./src/controller/fragment-tracker.ts"),R=k("./src/types/loader.ts"),y=k("./src/loader/fragment.ts"),T=k("./src/demux/transmuxer-interface.ts"),_=k("./src/types/transmuxer.ts"),O=k("./src/controller/gap-controller.ts"),w=k("./src/errors.ts"),g=k("./src/utils/logger.ts");function u(h,L){for(var v=0;v<L.length;v++){var c=L[v];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(h,c.key,c)}}function o(h,L,v){return L&&u(h.prototype,L),v&&u(h,v),h}function s(h,L){h.prototype=Object.create(L.prototype),h.prototype.constructor=h,l(h,L)}function l(h,L){return l=Object.setPrototypeOf||function(c,f){return c.__proto__=f,c},l(h,L)}var b=100,p=function(h){s(L,h);function L(c,f){var d;return d=h.call(this,c,f,"[stream-controller]")||this,d.audioCodecSwap=!1,d.gapController=null,d.level=-1,d._forceStartLoad=!1,d.altAudio=!1,d.audioOnly=!1,d.fragPlaying=null,d.onvplaying=null,d.onvseeked=null,d.fragLastKbps=0,d.stalled=!1,d.couldBacktrack=!1,d.audioCodecSwitch=!1,d.videoBuffer=null,d._registerListeners(),d}var v=L.prototype;return v._registerListeners=function(){var f=this.hls;f.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),f.on(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.on(W.Events.ERROR,this.onError,this),f.on(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.on(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(W.Events.BUFFER_CREATED,this.onBufferCreated,this),f.on(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.on(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.on(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},v._unregisterListeners=function(){var f=this.hls;f.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),f.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.off(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(W.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),f.off(W.Events.ERROR,this.onError,this),f.off(W.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),f.off(W.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(W.Events.BUFFER_CREATED,this.onBufferCreated,this),f.off(W.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),f.off(W.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),f.off(W.Events.FRAG_BUFFERED,this.onFragBuffered,this)},v.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},v.startLoad=function(f){if(this.levels){var d=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(b),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var x=a.startLevel;x===-1&&(a.config.testBandwidth?(x=0,this.bitrateTest=!0):x=a.nextAutoLevel),this.level=a.nextLoadLevel=x,this.loadedmetadata=!1}d>0&&f===-1&&(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),f=d),this.state=C.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=f,this.tick()}else this._forceStartLoad=!0,this.state=C.State.STOPPED},v.stopLoad=function(){this._forceStartLoad=!1,h.prototype.stopLoad.call(this)},v.doTick=function(){switch(this.state){case C.State.IDLE:this.doTickIdle();break;case C.State.WAITING_LEVEL:{var f,d=this.levels,a=this.level,x=d==null||((f=d[a])===null||f===void 0)?void 0:f.details;if(x&&(!x.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(x))break;this.state=C.State.IDLE;break}break}case C.State.FRAG_LOADING_WAITING_RETRY:{var m,S=self.performance.now(),I=this.retryDate;(!I||S>=I||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=C.State.IDLE)}break;default:break}this.onTickEnd()},v.onTickEnd=function(){h.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},v.doTickIdle=function(){var f,d,a=this.hls,x=this.levelLastLoaded,m=this.levels,S=this.media,I=a.config,z=a.nextLoadLevel;if(x===null||!S&&(this.startFragRequested||!I.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[z])return;var Y=m[z];this.level=a.nextLoadLevel=z;var ie=Y.details;if(!ie||this.state===C.State.WAITING_LEVEL||ie.live&&this.levelLastLoaded!==z){this.state=C.State.WAITING_LEVEL;return}var G=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:S,R.PlaylistLevelType.MAIN);if(G===null)return;var j=G.len,oe=this.getMaxBufferLength(Y.maxBitrate);if(j>=oe)return;if(this._streamEnded(G,ie)){var ye={};this.altAudio&&(ye.type="video"),this.hls.trigger(W.Events.BUFFER_EOS,ye),this.state=C.State.ENDED;return}var Ce=G.end,De=this.getNextFragment(Ce,ie);if(this.couldBacktrack&&!this.fragPrevious&&De&&De.sn!=="initSegment"){var Ye=De.sn-ie.startSN;Ye>1&&(De=ie.fragments[Ye-1],this.fragmentTracker.removeFragment(De))}if(De&&this.fragmentTracker.getState(De)===P.FragmentState.OK&&this.nextLoadPosition>Ce){var Ie=this.audioOnly&&!this.altAudio?y.ElementaryStreamTypes.AUDIO:y.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(S,Ie,R.PlaylistLevelType.MAIN),De=this.getNextFragment(this.nextLoadPosition,ie)}if(!De)return;De.initSegment&&!De.initSegment.data&&!this.bitrateTest&&(De=De.initSegment),((f=De.decryptdata)===null||f===void 0?void 0:f.keyFormat)==="identity"&&!((d=De.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(De,ie):this.loadFragment(De,ie,Ce)},v.loadFragment=function(f,d,a){var x,m=this.fragmentTracker.getState(f);if(this.fragCurrent=f,m===P.FragmentState.BACKTRACKED){var S=this.fragmentTracker.getBacktrackData(f);if(S){this._handleFragmentLoadProgress(S),this._handleFragmentLoadComplete(S);return}else m=P.FragmentState.NOT_LOADED}m===P.FragmentState.NOT_LOADED||m===P.FragmentState.PARTIAL?f.sn==="initSegment"?this._loadInitSegment(f):this.bitrateTest?(f.bitrateTest=!0,this.log("Fragment "+f.sn+" of level "+f.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(f)):(this.startFragRequested=!0,h.prototype.loadFragment.call(this,f,d,a)):m===P.FragmentState.APPENDING?this.reduceMaxBufferLength(f.duration)&&this.fragmentTracker.removeFragment(f):((x=this.media)===null||x===void 0?void 0:x.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},v.getAppendedFrag=function(f){var d=this.fragmentTracker.getAppendedFrag(f,R.PlaylistLevelType.MAIN);return d&&"fragment"in d?d.fragment:d},v.getBufferedFrag=function(f){return this.fragmentTracker.getBufferedFrag(f,R.PlaylistLevelType.MAIN)},v.followingBufferedFrag=function(f){return f?this.getBufferedFrag(f.end+.5):null},v.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},v.nextLevelSwitch=function(){var f=this.levels,d=this.media;if(d!=null&&d.readyState){var a,x=this.getAppendedFrag(d.currentTime);if(x&&x.start>1&&this.flushMainBuffer(0,x.start-1),!d.paused&&f){var m=this.hls.nextLoadLevel,S=f[m],I=this.fragLastKbps;I&&this.fragCurrent?a=this.fragCurrent.duration*S.maxBitrate/(1e3*I)+1:a=0}else a=0;var z=this.getBufferedFrag(d.currentTime+a);if(z){var Y=this.followingBufferedFrag(z);if(Y){this.abortCurrentFrag();var ie=Y.maxStartPTS?Y.maxStartPTS:Y.start,G=Y.duration,j=Math.max(z.end,ie+Math.min(Math.max(G-this.config.maxFragLookUpTolerance,G*.5),G*.75));this.flushMainBuffer(j,Number.POSITIVE_INFINITY)}}}},v.abortCurrentFrag=function(){var f=this.fragCurrent;this.fragCurrent=null,f!=null&&f.loader&&f.loader.abort(),this.state===C.State.KEY_LOADING&&(this.state=C.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},v.flushMainBuffer=function(f,d){h.prototype.flushMainBuffer.call(this,f,d,this.altAudio?"video":null)},v.onMediaAttached=function(f,d){h.prototype.onMediaAttached.call(this,f,d);var a=d.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new O.default(this.config,a,this.fragmentTracker,this.hls)},v.onMediaDetaching=function(){var f=this.media;f&&(f.removeEventListener("playing",this.onvplaying),f.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),h.prototype.onMediaDetaching.call(this)},v.onMediaPlaying=function(){this.tick()},v.onMediaSeeked=function(){var f=this.media,d=f?f.currentTime:null;Object(H.isFiniteNumber)(d)&&this.log("Media seeked to "+d.toFixed(3)),this.tick()},v.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(W.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},v.onManifestParsed=function(f,d){var a=!1,x=!1,m;d.levels.forEach(function(S){m=S.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(a=!0),m.indexOf("mp4a.40.5")!==-1&&(x=!0))}),this.audioCodecSwitch=a&&x&&!Object(M.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=d.levels,this.startFragRequested=!1},v.onLevelLoading=function(f,d){var a=this.levels;if(!a||this.state!==C.State.IDLE)return;var x=a[d.level];(!x.details||x.details.live&&this.levelLastLoaded!==d.level||this.waitForCdnTuneIn(x.details))&&(this.state=C.State.WAITING_LEVEL)},v.onLevelLoaded=function(f,d){var a,x=this.levels,m=d.level,S=d.details,I=S.totalduration;if(!x){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+S.startSN+","+S.endSN+"], cc ["+S.startCC+", "+S.endCC+"] duration:"+I);var z=this.fragCurrent;z&&(this.state===C.State.FRAG_LOADING||this.state===C.State.FRAG_LOADING_WAITING_RETRY)&&(z.level!==d.level&&z.loader&&(this.state=C.State.IDLE,z.loader.abort()));var Y=x[m],ie=0;if(S.live||(a=Y.details)!==null&&a!==void 0&&a.live){if(S.fragments[0]||(S.deltaUpdateFailed=!0),S.deltaUpdateFailed)return;ie=this.alignPlaylists(S,Y.details)}if(Y.details=S,this.levelLastLoaded=m,this.hls.trigger(W.Events.LEVEL_UPDATED,{details:S,level:m}),this.state===C.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(S))return;this.state=C.State.IDLE}this.startFragRequested?S.live&&this.synchronizeToLiveEdge(S):this.setStartPosition(S,ie),this.tick()},v._handleFragmentLoadProgress=function(f){var d,a=f.frag,x=f.part,m=f.payload,S=this.levels;if(!S){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var I=S[a.level],z=I.details;if(!z){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var Y=I.videoCodec,ie=z.PTSKnown||!z.live,G=(d=a.initSegment)===null||d===void 0?void 0:d.data,j=this._getAudioCodec(I),oe=this.transmuxer=this.transmuxer||new T.default(this.hls,R.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ye=x?x.index:-1,Ce=ye!==-1,De=new _.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,m.byteLength,ye,Ce),Ye=this.initPTS[a.cc];oe.push(m,G,j,Y,a,x,z.totalduration,ie,De,Ye)},v.onAudioTrackSwitching=function(f,d){var a=this.altAudio,x=!!d.url,m=d.id;if(!x){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var S=this.fragCurrent;S!=null&&S.loader&&(this.log("Switching to main audio track, cancel main fragment load"),S.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var I=this.hls;a&&I.trigger(W.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),I.trigger(W.Events.AUDIO_TRACK_SWITCHED,{id:m})}},v.onAudioTrackSwitched=function(f,d){var a=d.id,x=!!this.hls.audioTracks[a].url;if(x){var m=this.videoBuffer;m&&this.mediaBuffer!==m&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=m)}this.altAudio=x,this.tick()},v.onBufferCreated=function(f,d){var a=d.tracks,x,m,S=!1;for(var I in a){var z=a[I];if(z.id==="main"){if(m=I,x=z,I==="video"){var Y=a[I];Y&&(this.videoBuffer=Y.buffer)}}else S=!0}S&&x?(this.log("Alternate track found, use "+m+".buffered to schedule main fragment loading"),this.mediaBuffer=x.buffer):this.mediaBuffer=this.media},v.onFragBuffered=function(f,d){var a=d.frag,x=d.part;if(a&&a.type!==R.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(x?" p: "+x.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===C.State.PARSED&&(this.state=C.State.IDLE);return}var m=x?x.stats:a.stats;this.fragLastKbps=Math.round(8*m.total/(m.buffering.end-m.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,x)},v.onError=function(f,d){switch(d.details){case w.ErrorDetails.FRAG_LOAD_ERROR:case w.ErrorDetails.FRAG_LOAD_TIMEOUT:case w.ErrorDetails.KEY_LOAD_ERROR:case w.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.MAIN,d);break;case w.ErrorDetails.LEVEL_LOAD_ERROR:case w.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==C.State.ERROR&&(d.fatal?(this.warn(""+d.details),this.state=C.State.ERROR):!d.levelRetry&&this.state===C.State.WAITING_LEVEL&&(this.state=C.State.IDLE));break;case w.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="main"&&(this.state===C.State.PARSING||this.state===C.State.PARSED)){var a=!0,x=this.getFwdBufferInfo(this.media,R.PlaylistLevelType.MAIN);x&&x.len>.5&&(a=!this.reduceMaxBufferLength(x.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},v.checkBuffer=function(){var f=this.media,d=this.gapController;if(!f||!d||!f.readyState)return;var a=B.BufferHelper.getBuffered(f);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):d.poll(this.lastCurrentTime),this.lastCurrentTime=f.currentTime},v.onFragLoadEmergencyAborted=function(){this.state=C.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},v.onBufferFlushed=function(f,d){var a=d.type;if(a!==y.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var x=(a===y.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(x,a,R.PlaylistLevelType.MAIN)}},v.onLevelsUpdated=function(f,d){this.levels=d.levels},v.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},v.seekToStartPos=function(){var f=this.media,d=f.currentTime,a=this.startPosition;if(a>=0&&d<a){if(f.seeking){g.logger.log("could not seek to "+a+", already seeking at "+d);return}var x=B.BufferHelper.getBuffered(f),m=x.length?x.start(0):0,S=m-a;S>0&&(S<this.config.maxBufferHole||S<this.config.maxFragLookUpTolerance)&&(g.logger.log("adjusting start position by "+S+" to match buffer start"),a+=S,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+d),f.currentTime=a}},v._getAudioCodec=function(f){var d=this.config.defaultAudioCodec||f.audioCodec;return this.audioCodecSwap&&d&&(this.log("Swapping audio codec"),d.indexOf("mp4a.40.5")!==-1?d="mp4a.40.2":d="mp4a.40.5"),d},v._loadBitrateTestFrag=function(f){var d=this;this._doFragLoad(f).then(function(a){var x=d.hls;if(!a||x.nextLoadLevel||d.fragContextChanged(f))return;d.fragLoadError=0,d.state=C.State.IDLE,d.startFragRequested=!1,d.bitrateTest=!1;var m=f.stats;m.parsing.start=m.parsing.end=m.buffering.start=m.buffering.end=self.performance.now(),x.trigger(W.Events.FRAG_LOADED,a)})},v._handleTransmuxComplete=function(f){var d,a="main",x=this.hls,m=f.remuxResult,S=f.chunkMeta,I=this.getCurrentContext(S);if(!I){this.warn("The loading context changed while buffering fragment "+S.sn+" of level "+S.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(S.level);return}var z=I.frag,Y=I.part,ie=I.level,G=m.video,j=m.text,oe=m.id3,ye=m.initSegment,Ce=this.altAudio?void 0:m.audio;if(this.fragContextChanged(z))return;if(this.state=C.State.PARSING,ye){ye.tracks&&(this._bufferInitSegment(ie,ye.tracks,z,S),x.trigger(W.Events.FRAG_PARSING_INIT_SEGMENT,{frag:z,id:a,tracks:ye.tracks}));var De=ye.initPTS,Ye=ye.timescale;Object(H.isFiniteNumber)(De)&&(this.initPTS[z.cc]=De,x.trigger(W.Events.INIT_PTS_FOUND,{frag:z,id:a,initPTS:De,timescale:Ye}))}if(G&&m.independent!==!1){if(ie.details){var Ie=G.startPTS,Ve=G.endPTS,Ne=G.startDTS,Ue=G.endDTS;if(Y)Y.elementaryStreams[G.type]={startPTS:Ie,endPTS:Ve,startDTS:Ne,endDTS:Ue};else if(G.firstKeyFrame&&G.independent&&(this.couldBacktrack=!0),G.dropped&&G.independent){var Ae=this.getLoadPosition()+this.config.maxBufferHole;if(Ae<Ie){this.backtrack(z);return}z.setElementaryStreamInfo(G.type,z.start,Ve,z.start,Ue,!0)}z.setElementaryStreamInfo(G.type,Ie,Ve,Ne,Ue),this.bufferFragmentData(G,z,Y,S)}}else if(m.independent===!1){this.backtrack(z);return}if(Ce){var F=Ce.startPTS,A=Ce.endPTS,D=Ce.startDTS,K=Ce.endDTS;Y&&(Y.elementaryStreams[y.ElementaryStreamTypes.AUDIO]={startPTS:F,endPTS:A,startDTS:D,endDTS:K}),z.setElementaryStreamInfo(y.ElementaryStreamTypes.AUDIO,F,A,D,K),this.bufferFragmentData(Ce,z,Y,S)}if(oe!=null&&(d=oe.samples)!==null&&d!==void 0&&d.length){var J={frag:z,id:a,samples:oe.samples};x.trigger(W.Events.FRAG_PARSING_METADATA,J)}if(j){var U={frag:z,id:a,samples:j.samples};x.trigger(W.Events.FRAG_PARSING_USERDATA,U)}},v._bufferInitSegment=function(f,d,a,x){var m=this;if(this.state!==C.State.PARSING)return;this.audioOnly=!!d.audio&&!d.video,this.altAudio&&!this.audioOnly&&delete d.audio;var S=d.audio,I=d.video,z=d.audiovideo;if(S){var Y=f.audioCodec,ie=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(Y&&(Y.indexOf("mp4a.40.5")!==-1?Y="mp4a.40.2":Y="mp4a.40.5"),S.metadata.channelCount!==1&&ie.indexOf("firefox")===-1&&(Y="mp4a.40.5")),ie.indexOf("android")!==-1&&S.container!=="audio/mpeg"&&(Y="mp4a.40.2",this.log("Android: force audio codec to "+Y)),f.audioCodec&&f.audioCodec!==Y&&this.log('Swapping manifest audio codec "'+f.audioCodec+'" for "'+Y+'"'),S.levelCodec=Y,S.id="main",this.log("Init audio buffer, container:"+S.container+", codecs[selected/level/parsed]=["+(Y||"")+"/"+(f.audioCodec||"")+"/"+S.codec+"]")}I&&(I.levelCodec=f.videoCodec,I.id="main",this.log("Init video buffer, container:"+I.container+", codecs[level/parsed]=["+(f.videoCodec||"")+"/"+I.codec+"]")),z&&this.log("Init audiovideo buffer, container:"+z.container+", codecs[level/parsed]=["+(f.attrs.CODECS||"")+"/"+z.codec+"]"),this.hls.trigger(W.Events.BUFFER_CODECS,d),Object.keys(d).forEach(function(G){var j=d[G],oe=j.initSegment;oe!=null&&oe.byteLength&&m.hls.trigger(W.Events.BUFFER_APPENDING,{type:G,data:oe,frag:a,part:null,chunkMeta:x,parent:a.type})}),this.tick()},v.backtrack=function(f){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(f);var d=this.fragmentTracker.backtrack(f);this.fragPrevious=null,this.nextLoadPosition=f.start,d?this.resetFragmentLoading(f):this.state=C.State.BACKTRACKING},v.checkFragmentChanged=function(){var f=this.media,d=null;if(f&&f.readyState>1&&f.seeking===!1){var a=f.currentTime;if(B.BufferHelper.isBuffered(f,a)?d=this.getAppendedFrag(a):B.BufferHelper.isBuffered(f,a+.1)&&(d=this.getAppendedFrag(a+.1)),d){var x=this.fragPlaying,m=d.level;(!x||d.sn!==x.sn||x.level!==m||d.urlId!==x.urlId)&&(this.hls.trigger(W.Events.FRAG_CHANGED,{frag:d}),(!x||x.level!==m)&&this.hls.trigger(W.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=d)}}},o(L,[{key:"nextLevel",get:function(){var f=this.nextBufferedFrag;return f?f.level:-1}},{key:"currentLevel",get:function(){var f=this.media;if(f){var d=this.getAppendedFrag(f.currentTime);if(d)return d.level}return-1}},{key:"nextBufferedFrag",get:function(){var f=this.media;if(f){var d=this.getAppendedFrag(f.currentTime);return this.followingBufferedFrag(d)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),L}(C.default)},"./src/controller/subtitle-stream-controller.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"SubtitleStreamController",function(){return s});var H=k("./src/events.ts"),C=k("./src/utils/logger.ts"),M=k("./src/utils/buffer-helper.ts"),W=k("./src/controller/fragment-finders.ts"),B=k("./src/utils/discontinuities.ts"),P=k("./src/controller/level-helper.ts"),R=k("./src/controller/fragment-tracker.ts"),y=k("./src/controller/base-stream-controller.ts"),T=k("./src/types/loader.ts"),_=k("./src/types/level.ts");function O(l,b){for(var p=0;p<b.length;p++){var h=b[p];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(l,h.key,h)}}function w(l,b,p){return b&&O(l.prototype,b),p&&O(l,p),l}function g(l,b){l.prototype=Object.create(b.prototype),l.prototype.constructor=l,u(l,b)}function u(l,b){return u=Object.setPrototypeOf||function(h,L){return h.__proto__=L,h},u(l,b)}var o=500,s=function(l){g(b,l);function b(h,L){var v;return v=l.call(this,h,L,"[subtitle-stream-controller]")||this,v.levels=[],v.currentTrackId=-1,v.tracksBuffered=[],v.mainDetails=null,v._registerListeners(),v}var p=b.prototype;return p.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},p._registerListeners=function(){var L=this.hls;L.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.on(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.on(H.Events.ERROR,this.onError,this),L.on(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.on(H.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.on(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.on(H.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p._unregisterListeners=function(){var L=this.hls;L.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.off(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.off(H.Events.ERROR,this.onError,this),L.off(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.off(H.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.off(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.off(H.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p.startLoad=function(){this.stopLoad(),this.state=y.State.IDLE,this.setInterval(o),this.tick()},p.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},p.onLevelLoaded=function(L,v){this.mainDetails=v.details},p.onSubtitleFragProcessed=function(L,v){var c=v.frag,f=v.success;if(this.fragPrevious=c,this.state=y.State.IDLE,!f)return;var d=this.tracksBuffered[this.currentTrackId];if(!d)return;for(var a,x=c.start,m=0;m<d.length;m++)if(x>=d[m].start&&x<=d[m].end){a=d[m];break}var S=c.start+c.duration;a?a.end=S:(a={start:x,end:S},d.push(a)),this.fragmentTracker.fragBuffered(c)},p.onBufferFlushing=function(L,v){var c=v.startOffset,f=v.endOffset;if(c===0&&f!==Number.POSITIVE_INFINITY){var d=this.currentTrackId,a=this.levels;if(!a.length||!a[d]||!a[d].details)return;var x=a[d].details,m=x.targetduration,S=f-m;if(S<=0)return;v.endOffsetSubtitles=Math.max(0,S),this.tracksBuffered.forEach(function(I){for(var z=0;z<I.length;){if(I[z].end<=S){I.shift();continue}else if(I[z].start<S)I[z].start=S;else break;z++}}),this.fragmentTracker.removeFragmentsInRange(c,S,T.PlaylistLevelType.SUBTITLE)}},p.onError=function(L,v){var c,f=v.frag;if(!f||f.type!==T.PlaylistLevelType.SUBTITLE)return;(c=this.fragCurrent)!==null&&c!==void 0&&c.loader&&this.fragCurrent.loader.abort(),this.state=y.State.IDLE},p.onSubtitleTracksUpdated=function(L,v){var c=this,f=v.subtitleTracks;this.tracksBuffered=[],this.levels=f.map(function(d){return new _.Level(d)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(d){c.tracksBuffered[d.id]=[]}),this.mediaBuffer=null},p.onSubtitleTrackSwitch=function(L,v){if(this.currentTrackId=v.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var c=this.levels[this.currentTrackId];c!=null&&c.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,c&&this.setInterval(o)},p.onSubtitleTrackLoaded=function(L,v){var c,f=v.details,d=v.id,a=this.currentTrackId,x=this.levels;if(!x.length)return;var m=x[a];if(d>=x.length||d!==a||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,f.live||(c=m.details)!==null&&c!==void 0&&c.live){var S=this.mainDetails;if(f.deltaUpdateFailed||!S)return;var I=S.fragments[0];if(!m.details)f.hasProgramDateTime&&S.hasProgramDateTime?Object(B.alignMediaPlaylistByPDT)(f,S):I&&Object(P.addSliding)(f,I.start);else{var z=this.alignPlaylists(f,m.details);z===0&&I&&Object(P.addSliding)(f,I.start)}}if(m.details=f,this.levelLastLoaded=d,this.tick(),f.live&&!this.fragCurrent&&this.media&&this.state===y.State.IDLE){var Y=Object(W.findFragmentByPTS)(null,f.fragments,this.media.currentTime,0);Y||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},p._handleFragmentLoadComplete=function(L){var v=L.frag,c=L.payload,f=v.decryptdata,d=this.hls;if(this.fragContextChanged(v))return;if(c&&c.byteLength>0&&f&&f.key&&f.iv&&f.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(c),f.key.buffer,f.iv.buffer).then(function(x){var m=performance.now();d.trigger(H.Events.FRAG_DECRYPTED,{frag:v,payload:x,stats:{tstart:a,tdecrypt:m}})})}},p.doTick=function(){if(!this.media){this.state=y.State.IDLE;return}if(this.state===y.State.IDLE){var L,v=this.currentTrackId,c=this.levels;if(!c.length||!c[v]||!c[v].details)return;var f=c[v].details,d=f.targetduration,a=this.config,x=this.media,m=M.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,x.currentTime-d,a.maxBufferHole),S=m.end,I=m.len,z=this.getMaxBufferLength()+d;if(I>z)return;console.assert(f,"Subtitle track details are defined on idle subtitle stream controller tick");var Y=f.fragments,ie=Y.length,G=f.edge,j,oe=this.fragPrevious;if(S<G){var ye=a.maxFragLookUpTolerance;oe&&f.hasProgramDateTime&&(j=Object(W.findFragmentByPDT)(Y,oe.endProgramDateTime,ye)),j||(j=Object(W.findFragmentByPTS)(oe,Y,S,ye),!j&&oe&&oe.start<Y[0].start&&(j=Y[0]))}else j=Y[ie-1];(L=j)!==null&&L!==void 0&&L.encrypted?(C.logger.log("Loading key for "+j.sn),this.state=y.State.KEY_LOADING,this.hls.trigger(H.Events.KEY_LOADING,{frag:j})):j&&this.fragmentTracker.getState(j)===R.FragmentState.NOT_LOADED&&this.loadFragment(j,f,S)}},p.loadFragment=function(L,v,c){this.fragCurrent=L,l.prototype.loadFragment.call(this,L,v,c)},w(b,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),b}(y.default)},"./src/controller/subtitle-track-controller.ts":function(de,X,k){"use strict";k.r(X);var H=k("./src/events.ts"),C=k("./src/utils/texttrack-utils.ts"),M=k("./src/controller/base-playlist-controller.ts"),W=k("./src/types/loader.ts");function B(O,w){for(var g=0;g<w.length;g++){var u=w[g];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(O,u.key,u)}}function P(O,w,g){return w&&B(O.prototype,w),g&&B(O,g),O}function R(O,w){O.prototype=Object.create(w.prototype),O.prototype.constructor=O,y(O,w)}function y(O,w){return y=Object.setPrototypeOf||function(u,o){return u.__proto__=o,u},y(O,w)}var T=function(O){R(w,O);function w(u){var o;return o=O.call(this,u,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var g=w.prototype;return g.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,O.prototype.destroy.call(this)},g.registerListeners=function(){var o=this.hls;o.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(H.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){var o=this.hls;o.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(H.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(H.Events.ERROR,this.onError,this)},g.onMediaAttached=function(o,s){if(this.media=s.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},g.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},g.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=_(this.media.textTracks);o.forEach(function(s){Object(C.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},g.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},g.onManifestParsed=function(o,s){this.tracks=s.subtitleTracks},g.onSubtitleTrackLoaded=function(o,s){var l=s.id,b=s.details,p=this.trackId,h=this.tracksInGroup[p];if(!h){this.warn("Invalid subtitle track id "+l);return}var L=h.details;h.details=s.details,this.log("subtitle track "+l+" loaded ["+b.startSN+"-"+b.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,s,L))},g.onLevelLoading=function(o,s){this.switchLevel(s.level)},g.onLevelSwitching=function(o,s){this.switchLevel(s.level)},g.switchLevel=function(o){var s=this.hls.levels[o];if(!(s!=null&&s.textGroupIds))return;var l=s.textGroupIds[s.urlId];if(this.groupId!==l){var b=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,p=this.tracks.filter(function(v){return!l||v.groupId===l});this.tracksInGroup=p;var h=this.findTrackId(b==null?void 0:b.name)||this.findTrackId();this.groupId=l;var L={subtitleTracks:p};this.log("Updating subtitle tracks, "+p.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(H.Events.SUBTITLE_TRACKS_UPDATED,L),h!==-1&&this.setSubtitleTrack(h,b)}},g.findTrackId=function(o){for(var s=this.tracksInGroup,l=0;l<s.length;l++){var b=s[l];if((!this.selectDefaultTrack||b.default)&&(!o||o===b.name))return b.id}return-1},g.onError=function(o,s){if(O.prototype.onError.call(this,o,s),s.fatal||!s.context)return;s.context.type===W.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},g.loadPlaylist=function(o){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var l=s.id,b=s.groupId,p=s.url;if(o)try{p=o.addDirectives(p)}catch(h){this.warn("Could not construct new URL with HLS Delivery Directives: "+h)}this.log("Loading subtitle playlist for id "+l),this.hls.trigger(H.Events.SUBTITLE_TRACK_LOADING,{url:p,id:l,groupId:b,deliveryDirectives:o||null})}},g.toggleTrackModes=function(o){var s=this,l=this.media,b=this.subtitleDisplay,p=this.trackId;if(!l)return;var h=_(l.textTracks),L=h.filter(function(f){return f.groupId===s.groupId});if(o===-1)[].slice.call(h).forEach(function(f){f.mode="disabled"});else{var v=L[p];v&&(v.mode="disabled")}var c=L[o];c&&(c.mode=b?"showing":"hidden")},g.setSubtitleTrack=function(o,s){var l,b=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(l=b[o])!==null&&l!==void 0&&l.details)||o<-1||o>=b.length)return;this.clearTimer();var p=b[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,p){var h=p.id,L=p.groupId,v=L===void 0?"":L,c=p.name,f=p.type,d=p.url;this.hls.trigger(H.Events.SUBTITLE_TRACK_SWITCH,{id:h,groupId:v,name:c,type:f,url:d});var a=this.switchParams(p.url,s==null?void 0:s.details);this.loadPlaylist(a)}else this.hls.trigger(H.Events.SUBTITLE_TRACK_SWITCH,{id:o})},g.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,s=_(this.media.textTracks),l=0;l<s.length;l++)if(s[l].mode==="hidden")o=l;else if(s[l].mode==="showing"){o=l;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},P(w,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,s)}}]),w}(M.default);function _(O){for(var w=[],g=0;g<O.length;g++){var u=O[g];u.kind==="subtitles"&&u.label&&w.push(O[g])}return w}X.default=T},"./src/controller/timeline-controller.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"TimelineController",function(){return _});var H=k("./src/polyfills/number.ts"),C=k("./src/events.ts"),M=k("./src/utils/cea-608-parser.ts"),W=k("./src/utils/output-filter.ts"),B=k("./src/utils/webvtt-parser.ts"),P=k("./src/utils/texttrack-utils.ts"),R=k("./src/utils/imsc1-ttml-parser.ts"),y=k("./src/types/loader.ts"),T=k("./src/utils/logger.ts"),_=function(){function u(s){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=g(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var l=new W.default(this,"textTrack1"),b=new W.default(this,"textTrack2"),p=new W.default(this,"textTrack3"),h=new W.default(this,"textTrack4");this.cea608Parser1=new M.default(1,l,b),this.cea608Parser2=new M.default(3,p,h)}s.on(C.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(C.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(C.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(C.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(C.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(C.Events.FRAG_LOADING,this.onFragLoading,this),s.on(C.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(C.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(C.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(C.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(C.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(C.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=u.prototype;return o.destroy=function(){var l=this.hls;l.off(C.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.off(C.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(C.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(C.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.off(C.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.off(C.Events.FRAG_LOADING,this.onFragLoading,this),l.off(C.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(C.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.off(C.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.off(C.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(C.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.off(C.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(l,b,p,h,L){for(var v=!1,c=L.length;c--;){var f=L[c],d=w(f[0],f[1],b,p);if(d>=0&&(f[0]=Math.min(f[0],b),f[1]=Math.max(f[1],p),v=!0,d/(p-b)>.5))return}if(v||L.push([b,p]),this.config.renderTextTracksNatively){var a=this.captionsTracks[l];this.Cues.newCue(a,b,p,h)}else{var x=this.Cues.newCue(null,b,p,h);this.hls.trigger(C.Events.CUES_PARSED,{type:"captions",cues:x,track:l})}},o.onInitPtsFound=function(l,b){var p=this,h=b.frag,L=b.id,v=b.initPTS,c=b.timescale,f=this.unparsedVttFrags;L==="main"&&(this.initPTS[h.cc]=v,this.timescale[h.cc]=c),f.length&&(this.unparsedVttFrags=[],f.forEach(function(d){p.onFragLoaded(C.Events.FRAG_LOADED,d)}))},o.getExistingTrack=function(l){var b=this.media;if(b)for(var p=0;p<b.textTracks.length;p++){var h=b.textTracks[p];if(h[l])return h}return null},o.createCaptionsTrack=function(l){this.config.renderTextTracksNatively?this.createNativeTrack(l):this.createNonNativeTrack(l)},o.createNativeTrack=function(l){if(this.captionsTracks[l])return;var b=this.captionsProperties,p=this.captionsTracks,h=this.media,L=b[l],v=L.label,c=L.languageCode,f=this.getExistingTrack(l);if(f)p[l]=f,Object(P.clearCurrentCues)(p[l]),Object(P.sendAddTrackEvent)(p[l],h);else{var d=this.createTextTrack("captions",v,c);d&&(d[l]=!0,p[l]=d)}},o.createNonNativeTrack=function(l){if(this.nonNativeCaptionsTracks[l])return;var b=this.captionsProperties[l];if(!b)return;var p=b.label,h={_id:l,label:p,kind:"captions",default:b.media?!!b.media.default:!1,closedCaptions:b.media};this.nonNativeCaptionsTracks[l]=h,this.hls.trigger(C.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[h]})},o.createTextTrack=function(l,b,p){var h=this.media;return h?h.addTextTrack(l,b,p):void 0},o.onMediaAttaching=function(l,b){this.media=b.media,this._cleanTracks()},o.onMediaDetaching=function(){var l=this.captionsTracks;Object.keys(l).forEach(function(b){Object(P.clearCurrentCues)(l[b]),delete l[b]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=g(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},o._cleanTracks=function(){var l=this.media;if(!l)return;var b=l.textTracks;if(b)for(var p=0;p<b.length;p++)Object(P.clearCurrentCues)(b[p])},o.onSubtitleTracksUpdated=function(l,b){var p=this;this.textTracks=[];var h=b.subtitleTracks||[],L=h.some(function(d){return d.textCodec===R.IMSC1_CODEC});if(this.config.enableWebVTT||L&&this.config.enableIMSC1){var v=this.tracks&&h&&this.tracks.length===h.length;if(this.tracks=h||[],this.config.renderTextTracksNatively){var c=this.media?this.media.textTracks:[];this.tracks.forEach(function(d,a){var x;if(a<c.length){for(var m=null,S=0;S<c.length;S++)if(O(c[S],d)){m=c[S];break}m&&(x=m)}x?Object(P.clearCurrentCues)(x):(x=p.createTextTrack("subtitles",d.name,d.lang),x&&(x.mode="disabled")),x&&(x.groupId=d.groupId,p.textTracks.push(x))})}else if(!v&&this.tracks&&this.tracks.length){var f=this.tracks.map(function(d){return{label:d.name,kind:d.type.toLowerCase(),default:d.default,subtitleTrack:d}});this.hls.trigger(C.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:f})}}},o.onManifestLoaded=function(l,b){var p=this;this.config.enableCEA708Captions&&b.captions&&b.captions.forEach(function(h){var L=/(?:CC|SERVICE)([1-4])/.exec(h.instreamId);if(!L)return;var v="textTrack"+L[1],c=p.captionsProperties[v];if(!c)return;c.label=h.name,h.lang&&(c.languageCode=h.lang),c.media=h})},o.onFragLoading=function(l,b){var p=this.cea608Parser1,h=this.cea608Parser2,L=this.lastSn,v=this.lastPartIndex;if(!this.enabled||!(p&&h))return;if(b.frag.type===y.PlaylistLevelType.MAIN){var c,f,d=b.frag.sn,a=(c=b==null||((f=b.part)===null||f===void 0)?void 0:f.index)!=null?c:-1;d===L+1||d===L&&a===v+1||(p.reset(),h.reset()),this.lastSn=d,this.lastPartIndex=a}},o.onFragLoaded=function(l,b){var p=b.frag,h=b.payload,L=this.initPTS,v=this.unparsedVttFrags;if(p.type===y.PlaylistLevelType.SUBTITLE)if(h.byteLength){if(!Object(H.isFiniteNumber)(L[p.cc])){v.push(b),L.length&&this.hls.trigger(C.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Missing initial subtitle PTS")});return}var c=p.decryptdata;if(c==null||c.key==null||c.method!=="AES-128"){var f=this.tracks[p.level],d=this.vttCCs;d[p.cc]||(d[p.cc]={start:p.start,prevCC:this.prevCC,new:!0},this.prevCC=p.cc),f&&f.textCodec===R.IMSC1_CODEC?this._parseIMSC1(p,h):this._parseVTTs(p,h,d)}}else this.hls.trigger(C.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(l,b){var p=this,h=this.hls;Object(R.parseIMSC1)(b,this.initPTS[l.cc],this.timescale[l.cc],function(L){p._appendCues(L,l.level),h.trigger(C.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(L){T.logger.log("Failed to parse IMSC1: "+L),h.trigger(C.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:L})})},o._parseVTTs=function(l,b,p){var h=this,L=this.hls;Object(B.parseWebVTT)(b,this.initPTS[l.cc],this.timescale[l.cc],p,l.cc,l.start,function(v){h._appendCues(v,l.level),L.trigger(C.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(v){h._fallbackToIMSC1(l,b),T.logger.log("Failed to parse VTT cue: "+v),L.trigger(C.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:v})})},o._fallbackToIMSC1=function(l,b){var p=this,h=this.tracks[l.level];h.textCodec||Object(R.parseIMSC1)(b,this.initPTS[l.cc],this.timescale[l.cc],function(){h.textCodec=R.IMSC1_CODEC,p._parseIMSC1(l,b)},function(){h.textCodec="wvtt"})},o._appendCues=function(l,b){var p=this.hls;if(this.config.renderTextTracksNatively){var h=this.textTracks[b];if(h.mode==="disabled")return;l.forEach(function(c){return Object(P.addCueToTrack)(h,c)})}else{var L=this.tracks[b],v=L.default?"default":"subtitles"+b;p.trigger(C.Events.CUES_PARSED,{type:"subtitles",cues:l,track:v})}},o.onFragDecrypted=function(l,b){var p=b.frag;if(p.type===y.PlaylistLevelType.SUBTITLE){if(!Object(H.isFiniteNumber)(this.initPTS[p.cc])){this.unparsedVttFrags.push(b);return}this.onFragLoaded(C.Events.FRAG_LOADED,b)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(l,b){var p=this.cea608Parser1,h=this.cea608Parser2;if(!this.enabled||!(p&&h))return;for(var L=0;L<b.samples.length;L++){var v=b.samples[L].bytes;if(v){var c=this.extractCea608Data(v);p.addData(b.samples[L].pts,c[0]),h.addData(b.samples[L].pts,c[1])}}},o.onBufferFlushing=function(l,b){var p=b.startOffset,h=b.endOffset,L=b.endOffsetSubtitles,v=b.type,c=this.media;if(!c||c.currentTime<h)return;if(!v||v==="video"){var f=this.captionsTracks;Object.keys(f).forEach(function(a){return Object(P.removeCuesInRange)(f[a],p,h)})}if(this.config.renderTextTracksNatively&&(p===0&&L!==void 0)){var d=this.textTracks;Object.keys(d).forEach(function(a){return Object(P.removeCuesInRange)(d[a],p,L)})}},o.extractCea608Data=function(l){for(var b=l[0]&31,p=2,h=[[],[]],L=0;L<b;L++){var v=l[p++],c=127&l[p++],f=127&l[p++],d=(4&v)!==0,a=3&v;if(c===0&&f===0)continue;d&&((a===0||a===1)&&(h[a].push(c),h[a].push(f)))}return h},u}();function O(u,o){return u&&u.label===o.name&&!(u.textTrack1||u.textTrack2)}function w(u,o,s,l){return Math.min(o,l)-Math.max(u,s)}function g(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"default",function(){return H});var H=function(){function C(W,B){this.subtle=void 0,this.aesIV=void 0,this.subtle=W,this.aesIV=B}var M=C.prototype;return M.decrypt=function(B,P){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},P,B)},C}()},"./src/crypt/aes-decryptor.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"removePadding",function(){return C}),k.d(X,"default",function(){return M});var H=k("./src/utils/typed-array.ts");function C(W){var B=W.byteLength,P=B&&new DataView(W.buffer).getUint8(B-1);return P?Object(H.sliceUint8)(W,0,B-P):W}var M=function(){function W(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var B=W.prototype;return B.uint8ArrayToUint32Array_=function(R){for(var y=new DataView(R),T=new Uint32Array(4),_=0;_<4;_++)T[_]=y.getUint32(_*4);return T},B.initTable=function(){var R=this.sBox,y=this.invSBox,T=this.subMix,_=T[0],O=T[1],w=T[2],g=T[3],u=this.invSubMix,o=u[0],s=u[1],l=u[2],b=u[3],p=new Uint32Array(256),h=0,L=0,v=0;for(v=0;v<256;v++)v<128?p[v]=v<<1:p[v]=v<<1^283;for(v=0;v<256;v++){var c=L^L<<1^L<<2^L<<3^L<<4;c=c>>>8^c&255^99,R[h]=c,y[c]=h;var f=p[h],d=p[f],a=p[d],x=p[c]*257^c*16843008;_[h]=x<<24|x>>>8,O[h]=x<<16|x>>>16,w[h]=x<<8|x>>>24,g[h]=x,x=a*16843009^d*65537^f*257^h*16843008,o[c]=x<<24|x>>>8,s[c]=x<<16|x>>>16,l[c]=x<<8|x>>>24,b[c]=x,h?(h=f^p[p[p[a^f]]],L^=p[p[L]]):h=L=1}},B.expandKey=function(R){for(var y=this.uint8ArrayToUint32Array_(R),T=!0,_=0;_<y.length&&T;)T=y[_]===this.key[_],_++;if(T)return;this.key=y;var O=this.keySize=y.length;if(O!==4&&O!==6&&O!==8)throw new Error("Invalid aes key size="+O);var w=this.ksRows=(O+6+1)*4,g,u,o=this.keySchedule=new Uint32Array(w),s=this.invKeySchedule=new Uint32Array(w),l=this.sBox,b=this.rcon,p=this.invSubMix,h=p[0],L=p[1],v=p[2],c=p[3],f,d;for(g=0;g<w;g++){if(g<O){f=o[g]=y[g];continue}d=f,g%O===0?(d=d<<8|d>>>24,d=l[d>>>24]<<24|l[d>>>16&255]<<16|l[d>>>8&255]<<8|l[d&255],d^=b[g/O|0]<<24):O>6&&g%O===4&&(d=l[d>>>24]<<24|l[d>>>16&255]<<16|l[d>>>8&255]<<8|l[d&255]),o[g]=f=(o[g-O]^d)>>>0}for(u=0;u<w;u++)g=w-u,u&3?d=o[g]:d=o[g-4],u<4||g<=4?s[u]=d:s[u]=h[l[d>>>24]]^L[l[d>>>16&255]]^v[l[d>>>8&255]]^c[l[d&255]],s[u]=s[u]>>>0},B.networkToHostOrderSwap=function(R){return R<<24|(R&65280)<<8|(R&16711680)>>8|R>>>24},B.decrypt=function(R,y,T){for(var _=this.keySize+6,O=this.invKeySchedule,w=this.invSBox,g=this.invSubMix,u=g[0],o=g[1],s=g[2],l=g[3],b=this.uint8ArrayToUint32Array_(T),p=b[0],h=b[1],L=b[2],v=b[3],c=new Int32Array(R),f=new Int32Array(c.length),d,a,x,m,S,I,z,Y,ie,G,j,oe,ye,Ce,De=this.networkToHostOrderSwap;y<c.length;){for(ie=De(c[y]),G=De(c[y+1]),j=De(c[y+2]),oe=De(c[y+3]),S=ie^O[0],I=oe^O[1],z=j^O[2],Y=G^O[3],ye=4,Ce=1;Ce<_;Ce++)d=u[S>>>24]^o[I>>16&255]^s[z>>8&255]^l[Y&255]^O[ye],a=u[I>>>24]^o[z>>16&255]^s[Y>>8&255]^l[S&255]^O[ye+1],x=u[z>>>24]^o[Y>>16&255]^s[S>>8&255]^l[I&255]^O[ye+2],m=u[Y>>>24]^o[S>>16&255]^s[I>>8&255]^l[z&255]^O[ye+3],S=d,I=a,z=x,Y=m,ye=ye+4;d=w[S>>>24]<<24^w[I>>16&255]<<16^w[z>>8&255]<<8^w[Y&255]^O[ye],a=w[I>>>24]<<24^w[z>>16&255]<<16^w[Y>>8&255]<<8^w[S&255]^O[ye+1],x=w[z>>>24]<<24^w[Y>>16&255]<<16^w[S>>8&255]<<8^w[I&255]^O[ye+2],m=w[Y>>>24]<<24^w[S>>16&255]<<16^w[I>>8&255]<<8^w[z&255]^O[ye+3],f[y]=De(d^p),f[y+1]=De(m^h),f[y+2]=De(x^L),f[y+3]=De(a^v),p=ie,h=G,L=j,v=oe,y=y+4}return f.buffer},W}()},"./src/crypt/decrypter.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"default",function(){return y});var H=k("./src/crypt/aes-crypto.ts"),C=k("./src/crypt/fast-aes-key.ts"),M=k("./src/crypt/aes-decryptor.ts"),W=k("./src/utils/logger.ts"),B=k("./src/utils/mp4-tools.ts"),P=k("./src/utils/typed-array.ts"),R=16,y=function(){function T(O,w,g){var u=g===void 0?{}:g,o=u.removePKCS7Padding,s=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=O,this.config=w,this.removePKCS7Padding=s,s)try{var l=self.crypto;l&&(this.subtle=l.subtle||l.webkitSubtle)}catch(b){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var _=T.prototype;return _.destroy=function(){this.observer=null},_.isSync=function(){return this.config.enableSoftwareAES},_.flush=function(){var w=this.currentResult;if(!w){this.reset();return}var g=new Uint8Array(w);return this.reset(),this.removePKCS7Padding?Object(M.removePadding)(g):g},_.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},_.decrypt=function(w,g,u,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(w),g,u);var s=this.flush();s&&o(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(w),g,u).then(o)},_.softwareDecrypt=function(w,g,u){var o=this.currentIV,s=this.currentResult,l=this.remainderData;this.logOnce("JS AES decrypt"),l&&(w=Object(B.appendUint8Array)(l,w),this.remainderData=null);var b=this.getValidChunk(w);if(!b.length)return null;o&&(u=o);var p=this.softwareDecrypter;p||(p=this.softwareDecrypter=new M.default),p.expandKey(g);var h=s;return this.currentResult=p.decrypt(b.buffer,0,u),this.currentIV=Object(P.sliceUint8)(b,-16).buffer,h||null},_.webCryptoDecrypt=function(w,g,u){var o=this,s=this.subtle;return(this.key!==g||!this.fastAesKey)&&(this.key=g,this.fastAesKey=new C.default(s,g)),this.fastAesKey.expandKey().then(function(l){if(!s)return Promise.reject(new Error("web crypto not initialized"));var b=new H.default(s,u);return b.decrypt(w.buffer,l)}).catch(function(l){return o.onWebCryptoError(l,w,g,u)})},_.onWebCryptoError=function(w,g,u,o){return W.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",w),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(g,u,o)},_.getValidChunk=function(w){var g=w,u=w.length-w.length%R;return u!==w.length&&(g=Object(P.sliceUint8)(w,0,u),this.remainderData=Object(P.sliceUint8)(w,u)),g},_.logOnce=function(w){if(!this.logEnabled)return;W.logger.log("[decrypter.ts]: "+w),this.logEnabled=!1},T}()},"./src/crypt/fast-aes-key.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"default",function(){return H});var H=function(){function C(W,B){this.subtle=void 0,this.key=void 0,this.subtle=W,this.key=B}var M=C.prototype;return M.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},C}()},"./src/demux/aacdemuxer.ts":function(de,X,k){"use strict";k.r(X);var H=k("./src/demux/base-audio-demuxer.ts"),C=k("./src/demux/adts.ts"),M=k("./src/utils/logger.ts"),W=k("./src/demux/id3.ts");function B(y,T){y.prototype=Object.create(T.prototype),y.prototype.constructor=y,P(y,T)}function P(y,T){return P=Object.setPrototypeOf||function(O,w){return O.__proto__=w,O},P(y,T)}var R=function(y){B(T,y);function T(O,w){var g;return g=y.call(this)||this,g.observer=void 0,g.config=void 0,g.observer=O,g.config=w,g}var _=T.prototype;return _.resetInitSegment=function(w,g,u){y.prototype.resetInitSegment.call(this,w,g,u),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:w,duration:u,inputTimeScale:9e4,dropped:0}},T.probe=function(w){if(!w)return!1;for(var g=W.getID3Data(w,0)||[],u=g.length,o=w.length;u<o;u++)if(C.probe(w,u))return M.logger.log("ADTS sync word found !"),!0;return!1},_.canParse=function(w,g){return C.canParse(w,g)},_.appendFrame=function(w,g,u){C.initTrackConfig(w,this.observer,g,u,w.manifestCodec);var o=C.appendFrame(w,g,u,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},T}(H.default);R.minProbeByteLength=9,X.default=R},"./src/demux/adts.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"getAudioConfig",function(){return W}),k.d(X,"isHeaderPattern",function(){return B}),k.d(X,"getHeaderLength",function(){return P}),k.d(X,"getFullFrameLength",function(){return R}),k.d(X,"canGetFrameLength",function(){return y}),k.d(X,"isHeader",function(){return T}),k.d(X,"canParse",function(){return _}),k.d(X,"probe",function(){return O}),k.d(X,"initTrackConfig",function(){return w}),k.d(X,"getFrameDuration",function(){return g}),k.d(X,"parseFrameHeader",function(){return u}),k.d(X,"appendFrame",function(){return o});var H=k("./src/utils/logger.ts"),C=k("./src/errors.ts"),M=k("./src/events.ts");function W(s,l,b,p){var h,L,v,c,f=navigator.userAgent.toLowerCase(),d=p,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];h=((l[b+2]&192)>>>6)+1;var x=(l[b+2]&60)>>>2;if(x>a.length-1){s.trigger(M.Events.ERROR,{type:C.ErrorTypes.MEDIA_ERROR,details:C.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+x});return}return v=(l[b+2]&1)<<2,v|=(l[b+3]&192)>>>6,H.logger.log("manifest codec:"+p+", ADTS type:"+h+", samplingIndex:"+x),/firefox/i.test(f)?x>=6?(h=5,c=new Array(4),L=x-3):(h=2,c=new Array(2),L=x):f.indexOf("android")!==-1?(h=2,c=new Array(2),L=x):(h=5,c=new Array(4),p&&(p.indexOf("mp4a.40.29")!==-1||p.indexOf("mp4a.40.5")!==-1)||!p&&x>=6?L=x-3:((p&&p.indexOf("mp4a.40.2")!==-1&&(x>=6&&v===1||/vivaldi/i.test(f))||!p&&v===1)&&(h=2,c=new Array(2)),L=x)),c[0]=h<<3,c[0]|=(x&14)>>1,c[1]|=(x&1)<<7,c[1]|=v<<3,h===5&&(c[1]|=(L&14)>>1,c[2]=(L&1)<<7,c[2]|=2<<2,c[3]=0),{config:c,samplerate:a[x],channelCount:v,codec:"mp4a.40."+h,manifestCodec:d}}function B(s,l){return s[l]===255&&(s[l+1]&246)===240}function P(s,l){return s[l+1]&1?7:9}function R(s,l){return(s[l+3]&3)<<11|s[l+4]<<3|(s[l+5]&224)>>>5}function y(s,l){return l+5<s.length}function T(s,l){return l+1<s.length&&B(s,l)}function _(s,l){return y(s,l)&&B(s,l)&&R(s,l)<=s.length-l}function O(s,l){if(T(s,l)){var b=P(s,l);if(l+b>=s.length)return!1;var p=R(s,l);if(p<=b)return!1;var h=l+p;return h===s.length||T(s,h)}return!1}function w(s,l,b,p,h){if(!s.samplerate){var L=W(l,b,p,h);if(!L)return;s.config=L.config,s.samplerate=L.samplerate,s.channelCount=L.channelCount,s.codec=L.codec,s.manifestCodec=L.manifestCodec,H.logger.log("parsed codec:"+s.codec+", rate:"+L.samplerate+", channels:"+L.channelCount)}}function g(s){return 1024*9e4/s}function u(s,l,b,p,h){var L=P(s,l),v=R(s,l);if(v-=L,v>0){var c=b+p*h;return{headerLength:L,frameLength:v,stamp:c}}}function o(s,l,b,p,h){var L=g(s.samplerate),v=u(l,b,p,h,L);if(v){var c=v.frameLength,f=v.headerLength,d=v.stamp,a=f+c,x=Math.max(0,b+a-l.length),m;x?(m=new Uint8Array(a-f),m.set(l.subarray(b+f,l.length),0)):m=l.subarray(b+f,b+a);var S={unit:m,pts:d};return x||s.samples.push(S),{sample:S,length:a,missing:x}}}},"./src/demux/base-audio-demuxer.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"initPTSFn",function(){return R});var H=k("./src/polyfills/number.ts"),C=k("./src/demux/id3.ts"),M=k("./src/demux/dummy-demuxed-track.ts"),W=k("./src/utils/mp4-tools.ts"),B=k("./src/utils/typed-array.ts"),P=function(){function y(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var T=y.prototype;return T.resetInitSegment=function(O,w,g){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},T.resetTimeStamp=function(){},T.resetContiguity=function(){},T.canParse=function(O,w){return!1},T.appendFrame=function(O,w,g){},T.demux=function(O,w){this.cachedData&&(O=Object(W.appendUint8Array)(this.cachedData,O),this.cachedData=null);var g=C.getID3Data(O,0),u=g?g.length:0,o,s,l=this._audioTrack,b=this._id3Track,p=g?C.getTimeStamp(g):void 0,h=O.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=R(p,w)),g&&g.length>0&&b.samples.push({pts:this.initPTS,dts:this.initPTS,data:g}),s=this.initPTS;u<h;){if(this.canParse(O,u)){var L=this.appendFrame(l,O,u);L?(this.frameIndex++,s=L.sample.pts,u+=L.length,o=u):u=h}else C.canParse(O,u)?(g=C.getID3Data(O,u),b.samples.push({pts:s,dts:s,data:g}),u+=g.length,o=u):u++;if(u===h&&o!==h){var v=Object(B.sliceUint8)(O,o);this.cachedData?this.cachedData=Object(W.appendUint8Array)(this.cachedData,v):this.cachedData=v}}return{audioTrack:l,avcTrack:Object(M.dummyTrack)(),id3Track:b,textTrack:Object(M.dummyTrack)()}},T.demuxSampleAes=function(O,w,g){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},T.flush=function(O){var w=this.cachedData;return w&&(this.cachedData=null,this.demux(w,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(M.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(M.dummyTrack)()}},T.destroy=function(){},y}(),R=function(T,_){return Object(H.isFiniteNumber)(T)?T*90:_*9e4};X.default=P},"./src/demux/chunk-cache.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"default",function(){return H});var H=function(){function M(){this.chunks=[],this.dataLength=0}var W=M.prototype;return W.push=function(P){this.chunks.push(P),this.dataLength+=P.length},W.flush=function(){var P=this.chunks,R=this.dataLength,y;if(P.length)P.length===1?y=P[0]:y=C(P,R);else return new Uint8Array(0);return this.reset(),y},W.reset=function(){this.chunks.length=0,this.dataLength=0},M}();function C(M,W){for(var B=new Uint8Array(W),P=0,R=0;R<M.length;R++){var y=M[R];B.set(y,P),P+=y.length}return B}},"./src/demux/dummy-demuxed-track.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"dummyTrack",function(){return H});function H(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(de,X,k){"use strict";k.r(X);var H=k("./src/utils/logger.ts"),C=function(){function M(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 W=M.prototype;return W.loadWord=function(){var P=this.data,R=this.bytesAvailable,y=P.byteLength-R,T=new Uint8Array(4),_=Math.min(4,R);if(_===0)throw new Error("no bytes available");T.set(P.subarray(y,y+_)),this.word=new DataView(T.buffer).getUint32(0),this.bitsAvailable=_*8,this.bytesAvailable-=_},W.skipBits=function(P){var R;this.bitsAvailable>P?(this.word<<=P,this.bitsAvailable-=P):(P-=this.bitsAvailable,R=P>>3,P-=R>>3,this.bytesAvailable-=R,this.loadWord(),this.word<<=P,this.bitsAvailable-=P)},W.readBits=function(P){var R=Math.min(this.bitsAvailable,P),y=this.word>>>32-R;return P>32&&H.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=P-R,R>0&&this.bitsAvailable?y<<R|this.readBits(R):y},W.skipLZ=function(){var P;for(P=0;P<this.bitsAvailable;++P)if((this.word&2147483648>>>P)!==0)return this.word<<=P,this.bitsAvailable-=P,P;return this.loadWord(),P+this.skipLZ()},W.skipUEG=function(){this.skipBits(1+this.skipLZ())},W.skipEG=function(){this.skipBits(1+this.skipLZ())},W.readUEG=function(){var P=this.skipLZ();return this.readBits(P+1)-1},W.readEG=function(){var P=this.readUEG();return 1&P?1+P>>>1:-1*(P>>>1)},W.readBoolean=function(){return this.readBits(1)===1},W.readUByte=function(){return this.readBits(8)},W.readUShort=function(){return this.readBits(16)},W.readUInt=function(){return this.readBits(32)},W.skipScalingList=function(P){for(var R=8,y=8,T,_=0;_<P;_++)y!==0&&(T=this.readEG(),y=(R+T+256)%256),R=y===0?R:y},W.readSPS=function(){var P=0,R=0,y=0,T=0,_,O,w,g=this.readUByte.bind(this),u=this.readBits.bind(this),o=this.readUEG.bind(this),s=this.readBoolean.bind(this),l=this.skipBits.bind(this),b=this.skipEG.bind(this),p=this.skipUEG.bind(this),h=this.skipScalingList.bind(this);g();var L=g();if(u(5),l(3),g(),p(),L===100||L===110||L===122||L===244||L===44||L===83||L===86||L===118||L===128){var v=o();if(v===3&&l(1),p(),p(),l(1),s())for(O=v!==3?8:12,w=0;w<O;w++)s()&&(w<6?h(16):h(64))}p();var c=o();if(c===0)o();else if(c===1)for(l(1),b(),b(),_=o(),w=0;w<_;w++)b();p(),l(1);var f=o(),d=o(),a=u(1);a===0&&l(1),l(1),s()&&(P=o(),R=o(),y=o(),T=o());var x=[1,1];if(s()&&s()){var m=g();switch(m){case 1:x=[1,1];break;case 2:x=[12,11];break;case 3:x=[10,11];break;case 4:x=[16,11];break;case 5:x=[40,33];break;case 6:x=[24,11];break;case 7:x=[20,11];break;case 8:x=[32,11];break;case 9:x=[80,33];break;case 10:x=[18,11];break;case 11:x=[15,11];break;case 12:x=[64,33];break;case 13:x=[160,99];break;case 14:x=[4,3];break;case 15:x=[3,2];break;case 16:x=[2,1];break;case 255:{x=[g()<<8|g(),g()<<8|g()];break}}}return{width:Math.ceil((f+1)*16-P*2-R*2),height:(2-a)*(d+1)*16-(a?2:4)*(y+T),pixelRatio:x}},W.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},M}();X.default=C},"./src/demux/id3.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"isHeader",function(){return H}),k.d(X,"isFooter",function(){return C}),k.d(X,"getID3Data",function(){return M}),k.d(X,"canParse",function(){return B}),k.d(X,"getTimeStamp",function(){return P}),k.d(X,"isTimeStampFrame",function(){return R}),k.d(X,"getID3Frames",function(){return T}),k.d(X,"decodeFrame",function(){return _}),k.d(X,"utf8ArrayToStr",function(){return o}),k.d(X,"testables",function(){return s});var H=function(h,L){return L+10<=h.length&&(h[L]===73&&h[L+1]===68&&h[L+2]===51&&(h[L+3]<255&&h[L+4]<255&&(h[L+6]<128&&h[L+7]<128&&h[L+8]<128&&h[L+9]<128)))},C=function(h,L){return L+10<=h.length&&(h[L]===51&&h[L+1]===68&&h[L+2]===73&&(h[L+3]<255&&h[L+4]<255&&(h[L+6]<128&&h[L+7]<128&&h[L+8]<128&&h[L+9]<128)))},M=function(h,L){for(var v=L,c=0;H(h,L);){c+=10;var f=W(h,L+6);c+=f,C(h,L+10)&&(c+=10),L+=c}return c>0?h.subarray(v,v+c):void 0},W=function(h,L){var v=0;return v=(h[L]&127)<<21,v|=(h[L+1]&127)<<14,v|=(h[L+2]&127)<<7,v|=h[L+3]&127,v},B=function(h,L){return H(h,L)&&W(h,L+6)+10<=h.length-L},P=function(h){for(var L=T(h),v=0;v<L.length;v++){var c=L[v];if(R(c))return u(c)}return},R=function(h){return h&&h.key==="PRIV"&&h.info==="com.apple.streaming.transportStreamTimestamp"},y=function(h){var L=String.fromCharCode(h[0],h[1],h[2],h[3]),v=W(h,4),c=10;return{type:L,size:v,data:h.subarray(c,c+v)}},T=function(h){for(var L=0,v=[];H(h,L);){var c=W(h,L+6);L+=10;for(var f=L+c;L+8<f;){var d=y(h.subarray(L)),a=_(d);a&&v.push(a),L+=d.size+10}C(h,L)&&(L+=10)}return v},_=function(h){return h.type==="PRIV"?O(h):h.type[0]==="W"?g(h):w(h)},O=function(h){if(h.size<2)return;var L=o(h.data,!0),v=new Uint8Array(h.data.subarray(L.length+1));return{key:h.type,info:L,data:v.buffer}},w=function(h){if(h.size<2)return;if(h.type==="TXXX"){var L=1,v=o(h.data.subarray(L),!0);L+=v.length+1;var c=o(h.data.subarray(L));return{key:h.type,info:v,data:c}}var f=o(h.data.subarray(1));return{key:h.type,data:f}},g=function(h){if(h.type==="WXXX"){if(h.size<2)return;var L=1,v=o(h.data.subarray(L),!0);L+=v.length+1;var c=o(h.data.subarray(L));return{key:h.type,info:v,data:c}}var f=o(h.data);return{key:h.type,data:f}},u=function(h){if(h.data.byteLength===8){var L=new Uint8Array(h.data),v=L[3]&1,c=(L[4]<<23)+(L[5]<<15)+(L[6]<<7)+L[7];return c/=45,v&&(c+=4772185884e-2),Math.round(c)}return},o=function(h,L){L===void 0&&(L=!1);var v=b();if(v){var c=v.decode(h);if(L){var f=c.indexOf("\0");return f!==-1?c.substring(0,f):c}return c.replace(/\0/g,"")}for(var d=h.length,a,x,m,S="",I=0;I<d;){if(a=h[I++],a===0&&L)return S;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:S+=String.fromCharCode(a);break;case 12:case 13:x=h[I++],S+=String.fromCharCode((a&31)<<6|x&63);break;case 14:x=h[I++],m=h[I++],S+=String.fromCharCode((a&15)<<12|(x&63)<<6|(m&63)<<0);break;default:}}return S},s={decodeTextFrame:w},l;function b(){return!l&&typeof self.TextDecoder!="undefined"&&(l=new self.TextDecoder("utf-8")),l}},"./src/demux/mp3demuxer.ts":function(de,X,k){"use strict";k.r(X);var H=k("./src/demux/base-audio-demuxer.ts"),C=k("./src/demux/id3.ts"),M=k("./src/utils/logger.ts"),W=k("./src/demux/mpegaudio.ts");function B(y,T){y.prototype=Object.create(T.prototype),y.prototype.constructor=y,P(y,T)}function P(y,T){return P=Object.setPrototypeOf||function(O,w){return O.__proto__=w,O},P(y,T)}var R=function(y){B(T,y);function T(){return y.apply(this,arguments)||this}var _=T.prototype;return _.resetInitSegment=function(w,g,u){y.prototype.resetInitSegment.call(this,w,g,u),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:w,duration:u,inputTimeScale:9e4,dropped:0}},T.probe=function(w){if(!w)return!1;for(var g=C.getID3Data(w,0)||[],u=g.length,o=w.length;u<o;u++)if(W.probe(w,u))return M.logger.log("MPEG Audio sync word found !"),!0;return!1},_.canParse=function(w,g){return W.canParse(w,g)},_.appendFrame=function(w,g,u){return this.initPTS===null?void 0:W.appendFrame(w,g,u,this.initPTS,this.frameIndex)},T}(H.default);R.minProbeByteLength=4,X.default=R},"./src/demux/mp4demuxer.ts":function(de,X,k){"use strict";k.r(X);var H=k("./src/utils/mp4-tools.ts"),C=k("./src/demux/dummy-demuxed-track.ts"),M=function(){function W(P,R){this.remainderData=null,this.config=void 0,this.config=R}var B=W.prototype;return B.resetTimeStamp=function(){},B.resetInitSegment=function(){},B.resetContiguity=function(){},W.probe=function(R){return Object(H.findBox)({data:R,start:0,end:Math.min(R.length,16384)},["moof"]).length>0},B.demux=function(R){var y=R,T=Object(C.dummyTrack)();if(this.config.progressive){this.remainderData&&(y=Object(H.appendUint8Array)(this.remainderData,R));var _=Object(H.segmentValidRange)(y);this.remainderData=_.remainder,T.samples=_.valid||new Uint8Array}else T.samples=y;return{audioTrack:Object(C.dummyTrack)(),avcTrack:T,id3Track:Object(C.dummyTrack)(),textTrack:Object(C.dummyTrack)()}},B.flush=function(){var R=Object(C.dummyTrack)();return R.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(C.dummyTrack)(),avcTrack:R,id3Track:Object(C.dummyTrack)(),textTrack:Object(C.dummyTrack)()}},B.demuxSampleAes=function(R,y,T){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},B.destroy=function(){},W}();M.minProbeByteLength=1024,X.default=M},"./src/demux/mpegaudio.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"appendFrame",function(){return P}),k.d(X,"parseHeader",function(){return R}),k.d(X,"isHeaderPattern",function(){return y}),k.d(X,"isHeader",function(){return T}),k.d(X,"canParse",function(){return _}),k.d(X,"probe",function(){return O});var H=null,C=[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],M=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],W=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],B=[0,1,1,4];function P(w,g,u,o,s){if(u+24>g.length)return;var l=R(g,u);if(l&&u+l.frameLength<=g.length){var b=l.samplesPerFrame*9e4/l.sampleRate,p=o+s*b,h={unit:g.subarray(u,u+l.frameLength),pts:p,dts:p};return w.config=[],w.channelCount=l.channelCount,w.samplerate=l.sampleRate,w.samples.push(h),{sample:h,length:l.frameLength,missing:0}}}function R(w,g){var u=w[g+1]>>3&3,o=w[g+1]>>1&3,s=w[g+2]>>4&15,l=w[g+2]>>2&3;if(u!==1&&s!==0&&s!==15&&l!==3){var b=w[g+2]>>1&1,p=w[g+3]>>6,h=u===3?3-o:o===3?3:4,L=C[h*14+s-1]*1e3,v=u===3?0:u===2?1:2,c=M[v*3+l],f=p===3?1:2,d=W[u][o],a=B[o],x=d*8*a,m=Math.floor(d*L/c+b)*a;if(H===null){var S=navigator.userAgent||"",I=S.match(/Chrome\/(\d+)/i);H=I?parseInt(I[1]):0}var z=!!H&&H<=87;return z&&o===2&&L>=224e3&&p===0&&(w[g+3]=w[g+3]|128),{sampleRate:c,channelCount:f,frameLength:m,samplesPerFrame:x}}}function y(w,g){return w[g]===255&&(w[g+1]&224)===224&&(w[g+1]&6)!==0}function T(w,g){return g+1<w.length&&y(w,g)}function _(w,g){var u=4;return y(w,g)&&u<=w.length-g}function O(w,g){if(g+1<w.length&&y(w,g)){var u=4,o=R(w,g),s=u;o!=null&&o.frameLength&&(s=o.frameLength);var l=g+s;return l===w.length||T(w,l)}return!1}},"./src/demux/sample-aes.ts":function(de,X,k){"use strict";k.r(X);var H=k("./src/crypt/decrypter.ts"),C=k("./src/demux/tsdemuxer.ts"),M=function(){function W(P,R,y){this.keyData=void 0,this.decrypter=void 0,this.keyData=y,this.decrypter=new H.default(P,R,{removePKCS7Padding:!1})}var B=W.prototype;return B.decryptBuffer=function(R,y){this.decrypter.decrypt(R,this.keyData.key.buffer,this.keyData.iv.buffer,y)},B.decryptAacSample=function(R,y,T,_){var O=R[y].unit,w=O.subarray(16,O.length-O.length%16),g=w.buffer.slice(w.byteOffset,w.byteOffset+w.length),u=this;this.decryptBuffer(g,function(o){var s=new Uint8Array(o);O.set(s,16),_||u.decryptAacSamples(R,y+1,T)})},B.decryptAacSamples=function(R,y,T){for(;;y++){if(y>=R.length){T();return}if(R[y].unit.length<32)continue;var _=this.decrypter.isSync();if(this.decryptAacSample(R,y,T,_),!_)return}},B.getAvcEncryptedData=function(R){for(var y=Math.floor((R.length-48)/160)*16+16,T=new Int8Array(y),_=0,O=32;O<=R.length-16;O+=160,_+=16)T.set(R.subarray(O,O+16),_);return T},B.getAvcDecryptedUnit=function(R,y){for(var T=new Uint8Array(y),_=0,O=32;O<=R.length-16;O+=160,_+=16)R.set(T.subarray(_,_+16),O);return R},B.decryptAvcSample=function(R,y,T,_,O,w){var g=Object(C.discardEPB)(O.data),u=this.getAvcEncryptedData(g),o=this;this.decryptBuffer(u.buffer,function(s){O.data=o.getAvcDecryptedUnit(g,s),w||o.decryptAvcSamples(R,y,T+1,_)})},B.decryptAvcSamples=function(R,y,T,_){if(R instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;y++,T=0){if(y>=R.length){_();return}for(var O=R[y].units;!(T>=O.length);T++){var w=O[T];if(w.data.length<=48||w.type!==1&&w.type!==5)continue;var g=this.decrypter.isSync();if(this.decryptAvcSample(R,y,T,_,w,g),!g)return}}},W}();X.default=M},"./src/demux/transmuxer-interface.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"default",function(){return O});var H=k("./node_modules/webworkify-webpack/index.js"),C=k.n(H),M=k("./src/events.ts"),W=k("./src/demux/transmuxer.ts"),B=k("./src/utils/logger.ts"),P=k("./src/errors.ts"),R=k("./src/utils/mediasource-helper.ts"),y=k("./node_modules/eventemitter3/index.js"),T=k.n(y),_=Object(R.getMediaSource)()||{isTypeSupported:function(){return!1}},O=function(){function w(u,o,s,l){var b=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=u,this.id=o,this.onTransmuxComplete=s,this.onFlush=l;var p=u.config,h=function(d,a){a=a||{},a.frag=b.frag,a.id=b.id,u.trigger(d,a)};this.observer=new y.EventEmitter,this.observer.on(M.Events.FRAG_DECRYPTED,h),this.observer.on(M.Events.ERROR,h);var L={mp4:_.isTypeSupported("video/mp4"),mpeg:_.isTypeSupported("audio/mpeg"),mp3:_.isTypeSupported('audio/mp4; codecs="mp3"')},v=navigator.vendor;if(p.enableWorker&&typeof Worker!="undefined"){B.logger.log("demuxing in webworker");var c;try{c=this.worker=H("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),c.addEventListener("message",this.onwmsg),c.onerror=function(f){u.trigger(M.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(f.message+" ("+f.filename+":"+f.lineno+")")})},c.postMessage({cmd:"init",typeSupported:L,vendor:v,id:o,config:JSON.stringify(p)})}catch(f){B.logger.warn("Error in worker:",f),B.logger.error("Error while initializing DemuxerWorker, fallback to inline"),c&&self.URL.revokeObjectURL(c.objectURL),this.transmuxer=new W.default(this.observer,L,p,v,o),this.worker=null}}else this.transmuxer=new W.default(this.observer,L,p,v,o)}var g=w.prototype;return g.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var l=this.observer;l&&l.removeAllListeners(),this.observer=null},g.push=function(o,s,l,b,p,h,L,v,c,f){var d=this;c.transmuxing.start=self.performance.now();var a=this.transmuxer,x=this.worker,m=h?h.start:p.start,S=p.decryptdata,I=this.frag,z=!(I&&p.cc===I.cc),Y=!(I&&c.level===I.level),ie=I?c.sn-I.sn:-1,G=this.part?c.part-this.part.index:1,j=!Y&&(ie===1||ie===0&&G===1),oe=self.performance.now();(Y||ie||p.stats.parsing.start===0)&&(p.stats.parsing.start=oe),h&&(G||!j)&&(h.stats.parsing.start=oe);var ye=new W.TransmuxState(z,j,v,Y,m);if(!j||z){B.logger.log("[transmuxer-interface, "+p.type+"]: Starting new transmux session for sn: "+c.sn+" p: "+c.part+" level: "+c.level+" id: "+c.id+`
|
|
discontinuity: `+z+`
|
|
trackSwitch: `+Y+`
|
|
contiguous: `+j+`
|
|
accurateTimeOffset: `+v+`
|
|
timeOffset: `+m);var Ce=new W.TransmuxConfig(l,b,s,L,f);this.configureTransmuxer(Ce)}if(this.frag=p,this.part=h,x)x.postMessage({cmd:"demux",data:o,decryptdata:S,chunkMeta:c,state:ye},o instanceof ArrayBuffer?[o]:[]);else if(a){var De=a.push(o,S,c,ye);Object(W.isPromise)(De)?De.then(function(Ye){d.handleTransmuxComplete(Ye)}):this.handleTransmuxComplete(De)}},g.flush=function(o){var s=this;o.transmuxing.start=self.performance.now();var l=this.transmuxer,b=this.worker;if(b)b.postMessage({cmd:"flush",chunkMeta:o});else if(l){var p=l.flush(o);Object(W.isPromise)(p)?p.then(function(h){s.handleFlushResult(h,o)}):this.handleFlushResult(p,o)}},g.handleFlushResult=function(o,s){var l=this;o.forEach(function(b){l.handleTransmuxComplete(b)}),this.onFlush(s)},g.onWorkerMessage=function(o){var s=o.data,l=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,l.trigger(s.event,s.data);break}}},g.configureTransmuxer=function(o){var s=this.worker,l=this.transmuxer;s?s.postMessage({cmd:"configure",config:o}):l&&l.configure(o)},g.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},w}()},"./src/demux/transmuxer-worker.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"default",function(){return P});var H=k("./src/demux/transmuxer.ts"),C=k("./src/events.ts"),M=k("./src/utils/logger.ts"),W=k("./node_modules/eventemitter3/index.js"),B=k.n(W);function P(O){var w=new W.EventEmitter,g=function(o,s){O.postMessage({event:o,data:s})};w.on(C.Events.FRAG_DECRYPTED,g),w.on(C.Events.ERROR,g),O.addEventListener("message",function(u){var o=u.data;switch(o.cmd){case"init":{var s=JSON.parse(o.config);O.transmuxer=new H.default(w,o.typeSupported,s,o.vendor,o.id),Object(M.enableLogs)(s.debug),g("init",null);break}case"configure":{O.transmuxer.configure(o.config);break}case"demux":{var l=O.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(H.isPromise)(l)?l.then(function(h){R(O,h)}):R(O,l);break}case"flush":{var b=o.chunkMeta,p=O.transmuxer.flush(b);Object(H.isPromise)(p)?p.then(function(h){T(O,h,b)}):T(O,p,b);break}default:break}})}function R(O,w){if(_(w.remuxResult))return;var g=[],u=w.remuxResult,o=u.audio,s=u.video;o&&y(g,o),s&&y(g,s),O.postMessage({event:"transmuxComplete",data:w},g)}function y(O,w){w.data1&&O.push(w.data1.buffer),w.data2&&O.push(w.data2.buffer)}function T(O,w,g){w.forEach(function(u){R(O,u)}),O.postMessage({event:"flush",data:g})}function _(O){return!O.audio&&!O.video&&!O.text&&!O.id3&&!O.initSegment}},"./src/demux/transmuxer.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"default",function(){return s}),k.d(X,"isPromise",function(){return p}),k.d(X,"TransmuxConfig",function(){return h}),k.d(X,"TransmuxState",function(){return L});var H=k("./src/events.ts"),C=k("./src/errors.ts"),M=k("./src/crypt/decrypter.ts"),W=k("./src/demux/aacdemuxer.ts"),B=k("./src/demux/mp4demuxer.ts"),P=k("./src/demux/tsdemuxer.ts"),R=k("./src/demux/mp3demuxer.ts"),y=k("./src/remux/mp4-remuxer.ts"),T=k("./src/remux/passthrough-remuxer.ts"),_=k("./src/demux/chunk-cache.ts"),O=k("./src/utils/mp4-tools.ts"),w=k("./src/utils/logger.ts"),g;try{g=self.performance.now.bind(self.performance)}catch(v){w.logger.debug("Unable to use Performance API on this environment"),g=self.Date.now}var u=[{demux:P.default,remux:y.default},{demux:B.default,remux:T.default},{demux:W.default,remux:y.default},{demux:R.default,remux:y.default}],o=1024;u.forEach(function(v){var c=v.demux;o=Math.max(o,c.minProbeByteLength)});var s=function(){function v(f,d,a,x,m){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new _.default,this.observer=f,this.typeSupported=d,this.config=a,this.vendor=x,this.id=m}var c=v.prototype;return c.configure=function(d){this.transmuxConfig=d,this.decrypter&&this.decrypter.reset()},c.push=function(d,a,x,m){var S=this,I=x.transmuxing;I.executeStart=g();var z=new Uint8Array(d),Y=this.cache,ie=this.config,G=this.currentTransmuxState,j=this.transmuxConfig;m&&(this.currentTransmuxState=m);var oe=l(z,a);if(oe&&oe.method==="AES-128"){var ye=this.getDecrypter();if(ie.enableSoftwareAES){var Ce=ye.softwareDecrypt(z,oe.key.buffer,oe.iv.buffer);if(!Ce)return I.executeEnd=g(),b(x);z=new Uint8Array(Ce)}else return this.decryptionPromise=ye.webCryptoDecrypt(z,oe.key.buffer,oe.iv.buffer).then(function(Me){var je=S.push(Me,null,x);return S.decryptionPromise=null,je}),this.decryptionPromise}var De=m||G,Ye=De.contiguous,Ie=De.discontinuity,Ve=De.trackSwitch,Ne=De.accurateTimeOffset,Ue=De.timeOffset,Ae=j.audioCodec,F=j.videoCodec,A=j.defaultInitPts,D=j.duration,K=j.initSegmentData;if((Ie||Ve)&&this.resetInitSegment(K,Ae,F,D),Ie&&this.resetInitialTimestamp(A),Ye||this.resetContiguity(),this.needsProbing(z,Ie,Ve)){if(Y.dataLength){var J=Y.flush();z=Object(O.appendUint8Array)(J,z)}this.configureTransmuxer(z,j)}var U=this.transmux(z,oe,Ue,Ne,x),me=this.currentTransmuxState;return me.contiguous=!0,me.discontinuity=!1,me.trackSwitch=!1,I.executeEnd=g(),U},c.flush=function(d){var a=this,x=d.transmuxing;x.executeStart=g();var m=this.decrypter,S=this.cache,I=this.currentTransmuxState,z=this.decryptionPromise;if(z)return z.then(function(){return a.flush(d)});var Y=[],ie=I.timeOffset;if(m){var G=m.flush();G&&Y.push(this.push(G,null,d))}var j=S.dataLength;S.reset();var oe=this.demuxer,ye=this.remuxer;if(!oe||!ye)return j>=o&&this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:C.ErrorTypes.MEDIA_ERROR,details:C.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),x.executeEnd=g(),[b(d)];var Ce=oe.flush(ie);return p(Ce)?Ce.then(function(De){return a.flushRemux(Y,De,d),Y}):(this.flushRemux(Y,Ce,d),Y)},c.flushRemux=function(d,a,x){var m=a.audioTrack,S=a.avcTrack,I=a.id3Track,z=a.textTrack,Y=this.currentTransmuxState,ie=Y.accurateTimeOffset,G=Y.timeOffset;w.logger.log("[transmuxer.ts]: Flushed fragment "+x.sn+(x.part>-1?" p: "+x.part:"")+" of level "+x.level);var j=this.remuxer.remux(m,S,I,z,G,ie,!0,this.id);d.push({remuxResult:j,chunkMeta:x}),x.transmuxing.executeEnd=g()},c.resetInitialTimestamp=function(d){var a=this.demuxer,x=this.remuxer;if(!a||!x)return;a.resetTimeStamp(d),x.resetTimeStamp(d)},c.resetContiguity=function(){var d=this.demuxer,a=this.remuxer;if(!d||!a)return;d.resetContiguity(),a.resetNextTimestamp()},c.resetInitSegment=function(d,a,x,m){var S=this.demuxer,I=this.remuxer;if(!S||!I)return;S.resetInitSegment(a,x,m),I.resetInitSegment(d,a,x)},c.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},c.transmux=function(d,a,x,m,S){var I;return a&&a.method==="SAMPLE-AES"?I=this.transmuxSampleAes(d,a,x,m,S):I=this.transmuxUnencrypted(d,x,m,S),I},c.transmuxUnencrypted=function(d,a,x,m){var S=this.demuxer.demux(d,a,!1,!this.config.progressive),I=S.audioTrack,z=S.avcTrack,Y=S.id3Track,ie=S.textTrack,G=this.remuxer.remux(I,z,Y,ie,a,x,!1,this.id);return{remuxResult:G,chunkMeta:m}},c.transmuxSampleAes=function(d,a,x,m,S){var I=this;return this.demuxer.demuxSampleAes(d,a,x).then(function(z){var Y=I.remuxer.remux(z.audioTrack,z.avcTrack,z.id3Track,z.textTrack,x,m,!1,I.id);return{remuxResult:Y,chunkMeta:S}})},c.configureTransmuxer=function(d,a){for(var x=this.config,m=this.observer,S=this.typeSupported,I=this.vendor,z=a.audioCodec,Y=a.defaultInitPts,ie=a.duration,G=a.initSegmentData,j=a.videoCodec,oe,ye=0,Ce=u.length;ye<Ce;ye++)if(u[ye].demux.probe(d)){oe=u[ye];break}oe||(w.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),oe={demux:B.default,remux:T.default});var De=this.demuxer,Ye=this.remuxer,Ie=oe.remux,Ve=oe.demux;(!Ye||!(Ye instanceof Ie))&&(this.remuxer=new Ie(m,x,S,I)),(!De||!(De instanceof Ve))&&(this.demuxer=new Ve(m,x,S),this.probe=Ve.probe),this.resetInitSegment(G,z,j,ie),this.resetInitialTimestamp(Y)},c.needsProbing=function(d,a,x){return!this.demuxer||!this.remuxer||a||x},c.getDecrypter=function(){var d=this.decrypter;return d||(d=this.decrypter=new M.default(this.observer,this.config)),d},v}();function l(v,c){var f=null;return v.byteLength>0&&c!=null&&c.key!=null&&c.iv!==null&&c.method!=null&&(f=c),f}var b=function(c){return{remuxResult:{},chunkMeta:c}};function p(v){return"then"in v&&v.then instanceof Function}var h=function(c,f,d,a,x){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=c,this.videoCodec=f,this.initSegmentData=d,this.duration=a,this.defaultInitPts=x},L=function(c,f,d,a,x){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=c,this.contiguous=f,this.accurateTimeOffset=d,this.trackSwitch=a,this.timeOffset=x}},"./src/demux/tsdemuxer.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"discardEPB",function(){return b});var H=k("./src/demux/adts.ts"),C=k("./src/demux/mpegaudio.ts"),M=k("./src/demux/exp-golomb.ts"),W=k("./src/demux/id3.ts"),B=k("./src/demux/sample-aes.ts"),P=k("./src/events.ts"),R=k("./src/utils/mp4-tools.ts"),y=k("./src/utils/logger.ts"),T=k("./src/errors.ts"),_={video:1,audio:2,id3:3,text:4},O=function(){function p(L,v,c){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=L,this.config=v,this.typeSupported=c}p.probe=function(v){var c=p.syncOffset(v);return c<0?!1:(c&&y.logger.warn("MPEG2-TS detected but first sync word found @ offset "+c+", junk ahead ?"),!0)},p.syncOffset=function(v){for(var c=Math.min(1e3,v.length-3*188),f=0;f<c;){if(v[f]===71&&v[f+188]===71&&v[f+2*188]===71)return f;f++}return-1},p.createTrack=function(v,c){return{container:v==="video"||v==="audio"?"video/mp2t":void 0,type:v,id:_[v],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:v==="audio"?c:void 0}};var h=p.prototype;return h.resetInitSegment=function(v,c,f){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=p.createTrack("video",f),this._audioTrack=p.createTrack("audio",f),this._id3Track=p.createTrack("id3",f),this._txtTrack=p.createTrack("text",f),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=v,this.videoCodec=c,this._duration=f},h.resetTimeStamp=function(){},h.resetContiguity=function(){var v=this._audioTrack,c=this._avcTrack,f=this._id3Track;v&&(v.pesData=null),c&&(c.pesData=null),f&&(f.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},h.demux=function(v,c,f,d){f===void 0&&(f=!1),d===void 0&&(d=!1),f||(this.sampleAes=null);var a,x=this._avcTrack,m=this._audioTrack,S=this._id3Track,I=x.pid,z=x.pesData,Y=m.pid,ie=S.pid,G=m.pesData,j=S.pesData,oe=!1,ye=this.pmtParsed,Ce=this._pmtId,De=v.length;if(this.remainderData&&(v=Object(R.appendUint8Array)(this.remainderData,v),De=v.length,this.remainderData=null),De<188&&!d)return this.remainderData=v,{audioTrack:m,avcTrack:x,id3Track:S,textTrack:this._txtTrack};var Ye=Math.max(0,p.syncOffset(v));De-=(De+Ye)%188,De<v.byteLength&&!d&&(this.remainderData=new Uint8Array(v.buffer,De,v.buffer.byteLength-De));for(var Ie=Ye;Ie<De;Ie+=188)if(v[Ie]===71){var Ve=!!(v[Ie+1]&64),Ne=((v[Ie+1]&31)<<8)+v[Ie+2],Ue=(v[Ie+3]&48)>>4,Ae=void 0;if(Ue>1){if(Ae=Ie+5+v[Ie+4],Ae===Ie+188)continue}else Ae=Ie+4;switch(Ne){case I:Ve&&(z&&(a=o(z))&&this.parseAVCPES(a,!1),z={data:[],size:0}),z&&(z.data.push(v.subarray(Ae,Ie+188)),z.size+=Ie+188-Ae);break;case Y:Ve&&(G&&(a=o(G))&&(m.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),G={data:[],size:0}),G&&(G.data.push(v.subarray(Ae,Ie+188)),G.size+=Ie+188-Ae);break;case ie:Ve&&(j&&(a=o(j))&&this.parseID3PES(a),j={data:[],size:0}),j&&(j.data.push(v.subarray(Ae,Ie+188)),j.size+=Ie+188-Ae);break;case 0:Ve&&(Ae+=v[Ae]+1),Ce=this._pmtId=g(v,Ae);break;case Ce:{Ve&&(Ae+=v[Ae]+1);var F=u(v,Ae,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,f);I=F.avc,I>0&&(x.pid=I),Y=F.audio,Y>0&&(m.pid=Y,m.isAAC=F.isAAC),ie=F.id3,ie>0&&(S.pid=ie),oe&&!ye&&(y.logger.log("reparse from beginning"),oe=!1,Ie=Ye-188),ye=this.pmtParsed=!0;break}case 17:case 8191:break;default:oe=!0;break}}else this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});x.pesData=z,m.pesData=G,S.pesData=j;var A={audioTrack:m,avcTrack:x,id3Track:S,textTrack:this._txtTrack};return d&&this.extractRemainingSamples(A),A},h.flush=function(){var v=this.remainderData;this.remainderData=null;var c;return v?c=this.demux(v,-1,!1,!0):c={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(c),this.sampleAes?this.decrypt(c,this.sampleAes):c},h.extractRemainingSamples=function(v){var c=v.audioTrack,f=v.avcTrack,d=v.id3Track,a=f.pesData,x=c.pesData,m=d.pesData,S;a&&(S=o(a))?(this.parseAVCPES(S,!0),f.pesData=null):f.pesData=a,x&&(S=o(x))?(c.isAAC?this.parseAACPES(S):this.parseMPEGPES(S),c.pesData=null):(x!=null&&x.size&&y.logger.log("last AAC PES packet truncated,might overlap between fragments"),c.pesData=x),m&&(S=o(m))?(this.parseID3PES(S),d.pesData=null):d.pesData=m},h.demuxSampleAes=function(v,c,f){var d=this.demux(v,f,!0,!this.config.progressive),a=this.sampleAes=new B.default(this.observer,this.config,c);return this.decrypt(d,a)},h.decrypt=function(v,c){return new Promise(function(f){var d=v.audioTrack,a=v.avcTrack;d.samples&&d.isAAC?c.decryptAacSamples(d.samples,0,function(){a.samples?c.decryptAvcSamples(a.samples,0,0,function(){f(v)}):f(v)}):a.samples&&c.decryptAvcSamples(a.samples,0,0,function(){f(v)})})},h.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},h.parseAVCPES=function(v,c){var f=this,d=this._avcTrack,a=this.parseAVCNALu(v.data),x=!1,m=this.avcSample,S,I=!1;v.data=null,m&&a.length&&!d.audFound&&(s(m,d),m=this.avcSample=w(!1,v.pts,v.dts,"")),a.forEach(function(z){switch(z.type){case 1:{S=!0,m||(m=f.avcSample=w(!0,v.pts,v.dts,"")),x&&(m.debug+="NDR "),m.frame=!0;var Y=z.data;if(I&&Y.length>4){var ie=new M.default(Y).readSliceType();(ie===2||ie===4||ie===7||ie===9)&&(m.key=!0)}break}case 5:S=!0,m||(m=f.avcSample=w(!0,v.pts,v.dts,"")),x&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{S=!0,x&&m&&(m.debug+="SEI ");var G=new M.default(b(z.data));G.readUByte();for(var j=0,oe=0,ye=!1,Ce=0;!ye&&G.bytesAvailable>1;){j=0;do Ce=G.readUByte(),j+=Ce;while(Ce===255);oe=0;do Ce=G.readUByte(),oe+=Ce;while(Ce===255);if(j===4&&G.bytesAvailable!==0){ye=!0;var De=G.readUByte();if(De===181){var Ye=G.readUShort();if(Ye===49){var Ie=G.readUInt();if(Ie===1195456820){var Ve=G.readUByte();if(Ve===3){for(var Ne=G.readUByte(),Ue=G.readUByte(),Ae=31&Ne,F=[Ne,Ue],A=0;A<Ae;A++)F.push(G.readUByte()),F.push(G.readUByte()),F.push(G.readUByte());l(f._txtTrack.samples,{type:3,pts:v.pts,bytes:F})}}}}}else if(j===5&&G.bytesAvailable!==0){if(ye=!0,oe>16){for(var D=[],K=0;K<16;K++)D.push(G.readUByte().toString(16)),(K===3||K===5||K===7||K===9)&&D.push("-");for(var J=oe-16,U=new Uint8Array(J),me=0;me<J;me++)U[me]=G.readUByte();l(f._txtTrack.samples,{pts:v.pts,payloadType:j,uuid:D.join(""),userData:Object(W.utf8ArrayToStr)(U),userDataBytes:U})}}else if(oe<G.bytesAvailable)for(var Me=0;Me<oe;Me++)G.readUByte()}break}case 7:if(S=!0,I=!0,x&&m&&(m.debug+="SPS "),!d.sps){var je=new M.default(z.data),Xe=je.readSPS();d.width=Xe.width,d.height=Xe.height,d.pixelRatio=Xe.pixelRatio,d.sps=[z.data],d.duration=f._duration;for(var Be=z.data.subarray(1,4),He="avc1.",ze=0;ze<3;ze++){var rt=Be[ze].toString(16);rt.length<2&&(rt="0"+rt),He+=rt}d.codec=He}break;case 8:S=!0,x&&m&&(m.debug+="PPS "),d.pps||(d.pps=[z.data]);break;case 9:S=!1,d.audFound=!0,m&&s(m,d),m=f.avcSample=w(!1,v.pts,v.dts,x?"AUD ":"");break;case 12:S=!1;break;default:S=!1,m&&(m.debug+="unknown NAL "+z.type+" ");break}if(m&&S){var it=m.units;it.push(z)}}),c&&m&&(s(m,d),this.avcSample=null)},h.getLastNalUnit=function(){var v,c=this.avcSample,f;if(!c||c.units.length===0){var d=this._avcTrack.samples;c=d[d.length-1]}if((v=c)!==null&&v!==void 0&&v.units){var a=c.units;f=a[a.length-1]}return f},h.parseAVCNALu=function(v){var c=v.byteLength,f=this._avcTrack,d=f.naluState||0,a=d,x=[],m=0,S,I,z,Y=-1,ie=0;for(d===-1&&(Y=0,ie=v[0]&31,d=0,m=1);m<c;){if(S=v[m++],!d){d=S?0:1;continue}if(d===1){d=S?0:2;continue}if(!S)d=3;else if(S===1){if(Y>=0){var G={data:v.subarray(Y,m-d-1),type:ie};x.push(G)}else{var j=this.getLastNalUnit();if(j&&(a&&m<=4-a&&(j.state&&(j.data=j.data.subarray(0,j.data.byteLength-a))),I=m-d-1,I>0)){var oe=new Uint8Array(j.data.byteLength+I);oe.set(j.data,0),oe.set(v.subarray(0,I),j.data.byteLength),j.data=oe,j.state=0}}m<c?(z=v[m]&31,Y=m,ie=z,d=0):d=-1}else d=0}if(Y>=0&&d>=0){var ye={data:v.subarray(Y,c),type:ie,state:d};x.push(ye)}if(x.length===0){var Ce=this.getLastNalUnit();if(Ce){var De=new Uint8Array(Ce.data.byteLength+v.byteLength);De.set(Ce.data,0),De.set(v,Ce.data.byteLength),Ce.data=De}}return f.naluState=d,x},h.parseAACPES=function(v){var c=0,f=this._audioTrack,d=this.aacOverFlow,a=v.data;if(d){this.aacOverFlow=null;var x=d.sample.unit.byteLength,m=Math.min(d.missing,x),S=x-m;d.sample.unit.set(a.subarray(0,m),S),f.samples.push(d.sample),c=d.missing}var I,z;for(I=c,z=a.length;I<z-1&&!H.isHeader(a,I);I++);if(I!==c){var Y,ie;if(I<z-1?(Y="AAC PES did not start with ADTS header,offset:"+I,ie=!1):(Y="no ADTS header found in AAC PES",ie=!0),y.logger.warn("parsing error:"+Y),this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:ie,reason:Y}),ie)return}H.initTrackConfig(f,this.observer,a,I,this.audioCodec);var G;if(v.pts!==void 0)G=v.pts;else if(d){var j=H.getFrameDuration(f.samplerate);G=d.sample.pts+j}else{y.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var oe=0;I<z;)if(H.isHeader(a,I)){if(I+5<z){var ye=H.appendFrame(f,a,I,G,oe);if(ye)if(ye.missing)this.aacOverFlow=ye;else{I+=ye.length,oe++;continue}}break}else I++},h.parseMPEGPES=function(v){var c=v.data,f=c.length,d=0,a=0,x=v.pts;if(x===void 0){y.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<f;)if(C.isHeader(c,a)){var m=C.appendFrame(this._audioTrack,c,a,x,d);if(m)a+=m.length,d++;else break}else a++},h.parseID3PES=function(v){if(v.pts===void 0){y.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(v)},p}();O.minProbeByteLength=188;function w(p,h,L,v){return{key:p,frame:!1,pts:h,dts:L,units:[],debug:v,length:0}}function g(p,h){return(p[h+10]&31)<<8|p[h+11]}function u(p,h,L,v){var c={audio:-1,avc:-1,id3:-1,isAAC:!0},f=(p[h+1]&15)<<8|p[h+2],d=h+3+f-4,a=(p[h+10]&15)<<8|p[h+11];for(h+=12+a;h<d;){var x=(p[h+1]&31)<<8|p[h+2];switch(p[h]){case 207:if(!v){y.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:c.audio===-1&&(c.audio=x);break;case 21:c.id3===-1&&(c.id3=x);break;case 219:if(!v){y.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:c.avc===-1&&(c.avc=x);break;case 3:case 4:L?c.audio===-1&&(c.audio=x,c.isAAC=!1):y.logger.log("MPEG audio found, not supported in this browser");break;case 36:y.logger.warn("Unsupported HEVC stream type found");break;default:break}h+=((p[h+3]&15)<<8|p[h+4])+5}return c}function o(p){var h=0,L,v,c,f,d,a=p.data;if(!p||p.size===0)return null;for(;a[0].length<19&&a.length>1;){var x=new Uint8Array(a[0].length+a[1].length);x.set(a[0]),x.set(a[1],a[0].length),a[0]=x,a.splice(1,1)}L=a[0];var m=(L[0]<<16)+(L[1]<<8)+L[2];if(m===1){if(v=(L[4]<<8)+L[5],v&&v>p.size-6)return null;var S=L[7];S&192&&(f=(L[9]&14)*536870912+(L[10]&255)*4194304+(L[11]&254)*16384+(L[12]&255)*128+(L[13]&254)/2,S&64?(d=(L[14]&14)*536870912+(L[15]&255)*4194304+(L[16]&254)*16384+(L[17]&255)*128+(L[18]&254)/2,f-d>60*9e4&&(y.logger.warn(Math.round((f-d)/9e4)+"s delta between PTS and DTS, align them"),f=d)):d=f),c=L[8];var I=c+9;if(p.size<=I)return null;p.size-=I;for(var z=new Uint8Array(p.size),Y=0,ie=a.length;Y<ie;Y++){L=a[Y];var G=L.byteLength;if(I)if(I>G){I-=G;continue}else L=L.subarray(I),G-=I,I=0;z.set(L,h),h+=G}return v&&(v-=c+3),{data:z,pts:f,dts:d,len:v}}return null}function s(p,h){if(p.units.length&&p.frame){if(p.pts===void 0){var L=h.samples,v=L.length;if(v){var c=L[v-1];p.pts=c.pts,p.dts=c.dts}else{h.dropped++;return}}h.samples.push(p)}p.debug.length&&y.logger.log(p.pts+"/"+p.dts+":"+p.debug)}function l(p,h){var L=p.length;if(L>0){if(h.pts>=p[L-1].pts)p.push(h);else for(var v=L-1;v>=0;v--)if(h.pts<p[v].pts){p.splice(v,0,h);break}}else p.push(h)}function b(p){for(var h=p.byteLength,L=[],v=1;v<h-2;)p[v]===0&&p[v+1]===0&&p[v+2]===3?(L.push(v+2),v+=2):v++;if(L.length===0)return p;var c=h-L.length,f=new Uint8Array(c),d=0;for(v=0;v<c;d++,v++)d===L[0]&&(d++,L.shift()),f[v]=p[d];return f}X.default=O},"./src/errors.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"ErrorTypes",function(){return H}),k.d(X,"ErrorDetails",function(){return C});var H;(function(M){M.NETWORK_ERROR="networkError",M.MEDIA_ERROR="mediaError",M.KEY_SYSTEM_ERROR="keySystemError",M.MUX_ERROR="muxError",M.OTHER_ERROR="otherError"})(H||(H={}));var C;(function(M){M.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",M.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",M.KEY_SYSTEM_NO_SESSION="keySystemNoSession",M.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",M.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",M.MANIFEST_LOAD_ERROR="manifestLoadError",M.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",M.MANIFEST_PARSING_ERROR="manifestParsingError",M.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",M.LEVEL_EMPTY_ERROR="levelEmptyError",M.LEVEL_LOAD_ERROR="levelLoadError",M.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",M.LEVEL_SWITCH_ERROR="levelSwitchError",M.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",M.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",M.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",M.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",M.FRAG_LOAD_ERROR="fragLoadError",M.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",M.FRAG_DECRYPT_ERROR="fragDecryptError",M.FRAG_PARSING_ERROR="fragParsingError",M.REMUX_ALLOC_ERROR="remuxAllocError",M.KEY_LOAD_ERROR="keyLoadError",M.KEY_LOAD_TIMEOUT="keyLoadTimeOut",M.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",M.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",M.BUFFER_APPEND_ERROR="bufferAppendError",M.BUFFER_APPENDING_ERROR="bufferAppendingError",M.BUFFER_STALLED_ERROR="bufferStalledError",M.BUFFER_FULL_ERROR="bufferFullError",M.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",M.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",M.INTERNAL_EXCEPTION="internalException",M.INTERNAL_ABORTED="aborted",M.UNKNOWN="unknown"})(C||(C={}))},"./src/events.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"Events",function(){return H});var H;(function(C){C.MEDIA_ATTACHING="hlsMediaAttaching",C.MEDIA_ATTACHED="hlsMediaAttached",C.MEDIA_DETACHING="hlsMediaDetaching",C.MEDIA_DETACHED="hlsMediaDetached",C.BUFFER_RESET="hlsBufferReset",C.BUFFER_CODECS="hlsBufferCodecs",C.BUFFER_CREATED="hlsBufferCreated",C.BUFFER_APPENDING="hlsBufferAppending",C.BUFFER_APPENDED="hlsBufferAppended",C.BUFFER_EOS="hlsBufferEos",C.BUFFER_FLUSHING="hlsBufferFlushing",C.BUFFER_FLUSHED="hlsBufferFlushed",C.MANIFEST_LOADING="hlsManifestLoading",C.MANIFEST_LOADED="hlsManifestLoaded",C.MANIFEST_PARSED="hlsManifestParsed",C.LEVEL_SWITCHING="hlsLevelSwitching",C.LEVEL_SWITCHED="hlsLevelSwitched",C.LEVEL_LOADING="hlsLevelLoading",C.LEVEL_LOADED="hlsLevelLoaded",C.LEVEL_UPDATED="hlsLevelUpdated",C.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",C.LEVELS_UPDATED="hlsLevelsUpdated",C.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",C.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",C.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",C.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",C.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",C.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",C.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",C.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",C.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",C.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",C.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",C.CUES_PARSED="hlsCuesParsed",C.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",C.INIT_PTS_FOUND="hlsInitPtsFound",C.FRAG_LOADING="hlsFragLoading",C.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",C.FRAG_LOADED="hlsFragLoaded",C.FRAG_DECRYPTED="hlsFragDecrypted",C.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",C.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",C.FRAG_PARSING_METADATA="hlsFragParsingMetadata",C.FRAG_PARSED="hlsFragParsed",C.FRAG_BUFFERED="hlsFragBuffered",C.FRAG_CHANGED="hlsFragChanged",C.FPS_DROP="hlsFpsDrop",C.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",C.ERROR="hlsError",C.DESTROYING="hlsDestroying",C.KEY_LOADING="hlsKeyLoading",C.KEY_LOADED="hlsKeyLoaded",C.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",C.BACK_BUFFER_REACHED="hlsBackBufferReached"})(H||(H={}))},"./src/hls.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"default",function(){return p});var H=k("./node_modules/url-toolkit/src/url-toolkit.js"),C=k.n(H),M=k("./src/loader/playlist-loader.ts"),W=k("./src/loader/key-loader.ts"),B=k("./src/controller/id3-track-controller.ts"),P=k("./src/controller/latency-controller.ts"),R=k("./src/controller/level-controller.ts"),y=k("./src/controller/fragment-tracker.ts"),T=k("./src/controller/stream-controller.ts"),_=k("./src/is-supported.ts"),O=k("./src/utils/logger.ts"),w=k("./src/config.ts"),g=k("./node_modules/eventemitter3/index.js"),u=k.n(g),o=k("./src/events.ts"),s=k("./src/errors.ts");function l(h,L){for(var v=0;v<L.length;v++){var c=L[v];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(h,c.key,c)}}function b(h,L,v){return L&&l(h.prototype,L),v&&l(h,v),h}var p=function(){h.isSupported=function(){return Object(_.isSupported)()};function h(v){v===void 0&&(v={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new g.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var c=this.config=Object(w.mergeConfig)(h.DefaultConfig,v);this.userConfig=v,Object(O.enableLogs)(c.debug),this._autoLevelCapping=-1,c.progressive&&Object(w.enableStreamingMode)(c);var f=c.abrController,d=c.bufferController,a=c.capLevelController,x=c.fpsController,m=this.abrController=new f(this),S=this.bufferController=new d(this),I=this.capLevelController=new a(this),z=new x(this),Y=new M.default(this),ie=new W.default(this),G=new B.default(this),j=this.levelController=new R.default(this),oe=new y.FragmentTracker(this),ye=this.streamController=new T.default(this,oe);I.setStreamController(ye),z.setStreamController(ye);var Ce=[j,ye];this.networkControllers=Ce;var De=[Y,ie,m,S,I,z,G,oe];this.audioTrackController=this.createController(c.audioTrackController,null,Ce),this.createController(c.audioStreamController,oe,Ce),this.subtitleTrackController=this.createController(c.subtitleTrackController,null,Ce),this.createController(c.subtitleStreamController,oe,Ce),this.createController(c.timelineController,null,De),this.emeController=this.createController(c.emeController,null,De),this.cmcdController=this.createController(c.cmcdController,null,De),this.latencyController=this.createController(P.default,null,De),this.coreComponents=De}var L=h.prototype;return L.createController=function(c,f,d){if(c){var a=f?new c(this,f):new c(this);return d&&d.push(a),a}return null},L.on=function(c,f,d){d===void 0&&(d=this),this._emitter.on(c,f,d)},L.once=function(c,f,d){d===void 0&&(d=this),this._emitter.once(c,f,d)},L.removeAllListeners=function(c){this._emitter.removeAllListeners(c)},L.off=function(c,f,d,a){d===void 0&&(d=this),this._emitter.off(c,f,d,a)},L.listeners=function(c){return this._emitter.listeners(c)},L.emit=function(c,f,d){return this._emitter.emit(c,f,d)},L.trigger=function(c,f){if(this.config.debug)return this.emit(c,c,f);try{return this.emit(c,c,f)}catch(d){O.logger.error("An internal error happened while handling event "+c+'. Error message: "'+d.message+'". Here is a stacktrace:',d),this.trigger(o.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:c,error:d})}return!1},L.listenerCount=function(c){return this._emitter.listenerCount(c)},L.destroy=function(){O.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(c){return c.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(c){return c.destroy()}),this.coreComponents.length=0},L.attachMedia=function(c){O.logger.log("attachMedia"),this._media=c,this.trigger(o.Events.MEDIA_ATTACHING,{media:c})},L.detachMedia=function(){O.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},L.loadSource=function(c){this.stopLoad();var f=this.media,d=this.url,a=this.url=H.buildAbsoluteURL(self.location.href,c,{alwaysNormalize:!0});O.logger.log("loadSource:"+a),f&&d&&d!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(f)),this.trigger(o.Events.MANIFEST_LOADING,{url:c})},L.startLoad=function(c){c===void 0&&(c=-1),O.logger.log("startLoad("+c+")"),this.networkControllers.forEach(function(f){f.startLoad(c)})},L.stopLoad=function(){O.logger.log("stopLoad"),this.networkControllers.forEach(function(c){c.stopLoad()})},L.swapAudioCodec=function(){O.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},L.recoverMediaError=function(){O.logger.log("recoverMediaError");var c=this._media;this.detachMedia(),c&&this.attachMedia(c)},L.removeLevel=function(c,f){f===void 0&&(f=0),this.levelController.removeLevel(c,f)},b(h,[{key:"levels",get:function(){var c=this.levelController.levels;return c||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(c){O.logger.log("set currentLevel:"+c),this.loadLevel=c,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(c){O.logger.log("set nextLevel:"+c),this.levelController.manualLevel=c,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(c){O.logger.log("set loadLevel:"+c),this.levelController.manualLevel=c}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(c){this.levelController.nextLoadLevel=c}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(c){O.logger.log("set firstLevel:"+c),this.levelController.firstLevel=c}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(c){O.logger.log("set startLevel:"+c),c!==-1&&(c=Math.max(c,this.minAutoLevel)),this.levelController.startLevel=c}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(c){var f=!!c;f!==this.config.capLevelToPlayerSize&&(f?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=f)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(c){this._autoLevelCapping!==c&&(O.logger.log("set autoLevelCapping:"+c),this._autoLevelCapping=c)}},{key:"bandwidthEstimate",get:function(){var c=this.abrController.bwEstimator;return c?c.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var c=this.levels,f=this.config.minAutoBitrate;if(!c)return 0;for(var d=c.length,a=0;a<d;a++)if(c[a].maxBitrate>f)return a;return 0}},{key:"maxAutoLevel",get:function(){var c=this.levels,f=this.autoLevelCapping,d;return f===-1&&c&&c.length?d=c.length-1:d=f,d}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(c){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,c)}},{key:"audioTracks",get:function(){var c=this.audioTrackController;return c?c.audioTracks:[]}},{key:"audioTrack",get:function(){var c=this.audioTrackController;return c?c.audioTrack:-1},set:function(c){var f=this.audioTrackController;f&&(f.audioTrack=c)}},{key:"subtitleTracks",get:function(){var c=this.subtitleTrackController;return c?c.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var c=this.subtitleTrackController;return c?c.subtitleTrack:-1},set:function(c){var f=this.subtitleTrackController;f&&(f.subtitleTrack=c)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var c=this.subtitleTrackController;return c?c.subtitleDisplay:!1},set:function(c){var f=this.subtitleTrackController;f&&(f.subtitleDisplay=c)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(c){this.config.lowLatencyMode=c}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return h.defaultConfig?h.defaultConfig:w.hlsDefaultConfig},set:function(c){h.defaultConfig=c}}]),h}();p.defaultConfig=void 0},"./src/is-supported.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"isSupported",function(){return M}),k.d(X,"changeTypeSupported",function(){return W});var H=k("./src/utils/mediasource-helper.ts");function C(){return self.SourceBuffer||self.WebKitSourceBuffer}function M(){var B=Object(H.getMediaSource)();if(!B)return!1;var P=C(),R=B&&typeof B.isTypeSupported=="function"&&B.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),y=!P||P.prototype&&typeof P.prototype.appendBuffer=="function"&&typeof P.prototype.remove=="function";return!!R&&!!y}function W(){var B,P=C();return typeof(P==null||((B=P.prototype)===null||B===void 0)?void 0:B.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"default",function(){return O}),k.d(X,"LoadError",function(){return g});var H=k("./src/polyfills/number.ts"),C=k("./src/errors.ts");function M(u,o){u.prototype=Object.create(o.prototype),u.prototype.constructor=u,y(u,o)}function W(u){var o=typeof Map=="function"?new Map:void 0;return W=function(l){if(l===null||!R(l))return l;if(typeof l!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(l))return o.get(l);o.set(l,b)}function b(){return B(l,arguments,T(this).constructor)}return b.prototype=Object.create(l.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),y(b,l)},W(u)}function B(u,o,s){return P()?B=Reflect.construct:B=function(b,p,h){var L=[null];L.push.apply(L,p);var v=Function.bind.apply(b,L),c=new v;return h&&y(c,h.prototype),c},B.apply(null,arguments)}function P(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(u){return!1}}function R(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function y(u,o){return y=Object.setPrototypeOf||function(l,b){return l.__proto__=b,l},y(u,o)}function T(u){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},T(u)}var _=Math.pow(2,17),O=function(){function u(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var o=u.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(l,b){var p=this,h=l.url;if(!h)return Promise.reject(new g({type:C.ErrorTypes.NETWORK_ERROR,details:C.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,networkDetails:null},"Fragment does not have a "+(h?"part list":"url")));this.abort();var L=this.config,v=L.fLoader,c=L.loader;return new Promise(function(f,d){p.loader&&p.loader.destroy();var a=p.loader=l.loader=v?new v(L):new c(L),x=w(l),m={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:_};l.stats=a.stats,a.load(x,m,{onSuccess:function(I,z,Y,ie){p.resetLoader(l,a),f({frag:l,part:null,payload:I.data,networkDetails:ie})},onError:function(I,z,Y){p.resetLoader(l,a),d(new g({type:C.ErrorTypes.NETWORK_ERROR,details:C.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,response:I,networkDetails:Y}))},onAbort:function(I,z,Y){p.resetLoader(l,a),d(new g({type:C.ErrorTypes.NETWORK_ERROR,details:C.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,networkDetails:Y}))},onTimeout:function(I,z,Y){p.resetLoader(l,a),d(new g({type:C.ErrorTypes.NETWORK_ERROR,details:C.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,networkDetails:Y}))},onProgress:function(I,z,Y,ie){b&&b({frag:l,part:null,payload:Y,networkDetails:ie})}})})},o.loadPart=function(l,b,p){var h=this;this.abort();var L=this.config,v=L.fLoader,c=L.loader;return new Promise(function(f,d){h.loader&&h.loader.destroy();var a=h.loader=l.loader=v?new v(L):new c(L),x=w(l,b),m={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:_};b.stats=a.stats,a.load(x,m,{onSuccess:function(I,z,Y,ie){h.resetLoader(l,a),h.updateStatsFromPart(l,b);var G={frag:l,part:b,payload:I.data,networkDetails:ie};p(G),f(G)},onError:function(I,z,Y){h.resetLoader(l,a),d(new g({type:C.ErrorTypes.NETWORK_ERROR,details:C.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,part:b,response:I,networkDetails:Y}))},onAbort:function(I,z,Y){l.stats.aborted=b.stats.aborted,h.resetLoader(l,a),d(new g({type:C.ErrorTypes.NETWORK_ERROR,details:C.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,part:b,networkDetails:Y}))},onTimeout:function(I,z,Y){h.resetLoader(l,a),d(new g({type:C.ErrorTypes.NETWORK_ERROR,details:C.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,part:b,networkDetails:Y}))}})})},o.updateStatsFromPart=function(l,b){var p=l.stats,h=b.stats,L=h.total;if(p.loaded+=h.loaded,L){var v=Math.round(l.duration/b.duration),c=Math.min(Math.round(p.loaded/L),v),f=v-c,d=f*Math.round(p.loaded/c);p.total=p.loaded+d}else p.total=Math.max(p.loaded,p.total);var a=p.loading,x=h.loading;a.start?a.first+=x.first-x.start:(a.start=x.start,a.first=x.first),a.end=x.end},o.resetLoader=function(l,b){l.loader=null,this.loader===b&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),b.destroy()},u}();function w(u,o){o===void 0&&(o=null);var s=o||u,l={frag:u,part:o,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},b=s.byteRangeStartOffset,p=s.byteRangeEndOffset;return Object(H.isFiniteNumber)(b)&&Object(H.isFiniteNumber)(p)&&(l.rangeStart=b,l.rangeEnd=p),l}var g=function(u){M(o,u);function o(s){for(var l,b=arguments.length,p=new Array(b>1?b-1:0),h=1;h<b;h++)p[h-1]=arguments[h];return l=u.call.apply(u,[this].concat(p))||this,l.data=void 0,l.data=s,l}return o}(W(Error))},"./src/loader/fragment.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"ElementaryStreamTypes",function(){return O}),k.d(X,"BaseSegment",function(){return w}),k.d(X,"Fragment",function(){return g}),k.d(X,"Part",function(){return u});var H=k("./src/polyfills/number.ts"),C=k("./node_modules/url-toolkit/src/url-toolkit.js"),M=k.n(C),W=k("./src/utils/logger.ts"),B=k("./src/loader/level-key.ts"),P=k("./src/loader/load-stats.ts");function R(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,y(o,s)}function y(o,s){return y=Object.setPrototypeOf||function(b,p){return b.__proto__=p,b},y(o,s)}function T(o,s){for(var l=0;l<s.length;l++){var b=s[l];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(o,b.key,b)}}function _(o,s,l){return s&&T(o.prototype,s),l&&T(o,l),o}var O;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(O||(O={}));var w=function(){function o(l){var b;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(b={},b[O.AUDIO]=null,b[O.VIDEO]=null,b[O.AUDIOVIDEO]=null,b),this.baseurl=l}var s=o.prototype;return s.setByteRange=function(b,p){var h=b.split("@",2),L=[];h.length===1?L[0]=p?p.byteRangeEndOffset:0:L[0]=parseInt(h[1]),L[1]=parseInt(h[0])+L[0],this._byteRange=L},_(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(C.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(b){this._url=b}}]),o}(),g=function(o){R(s,o);function s(b,p){var h;return h=o.call(this,p)||this,h._decryptdata=null,h.rawProgramDateTime=null,h.programDateTime=null,h.tagList=[],h.duration=0,h.sn=0,h.levelkey=void 0,h.type=void 0,h.loader=null,h.level=-1,h.cc=0,h.startPTS=void 0,h.endPTS=void 0,h.appendedPTS=void 0,h.startDTS=void 0,h.endDTS=void 0,h.start=0,h.deltaPTS=void 0,h.maxStartPTS=void 0,h.minEndPTS=void 0,h.stats=new P.LoadStats,h.urlId=0,h.data=void 0,h.bitrateTest=!1,h.title=null,h.initSegment=null,h.type=b,h}var l=s.prototype;return l.createInitializationVector=function(p){for(var h=new Uint8Array(16),L=12;L<16;L++)h[L]=p>>8*(15-L)&255;return h},l.setDecryptDataFromLevelKey=function(p,h){var L=p;return(p==null?void 0:p.method)==="AES-128"&&p.uri&&!p.iv&&(L=B.LevelKey.fromURI(p.uri),L.method=p.method,L.iv=this.createInitializationVector(h),L.keyFormat="identity"),L},l.setElementaryStreamInfo=function(p,h,L,v,c,f){f===void 0&&(f=!1);var d=this.elementaryStreams,a=d[p];if(!a){d[p]={startPTS:h,endPTS:L,startDTS:v,endDTS:c,partial:f};return}a.startPTS=Math.min(a.startPTS,h),a.endPTS=Math.max(a.endPTS,L),a.startDTS=Math.min(a.startDTS,v),a.endDTS=Math.max(a.endDTS,c)},l.clearElementaryStreamInfo=function(){var p=this.elementaryStreams;p[O.AUDIO]=null,p[O.VIDEO]=null,p[O.AUDIOVIDEO]=null},_(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var p=this.sn;typeof p!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&W.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),p=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,p)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(H.isFiniteNumber)(this.programDateTime))return null;var p=Object(H.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+p*1e3}},{key:"encrypted",get:function(){var p;return!!((p=this.decryptdata)!==null&&p!==void 0&&p.keyFormat&&this.decryptdata.uri)}}]),s}(w),u=function(o){R(s,o);function s(l,b,p,h,L){var v;v=o.call(this,p)||this,v.fragOffset=0,v.duration=0,v.gap=!1,v.independent=!1,v.relurl=void 0,v.fragment=void 0,v.index=void 0,v.stats=new P.LoadStats,v.duration=l.decimalFloatingPoint("DURATION"),v.gap=l.bool("GAP"),v.independent=l.bool("INDEPENDENT"),v.relurl=l.enumeratedString("URI"),v.fragment=b,v.index=h;var c=l.enumeratedString("BYTERANGE");return c&&v.setByteRange(c,L),L&&(v.fragOffset=L.fragOffset+L.duration),v}return _(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var b=this.elementaryStreams;return!!(b.audio||b.video||b.audiovideo)}}]),s}(w)},"./src/loader/key-loader.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"default",function(){return W});var H=k("./src/events.ts"),C=k("./src/errors.ts"),M=k("./src/utils/logger.ts"),W=function(){function B(R){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=R,this._registerListeners()}var P=B.prototype;return P._registerListeners=function(){this.hls.on(H.Events.KEY_LOADING,this.onKeyLoading,this)},P._unregisterListeners=function(){this.hls.off(H.Events.KEY_LOADING,this.onKeyLoading)},P.destroy=function(){this._unregisterListeners();for(var y in this.loaders){var T=this.loaders[y];T&&T.destroy()}this.loaders={}},P.onKeyLoading=function(y,T){var _=T.frag,O=_.type,w=this.loaders[O];if(!_.decryptdata){M.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var g=_.decryptdata.uri;if(g!==this.decrypturl||this.decryptkey===null){var u=this.hls.config;if(w&&(M.logger.warn("abort previous key loader for type:"+O),w.abort()),!g){M.logger.warn("key uri is falsy");return}var o=u.loader,s=_.loader=this.loaders[O]=new o(u);this.decrypturl=g,this.decryptkey=null;var l={url:g,frag:_,responseType:"arraybuffer"},b={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:u.fragLoadingRetryDelay,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(l,b,p)}else this.decryptkey&&(_.decryptdata.key=this.decryptkey,this.hls.trigger(H.Events.KEY_LOADED,{frag:_}))},P.loadsuccess=function(y,T,_){var O=_.frag;if(!O.decryptdata){M.logger.error("after key load, decryptdata unset");return}this.decryptkey=O.decryptdata.key=new Uint8Array(y.data),O.loader=null,delete this.loaders[O.type],this.hls.trigger(H.Events.KEY_LOADED,{frag:O})},P.loaderror=function(y,T){var _=T.frag,O=_.loader;O&&O.abort(),delete this.loaders[_.type],this.hls.trigger(H.Events.ERROR,{type:C.ErrorTypes.NETWORK_ERROR,details:C.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:_,response:y})},P.loadtimeout=function(y,T){var _=T.frag,O=_.loader;O&&O.abort(),delete this.loaders[_.type],this.hls.trigger(H.Events.ERROR,{type:C.ErrorTypes.NETWORK_ERROR,details:C.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:_})},B}()},"./src/loader/level-details.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"LevelDetails",function(){return B});var H=k("./src/polyfills/number.ts");function C(P,R){for(var y=0;y<R.length;y++){var T=R[y];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(P,T.key,T)}}function M(P,R,y){return R&&C(P.prototype,R),y&&C(P,y),P}var W=10,B=function(){function P(y){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=y}var R=P.prototype;return R.reloaded=function(T){if(!T){this.advanced=!0,this.updated=!0;return}var _=this.lastPartSn-T.lastPartSn,O=this.lastPartIndex-T.lastPartIndex;this.updated=this.endSN!==T.endSN||!!O||!!_,this.advanced=this.endSN>T.endSN||_>0||_===0&&O>0,this.updated||this.advanced?this.misses=Math.floor(T.misses*.6):this.misses=T.misses+1,this.availabilityDelay=T.availabilityDelay},M(P,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(H.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||W}},{key:"drift",get:function(){var T=this.driftEndTime-this.driftStartTime;if(T>0){var _=this.driftEnd-this.driftStart;return _*1e3/T}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var T;return(T=this.fragments)!==null&&T!==void 0&&T.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 T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),P}()},"./src/loader/level-key.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"LevelKey",function(){return B});var H=k("./node_modules/url-toolkit/src/url-toolkit.js"),C=k.n(H);function M(P,R){for(var y=0;y<R.length;y++){var T=R[y];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(P,T.key,T)}}function W(P,R,y){return R&&M(P.prototype,R),y&&M(P,y),P}var B=function(){P.fromURL=function(y,T){return new P(y,T)},P.fromURI=function(y){return new P(y)};function P(R,y){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,y?this._uri=Object(H.buildAbsoluteURL)(R,y,{alwaysNormalize:!0}):this._uri=R}return W(P,[{key:"uri",get:function(){return this._uri}}]),P}()},"./src/loader/load-stats.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"LoadStats",function(){return H});var H=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(de,X,k){"use strict";k.r(X),k.d(X,"default",function(){return s});var H=k("./src/polyfills/number.ts"),C=k("./node_modules/url-toolkit/src/url-toolkit.js"),M=k.n(C),W=k("./src/loader/fragment.ts"),B=k("./src/loader/level-details.ts"),P=k("./src/loader/level-key.ts"),R=k("./src/utils/attr-list.ts"),y=k("./src/utils/logger.ts"),T=k("./src/utils/codecs.ts"),_=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,O=/#EXT-X-MEDIA:(.*)/g,w=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),g=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),u=/\.(mp4|m4s|m4v|m4a)$/i;function o(L){var v,c;return u.test((v=(c=C.parseURL(L))===null||c===void 0?void 0:c.path)!=null?v:"")}var s=function(){function L(){}return L.findGroup=function(c,f){for(var d=0;d<c.length;d++){var a=c[d];if(a.id===f)return a}},L.convertAVC1ToAVCOTI=function(c){var f=c.split(".");if(f.length>2){var d=f.shift()+".";return d+=parseInt(f.shift()).toString(16),d+=("000"+parseInt(f.shift()).toString(16)).substr(-4),d}return c},L.resolve=function(c,f){return C.buildAbsoluteURL(f,c,{alwaysNormalize:!0})},L.parseMasterPlaylist=function(c,f){var d=[],a={},x=!1;_.lastIndex=0;for(var m;(m=_.exec(c))!=null;)if(m[1]){var S=new R.AttrList(m[1]),I={attrs:S,bitrate:S.decimalInteger("AVERAGE-BANDWIDTH")||S.decimalInteger("BANDWIDTH"),name:S.NAME,url:L.resolve(m[2],f)},z=S.decimalResolution("RESOLUTION");z&&(I.width=z.width,I.height=z.height),l((S.CODECS||"").split(/[ ,]+/).filter(function(ie){return ie}),I),I.videoCodec&&I.videoCodec.indexOf("avc1")!==-1&&(I.videoCodec=L.convertAVC1ToAVCOTI(I.videoCodec)),d.push(I)}else if(m[3]){var Y=new R.AttrList(m[3]);Y["DATA-ID"]&&(x=!0,a[Y["DATA-ID"]]=Y)}return{levels:d,sessionData:x?a:null}},L.parseMasterPlaylistMedia=function(c,f,d,a){a===void 0&&(a=[]);var x,m=[],S=0;for(O.lastIndex=0;(x=O.exec(c))!==null;){var I=new R.AttrList(x[1]);if(I.TYPE===d){var z={attrs:I,bitrate:0,id:S++,groupId:I["GROUP-ID"],instreamId:I["INSTREAM-ID"],name:I.NAME||I.LANGUAGE||"",type:d,default:I.bool("DEFAULT"),autoselect:I.bool("AUTOSELECT"),forced:I.bool("FORCED"),lang:I.LANGUAGE,url:I.URI?L.resolve(I.URI,f):""};if(a.length){var Y=L.findGroup(a,z.groupId)||a[0];b(z,Y,"audioCodec"),b(z,Y,"textCodec")}m.push(z)}}return m},L.parseLevelPlaylist=function(c,f,d,a,x){var m=new B.LevelDetails(f),S=m.fragments,I=null,z=0,Y=0,ie=0,G=0,j=null,oe=new W.Fragment(a,f),ye,Ce,De,Ye=-1,Ie=!1;for(w.lastIndex=0,m.m3u8=c;(ye=w.exec(c))!==null;){Ie&&(Ie=!1,oe=new W.Fragment(a,f),oe.start=ie,oe.sn=z,oe.cc=G,oe.level=d,I&&(oe.initSegment=I,oe.rawProgramDateTime=I.rawProgramDateTime));var Ve=ye[1];if(Ve){oe.duration=parseFloat(Ve);var Ne=(" "+ye[2]).slice(1);oe.title=Ne||null,oe.tagList.push(Ne?["INF",Ve,Ne]:["INF",Ve])}else if(ye[3])Object(H.isFiniteNumber)(oe.duration)&&(oe.start=ie,De&&(oe.levelkey=De),oe.sn=z,oe.level=d,oe.cc=G,oe.urlId=x,S.push(oe),oe.relurl=(" "+ye[3]).slice(1),h(oe,j),j=oe,ie+=oe.duration,z++,Y=0,Ie=!0);else if(ye[4]){var Ue=(" "+ye[4]).slice(1);j?oe.setByteRange(Ue,j):oe.setByteRange(Ue)}else if(ye[5])oe.rawProgramDateTime=(" "+ye[5]).slice(1),oe.tagList.push(["PROGRAM-DATE-TIME",oe.rawProgramDateTime]),Ye===-1&&(Ye=S.length);else{if(ye=ye[0].match(g),!ye){y.logger.warn("No matches on slow regex match for level playlist!");continue}for(Ce=1;Ce<ye.length&&!(typeof ye[Ce]!="undefined");Ce++);var Ae=(" "+ye[Ce]).slice(1),F=(" "+ye[Ce+1]).slice(1),A=ye[Ce+2]?(" "+ye[Ce+2]).slice(1):"";switch(Ae){case"PLAYLIST-TYPE":m.type=F.toUpperCase();break;case"MEDIA-SEQUENCE":z=m.startSN=parseInt(F);break;case"SKIP":{var D=new R.AttrList(F),K=D.decimalInteger("SKIPPED-SEGMENTS");if(Object(H.isFiniteNumber)(K)){m.skippedSegments=K;for(var J=K;J--;)S.unshift(null);z+=K}var U=D.enumeratedString("RECENTLY-REMOVED-DATERANGES");U&&(m.recentlyRemovedDateranges=U.split(" "));break}case"TARGETDURATION":m.targetduration=parseFloat(F);break;case"VERSION":m.version=parseInt(F);break;case"EXTM3U":break;case"ENDLIST":m.live=!1;break;case"#":(F||A)&&oe.tagList.push(A?[F,A]:[F]);break;case"DIS":G++;case"GAP":oe.tagList.push([Ae]);break;case"BITRATE":oe.tagList.push([Ae,F]);break;case"DISCONTINUITY-SEQ":G=parseInt(F);break;case"KEY":{var me,Me=new R.AttrList(F),je=Me.enumeratedString("METHOD"),Xe=Me.URI,Be=Me.hexadecimalInteger("IV"),He=Me.enumeratedString("KEYFORMATVERSIONS"),ze=Me.enumeratedString("KEYID"),rt=(me=Me.enumeratedString("KEYFORMAT"))!=null?me:"identity",it=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(it.indexOf(rt)>-1){y.logger.warn("Keyformat "+rt+" is not supported from the manifest");continue}else if(rt!=="identity")continue;je&&(De=P.LevelKey.fromURL(f,Xe),Xe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(je)>=0&&(De.method=je,De.keyFormat=rt,ze&&(De.keyID=ze),He&&(De.keyFormatVersions=He),De.iv=Be));break}case"START":{var lt=new R.AttrList(F),et=lt.decimalFloatingPoint("TIME-OFFSET");Object(H.isFiniteNumber)(et)&&(m.startTimeOffset=et);break}case"MAP":{var St=new R.AttrList(F);oe.relurl=St.URI,St.BYTERANGE&&oe.setByteRange(St.BYTERANGE),oe.level=d,oe.sn="initSegment",De&&(oe.levelkey=De),oe.initSegment=null,I=oe,Ie=!0;break}case"SERVER-CONTROL":{var ut=new R.AttrList(F);m.canBlockReload=ut.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=ut.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&ut.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=ut.optionalFloat("PART-HOLD-BACK",0),m.holdBack=ut.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var ht=new R.AttrList(F);m.partTarget=ht.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Fe=m.partList;Fe||(Fe=m.partList=[]);var bt=Y>0?Fe[Fe.length-1]:void 0,mt=Y++,se=new W.Part(new R.AttrList(F),oe,f,mt,bt);Fe.push(se),oe.duration+=se.duration;break}case"PRELOAD-HINT":{var Z=new R.AttrList(F);m.preloadHint=Z;break}case"RENDITION-REPORT":{var Q=new R.AttrList(F);m.renditionReports=m.renditionReports||[],m.renditionReports.push(Q);break}default:y.logger.warn("line parsed but not handled: "+ye);break}}}j&&!j.relurl?(S.pop(),ie-=j.duration,m.partList&&(m.fragmentHint=j)):m.partList&&(h(oe,j),oe.cc=G,m.fragmentHint=oe);var ae=S.length,ue=S[0],ee=S[ae-1];if(ie+=m.skippedSegments*m.targetduration,ie>0&&ae&&ee){m.averagetargetduration=ie/ae;var ne=ee.sn;m.endSN=ne!=="initSegment"?ne:0,ue&&(m.startCC=ue.cc,ue.initSegment||m.fragments.every(function(he){return he.relurl&&o(he.relurl)})&&(y.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),oe=new W.Fragment(a,f),oe.relurl=ee.relurl,oe.level=d,oe.sn="initSegment",ue.initSegment=oe,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(ie+=m.fragmentHint.duration),m.totalduration=ie,m.endCC=G,Ye>0&&p(S,Ye),m},L}();function l(L,v){["video","audio","text"].forEach(function(c){var f=L.filter(function(a){return Object(T.isCodecType)(a,c)});if(f.length){var d=f.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});v[c+"Codec"]=d.length>0?d[0]:f[0],L=L.filter(function(a){return f.indexOf(a)===-1})}}),v.unknownCodecs=L}function b(L,v,c){var f=v[c];f&&(L[c]=f)}function p(L,v){for(var c=L[v],f=v;f--;){var d=L[f];if(!d)return;d.programDateTime=c.programDateTime-d.duration*1e3,c=d}}function h(L,v){L.rawProgramDateTime?L.programDateTime=Date.parse(L.rawProgramDateTime):v!=null&&v.programDateTime&&(L.programDateTime=v.endProgramDateTime),Object(H.isFiniteNumber)(L.programDateTime)||(L.programDateTime=null,L.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(de,X,k){"use strict";k.r(X);var H=k("./src/polyfills/number.ts"),C=k("./src/events.ts"),M=k("./src/errors.ts"),W=k("./src/utils/logger.ts"),B=k("./src/utils/mp4-tools.ts"),P=k("./src/loader/m3u8-parser.ts"),R=k("./src/types/loader.ts"),y=k("./src/utils/attr-list.ts");function T(w){var g=w.type;switch(g){case R.PlaylistContextType.AUDIO_TRACK:return R.PlaylistLevelType.AUDIO;case R.PlaylistContextType.SUBTITLE_TRACK:return R.PlaylistLevelType.SUBTITLE;default:return R.PlaylistLevelType.MAIN}}function _(w,g){var u=w.url;return(u===void 0||u.indexOf("data:")===0)&&(u=g.url),u}var O=function(){function w(u){this.hls=void 0,this.loaders=Object.create(null),this.hls=u,this.registerListeners()}var g=w.prototype;return g.registerListeners=function(){var o=this.hls;o.on(C.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(C.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(C.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(C.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},g.unregisterListeners=function(){var o=this.hls;o.off(C.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(C.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(C.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(C.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},g.createInternalLoader=function(o){var s=this.hls.config,l=s.pLoader,b=s.loader,p=l||b,h=new p(s);return o.loader=h,this.loaders[o.type]=h,h},g.getInternalLoader=function(o){return this.loaders[o.type]},g.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},g.destroyInternalLoaders=function(){for(var o in this.loaders){var s=this.loaders[o];s&&s.destroy(),this.resetInternalLoader(o)}},g.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},g.onManifestLoading=function(o,s){var l=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:R.PlaylistContextType.MANIFEST,url:l,deliveryDirectives:null})},g.onLevelLoading=function(o,s){var l=s.id,b=s.level,p=s.url,h=s.deliveryDirectives;this.load({id:l,groupId:null,level:b,responseType:"text",type:R.PlaylistContextType.LEVEL,url:p,deliveryDirectives:h})},g.onAudioTrackLoading=function(o,s){var l=s.id,b=s.groupId,p=s.url,h=s.deliveryDirectives;this.load({id:l,groupId:b,level:null,responseType:"text",type:R.PlaylistContextType.AUDIO_TRACK,url:p,deliveryDirectives:h})},g.onSubtitleTrackLoading=function(o,s){var l=s.id,b=s.groupId,p=s.url,h=s.deliveryDirectives;this.load({id:l,groupId:b,level:null,responseType:"text",type:R.PlaylistContextType.SUBTITLE_TRACK,url:p,deliveryDirectives:h})},g.load=function(o){var s,l=this.hls.config,b=this.getInternalLoader(o);if(b){var p=b.context;if(p&&p.url===o.url){W.logger.trace("[playlist-loader]: playlist request ongoing");return}W.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),b.abort()}var h,L,v,c;switch(o.type){case R.PlaylistContextType.MANIFEST:h=l.manifestLoadingMaxRetry,L=l.manifestLoadingTimeOut,v=l.manifestLoadingRetryDelay,c=l.manifestLoadingMaxRetryTimeout;break;case R.PlaylistContextType.LEVEL:case R.PlaylistContextType.AUDIO_TRACK:case R.PlaylistContextType.SUBTITLE_TRACK:h=0,L=l.levelLoadingTimeOut;break;default:h=l.levelLoadingMaxRetry,L=l.levelLoadingTimeOut,v=l.levelLoadingRetryDelay,c=l.levelLoadingMaxRetryTimeout;break}if(b=this.createInternalLoader(o),(s=o.deliveryDirectives)!==null&&s!==void 0&&s.part){var f;if(o.type===R.PlaylistContextType.LEVEL&&o.level!==null?f=this.hls.levels[o.level].details:o.type===R.PlaylistContextType.AUDIO_TRACK&&o.id!==null?f=this.hls.audioTracks[o.id].details:o.type===R.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(f=this.hls.subtitleTracks[o.id].details),f){var d=f.partTarget,a=f.targetduration;d&&a&&(L=Math.min(Math.max(d*3,a*.8)*1e3,L))}}var x={timeout:L,maxRetry:h,retryDelay:v,maxRetryDelay:c,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};b.load(o,x,m)},g.loadsuccess=function(o,s,l,b){if(b===void 0&&(b=null),l.isSidxRequest){this.handleSidxRequest(o,l),this.handlePlaylistLoaded(o,s,l,b);return}this.resetInternalLoader(l.type);var p=o.data;if(p.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,l,"no EXTM3U delimiter",b);return}s.parsing.start=performance.now(),p.indexOf("#EXTINF:")>0||p.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,s,l,b):this.handleMasterPlaylist(o,s,l,b)},g.loaderror=function(o,s,l){l===void 0&&(l=null),this.handleNetworkError(s,l,!1,o)},g.loadtimeout=function(o,s,l){l===void 0&&(l=null),this.handleNetworkError(s,l,!0)},g.handleMasterPlaylist=function(o,s,l,b){var p=this.hls,h=o.data,L=_(o,l),v=P.default.parseMasterPlaylist(h,L),c=v.levels,f=v.sessionData;if(!c.length){this.handleManifestParsingError(o,l,"no level found in manifest",b);return}var d=c.map(function(z){return{id:z.attrs.AUDIO,audioCodec:z.audioCodec}}),a=c.map(function(z){return{id:z.attrs.SUBTITLES,textCodec:z.textCodec}}),x=P.default.parseMasterPlaylistMedia(h,L,"AUDIO",d),m=P.default.parseMasterPlaylistMedia(h,L,"SUBTITLES",a),S=P.default.parseMasterPlaylistMedia(h,L,"CLOSED-CAPTIONS");if(x.length){var I=x.some(function(z){return!z.url});!I&&c[0].audioCodec&&!c[0].attrs.AUDIO&&(W.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),x.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new y.AttrList({}),bitrate:0,url:""}))}p.trigger(C.Events.MANIFEST_LOADED,{levels:c,audioTracks:x,subtitles:m,captions:S,url:L,stats:s,networkDetails:b,sessionData:f})},g.handleTrackOrLevelPlaylist=function(o,s,l,b){var p=this.hls,h=l.id,L=l.level,v=l.type,c=_(o,l),f=Object(H.isFiniteNumber)(h)?h:0,d=Object(H.isFiniteNumber)(L)?L:f,a=T(l),x=P.default.parseLevelPlaylist(o.data,c,d,a,f);if(!x.fragments.length){p.trigger(C.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:c,reason:"no fragments found in level",level:typeof l.level=="number"?l.level:void 0});return}if(v===R.PlaylistContextType.MANIFEST){var m={attrs:new y.AttrList({}),bitrate:0,details:x,name:"",url:c};p.trigger(C.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:c,stats:s,networkDetails:b,sessionData:null})}if(s.parsing.end=performance.now(),x.needSidxRanges){var S,I=(S=x.fragments[0].initSegment)===null||S===void 0?void 0:S.url;this.load({url:I,isSidxRequest:!0,type:v,level:L,levelDetails:x,id:h,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}l.levelDetails=x,this.handlePlaylistLoaded(o,s,l,b)},g.handleSidxRequest=function(o,s){var l=Object(B.parseSegmentIndex)(new Uint8Array(o.data));if(!l)return;var b=l.references,p=s.levelDetails;b.forEach(function(h,L){var v=h.info,c=p.fragments[L];c.byteRange.length===0&&c.setByteRange(String(1+v.end-v.start)+"@"+String(v.start)),c.initSegment&&c.initSegment.setByteRange(String(l.moovEndOffset)+"@0")})},g.handleManifestParsingError=function(o,s,l,b){this.hls.trigger(C.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===R.PlaylistContextType.MANIFEST,url:o.url,reason:l,response:o,context:s,networkDetails:b})},g.handleNetworkError=function(o,s,l,b){l===void 0&&(l=!1),W.logger.warn("[playlist-loader]: A network "+(l?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var p=M.ErrorDetails.UNKNOWN,h=!1,L=this.getInternalLoader(o);switch(o.type){case R.PlaylistContextType.MANIFEST:p=l?M.ErrorDetails.MANIFEST_LOAD_TIMEOUT:M.ErrorDetails.MANIFEST_LOAD_ERROR,h=!0;break;case R.PlaylistContextType.LEVEL:p=l?M.ErrorDetails.LEVEL_LOAD_TIMEOUT:M.ErrorDetails.LEVEL_LOAD_ERROR,h=!1;break;case R.PlaylistContextType.AUDIO_TRACK:p=l?M.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:M.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,h=!1;break;case R.PlaylistContextType.SUBTITLE_TRACK:p=l?M.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:M.ErrorDetails.SUBTITLE_LOAD_ERROR,h=!1;break}L&&this.resetInternalLoader(o.type);var v={type:M.ErrorTypes.NETWORK_ERROR,details:p,fatal:h,url:o.url,loader:L,context:o,networkDetails:s};b&&(v.response=b),this.hls.trigger(C.Events.ERROR,v)},g.handlePlaylistLoaded=function(o,s,l,b){var p=l.type,h=l.level,L=l.id,v=l.groupId,c=l.loader,f=l.levelDetails,d=l.deliveryDirectives;if(!(f!=null&&f.targetduration)){this.handleManifestParsingError(o,l,"invalid target duration",b);return}if(!c)return;f.live&&(c.getCacheAge&&(f.ageHeader=c.getCacheAge()||0),(!c.getCacheAge||isNaN(f.ageHeader))&&(f.ageHeader=0));switch(p){case R.PlaylistContextType.MANIFEST:case R.PlaylistContextType.LEVEL:this.hls.trigger(C.Events.LEVEL_LOADED,{details:f,level:h||0,id:L||0,stats:s,networkDetails:b,deliveryDirectives:d});break;case R.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(C.Events.AUDIO_TRACK_LOADED,{details:f,id:L||0,groupId:v||"",stats:s,networkDetails:b,deliveryDirectives:d});break;case R.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(C.Events.SUBTITLE_TRACK_LOADED,{details:f,id:L||0,groupId:v||"",stats:s,networkDetails:b,deliveryDirectives:d});break}},w}();X.default=O},"./src/polyfills/number.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"isFiniteNumber",function(){return H}),k.d(X,"MAX_SAFE_INTEGER",function(){return C});var H=Number.isFinite||function(M){return typeof M=="number"&&isFinite(M)},C=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(de,X,k){"use strict";k.r(X);var H=function(){function C(){}return C.getSilentFrame=function(W,B){switch(W){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},C}();X.default=H},"./src/remux/mp4-generator.ts":function(de,X,k){"use strict";k.r(X);var H=Math.pow(2,32)-1,C=function(){function M(){}return M.init=function(){M.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 M.types)M.types.hasOwnProperty(B)&&(M.types[B]=[B.charCodeAt(0),B.charCodeAt(1),B.charCodeAt(2),B.charCodeAt(3)]);var P=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]);M.HDLR_TYPES={video:P,audio:R};var y=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),T=new Uint8Array([0,0,0,0,0,0,0,0]);M.STTS=M.STSC=M.STCO=T,M.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),M.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),M.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),M.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var _=new Uint8Array([105,115,111,109]),O=new Uint8Array([97,118,99,49]),w=new Uint8Array([0,0,0,1]);M.FTYP=M.box(M.types.ftyp,_,w,_,O),M.DINF=M.box(M.types.dinf,M.box(M.types.dref,y))},M.box=function(B){for(var P=8,R=arguments.length,y=new Array(R>1?R-1:0),T=1;T<R;T++)y[T-1]=arguments[T];for(var _=y.length,O=_;_--;)P+=y[_].byteLength;var w=new Uint8Array(P);for(w[0]=P>>24&255,w[1]=P>>16&255,w[2]=P>>8&255,w[3]=P&255,w.set(B,4),_=0,P=8;_<O;_++)w.set(y[_],P),P+=y[_].byteLength;return w},M.hdlr=function(B){return M.box(M.types.hdlr,M.HDLR_TYPES[B])},M.mdat=function(B){return M.box(M.types.mdat,B)},M.mdhd=function(B,P){P*=B;var R=Math.floor(P/(H+1)),y=Math.floor(P%(H+1));return M.box(M.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,y>>24,y>>16&255,y>>8&255,y&255,85,196,0,0]))},M.mdia=function(B){return M.box(M.types.mdia,M.mdhd(B.timescale,B.duration),M.hdlr(B.type),M.minf(B))},M.mfhd=function(B){return M.box(M.types.mfhd,new Uint8Array([0,0,0,0,B>>24,B>>16&255,B>>8&255,B&255]))},M.minf=function(B){return B.type==="audio"?M.box(M.types.minf,M.box(M.types.smhd,M.SMHD),M.DINF,M.stbl(B)):M.box(M.types.minf,M.box(M.types.vmhd,M.VMHD),M.DINF,M.stbl(B))},M.moof=function(B,P,R){return M.box(M.types.moof,M.mfhd(B),M.traf(R,P))},M.moov=function(B){for(var P=B.length,R=[];P--;)R[P]=M.trak(B[P]);return M.box.apply(null,[M.types.moov,M.mvhd(B[0].timescale,B[0].duration)].concat(R).concat(M.mvex(B)))},M.mvex=function(B){for(var P=B.length,R=[];P--;)R[P]=M.trex(B[P]);return M.box.apply(null,[M.types.mvex].concat(R))},M.mvhd=function(B,P){P*=B;var R=Math.floor(P/(H+1)),y=Math.floor(P%(H+1)),T=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,y>>24,y>>16&255,y>>8&255,y&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 M.box(M.types.mvhd,T)},M.sdtp=function(B){var P=B.samples||[],R=new Uint8Array(4+P.length),y,T;for(y=0;y<P.length;y++)T=P[y].flags,R[y+4]=T.dependsOn<<4|T.isDependedOn<<2|T.hasRedundancy;return M.box(M.types.sdtp,R)},M.stbl=function(B){return M.box(M.types.stbl,M.stsd(B),M.box(M.types.stts,M.STTS),M.box(M.types.stsc,M.STSC),M.box(M.types.stsz,M.STSZ),M.box(M.types.stco,M.STCO))},M.avc1=function(B){var P=[],R=[],y,T,_;for(y=0;y<B.sps.length;y++)T=B.sps[y],_=T.byteLength,P.push(_>>>8&255),P.push(_&255),P=P.concat(Array.prototype.slice.call(T));for(y=0;y<B.pps.length;y++)T=B.pps[y],_=T.byteLength,R.push(_>>>8&255),R.push(_&255),R=R.concat(Array.prototype.slice.call(T));var O=M.box(M.types.avcC,new Uint8Array([1,P[3],P[4],P[5],252|3,224|B.sps.length].concat(P).concat([B.pps.length]).concat(R))),w=B.width,g=B.height,u=B.pixelRatio[0],o=B.pixelRatio[1];return M.box(M.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,w>>8&255,w&255,g>>8&255,g&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),O,M.box(M.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),M.box(M.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,o>>24,o>>16&255,o>>8&255,o&255])))},M.esds=function(B){var P=B.config.length;return new Uint8Array([0,0,0,0,3,23+P,0,1,0,4,15+P,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([P]).concat(B.config).concat([6,1,2]))},M.mp4a=function(B){var P=B.samplerate;return M.box(M.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,P>>8&255,P&255,0,0]),M.box(M.types.esds,M.esds(B)))},M.mp3=function(B){var P=B.samplerate;return M.box(M.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,P>>8&255,P&255,0,0]))},M.stsd=function(B){return B.type==="audio"?!B.isAAC&&B.codec==="mp3"?M.box(M.types.stsd,M.STSD,M.mp3(B)):M.box(M.types.stsd,M.STSD,M.mp4a(B)):M.box(M.types.stsd,M.STSD,M.avc1(B))},M.tkhd=function(B){var P=B.id,R=B.duration*B.timescale,y=B.width,T=B.height,_=Math.floor(R/(H+1)),O=Math.floor(R%(H+1));return M.box(M.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,P>>24&255,P>>16&255,P>>8&255,P&255,0,0,0,0,_>>24,_>>16&255,_>>8&255,_&255,O>>24,O>>16&255,O>>8&255,O&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,y>>8&255,y&255,0,0,T>>8&255,T&255,0,0]))},M.traf=function(B,P){var R=M.sdtp(B),y=B.id,T=Math.floor(P/(H+1)),_=Math.floor(P%(H+1));return M.box(M.types.traf,M.box(M.types.tfhd,new Uint8Array([0,0,0,0,y>>24,y>>16&255,y>>8&255,y&255])),M.box(M.types.tfdt,new Uint8Array([1,0,0,0,T>>24,T>>16&255,T>>8&255,T&255,_>>24,_>>16&255,_>>8&255,_&255])),M.trun(B,R.length+16+20+8+16+8+8),R)},M.trak=function(B){return B.duration=B.duration||4294967295,M.box(M.types.trak,M.tkhd(B),M.mdia(B))},M.trex=function(B){var P=B.id;return M.box(M.types.trex,new Uint8Array([0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},M.trun=function(B,P){var R=B.samples||[],y=R.length,T=12+16*y,_=new Uint8Array(T),O,w,g,u,o,s;for(P+=8+T,_.set([0,0,15,1,y>>>24&255,y>>>16&255,y>>>8&255,y&255,P>>>24&255,P>>>16&255,P>>>8&255,P&255],0),O=0;O<y;O++)w=R[O],g=w.duration,u=w.size,o=w.flags,s=w.cts,_.set([g>>>24&255,g>>>16&255,g>>>8&255,g&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*O);return M.box(M.types.trun,_)},M.initSegment=function(B){M.types||M.init();var P=M.moov(B),R=new Uint8Array(M.FTYP.byteLength+P.byteLength);return R.set(M.FTYP),R.set(P,M.FTYP.byteLength),R},M}();C.types=void 0,C.HDLR_TYPES=void 0,C.STTS=void 0,C.STSC=void 0,C.STCO=void 0,C.STSZ=void 0,C.VMHD=void 0,C.SMHD=void 0,C.STSD=void 0,C.FTYP=void 0,C.DINF=void 0,X.default=C},"./src/remux/mp4-remuxer.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"default",function(){return s}),k.d(X,"normalizePts",function(){return l});var H=k("./src/polyfills/number.ts"),C=k("./src/remux/aac-helper.ts"),M=k("./src/remux/mp4-generator.ts"),W=k("./src/events.ts"),B=k("./src/errors.ts"),P=k("./src/utils/logger.ts"),R=k("./src/types/loader.ts"),y=k("./src/utils/timescale-conversion.ts");function T(){return T=Object.assign||function(L){for(var v=1;v<arguments.length;v++){var c=arguments[v];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(L[f]=c[f])}return L},T.apply(this,arguments)}var _=10*1e3,O=1024,w=1152,g=null,u=null,o=!1,s=function(){function L(c,f,d,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=c,this.config=f,this.typeSupported=d,this.ISGenerated=!1,g===null){var x=navigator.userAgent||"",m=x.match(/Chrome\/(\d+)/i);g=m?parseInt(m[1]):0}if(u===null){var S=navigator.userAgent.match(/Safari\/(\d+)/i);u=S?parseInt(S[1]):0}o=!!g&&g<75||!!u&&u<600}var v=L.prototype;return v.destroy=function(){},v.resetTimeStamp=function(f){P.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=f},v.resetNextTimestamp=function(){P.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},v.resetInitSegment=function(){P.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},v.getVideoStartPts=function(f){var d=!1,a=f.reduce(function(x,m){var S=m.pts-x;return S<-4294967296?(d=!0,l(x,m.pts)):S>0?x:m.pts},f[0].pts);return d&&P.logger.debug("PTS rollover detected"),a},v.remux=function(f,d,a,x,m,S,I,z){var Y,ie,G,j,oe,ye,Ce=m,De=m,Ye=f.pid>-1,Ie=d.pid>-1,Ve=d.samples.length,Ne=f.samples.length>0,Ue=Ve>1,Ae=(!Ye||Ne)&&(!Ie||Ue)||this.ISGenerated||I;if(Ae){this.ISGenerated||(G=this.generateIS(f,d,m));var F=this.isVideoContiguous,A=-1;if(Ue&&(A=b(d.samples),!F&&this.config.forceKeyFrameOnDiscontinuity))if(ye=!0,A>0){P.logger.warn("[mp4-remuxer]: Dropped "+A+" out of "+Ve+" video samples due to a missing keyframe");var D=this.getVideoStartPts(d.samples);d.samples=d.samples.slice(A),d.dropped+=A,De+=(d.samples[0].pts-D)/(d.timescale||9e4)}else A===-1&&(P.logger.warn("[mp4-remuxer]: No keyframe found out of "+Ve+" video samples"),ye=!1);if(this.ISGenerated){if(Ne&&Ue){var K=this.getVideoStartPts(d.samples),J=l(f.samples[0].pts,K)-K,U=J/d.inputTimeScale;Ce+=Math.max(0,U),De+=Math.max(0,-U)}if(Ne){if(f.samplerate||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),G=this.generateIS(f,d,m)),ie=this.remuxAudio(f,Ce,this.isAudioContiguous,S,Ie||Ue||z===R.PlaylistLevelType.AUDIO?De:void 0),Ue){var me=ie?ie.endPTS-ie.startPTS:0;d.inputTimeScale||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),G=this.generateIS(f,d,m)),Y=this.remuxVideo(d,De,F,me)}}else Ue&&(Y=this.remuxVideo(d,De,F,0));Y&&(Y.firstKeyFrame=A,Y.independent=A!==-1)}}return this.ISGenerated&&(a.samples.length&&(oe=this.remuxID3(a,m)),x.samples.length&&(j=this.remuxText(x,m))),{audio:ie,video:Y,initSegment:G,independent:ye,text:j,id3:oe}},v.generateIS=function(f,d,a){var x=f.samples,m=d.samples,S=this.typeSupported,I={},z=!Object(H.isFiniteNumber)(this._initPTS),Y="audio/mp4",ie,G,j;if(z&&(ie=G=Infinity),f.config&&x.length&&(f.timescale=f.samplerate,f.isAAC||(S.mpeg?(Y="audio/mpeg",f.codec=""):S.mp3&&(f.codec="mp3")),I.audio={id:"audio",container:Y,codec:f.codec,initSegment:!f.isAAC&&S.mpeg?new Uint8Array(0):M.default.initSegment([f]),metadata:{channelCount:f.channelCount}},z&&(j=f.inputTimeScale,ie=G=x[0].pts-Math.round(j*a))),d.sps&&d.pps&&m.length&&(d.timescale=d.inputTimeScale,I.video={id:"main",container:"video/mp4",codec:d.codec,initSegment:M.default.initSegment([d]),metadata:{width:d.width,height:d.height}},z)){j=d.inputTimeScale;var oe=this.getVideoStartPts(m),ye=Math.round(j*a);G=Math.min(G,l(m[0].dts,oe)-ye),ie=Math.min(ie,oe-ye)}if(Object.keys(I).length)return this.ISGenerated=!0,z&&(this._initPTS=ie,this._initDTS=G),{tracks:I,initPTS:ie,timescale:j}},v.remuxVideo=function(f,d,a,x){var m=f.inputTimeScale,S=f.samples,I=[],z=S.length,Y=this._initPTS,ie=this.nextAvcDts,G=8,j,oe,ye,Ce=Number.POSITIVE_INFINITY,De=Number.NEGATIVE_INFINITY,Ye=0,Ie=!1;if(!a||ie===null){var Ve=d*m,Ne=S[0].pts-l(S[0].dts,S[0].pts);ie=Ve-Ne}for(var Ue=0;Ue<z;Ue++){var Ae=S[Ue];if(Ae.pts=l(Ae.pts-Y,ie),Ae.dts=l(Ae.dts-Y,ie),Ae.dts>Ae.pts){var F=9e4*.2;Ye=Math.max(Math.min(Ye,Ae.pts-Ae.dts),-1*F)}Ae.dts<S[Ue>0?Ue-1:Ue].dts&&(Ie=!0)}Ie&&S.sort(function(Wt,Ct){var vt=Wt.dts-Ct.dts,ir=Wt.pts-Ct.pts;return vt||ir}),oe=S[0].dts,ye=S[S.length-1].dts;var A=Math.round((ye-oe)/(z-1));if(Ye<0){if(Ye<A*-2){P.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(y.toMsFromMpegTsClock)(-A,!0)+" ms");for(var D=Ye,K=0;K<z;K++)S[K].dts=D=Math.max(D,S[K].pts-A),S[K].pts=Math.max(D,S[K].pts)}else{P.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(y.toMsFromMpegTsClock)(Ye,!0)+" ms to overcome this issue");for(var J=0;J<z;J++)S[J].dts=S[J].dts+Ye}oe=S[0].dts}if(a){var U=oe-ie,me=U>A,Me=U<-1;if(me||Me){me?P.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(U,!0)+" ms ("+U+"dts) hole between fragments detected, filling it"):P.logger.warn("AVC: "+Object(y.toMsFromMpegTsClock)(-U,!0)+" ms ("+U+"dts) overlapping between fragments detected"),oe=ie;var je=S[0].pts-U;S[0].dts=oe,S[0].pts=je,P.logger.log("Video: First PTS/DTS adjusted: "+Object(y.toMsFromMpegTsClock)(je,!0)+"/"+Object(y.toMsFromMpegTsClock)(oe,!0)+", delta: "+Object(y.toMsFromMpegTsClock)(U,!0)+" ms")}}o&&(oe=Math.max(0,oe));for(var Xe=0,Be=0,He=0;He<z;He++){for(var ze=S[He],rt=ze.units,it=rt.length,lt=0,et=0;et<it;et++)lt+=rt[et].data.length;Be+=lt,Xe+=it,ze.length=lt,ze.dts=Math.max(ze.dts,oe),ze.pts=Math.max(ze.pts,ze.dts,0),Ce=Math.min(ze.pts,Ce),De=Math.max(ze.pts,De)}ye=S[z-1].dts;var St=Be+4*Xe+8,ut;try{ut=new Uint8Array(St)}catch(Wt){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:B.ErrorTypes.MUX_ERROR,details:B.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:St,reason:"fail allocating video mdat "+St});return}var ht=new DataView(ut.buffer);ht.setUint32(0,St),ut.set(M.default.types.mdat,4);for(var Fe=0;Fe<z;Fe++){for(var bt=S[Fe],mt=bt.units,se=0,Z=0,Q=mt.length;Z<Q;Z++){var ae=mt[Z],ue=ae.data,ee=ae.data.byteLength;ht.setUint32(G,ee),G+=4,ut.set(ue,G),G+=ee,se+=4+ee}if(Fe<z-1)j=S[Fe+1].dts-bt.dts;else{var ne=this.config,he=bt.dts-S[Fe>0?Fe-1:Fe].dts;if(ne.stretchShortVideoTrack&&this.nextAudioPts!==null){var pe=Math.floor(ne.maxBufferHole*m),Ee=(x?Ce+x*m:this.nextAudioPts)-bt.pts;Ee>pe?(j=Ee-he,j<0&&(j=he),P.logger.log("[mp4-remuxer]: It is approximately "+Ee/90+" ms to the next segment; using duration "+j/90+" ms for the last video frame.")):j=he}else j=he}var ke=Math.round(bt.pts-bt.dts);I.push(new p(bt.key,j,se,ke))}if(I.length&&g&&g<70){var We=I[0].flags;We.dependsOn=2,We.isNonSync=0}console.assert(j!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=ie=ye+j,this.isVideoContiguous=!0;var qe=M.default.moof(f.sequenceNumber++,oe,T({},f,{samples:I})),ft="video",gt={data1:qe,data2:ut,startPTS:Ce/m,endPTS:(De+j)/m,startDTS:oe/m,endDTS:ie/m,type:ft,hasAudio:!1,hasVideo:!0,nb:I.length,dropped:f.dropped};return f.samples=[],f.dropped=0,console.assert(ut.length,"MDAT length must not be zero"),gt},v.remuxAudio=function(f,d,a,x,m){var S=f.inputTimeScale,I=f.samplerate?f.samplerate:S,z=S/I,Y=f.isAAC?O:w,ie=Y*z,G=this._initPTS,j=!f.isAAC&&this.typeSupported.mpeg,oe=[],ye=f.samples,Ce=j?0:8,De=this.nextAudioPts||-1,Ye=d*S;if(this.isAudioContiguous=a=a||ye.length&&De>0&&(x&&Math.abs(Ye-De)<9e3||Math.abs(l(ye[0].pts-G,Ye)-De)<20*ie),ye.forEach(function(ue){ue.pts=l(ue.pts-G,Ye)}),!a||De<0){if(ye=ye.filter(function(ue){return ue.pts>=0}),!ye.length)return;m===0?De=0:x?De=Math.max(0,Ye):De=ye[0].pts}if(f.isAAC)for(var Ie=m!==void 0,Ve=this.config.maxAudioFramesDrift,Ne=0,Ue=De;Ne<ye.length;Ne++){var Ae=ye[Ne],F=Ae.pts,A=F-Ue,D=Math.abs(1e3*A/S);if(A<=-Ve*ie&&Ie)Ne===0&&(P.logger.warn("Audio frame @ "+(F/S).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*A/S)+" ms."),this.nextAudioPts=De=Ue=F);else if(A>=Ve*ie&&D<_&&Ie){var K=Math.round(A/ie);Ue=F-K*ie,Ue<0&&(K--,Ue+=ie),Ne===0&&(this.nextAudioPts=De=Ue),P.logger.warn("[mp4-remuxer]: Injecting "+K+" audio frame @ "+(Ue/S).toFixed(3)+"s due to "+Math.round(1e3*A/S)+" ms gap.");for(var J=0;J<K;J++){var U=Math.max(Ue,0),me=C.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);me||(P.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),me=Ae.unit.subarray()),ye.splice(Ne,0,{unit:me,pts:U}),Ue+=ie,Ne++}}Ae.pts=Ue,Ue+=ie}for(var Me=null,je=null,Xe,Be=0,He=ye.length;He--;)Be+=ye[He].unit.byteLength;for(var ze=0,rt=ye.length;ze<rt;ze++){var it=ye[ze],lt=it.unit,et=it.pts;if(je!==null){var St=oe[ze-1];St.duration=Math.round((et-je)/z)}else if(a&&f.isAAC&&(et=De),Me=et,Be>0){Be+=Ce;try{Xe=new Uint8Array(Be)}catch(ue){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:B.ErrorTypes.MUX_ERROR,details:B.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Be,reason:"fail allocating audio mdat "+Be});return}if(!j){var ut=new DataView(Xe.buffer);ut.setUint32(0,Be),Xe.set(M.default.types.mdat,4)}}else return;Xe.set(lt,Ce);var ht=lt.byteLength;Ce+=ht,oe.push(new p(!0,Y,ht,0)),je=et}var Fe=oe.length;if(!Fe)return;var bt=oe[oe.length-1];this.nextAudioPts=De=je+z*bt.duration;var mt=j?new Uint8Array(0):M.default.moof(f.sequenceNumber++,Me/z,T({},f,{samples:oe}));f.samples=[];var se=Me/S,Z=De/S,Q="audio",ae={data1:mt,data2:Xe,startPTS:se,endPTS:Z,startDTS:se,endDTS:Z,type:Q,hasAudio:!0,hasVideo:!1,nb:Fe};return this.isAudioContiguous=!0,console.assert(Xe.length,"MDAT length must not be zero"),ae},v.remuxEmptyAudio=function(f,d,a,x){var m=f.inputTimeScale,S=f.samplerate?f.samplerate:m,I=m/S,z=this.nextAudioPts,Y=(z!==null?z:x.startDTS*m)+this._initDTS,ie=x.endDTS*m+this._initDTS,G=I*O,j=Math.ceil((ie-Y)/G),oe=C.default.getSilentFrame(f.manifestCodec||f.codec,f.channelCount);if(P.logger.warn("[mp4-remuxer]: remux empty Audio"),!oe){P.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ye=[],Ce=0;Ce<j;Ce++){var De=Y+Ce*G;ye.push({unit:oe,pts:De,dts:De})}return f.samples=ye,this.remuxAudio(f,d,a,!1)},v.remuxID3=function(f,d){var a=f.samples.length;if(!a)return;for(var x=f.inputTimeScale,m=this._initPTS,S=this._initDTS,I=0;I<a;I++){var z=f.samples[I];z.pts=l(z.pts-m,d*x)/x,z.dts=l(z.dts-S,d*x)/x}var Y=f.samples;return f.samples=[],{samples:Y}},v.remuxText=function(f,d){var a=f.samples.length;if(!a)return;for(var x=f.inputTimeScale,m=this._initPTS,S=0;S<a;S++){var I=f.samples[S];I.pts=l(I.pts-m,d*x)/x}f.samples.sort(function(Y,ie){return Y.pts-ie.pts});var z=f.samples;return f.samples=[],{samples:z}},L}();function l(L,v){var c;if(v===null)return L;for(v<L?c=-8589934592:c=8589934592;Math.abs(L-v)>4294967296;)L+=c;return L}function b(L){for(var v=0;v<L.length;v++)if(L[v].key)return v;return-1}var p=function(v,c,f,d){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=c,this.size=f,this.cts=d,this.flags=new h(v)},h=function(v){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=v?2:1,this.isNonSync=v?0:1}},"./src/remux/passthrough-remuxer.ts":function(de,X,k){"use strict";k.r(X);var H=k("./src/polyfills/number.ts"),C=k("./src/utils/mp4-tools.ts"),M=k("./src/loader/fragment.ts"),W=k("./src/utils/logger.ts"),B=function(){function y(){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 T=y.prototype;return T.destroy=function(){},T.resetTimeStamp=function(O){this.initPTS=O,this.lastEndDTS=null},T.resetNextTimestamp=function(){this.lastEndDTS=null},T.resetInitSegment=function(O,w,g){this.audioCodec=w,this.videoCodec=g,this.generateInitSegment(O),this.emitInitSegment=!0},T.generateInitSegment=function(O){var w=this.audioCodec,g=this.videoCodec;if(!O||!O.byteLength){this.initTracks=void 0,this.initData=void 0;return}var u=this.initData=Object(C.parseInitSegment)(O);w||(w=R(u.audio,M.ElementaryStreamTypes.AUDIO)),g||(g=R(u.video,M.ElementaryStreamTypes.VIDEO));var o={};u.audio&&u.video?o.audiovideo={container:"video/mp4",codec:w+","+g,initSegment:O,id:"main"}:u.audio?o.audio={container:"audio/mp4",codec:w,initSegment:O,id:"audio"}:u.video?o.video={container:"video/mp4",codec:g,initSegment:O,id:"main"}:W.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},T.remux=function(O,w,g,u,o){var s=this.initPTS,l=this.lastEndDTS,b={audio:void 0,video:void 0,text:u,id3:g,initSegment:void 0};Object(H.isFiniteNumber)(l)||(l=this.lastEndDTS=o||0);var p=w.samples;if(!p||!p.length)return b;var h={initPTS:void 0,timescale:1},L=this.initData;if((!L||!L.length)&&(this.generateInitSegment(p),L=this.initData),!L||!L.length)return W.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),b;this.emitInitSegment&&(h.tracks=this.initTracks,this.emitInitSegment=!1),Object(H.isFiniteNumber)(s)||(this.initPTS=h.initPTS=s=P(L,p,l));var v=Object(C.getDuration)(p,L),c=l,f=v+c;Object(C.offsetStartDTS)(L,p,s),v>0?this.lastEndDTS=f:(W.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var d=!!L.audio,a=!!L.video,x="";d&&(x+="audio"),a&&(x+="video");var m={data1:p,startPTS:c,startDTS:c,endPTS:f,endDTS:f,type:x,hasAudio:d,hasVideo:a,nb:1,dropped:0};return b.audio=m.type==="audio"?m:void 0,b.video=m.type!=="audio"?m:void 0,b.text=u,b.id3=g,b.initSegment=h,b},y}(),P=function(T,_,O){return Object(C.getStartDTS)(T,_)-O};function R(y,T){var _=y==null?void 0:y.codec;return _&&_.length>4?_:_==="hvc1"?"hvc1.1.c.L120.90":_==="av01"?"av01.0.04M.08":_==="avc1"||T===M.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}X.default=B},"./src/task-loop.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"default",function(){return H});var H=function(){function C(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var M=C.prototype;return M.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},M.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},M.onHandlerDestroyed=function(){},M.hasInterval=function(){return!!this._tickInterval},M.hasNextTick=function(){return!!this._tickTimer},M.setInterval=function(B){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,B),!0)},M.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},M.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},M.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},M.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},M.doTick=function(){},C}()},"./src/types/cmcd.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"CMCDVersion",function(){return H}),k.d(X,"CMCDObjectType",function(){return C}),k.d(X,"CMCDStreamingFormat",function(){return M}),k.d(X,"CMCDStreamType",function(){return W});var H=1,C;(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"})(C||(C={}));var M;(function(B){B.DASH="d",B.HLS="h",B.SMOOTH="s",B.OTHER="o"})(M||(M={}));var W;(function(B){B.VOD="v",B.LIVE="l"})(W||(W={}))},"./src/types/level.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"HlsSkip",function(){return M}),k.d(X,"getSkipValue",function(){return W}),k.d(X,"HlsUrlParameters",function(){return B}),k.d(X,"Level",function(){return P});function H(R,y){for(var T=0;T<y.length;T++){var _=y[T];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(R,_.key,_)}}function C(R,y,T){return y&&H(R.prototype,y),T&&H(R,T),R}var M;(function(R){R.No="",R.Yes="YES",R.v2="v2"})(M||(M={}));function W(R,y){var T=R.canSkipUntil,_=R.canSkipDateRanges,O=R.endSN,w=y!==void 0?y-O:0;return T&&w<T?_?M.v2:M.Yes:M.No}var B=function(){function R(T,_,O){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=T,this.part=_,this.skip=O}var y=R.prototype;return y.addDirectives=function(_){var O=new self.URL(_);return this.msn!==void 0&&O.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&O.searchParams.set("_HLS_part",this.part.toString()),this.skip&&O.searchParams.set("_HLS_skip",this.skip),O.toString()},R}(),P=function(){function R(y){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=[y.url],this.attrs=y.attrs,this.bitrate=y.bitrate,y.details&&(this.details=y.details),this.id=y.id||0,this.name=y.name,this.width=y.width||0,this.height=y.height||0,this.audioCodec=y.audioCodec,this.videoCodec=y.videoCodec,this.unknownCodecs=y.unknownCodecs,this.codecSet=[y.videoCodec,y.audioCodec].filter(function(T){return T}).join(",").replace(/\.[^.,]+/g,"")}return C(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(T){var _=T%this.url.length;this._urlId!==_&&(this.details=void 0,this._urlId=_)}}]),R}()},"./src/types/loader.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"PlaylistContextType",function(){return H}),k.d(X,"PlaylistLevelType",function(){return C});var H;(function(M){M.MANIFEST="manifest",M.LEVEL="level",M.AUDIO_TRACK="audioTrack",M.SUBTITLE_TRACK="subtitleTrack"})(H||(H={}));var C;(function(M){M.MAIN="main",M.AUDIO="audio",M.SUBTITLE="subtitle"})(C||(C={}))},"./src/types/transmuxer.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"ChunkMetadata",function(){return H});var H=function(W,B,P,R,y,T){R===void 0&&(R=0),y===void 0&&(y=-1),T===void 0&&(T=!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=C(),this.buffering={audio:C(),video:C(),audiovideo:C()},this.level=W,this.sn=B,this.id=P,this.size=R,this.part=y,this.partial=T};function C(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"AttrList",function(){return M});var H=/^(\d+)x(\d+)$/,C=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,M=function(){function W(P){typeof P=="string"&&(P=W.parseAttrList(P));for(var R in P)P.hasOwnProperty(R)&&(this[R]=P[R])}var B=W.prototype;return B.decimalInteger=function(R){var y=parseInt(this[R],10);return y>Number.MAX_SAFE_INTEGER?Infinity:y},B.hexadecimalInteger=function(R){if(this[R]){var y=(this[R]||"0x").slice(2);y=(y.length&1?"0":"")+y;for(var T=new Uint8Array(y.length/2),_=0;_<y.length/2;_++)T[_]=parseInt(y.slice(_*2,_*2+2),16);return T}else return null},B.hexadecimalIntegerAsNumber=function(R){var y=parseInt(this[R],16);return y>Number.MAX_SAFE_INTEGER?Infinity:y},B.decimalFloatingPoint=function(R){return parseFloat(this[R])},B.optionalFloat=function(R,y){var T=this[R];return T?parseFloat(T):y},B.enumeratedString=function(R){return this[R]},B.bool=function(R){return this[R]==="YES"},B.decimalResolution=function(R){var y=H.exec(this[R]);return y===null?void 0:{width:parseInt(y[1],10),height:parseInt(y[2],10)}},W.parseAttrList=function(R){var y,T={},_='"';for(C.lastIndex=0;(y=C.exec(R))!==null;){var O=y[2];O.indexOf(_)===0&&O.lastIndexOf(_)===O.length-1&&(O=O.slice(1,-1)),T[y[1]]=O}return T},W}()},"./src/utils/binary-search.ts":function(de,X,k){"use strict";k.r(X);var H={search:function(M,W){for(var B=0,P=M.length-1,R=null,y=null;B<=P;){R=(B+P)/2|0,y=M[R];var T=W(y);if(T>0)B=R+1;else if(T<0)P=R-1;else return y}return null}};X.default=H},"./src/utils/buffer-helper.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"BufferHelper",function(){return M});var H=k("./src/utils/logger.ts"),C={length:0,start:function(){return 0},end:function(){return 0}},M=function(){function W(){}return W.isBuffered=function(P,R){try{if(P){for(var y=W.getBuffered(P),T=0;T<y.length;T++)if(R>=y.start(T)&&R<=y.end(T))return!0}}catch(_){}return!1},W.bufferInfo=function(P,R,y){try{if(P){var T=W.getBuffered(P),_=[],O;for(O=0;O<T.length;O++)_.push({start:T.start(O),end:T.end(O)});return this.bufferedInfo(_,R,y)}}catch(w){}return{len:0,start:R,end:R,nextStart:void 0}},W.bufferedInfo=function(P,R,y){R=Math.max(0,R),P.sort(function(h,L){var v=h.start-L.start;return v||L.end-h.end});var T=[];if(y)for(var _=0;_<P.length;_++){var O=T.length;if(O){var w=T[O-1].end;P[_].start-w<y?P[_].end>w&&(T[O-1].end=P[_].end):T.push(P[_])}else T.push(P[_])}else T=P;for(var g=0,u,o=R,s=R,l=0;l<T.length;l++){var b=T[l].start,p=T[l].end;if(R+y>=b&&R<p)o=b,s=p,g=s-R;else if(R+y<b){u=b;break}}return{len:g,start:o||0,end:s||0,nextStart:u}},W.getBuffered=function(P){try{return P.buffered}catch(R){return H.logger.log("failed to get media.buffered",R),C}},W}()},"./src/utils/cea-608-parser.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"Row",function(){return s}),k.d(X,"CaptionScreen",function(){return l});var H=k("./src/utils/logger.ts"),C={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},M=function(f){var d=f;return C.hasOwnProperty(f)&&(d=C[f]),String.fromCharCode(d)},W=15,B=100,P={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},y={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},T={25:2,26:4,29:6,30:8,31:10,27:13,28:15},_=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],O;(function(c){c[c.ERROR=0]="ERROR",c[c.TEXT=1]="TEXT",c[c.WARNING=2]="WARNING",c[c.INFO=2]="INFO",c[c.DEBUG=3]="DEBUG",c[c.DATA=3]="DATA"})(O||(O={}));var w=function(){function c(){this.time=null,this.verboseLevel=O.ERROR}var f=c.prototype;return f.log=function(a,x){this.verboseLevel>=a&&H.logger.log(this.time+" ["+a+"] "+x)},c}(),g=function(f){for(var d=[],a=0;a<f.length;a++)d.push(f[a].toString(16));return d},u=function(){function c(d,a,x,m,S){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=d||"white",this.underline=a||!1,this.italics=x||!1,this.background=m||"black",this.flash=S||!1}var f=c.prototype;return f.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},f.setStyles=function(a){for(var x=["foreground","underline","italics","background","flash"],m=0;m<x.length;m++){var S=x[m];a.hasOwnProperty(S)&&(this[S]=a[S])}},f.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},f.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},f.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},f.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},c}(),o=function(){function c(d,a,x,m,S,I){this.uchar=void 0,this.penState=void 0,this.uchar=d||" ",this.penState=new u(a,x,m,S,I)}var f=c.prototype;return f.reset=function(){this.uchar=" ",this.penState.reset()},f.setChar=function(a,x){this.uchar=a,this.penState.copy(x)},f.setPenState=function(a){this.penState.copy(a)},f.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},f.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},f.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},c}(),s=function(){function c(d){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<B;a++)this.chars.push(new o);this.logger=d,this.pos=0,this.currPenState=new u}var f=c.prototype;return f.equals=function(a){for(var x=!0,m=0;m<B;m++)if(!this.chars[m].equals(a.chars[m])){x=!1;break}return x},f.copy=function(a){for(var x=0;x<B;x++)this.chars[x].copy(a.chars[x])},f.isEmpty=function(){for(var a=!0,x=0;x<B;x++)if(!this.chars[x].isEmpty()){a=!1;break}return a},f.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(O.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>B&&(this.logger.log(O.DEBUG,"Too large cursor position "+this.pos),this.pos=B)},f.moveCursor=function(a){var x=this.pos+a;if(a>1)for(var m=this.pos+1;m<x+1;m++)this.chars[m].setPenState(this.currPenState);this.setCursor(x)},f.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},f.insertChar=function(a){a>=144&&this.backSpace();var x=M(a);if(this.pos>=B){this.logger.log(O.ERROR,"Cannot insert "+a.toString(16)+" ("+x+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(x,this.currPenState),this.moveCursor(1)},f.clearFromPos=function(a){var x;for(x=a;x<B;x++)this.chars[x].reset()},f.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},f.clearToEndOfRow=function(){this.clearFromPos(this.pos)},f.getTextString=function(){for(var a=[],x=!0,m=0;m<B;m++){var S=this.chars[m].uchar;S!==" "&&(x=!1),a.push(S)}return x?"":a.join("")},f.setPenStyles=function(a){this.currPenState.setStyles(a);var x=this.chars[this.pos];x.setPenState(this.currPenState)},c}(),l=function(){function c(d){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<W;a++)this.rows.push(new s(d));this.logger=d,this.currRow=W-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var f=c.prototype;return f.reset=function(){for(var a=0;a<W;a++)this.rows[a].clear();this.currRow=W-1},f.equals=function(a){for(var x=!0,m=0;m<W;m++)if(!this.rows[m].equals(a.rows[m])){x=!1;break}return x},f.copy=function(a){for(var x=0;x<W;x++)this.rows[x].copy(a.rows[x])},f.isEmpty=function(){for(var a=!0,x=0;x<W;x++)if(!this.rows[x].isEmpty()){a=!1;break}return a},f.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},f.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},f.insertChar=function(a){var x=this.rows[this.currRow];x.insertChar(a)},f.setPen=function(a){var x=this.rows[this.currRow];x.setPenStyles(a)},f.moveCursor=function(a){var x=this.rows[this.currRow];x.moveCursor(a)},f.setCursor=function(a){this.logger.log(O.INFO,"setCursor: "+a);var x=this.rows[this.currRow];x.setCursor(a)},f.setPAC=function(a){this.logger.log(O.INFO,"pacData = "+JSON.stringify(a));var x=a.row-1;if(this.nrRollUpRows&&x<this.nrRollUpRows-1&&(x=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==x){for(var m=0;m<W;m++)this.rows[m].clear();var S=this.currRow+1-this.nrRollUpRows,I=this.lastOutputScreen;if(I){var z=I.rows[S].cueStartTime,Y=this.logger.time;if(z&&Y!==null&&z<Y)for(var ie=0;ie<this.nrRollUpRows;ie++)this.rows[x-this.nrRollUpRows+ie+1].copy(I.rows[S+ie])}}this.currRow=x;var G=this.rows[this.currRow];if(a.indent!==null){var j=a.indent,oe=Math.max(j-1,0);G.setCursor(a.indent),a.color=G.chars[oe].penState.foreground}var ye={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(ye)},f.setBkgData=function(a){this.logger.log(O.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},f.setRollUpRows=function(a){this.nrRollUpRows=a},f.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(O.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(O.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,x=this.rows.splice(a,1)[0];x.clear(),this.rows.splice(this.currRow,0,x),this.logger.log(O.INFO,"Rolling up")},f.getDisplayText=function(a){a=a||!1;for(var x=[],m="",S=-1,I=0;I<W;I++){var z=this.rows[I].getTextString();z&&(S=I+1,a?x.push("Row "+S+": '"+z+"'"):x.push(z.trim()))}return x.length>0&&(a?m="["+x.join(" | ")+"]":m=x.join(`
|
|
`)),m},f.getTextAndFormat=function(){return this.rows},c}(),b=function(){function c(d,a,x){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=d,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new l(x),this.nonDisplayedMemory=new l(x),this.lastOutputScreen=new l(x),this.currRollUpRow=this.displayedMemory.rows[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=x}var f=c.prototype;return f.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},f.getHandler=function(){return this.outputFilter},f.setHandler=function(a){this.outputFilter=a},f.setPAC=function(a){this.writeScreen.setPAC(a)},f.setBkgData=function(a){this.writeScreen.setBkgData(a)},f.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(O.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},f.insertChars=function(a){for(var x=0;x<a.length;x++)this.writeScreen.insertChar(a[x]);var m=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(O.INFO,m+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(O.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},f.ccRCL=function(){this.logger.log(O.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},f.ccBS=function(){if(this.logger.log(O.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},f.ccAOF=function(){},f.ccAON=function(){},f.ccDER=function(){this.logger.log(O.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},f.ccRU=function(a){this.logger.log(O.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},f.ccFON=function(){this.logger.log(O.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},f.ccRDC=function(){this.logger.log(O.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},f.ccTR=function(){this.logger.log(O.INFO,"TR"),this.setMode("MODE_TEXT")},f.ccRTD=function(){this.logger.log(O.INFO,"RTD"),this.setMode("MODE_TEXT")},f.ccEDM=function(){this.logger.log(O.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},f.ccCR=function(){this.logger.log(O.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},f.ccENM=function(){this.logger.log(O.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},f.ccEOC=function(){if(this.logger.log(O.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(O.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},f.ccTO=function(a){this.logger.log(O.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},f.ccMIDROW=function(a){var x={flash:!1};if(x.underline=a%2===1,x.italics=a>=46,x.italics)x.foreground="white";else{var m=Math.floor(a/2)-16,S=["white","green","blue","cyan","red","yellow","magenta"];x.foreground=S[m]}this.logger.log(O.INFO,"MIDROW: "+JSON.stringify(x)),this.writeScreen.setPen(x)},f.outputDataUpdate=function(a){a===void 0&&(a=!1);var x=this.logger.time;if(x===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=x:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,x,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:x),this.lastOutputScreen.copy(this.displayedMemory))},f.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},c}(),p=function(){function c(d,a,x){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var m=new w;this.channels=[null,new b(d,a,m),new b(d+1,x,m)],this.cmdHistory=v(),this.logger=m}var f=c.prototype;return f.getHandler=function(a){return this.channels[a].getHandler()},f.setHandler=function(a,x){this.channels[a].setHandler(x)},f.addData=function(a,x){var m,S,I,z=!1;this.logger.time=a;for(var Y=0;Y<x.length;Y+=2){if(S=x[Y]&127,I=x[Y+1]&127,S===0&&I===0)continue;if(this.logger.log(O.DATA,"["+g([x[Y],x[Y+1]])+"] -> ("+g([S,I])+")"),m=this.parseCmd(S,I),m||(m=this.parseMidrow(S,I)),m||(m=this.parsePAC(S,I)),m||(m=this.parseBackgroundAttributes(S,I)),!m&&(z=this.parseChars(S,I),z)){var ie=this.currentChannel;if(ie&&ie>0){var G=this.channels[ie];G.insertChars(z)}else this.logger.log(O.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!z&&this.logger.log(O.WARNING,"Couldn't parse cleaned data "+g([S,I])+" orig: "+g([x[Y],x[Y+1]]))}},f.parseCmd=function(a,x){var m=this.cmdHistory,S=(a===20||a===28||a===21||a===29)&&x>=32&&x<=47,I=(a===23||a===31)&&x>=33&&x<=35;if(!(S||I))return!1;if(L(a,x,m))return h(null,null,m),this.logger.log(O.DEBUG,"Repeated command ("+g([a,x])+") is dropped"),!0;var z=a===20||a===21||a===23?1:2,Y=this.channels[z];return a===20||a===21||a===28||a===29?x===32?Y.ccRCL():x===33?Y.ccBS():x===34?Y.ccAOF():x===35?Y.ccAON():x===36?Y.ccDER():x===37?Y.ccRU(2):x===38?Y.ccRU(3):x===39?Y.ccRU(4):x===40?Y.ccFON():x===41?Y.ccRDC():x===42?Y.ccTR():x===43?Y.ccRTD():x===44?Y.ccEDM():x===45?Y.ccCR():x===46?Y.ccENM():x===47&&Y.ccEOC():Y.ccTO(x-32),h(a,x,m),this.currentChannel=z,!0},f.parseMidrow=function(a,x){var m=0;if((a===17||a===25)&&x>=32&&x<=47){if(a===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(O.ERROR,"Mismatch channel in midrow parsing"),!1;var S=this.channels[m];return S?(S.ccMIDROW(x),this.logger.log(O.DEBUG,"MIDROW ("+g([a,x])+")"),!0):!1}return!1},f.parsePAC=function(a,x){var m,S=this.cmdHistory,I=(a>=17&&a<=23||a>=25&&a<=31)&&x>=64&&x<=127,z=(a===16||a===24)&&x>=64&&x<=95;if(!(I||z))return!1;if(L(a,x,S))return h(null,null,S),!0;var Y=a<=23?1:2;x>=64&&x<=95?m=Y===1?P[a]:y[a]:m=Y===1?R[a]:T[a];var ie=this.channels[Y];return ie?(ie.setPAC(this.interpretPAC(m,x)),h(a,x,S),this.currentChannel=Y,!0):!1},f.interpretPAC=function(a,x){var m,S={color:null,italics:!1,indent:null,underline:!1,row:a};return x>95?m=x-96:m=x-64,S.underline=(m&1)===1,m<=13?S.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(S.italics=!0,S.color="white"):S.indent=Math.floor((m-16)/2)*4,S},f.parseChars=function(a,x){var m,S=null,I=null;if(a>=25?(m=2,I=a-8):(m=1,I=a),I>=17&&I<=19){var z;I===17?z=x+80:I===18?z=x+112:z=x+144,this.logger.log(O.INFO,"Special char '"+M(z)+"' in channel "+m),S=[z]}else a>=32&&a<=127&&(S=x===0?[a]:[a,x]);if(S){var Y=g(S);this.logger.log(O.DEBUG,"Char codes = "+Y.join(",")),h(a,x,this.cmdHistory)}return S},f.parseBackgroundAttributes=function(a,x){var m=(a===16||a===24)&&x>=32&&x<=47,S=(a===23||a===31)&&x>=45&&x<=47;if(!(m||S))return!1;var I,z={};a===16||a===24?(I=Math.floor((x-32)/2),z.background=_[I],x%2===1&&(z.background=z.background+"_semi")):x===45?z.background="transparent":(z.foreground="black",x===47&&(z.underline=!0));var Y=a<=23?1:2,ie=this.channels[Y];return ie.setBkgData(z),h(a,x,this.cmdHistory),!0},f.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var x=this.channels[a];x&&x.reset()}this.cmdHistory=v()},f.cueSplitAtTime=function(a){for(var x=0;x<this.channels.length;x++){var m=this.channels[x];m&&m.cueSplitAtTime(a)}},c}();function h(c,f,d){d.a=c,d.b=f}function L(c,f,d){return d.a===c&&d.b===f}function v(){return{a:null,b:null}}X.default=p},"./src/utils/codecs.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"isCodecType",function(){return C}),k.d(X,"isCodecSupportedInMp4",function(){return M});var H={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 C(W,B){var P=H[B];return!!P&&P[W.slice(0,4)]===!0}function M(W,B){return MediaSource.isTypeSupported((B||"video")+'/mp4;codecs="'+W+'"')}},"./src/utils/cues.ts":function(de,X,k){"use strict";k.r(X);var H=k("./src/utils/vttparser.ts"),C=k("./src/utils/webvtt-parser.ts"),M=k("./src/utils/texttrack-utils.ts"),W=/\s/,B={newCue:function(R,y,T,_){for(var O=[],w,g,u,o,s,l=self.VTTCue||self.TextTrackCue,b=0;b<_.rows.length;b++)if(w=_.rows[b],u=!0,o=0,s="",!w.isEmpty()){for(var p=0;p<w.chars.length;p++)W.test(w.chars[p].uchar)&&u?o++:(s+=w.chars[p].uchar,u=!1);w.cueStartTime=y,y===T&&(T+=1e-4),o>=16?o--:o++;var h=Object(H.fixLineBreaks)(s.trim()),L=Object(C.generateCueId)(y,T,h);(!R||!R.cues||!R.cues.getCueById(L))&&(g=new l(y,T,h),g.id=L,g.line=b+1,g.align="left",g.position=10+Math.min(80,Math.floor(o*8/32)*10),O.push(g))}return R&&O.length&&(O.sort(function(v,c){return v.line==="auto"||c.line==="auto"?0:v.line>8&&c.line>8?c.line-v.line:v.line-c.line}),O.forEach(function(v){return Object(M.addCueToTrack)(R,v)})),O}};X.default=B},"./src/utils/discontinuities.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"findFirstFragWithCC",function(){return W}),k.d(X,"shouldAlignOnDiscontinuities",function(){return B}),k.d(X,"findDiscontinuousReferenceFrag",function(){return P}),k.d(X,"adjustSlidingStart",function(){return y}),k.d(X,"alignStream",function(){return T}),k.d(X,"alignPDT",function(){return O}),k.d(X,"alignFragmentByPDTDelta",function(){return w}),k.d(X,"alignMediaPlaylistByPDT",function(){return g});var H=k("./src/polyfills/number.ts"),C=k("./src/utils/logger.ts"),M=k("./src/controller/level-helper.ts");function W(u,o){for(var s=null,l=0,b=u.length;l<b;l++){var p=u[l];if(p&&p.cc===o){s=p;break}}return s}function B(u,o,s){return!!(o.details&&(s.endCC>s.startCC||u&&u.cc<s.startCC))}function P(u,o){var s=u.fragments,l=o.fragments;if(!l.length||!s.length){C.logger.log("No fragments to align");return}var b=W(s,l[0].cc);if(!b||b&&!b.startPTS){C.logger.log("No frag in previous level to align on");return}return b}function R(u,o){if(u){var s=u.start+o;u.start=u.startPTS=s,u.endPTS=s+u.duration}}function y(u,o){for(var s=o.fragments,l=0,b=s.length;l<b;l++)R(s[l],u);o.fragmentHint&&R(o.fragmentHint,u),o.alignedSliding=!0}function T(u,o,s){if(!o)return;_(u,s,o),!s.alignedSliding&&o.details&&O(s,o.details),!s.alignedSliding&&o.details&&!s.skippedSegments&&Object(M.adjustSliding)(o.details,s)}function _(u,o,s){if(B(u,s,o)){var l=P(s.details,o);l&&Object(H.isFiniteNumber)(l.start)&&(C.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),y(l.start,o))}}function O(u,o){if(!o.fragments.length||!u.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,l=u.fragments[0].programDateTime,b=(l-s)/1e3+o.fragments[0].start;b&&Object(H.isFiniteNumber)(b)&&(C.logger.log("Adjusting PTS using programDateTime delta "+(l-s)+"ms, sliding:"+b.toFixed(3)+" "+u.url+" "),y(b,u))}function w(u,o){var s=u.programDateTime;if(!s)return;var l=(s-o)/1e3;u.start=u.startPTS=l,u.endPTS=l+u.duration}function g(u,o){if(!o.fragments.length||!u.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,l=o.fragments[0].start,b=s-l*1e3;u.fragments.forEach(function(p){w(p,b)}),u.fragmentHint&&w(u.fragmentHint,b),u.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(de,X,k){"use strict";k.r(X);var H=k("./src/utils/ewma.ts"),C=function(){function M(B,P,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 H.default(B),this.fast_=new H.default(P)}var W=M.prototype;return W.update=function(P,R){var y=this.slow_,T=this.fast_;this.slow_.halfLife!==P&&(this.slow_=new H.default(P,y.getEstimate(),y.getTotalWeight())),this.fast_.halfLife!==R&&(this.fast_=new H.default(R,T.getEstimate(),T.getTotalWeight()))},W.sample=function(P,R){P=Math.max(P,this.minDelayMs_);var y=8*R,T=P/1e3,_=y/T;this.fast_.sample(T,_),this.slow_.sample(T,_)},W.canEstimate=function(){var P=this.fast_;return P&&P.getTotalWeight()>=this.minWeight_},W.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},W.destroy=function(){},M}();X.default=C},"./src/utils/ewma.ts":function(de,X,k){"use strict";k.r(X);var H=function(){function C(W,B,P){B===void 0&&(B=0),P===void 0&&(P=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=W,this.alpha_=W?Math.exp(Math.log(.5)/W):0,this.estimate_=B,this.totalWeight_=P}var M=C.prototype;return M.sample=function(B,P){var R=Math.pow(this.alpha_,B);this.estimate_=P*(1-R)+R*this.estimate_,this.totalWeight_+=B},M.getTotalWeight=function(){return this.totalWeight_},M.getEstimate=function(){if(this.alpha_){var B=1-Math.pow(this.alpha_,this.totalWeight_);if(B)return this.estimate_/B}return this.estimate_},C}();X.default=H},"./src/utils/fetch-loader.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"fetchSupported",function(){return w});var H=k("./src/polyfills/number.ts"),C=k("./src/loader/load-stats.ts"),M=k("./src/demux/chunk-cache.ts");function W(l,b){l.prototype=Object.create(b.prototype),l.prototype.constructor=l,T(l,b)}function B(l){var b=typeof Map=="function"?new Map:void 0;return B=function(h){if(h===null||!y(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof b!="undefined"){if(b.has(h))return b.get(h);b.set(h,L)}function L(){return P(h,arguments,_(this).constructor)}return L.prototype=Object.create(h.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),T(L,h)},B(l)}function P(l,b,p){return R()?P=Reflect.construct:P=function(L,v,c){var f=[null];f.push.apply(f,v);var d=Function.bind.apply(L,f),a=new d;return c&&T(a,c.prototype),a},P.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(l){return!1}}function y(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function T(l,b){return T=Object.setPrototypeOf||function(h,L){return h.__proto__=L,h},T(l,b)}function _(l){return _=Object.setPrototypeOf?Object.getPrototypeOf:function(p){return p.__proto__||Object.getPrototypeOf(p)},_(l)}function O(){return O=Object.assign||function(l){for(var b=1;b<arguments.length;b++){var p=arguments[b];for(var h in p)Object.prototype.hasOwnProperty.call(p,h)&&(l[h]=p[h])}return l},O.apply(this,arguments)}function w(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(l){}return!1}var g=function(){function l(p){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=p.fetchSetup||o,this.controller=new self.AbortController,this.stats=new C.LoadStats}var b=l.prototype;return b.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},b.abortInternal=function(){var h=this.response;(!h||!h.ok)&&(this.stats.aborted=!0,this.controller.abort())},b.abort=function(){var h;this.abortInternal(),(h=this.callbacks)!==null&&h!==void 0&&h.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},b.load=function(h,L,v){var c=this,f=this.stats;if(f.loading.start)throw new Error("Loader can only be used once.");f.loading.start=self.performance.now();var d=u(h,this.controller.signal),a=v.onProgress,x=h.responseType==="arraybuffer",m=x?"byteLength":"length";this.context=h,this.config=L,this.callbacks=v,this.request=this.fetchSetup(h,d),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){c.abortInternal(),v.onTimeout(f,h,c.response)},L.timeout),self.fetch(this.request).then(function(S){if(c.response=c.loader=S,!S.ok){var I=S.status,z=S.statusText;throw new s(z||"fetch, bad network response",I,S)}return f.loading.first=Math.max(self.performance.now(),f.loading.start),f.total=parseInt(S.headers.get("Content-Length")||"0"),a&&Object(H.isFiniteNumber)(L.highWaterMark)?c.loadProgressively(S,f,h,L.highWaterMark,a):x?S.arrayBuffer():S.text()}).then(function(S){var I=c.response;self.clearTimeout(c.requestTimeout),f.loading.end=Math.max(self.performance.now(),f.loading.first),f.loaded=f.total=S[m];var z={url:I.url,data:S};a&&!Object(H.isFiniteNumber)(L.highWaterMark)&&a(f,h,S,I),v.onSuccess(z,f,h,I)}).catch(function(S){if(self.clearTimeout(c.requestTimeout),f.aborted)return;var I=S.code||0;v.onError({code:I,text:S.message},h,S.details)})},b.getCacheAge=function(){var h=null;if(this.response){var L=this.response.headers.get("age");h=L?parseFloat(L):null}return h},b.loadProgressively=function(h,L,v,c,f){c===void 0&&(c=0);var d=new M.default,a=h.body.getReader(),x=function m(){return a.read().then(function(S){if(S.done)return d.dataLength&&f(L,v,d.flush(),h),Promise.resolve(new ArrayBuffer(0));var I=S.value,z=I.length;return L.loaded+=z,z<c||d.dataLength?(d.push(I),d.dataLength>=c&&f(L,v,d.flush(),h)):f(L,v,I,h),m()}).catch(function(){return Promise.reject()})};return x()},l}();function u(l,b){var p={method:"GET",mode:"cors",credentials:"same-origin",signal:b,headers:new self.Headers(O({},l.headers))};return l.rangeEnd&&p.headers.set("Range","bytes="+l.rangeStart+"-"+String(l.rangeEnd-1)),p}function o(l,b){return new self.Request(l.url,b)}var s=function(l){W(b,l);function b(p,h,L){var v;return v=l.call(this,p)||this,v.code=void 0,v.details=void 0,v.code=h,v.details=L,v}return b}(B(Error));X.default=g},"./src/utils/imsc1-ttml-parser.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"IMSC1_CODEC",function(){return y}),k.d(X,"parseIMSC1",function(){return w});var H=k("./src/utils/mp4-tools.ts"),C=k("./src/utils/vttparser.ts"),M=k("./src/utils/vttcue.ts"),W=k("./src/demux/id3.ts"),B=k("./src/utils/timescale-conversion.ts"),P=k("./src/utils/webvtt-parser.ts");function R(){return R=Object.assign||function(c){for(var f=1;f<arguments.length;f++){var d=arguments[f];for(var a in d)Object.prototype.hasOwnProperty.call(d,a)&&(c[a]=d[a])}return c},R.apply(this,arguments)}var y="stpp.ttml.im1t",T=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,_=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,O={left:"start",center:"center",right:"end",start:"start",end:"end"};function w(c,f,d,a,x){var m=Object(H.findBox)(new Uint8Array(c),["mdat"]);if(m.length===0){x(new Error("Could not parse IMSC1 mdat"));return}var S=m[0],I=Object(W.utf8ArrayToStr)(new Uint8Array(c,S.start,S.end-S.start)),z=Object(B.toTimescaleFromScale)(f,1,d);try{a(g(I,z))}catch(Y){x(Y)}}function g(c,f){var d=new DOMParser,a=d.parseFromString(c,"text/xml"),x=a.getElementsByTagName("tt")[0];if(!x)throw new Error("Invalid ttml");var m={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},S=Object.keys(m).reduce(function(G,j){return G[j]=x.getAttribute("ttp:"+j)||m[j],G},{}),I=x.getAttribute("xml:space")!=="preserve",z=o(u(x,"styling","style")),Y=o(u(x,"layout","region")),ie=u(x,"body","[begin]");return[].map.call(ie,function(G){var j=s(G,I);if(!j||!G.hasAttribute("begin"))return null;var oe=h(G.getAttribute("begin"),S),ye=h(G.getAttribute("dur"),S),Ce=h(G.getAttribute("end"),S);if(oe===null)throw p(G);if(Ce===null){if(ye===null)throw p(G);Ce=oe+ye}var De=new M.default(oe-f,Ce-f,j);De.id=Object(P.generateCueId)(De.startTime,De.endTime,De.text);var Ye=Y[G.getAttribute("region")],Ie=z[G.getAttribute("style")];De.position=10,De.size=80;var Ve=l(Ye,Ie),Ne=Ve.textAlign;if(Ne){var Ue=O[Ne];Ue&&(De.lineAlign=Ue),De.align=Ne}return R(De,Ve),De}).filter(function(G){return G!==null})}function u(c,f,d){var a=c.getElementsByTagName(f)[0];return a?[].slice.call(a.querySelectorAll(d)):[]}function o(c){return c.reduce(function(f,d){var a=d.getAttribute("xml:id");return a&&(f[a]=d),f},{})}function s(c,f){return[].slice.call(c.childNodes).reduce(function(d,a,x){var m;return a.nodeName==="br"&&x?d+`
|
|
`:(m=a.childNodes)!==null&&m!==void 0&&m.length?s(a,f):f?d+a.textContent.trim().replace(/\s+/g," "):d+a.textContent},"")}function l(c,f){var d="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(x,m){var S=b(f,d,m)||b(c,d,m);return S&&(x[m]=S),x},{})}function b(c,f,d){return c.hasAttributeNS(f,d)?c.getAttributeNS(f,d):null}function p(c){return new Error("Could not parse ttml timestamp "+c)}function h(c,f){if(!c)return null;var d=Object(C.parseTimeStamp)(c);return d===null&&(T.test(c)?d=L(c,f):_.test(c)&&(d=v(c,f))),d}function L(c,f){var d=T.exec(c),a=(d[4]|0)+(d[5]|0)/f.subFrameRate;return(d[1]|0)*3600+(d[2]|0)*60+(d[3]|0)+a/f.frameRate}function v(c,f){var d=_.exec(c),a=Number(d[1]),x=d[2];switch(x){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/f.frameRate;case"t":return a/f.tickRate}return a}},"./src/utils/logger.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"enableLogs",function(){return P}),k.d(X,"logger",function(){return R});var H=function(){},C={trace:H,debug:H,log:H,warn:H,info:H,error:H},M=C;function W(y){var T=self.console[y];return T?T.bind(self.console,"["+y+"] >"):H}function B(y){for(var T=arguments.length,_=new Array(T>1?T-1:0),O=1;O<T;O++)_[O-1]=arguments[O];_.forEach(function(w){M[w]=y[w]?y[w].bind(y):W(w)})}function P(y){if(self.console&&y===!0||typeof y=="object"){B(y,"debug","log","info","warn","error");try{M.log()}catch(T){M=C}}else M=C}var R=M},"./src/utils/mediakeys-helper.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"KeySystems",function(){return H}),k.d(X,"requestMediaKeySystemAccess",function(){return C});var H;(function(M){M.WIDEVINE="com.widevine.alpha",M.PLAYREADY="com.microsoft.playready"})(H||(H={}));var C=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"getMediaSource",function(){return H});function H(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"bin2str",function(){return B}),k.d(X,"readUint16",function(){return P}),k.d(X,"readUint32",function(){return R}),k.d(X,"writeUint32",function(){return y}),k.d(X,"findBox",function(){return T}),k.d(X,"parseSegmentIndex",function(){return _}),k.d(X,"parseInitSegment",function(){return O}),k.d(X,"getStartDTS",function(){return w}),k.d(X,"getDuration",function(){return g}),k.d(X,"computeRawDurationFromSamples",function(){return u}),k.d(X,"offsetStartDTS",function(){return o}),k.d(X,"segmentValidRange",function(){return s}),k.d(X,"appendUint8Array",function(){return l});var H=k("./src/utils/typed-array.ts"),C=k("./src/loader/fragment.ts"),M=Math.pow(2,32)-1,W=[].push;function B(b){return String.fromCharCode.apply(null,b)}function P(b,p){"data"in b&&(p+=b.start,b=b.data);var h=b[p]<<8|b[p+1];return h<0?65536+h:h}function R(b,p){"data"in b&&(p+=b.start,b=b.data);var h=b[p]<<24|b[p+1]<<16|b[p+2]<<8|b[p+3];return h<0?4294967296+h:h}function y(b,p,h){"data"in b&&(p+=b.start,b=b.data),b[p]=h>>24,b[p+1]=h>>16&255,b[p+2]=h>>8&255,b[p+3]=h&255}function T(b,p){var h=[];if(!p.length)return h;var L,v,c;"data"in b?(L=b.data,v=b.start,c=b.end):(L=b,v=0,c=L.byteLength);for(var f=v;f<c;){var d=R(L,f),a=B(L.subarray(f+4,f+8)),x=d>1?f+d:c;if(a===p[0])if(p.length===1)h.push({data:L,start:f+8,end:x});else{var m=T({data:L,start:f+8,end:x},p.slice(1));m.length&&W.apply(h,m)}f=x}return h}function _(b){var p=T(b,["moov"]),h=p[0],L=h?h.end:null,v=T(b,["sidx"]);if(!v||!v[0])return null;var c=[],f=v[0],d=f.data[0],a=d===0?8:16,x=R(f,a);a+=4;var m=0,S=0;d===0?a+=8:a+=16,a+=2;var I=f.end+S,z=P(f,a);a+=2;for(var Y=0;Y<z;Y++){var ie=a,G=R(f,ie);ie+=4;var j=G&2147483647,oe=(G&2147483648)>>>31;if(oe===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ye=R(f,ie);ie+=4,c.push({referenceSize:j,subsegmentDuration:ye,info:{duration:ye/x,start:I,end:I+j-1}}),I+=j,ie+=4,a=ie}return{earliestPresentationTime:m,timescale:x,version:d,referencesCount:z,references:c,moovEndOffset:L}}function O(b){for(var p=[],h=T(b,["moov","trak"]),L=0;L<h.length;L++){var v=h[L],c=T(v,["tkhd"])[0];if(c){var f=c.data[c.start],d=f===0?12:20,a=R(c,d),x=T(v,["mdia","mdhd"])[0];if(x){f=x.data[x.start],d=f===0?12:20;var m=R(x,d),S=T(v,["mdia","hdlr"])[0];if(S){var I=B(S.data.subarray(S.start+8,S.start+12)),z={soun:C.ElementaryStreamTypes.AUDIO,vide:C.ElementaryStreamTypes.VIDEO}[I];if(z){var Y=T(v,["mdia","minf","stbl","stsd"])[0],ie=void 0;Y&&(ie=B(Y.data.subarray(Y.start+12,Y.start+16))),p[a]={timescale:m,type:z},p[z]={timescale:m,id:a,codec:ie}}}}}}var G=T(b,["moov","mvex","trex"]);return G.forEach(function(j){var oe=R(j,4),ye=p[oe];ye&&(ye.default={duration:R(j,12),flags:R(j,20)})}),p}function w(b,p){return T(p,["moof","traf"]).reduce(function(h,L){var v=T(L,["tfdt"])[0],c=v.data[v.start],f=T(L,["tfhd"]).reduce(function(d,a){var x=R(a,4),m=b[x];if(m){var S=R(v,4);c===1&&(S*=Math.pow(2,32),S+=R(v,8));var I=m.timescale||9e4,z=S/I;if(isFinite(z)&&(d===null||z<d))return z}return d},null);return f!==null&&isFinite(f)&&(h===null||f<h)?f:h},null)||0}function g(b,p){for(var h=0,L=0,v=0,c=T(b,["moof","traf"]),f=0;f<c.length;f++){var d=c[f],a=T(d,["tfhd"])[0],x=R(a,4),m=p[x];if(!m)continue;var S=m.default,I=R(a,0)|(S==null?void 0:S.flags),z=S==null?void 0:S.duration;I&8&&(I&2?z=R(a,12):z=R(a,8));for(var Y=m.timescale||9e4,ie=T(d,["trun"]),G=0;G<ie.length;G++){if(z){var j=R(ie[G],4);h=z*j}else h=u(ie[G]);m.type===C.ElementaryStreamTypes.VIDEO?L+=h/Y:m.type===C.ElementaryStreamTypes.AUDIO&&(v+=h/Y)}}if(L===0&&v===0){var oe=_(b);if(oe!=null&&oe.references)return oe.references.reduce(function(ye,Ce){return ye+Ce.info.duration||0},0)}return L||v}function u(b){var p=R(b,0),h=8;p&1&&(h+=4),p&4&&(h+=4);for(var L=0,v=R(b,4),c=0;c<v;c++){if(p&256){var f=R(b,h);L+=f,h+=4}p&512&&(h+=4),p&1024&&(h+=4),p&2048&&(h+=4)}return L}function o(b,p,h){T(p,["moof","traf"]).forEach(function(L){T(L,["tfhd"]).forEach(function(v){var c=R(v,4),f=b[c];if(!f)return;var d=f.timescale||9e4;T(L,["tfdt"]).forEach(function(a){var x=a.data[a.start],m=R(a,4);if(x===0)y(a,4,m-h*d);else{m*=Math.pow(2,32),m+=R(a,8),m-=h*d,m=Math.max(m,0);var S=Math.floor(m/(M+1)),I=Math.floor(m%(M+1));y(a,4,S),y(a,8,I)}})})})}function s(b){var p={valid:null,remainder:null},h=T(b,["moof"]);if(h){if(h.length<2)return p.remainder=b,p}else return p;var L=h[h.length-1];return p.valid=Object(H.sliceUint8)(b,0,L.start-8),p.remainder=Object(H.sliceUint8)(b,L.start-8),p}function l(b,p){var h=new Uint8Array(b.length+p.length);return h.set(b),h.set(p,b.length),h}},"./src/utils/output-filter.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"default",function(){return H});var H=function(){function C(W,B){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=W,this.trackName=B}var M=C.prototype;return M.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},M.newCue=function(B,P,R){(this.startTime===null||this.startTime>B)&&(this.startTime=B),this.endTime=P,this.screen=R,this.timelineController.createCaptionsTrack(this.trackName)},M.reset=function(){this.cueRanges=[]},C}()},"./src/utils/texttrack-utils.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"sendAddTrackEvent",function(){return C}),k.d(X,"addCueToTrack",function(){return M}),k.d(X,"clearCurrentCues",function(){return W}),k.d(X,"removeCuesInRange",function(){return B}),k.d(X,"getCuesInRange",function(){return R});var H=k("./src/utils/logger.ts");function C(y,T){var _;try{_=new Event("addtrack")}catch(O){_=document.createEvent("Event"),_.initEvent("addtrack",!1,!1)}_.track=y,T.dispatchEvent(_)}function M(y,T){var _=y.mode;if(_==="disabled"&&(y.mode="hidden"),y.cues&&!y.cues.getCueById(T.id))try{if(y.addCue(T),!y.cues.getCueById(T.id))throw new Error("addCue is failed for: "+T)}catch(w){H.logger.debug("[texttrack-utils]: "+w);var O=new self.TextTrackCue(T.startTime,T.endTime,T.text);O.id=T.id,y.addCue(O)}_==="disabled"&&(y.mode=_)}function W(y){var T=y.mode;if(T==="disabled"&&(y.mode="hidden"),y.cues)for(var _=y.cues.length;_--;)y.removeCue(y.cues[_]);T==="disabled"&&(y.mode=T)}function B(y,T,_){var O=y.mode;if(O==="disabled"&&(y.mode="hidden"),y.cues&&y.cues.length>0)for(var w=R(y.cues,T,_),g=0;g<w.length;g++)y.removeCue(w[g]);O==="disabled"&&(y.mode=O)}function P(y,T){if(T<y[0].startTime)return 0;var _=y.length-1;if(T>y[_].endTime)return-1;for(var O=0,w=_;O<=w;){var g=Math.floor((w+O)/2);if(T<y[g].startTime)w=g-1;else if(T>y[g].startTime&&O<_)O=g+1;else return g}return y[O].startTime-T<T-y[w].startTime?O:w}function R(y,T,_){var O=[],w=P(y,T);if(w>-1)for(var g=w,u=y.length;g<u;g++){var o=y[g];if(o.startTime>=T&&o.endTime<=_)O.push(o);else if(o.startTime>_)return O}return O}},"./src/utils/time-ranges.ts":function(de,X,k){"use strict";k.r(X);var H={toString:function(M){for(var W="",B=M.length,P=0;P<B;P++)W+="["+M.start(P).toFixed(3)+","+M.end(P).toFixed(3)+"]";return W}};X.default=H},"./src/utils/timescale-conversion.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"toTimescaleFromBase",function(){return C}),k.d(X,"toTimescaleFromScale",function(){return M}),k.d(X,"toMsFromMpegTsClock",function(){return W}),k.d(X,"toMpegTsClockFromTimescale",function(){return B});var H=9e4;function C(P,R,y,T){y===void 0&&(y=1),T===void 0&&(T=!1);var _=P*R*y;return T?Math.round(_):_}function M(P,R,y,T){return y===void 0&&(y=1),T===void 0&&(T=!1),C(P,R,1/y,T)}function W(P,R){return R===void 0&&(R=!1),C(P,1e3,1/H,R)}function B(P,R){return R===void 0&&(R=1),C(P,H,1/R)}},"./src/utils/typed-array.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"sliceUint8",function(){return H});function H(C,M,W){return Uint8Array.prototype.slice?C.slice(M,W):new Uint8Array(Array.prototype.slice.call(C,M,W))}},"./src/utils/vttcue.ts":function(de,X,k){"use strict";k.r(X),X.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var H=["","lr","rl"],C=["start","middle","end","left","right"];function M(y,T){if(typeof T!="string")return!1;if(!Array.isArray(y))return!1;var _=T.toLowerCase();return~y.indexOf(_)?_:!1}function W(y){return M(H,y)}function B(y){return M(C,y)}function P(y){for(var T=arguments.length,_=new Array(T>1?T-1:0),O=1;O<T;O++)_[O-1]=arguments[O];for(var w=1;w<arguments.length;w++){var g=arguments[w];for(var u in g)y[u]=g[u]}return y}function R(y,T,_){var O=this,w={enumerable:!0};O.hasBeenReset=!1;var g="",u=!1,o=y,s=T,l=_,b=null,p="",h=!0,L="auto",v="start",c=50,f="middle",d=50,a="middle";Object.defineProperty(O,"id",P({},w,{get:function(){return g},set:function(m){g=""+m}})),Object.defineProperty(O,"pauseOnExit",P({},w,{get:function(){return u},set:function(m){u=!!m}})),Object.defineProperty(O,"startTime",P({},w,{get:function(){return o},set:function(m){if(typeof m!="number")throw new TypeError("Start time must be set to a number.");o=m,this.hasBeenReset=!0}})),Object.defineProperty(O,"endTime",P({},w,{get:function(){return s},set:function(m){if(typeof m!="number")throw new TypeError("End time must be set to a number.");s=m,this.hasBeenReset=!0}})),Object.defineProperty(O,"text",P({},w,{get:function(){return l},set:function(m){l=""+m,this.hasBeenReset=!0}})),Object.defineProperty(O,"region",P({},w,{get:function(){return b},set:function(m){b=m,this.hasBeenReset=!0}})),Object.defineProperty(O,"vertical",P({},w,{get:function(){return p},set:function(m){var S=W(m);if(S===!1)throw new SyntaxError("An invalid or illegal string was specified.");p=S,this.hasBeenReset=!0}})),Object.defineProperty(O,"snapToLines",P({},w,{get:function(){return h},set:function(m){h=!!m,this.hasBeenReset=!0}})),Object.defineProperty(O,"line",P({},w,{get:function(){return L},set:function(m){if(typeof m!="number"&&m!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");L=m,this.hasBeenReset=!0}})),Object.defineProperty(O,"lineAlign",P({},w,{get:function(){return v},set:function(m){var S=B(m);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");v=S,this.hasBeenReset=!0}})),Object.defineProperty(O,"position",P({},w,{get:function(){return c},set:function(m){if(m<0||m>100)throw new Error("Position must be between 0 and 100.");c=m,this.hasBeenReset=!0}})),Object.defineProperty(O,"positionAlign",P({},w,{get:function(){return f},set:function(m){var S=B(m);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");f=S,this.hasBeenReset=!0}})),Object.defineProperty(O,"size",P({},w,{get:function(){return d},set:function(m){if(m<0||m>100)throw new Error("Size must be between 0 and 100.");d=m,this.hasBeenReset=!0}})),Object.defineProperty(O,"align",P({},w,{get:function(){return a},set:function(m){var S=B(m);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");a=S,this.hasBeenReset=!0}})),O.displayState=void 0}return R.prototype.getCueAsHTML=function(){var y=self.WebVTT;return y.convertCueToDOMTree(self,this.text)},R}()},"./src/utils/vttparser.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"parseTimeStamp",function(){return M}),k.d(X,"fixLineBreaks",function(){return T}),k.d(X,"VTTParser",function(){return _});var H=k("./src/utils/vttcue.ts"),C=function(){function O(){}var w=O.prototype;return w.decode=function(u,o){if(!u)return"";if(typeof u!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(u))},O}();function M(O){function w(u,o,s,l){return(u|0)*3600+(o|0)*60+(s|0)+parseFloat(l||0)}var g=O.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return g?parseFloat(g[2])>59?w(g[2],g[3],0,g[4]):w(g[1],g[2],g[3],g[4]):null}var W=function(){function O(){this.values=Object.create(null)}var w=O.prototype;return w.set=function(u,o){!this.get(u)&&o!==""&&(this.values[u]=o)},w.get=function(u,o,s){return s?this.has(u)?this.values[u]:o[s]:this.has(u)?this.values[u]:o},w.has=function(u){return u in this.values},w.alt=function(u,o,s){for(var l=0;l<s.length;++l)if(o===s[l]){this.set(u,o);break}},w.integer=function(u,o){/^-?\d+$/.test(o)&&this.set(u,parseInt(o,10))},w.percent=function(u,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var s=parseFloat(o);if(s>=0&&s<=100)return this.set(u,s),!0}return!1},O}();function B(O,w,g,u){var o=u?O.split(u):[O];for(var s in o){if(typeof o[s]!="string")continue;var l=o[s].split(g);if(l.length!==2)continue;var b=l[0],p=l[1];w(b,p)}}var P=new H.default(0,0,""),R=P.align==="middle"?"middle":"center";function y(O,w,g){var u=O;function o(){var b=M(O);if(b===null)throw new Error("Malformed timestamp: "+u);return O=O.replace(/^[^\sa-zA-Z-]+/,""),b}function s(b,p){var h=new W;B(b,function(c,f){var d;switch(c){case"region":for(var a=g.length-1;a>=0;a--)if(g[a].id===f){h.set(c,g[a].region);break}break;case"vertical":h.alt(c,f,["rl","lr"]);break;case"line":d=f.split(","),h.integer(c,d[0]),h.percent(c,d[0])&&h.set("snapToLines",!1),h.alt(c,d[0],["auto"]),d.length===2&&h.alt("lineAlign",d[1],["start",R,"end"]);break;case"position":d=f.split(","),h.percent(c,d[0]),d.length===2&&h.alt("positionAlign",d[1],["start",R,"end","line-left","line-right","auto"]);break;case"size":h.percent(c,f);break;case"align":h.alt(c,f,["start",R,"end","left","right"]);break}},/:/,/\s/),p.region=h.get("region",null),p.vertical=h.get("vertical","");var L=h.get("line","auto");L==="auto"&&P.line===-1&&(L=-1),p.line=L,p.lineAlign=h.get("lineAlign","start"),p.snapToLines=h.get("snapToLines",!0),p.size=h.get("size",100),p.align=h.get("align",R);var v=h.get("position","auto");v==="auto"&&P.position===50&&(v=p.align==="start"||p.align==="left"?0:p.align==="end"||p.align==="right"?100:50),p.position=v}function l(){O=O.replace(/^\s+/,"")}if(l(),w.startTime=o(),l(),O.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+u);O=O.substr(3),l(),w.endTime=o(),l(),s(O,w)}function T(O){return O.replace(/<br(?: \/)?>/gi,`
|
|
`)}var _=function(){function O(){this.state="INITIAL",this.buffer="",this.decoder=new C,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var w=O.prototype;return w.parse=function(u){var o=this;u&&(o.buffer+=o.decoder.decode(u,{stream:!0}));function s(){var v=o.buffer,c=0;for(v=T(v);c<v.length&&v[c]!=="\r"&&v[c]!==`
|
|
`;)++c;var f=v.substr(0,c);return v[c]==="\r"&&++c,v[c]===`
|
|
`&&++c,o.buffer=v.substr(c),f}function l(v){B(v,function(c,f){},/:/)}try{var b="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;b=s();var p=b.match(/^()?WEBVTT([ \t].*)?$/);if(!p||!p[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var h=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;h?h=!1:b=s();switch(o.state){case"HEADER":/:/.test(b)?l(b):b||(o.state="ID");continue;case"NOTE":b||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(b)){o.state="NOTE";break}if(!b)continue;if(o.cue=new H.default(0,0,""),o.state="CUE",b.indexOf("-->")===-1){o.cue.id=b;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{y(b,o.cue,o.regionList)}catch(v){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var L=b.indexOf("-->")!==-1;if(!b||L&&(h=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
|
|
`),o.cue.text+=b}continue;case"BADCUE":b||(o.state="ID")}}}catch(v){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},w.flush=function(){var u=this;try{if((u.cue||u.state==="HEADER")&&(u.buffer+=`
|
|
|
|
`,u.parse()),u.state==="INITIAL"||u.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){u.onparsingerror&&u.onparsingerror(o)}return u.onflush&&u.onflush(),this},O}()},"./src/utils/webvtt-parser.ts":function(de,X,k){"use strict";k.r(X),k.d(X,"generateCueId",function(){return _}),k.d(X,"parseWebVTT",function(){return w});var H=k("./src/polyfills/number.ts"),C=k("./src/utils/vttparser.ts"),M=k("./src/demux/id3.ts"),W=k("./src/utils/timescale-conversion.ts"),B=k("./src/remux/mp4-remuxer.ts"),P=/\r\n|\n\r|\n|\r/g,R=function(u,o,s){return s===void 0&&(s=0),u.substr(s,o.length)===o},y=function(u){var o=parseInt(u.substr(-3)),s=parseInt(u.substr(-6,2)),l=parseInt(u.substr(-9,2)),b=u.length>9?parseInt(u.substr(0,u.indexOf(":"))):0;if(!Object(H.isFiniteNumber)(o)||!Object(H.isFiniteNumber)(s)||!Object(H.isFiniteNumber)(l)||!Object(H.isFiniteNumber)(b))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+u);return o+=1e3*s,o+=60*1e3*l,o+=60*60*1e3*b,o},T=function(u){for(var o=5381,s=u.length;s;)o=o*33^u.charCodeAt(--s);return(o>>>0).toString()};function _(g,u,o){return T(g.toString())+T(u.toString())+T(o)}var O=function(u,o,s){var l=u[o],b=u[l.prevCC];if(!b||!b.new&&l.new){u.ccOffset=u.presentationOffset=l.start,l.new=!1;return}for(;(p=b)!==null&&p!==void 0&&p.new;){var p;u.ccOffset+=l.start-b.start,l.new=!1,l=b,b=u[l.prevCC]}u.presentationOffset=s};function w(g,u,o,s,l,b,p,h){var L=new C.VTTParser,v=Object(M.utf8ArrayToStr)(new Uint8Array(g)).trim().replace(P,`
|
|
`).split(`
|
|
`),c=[],f=Object(W.toMpegTsClockFromTimescale)(u,o),d="00:00.000",a=0,x=0,m,S=!0,I=!1;L.oncue=function(z){var Y=s[l],ie=s.ccOffset,G=(a-f)/9e4;if(Y!=null&&Y.new&&(x!==void 0?ie=s.ccOffset=Y.start:O(s,l,G)),G&&(ie=G-s.presentationOffset),I){var j=z.endTime-z.startTime,oe=Object(B.normalizePts)((z.startTime+ie-x)*9e4,b*9e4)/9e4;z.startTime=oe,z.endTime=oe+j}var ye=z.text.trim();z.text=decodeURIComponent(encodeURIComponent(ye)),z.id||(z.id=_(z.startTime,z.endTime,ye)),z.endTime>0&&c.push(z)},L.onparsingerror=function(z){m=z},L.onflush=function(){if(m){h(m);return}p(c)},v.forEach(function(z){if(S)if(R(z,"X-TIMESTAMP-MAP=")){S=!1,I=!0,z.substr(16).split(",").forEach(function(Y){R(Y,"LOCAL:")?d=Y.substr(6):R(Y,"MPEGTS:")&&(a=parseInt(Y.substr(7)))});try{x=y(d)/1e3}catch(Y){I=!1,m=Y}return}else z===""&&(S=!1);L.parse(z+`
|
|
`)}),L.flush()}},"./src/utils/xhr-loader.ts":function(de,X,k){"use strict";k.r(X);var H=k("./src/utils/logger.ts"),C=k("./src/loader/load-stats.ts"),M=/^age:\s*[\d.]+\s*$/m,W=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 C.LoadStats,this.retryDelay=0}var P=B.prototype;return P.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},P.abortInternal=function(){var y=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),y&&(y.onreadystatechange=null,y.onprogress=null,y.readyState!==4&&(this.stats.aborted=!0,y.abort()))},P.abort=function(){var y;this.abortInternal(),(y=this.callbacks)!==null&&y!==void 0&&y.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},P.load=function(y,T,_){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=y,this.config=T,this.callbacks=_,this.retryDelay=T.retryDelay,this.loadInternal()},P.loadInternal=function(){var y=this.config,T=this.context;if(!y)return;var _=this.loader=new self.XMLHttpRequest,O=this.stats;O.loading.first=0,O.loaded=0;var w=this.xhrSetup;try{if(w)try{w(_,T.url)}catch(o){_.open("GET",T.url,!0),w(_,T.url)}_.readyState||_.open("GET",T.url,!0);var g=this.context.headers;if(g)for(var u in g)_.setRequestHeader(u,g[u])}catch(o){this.callbacks.onError({code:_.status,text:o.message},T,_);return}T.rangeEnd&&_.setRequestHeader("Range","bytes="+T.rangeStart+"-"+(T.rangeEnd-1)),_.onreadystatechange=this.readystatechange.bind(this),_.onprogress=this.loadprogress.bind(this),_.responseType=T.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),y.timeout),_.send()},P.readystatechange=function(){var y=this.context,T=this.loader,_=this.stats;if(!y||!T)return;var O=T.readyState,w=this.config;if(_.aborted)return;if(O>=2)if(self.clearTimeout(this.requestTimeout),_.loading.first===0&&(_.loading.first=Math.max(self.performance.now(),_.loading.start)),O===4){T.onreadystatechange=null,T.onprogress=null;var g=T.status;if(g>=200&&g<300){_.loading.end=Math.max(self.performance.now(),_.loading.first);var u,o;if(y.responseType==="arraybuffer"?(u=T.response,o=u.byteLength):(u=T.responseText,o=u.length),_.loaded=_.total=o,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(_,y,u,T),!this.callbacks)return;var l={url:T.responseURL,data:u};this.callbacks.onSuccess(l,_,y,T)}else _.retry>=w.maxRetry||g>=400&&g<499?(H.logger.error(g+" while loading "+y.url),this.callbacks.onError({code:g,text:T.statusText},y,T)):(H.logger.warn(g+" while loading "+y.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,w.maxRetryDelay),_.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),w.timeout)},P.loadtimeout=function(){H.logger.warn("timeout while loading "+this.context.url);var y=this.callbacks;y&&(this.abortInternal(),y.onTimeout(this.stats,this.context,this.loader))},P.loadprogress=function(y){var T=this.stats;T.loaded=y.loaded,y.lengthComputable&&(T.total=y.total)},P.getCacheAge=function(){var y=null;if(this.loader&&M.test(this.loader.getAllResponseHeaders())){var T=this.loader.getResponseHeader("age");y=T?parseFloat(T):null}return y},B}();X.default=W}}).default})},vHTk:function(Ot,ct,le){Ot.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|