(window.webpackJsonp=window.webpackJsonp||[]).push([[165,5,7],{"+NIl":function(mt,Ee,Q){(function(ne){ne(Q("VrN/"))})(function(ne){"use strict";ne.defineMode("stex",function($,O){"use strict";function V(m,p){m.cmdState.push(p)}function _(m){return m.cmdState.length>0?m.cmdState[m.cmdState.length-1]:null}function P(m){var p=m.cmdState.pop();p&&p.closeBracket()}function F(m){for(var p=m.cmdState,v=p.length-1;v>=0;v--){var a=p[v];if(a.name=="DEFAULT")continue;return a}return{styleIdentifier:function(){return null}}}function N(m,p,v){return function(){this.name=m,this.bracketNo=0,this.style=p,this.styles=v,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var M={};M.importmodule=N("importmodule","tag",["string","builtin"]),M.documentclass=N("documentclass","tag",["","atom"]),M.usepackage=N("usepackage","tag",["atom"]),M.begin=N("begin","tag",["atom"]),M.end=N("end","tag",["atom"]),M.label=N("label","tag",["atom"]),M.ref=N("ref","tag",["atom"]),M.eqref=N("eqref","tag",["atom"]),M.cite=N("cite","tag",["atom"]),M.bibitem=N("bibitem","tag",["atom"]),M.Bibitem=N("Bibitem","tag",["atom"]),M.RBibitem=N("RBibitem","tag",["atom"]),M.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function k(m,p){m.f=p}function d(m,p){var v;if(m.match(/^\\[a-zA-Z@]+/)){var a=m.current().slice(1);return v=M.hasOwnProperty(a)?M[a]:M.DEFAULT,v=new v,V(p,v),k(p,S),v.style}if(m.match(/^\\[$&%#{}_]/))return"tag";if(m.match(/^\\[,;!\/\\]/))return"tag";if(m.match("\\["))return k(p,function(s,l){return h(s,l,"\\]")}),"keyword";if(m.match("\\("))return k(p,function(s,l){return h(s,l,"\\)")}),"keyword";if(m.match("$$"))return k(p,function(s,l){return h(s,l,"$$")}),"keyword";if(m.match("$"))return k(p,function(s,l){return h(s,l,"$")}),"keyword";var i=m.next();if(i=="%")return m.skipToEnd(),"comment";if(i=="}"||i=="]"){if(v=_(p),v)v.closeBracket(i),k(p,S);else return"error";return"bracket"}else return i=="{"||i=="["?(v=M.DEFAULT,v=new v,V(p,v),"bracket"):/\d/.test(i)?(m.eatWhile(/[\w.%]/),"atom"):(m.eatWhile(/[\w\-_]/),v=F(p),v.name=="begin"&&(v.argument=m.current()),v.styleIdentifier())}function h(m,p,v){if(m.eatSpace())return null;if(v&&m.match(v))return k(p,d),"keyword";if(m.match(/^\\[a-zA-Z@]+/))return"tag";if(m.match(/^[a-zA-Z]+/))return"variable-2";if(m.match(/^\\[$&%#{}_]/))return"tag";if(m.match(/^\\[,;!\/]/))return"tag";if(m.match(/^[\^_&]/))return"tag";if(m.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(m.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var a=m.next();return a=="{"||a=="}"||a=="["||a=="]"||a=="("||a==")"?"bracket":a=="%"?(m.skipToEnd(),"comment"):"error"}function S(m,p){var v=m.peek(),a;return v=="{"||v=="["?(a=_(p),a.openBracket(v),m.eat(v),k(p,d),"bracket"):/[ \t\r]/.test(v)?(m.eat(v),null):(k(p,d),P(p),d(m,p))}return{startState:function(){var m=O.inMathMode?function(p,v){return h(p,v)}:d;return{cmdState:[],f:m}},copyState:function(m){return{cmdState:m.cmdState.slice(),f:m.f}},token:function(m,p){return p.f(m,p)},blankLine:function(m){m.f=d,m.cmdState.length=0},lineComment:"%"}}),ne.defineMIME("text/x-stex","stex"),ne.defineMIME("text/x-latex","stex")})},"+ua5":function(mt,Ee,Q){},"/cxE":function(mt,Ee,Q){"use strict";Q.d(Ee,"e",function(){return O}),Q.d(Ee,"f",function(){return V}),Q.d(Ee,"g",function(){return _}),Q.d(Ee,"d",function(){return F}),Q.d(Ee,"a",function(){return N}),Q.d(Ee,"b",function(){return M}),Q.d(Ee,"c",function(){return k});var ne=function(){function d(){this.listeners=[],this.unexpectedErrorHandler=function(h){setTimeout(function(){throw h.stack?new Error(h.message+` `+h.stack):h},0)}}return d.prototype.emit=function(h){this.listeners.forEach(function(S){S(h)})},d.prototype.onUnexpectedError=function(h){this.unexpectedErrorHandler(h),this.emit(h)},d.prototype.onUnexpectedExternalError=function(h){this.unexpectedErrorHandler(h)},d}(),$=new ne;function O(d){F(d)||$.onUnexpectedError(d);return}function V(d){F(d)||$.onUnexpectedExternalError(d);return}function _(d){if(d instanceof Error){var h=d.name,S=d.message,m=d.stacktrace||d.stack;return{$isError:!0,name:h,message:S,stack:m}}return d}var P="Canceled";function F(d){return d instanceof Error&&d.name===P&&d.message===P}function N(){var d=new Error(P);return d.name=d.message,d}function M(d){return d?new Error("Illegal argument: "+d):new Error("Illegal argument")}function k(d){return d?new Error("Illegal state: "+d):new Error("Illegal state")}},"19Vz":function(mt,Ee,Q){(function(ne){ne(Q("VrN/"))})(function(ne){ne.defineOption("placeholder","",function(N,M,k){var d=k&&k!=ne.Init;if(M&&!d)N.on("blur",_),N.on("change",P),N.on("swapDoc",P),ne.on(N.getInputField(),"compositionupdate",N.state.placeholderCompose=function(){V(N)}),P(N);else if(!M&&d){N.off("blur",_),N.off("change",P),N.off("swapDoc",P),ne.off(N.getInputField(),"compositionupdate",N.state.placeholderCompose),$(N);var h=N.getWrapperElement();h.className=h.className.replace(" CodeMirror-empty","")}M&&!N.hasFocus()&&_(N)});function $(N){N.state.placeholder&&(N.state.placeholder.parentNode.removeChild(N.state.placeholder),N.state.placeholder=null)}function O(N){$(N);var M=N.state.placeholder=document.createElement("pre");M.style.cssText="height: 0; overflow: visible",M.style.direction=N.getOption("direction"),M.className="CodeMirror-placeholder CodeMirror-line-like";var k=N.getOption("placeholder");typeof k=="string"&&(k=document.createTextNode(k)),M.appendChild(k),N.display.lineSpace.insertBefore(M,N.display.lineSpace.firstChild)}function V(N){setTimeout(function(){var M=!1,k=N.getInputField();k.nodeName=="TEXTAREA"?M=!k.value:N.lineCount()==1&&(M=!/[^\u200b]/.test(k.querySelector(".CodeMirror-line").textContent)),M?O(N):$(N)},20)}function _(N){F(N)&&O(N)}function P(N){var M=N.getWrapperElement(),k=F(N);M.className=M.className.replace(" CodeMirror-empty","")+(k?" CodeMirror-empty":""),k?O(N):$(N)}function F(N){return N.lineCount()===1&&N.getLine(0)===""}})},"1eCo":function(mt,Ee,Q){(function(ne){ne(Q("VrN/"))})(function(ne){"use strict";var $={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},O={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ne.defineMode("xml",function(V,_){var P=V.indentUnit,F={},N=_.htmlMode?$:O;for(var M in N)F[M]=N[M];for(var M in _)F[M]=_[M];var k,d;function h(u,L){function x(W){return L.tokenize=W,W(u,L)}var A=u.next();if(A=="<")return u.eat("!")?u.eat("[")?u.match("CDATA[")?x(p("atom","]]>")):null:u.match("--")?x(p("comment","-->")):u.match("DOCTYPE",!0,!0)?(u.eatWhile(/[\w\._\-]/),x(v(1))):null:u.eat("?")?(u.eatWhile(/[\w\._\-]/),L.tokenize=p("meta","?>"),"meta"):(k=u.eat("/")?"closeTag":"openTag",L.tokenize=S,"tag bracket");if(A=="&"){var I;return u.eat("#")?u.eat("x")?I=u.eatWhile(/[a-fA-F\d]/)&&u.eat(";"):I=u.eatWhile(/[\d]/)&&u.eat(";"):I=u.eatWhile(/[\w\.\-:]/)&&u.eat(";"),I?"atom":"error"}else return u.eatWhile(/[^&<]/),null}h.isInText=!0;function S(u,L){var x=u.next();if(x==">"||x=="/"&&u.eat(">"))return L.tokenize=h,k=x==">"?"endTag":"selfcloseTag","tag bracket";if(x=="=")return k="equals",null;if(x=="<"){L.tokenize=h,L.state=l,L.tagName=L.tagStart=null;var A=L.tokenize(u,L);return A?A+" tag error":"tag error"}else return/[\'\"]/.test(x)?(L.tokenize=m(x),L.stringStartCol=u.column(),L.tokenize(u,L)):(u.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function m(u){var L=function(x,A){for(;!x.eol();)if(x.next()==u){A.tokenize=S;break}return"string"};return L.isInAttribute=!0,L}function p(u,L){return function(x,A){for(;!x.eol();){if(x.match(L)){A.tokenize=h;break}x.next()}return u}}function v(u){return function(L,x){for(var A;(A=L.next())!=null;){if(A=="<")return x.tokenize=v(u+1),x.tokenize(L,x);if(A==">")if(u==1){x.tokenize=h;break}else return x.tokenize=v(u-1),x.tokenize(L,x)}return"meta"}}function a(u,L,x){this.prev=u.context,this.tagName=L,this.indent=u.indented,this.startOfLine=x,(F.doNotIndent.hasOwnProperty(L)||u.context&&u.context.noIndent)&&(this.noIndent=!0)}function i(u){u.context&&(u.context=u.context.prev)}function s(u,L){for(var x;;){if(!u.context)return;if(x=u.context.tagName,!F.contextGrabbers.hasOwnProperty(x)||!F.contextGrabbers[x].hasOwnProperty(L))return;i(u)}}function l(u,L,x){return u=="openTag"?(x.tagStart=L.column(),C):u=="closeTag"?g:l}function C(u,L,x){return u=="word"?(x.tagName=L.current(),d="tag",w):F.allowMissingTagName&&u=="endTag"?(d="tag bracket",w(u,L,x)):(d="error",C)}function g(u,L,x){if(u=="word"){var A=L.current();return x.context&&x.context.tagName!=A&&F.implicitlyClosed.hasOwnProperty(x.context.tagName)&&i(x),x.context&&x.context.tagName==A||F.matchClosing===!1?(d="tag",y):(d="tag error",R)}else return F.allowMissingTagName&&u=="endTag"?(d="tag bracket",y(u,L,x)):(d="error",R)}function y(u,L,x){return u!="endTag"?(d="error",y):(i(x),l)}function R(u,L,x){return d="error",y(u,L,x)}function w(u,L,x){if(u=="word")return d="attribute",T;if(u=="endTag"||u=="selfcloseTag"){var A=x.tagName,I=x.tagStart;return x.tagName=x.tagStart=null,u=="selfcloseTag"||F.autoSelfClosers.hasOwnProperty(A)?s(x,A):(s(x,A),x.context=new a(x,A,I==x.indented)),l}return d="error",w}function T(u,L,x){return u=="equals"?b:(F.allowMissing||(d="error"),w(u,L,x))}function b(u,L,x){return u=="string"?f:u=="word"&&F.allowUnquoted?(d="string",w):(d="error",w(u,L,x))}function f(u,L,x){return u=="string"?f:w(u,L,x)}return{startState:function(u){var L={tokenize:h,state:l,indented:u||0,tagName:null,tagStart:null,context:null};return u!=null&&(L.baseIndent=u),L},token:function(u,L){if(!L.tagName&&u.sol()&&(L.indented=u.indentation()),u.eatSpace())return null;k=null;var x=L.tokenize(u,L);return(x||k)&&x!="comment"&&(d=null,L.state=L.state(k||x,u,L),d&&(x=d=="error"?x+" error":d)),x},indent:function(u,L,x){var A=u.context;if(u.tokenize.isInAttribute)return u.tagStart==u.indented?u.stringStartCol+1:u.indented+P;if(A&&A.noIndent)return ne.Pass;if(u.tokenize!=S&&u.tokenize!=h)return x?x.match(/^(\s*)/)[0].length:0;if(u.tagName)return F.multilineTagIndentPastTag!==!1?u.tagStart+u.tagName.length+2:u.tagStart+P*(F.multilineTagIndentFactor||1);if(F.alignCDATA&&/$/,blockCommentStart:"",configuration:F.htmlMode?"html":"xml",helperType:F.htmlMode?"html":"xml",skipAttribute:function(u){u.state==b&&(u.state=w)},xmlCurrentTag:function(u){return u.tagName?{name:u.tagName,close:u.type=="closeTag"}:null},xmlCurrentContext:function(u){for(var L=[],x=u.context;x;x=x.prev)x.tagName&&L.push(x.tagName);return L.reverse()}}}),ne.defineMIME("text/xml","xml"),ne.defineMIME("application/xml","xml"),ne.mimeModes.hasOwnProperty("text/html")||ne.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"24hK":function(mt,Ee,Q){"use strict";Q.d(Ee,"a",function(){return O});var ne=Q("JYp7"),$=function(){function V(_){this.element=_,this.next=V.Undefined,this.prev=V.Undefined}return V.Undefined=new V(void 0),V}(),O=function(){function V(){this._first=$.Undefined,this._last=$.Undefined,this._size=0}return Object.defineProperty(V.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),V.prototype.isEmpty=function(){return this._first===$.Undefined},V.prototype.clear=function(){this._first=$.Undefined,this._last=$.Undefined,this._size=0},V.prototype.unshift=function(_){return this._insert(_,!1)},V.prototype.push=function(_){return this._insert(_,!0)},V.prototype._insert=function(_,P){var F=this,N=new $(_);if(this._first===$.Undefined)this._first=N,this._last=N;else if(P){var M=this._last;this._last=N,N.prev=M,M.next=N}else{var k=this._first;this._first=N,N.next=k,k.prev=N}this._size+=1;var d=!1;return function(){d||(d=!0,F._remove(N))}},V.prototype.shift=function(){if(this._first===$.Undefined)return;var _=this._first.element;return this._remove(this._first),_},V.prototype.pop=function(){if(this._last===$.Undefined)return;var _=this._last.element;return this._remove(this._last),_},V.prototype._remove=function(_){if(_.prev!==$.Undefined&&_.next!==$.Undefined){var P=_.prev;P.next=_.next,_.next.prev=P}else _.prev===$.Undefined&&_.next===$.Undefined?(this._first=$.Undefined,this._last=$.Undefined):_.next===$.Undefined?(this._last=this._last.prev,this._last.next=$.Undefined):_.prev===$.Undefined&&(this._first=this._first.next,this._first.prev=$.Undefined);this._size-=1},V.prototype.iterator=function(){var _,P=this._first;return{next:function(){return P===$.Undefined?ne.c:(_?_.value=P.element:_={done:!1,value:P.element},P=P.next,_)}}},V.prototype.toArray=function(){for(var _=[],P=this._first;P!==$.Undefined;P=P.next)_.push(P.element);return _},V}()},"30zm":function(mt,Ee,Q){"use strict";var ne=Q("jCWc"),$=Q("kPKH"),O=Q("k1fw"),V=Q("tJVT"),_=Q("PpiC"),P=Q("B9cy"),F=Q("Ol7k"),N=Q("lUTK"),M=Q("BvKs"),k=Q("q1tI"),d=Q.n(k),h=Q("Ty5D"),S=Q("55Ip"),m=Q("9kvl"),p=Q("m3rI"),v=Q("kzJb"),a=Q.n(v),i=M.a.SubMenu,s=F.a.Sider,l=F.a.Content,C=function(y){var R=y.messages,w=y.globalSetting,T=y.loading,b=y.user,f=y.dispatch,u=Object(_.a)(y,["messages","globalSetting","loading","user","dispatch"]),L=Object(h.i)(),x=b.userInfo,A=Object(h.h)(),I=R.tidingsList,W=R.privateMessage,K=R.unreadInfo,Z=Object(k.useState)({per_page:10,page:1}),z=Object(V.a)(Z,2),B=z[0],ee=z[1];Object(k.useEffect)(function(){ie()},[L.userId]);var ie=function(){f({type:"messages/unreadMessageInfo",payload:Object(O.a)(Object(O.a)({},B),L)})};return d.a.createElement($.a,{flex:"264px"},d.a.createElement("aside",{className:a.a.userInfo},d.a.createElement("img",{className:"mt40",src:p.a.IMG_SERVER+"/images/"+(x==null?void 0:x.image_url)}),d.a.createElement("p",{className:"font24 mt10"},x==null?void 0:x.username),d.a.createElement("p",{className:"mt20"},x==null?void 0:x.user_identity)),d.a.createElement("ul",{className:a.a.navInfo},d.a.createElement(S.a,{to:"/messages/".concat(x==null?void 0:x.login,"/user_tidings")},d.a.createElement("li",{className:A.pathname.indexOf("user_tidings")>-1&&a.a.actived},"\u6D88\u606F",!!(K!=null&&K.unread_tiding_count)&&d.a.createElement("span",{className:a.a.newTip},K==null?void 0:K.unread_tiding_count))),d.a.createElement(S.a,{to:"/messages/".concat(x==null?void 0:x.login,"/private_messages")},d.a.createElement("li",{className:(A.pathname.indexOf("private_messages")>-1||A.pathname.indexOf("message_detail")>-1)&&a.a.actived},"\u79C1\u4FE1",!!(K!=null&&K.unread_message_count)&&d.a.createElement("span",{className:a.a.newTip},K==null?void 0:K.unread_message_count)))))};Ee.a=Object(m.a)(function(g){var y=g.messages,R=g.loading,w=g.user,T=g.globalSetting;return{messages:y,globalSetting:T,user:w,loading:R.effects}})(C)},"55Ip":function(mt,Ee,Q){"use strict";Q.d(Ee,"a",function(){return s}),Q.d(Ee,"b",function(){return w});var ne=Q("Ty5D"),$=Q("dI71"),O=Q("q1tI"),V=Q.n(O),_=Q("YS25"),P=Q("17x9"),F=Q.n(P),N=Q("wx14"),M=Q("zLVn"),k=Q("9R94"),d=function(b){Object($.a)(f,b);function f(){for(var L,x=arguments.length,A=new Array(x),I=0;I1&&arguments[1]!==void 0?arguments[1]:0,p=(F[S[m+0]]+F[S[m+1]]+F[S[m+2]]+F[S[m+3]]+"-"+F[S[m+4]]+F[S[m+5]]+"-"+F[S[m+6]]+F[S[m+7]]+"-"+F[S[m+8]]+F[S[m+9]]+"-"+F[S[m+10]]+F[S[m+11]]+F[S[m+12]]+F[S[m+13]]+F[S[m+14]]+F[S[m+15]]).toLowerCase();if(!P(p))throw TypeError("Stringified UUID is invalid");return p}var k=M;function d(S,m,p){S=S||{};var v=S.random||(S.rng||O)();if(v[6]=v[6]&15|64,v[8]=v[8]&63|128,m){p=p||0;for(var a=0;a<16;++a)m[p+a]=v[a];return m}return k(v)}var h=Ee.a=d},"7ahc":function(mt,Ee,Q){"use strict";Q.d(Ee,"a",function(){return C});var ne=Q("k1fw"),$=Q("0Owb"),O=Q("+L6B"),V=Q("2/Rp"),_=Q("y8nQ"),P=Q("Vl3Y"),F=Q("tJVT"),N=Q("OaEy"),M=Q("2fM7"),k=Q("q1tI"),d=Q.n(k),h=Q("VrN/"),S=Q.n(h),m=Q("p77/"),p=Q.n(m),v=Q("c5Ni"),a=Q.n(v),i=M.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"]};Ee.b=function(g){var y=g.callback,R=g.onCancel,w=Object(k.useState)("python"),T=Object(F.a)(w,2),b=T[0],f=T[1];function u(x){f(l[x][1])}function L(x){y(x)}return d.a.createElement(P.a,Object($.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:L}),d.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},d.a.createElement(M.a,{onChange:u},Object.keys(l).map(function(x){return d.a.createElement(i,{key:x,value:x},l[x][0])}))),d.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},d.a.createElement(C,{mode:b})),d.a.createElement("div",{className:"flex-container flex-end"},d.a.createElement(V.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),d.a.createElement(V.a,{type:"ghost",onClick:R},"\u53D6\u6D88")))};function C(g){var y=g.value,R=g.onChange,w=g.mode,T=g.options,b=T===void 0?{}:T,f=Object(k.useRef)(),u=Object(k.useState)(),L=Object(F.a)(u,2),x=L[0],A=L[1];return Object(k.useEffect)(function(){if(x){function I(W){var K=W.getValue();R&&R(K)}return x.on("change",I),function(){x.off("change",I)}}},[x,R]),Object(k.useEffect)(function(){x&&x.setOption("mode",w)},[x,w]),Object(k.useEffect)(function(){x&&((y!==x.getValue()||y==="")&&setTimeout(function(){x.setValue(y||" ")},300))},[x,y]),Object(k.useEffect)(function(){if(f.current&&!x){var I=S.a.fromTextArea(f.current,Object(ne.a)({mode:w,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},b));A(I)}},[f.current,x]),d.a.createElement("div",{className:"my-codemirror-container"},d.a.createElement("textarea",{ref:f}))}},"8EBN":function(mt,Ee,Q){(function(ne){ne(Q("VrN/"))})(function(ne){"use strict";ne.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 $=0;$-1&&V.substring(F+1,V.length);if(N)return ne.findModeByExtension(N)},ne.findModeByName=function(V){V=V.toLowerCase();for(var _=0;_0&&S[S.length-1])&&(a[0]===6||a[0]===2)){k=0;continue}if(a[0]===3&&(!S||a[1]>S[0]&&a[1]=j.length?X.slice(j.length):X}).join(` `)}var a=[],i=["
    "],s=new m.a.Renderer,l=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function C(){a.length=0,i=["
      "]}var g={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function y(H,c,E,j){if(c>=H.length||H[c].level<=E)return c;var X=H[c];j.push("
    • "+X.text+""),c++;var G=[];return c=y(H,c,X.level,G),G.length>0&&(j.push("
        "),G.forEach(function(pe){j.push(pe)}),j.push("
      ")),j.push("
    • "),c=y(H,c,E,j),c}function R(){return y(a,0,0,i),i.push("
    "),i.join("")}var w={heading:function(c){var E=l.exec(c);if(E)return{type:"heading",raw:E[0],depth:E[1].length,text:E[2]}},fences:function(c){var E=this.rules.block.fences.exec(c);if(E){var j=E[0],X=v(j,E[3]||""),G=E[2]?E[2].trim():E[2];if(["latex","katex","math"].indexOf(G)>=0){var pe=f(),We=X;X=pe,u[pe]={type:"block",expression:We}}return{type:"code",raw:j,lang:G,text:X}}}},T=/(?:\${2})([^\n`]+?)(?:\${2})/gi,b=0,f=function(){return"__special_katext_id_".concat(b++,"__")},u={};function L(){return u}function x(){b=0,u={}}function A(H){return H=H.replace(T,function(c,E){var j=f();return u[j]={type:"inline",expression:E},j}),H}var I=s.listitem;s.listitem=function(H){return I(A(H))};var W=s.paragraph;s.paragraph=function(H){return W(A(H))};var K=s.tablecell;s.tablecell=function(H,c){return K(A(H),c)},s.code=function(H,c,E){var j=(c||"").match(/\S*/)[0];return j?["latex","katex","math"].indexOf(j)>=0?"

    ".concat(H,"

    "):'
    ').concat(E?H:Object(p.escape)(H,!0),`
    `):'
    '+(E?H:Object(p.escape)(H,!0))+"
    "},s.heading=function(H,c,E){var j=this.options.headerPrefix+E.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return a.push({anchor:j,level:c,text:H}),"'+H+""},m.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),m.a.use({tokenizer:w,renderer:s});var Z=m.a,z=Q("SJMd"),B=Q("ulZh"),ee=Q.n(B),ie=Q("m3rI"),de=Q("Oy/b"),be=Q("p5ED"),Ie=Q("ErOA");/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var Ae=function(H,c){return(Ae=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,j){E.__proto__=j}||function(E,j){for(var X in j)Object.prototype.hasOwnProperty.call(j,X)&&(E[X]=j[X])})(H,c)};function Re(H,c){function E(){this.constructor=H}Ae(H,c),H.prototype=c===null?Object.create(c):(E.prototype=c.prototype,new E)}function ke(H,c,E,j){return new(E||(E=Promise))(function(X,G){function pe(gt){try{nt(j.next(gt))}catch(Ge){G(Ge)}}function We(gt){try{nt(j.throw(gt))}catch(Ge){G(Ge)}}function nt(gt){var Ge;gt.done?X(gt.value):(Ge=gt.value,Ge instanceof E?Ge:new E(function(Dt){Dt(Ge)})).then(pe,We)}nt((j=j.apply(H,c||[])).next())})}function De(H,c){var E,j,X,G,pe={label:0,sent:function(){if(1&X[0])throw X[1];return X[1]},trys:[],ops:[]};return G={next:We(0),throw:We(1),return:We(2)},typeof Symbol=="function"&&(G[Symbol.iterator]=function(){return this}),G;function We(nt){return function(gt){return function(Ge){if(E)throw new TypeError("Generator is already executing.");for(;pe;)try{if(E=1,j&&(X=2&Ge[0]?j.return:Ge[0]?j.throw||((X=j.return)&&X.call(j),0):j.next)&&!(X=X.call(j,Ge[1])).done)return X;switch(j=0,X&&(Ge=[2&Ge[0],X.value]),Ge[0]){case 0:case 1:X=Ge;break;case 4:return pe.label++,{value:Ge[1],done:!1};case 5:pe.label++,j=Ge[1],Ge=[0];continue;case 7:Ge=pe.ops.pop(),pe.trys.pop();continue;default:if(!(X=pe.trys,(X=X.length>0&&X[X.length-1])||Ge[0]!==6&&Ge[0]!==2)){pe=0;continue}if(Ge[0]===3&&(!X||Ge[1]>X[0]&&Ge[1]',"select"),this.addActionButton(j,'',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(j,'',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(j,'',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(j,'',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(j,'',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(j,'',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(j,'',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(G){var pe=document.createElement("div");pe.className=""+E.toolbarButtonStyleClass.name,pe.setAttribute("data-type-name",G.typeName),pe.innerHTML=G.icon,pe.addEventListener("click",function(){E.markerToolbarButtonClicked(pe,G)}),E.buttons.push(pe),E.markerButtons.push(pe)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var X=document.createElement("div");X.className=this.toolbarBlockStyleClass.name,X.style.whiteSpace="nowrap",X.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(X),this.addActionButton(X,'',"render"),this.addActionButton(X,'',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},H.prototype.addButtonClickListener=function(c){this.buttonClickListeners.push(c)},H.prototype.removeButtonClickListener=function(c){this.buttonClickListeners.indexOf(c)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(c),1)},H.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},H.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var c=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var E=0;E0&&this.buttonClickListeners.forEach(function(j){return j("marker",E)}),this.markerButtonOverflowBlock.style.display="none"},H.prototype.actionToolbarButtonClicked=function(c,E){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(j){return j("action",E)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},H.prototype.setActiveButton=function(c){this.resetButtonStyles(),c.className=c.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),c.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},H.prototype.setActiveMarkerButton=function(c){var E=this.markerButtons.find(function(j){return j.getAttribute("data-type-name")===c});E&&this.setActiveButton(E)},H.prototype.setCurrentMarker=function(c){var E=this;this.currentMarker=c,this.buttons.filter(function(j){return/delete|notes/.test(j.getAttribute("data-action"))}).forEach(function(j){E.currentMarker===void 0?(j.style.fillOpacity="0.4",j.style.pointerEvents="none"):(j.style.fillOpacity="1",j.style.pointerEvents="all")})},H}(),we=function(){function H(c,E,j,X){this.panels=[],this.panelButtons=[],this.markerjsContainer=c,this.displayMode=E,this.uiStyleSettings=j,this.styles=X,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return H.prototype.addStyles=function(){var c;this.toolboxStyleClass=this.styles.addClass(new ae("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 ae("toolbox_colors",` color: `+this.uiStyleSettings.toolboxColor+`; `));var E=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new ae("toolbox-button-row",` display: flex; cursor: default; box-sizing: content-box; `)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new ae("toolbox-button-row_colors",` background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`; `)),this.toolboxPanelRowStyleClass=this.styles.addClass(new ae("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 ae("toolbox-panel-row_colors",` background-color: `+((c=this.uiStyleSettings.toolboxBackgroundColor)!==null&&c!==void 0?c:this.uiStyleSettings.toolbarBackgroundHoverColor)+`; `)),this.toolboxButtonStyleClass=this.styles.addClass(new ae("toolbox_button",` display: inline-block; width: `+(this.uiStyleSettings.toolbarHeight-2*E)+`px; height: `+(this.uiStyleSettings.toolbarHeight-2*E)+`px; padding: `+E+`px; box-sizing: content-box; `)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new ae("toolbox-button_colors",` fill: `+this.uiStyleSettings.toolbarColor+`; `)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new ae("toolbox-active-button_colors",` background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`; fill: `+this.uiStyleSettings.toolbarColor+`; `)),this.styles.addRule(new se("."+this.toolboxButtonStyleColorsClass.name+":hover",` background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+` `)),this.styles.addRule(new se("."+this.toolboxButtonStyleClass.name+" svg",` height: `+this.uiStyleSettings.toolbarHeight/2+`px; `))},H.prototype.show=function(c){var E;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=c,this.uiContainer.className=this.toolboxStyleClass.name+" "+((E=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&E!==void 0?E:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},H.prototype.setPanelButtons=function(c){var E,j,X=this;this.panels=c,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((E=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&E!==void 0?E:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((j=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&j!==void 0?j:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(G){var pe;G.uiStyleSettings=X.uiStyleSettings;var We=document.createElement("div");We.className=X.toolboxButtonStyleClass.name+" "+((pe=X.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&pe!==void 0?pe:X.toolboxButtonStyleColorsClass.name),We.innerHTML=G.icon,We.title=G.title,We.addEventListener("click",function(){X.panelButtonClick(G)}),X.panelButtons.push(We),X.buttonRow.appendChild(We)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},H.prototype.panelButtonClick=function(c){var E=this,j=-1;if(c!==this.activePanel){j=this.panels.indexOf(c),this.panelRow.innerHTML="";var X=c.getUi();X.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(X),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=c}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){E.displayMode==="inline"?E.panelRow.style.display="none":E.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(G,pe){var We,nt;G.className=E.toolboxButtonStyleClass.name+" "+(pe===j?""+((We=E.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&We!==void 0?We:E.toolboxActiveButtonStyleColorsClass.name):""+((nt=E.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&nt!==void 0?nt:E.toolboxButtonStyleColorsClass.name))})},H}(),Pe=function(H,c){this.title=H,this.icon=c},_e=function(H){function c(E,j,X,G){var pe=H.call(this,E,G||'')||this;return pe.colors=[],pe.addTransparent=!1,pe.colorBoxes=[],pe.colors=j,pe.currentColor=X,pe.setCurrentColor=pe.setCurrentColor.bind(pe),pe.getColorBox=pe.getColorBox.bind(pe),pe}return Re(c,H),c.prototype.getUi=function(){var E=this,j=document.createElement("div");return j.style.overflow="hidden",j.style.whiteSpace="nowrap",this.colors.forEach(function(X){var G=E.getColorBox(X);j.appendChild(G),E.colorBoxes.push(G)}),j},c.prototype.getColorBox=function(E){var j=this,X=this.uiStyleSettings.toolbarHeight/4,G=this.uiStyleSettings.toolbarHeight-X,pe=document.createElement("div");pe.style.display="inline-block",pe.style.boxSizing="content-box",pe.style.width=G-2+"px",pe.style.height=G-2+"px",pe.style.padding="1px",pe.style.marginRight="2px",pe.style.marginBottom="2px",pe.style.borderWidth="2px",pe.style.borderStyle="solid",pe.style.borderRadius=(G+2)/2+"px",pe.style.borderColor=E===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",pe.addEventListener("click",function(){j.setCurrentColor(E,pe)});var We=document.createElement("div");return We.style.display="inline-block",We.style.width=G-2+"px",We.style.height=G-2+"px",We.style.backgroundColor=E,We.style.borderRadius=G/2+"px",E==="transparent"&&(We.style.fill=this.uiStyleSettings.toolboxAccentColor,We.innerHTML=` `),pe.appendChild(We),pe},c.prototype.setCurrentColor=function(E,j){var X=this;this.currentColor=E,this.colorBoxes.forEach(function(G){G.style.borderColor=G===j?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(E)},c}(Pe),Ue=function(){function H(c,E,j){this._state="new",this._isSelected=!1,this._container=c,this._overlayContainer=E,this.globalSettings=j,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(H.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),H.prototype.ownsTarget=function(c){return!1},Object.defineProperty(H.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),H.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},H.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},H.prototype.pointerDown=function(c,E){},H.prototype.dblClick=function(c,E){},H.prototype.manipulate=function(c){},H.prototype.pointerUp=function(c){this.stateChanged()},H.prototype.dispose=function(){},H.prototype.addMarkerVisualToContainer=function(c){this.container.childNodes.length>0?this.container.insertBefore(c,this.container.childNodes[0]):this.container.appendChild(c)},H.prototype.getState=function(){return{typeName:H.typeName,state:this.state,notes:this.notes}},H.prototype.restoreState=function(c){this._state=c.state,this.notes=c.notes},H.prototype.scale=function(c,E){},H.prototype.colorChanged=function(c){this.onColorChanged&&this.onColorChanged(c),this.stateChanged()},H.prototype.fillColorChanged=function(c){this.onFillColorChanged&&this.onFillColorChanged(c),this.stateChanged()},H.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var c=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),c.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(c)&&this.onStateChanged(this)}},H.typeName="MarkerBase",H}(),je=function(){function H(){this.findGripByVisual=this.findGripByVisual.bind(this)}return H.prototype.findGripByVisual=function(c){return this.topLeft.ownsTarget(c)?this.topLeft:this.topCenter.ownsTarget(c)?this.topCenter:this.topRight.ownsTarget(c)?this.topRight:this.centerLeft.ownsTarget(c)?this.centerLeft:this.centerRight.ownsTarget(c)?this.centerRight:this.bottomLeft.ownsTarget(c)?this.bottomLeft:this.bottomCenter.ownsTarget(c)?this.bottomCenter:this.bottomRight.ownsTarget(c)?this.bottomRight:void 0},H}(),at=function(){function H(){this.GRIP_SIZE=10,this.visual=ue.createGroup(),this.visual.appendChild(ue.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(ue.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return H.prototype.ownsTarget=function(c){return c===this.visual||c===this.visual.childNodes[0]||c===this.visual.childNodes[1]},H}(),Je=function(){function H(){}return H.toITransformMatrix=function(c){return{a:c.a,b:c.b,c:c.c,d:c.d,e:c.e,f:c.f}},H.toSVGMatrix=function(c,E){return c.a=E.a,c.b=E.b,c.c=E.c,c.d=E.d,c.e=E.e,c.f=E.f,c},H}(),Qe=function(H){function c(E,j,X){var G=H.call(this,E,j,X)||this;return G.left=0,G.top=0,G.width=0,G.height=0,G.defaultSize={x:50,y:20},G.offsetX=0,G.offsetY=0,G.rotationAngle=0,G.CB_DISTANCE=10,G._suppressMarkerCreateEvent=!1,G.container.transform.baseVal.appendItem(ue.createTransform()),G.setupControlBox(),G}return Re(c,H),Object.defineProperty(c.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"visual",{get:function(){return this._visual},set:function(E){this._visual=E;var j=ue.createTransform();this._visual.transform.baseVal.appendItem(j)},enumerable:!1,configurable:!0}),c.prototype.ownsTarget=function(E){return!!H.prototype.ownsTarget.call(this,E)||!!(this.controlGrips.findGripByVisual(E)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(E))},c.prototype.pointerDown=function(E,j){H.prototype.pointerDown.call(this,E,j),this.state==="new"&&(this.left=E.x,this.top=E.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var X=this.unrotatePoint(E);if(this.manipulationStartX=X.x,this.manipulationStartY=X.y,this.offsetX=X.x-this.left,this.offsetY=X.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(j),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(j)){this.activeGrip=this.rotatorGrip;var G=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=G.x-this.width/2,this.top=G.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var pe=this.container.transform.baseVal.getItem(0);pe.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(pe,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},c.prototype.pointerUp=function(E){var j=this.state;H.prototype.pointerUp.call(this,E),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(E),this._state="select",j==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},c.prototype.moveVisual=function(E){this.visual.style.transform="translate("+E.x+"px, "+E.y+"px)"},c.prototype.manipulate=function(E){var j=this.unrotatePoint(E);this.state==="creating"?this.resize(E):this.state==="move"?(this.left=this.manipulationStartLeft+(j.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(j.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(j):this.state==="rotate"&&this.rotate(E)},c.prototype.resize=function(E){var j=this.manipulationStartLeft,X=this.manipulationStartWidth,G=this.manipulationStartTop,pe=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:j=this.manipulationStartLeft+E.x-this.manipulationStartX,X=this.manipulationStartWidth+this.manipulationStartLeft-j;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:X=this.manipulationStartWidth+E.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:G=this.manipulationStartTop+E.y-this.manipulationStartY,pe=this.manipulationStartHeight+this.manipulationStartTop-G;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:pe=this.manipulationStartHeight+E.y-this.manipulationStartY}X>=0?(this.left=j,this.width=X):(this.left=j+X,this.width=-X),pe>=0?(this.top=G,this.height=pe):(this.top=G+pe,this.height=-pe),this.setSize()},c.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},c.prototype.rotate=function(E){if(Math.abs(E.x-this.centerX)>.1){var j=Math.sign(E.x-this.centerX);this.rotationAngle=180*Math.atan((E.y-this.centerY)/(E.x-this.centerX))/Math.PI+90*j,this.applyRotation()}},c.prototype.applyRotation=function(){var E=this.container.transform.baseVal.getItem(0);E.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(E,0)},c.prototype.rotatePoint=function(E){if(this.rotationAngle===0)return E;var j=this.container.getCTM(),X=ue.createPoint(E.x,E.y);return{x:(X=X.matrixTransform(j)).x,y:X.y}},c.prototype.unrotatePoint=function(E){if(this.rotationAngle===0)return E;var j=this.container.getCTM();j=j.inverse();var X=ue.createPoint(E.x,E.y);return{x:(X=X.matrixTransform(j)).x,y:X.y}},c.prototype.select=function(){H.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},c.prototype.deselect=function(){H.prototype.deselect.call(this),this.controlBox.style.display="none"},c.prototype.setupControlBox=function(){this.controlBox=ue.createGroup();var E=ue.createTransform();E.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(E),this.container.appendChild(this.controlBox),this.controlRect=ue.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=ue.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 je,this.addControlGrips(),this.controlBox.style.display="none"},c.prototype.adjustControlBox=function(){var E=this.controlBox.transform.baseVal.getItem(0);E.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(E,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},c.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},c.prototype.createGrip=function(){var E=new at;return E.visual.transform.baseVal.appendItem(ue.createTransform()),this.controlBox.appendChild(E.visual),E},c.prototype.positionGrips=function(){var E=this.controlGrips.topLeft.GRIP_SIZE,j=-E/2,X=j,G=(this.width+this.CB_DISTANCE)/2-E/2,pe=(this.height+this.CB_DISTANCE)/2-E/2,We=this.height+this.CB_DISTANCE-E/2,nt=this.width+this.CB_DISTANCE-E/2;this.positionGrip(this.controlGrips.topLeft.visual,j,X),this.positionGrip(this.controlGrips.topCenter.visual,G,X),this.positionGrip(this.controlGrips.topRight.visual,nt,X),this.positionGrip(this.controlGrips.centerLeft.visual,j,pe),this.positionGrip(this.controlGrips.centerRight.visual,nt,pe),this.positionGrip(this.controlGrips.bottomLeft.visual,j,We),this.positionGrip(this.controlGrips.bottomCenter.visual,G,We),this.positionGrip(this.controlGrips.bottomRight.visual,nt,We),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,G,X-3*this.CB_DISTANCE)},c.prototype.positionGrip=function(E,j,X){var G=E.transform.baseVal.getItem(0);G.setTranslate(j,X),E.transform.baseVal.replaceItem(G,0)},c.prototype.hideControlBox=function(){this.controlBox.style.display="none"},c.prototype.showControlBox=function(){this.controlBox.style.display=""},c.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:Je.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:Je.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},H.prototype.getState.call(this))},c.prototype.restoreState=function(E){H.prototype.restoreState.call(this,E);var j=E;this.left=j.left,this.top=j.top,this.width=j.width,this.height=j.height,this.rotationAngle=j.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(Je.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,j.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(Je.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,j.containerTransformMatrix))},c.prototype.scale=function(E,j){H.prototype.scale.call(this,E,j);var X=this.rotatePoint({x:this.left,y:this.top}),G=this.unrotatePoint({x:X.x*E,y:X.y*j});this.left=G.x,this.top=G.y,this.width=this.width*E,this.height=this.height*j,this.adjustControlBox()},c}(Ue),Ve=function(H){function c(E,j,X){var G=H.call(this,E,j,X)||this;return G.fillColor="transparent",G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.opacity=1,G.setStrokeColor=G.setStrokeColor.bind(G),G.setFillColor=G.setFillColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.createVisual=G.createVisual.bind(G),G}return Re(c,H),c.prototype.ownsTarget=function(E){return!(!H.prototype.ownsTarget.call(this,E)&&E!==this.visual)},c.prototype.createVisual=function(){this.visual=ue.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},c.prototype.pointerDown=function(E,j){H.prototype.pointerDown.call(this,E,j),this.state==="new"&&(this.createVisual(),this.moveVisual(E),this._state="creating")},c.prototype.manipulate=function(E){H.prototype.manipulate.call(this,E)},c.prototype.resize=function(E){H.prototype.resize.call(this,E),this.setSize()},c.prototype.setSize=function(){H.prototype.setSize.call(this),ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},c.prototype.pointerUp=function(E){H.prototype.pointerUp.call(this,E),this.setSize()},c.prototype.setStrokeColor=function(E){this.strokeColor=E,this.visual&&ue.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(E),this.stateChanged()},c.prototype.setFillColor=function(E){this.fillColor=E,this.visual&&ue.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},c.prototype.setStrokeWidth=function(E){this.strokeWidth=E,this.visual&&ue.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},c.prototype.setStrokeDasharray=function(E){this.strokeDasharray=E,this.visual&&ue.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},c.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},H.prototype.getState.call(this))},c.prototype.restoreState=function(E){var j=E;this.fillColor=j.fillColor,this.strokeColor=j.strokeColor,this.strokeWidth=j.strokeWidth,this.strokeDasharray=j.strokeDasharray,this.opacity=j.opacity,this.createVisual(),H.prototype.restoreState.call(this,E),this.setSize()},c.prototype.scale=function(E,j){H.prototype.scale.call(this,E,j),this.setSize()},c.title="Rectangle marker",c}(Qe),ht=function(H){function c(E,j,X,G){var pe=H.call(this,E,G||'')||this;return pe.widths=[],pe.widthBoxes=[],pe.widths=j,pe.currentWidth=X,pe.setCurrentWidth=pe.setCurrentWidth.bind(pe),pe}return Re(c,H),c.prototype.getUi=function(){var E=this,j=document.createElement("div");return j.style.display="flex",j.style.overflow="hidden",j.style.flexGrow="2",this.widths.forEach(function(X){var G=document.createElement("div");G.style.display="flex",G.style.flexGrow="2",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.borderColor=X===E.currentWidth?E.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){E.setCurrentWidth(X,G)}),j.appendChild(G);var pe=document.createElement("div");pe.innerText=X.toString(),pe.style.marginRight="5px",G.appendChild(pe);var We=document.createElement("div");We.style.minHeight="20px",We.style.flexGrow="2",We.style.display="flex",We.style.alignItems="center";var nt=document.createElement("hr");nt.style.minWidth="20px",nt.style.border="0px",nt.style.borderTop=X+"px solid "+E.uiStyleSettings.toolboxColor,nt.style.flexGrow="2",We.appendChild(nt),G.appendChild(We),E.widthBoxes.push(G)}),j},c.prototype.setCurrentWidth=function(E,j){var X=this;this.currentWidth=E,this.widthBoxes.forEach(function(G){G.style.borderColor=G===j?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},c}(Pe),it=function(H){function c(E,j,X,G){var pe=H.call(this,E,G||'')||this;return pe.styles=[],pe.styleBoxes=[],pe.styles=j,pe.currentStyle=X,pe.setCurrentStyle=pe.setCurrentStyle.bind(pe),pe}return Re(c,H),c.prototype.getUi=function(){var E=this,j=document.createElement("div");return j.style.display="flex",j.style.overflow="hidden",j.style.flexGrow="2",this.styles.forEach(function(X){var G=document.createElement("div");G.style.display="flex",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.overflow="hidden",G.style.maxWidth=100/E.styles.length-5+"%",G.style.borderColor=X===E.currentStyle?E.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){E.setCurrentStyle(X,G)}),j.appendChild(G);var pe=document.createElement("div");pe.style.minHeight="20px",pe.style.flexGrow="2",pe.style.overflow="hidden";var We=` `;pe.innerHTML=We,G.appendChild(pe),E.styleBoxes.push(G)}),j},c.prototype.setCurrentStyle=function(E,j){var X=this;this.currentStyle=E,this.styleBoxes.forEach(function(G){G.style.borderColor=G===j?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},c}(Pe),rt=function(H){function c(E,j,X){var G=H.call(this,E,j,X)||this;return G.strokeColor=X.defaultColor,G.strokeWidth=X.defaultStrokeWidth,G.strokeDasharray=X.defaultStrokeDasharray,G.strokePanel=new _e("Line color",X.defaultColorSet,X.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new ht("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new it("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return Re(c,H),Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var E=H.prototype.getState.call(this);return E.typeName=c.typeName,E},c.typeName="FrameMarker",c.title="Frame marker",c.icon='',c}(Ve),Le=function(){this.defaultColorSet=["#EF4444","#10B981","#2563EB","#FFFF00","#7C3AED","#F472B6","#000000","#FFFFFF"],this.defaultColor=this.defaultColorSet[0],this.defaultFillColor=this.defaultColorSet[0],this.defaultStrokeColor=this.defaultColorSet[7],this.defaultHighlightColor=this.defaultColorSet[3],this.defaultStrokeWidth=3,this.defaultStrokeDasharray="",this.defaultHighlightOpacity=.5,this.defaultFontFamily="Helvetica, Arial, sans-serif",this.defaultStrokeWidths=[1,2,3,5,10],this.defaultStrokeDasharrays=["","3","12 3","9 6 3 6"],this.defaultOpacitySteps=[.1,.25,.5,.75,1],this.displayMode="inline",this.defaultFontFamilies=['Times, "Times New Roman", serif',"Helvetica, Arial, sans-serif",'Courier, "Courier New", monospace',"cursive","fantasy"],this.popupMargin=30,this.newFreehandMarkerOnPointerUp=!1,this.defaultColorsFollowCurrentColors=!1,this.freehandPixelRatio=1,this.disableRotation=!1},Xe=function(H){function c(E,j,X){var G=H.call(this,E,j,X)||this;return G.x1=0,G.y1=0,G.x2=0,G.y2=0,G.defaultLength=50,G.manipulationStartX=0,G.manipulationStartY=0,G.manipulationStartX1=0,G.manipulationStartY1=0,G.manipulationStartX2=0,G.manipulationStartY2=0,G.setupControlBox(),G}return Re(c,H),c.prototype.ownsTarget=function(E){return!!H.prototype.ownsTarget.call(this,E)||!(!this.grip1.ownsTarget(E)&&!this.grip2.ownsTarget(E))},c.prototype.pointerDown=function(E,j){H.prototype.pointerDown.call(this,E,j),this.manipulationStartX=E.x,this.manipulationStartY=E.y,this.state==="new"&&(this.x1=E.x,this.y1=E.y,this.x2=E.x,this.y2=E.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(j)?this.activeGrip=this.grip1:this.grip2.ownsTarget(j)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},c.prototype.pointerUp=function(E){var j=this.state;H.prototype.pointerUp.call(this,E),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(E),this._state="select",j==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},c.prototype.adjustVisual=function(){},c.prototype.manipulate=function(E){this.state==="creating"?this.resize(E):this.state==="move"?(this.x1=this.manipulationStartX1+E.x-this.manipulationStartX,this.y1=this.manipulationStartY1+E.y-this.manipulationStartY,this.x2=this.manipulationStartX2+E.x-this.manipulationStartX,this.y2=this.manipulationStartY2+E.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(E)},c.prototype.resize=function(E){switch(this.activeGrip){case this.grip1:this.x1=E.x,this.y1=E.y;break;case this.grip2:case void 0:this.x2=E.x,this.y2=E.y}this.adjustVisual(),this.adjustControlBox()},c.prototype.select=function(){H.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},c.prototype.deselect=function(){H.prototype.deselect.call(this),this.controlBox.style.display="none"},c.prototype.setupControlBox=function(){this.controlBox=ue.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},c.prototype.adjustControlBox=function(){this.positionGrips()},c.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},c.prototype.createGrip=function(){var E=new at;return E.visual.transform.baseVal.appendItem(ue.createTransform()),this.controlBox.appendChild(E.visual),E},c.prototype.positionGrips=function(){var E=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-E/2,this.y1-E/2),this.positionGrip(this.grip2.visual,this.x2-E/2,this.y2-E/2)},c.prototype.positionGrip=function(E,j,X){var G=E.transform.baseVal.getItem(0);G.setTranslate(j,X),E.transform.baseVal.replaceItem(G,0)},c.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},H.prototype.getState.call(this))},c.prototype.restoreState=function(E){H.prototype.restoreState.call(this,E);var j=E;this.x1=j.x1,this.y1=j.y1,this.x2=j.x2,this.y2=j.y2},c.prototype.scale=function(E,j){H.prototype.scale.call(this,E,j),this.x1=this.x1*E,this.y1=this.y1*j,this.x2=this.x2*E,this.y2=this.y2*j,this.adjustVisual(),this.adjustControlBox()},c}(Ue),lt=function(H){function c(E,j,X){var G=H.call(this,E,j,X)||this;return G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.setStrokeColor=G.setStrokeColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.strokeColor=X.defaultColor,G.strokeWidth=X.defaultStrokeWidth,G.strokeDasharray=X.defaultStrokeDasharray,G.strokePanel=new _e("Line color",X.defaultColorSet,X.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new ht("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new it("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return Re(c,H),c.prototype.ownsTarget=function(E){return!(!H.prototype.ownsTarget.call(this,E)&&E!==this.visual&&E!==this.selectorLine&&E!==this.visibleLine)},c.prototype.createVisual=function(){this.visual=ue.createGroup(),this.selectorLine=ue.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=ue.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},c.prototype.pointerDown=function(E,j){H.prototype.pointerDown.call(this,E,j),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},c.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),ue.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),ue.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),ue.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},c.prototype.setStrokeColor=function(E){this.strokeColor=E,this.adjustVisual(),this.colorChanged(E)},c.prototype.setStrokeWidth=function(E){this.strokeWidth=E,this.adjustVisual()},c.prototype.setStrokeDasharray=function(E){this.strokeDasharray=E,this.adjustVisual(),this.stateChanged()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var E=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},H.prototype.getState.call(this));return E.typeName=c.typeName,E},c.prototype.restoreState=function(E){H.prototype.restoreState.call(this,E);var j=E;this.strokeColor=j.strokeColor,this.strokeWidth=j.strokeWidth,this.strokeDasharray=j.strokeDasharray,this.createVisual(),this.adjustVisual()},c.typeName="LineMarker",c.title="Line marker",c.icon='',c}(Xe),Oe=function(H){function c(E,j,X,G){var pe=H.call(this,E,G||'')||this;return pe.fonts=[],pe.fontBoxes=[],pe.fonts=j,pe.currentFont=X,pe.setCurrentFont=pe.setCurrentFont.bind(pe),pe}return Re(c,H),c.prototype.getUi=function(){var E=this,j=document.createElement("div");return j.style.overflow="hidden",j.style.flexGrow="2",this.fonts.forEach(function(X){var G=document.createElement("div");G.style.display="inline-block",G.style.alignItems="center",G.style.justifyContent="space-between",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.overflow="hidden",G.style.maxWidth=100/E.fonts.length-5+"%",G.style.borderColor=X===E.currentFont?E.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){E.setCurrentFont(X,G)}),j.appendChild(G);var pe=document.createElement("div");pe.style.display="flex",pe.style.minHeight="20px",pe.style.flexGrow="2",pe.style.fontFamily=X,pe.style.overflow="hidden";var We=document.createElement("div");We.style.whiteSpace="nowrap",We.style.overflow="hidden",We.style.textOverflow="ellipsis",We.innerHTML="The quick brown fox jumps over the lazy dog",pe.appendChild(We),G.appendChild(pe),E.fontBoxes.push(G)}),j},c.prototype.setCurrentFont=function(E,j){var X=this;this.currentFont=E,this.fontBoxes.forEach(function(G){G.style.borderColor=G===j?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},c}(Pe),He=function(H){function c(E,j,X){var G=H.call(this,E,j,X)||this;return G.color="transparent",G.padding=5,G.DEFAULT_TEXT="your text here",G.text=G.DEFAULT_TEXT,G.isMoved=!1,G.color=X.defaultColor,G.fontFamily=X.defaultFontFamily,G.defaultSize={x:100,y:30},G.setColor=G.setColor.bind(G),G.setFont=G.setFont.bind(G),G.renderText=G.renderText.bind(G),G.sizeText=G.sizeText.bind(G),G.textEditDivClicked=G.textEditDivClicked.bind(G),G.showTextEditor=G.showTextEditor.bind(G),G.setSize=G.setSize.bind(G),G.positionTextEditor=G.positionTextEditor.bind(G),G.colorPanel=new _e("Color",X.defaultColorSet,X.defaultColor),G.colorPanel.onColorChanged=G.setColor,G.fontFamilyPanel=new Oe("Font",X.defaultFontFamilies,X.defaultFontFamily),G.fontFamilyPanel.onFontChanged=G.setFont,G}return Re(c,H),c.prototype.ownsTarget=function(E){if(H.prototype.ownsTarget.call(this,E)||E===this.visual||E===this.textElement||E===this.bgRectangle)return!0;var j=!1;return this.textElement.childNodes.forEach(function(X){X===E&&(j=!0)}),j},c.prototype.createVisual=function(){this.visual=ue.createGroup(),this.bgRectangle=ue.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=ue.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(ue.createTransform()),this.textElement.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},c.prototype.pointerDown=function(E,j){H.prototype.pointerDown.call(this,E,j),this.isMoved=!1,this.pointerDownPoint=E,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(E),this._state="creating")},c.prototype.renderText=function(){var E=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(j){E.textElement.appendChild(ue.createTSpan(j.trim()===""?" ":j.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},c.prototype.getTextScale=function(){var E=this.textElement.getBBox(),j=1;if(E.width>0&&E.height>0){var X=(1*this.width-this.width*this.padding*2/100)/E.width,G=(1*this.height-this.height*this.padding*2/100)/E.height;j=Math.min(X,G)}return j},c.prototype.getTextPosition=function(E){var j=this.textElement.getBBox(),X=0,G=0;return j.width>0&&j.height>0&&(X=(this.width-j.width*E)/2,G=this.height/2-j.height*E/2),{x:X,y:G}},c.prototype.sizeText=function(){var E=this.textElement.getBBox(),j=this.getTextScale(),X=this.getTextPosition(j);X.y-=E.y*j,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+X.x+"px, "+X.y+"px) scale("+j+", "+j+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(X.x,X.y),this.textElement.transform.baseVal.getItem(1).setScale(j,j))},c.prototype.manipulate=function(E){H.prototype.manipulate.call(this,E),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(E.x-this.pointerDownPoint.x)>5||Math.abs(E.y-this.pointerDownPoint.y)>5)},c.prototype.resize=function(E){H.prototype.resize.call(this,E),this.isMoved=!0,this.setSize(),this.sizeText()},c.prototype.setSize=function(){H.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},c.prototype.pointerUp=function(E){var j=this.state;j==="creating"&&(this._suppressMarkerCreateEvent=!0),H.prototype.pointerUp.call(this,E),this.setSize(),(j==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},c.prototype.showTextEditor=function(){var E=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(j){j.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var j=Number.parseFloat(E.textEditor.style.fontSize);E.textEditor.clientWidth>=Number.parseInt(E.textEditor.style.maxWidth)&&j>.9;)j-=.1,E.textEditor.style.fontSize=Math.max(j,.9)+"em"}),this.textEditor.addEventListener("keyup",function(j){j.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(j){if(j.clipboardData){var X=j.clipboardData.getData("text"),G=window.getSelection();if(!G.rangeCount)return!1;G.deleteFromDocument(),G.getRangeAt(0).insertNode(document.createTextNode(X)),j.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){E.textEditDivClicked(E.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},c.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var E=this.getTextScale(),j=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),X=this.textElement.getBBox(),G={x:X.width*E,y:X.height*E};j.x-=G.x/2,j.y-=G.y/2,this.textEditor.style.top=j.y+"px",this.textEditor.style.left=j.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-j.x+"px",this.textEditor.style.fontSize=Math.max(16*E,12)+"px",this.textElement.style.display="none"}},c.prototype.textEditDivClicked=function(E){this.text=E.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},c.prototype.select=function(){H.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},c.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),H.prototype.deselect.call(this)},c.prototype.dblClick=function(E,j){H.prototype.dblClick.call(this,E,j),this.showTextEditor()},c.prototype.setColor=function(E){this.textElement&&ue.setAttributes(this.textElement,[["fill",E]]),this.color=E,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(E)},c.prototype.setFont=function(E){this.textElement&&ue.setAttributes(this.textElement,[["font-family",E]]),this.fontFamily=E,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},c.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},c.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var E=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},H.prototype.getState.call(this));return E.typeName=c.typeName,E},c.prototype.restoreState=function(E){var j=E;this.color=j.color,this.fontFamily=j.fontFamily,this.padding=j.padding,this.text=j.text,this.createVisual(),H.prototype.restoreState.call(this,E),this.setSize()},c.prototype.scale=function(E,j){H.prototype.scale.call(this,E,j),this.setSize(),this.sizeText(),this.positionTextEditor()},c.typeName="TextMarker",c.title="Text marker",c.icon='',c}(Qe),ye=function(H){function c(E,j,X){var G=H.call(this,E,j,X)||this;return G.color="transparent",G.lineWidth=3,G.drawing=!1,G.pixelRatio=1,G.color=X.defaultColor,G.lineWidth=X.defaultStrokeWidth,G.pixelRatio=X.freehandPixelRatio,G.setColor=G.setColor.bind(G),G.addCanvas=G.addCanvas.bind(G),G.finishCreation=G.finishCreation.bind(G),G.setLineWidth=G.setLineWidth.bind(G),G.colorPanel=new _e("Color",X.defaultColorSet,X.defaultColor),G.colorPanel.onColorChanged=G.setColor,G.lineWidthPanel=new ht("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),G.lineWidthPanel.onWidthChanged=G.setLineWidth,G}return Re(c,H),c.prototype.ownsTarget=function(E){return!(!H.prototype.ownsTarget.call(this,E)&&E!==this.visual&&E!==this.drawingImage)},c.prototype.createVisual=function(){this.visual=ue.createGroup(),this.drawingImage=ue.createImage(),this.visual.appendChild(this.drawingImage);var E=ue.createTransform();this.visual.transform.baseVal.appendItem(E),this.addMarkerVisualToContainer(this.visual)},c.prototype.pointerDown=function(E,j){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(E.x,E.y),this.drawing=!0):H.prototype.pointerDown.call(this,E,j)},c.prototype.manipulate=function(E){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(E.x,E.y),this.canvasContext.stroke()):H.prototype.manipulate.call(this,E)},c.prototype.resize=function(E){H.prototype.resize.call(this,E),ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},c.prototype.pointerUp=function(E){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):H.prototype.pointerUp.call(this,E)},c.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},c.prototype.select=function(){this.state==="creating"&&this.finishCreation(),H.prototype.select.call(this)},c.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),H.prototype.deselect.call(this)},c.prototype.finishCreation=function(){for(var E=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),j=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],X=j[0],G=j[1],pe=j[2],We=j[3],nt=!1,gt=0;gt0&&(nt=!0,gtWe&&(We=gt),Ge>pe&&(pe=Ge));if(nt){this.left=X/this.pixelRatio,this.top=G/this.pixelRatio,this.width=(pe-X)/this.pixelRatio,this.height=(We-G)/this.pixelRatio;var Dt=document.createElement("canvas");Dt.width=pe-X,Dt.height=We-G,Dt.getContext("2d").putImageData(this.canvasContext.getImageData(X,G,pe-X,We-G),0,0),this.drawingImgUrl=Dt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},c.prototype.setDrawingImage=function(){ue.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},c.prototype.setColor=function(E){this.color=E,this.colorChanged(E)},c.prototype.setLineWidth=function(E){this.lineWidth=E},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var E=Object.assign({drawingImgUrl:this.drawingImgUrl},H.prototype.getState.call(this));return E.typeName=c.typeName,E},c.prototype.restoreState=function(E){this.createVisual(),H.prototype.restoreState.call(this,E),this.drawingImgUrl=E.drawingImgUrl,this.setDrawingImage()},c.prototype.scale=function(E,j){H.prototype.scale.call(this,E,j),this.setDrawingImage()},c.typeName="FreehandMarker",c.title="Freehand marker",c.icon='',c}(Qe),ce=function(H){function c(E,j,X){var G=H.call(this,E,X||'')||this;return G.typeBoxes=[],G.currentType=j,G.setCurrentType=G.setCurrentType.bind(G),G}return Re(c,H),c.prototype.getUi=function(){var E=this,j=document.createElement("div");j.style.display="flex",j.style.overflow="hidden",j.style.flexGrow="2";for(var X=function(We){var nt="both";switch(We){case 0:nt="both";break;case 1:nt="start";break;case 2:nt="end";break;case 3:nt="none"}var gt=document.createElement("div");if(gt.style.display="flex",gt.style.flexGrow="2",gt.style.alignItems="center",gt.style.justifyContent="space-between",gt.style.padding="5px",gt.style.borderWidth="2px",gt.style.borderStyle="solid",gt.style.borderColor=nt===G.currentType?G.uiStyleSettings.toolboxAccentColor:"transparent",gt.addEventListener("click",function(){E.setCurrentType(nt,gt)}),j.appendChild(gt),nt==="both"||nt==="start"){var Ge=document.createElement("div");Ge.style.display="flex",Ge.style.alignItems="center",Ge.style.minHeight="20px",Ge.innerHTML=` `,Ge.style.marginLeft="5px",gt.appendChild(Ge)}var Dt=document.createElement("div");Dt.style.display="flex",Dt.style.alignItems="center",Dt.style.minHeight="20px",Dt.style.flexGrow="2";var Ut=document.createElement("hr");if(Ut.style.minWidth="20px",Ut.style.border="0px",Ut.style.borderTop="3px solid "+(G.uiStyleSettings!==void 0?G.uiStyleSettings.toolboxColor:"#eeeeee"),Ut.style.flexGrow="2",Dt.appendChild(Ut),gt.appendChild(Dt),nt==="both"||nt==="end"){var rr=document.createElement("div");rr.style.display="flex",rr.style.alignItems="center",rr.style.minHeight="20px",rr.innerHTML=` `,rr.style.marginRight="5px",gt.appendChild(rr)}G.typeBoxes.push(gt)},G=this,pe=0;pe<4;pe++)X(pe);return j},c.prototype.setCurrentType=function(E,j){var X=this;this.currentType=E,this.typeBoxes.forEach(function(G){G.style.borderColor=G===j?X.uiStyleSettings!==void 0?X.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},c}(Pe),me=function(H){function c(E,j,X){var G=H.call(this,E,j,X)||this;return G.arrowType="end",G.arrowBaseHeight=10,G.arrowBaseWidth=10,G.getArrowPoints=G.getArrowPoints.bind(G),G.setArrowType=G.setArrowType.bind(G),G.arrowTypePanel=new ce("Arrow type","end"),G.arrowTypePanel.onArrowTypeChanged=G.setArrowType,G}return Re(c,H),c.prototype.ownsTarget=function(E){return!(!H.prototype.ownsTarget.call(this,E)&&E!==this.arrow1&&E!==this.arrow2)},c.prototype.getArrowPoints=function(E,j){var X=this.arrowBaseWidth+2*this.strokeWidth,G=this.arrowBaseHeight+2*this.strokeWidth;return E-X/2+","+(j+G/2)+" "+E+","+(j-G/2)+" "+(E+X/2)+","+(j+G/2)},c.prototype.createTips=function(){this.arrow1=ue.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=ue.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.arrow2)},c.prototype.pointerDown=function(E,j){H.prototype.pointerDown.call(this,E,j),this.state==="creating"&&this.createTips()},c.prototype.adjustVisual=function(){if(H.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",ue.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),ue.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var E=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),j=this.arrow1.transform.baseVal.getItem(0);j.setRotate(E,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(j,0);var X=this.arrow2.transform.baseVal.getItem(0);X.setRotate(E+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(X,0)}},c.prototype.setArrowType=function(E){this.arrowType=E,this.adjustVisual(),this.stateChanged()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var E=Object.assign({arrowType:this.arrowType},H.prototype.getState.call(this));return E.typeName=c.typeName,E},c.prototype.restoreState=function(E){H.prototype.restoreState.call(this,E);var j=E;this.arrowType=j.arrowType,this.createTips(),this.adjustVisual()},c.typeName="ArrowMarker",c.title="Arrow marker",c.icon='',c}(lt),te=function(H){function c(E,j,X){var G=H.call(this,E,j,X)||this;return G.fillColor=X.defaultFillColor,G.strokeWidth=0,G.fillPanel=new _e("Color",X.defaultColorSet,X.defaultFillColor),G.fillPanel.onColorChanged=G.setFillColor,G}return Re(c,H),Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var E=H.prototype.getState.call(this);return E.typeName=c.typeName,E},c.typeName="CoverMarker",c.title="Cover marker",c.icon='',c}(Ve),re=function(H){function c(E,j,X,G){var pe=H.call(this,E,G||'')||this;return pe.opacities=[],pe.opacityBoxes=[],pe.opacities=j,pe.currentOpacity=X,pe.setCurrentOpacity=pe.setCurrentOpacity.bind(pe),pe}return Re(c,H),c.prototype.getUi=function(){var E=this,j=document.createElement("div");return j.style.display="flex",j.style.overflow="hidden",j.style.flexGrow="2",j.style.justifyContent="space-between",this.opacities.forEach(function(X){var G=document.createElement("div");G.style.display="flex",G.style.alignItems="center",G.style.justifyContent="center",G.style.padding="5px",G.style.borderWidth="2px",G.style.borderStyle="solid",G.style.borderColor=X===E.currentOpacity?E.uiStyleSettings.toolboxAccentColor:"transparent",G.addEventListener("click",function(){E.setCurrentOpacity(X,G)}),j.appendChild(G);var pe=document.createElement("div");pe.innerText=100*X+"%",G.appendChild(pe),E.opacityBoxes.push(G)}),j},c.prototype.setCurrentOpacity=function(E,j){var X=this;this.currentOpacity=E,this.opacityBoxes.forEach(function(G){G.style.borderColor=G===j?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},c}(Pe),oe=function(H){function c(E,j,X){var G=H.call(this,E,j,X)||this;return G.setOpacity=G.setOpacity.bind(G),G.fillColor=X.defaultHighlightColor,G.strokeWidth=0,G.opacity=X.defaultHighlightOpacity,G.fillPanel=new _e("Color",X.defaultColorSet,G.fillColor),G.fillPanel.onColorChanged=G.setFillColor,G.opacityPanel=new re("Opacity",X.defaultOpacitySteps,G.opacity),G.opacityPanel.onOpacityChanged=G.setOpacity,G}return Re(c,H),c.prototype.setOpacity=function(E){this.opacity=E,this.visual&&ue.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var E=H.prototype.getState.call(this);return E.typeName=c.typeName,E},c.typeName="HighlightMarker",c.title="Highlight marker",c.icon='',c}(te),he='',Te=function(H){function c(E,j,X){var G=H.call(this,E,j,X)||this;return G.bgColor="transparent",G.tipPosition={x:0,y:0},G.tipBase1Position={x:0,y:0},G.tipBase2Position={x:0,y:0},G.tipMoving=!1,G.color=X.defaultStrokeColor,G.bgColor=X.defaultFillColor,G.fontFamily=X.defaultFontFamily,G.defaultSize={x:100,y:30},G.setBgColor=G.setBgColor.bind(G),G.getTipPoints=G.getTipPoints.bind(G),G.positionTip=G.positionTip.bind(G),G.setTipPoints=G.setTipPoints.bind(G),G.colorPanel=new _e("Text color",X.defaultColorSet,G.color,''),G.colorPanel.onColorChanged=G.setColor,G.bgColorPanel=new _e("Fill color",X.defaultColorSet,G.bgColor,he),G.bgColorPanel.onColorChanged=G.setBgColor,G.fontFamilyPanel=new Oe("Font",X.defaultFontFamilies,X.defaultFontFamily),G.fontFamilyPanel.onFontChanged=G.setFont,G.tipGrip=new at,G.tipGrip.visual.transform.baseVal.appendItem(ue.createTransform()),G.controlBox.appendChild(G.tipGrip.visual),G}return Re(c,H),c.prototype.ownsTarget=function(E){return H.prototype.ownsTarget.call(this,E)||this.tipGrip.ownsTarget(E)||this.tip===E},c.prototype.createTip=function(){ue.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=ue.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},c.prototype.pointerDown=function(E,j){this.state==="new"&&H.prototype.pointerDown.call(this,E,j),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(j)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):H.prototype.pointerDown.call(this,E,j)},c.prototype.pointerUp=function(E){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,H.prototype.pointerUp.call(this,E);else{var j=this.state==="creating";H.prototype.pointerUp.call(this,E),this.setTipPoints(j),this.positionTip()}},c.prototype.manipulate=function(E){if(this.tipMoving){var j=this.unrotatePoint(E);this.tipPosition={x:j.x-this.manipulationStartLeft,y:j.y-this.manipulationStartTop},this.positionTip()}else H.prototype.manipulate.call(this,E)},c.prototype.setBgColor=function(E){this.bgRectangle&&this.tip&&(ue.setAttributes(this.bgRectangle,[["fill",E]]),ue.setAttributes(this.tip,[["fill",E]])),this.bgColor=E,this.fillColorChanged(E)},c.prototype.getTipPoints=function(){return this.setTipPoints(this.state==="creating"),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},c.prototype.setTipPoints=function(E){E===void 0&&(E=!1);var j=Math.min(this.height/2,15),X=this.height/5;E&&(this.tipPosition={x:j+X/2,y:this.height+20});var G=Math.atan(this.height/2/(this.width/2));this.tipPosition.x=this.width/2&&this.tipPosition.y=this.width/2&&this.tipPosition.y>=this.height/2?G.1)){var E=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),j=this.tip1.transform.baseVal.getItem(0);j.setRotate(E,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(j,0);var X=this.tip2.transform.baseVal.getItem(0);X.setRotate(E+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(X,0)}},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var E=H.prototype.getState.call(this);return E.typeName=c.typeName,E},c.prototype.restoreState=function(E){H.prototype.restoreState.call(this,E),this.createTips(),this.adjustVisual()},c.typeName="MeasurementMarker",c.title="Measurement marker",c.icon='',c}(lt),Ye=function(H){function c(E,j,X){var G=H.call(this,E,j,X)||this;return G.strokePanel.colors=X.defaultColorSet,G.fillColor="transparent",G}return Re(c,H),Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var E=H.prototype.getState.call(this);return E.typeName=c.typeName,E},c.typeName="EllipseFrameMarker",c.title="Ellipse frame marker",c.icon='',c}(xe),ut=function(){function H(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(H.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),H.prototype.addUndoStep=function(c){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(c)||(this.undoStack.push(c),JSON.stringify(this.lastRedoStep)!==JSON.stringify(c)&&this.redoStack.splice(0,this.redoStack.length))},H.prototype.replaceLastUndoStep=function(c){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=c)},H.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},H.prototype.undo=function(){if(this.undoStack.length>1){var c=this.undoStack.pop();return c!==void 0&&this.redoStack.push(c),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},H.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},H}(),qe=function(H){function c(E,j,X){var G=H.call(this,E,j,X)||this;return G.strokeColor="transparent",G.strokeWidth=0,G.strokeDasharray="",G.curveX=0,G.curveY=0,G.manipulationStartCurveX=0,G.manipulationStartCurveY=0,G.setStrokeColor=G.setStrokeColor.bind(G),G.setStrokeWidth=G.setStrokeWidth.bind(G),G.setStrokeDasharray=G.setStrokeDasharray.bind(G),G.positionGrips=G.positionGrips.bind(G),G.addControlGrips=G.addControlGrips.bind(G),G.adjustVisual=G.adjustVisual.bind(G),G.setupControlBox=G.setupControlBox.bind(G),G.resize=G.resize.bind(G),G.strokeColor=X.defaultColor,G.strokeWidth=X.defaultStrokeWidth,G.strokeDasharray=X.defaultStrokeDasharray,G.strokePanel=new _e("Line color",X.defaultColorSet,X.defaultColor),G.strokePanel.onColorChanged=G.setStrokeColor,G.strokeWidthPanel=new ht("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),G.strokeWidthPanel.onWidthChanged=G.setStrokeWidth,G.strokeStylePanel=new it("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),G.strokeStylePanel.onStyleChanged=G.setStrokeDasharray,G}return Re(c,H),c.prototype.ownsTarget=function(E){return!(!H.prototype.ownsTarget.call(this,E)&&E!==this.visual&&E!==this.selectorCurve&&E!==this.visibleCurve&&!this.curveGrip.ownsTarget(E))},c.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},c.prototype.createVisual=function(){this.visual=ue.createGroup(),this.selectorCurve=ue.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=ue.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},c.prototype.pointerDown=function(E,j){H.prototype.pointerDown.call(this,E,j),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=E.x,this.curveY=E.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(j)&&(this.activeGrip=this.curveGrip,this._state="resize")},c.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),ue.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),ue.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),ue.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},c.prototype.setupControlBox=function(){H.prototype.setupControlBox.call(this),this.curveControlLine1=ue.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=ue.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},c.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,H.prototype.addControlGrips.call(this)},c.prototype.positionGrips=function(){H.prototype.positionGrips.call(this);var E=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-E/2,this.curveY-E/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},c.prototype.manipulate=function(E){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+E.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+E.y-this.manipulationStartY),H.prototype.manipulate.call(this,E)},c.prototype.resize=function(E){this.activeGrip===this.curveGrip&&(this.curveX=E.x,this.curveY=E.y),H.prototype.resize.call(this,E),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},c.prototype.setStrokeColor=function(E){this.strokeColor=E,this.adjustVisual(),this.colorChanged(E)},c.prototype.setStrokeWidth=function(E){this.strokeWidth=E,this.adjustVisual()},c.prototype.setStrokeDasharray=function(E){this.strokeDasharray=E,this.adjustVisual()},c.prototype.scale=function(E,j){this.curveX=this.curveX*E,this.curveY=this.curveY*j,H.prototype.scale.call(this,E,j)},Object.defineProperty(c.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),c.prototype.getState=function(){var E=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},H.prototype.getState.call(this));return E.typeName=c.typeName,E},c.prototype.restoreState=function(E){H.prototype.restoreState.call(this,E);var j=E;this.strokeColor=j.strokeColor,this.strokeWidth=j.strokeWidth,this.strokeDasharray=j.strokeDasharray,this.curveX=j.curveX,this.curveY=j.curveY,this.createVisual(),this.adjustVisual()},c.typeName="CurveMarker",c.title="Curve marker",c.icon='',c}(Xe),yt=function(){function H(c,E){E===void 0&&(E=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=c,this.cancelable=E}return Object.defineProperty(H.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),H.prototype.preventDefault=function(){this._defaultPrevented=!0},H}(),xt=function(H){function c(E,j,X){var G=H.call(this,E,!1)||this;return G.dataUrl=j,G.state=X,G}return Re(c,H),c}(yt),et=function(H){function c(E,j,X){X===void 0&&(X=!1);var G=H.call(this,E,X)||this;return G.marker=j,G}return Re(c,H),c}(yt),Wt=function(){function H(){this.render=[],this.beforeclose=[],this.close=[],this.show=[],this.restorestate=[],this.statechange=[],this.markerselect=[],this.markerdeselect=[],this.markercreating=[],this.markercreate=[],this.markerbeforedelete=[],this.markerdelete=[],this.markerchange=[],this.focus=[],this.blur=[]}return H.prototype.addEventListener=function(c,E){this[c].push(E)},H.prototype.removeEventListener=function(c,E){var j=this[c].indexOf(E);j>-1&&this[c].splice(j,1)},H}(),kt=function(){function H(c){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Le,this._isOpen=!1,this.undoRedoManager=new ut,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new Wt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=H.instanceCounter++,this.styles=new tt(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=c,this.targetRoot=document.body,this.width=c.clientWidth,this.height=c.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(H.prototype,"ALL_MARKER_TYPES",{get:function(){return[rt,ye,me,He,Ye,xe,oe,Te,Be,te,lt,qe]},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[rt,ye,me,He,xe,oe,Te]},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"BASIC_MARKER_TYPES",{get:function(){return[rt,ye,me,He,oe]},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(c){var E=this;this._availableMarkerTypes.splice(0),c.forEach(function(j){if(typeof j=="string"){var X=E.ALL_MARKER_TYPES.find(function(G){return G.typeName===j});X!==void 0&&E._availableMarkerTypes.push(X)}else E._availableMarkerTypes.push(j)})},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(c){this._zoomLevel=c,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),H.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),Me.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},H.prototype.show=function(){var c=this;this.styles.styleSheetRoot===void 0&&Ke.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=Ke.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(E){return E(new yt(c))})},H.prototype.render=function(){return ke(this,void 0,void 0,function(){var c;return De(this,function(E){switch(E.label){case 0:return this.setCurrentMarker(),(c=new $e).naturalSize=this.renderAtNaturalSize,c.imageType=this.renderImageType,c.imageQuality=this.renderImageQuality,c.markersOnly=this.renderMarkersOnly,c.width=this.renderWidth,c.height=this.renderHeight,[4,c.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return E.sent(),[4,c.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,E.sent()]}})})},H.prototype.close=function(c){var E=this;if(c===void 0&&(c=!1),this.isOpen){var j=!1;c||this.eventListeners.beforeclose.forEach(function(X){var G=new yt(E,!0);X(G),G.defaultPrevented&&(j=!0)}),j||(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(X){return X(new yt(E))}),this.detachEvents(),this._isOpen=!1)}},H.prototype.addMarkersToToolbar=function(){for(var c,E=[],j=0;jthis.editorCanvas.clientHeight?this.editorCanvas.clientHeight*c:this.editorCanvas.clientWidth,j=E',c.title="Powered by marker.js",c.style.display="grid",c.style.alignItems="center",c.style.justifyItems="center",c.style.padding="3px",c.style.width="20px",c.style.height="20px",this.logoUI.appendChild(c),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},H.prototype.positionLogo=function(){this.logoUI&&(this.uiStyleSettings.logoPosition!=="right"?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},H.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},H.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},H.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var c=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=c+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new ve(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-1&&this.markers.splice(this.markers.indexOf(c),1),c.dispose()},H.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),this._currentMarker!==void 0&&(this._currentMarker.state!=="new"?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},H.prototype.toolbarButtonClicked=function(c,E){if(c==="marker"&&E!==void 0)this.createNewMarker(E);else if(c==="action")switch(E){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},H.prototype.deleteSelectedMarker=function(){var c=this;if(this._currentMarker!==void 0){var E=!1;if(this.eventListeners.markerbeforedelete.forEach(function(X){var G=new et(c,c._currentMarker,!0);X(G),G.defaultPrevented&&(E=!0)}),!E){var j=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(X){return X(new et(c,j))})}}},H.prototype.clear=function(){var c=this,E=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(pe){var We=new et(c,void 0,!0);pe(We),We.defaultPrevented&&(E=!0)}),!E)){this.setCurrentMarker();for(var j=function(pe){var We=X.markers[pe];X.setCurrentMarker(X.markers[pe]),X._currentMarker.dispose(),X.markerImage.removeChild(X._currentMarker.container),X.markers.splice(X.markers.indexOf(X._currentMarker),1),X.eventListeners.markerdelete.forEach(function(nt){return nt(new et(c,We))})},X=this,G=this.markers.length-1;G>=0;G--)j(G);this.addUndoStep()}},Object.defineProperty(H.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),H.prototype.showNotesEditor=function(){var c;this._currentMarker!==void 0&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=(c=this._currentMarker.notes)!==null&&c!==void 0?c:"",this.overlayContainer.appendChild(this.notesArea))},H.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(this._currentMarker!==void 0&&(this._currentMarker.notes=this.notesArea.value.trim()!==""?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},H.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},H.prototype.addUndoStep=function(){var c=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var E=this.getState(),j=this.undoRedoManager.getLastUndoStep();if(!j||j.width===E.width&&j.height===E.height){var X=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(E),X1&&this.panTo({x:c.clientX,y:c.clientY}))},H.prototype.onPointerUp=function(c){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(c.clientX,c.clientY)),this.isDragging=!1,this.addUndoStep()},H.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},H.prototype.onKeyUp=function(c){this._currentMarker===void 0||this.notesArea!==void 0||c.key!=="Delete"&&c.key!=="Backspace"||this.deleteSelectedMarker()},H.prototype.clientToLocalCoordinates=function(c,E){var j=this.markerImage.getBoundingClientRect();return{x:(c-j.left)/this.zoomLevel,y:(E-j.top)/this.zoomLevel}},H.prototype.onWindowResize=function(){this.positionUI()},H.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var c=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=c+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},H.prototype.addLicenseKey=function(c){Me.addKey(c)},H.prototype.addEventListener=function(c,E){this.eventListeners.addEventListener(c,E)},H.prototype.removeEventListener=function(c,E){this.eventListeners.removeEventListener(c,E)},H.prototype.renderState=function(c){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(c),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(H.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),H.prototype.focus=function(){var c=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(E){return E(new yt(c))}))},H.prototype.blur=function(){var c=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(E){return E(new yt(c))}))},H.instanceCounter=0,H}();/* ********************************** cropro version 1.2.0 @license SEE LICENSE IN LICENSE copyright Alan Mendelevich see README and LICENSE for details ********************************** *//*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var Gt=function(H,c){return(Gt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,j){E.__proto__=j}||function(E,j){for(var X in j)Object.prototype.hasOwnProperty.call(j,X)&&(E[X]=j[X])})(H,c)};function Kt(H,c){if(typeof c!="function"&&c!==null)throw new TypeError("Class extends value "+String(c)+" is not a constructor or null");function E(){this.constructor=H}Gt(H,c),H.prototype=c===null?Object.create(c):(E.prototype=c.prototype,new E)}function Pt(H,c,E,j){return new(E||(E=Promise))(function(X,G){function pe(gt){try{nt(j.next(gt))}catch(Ge){G(Ge)}}function We(gt){try{nt(j.throw(gt))}catch(Ge){G(Ge)}}function nt(gt){var Ge;gt.done?X(gt.value):(Ge=gt.value,Ge instanceof E?Ge:new E(function(Dt){Dt(Ge)})).then(pe,We)}nt((j=j.apply(H,c||[])).next())})}function wr(H,c){var E,j,X,G,pe={label:0,sent:function(){if(1&X[0])throw X[1];return X[1]},trys:[],ops:[]};return G={next:We(0),throw:We(1),return:We(2)},typeof Symbol=="function"&&(G[Symbol.iterator]=function(){return this}),G;function We(nt){return function(gt){return function(Ge){if(E)throw new TypeError("Generator is already executing.");for(;pe;)try{if(E=1,j&&(X=2&Ge[0]?j.return:Ge[0]?j.throw||((X=j.return)&&X.call(j),0):j.next)&&!(X=X.call(j,Ge[1])).done)return X;switch(j=0,X&&(Ge=[2&Ge[0],X.value]),Ge[0]){case 0:case 1:X=Ge;break;case 4:return pe.label++,{value:Ge[1],done:!1};case 5:pe.label++,j=Ge[1],Ge=[0];continue;case 7:Ge=pe.ops.pop(),pe.trys.pop();continue;default:if(!(X=pe.trys,(X=X.length>0&&X[X.length-1])||Ge[0]!==6&&Ge[0]!==2)){pe=0;continue}if(Ge[0]===3&&(!X||Ge[1]>X[0]&&Ge[1]0&&E>0){var j=new lr(c,E),X=j.ratio>=1?20:j.getHorizontalLength(20),G=j.ratio<1?20:j.getVerticalLength(20),pe=document.createElementNS("http://www.w3.org/2000/svg","svg");pe.setAttribute("xmlns","http://www.w3.org/2000/svg"),pe.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(pe);var We=St.createDefs();pe.appendChild(We);var nt=St.createElement("clipPath",[["id","text-bg-clip"]]);We.appendChild(nt);var gt=St.createPath(St.getHollowRectanglePath((24-X)/2,(24-G)/2,X,G,(24-X)/2+2,(24-G)/2+2,X-4,G-4));pe.appendChild(gt);var Ge=St.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ge.appendChild(St.createTSpan(c+":"+E)),pe.appendChild(Ge);var Dt=Ge.getBBox();St.setAttributes(Ge,[["x",((24-Dt.width)/2).toString()],["y",((24-Dt.height)/2-Dt.y).toString()]]);var Ut=St.createPath(St.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Dt.width))/2,(24-Math.ceil(Dt.height))/2,Math.ceil(Dt.width),Math.ceil(Dt.height)));return nt.appendChild(Ut),St.setAttributes(gt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(pe),pe.outerHTML}return''},H}(),Ar=function(H){function c(E,j,X){var G=H.call(this,E,j)||this;return G.isDropdownOpen=!1,G.onClick=G.dropdownButtonClicked,G.dropdownButtons=X,G}return Kt(c,H),c.prototype.setupDropdown=function(){var E=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(j){j.className=E.className,j.colorsClassName=E.colorsClassName,E.dropdownBlock.appendChild(j.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},c.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},c.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},c.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},c.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},c.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},c}(Tt),_t=function(){function H(c,E){this.GRIP_SIZE=10,this.color=c,this.fillColor=E,this.visual=St.createGroup(),this.visual.appendChild(St.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(St.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return H.prototype.ownsTarget=function(c){return c===this.visual||c===this.visual.childNodes[0]||c===this.visual.childNodes[1]},H.prototype.setCenter=function(c,E){this.visual.childNodes.forEach(function(j){return St.setAttributes(j,[["cx",c.toString()],["cy",E.toString()]])})},H}(),kr=function(){function H(c,E,j,X){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=c,this.canvasHeight=E,this.margin=j,this.container=X,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(H.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(c){this._aspectRatio=c,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(c){this._isGridVisible=c,this.gridContainer&&St.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(c){this._zoomFactor=c,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),H.prototype.open=function(){var c=this;this.cropShadeElement=St.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=St.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var E=0;Ethis.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-E.height/2),St.setAttributes(this.cropRectElement,[["x",E.x.toString()],["y",E.y.toString()],["width",E.width.toString()],["height",E.height.toString()]]);var j=E.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(G,pe){var We=E.y+j*(pe+1);St.setAttributes(G,[["x1",""+E.x],["y1",""+We],["x2",""+(E.x+E.width)],["y2",""+We]])});var X=E.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(G,pe){var We=E.x+X*(pe+1);St.setAttributes(G,[["x1",""+We],["y1",""+E.y],["x2",""+We],["y2",""+(E.y+E.height)]])}),St.setAttributes(this.cropShadeElement,[["d",St.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,E.x,E.y,E.width,E.height)]]),this.topLeftGrip.setCenter(E.x,E.y),this.topRightGrip.setCenter(E.x+E.width,E.y),this.bottomLeftGrip.setCenter(E.x,E.y+E.height),this.bottomRightGrip.setCenter(E.x+E.width,E.y+E.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},H.prototype.attachEvents=function(){this.container.style.touchAction="none",this.container.addEventListener("pointerdown",this.onPointerDown),this.container.addEventListener("pointermove",this.onPointerMove),this.container.addEventListener("pointerup",this.onPointerUp)},H.prototype.clientToLocalCoordinates=function(c,E){var j=this.container.getBoundingClientRect();return{x:c-j.left+this.margin,y:E-j.top+this.margin}},H.prototype.onPointerDown=function(c){this.container.setPointerCapture(c.pointerId),this.previousPoint=this.clientToLocalCoordinates(c.clientX,c.clientY),this.cropRectElement===c.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(c.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(c.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(c.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(c.target)&&(this.activeGrip=this.bottomRightGrip)},H.prototype.onPointerMove=function(c){if(this.isMoving)this.move(this.clientToLocalCoordinates(c.clientX,c.clientY));else if(this.activeGrip){var E=this.clientToLocalCoordinates(c.clientX,c.clientY);this.resize(E)}c.preventDefault()},H.prototype.onPointerUp=function(c){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(c.pointerId)},H.prototype.move=function(c){var E=c.x-this.previousPoint.x,j=c.y-this.previousPoint.y;this.zoomFactor!==1&&(E=-E/this.zoomFactor,j=-j/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+E),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+j),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=c},H.prototype.resize=function(c){var E=Object.assign({},this.cropRect),j=c.x-this.previousPoint.x,X=c.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:E.x+jthis.canvasWidth*this.zoomFactor&&(j=this.canvasWidth*this.zoomFactor-E.width),E.width+=j}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(E.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(j),E.height=this.aspectRatio.getVerticalLength(E.width)):(E.y+=X,E.height=this.cropRect.y+this.cropRect.height-E.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?E.height=this.aspectRatio.getVerticalLength(E.width):E.height+=X}E.width<10&&(E.x=this.cropRect.x,E.width=10),E.height<10&&(E.y=this.cropRect.y,E.height=10),this.previousPoint=c,E.x>=this.margin&&E.y>=this.margin&&E.x-this.margin+E.width<=this.canvasWidth&&E.y-this.margin+E.height<=this.canvasHeight&&(this.cropRect=E,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},H.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var c=this.cropRect.x+this.cropRect.width/2,E=this.cropRect.y+this.cropRect.height/2,j=this.aspectRatio.getHorizontalLength(this.cropRect.height),X=this.aspectRatio.getVerticalLength(this.cropRect.width);j/this.canvasWidththis.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=c-this.cropRect.width/2,this.cropRect.y=E-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},H.prototype.getRescaledRect=function(c,E,j,X,G,pe){var We=j/c,nt=X/E;return{x:(G.x-pe)*We+pe,y:(G.y-pe)*nt+pe,width:G.width*We,height:G.height*nt}},H.prototype.scaleCanvas=function(c,E){var j=this.getRescaledRect(this.canvasWidth,this.canvasHeight,c,E,this.cropRect,this.margin);this.canvasWidth=c,this.canvasHeight=E,this.onCropChange&&this.onCropChange(j),this.setCropRectangle(j)},H}(),Vr=function(){function H(c){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=c,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(H.prototype,"angle",{get:function(){return this._angle},set:function(c){this._angle=c,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),H.prototype.getUI=function(){return this.controlContainer=document.createElement("div"),this.controlContainer.title=this.title,this.controlContainer.className=this.className+" "+this.colorsClassName,this.controlContainer.appendChild(this.getVisual()),this.controlContainer.addEventListener("pointerdown",this.onPointerDown),this.controlContainer.addEventListener("pointermove",this.onPointerMove),this.controlContainer.addEventListener("pointerup",this.onPointerUp),this.uiContainer.appendChild(this.controlContainer),this.uiContainer.style.display="inline-block",this.uiContainer.style.touchAction="none",this.setAngleLabel(),this.positionScaleShape(),this.uiContainer},H.prototype.onPointerDown=function(c){this.controlContainer.setPointerCapture(c.pointerId),this.isDragging=!0,this.previousPoint={x:c.clientX,y:c.clientY}},H.prototype.onPointerMove=function(c){this.isDragging&&(this.onAngleChange&&this.onAngleChange((c.clientX-this.previousPoint.x)/5),this.previousPoint.x=c.clientX)},H.prototype.onPointerUp=function(c){this.isDragging&&this.onAngleChange&&this.onAngleChange((c.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(c.pointerId)},H.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var c=this.angleLabelText.getBBox();St.setAttributes(this.angleLabelElement,[["x",((this.width-c.width)/2).toString()],["y",(this.height/2).toString()]])}},H.prototype.positionScaleShape=function(){if(this.scaleShape){var c=this.scaleShape.transform.baseVal.getItem(0);c.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(c,0)}},H.prototype.getVisual=function(){var c=document.createElementNS("http://www.w3.org/2000/svg","svg");c.setAttribute("xmlns","http://www.w3.org/2000/svg"),c.setAttribute("width",this.width+"px"),c.setAttribute("height",this.height+"px"),c.setAttribute("viewBox","0 0 "+this.width+" "+this.height),c.style.flexShrink="0",document.body.appendChild(c);for(var E="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,j=1;j<=this.width/5+10;j++){var X=j%5==0?this.height/3:this.height/6;E+="h4v"+-X+"h1v"+X}E+="v1H0Z",this.scaleShape=St.createPath(E);var G=St.createTransform();this.scaleShape.transform.baseVal.appendItem(G),c.appendChild(this.scaleShape),this.angleLabelElement=St.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=St.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var pe=St.createTSpan("");return pe.innerHTML="°",this.angleLabelElement.appendChild(pe),c.appendChild(this.angleLabelElement),document.body.removeChild(c),c},H}(),rn=function(){function H(){this.naturalSize=!1,this.imageType="image/png"}return H.prototype.rasterize=function(c,E,j,X,G,pe,We){var nt=this;return new Promise(function(gt){var Ge=document.createElement("canvas");Ge.width=c.width.baseVal.value-2*X,Ge.height=c.height.baseVal.value-2*X;var Dt=1,Ut=1;nt.naturalSize===!0?(Dt=E.naturalWidth/(c.width.baseVal.value-2*X)/pe,Ut=E.naturalHeight/(c.height.baseVal.value-2*X)/We,Ge.width=E.naturalWidth/pe,Ge.height=E.naturalHeight/We):nt.width!==void 0&&nt.height!==void 0&&(Dt=nt.width/j.width,Ut=nt.height/j.height,Ge.width*=Dt,Ge.height*=Ut);var rr=Ge.getContext("2d");rr.translate(Ge.width/2,Ge.height/2),rr.rotate(G*Math.PI/180),rr.scale(pe,We),rr.translate(-Ge.width/2,-Ge.height/2),rr.drawImage(E,0,0,Ge.width,Ge.height);var Xr=document.createElement("canvas");Xr.width=j.width*Dt,Xr.height=j.height*Ut,Xr.getContext("2d").putImageData(rr.getImageData((j.x-X)*Dt,(j.y-X)*Ut,j.width*Dt,j.height*Ut),0,0),gt(Xr.toDataURL(nt.imageType,nt.imageQuality))})},H}(),Fe=function(){function H(c){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=H.instanceCounter++,this.styles=new Et(this.instanceNo),this.target=c,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(H.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(c){this._zoomToCropEnabled=c,c?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(c){this._isGridVisible=c,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"gridLines",{get:function(){return this._gridLines},set:function(c){this._gridLines=c,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(c){this._rotationAngle=c,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"aspectRatio",{get:function(){var c;return(c=this._aspectRatio)!==null&&c!==void 0?c:this.aspectRatios[0]},set:function(c){this._aspectRatio=c},enumerable:!1,configurable:!0}),H.prototype.open=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.setupResizeObserver(),this.initCropCanvas(),this.setEditingTarget(),this.setTopLeft(),this.initCropLayer(),this.attachEvents(),this.applyAspectRatio(),this.displayMode==="popup"&&this.onPopupResize(),this._isOpen=!0},H.prototype.show=function(){this.showUI(),this.open()},H.prototype.close=function(c){c===void 0&&(c=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),c||this.closeEventListeners.forEach(function(E){return E()}),this._isOpen=!1)},H.prototype.addRenderEventListener=function(c){this.renderEventListeners.push(c)},H.prototype.removeRenderEventListener=function(c){this.renderEventListeners.indexOf(c)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(c),1)},H.prototype.addCloseEventListener=function(c){this.closeEventListeners.push(c)},H.prototype.removeCloseEventListener=function(c){this.closeEventListeners.indexOf(c)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(c),1)},H.prototype.setupResizeObserver=function(){var c=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){c.resize(c.target.clientWidth,c.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},H.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var c=1*this.target.clientWidth/this.target.clientHeight,E=this.contentDiv.clientWidth/c>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*c:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,j=E+2*this.CANVAS_MARGINc+this.CANVAS_MARGIN?this.target.offsetTop-(c+this.CANVAS_MARGIN):0;this.coverDiv.style.top=E+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},H.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},H.prototype.addTopToolbar=function(){var c=this;this.topToolbar=new Rt,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 E=new Mt;E.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(E);var j=[];this.aspectRatios.forEach(function(Ut){var rr=new Tt(Lr.getIcon(Ut.horizontal,Ut.vertical),Ut.horizontal===0&&Ut.vertical===0?"FREE":Ut.horizontal+":"+Ut.vertical);rr.onClick=function(){return c.ratioButtonClicked(Ut)},j.push(rr)}),this.aspectRatioButton=new Ar(Lr.getIcon(0,0),"Aspect ratio",j),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,E.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var X=new Tt('',"Toggle grid");X.isActive=this.isGridVisible,X.onClick=function(){c.isGridVisible=!c.isGridVisible,X.isActive=c.isGridVisible},E.addButton(X);var G=new Tt('',"Zoom to selection");if(G.isActive=this.zoomToCropEnabled,G.onClick=function(){c.zoomToCropEnabled=!c.zoomToCropEnabled,G.isActive=c.zoomToCropEnabled},E.addButton(G),!Wr.isLicensed){var pe=new pt;this.topToolbar.addElementBlock(pe);var We=document.createElement("div");We.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var nt=document.createElement("a");nt.style.color="currentColor",nt.href="https://markerjs.com/products/cropro",nt.target="_blank",nt.innerHTML='',We.appendChild(nt),pe.addElement(We)}var gt=new Mt;gt.minWidth=3*this.toolbarHeight+"px",gt.contentAlign="end",this.topToolbar.addButtonBlock(gt);var Ge=new Tt('',"OK");Ge.onClick=this.startRenderAndClose,gt.addButton(Ge),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ge.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Dt=new Tt('',"Close");Dt.onClick=this.close,gt.addButton(Dt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Dt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},H.prototype.addBottomToolbar=function(){var c=this;this.bottomToolbar=new Rt,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 E=new Mt;E.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(E);var j=new Tt('',"Rotate left");j.onClick=this.rotateLeftButtonClicked,E.addButton(j);var X=new Tt('',"Rotate right");X.onClick=this.rotateRightButtonClicked,E.addButton(X);var G=new pt;G.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(G),this.straightener=new Vr("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(gt){c.rotateBy(gt),c.straightener.angle=c.rotationAngle},G.addElement(this.straightener.getUI());var pe=new Mt;pe.minWidth=2*this.toolbarHeight+"px",pe.contentAlign="end",this.bottomToolbar.addButtonBlock(pe);var We=new Tt('',"Flip horizontal");We.onClick=this.flipHorizontallyButtonClicked,pe.addButton(We);var nt=new Tt('',"Flip vertical");nt.onClick=this.flipVerticallyButtonClicked,pe.addButton(nt)},H.prototype.ratioButtonClicked=function(c){this.aspectRatio=c,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},H.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Lr.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},H.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new lr(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},H.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},H.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},H.prototype.restoreState=function(c){if(c){var E=this.cropLayer.getRescaledRect(c.width,c.height,this.imageWidth,this.imageHeight,c.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(E),this.cropRectChanged(E),this.flippedHorizontally=c.flippedHorizontally,this.flippedVertically=c.flippedVertically,this.applyFlip(),this.rotationAngle=c.rotationAngle,this.applyRotation()}},H.prototype.clientToLocalCoordinates=function(c,E){var j=this.cropImage.getBoundingClientRect();return{x:c-j.left,y:E-j.top}},H.prototype.onWindowResize=function(){this.positionUI()},H.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var c=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=c+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},H.prototype.rotateLeftButtonClicked=function(){var c=this.rotationAngle-90;this.rotationAngle%90!=0&&(c+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(c)},H.prototype.rotateRightButtonClicked=function(){var c=this.rotationAngle+90;this.rotationAngle%90!=0&&(c-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(c)},H.prototype.rotateTo=function(c){c=(c=c>180?c-360:c)<=-180?c+360:c,this.rotationAngle=c,this.applyRotation()},H.prototype.rotateBy=function(c){this.rotateTo((this.rotationAngle+c)%360)},H.prototype.applyRotation=function(){var c=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var E=this.editingTargetRotationContainer.transform.baseVal.getItem(0);E.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(E,0);var j=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/j.width,this.imageHeight/j.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=c},H.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},H.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},H.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},H.prototype.startRenderAndClose=function(){return Pt(this,void 0,void 0,function(){var c,E;return wr(this,function(j){switch(j.label){case 0:return[4,this.render()];case 1:return c=j.sent(),E=this.getState(),this.renderEventListeners.forEach(function(X){return X(c,E)}),this.close(!0),[2]}})})},H.prototype.render=function(){return Pt(this,void 0,void 0,function(){var c;return wr(this,function(E){switch(E.label){case 0:return(c=new rn).naturalSize=this.renderAtNaturalSize,c.imageType=this.renderImageType,c.imageQuality=this.renderImageQuality,c.width=this.renderWidth,c.height=this.renderHeight,this.unzoomFromCrop(),St.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,c.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return E.sent(),[4,c.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,E.sent()]}})})},H.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Ct("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 Ct("toolbar_colors",` background-color: `+this.styles.settings.toolbarBackgroundColor+`; `)),this.toolbarBlockStyleClass=this.styles.addClass(new Ct("toolbar-block",` display: flex; align-items: center; box-sizing: content-box; `));var c=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Ct("toolbar_button",` display: inline-block; width: `+(this.toolbarHeight-2*c)+`px; height: `+(this.toolbarHeight-2*c)+`px; padding: `+c+`px; cursor: default; user-select: none; box-sizing: content-box; `)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Ct("toolbar_button_colors",` color: `+this.styles.settings.toolbarColor+`; fill: currentColor; `)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Ct("toolbar_active_button",` color: `+this.styles.settings.toolbarColor+`; fill: currentColor; background-color: `+this.styles.settings.toolbarBackgroundActiveColor+` `)),this.styles.addRule(new dt("."+this.toolbarButtonStyleClass.name+" svg",` height: `+this.toolbarHeight/2+`px; `)),this.styles.addRule(new dt("."+this.toolbarButtonStyleColorsClass.name+":hover",` background-color: `+this.styles.settings.toolbarBackgroundHoverColor+` `)),this.toolbarDropdownStyleClass=this.styles.addClass(new Ct("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 Ct("toolbar_dropdown_colors",` background-color: `+this.styles.settings.toolbarBackgroundColor+`; `)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Ct("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 Ct("toolbar_straightener",` display: flex; overflow: hidden; justify-content: center; height: `+(this.toolbarHeight-2*c)+`px; padding: `+c+`px; cursor: default; user-select: none; box-sizing: content-box; `)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Ct("toolbar_straightener_colors",` color: `+this.styles.settings.toolbarColor+`; fill: currentColor; `))},H.instanceCounter=0,H}(),ct=Q("8hTe"),Nt=Q.n(ct),$t=/]*>/g;function Qt(H){var c=document.createElement("div");return c.innerHTML=H,c.childNodes.length===0?"":c.childNodes[0].nodeValue}var tr=Ee.a=function(H){var c=H.value,E=c===void 0?"":c,j=H.edit,X=j===void 0?!1:j,G=H.className,pe=H.showTextOnly,We=H.showLines,nt=H.replaces,gt=H.zoomImg,Ge=H.hasMask,Dt=H.style,Ut=Dt===void 0?{}:Dt,rr=H.stylesPrev,Xr=rr===void 0?{}:rr,Yr=String(E),mr=Object(k.useRef)(),qr=Object(k.useRef)(),Gn=Object(k.useState)(""),Pr=Object(F.a)(Gn,2),$r=Pr[0],Hr=Pr[1],bn=Object(k.useState)("office"),nn=Object(F.a)(bn,2),mn=nn[0],dn=nn[1],hi=function(){var Vt=new Fe(qr.current);Vt.displayMode="popup",Vt.addRenderEventListener(function(){var Sr=Object(P.a)(M.a.mark(function zt(hr){var Jt;return M.a.wrap(function(ur){for(;;)switch(ur.prev=ur.next){case 0:return mr.current.style.display="none",ur.next=3,Object(Ie.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:hr}});case 3:Jt=ur.sent,Jt!=null&&Jt.id&&nt(qr.current.getAttribute("src").replace(ie.a.API_SERVER,""),"/api/attachments/".concat(Jt==null?void 0:Jt.id,"?type=").concat(Jt.content_type));case 5:case"end":return ur.stop()}},zt)}));return function(zt){return Sr.apply(this,arguments)}}()),Vt.show()},zn=function(){var Vt=new kt(qr.current);Vt.settings.displayMode="popup",Vt.addEventListener("render",function(){var Sr=Object(P.a)(M.a.mark(function zt(hr){var Jt;return M.a.wrap(function(ur){for(;;)switch(ur.prev=ur.next){case 0:if(mr.current.style.display="none",!qr.current){ur.next=6;break}return ur.next=4,Object(Ie.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:hr.dataUrl}});case 4:Jt=ur.sent,Jt!=null&&Jt.id&&nt(qr.current.getAttribute("src").replace(ie.a.API_SERVER,""),"/api/attachments/".concat(Jt==null?void 0:Jt.id,"?type=").concat(Jt.content_type));case 6:case"end":return ur.stop()}},zt)}));return function(zt){return Sr.apply(this,arguments)}}()),Vt.show(),window.markerArea=Vt},an=Object(k.useMemo)(function(){try{var or=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Vt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Sr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Yr=Yr.replace(or,"("+ie.a.API_SERVER+"/api/attachments/").replace(Vt,'"'+ie.a.API_SERVER+"/api/attachments/").replace(Sr,'"'+ie.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,` `),Yr=Yr.replace(new RegExp("(?[TOC]

    ",R()),C()),zt=zt.replace(/(__special_katext_id_\d+__)/g,function(hn,ur){var _r=hr[ur],Kn=_r.type,Vn=_r.expression;return Object(de.renderToString)(Qt(Vn)||"",{displayMode:Kn==="block",throwOnError:!1,output:"html"})}),zt=zt.replace(/▁/g,"\u2581\u2581\u2581"),x(),pe){var Jt=document.createElement("div");return Jt.innerHTML=zt,Jt.innerText}return setTimeout(function(){return On()},500),zt},[Yr]),Jr=Object(k.useRef)();g.WebkitLineClamp=We,We&&(Ut=Object(_.a)(Object(_.a)({},Ut),g));function kn(or){var Vt=or.target;if(Vt.tagName.toUpperCase()==="IMG"){if(gt){var Sr=Vt.getAttribute("src");Hr(Sr),dn("image")}}else if(Vt.tagName.toUpperCase()==="A"){var zt=Vt.getAttribute("href");if(zt.indexOf("office")>-1)or.preventDefault(),Hr(zt),dn("office");else if(zt.indexOf("application/pdf")>-1)or.preventDefault(),Hr(zt),dn("pdf");else if(zt.indexOf("type=text")>-1)or.preventDefault(),Hr(zt),dn("html");else if(zt.startsWith("#")){or.preventDefault();var hr=document.getElementById(zt.replace("#",""));hr&&hr.scrollIntoView(!0)}}}var On=function(){var Vt,Sr=(Vt=Jr.current)===null||Vt===void 0?void 0:Vt.querySelectorAll("video");Sr==null||Sr.forEach(function(zt){if(zt.oncontextmenu=function(){return!1},zt.src.indexOf(".m3u8")>-1&&!zt.canPlayType("application/vnd.apple.mpegurl")){if(ee.a.isSupported()){var hr=new ee.a;hr.loadSource(zt.src),hr.attachMedia(zt)}}})};Object(k.useEffect)(function(){if(Jr.current&&an&&(an.match($t)&&window.PR.prettyPrint()),Jr.current)return Jr.current.addEventListener("click",kn),function(){Jr.current.removeEventListener("click",kn),x(),C()}},[an,Jr.current,kn]);var ci=function(Vt){if(!X)return;Vt.target.nodeName==="IMG"?(mr.current.style.display="flex",mr.current.style.width=Vt.target.clientWidth+"px",mr.current.style.height=Vt.target.clientHeight+"px",mr.current.style.top=Vt.target.offsetTop+"px",mr.current.style.left=Vt.target.offsetLeft+"px",qr.current.src=Vt.target.getAttribute("src")):mr.current.style.display="none"};return d.a.createElement("div",{style:{position:"relative"}},d.a.createElement("div",{ref:Jr,style:Object(_.a)({},Ut),className:"".concat(G||""," markdown-body ").concat(Nt.a.mdBody),onMouseOver:ci,dangerouslySetInnerHTML:{__html:an}}),d.a.createElement("div",{ref:mr,className:Nt.a.button},d.a.createElement($.a,null,d.a.createElement(V.a,{onClick:function(){return hi()}},"\u88C1\u526A"),d.a.createElement(V.a,{onClick:function(){return zn()}},"\u7F16\u8F91"))),d.a.createElement("img",{ref:qr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),d.a.createElement(be.a,{close:!0,data:$r,hasMask:Ge,type:$r!=null&&$r.length?mn:"",style:Object(_.a)({},Xr),onClose:function(){return Hr("")}}))}},"9VGf":function(mt,Ee,Q){"use strict";Q.d(Ee,"a",function(){return O});var ne=Q("q1tI"),$=Q.n(ne);function O(V,_){var P=Object(ne.useRef)();Object(ne.useEffect)(function(){P.current=V}),Object(ne.useEffect)(function(){function F(){P.current()}if(_!==null){var N=setInterval(F,_);return function(){return clearInterval(N)}}},[_])}},BU3w:function(mt,Ee,Q){"use strict";Q.d(Ee,"a",function(){return P});var ne=Q("MNnm"),$="rc-util-key";function O(F){if(F.attachTo)return F.attachTo;var N=document.querySelector("head");return N||document.body}function V(F){var N,M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ne.a)())return null;var k=document.createElement("style");if((N=M.csp)===null||N===void 0?void 0:N.nonce){var d;k.nonce=(d=M.csp)===null||d===void 0?void 0:d.nonce}k.innerHTML=F;var h=O(M),S=h.firstChild;return M.prepend&&h.prepend?h.prepend(k):M.prepend&&S?h.insertBefore(k,S):h.appendChild(k),k}var _=new Map;function P(F,N){var M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},k=O(M);if(!_.has(k)){var d=V("",M),h=d.parentNode;_.set(k,h),h.removeChild(d)}var S=Array.from(_.get(k).children).find(function(i){return i.tagName==="STYLE"&&i[$]===N});if(S){var m,p;if(((m=M.csp)===null||m===void 0?void 0:m.nonce)&&S.nonce!==((p=M.csp)===null||p===void 0?void 0:p.nonce)){var v;S.nonce=(v=M.csp)===null||v===void 0?void 0:v.nonce}return S.innerHTML!==F&&(S.innerHTML=F),S}var a=V(F,M);return a[$]=N,a}},Bd2K:function(mt,Ee,Q){(function(ne){ne(Q("VrN/"),Q("osHv"))})(function(ne){ne.defineOption("autoCloseTags",!1,function(M,k,d){if(d!=ne.Init&&d&&M.removeKeyMap("autoCloseTags"),!k)return;var h={name:"autoCloseTags"};(typeof k!="object"||k.whenClosing!==!1)&&(h["'/'"]=function(S){return P(S)}),(typeof k!="object"||k.whenOpening!==!1)&&(h["'>'"]=function(S){return V(S)}),M.addKeyMap(h)});var $=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],O=["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 V(M){if(M.getOption("disableInput"))return ne.Pass;for(var k=M.listSelections(),d=[],h=M.getOption("autoCloseTags"),S=0;Sm.ch&&(s=s.slice(0,s.length-p.end+m.ch));var y=s.toLowerCase();if(!s||p.type=="string"&&(p.end!=m.ch||!/[\"\']/.test(p.string.charAt(p.string.length-1))||p.string.length==1)||p.type=="tag"&&i.close||p.string.indexOf("/")==m.ch-p.start-1||C&&F(C,y)>-1||N(M,v.mode.xmlCurrentContext&&v.mode.xmlCurrentContext(a)||[],s,m,!0))return ne.Pass;var R=typeof h=="object"&&h.emptyTags;if(R&&F(R,s)>-1){d[S]={text:"/>",newPos:ne.Pos(m.line,m.ch+2)};continue}var w=g&&F(g,y)>-1;d[S]={indent:w,text:">"+(w?` `:"")+"",newPos:w?ne.Pos(m.line+1,0):ne.Pos(m.line,m.ch+1)}}for(var T=typeof h=="object"&&h.dontIndentOnAutoClose,S=k.length-1;S>=0;S--){var b=d[S];M.replaceRange(b.text,k[S].head,k[S].anchor,"+insert");var f=M.listSelections().slice(0);f[S]={head:b.newPos,anchor:b.newPos},M.setSelections(f),!T&&b.indent&&(M.indentLine(b.newPos.line,null,!0),M.indentLine(b.newPos.line+1,null,!0))}}function _(M,k){for(var d=M.listSelections(),h=[],S=k?"/":""&&(C+=">"),h[v]=C}if(M.replaceSelections(h),d=M.listSelections(),!p)for(var v=0;v=0&&k[a]==d;a--)++v;h=p.to;for(var a=1;a0){for(var k=0;k1&&arguments[1]!==void 0?arguments[1]:"",k=[],d=0;dye.length)&&(ce=ye.length);for(var me=0,te=new Array(ce);me=ye.length?{done:!0}:{done:!1,value:ye[te++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return me=ye[Symbol.iterator](),me.next.bind(me)}function P(ye,ce){return ce={exports:{}},ye(ce,ce.exports),ce.exports}var F=P(function(ye){function ce(){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 me(te){ye.exports.defaults=te}ye.exports={defaults:ce(),getDefaults:ce,changeDefaults:me}}),N=F.defaults,M=F.getDefaults,k=F.changeDefaults,d=/[&<>"']/,h=/[&<>"']/g,S=/[<>"']|&(?!#?\w+;)/,m=/[<>"']|&(?!#?\w+;)/g,p={"&":"&","<":"<",">":">",'"':""","'":"'"},v=function(ce){return p[ce]};function a(ye,ce){if(ce){if(d.test(ye))return ye.replace(h,v)}else if(S.test(ye))return ye.replace(m,v);return ye}var i=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(ye){return ye.replace(i,function(ce,me){return me=me.toLowerCase(),me==="colon"?":":me.charAt(0)==="#"?me.charAt(1)==="x"?String.fromCharCode(parseInt(me.substring(2),16)):String.fromCharCode(+me.substring(1)):""})}var l=/(^|[^\[])\^/g;function C(ye,ce){ye=ye.source||ye,ce=ce||"";var me={replace:function(re,oe){return oe=oe.source||oe,oe=oe.replace(l,"$1"),ye=ye.replace(re,oe),me},getRegex:function(){return new RegExp(ye,ce)}};return me}var g=/[^\w:]/g,y=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function R(ye,ce,me){if(ye){var te;try{te=decodeURIComponent(s(me)).replace(g,"").toLowerCase()}catch(re){return null}if(te.indexOf("javascript:")===0||te.indexOf("vbscript:")===0||te.indexOf("data:")===0)return null}ce&&!y.test(me)&&(me=u(ce,me));try{me=encodeURI(me).replace(/%25/g,"%")}catch(re){return null}return me}var w={},T=/^[^:]+:\/*[^/]*$/,b=/^([^:]+:)[\s\S]*$/,f=/^([^:]+:\/*[^/]*)[\s\S]*$/;function u(ye,ce){w[" "+ye]||(T.test(ye)?w[" "+ye]=ye+"/":w[" "+ye]=I(ye,"/",!0)),ye=w[" "+ye];var me=ye.indexOf(":")===-1;return ce.substring(0,2)==="//"?me?ce:ye.replace(b,"$1")+ce:ce.charAt(0)==="/"?me?ce:ye.replace(f,"$1")+ce:ye+ce}var L={exec:function(){}};function x(ye){for(var ce=1,me,te;ce=0&&Te[Be]==="\\";)xe=!xe;return xe?"|":" |"}),te=me.split(/ \|/),re=0;if(te.length>ce)te.splice(ce);else for(;te.length=te.length?re.slice(te.length):re}).join(` `)}var Ae=function(){function ye(me){this.options=me||z}var ce=ye.prototype;return ce.space=function(te){var re=this.rules.block.newline.exec(te);if(re)return re[0].length>1?{type:"space",raw:re[0]}:{raw:` `}},ce.code=function(te,re){var oe=this.rules.block.code.exec(te);if(oe){var he=re[re.length-1];if(he&&he.type==="paragraph")return{raw:oe[0],text:oe[0].trimRight()};var Te=oe[0].replace(/^ {4}/gm,"");return{type:"code",raw:oe[0],codeBlockStyle:"indented",text:this.options.pedantic?Te:B(Te,` `)}}},ce.fences=function(te){var re=this.rules.block.fences.exec(te);if(re){var oe=re[0],he=Ie(oe,re[3]||"");return{type:"code",raw:oe,lang:re[2]?re[2].trim():re[2],text:he}}},ce.heading=function(te){var re=this.rules.block.heading.exec(te);if(re)return{type:"heading",raw:re[0],depth:re[1].length,text:re[2]}},ce.nptable=function(te){var re=this.rules.block.nptable.exec(te);if(re){var oe={type:"table",header:ee(re[1].replace(/^ *| *\| *$/g,"")),align:re[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:re[3]?re[3].replace(/\n$/,"").split(` `):[],raw:re[0]};if(oe.header.length===oe.align.length){var he=oe.align.length,Te;for(Te=0;Te ?/gm,"");return{type:"blockquote",raw:re[0],text:oe}}},ce.list=function(te){var re=this.rules.block.list.exec(te);if(re){for(var oe=re[0],he=re[2],Te=he.length>1,xe=he[he.length-1]===")",Be={type:"list",raw:oe,ordered:Te,start:Te?+he.slice(0,-1):"",loose:!1,items:[]},Ye=re[0].match(this.rules.block.item),ut=!1,qe,yt,xt,et,Wt,kt,Gt,Kt=Ye.length,Pt=0;Pt1||this.options.smartLists&&xt!==he)&&(et=Ye.slice(Pt+1).join(` `),Be.raw=Be.raw.substring(0,Be.raw.length-et.length),Pt=Kt-1)),Wt=ut||/\n\n(?!\s*$)/.test(qe),Pt!==Kt-1&&(ut=qe.charAt(qe.length-1)===` `,Wt||(Wt=ut)),Wt&&(Be.loose=!0),kt=/^\[[ xX]\] /.test(qe),Gt=void 0,kt&&(Gt=qe[1]!==" ",qe=qe.replace(/^\[[ xX]\] +/,"")),Be.items.push({type:"list_item",raw:oe,task:kt,checked:Gt,loose:Wt,text:qe});return Be}},ce.html=function(te){var re=this.rules.block.html.exec(te);if(re)return{type:this.options.sanitize?"paragraph":"html",raw:re[0],pre:!this.options.sanitizer&&(re[1]==="pre"||re[1]==="script"||re[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(re[0]):ie(re[0]):re[0]}},ce.def=function(te){var re=this.rules.block.def.exec(te);if(re){re[3]&&(re[3]=re[3].substring(1,re[3].length-1));var oe=re[1].toLowerCase().replace(/\s+/g," ");return{tag:oe,raw:re[0],href:re[2],title:re[3]}}},ce.table=function(te){var re=this.rules.block.table.exec(te);if(re){var oe={type:"table",header:ee(re[1].replace(/^ *| *\| *$/g,"")),align:re[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:re[3]?re[3].replace(/\n$/,"").split(` `):[]};if(oe.header.length===oe.align.length){oe.raw=re[0];var he=oe.align.length,Te;for(Te=0;Te/i.test(he[0])&&(re=!1),!oe&&/^<(pre|code|kbd|script)(\s|>)/i.test(he[0])?oe=!0:oe&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(he[0])&&(oe=!1),{type:this.options.sanitize?"text":"html",raw:he[0],inLink:re,inRawBlock:oe,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(he[0]):ie(he[0]):he[0]}},ce.link=function(te){var re=this.rules.inline.link.exec(te);if(re){var oe=de(re[2],"()");if(oe>-1){var he=re[0].indexOf("!")===0?5:4,Te=he+re[1].length+oe;re[2]=re[2].substring(0,oe),re[0]=re[0].substring(0,Te).trim(),re[3]=""}var xe=re[2],Be="";if(this.options.pedantic){var Ye=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(xe);Ye?(xe=Ye[1],Be=Ye[3]):Be=""}else Be=re[3]?re[3].slice(1,-1):"";xe=xe.trim().replace(/^<([\s\S]*)>$/,"$1");var ut=be(re,{href:xe&&xe.replace(this.rules.inline._escapes,"$1"),title:Be&&Be.replace(this.rules.inline._escapes,"$1")},re[0]);return ut}},ce.reflink=function(te,re){var oe;if((oe=this.rules.inline.reflink.exec(te))||(oe=this.rules.inline.nolink.exec(te))){var he=(oe[2]||oe[1]).replace(/\s+/g," ");if(he=re[he.toLowerCase()],!he||!he.href){var Te=oe[0].charAt(0);return{type:"text",raw:Te,text:Te}}var xe=be(oe,he,oe[0]);return xe}},ce.strong=function(te,re,oe){oe===void 0&&(oe="");var he=this.rules.inline.strong.start.exec(te);if(he&&(!he[1]||he[1]&&(oe===""||this.rules.inline.punctuation.exec(oe)))){re=re.slice(-1*te.length);var Te=he[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Te.lastIndex=0;for(var xe;(he=Te.exec(re))!=null;)if(xe=this.rules.inline.strong.middle.exec(re.slice(0,he.index+3)),xe)return{type:"strong",raw:te.slice(0,xe[0].length),text:te.slice(2,xe[0].length-2)}}},ce.em=function(te,re,oe){oe===void 0&&(oe="");var he=this.rules.inline.em.start.exec(te);if(he&&(!he[1]||he[1]&&(oe===""||this.rules.inline.punctuation.exec(oe)))){re=re.slice(-1*te.length);var Te=he[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Te.lastIndex=0;for(var xe;(he=Te.exec(re))!=null;)if(xe=this.rules.inline.em.middle.exec(re.slice(0,he.index+2)),xe)return{type:"em",raw:te.slice(0,xe[0].length),text:te.slice(1,xe[0].length-1)}}},ce.codespan=function(te){var re=this.rules.inline.code.exec(te);if(re){var oe=re[2].replace(/\n/g," "),he=/[^ ]/.test(oe),Te=oe.startsWith(" ")&&oe.endsWith(" ");return he&&Te&&(oe=oe.substring(1,oe.length-1)),oe=ie(oe,!0),{type:"codespan",raw:re[0],text:oe}}},ce.br=function(te){var re=this.rules.inline.br.exec(te);if(re)return{type:"br",raw:re[0]}},ce.del=function(te){var re=this.rules.inline.del.exec(te);if(re)return{type:"del",raw:re[0],text:re[1]}},ce.autolink=function(te,re){var oe=this.rules.inline.autolink.exec(te);if(oe){var he,Te;return oe[2]==="@"?(he=ie(this.options.mangle?re(oe[1]):oe[1]),Te="mailto:"+he):(he=ie(oe[1]),Te=he),{type:"link",raw:oe[0],text:he,href:Te,tokens:[{type:"text",raw:he,text:he}]}}},ce.url=function(te,re){var oe;if(oe=this.rules.inline.url.exec(te)){var he,Te;if(oe[2]==="@")he=ie(this.options.mangle?re(oe[0]):oe[0]),Te="mailto:"+he;else{var xe;do xe=oe[0],oe[0]=this.rules.inline._backpedal.exec(oe[0])[0];while(xe!==oe[0]);he=ie(oe[0]),oe[1]==="www."?Te="http://"+he:Te=he}return{type:"link",raw:oe[0],text:he,href:Te,tokens:[{type:"text",raw:he,text:he}]}}},ce.inlineText=function(te,re,oe){var he=this.rules.inline.text.exec(te);if(he){var Te;return re?Te=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(he[0]):ie(he[0]):he[0]:Te=ie(this.options.smartypants?oe(he[0]):he[0]),{type:"text",raw:he[0],text:Te}}},ye}(),Re=Z.noopTest,ke=Z.edit,De=Z.merge,ge={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]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|\\n*|\\n*|)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:Re,table:Re,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ge._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ge._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ge.def=ke(ge.def).replace("label",ge._label).replace("title",ge._title).getRegex(),ge.bullet=/(?:[*+-]|\d{1,9}[.)])/,ge.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ge.item=ke(ge.item,"gm").replace(/bull/g,ge.bullet).getRegex(),ge.list=ke(ge.list).replace(/bull/g,ge.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ge.def.source+")").getRegex(),ge._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",ge._comment=//,ge.html=ke(ge.html,"i").replace("comment",ge._comment).replace("tag",ge._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ge.paragraph=ke(ge._paragraph).replace("hr",ge.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",")|<(?:script|pre|style|!--)").replace("tag",ge._tag).getRegex(),ge.blockquote=ke(ge.blockquote).replace("paragraph",ge.paragraph).getRegex(),ge.normal=De({},ge),ge.gfm=De({},ge.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*|$)"}),ge.gfm.nptable=ke(ge.gfm.nptable).replace("hr",ge.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",")|<(?:script|pre|style|!--)").replace("tag",ge._tag).getRegex(),ge.gfm.table=ke(ge.gfm.table).replace("hr",ge.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",")|<(?:script|pre|style|!--)").replace("tag",ge._tag).getRegex(),ge.pedantic=De({},ge.normal,{html:ke(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ge._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:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:Re,paragraph:ke(ge.normal._paragraph).replace("hr",ge.hr).replace("heading",` *#{1,6} *[^ ]`).replace("lheading",ge.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ue={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Re,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\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:Re,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",ue.punctuation=ke(ue.punctuation).replace(/punctuation/g,ue._punctuation).getRegex(),ue._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",ue._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",ue.em.start=ke(ue.em.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.middle=ke(ue.em.middle).replace(/punctuation/g,ue._punctuation).replace(/overlapSkip/g,ue._overlapSkip).getRegex(),ue.em.endAst=ke(ue.em.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.endUnd=ke(ue.em.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.start=ke(ue.strong.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.middle=ke(ue.strong.middle).replace(/punctuation/g,ue._punctuation).replace(/blockSkip/g,ue._blockSkip).getRegex(),ue.strong.endAst=ke(ue.strong.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.endUnd=ke(ue.strong.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.blockSkip=ke(ue._blockSkip,"g").getRegex(),ue.overlapSkip=ke(ue._overlapSkip,"g").getRegex(),ue._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,ue._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,ue._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])?)+(?![-_])/,ue.autolink=ke(ue.autolink).replace("scheme",ue._scheme).replace("email",ue._email).getRegex(),ue._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,ue.tag=ke(ue.tag).replace("comment",ge._comment).replace("attribute",ue._attribute).getRegex(),ue._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ue._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,ue._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ue.link=ke(ue.link).replace("label",ue._label).replace("href",ue._href).replace("title",ue._title).getRegex(),ue.reflink=ke(ue.reflink).replace("label",ue._label).getRegex(),ue.reflinkSearch=ke(ue.reflinkSearch,"g").replace("reflink",ue.reflink).replace("nolink",ue.nolink).getRegex(),ue.normal=De({},ue),ue.pedantic=De({},ue.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:ke(/^!?\[(label)\]\((.*?)\)/).replace("label",ue._label).getRegex(),reflink:ke(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ue._label).getRegex()}),ue.gfm=De({},ue.normal,{escape:ke(ue.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]*?(?:(?=[\\.5&&(te="x"+te.toString(16)),ce+="&#"+te+";";return ce}var ve=function(){function ye(me){this.tokens=[],this.tokens.links=Object.create(null),this.options=me||$e,this.options.tokenizer=this.options.tokenizer||new Ae,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var te={block:Ke.normal,inline:tt.normal};this.options.pedantic?(te.block=Ke.pedantic,te.inline=tt.pedantic):this.options.gfm&&(te.block=Ke.gfm,this.options.breaks?te.inline=tt.breaks:te.inline=tt.gfm),this.tokenizer.rules=te}ye.lex=function(te,re){var oe=new ye(re);return oe.lex(te)};var ce=ye.prototype;return ce.lex=function(te){return te=te.replace(/\r\n|\r/g,` `).replace(/\t/g," "),this.blockTokens(te,this.tokens,!0),this.inline(this.tokens),this.tokens},ce.blockTokens=function(te,re,oe){re===void 0&&(re=[]),oe===void 0&&(oe=!0),te=te.replace(/^ +$/gm,"");for(var he,Te,xe,Be;te;){if(he=this.tokenizer.space(te)){te=te.substring(he.raw.length),he.type&&re.push(he);continue}if(he=this.tokenizer.code(te,re)){te=te.substring(he.raw.length),he.type?re.push(he):(Be=re[re.length-1],Be.raw+=` `+he.raw,Be.text+=` `+he.text);continue}if(he=this.tokenizer.fences(te)){te=te.substring(he.raw.length),re.push(he);continue}if(he=this.tokenizer.heading(te)){te=te.substring(he.raw.length),re.push(he);continue}if(he=this.tokenizer.nptable(te)){te=te.substring(he.raw.length),re.push(he);continue}if(he=this.tokenizer.hr(te)){te=te.substring(he.raw.length),re.push(he);continue}if(he=this.tokenizer.blockquote(te)){te=te.substring(he.raw.length),he.tokens=this.blockTokens(he.text,[],oe),re.push(he);continue}if(he=this.tokenizer.list(te)){for(te=te.substring(he.raw.length),xe=he.items.length,Te=0;Te0)for(;(Ye=this.tokenizer.rules.inline.reflinkSearch.exec(Be))!=null;)ut.includes(Ye[0].slice(Ye[0].lastIndexOf("[")+1,-1))&&(Be=Be.slice(0,Ye.index)+"["+"a".repeat(Ye[0].length-2)+"]"+Be.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ye=this.tokenizer.rules.inline.blockSkip.exec(Be))!=null;)Be=Be.slice(0,Ye.index)+"["+"a".repeat(Ye[0].length-2)+"]"+Be.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;te;){if(xe=this.tokenizer.escape(te)){te=te.substring(xe.raw.length),re.push(xe);continue}if(xe=this.tokenizer.tag(te,oe,he)){te=te.substring(xe.raw.length),oe=xe.inLink,he=xe.inRawBlock,re.push(xe);continue}if(xe=this.tokenizer.link(te)){te=te.substring(xe.raw.length),xe.type==="link"&&(xe.tokens=this.inlineTokens(xe.text,[],!0,he)),re.push(xe);continue}if(xe=this.tokenizer.reflink(te,this.tokens.links)){te=te.substring(xe.raw.length),xe.type==="link"&&(xe.tokens=this.inlineTokens(xe.text,[],!0,he)),re.push(xe);continue}if(xe=this.tokenizer.strong(te,Be,Te)){te=te.substring(xe.raw.length),xe.tokens=this.inlineTokens(xe.text,[],oe,he),re.push(xe);continue}if(xe=this.tokenizer.em(te,Be,Te)){te=te.substring(xe.raw.length),xe.tokens=this.inlineTokens(xe.text,[],oe,he),re.push(xe);continue}if(xe=this.tokenizer.codespan(te)){te=te.substring(xe.raw.length),re.push(xe);continue}if(xe=this.tokenizer.br(te)){te=te.substring(xe.raw.length),re.push(xe);continue}if(xe=this.tokenizer.del(te)){te=te.substring(xe.raw.length),xe.tokens=this.inlineTokens(xe.text,[],oe,he),re.push(xe);continue}if(xe=this.tokenizer.autolink(te,ae)){te=te.substring(xe.raw.length),re.push(xe);continue}if(!oe&&(xe=this.tokenizer.url(te,ae))){te=te.substring(xe.raw.length),re.push(xe);continue}if(xe=this.tokenizer.inlineText(te,he,se)){te=te.substring(xe.raw.length),Te=xe.raw.slice(-1),re.push(xe);continue}if(te){var qe="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(qe);break}else throw new Error(qe)}}return re},$(ye,null,[{key:"rules",get:function(){return{block:Ke,inline:tt}}}]),ye}(),we=F.defaults,Pe=Z.cleanUrl,_e=Z.escape,Ue=function(){function ye(me){this.options=me||we}var ce=ye.prototype;return ce.code=function(te,re,oe){var he=(re||"").match(/\S*/)[0];if(this.options.highlight){var Te=this.options.highlight(te,he);Te!=null&&Te!==te&&(oe=!0,te=Te)}return he?'
    '+(oe?te:_e(te,!0))+`
    `:"
    "+(oe?te:_e(te,!0))+`
    `},ce.blockquote=function(te){return`
    `+te+`
    `},ce.html=function(te){return te},ce.heading=function(te,re,oe,he){return this.options.headerIds?"'+te+" `:""+te+" `},ce.hr=function(){return this.options.xhtml?`
    `:`
    `},ce.list=function(te,re,oe){var he=re?"ol":"ul",Te=re&&oe!==1?' start="'+oe+'"':"";return"<"+he+Te+`> `+te+" `},ce.listitem=function(te){return"
  • "+te+`
  • `},ce.checkbox=function(te){return" "},ce.paragraph=function(te){return"

    "+te+`

    `},ce.table=function(te,re){return re&&(re=""+re+""),` `+te+` `+re+`
    `},ce.tablerow=function(te){return` `+te+` `},ce.tablecell=function(te,re){var oe=re.header?"th":"td",he=re.align?"<"+oe+' align="'+re.align+'">':"<"+oe+">";return he+te+" `},ce.strong=function(te){return""+te+""},ce.em=function(te){return""+te+""},ce.codespan=function(te){return""+te+""},ce.br=function(){return this.options.xhtml?"
    ":"
    "},ce.del=function(te){return""+te+""},ce.link=function(te,re,oe){if(te=Pe(this.options.sanitize,this.options.baseUrl,te),te===null)return oe;var he='",he},ce.image=function(te,re,oe){if(te=Pe(this.options.sanitize,this.options.baseUrl,te),te===null)return oe;var he=''+oe+'":">",he},ce.text=function(te){return te},ye}(),je=function(){function ye(){}var ce=ye.prototype;return ce.strong=function(te){return te},ce.em=function(te){return te},ce.codespan=function(te){return te},ce.del=function(te){return te},ce.html=function(te){return te},ce.text=function(te){return te},ce.link=function(te,re,oe){return""+oe},ce.image=function(te,re,oe){return""+oe},ce.br=function(){return""},ye}(),at=function(){function ye(){this.seen={}}var ce=ye.prototype;return ce.slug=function(te){var re=te.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(re)){var oe=re;do this.seen[oe]++,re=oe+"-"+this.seen[oe];while(this.seen.hasOwnProperty(re))}return this.seen[re]=0,re},ye}(),Je=F.defaults,Qe=Z.unescape,Ve=function(){function ye(me){this.options=me||Je,this.options.renderer=this.options.renderer||new Ue,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new je,this.slugger=new at}ye.parse=function(te,re){var oe=new ye(re);return oe.parse(te)};var ce=ye.prototype;return ce.parse=function(te,re){re===void 0&&(re=!0);var oe="",he,Te,xe,Be,Ye,ut,qe,yt,xt,et,Wt,kt,Gt,Kt,Pt,wr,Wr,St,Et=te.length;for(he=0;he0&&Pt.tokens[0].type==="text"?(Pt.tokens[0].text=St+" "+Pt.tokens[0].text,Pt.tokens[0].tokens&&Pt.tokens[0].tokens.length>0&&Pt.tokens[0].tokens[0].type==="text"&&(Pt.tokens[0].tokens[0].text=St+" "+Pt.tokens[0].tokens[0].text)):Pt.tokens.unshift({type:"text",text:St}):Kt+=St),Kt+=this.parse(Pt.tokens,Gt),xt+=this.renderer.listitem(Kt,Wr,wr);oe+=this.renderer.list(xt,Wt,kt);continue}case"html":{oe+=this.renderer.html(et.text);continue}case"paragraph":{oe+=this.renderer.paragraph(this.parseInline(et.tokens));continue}case"text":{for(xt=et.tokens?this.parseInline(et.tokens):et.text;he+1An error occurred:

    "+rt(xe.message+"",!0)+"
    ";throw xe}}Oe.options=Oe.setOptions=function(ye){return ht(Oe.defaults,ye),Xe(Oe.defaults),Oe},Oe.getDefaults=Le,Oe.defaults=lt,Oe.use=function(ye){var ce=ht({},ye);if(ye.renderer&&function(){var te=Oe.defaults.renderer||new Ue,re=function(Te){var xe=te[Te];te[Te]=function(){for(var Be=arguments.length,Ye=new Array(Be),ut=0;ut`,triples:"",explode:"[]{}"},O=ne.Pos;ne.defineOption("autoCloseBrackets",!1,function(p,v,a){a&&a!=ne.Init&&(p.removeKeyMap(_),p.state.closeBrackets=null),v&&(P(V(v,"pairs")),p.state.closeBrackets=v,p.addKeyMap(_))});function V(p,v){return v=="pairs"&&typeof p=="string"?p:typeof p=="object"&&p[v]!=null?p[v]:$[v]}var _={Backspace:M,Enter:k};function P(p){for(var v=0;v=0;s--){var C=i[s].head;p.replaceRange("",O(C.line,C.ch-1),O(C.line,C.ch+1),"+delete")}}function k(p){var v=N(p),a=v&&V(v,"explode");if(!a||p.getOption("disableInput"))return ne.Pass;for(var i=p.listSelections(),s=0;s0;return{anchor:new O(p.anchor.line,p.anchor.ch+(v?-1:1)),head:new O(p.head.line,p.head.ch+(v?1:-1))}}function h(p,v){var a=N(p);if(!a||p.getOption("disableInput"))return ne.Pass;var i=V(a,"pairs"),s=i.indexOf(v);if(s==-1)return ne.Pass;for(var l=V(a,"closeBefore"),C=V(a,"triples"),g=i.charAt(s+1)==v,y=p.listSelections(),R=s%2==0,w,T=0;T=0&&p.getRange(f,O(f.line,f.ch+3))==v+v+v?u="skipThree":u="skip";else if(g&&f.ch>1&&C.indexOf(v)>=0&&p.getRange(O(f.line,f.ch-2),f)==v+v){if(f.ch>2&&/\bstring/.test(p.getTokenTypeAt(O(f.line,f.ch-2))))return ne.Pass;u="addFour"}else if(g){var x=f.ch==0?" ":p.getRange(O(f.line,f.ch-1),f);if(!ne.isWordChar(L)&&x!=v&&!ne.isWordChar(x))u="both";else return ne.Pass}else if(R&&(L.length===0||/\s/.test(L)||l.indexOf(L)>-1))u="both";else return ne.Pass;if(!w)w=u;else if(w!=u)return ne.Pass}var A=s%2?i.charAt(s-1):v,I=s%2?v:i.charAt(s+1);p.operation(function(){if(w=="skip")p.execCommand("goCharRight");else if(w=="skipThree")for(var W=0;W<3;W++)p.execCommand("goCharRight");else if(w=="surround"){for(var K=p.getSelections(),W=0;W=R?$:{done:!1,value:g[y++]}}}}M.fromArray=S;function m(g){return{next:function(){var y=g.next();return y.done?$:{done:!1,value:y.value}}}}M.fromNativeIterator=m;function p(g){return g?Array.isArray(g)?M.fromArray(g):g:M.empty()}M.from=p;function v(g,y){return{next:function(){var R=g.next();return R.done?$:{done:!1,value:y(R.value)}}}}M.map=v;function a(g,y){return{next:function(){for(;;){var R=g.next();if(R.done)return $;if(y(R.value))return{done:!1,value:R.value}}}}}M.filter=a;function i(g,y){for(var R=g.next();!R.done;R=g.next())y(R.value)}M.forEach=i;function s(g,y){y===void 0&&(y=Number.POSITIVE_INFINITY);var R=[];if(y===0)return R;for(var w=0,T=g.next();!T.done&&!(R.push(T.value),++w>=y);T=g.next());return R}M.collect=s;function l(){for(var g=[],y=0;y=g.length)return $;var w=g[R],T=w.next();return T.done?(R++,this.next()):T}}}M.concat=l;function C(g){return new V(g)}M.chain=C})(O||(O={}));var V=function(){function M(k){this.it=k}return M.prototype.next=function(){return this.it.next()},M}();function _(M){return Array.isArray(M)?O.fromArray(M):M||O.empty()}var P=function(){function M(k,d,h,S){d===void 0&&(d=0),h===void 0&&(h=k.length),S===void 0&&(S=d-1),this.items=k,this.start=d,this.end=h,this.index=S}return M.prototype.first=function(){return this.index=this.start,this.current()},M.prototype.next=function(){return this.index=Math.min(this.index+1,this.end),this.current()},M.prototype.current=function(){return this.index===this.start-1||this.index===this.end?null:this.items[this.index]},M}(),F=function(M){ne(k,M);function k(d,h,S,m){return h===void 0&&(h=0),S===void 0&&(S=d.length),m===void 0&&(m=h-1),M.call(this,d,h,S,m)||this}return k.prototype.current=function(){return M.prototype.current.call(this)},k.prototype.previous=function(){return this.index=Math.max(this.index-1,this.start-1),this.current()},k.prototype.first=function(){return this.index=this.start,this.current()},k.prototype.last=function(){return this.index=this.end-1,this.current()},k.prototype.parent=function(){return null},k}(P),N=function(){function M(k,d){this.iterator=k,this.fn=d}return M.prototype.next=function(){return this.fn(this.iterator.next())},M}()},LSTS:function(mt,Ee,Q){"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});var ne=function(){function h(S,m){for(var p=0;p=0)continue;if(!Object.prototype.hasOwnProperty.call(h,p))continue;m[p]=h[p]}return m}function N(h,S){if(!(h instanceof S))throw new TypeError("Cannot call a class as a function")}function M(h,S){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return S&&(typeof S=="object"||typeof S=="function")?S:h}function k(h,S){if(typeof S!="function"&&S!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof S);h.prototype=Object.create(S&&S.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),S&&(Object.setPrototypeOf?Object.setPrototypeOf(h,S):h.__proto__=S)}var d=function(h){k(S,h);function S(m){N(this,S);var p=M(this,(S.__proto__||Object.getPrototypeOf(S)).call(this,m));return p.scrollListener=p.scrollListener.bind(p),p.eventListenerOptions=p.eventListenerOptions.bind(p),p.mousewheelListener=p.mousewheelListener.bind(p),p}return ne(S,[{key:"componentDidMount",value:function(){this.pageLoaded=this.props.pageStart,this.options=this.eventListenerOptions(),this.attachScrollListener()}},{key:"componentDidUpdate",value:function(){if(this.props.isReverse&&this.loadMore){var p=this.getParentElement(this.scrollComponent);p.scrollTop=p.scrollHeight-this.beforeScrollHeight+this.beforeScrollTop,this.loadMore=!1}this.attachScrollListener()}},{key:"componentWillUnmount",value:function(){this.detachScrollListener(),this.detachMousewheelListener()}},{key:"isPassiveSupported",value:function(){var p=!1,v={get passive(){p=!0}};try{document.addEventListener("test",null,v),document.removeEventListener("test",null,v)}catch(a){}return p}},{key:"eventListenerOptions",value:function(){var p=this.props.useCapture;return this.isPassiveSupported()&&(p={useCapture:this.props.useCapture,passive:!0}),p}},{key:"setDefaultLoader",value:function(p){this.defaultLoader=p}},{key:"detachMousewheelListener",value:function(){var p=window;this.props.useWindow===!1&&(p=this.scrollComponent.parentNode),p.removeEventListener("mousewheel",this.mousewheelListener,this.options?this.options:this.props.useCapture)}},{key:"detachScrollListener",value:function(){var p=window;this.props.useWindow===!1&&(p=this.getParentElement(this.scrollComponent)),p.removeEventListener("scroll",this.scrollListener,this.options?this.options:this.props.useCapture),p.removeEventListener("resize",this.scrollListener,this.options?this.options:this.props.useCapture)}},{key:"getParentElement",value:function(p){var v=this.props.getScrollParent&&this.props.getScrollParent();return v!=null?v:p&&p.parentNode}},{key:"filterProps",value:function(p){return p}},{key:"attachScrollListener",value:function(){var p=this.getParentElement(this.scrollComponent);if(!this.props.hasMore||!p)return;var v=window;this.props.useWindow===!1&&(v=p),v.addEventListener("mousewheel",this.mousewheelListener,this.options?this.options:this.props.useCapture),v.addEventListener("scroll",this.scrollListener,this.options?this.options:this.props.useCapture),v.addEventListener("resize",this.scrollListener,this.options?this.options:this.props.useCapture),this.props.initialLoad&&this.scrollListener()}},{key:"mousewheelListener",value:function(p){p.deltaY===1&&!this.isPassiveSupported()&&p.preventDefault()}},{key:"scrollListener",value:function(){var p=this.scrollComponent,v=window,a=this.getParentElement(p),i=void 0;if(this.props.useWindow){var s=document.documentElement||document.body.parentNode||document.body,l=v.pageYOffset!==void 0?v.pageYOffset:s.scrollTop;this.props.isReverse?i=l:i=this.calculateOffset(p,l)}else this.props.isReverse?i=a.scrollTop:i=p.scrollHeight-a.scrollTop-a.clientHeight;i1&&arguments[1]!==void 0?arguments[1]:1,me=je.length,te=0;te1&&arguments[1]!==void 0?arguments[1]:!1;return Object(R.a)(B).map(function(ie,de){if(!_.isValidElement(ie)||!ie.type)return null;var be=ie.type.isSelectOptGroup,Ie=ie.key,Ae=ie.props,Re=Ae.children,ke=Object(F.a)(Ae,["children"]);return ee||!be?w(ie):Object(y.a)(Object(y.a)({key:"__RC_SELECT_GRP__".concat(Ie===null?de:Ie,"__"),label:Ie},ke),{},{options:T(Re)})}).filter(function(ie){return ie})}var b=Q("2Qr1"),f=Q("qNPg"),u=Q("U8pU"),L=Q("Kwbf"),x=Q("WKfj");function A(B){var ee=B.mode,ie=B.options,de=B.children,be=B.backfill,Ie=B.allowClear,Ae=B.placeholder,Re=B.getInputElement,ke=B.showSearch,De=B.onSearch,ge=B.defaultOpen,ue=B.autoFocus,Me=B.labelInValue,$e=B.value,Ke=B.inputValue,tt=B.optionLabelProp,se=ee==="multiple"||ee==="tags",ae=ke!==void 0?ke:se||ee==="combobox",ve=ie||T(de);if(Object(L.a)(ee!=="tags"||ve.every(function(Ue){return!Ue.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),ee==="tags"||ee==="combobox"){var we=ve.some(function(Ue){return Ue.options?Ue.options.some(function(je){return typeof("value"in je?je.value:je.key)=="number"}):typeof("value"in Ue?Ue.value:Ue.key)=="number"});Object(L.a)(!we,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(L.a)(ee!=="combobox"||!tt,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(L.a)(ee==="combobox"||!be,"`backfill` only works with `combobox` mode."),Object(L.a)(ee==="combobox"||!Re,"`getInputElement` only work with `combobox` mode."),Object(L.b)(ee!=="combobox"||!Re||!Ie||!Ae,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),De&&!ae&&ee!=="combobox"&&ee!=="tags"&&Object(L.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(L.b)(!ge||ue,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),$e!=null){var Pe=Object(x.d)($e);Object(L.a)(!Me||Pe.every(function(Ue){return Object(u.a)(Ue)==="object"&&("key"in Ue||"value"in Ue)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(L.a)(!se||Array.isArray($e),"`value` should be array when `mode` is `multiple` or `tags`")}if(de){var _e=null;Object(R.a)(de).some(function(Ue){if(!_.isValidElement(Ue)||!Ue.type)return!1;var je=Ue.type;if(je.isSelectOption)return!1;if(je.isSelectOptGroup){var at=Object(R.a)(Ue.props.children).every(function(Je){return!_.isValidElement(Je)||!Ue.type||Je.type.isSelectOption?!0:(_e=Je.type,!1)});return!at}return _e=je,!0}),_e&&Object(L.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(_e.displayName||_e.name||_e,"`.")),Object(L.a)(Ke===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var I=A,W=Object(f.a)({prefixCls:"rc-select",components:{optionList:i},convertChildrenToData:T,flattenOptions:b.d,getLabeledValue:b.e,filterOptions:b.b,isValueDisabled:b.g,findValueOption:b.c,warningProps:I,fillOptionsWithMissingValue:b.a}),K=function(B){Object(O.a)(ie,B);var ee=Object(V.a)(ie);function ie(){var de;return Object(ne.a)(this,ie),de=ee.apply(this,arguments),de.selectRef=_.createRef(),de.focus=function(){de.selectRef.current.focus()},de.blur=function(){de.selectRef.current.blur()},de}return Object($.a)(ie,[{key:"render",value:function(){return _.createElement(W,Object.assign({ref:this.selectRef},this.props))}}]),ie}(_.Component);K.Option=l,K.OptGroup=g;var Z=K,z=Ee.c=Z},M8RZ:function(mt,Ee,Q){"use strict";Q.d(Ee,"a",function(){return M});var ne=Q("fWQN"),$=Q("mtLc"),O=Q("yKVA"),V=Q("879j"),_=Q("q1tI"),P=Q.n(_),F=Q("i8i4"),N=Q.n(F),M=function(k){Object(O.a)(h,k);var d=Object(V.a)(h);function h(S){var m;Object(ne.a)(this,h),m=d.call(this,S);var p=window.document;return m.node=p.createElement("div"),p.body.appendChild(m.node),m}return Object($.a)(h,[{key:"render",value:function(){var m=this.props.children;return Object(F.createPortal)(m,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),h}(P.a.Component)},MI8n:function(mt,Ee,Q){"use strict";Q.d(Ee,"b",function(){return P}),Q.d(Ee,"a",function(){return M}),Q.d(Ee,"e",function(){return k}),Q.d(Ee,"d",function(){return d}),Q.d(Ee,"c",function(){return h}),Q.d(Ee,"f",function(){return S});var ne=Q("/cxE"),$=Q("C/vA"),O=Q("pmY6"),V=Q("24hK"),_=function(){var m=function(p,v){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,i){a.__proto__=i}||function(a,i){for(var s in i)i.hasOwnProperty(s)&&(a[s]=i[s])},m(p,v)};return function(p,v){m(p,v);function a(){this.constructor=p}p.prototype=v===null?Object.create(v):(a.prototype=v.prototype,new a)}}(),P;(function(m){m.None=function(){return O.a.None};function p(I){return function(W,K,Z){K===void 0&&(K=null);var z=!1,B;return B=I(function(ee){return z?void 0:(B?B.dispose():z=!0,W.call(K,ee))},null,Z),z&&B.dispose(),B}}m.once=p;function v(I,W){return g(function(K,Z,z){return Z===void 0&&(Z=null),I(function(B){return K.call(Z,W(B))},null,z)})}m.map=v;function a(I,W){return g(function(K,Z,z){return Z===void 0&&(Z=null),I(function(B){W(B),K.call(Z,B)},null,z)})}m.forEach=a;function i(I,W){return g(function(K,Z,z){return Z===void 0&&(Z=null),I(function(B){return W(B)&&K.call(Z,B)},null,z)})}m.filter=i;function s(I){return I}m.signal=s;function l(){for(var I=[],W=0;W1)&&be.fire(Ae),de=0},K)})},onLastListenerRemove:function(){B.dispose()}});return be.event}m.debounce=y;function R(I){var W=new Date().getTime();return v(p(I),function(K){return new Date().getTime()-W})}m.stopwatch=R;function w(I){var W=!0,K;return i(I,function(Z){var z=W||Z!==K;return W=!1,K=Z,z})}m.latch=w;function T(I,W,K){W===void 0&&(W=!1),K===void 0&&(K=[]);var Z=K.slice(),z=I(function(ie){Z?Z.push(ie):ee.fire(ie)}),B=function(){Z&&Z.forEach(function(ie){return ee.fire(ie)}),Z=null},ee=new M({onFirstListenerAdd:function(){z||(z=I(function(ie){return ee.fire(ie)}))},onFirstListenerDidAdd:function(){Z&&(W?setTimeout(B):B())},onLastListenerRemove:function(){z&&z.dispose(),z=null}});return ee.event}m.buffer=T;var b=function(){function I(W){this.event=W}return I.prototype.map=function(W){return new I(v(this.event,W))},I.prototype.forEach=function(W){return new I(a(this.event,W))},I.prototype.filter=function(W){return new I(i(this.event,W))},I.prototype.reduce=function(W,K){return new I(C(this.event,W,K))},I.prototype.latch=function(){return new I(w(this.event))},I.prototype.debounce=function(W,K,Z,z){return K===void 0&&(K=100),Z===void 0&&(Z=!1),new I(y(this.event,W,K,Z,z))},I.prototype.on=function(W,K,Z){return this.event(W,K,Z)},I.prototype.once=function(W,K,Z){return p(this.event)(W,K,Z)},I}();function f(I){return new b(I)}m.chain=f;function u(I,W,K){K===void 0&&(K=function(ie){return ie});var Z=function(){for(var ie=[],de=0;de0?new N(this._options&&this._options.leakWarningThreshold):void 0}return Object.defineProperty(m.prototype,"event",{get:function(){var p=this;return this._event||(this._event=function(v,a,i){p._listeners||(p._listeners=new V.a);var s=p._listeners.isEmpty();s&&p._options&&p._options.onFirstListenerAdd&&p._options.onFirstListenerAdd(p);var l=p._listeners.push(a?[v,a]:v);s&&p._options&&p._options.onFirstListenerDidAdd&&p._options.onFirstListenerDidAdd(p),p._options&&p._options.onListenerDidAdd&&p._options.onListenerDidAdd(p,v,a);var C;p._leakageMon&&(C=p._leakageMon.check(p._listeners.size));var g;return g={dispose:function(){if(C&&C(),g.dispose=m._noop,!p._disposed&&(l(),p._options&&p._options.onLastListenerRemove)){var y=p._listeners&&!p._listeners.isEmpty();y||p._options.onLastListenerRemove(p)}}},i instanceof O.b?i.add(g):Array.isArray(i)&&i.push(g),g}),this._event},enumerable:!0,configurable:!0}),m.prototype.fire=function(p){if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new V.a);for(var v=this._listeners.iterator(),a=v.next();!a.done;a=v.next())this._deliveryQueue.push([a.value,p]);for(;this._deliveryQueue.size>0;){var i=this._deliveryQueue.shift(),s=i[0],l=i[1];try{typeof s=="function"?s.call(void 0,l):s[0].call(s[1],l)}catch(C){Object(ne.e)(C)}}}},m.prototype.dispose=function(){this._listeners&&this._listeners.clear(),this._deliveryQueue&&this._deliveryQueue.clear(),this._leakageMon&&this._leakageMon.dispose(),this._disposed=!0},m._noop=function(){},m}(),k=function(m){_(p,m);function p(v){var a=m.call(this,v)||this;return a._isPaused=0,a._eventQueue=new V.a,a._mergeFn=v&&v.merge,a}return p.prototype.pause=function(){this._isPaused++},p.prototype.resume=function(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){var v=this._eventQueue.toArray();this._eventQueue.clear(),m.prototype.fire.call(this,this._mergeFn(v))}else for(;!this._isPaused&&this._eventQueue.size!==0;)m.prototype.fire.call(this,this._eventQueue.shift())},p.prototype.fire=function(v){this._listeners&&(this._isPaused!==0?this._eventQueue.push(v):m.prototype.fire.call(this,v))},p}(M),d=function(){function m(){var p=this;this.hasListeners=!1,this.events=[],this.emitter=new M({onFirstListenerAdd:function(){return p.onFirstListenerAdd()},onLastListenerRemove:function(){return p.onLastListenerRemove()}})}return Object.defineProperty(m.prototype,"event",{get:function(){return this.emitter.event},enumerable:!0,configurable:!0}),m.prototype.add=function(p){var v=this,a={event:p,listener:null};this.events.push(a),this.hasListeners&&this.hook(a);var i=function(){v.hasListeners&&v.unhook(a);var s=v.events.indexOf(a);v.events.splice(s,1)};return Object(O.h)(Object($.a)(i))},m.prototype.onFirstListenerAdd=function(){var p=this;this.hasListeners=!0,this.events.forEach(function(v){return p.hook(v)})},m.prototype.onLastListenerRemove=function(){var p=this;this.hasListeners=!1,this.events.forEach(function(v){return p.unhook(v)})},m.prototype.hook=function(p){var v=this;p.listener=p.event(function(a){return v.emitter.fire(a)})},m.prototype.unhook=function(p){p.listener&&p.listener.dispose(),p.listener=null},m.prototype.dispose=function(){this.emitter.dispose()},m}(),h=function(){function m(){this.buffers=[]}return m.prototype.wrapEvent=function(p){var v=this;return function(a,i,s){return p(function(l){var C=v.buffers[v.buffers.length-1];C?C.push(function(){return a.call(i,l)}):a.call(i,l)},void 0,s)}},m.prototype.bufferEvents=function(p){var v=[];this.buffers.push(v);var a=p();return this.buffers.pop(),v.forEach(function(i){return i()}),a},m}(),S=function(){function m(){var p=this;this.listening=!1,this.inputEvent=P.None,this.inputEventListener=O.a.None,this.emitter=new M({onFirstListenerDidAdd:function(){p.listening=!0,p.inputEventListener=p.inputEvent(p.emitter.fire,p.emitter)},onLastListenerRemove:function(){p.listening=!1,p.inputEventListener.dispose()}}),this.event=this.emitter.event}return Object.defineProperty(m.prototype,"input",{set:function(p){this.inputEvent=p,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=p(this.emitter.fire,this.emitter))},enumerable:!0,configurable:!0}),m.prototype.dispose=function(){this.inputEventListener.dispose(),this.emitter.dispose()},m}()},N0LK:function(mt,Ee,Q){"use strict";Q.d(Ee,"x",function(){return ne}),Q.d(Ee,"F",function(){return $}),Q.d(Ee,"r",function(){return V}),Q.d(Ee,"o",function(){return _}),Q.d(Ee,"p",function(){return P}),Q.d(Ee,"Q",function(){return F}),Q.d(Ee,"K",function(){return M}),Q.d(Ee,"k",function(){return k}),Q.d(Ee,"N",function(){return d}),Q.d(Ee,"m",function(){return h}),Q.d(Ee,"l",function(){return S}),Q.d(Ee,"I",function(){return m}),Q.d(Ee,"H",function(){return p}),Q.d(Ee,"q",function(){return v}),Q.d(Ee,"t",function(){return a}),Q.d(Ee,"D",function(){return i}),Q.d(Ee,"e",function(){return s}),Q.d(Ee,"f",function(){return l}),Q.d(Ee,"B",function(){return C}),Q.d(Ee,"C",function(){return g}),Q.d(Ee,"n",function(){return R}),Q.d(Ee,"O",function(){return T}),Q.d(Ee,"c",function(){return b}),Q.d(Ee,"d",function(){return f}),Q.d(Ee,"z",function(){return u}),Q.d(Ee,"A",function(){return L}),Q.d(Ee,"u",function(){return x}),Q.d(Ee,"E",function(){return I}),Q.d(Ee,"G",function(){return W}),Q.d(Ee,"i",function(){return Z}),Q.d(Ee,"g",function(){return B}),Q.d(Ee,"v",function(){return ie}),Q.d(Ee,"h",function(){return de}),Q.d(Ee,"y",function(){return be}),Q.d(Ee,"w",function(){return Ie}),Q.d(Ee,"a",function(){return Ae}),Q.d(Ee,"P",function(){return Re}),Q.d(Ee,"L",function(){return ke}),Q.d(Ee,"J",function(){return De}),Q.d(Ee,"j",function(){return ge}),Q.d(Ee,"M",function(){return ue}),Q.d(Ee,"s",function(){return Me}),Q.d(Ee,"b",function(){return $e});function ne(se){return!se||typeof se!="string"?!0:se.trim().length===0}function $(se,ae,ve){ve===void 0&&(ve="0");for(var we=""+se,Pe=[we],_e=we.length;_e=ae.length?we:ae[_e]})}function _(se){return se.replace(/[<>&]/g,function(ae){switch(ae){case"<":return"<";case">":return">";case"&":return"&";default:return ae}})}function P(se){return se.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function F(se,ae){ae===void 0&&(ae=" ");var ve=N(se,ae);return M(ve,ae)}function N(se,ae){if(!se||!ae)return se;var ve=ae.length;if(ve===0||se.length===0)return se;for(var we=0;se.indexOf(ae,we)===we;)we=we+ve;return se.substring(we)}function M(se,ae){if(!se||!ae)return se;var ve=ae.length,we=se.length;if(ve===0||we===0)return se;for(var Pe=we,_e=-1;!(_e=se.lastIndexOf(ae,Pe-1),_e===-1||_e+ve!==Pe);){if(_e===0)return"";Pe=_e}return se.substring(0,Pe)}function k(se){return se.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function d(se,ae){if(se.length0?se.indexOf(ae,ve)===ve:ve===0?se===ae:!1}function S(se,ae,ve){if(ve===void 0&&(ve={}),!se)throw new Error("Cannot create regex from empty string");ae||(se=P(se)),ve.wholeWord&&(/\B/.test(se.charAt(0))||(se="\\b"+se),/\B/.test(se.charAt(se.length-1))||(se=se+"\\b"));var we="";return ve.global&&(we+="g"),ve.matchCase||(we+="i"),ve.multiline&&(we+="m"),ve.unicode&&(we+="u"),new RegExp(se,we)}function m(se){if(se.source==="^"||se.source==="^$"||se.source==="$"||se.source==="^\\s*$")return!1;var ae=se.exec("");return!!(ae&&se.lastIndex===0)}function p(se){return(se.global?"g":"")+(se.ignoreCase?"i":"")+(se.multiline?"m":"")+(se.unicode?"u":"")}function v(se){for(var ae=0,ve=se.length;ae=0;ve--){var we=se.charCodeAt(ve);if(we!==32&&we!==9)return ve}return-1}function s(se,ae){return seae?1:0}function l(se,ae){for(var ve=Math.min(se.length,ae.length),we=0;weae.length?1:0}function C(se){return se>=97&&se<=122}function g(se){return se>=65&&se<=90}function y(se){return C(se)||g(se)}function R(se,ae){return se.length===ae.length&&w(se,ae)}function w(se,ae,ve){ve===void 0&&(ve=se.length);for(var we=0;wese.length?!1:w(se,ae,ve)}function b(se,ae){var ve,we=Math.min(se.length,ae.length);for(ve=0;ve1){var we=se.charCodeAt(ae-2);if(u(we))return(we-55296<<10)+(ve-56320)+65536}return ve}function I(se,ae){var ve=Ke.getInstance(),we=ae,Pe=se.length,_e=x(se,Pe,ae);ae+=_e>=65536?2:1;for(var Ue=ve.getGraphemeBreakType(_e);ae=65536?2:1,Ue=at}return ae-we}function W(se,ae){var ve=Ke.getInstance(),we=ae,Pe=A(se,ae);ae-=Pe>=65536?2:1;for(var _e=ve.getGraphemeBreakType(Pe);ae>0;){var Ue=A(se,ae),je=ve.getGraphemeBreakType(Ue);if($e(je,_e))break;ae-=Ue>=65536?2:1,_e=je}return we-ae}var K=/(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u08BD\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE33\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDCFF]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD50-\uDFFF]|\uD83B[\uDC00-\uDEBB])/;function Z(se){return K.test(se)}var z=/(?:[\u231A\u231B\u23F0\u23F3\u2600-\u27BF\u2B50\u2B55]|\uD83C[\uDDE6-\uDDFF\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F\uDE80-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD00-\uDDFF\uDE70-\uDE73\uDE78-\uDE82\uDE90-\uDE95])/;function B(se){return z.test(se)}var ee=/^[\t\n\r\x20-\x7E]*$/;function ie(se){return ee.test(se)}function de(se){for(var ae=0,ve=se.length;ae=11904&&se<=55215||se>=63744&&se<=64255||se>=65281&&se<=65374}function Ie(se){return se>=127462&&se<=127487||se>=9728&&se<=10175||se>=127744&&se<=128591||se>=128640&&se<=128764||se>=128992&&se<=129003||se>=129280&&se<=129535||se>=129648&&se<=129651||se>=129656&&se<=129666||se>=129680&&se<=129685}var Ae=String.fromCharCode(65279);function Re(se){return!!(se&&se.length>0&&se.charCodeAt(0)===65279)}function ke(se){return btoa(encodeURIComponent(se))}function De(se,ae){for(var ve="",we=0;weve[3*Pe+1])Pe=2*Pe+1;else return ve[3*Pe+2];return 0},se._INSTANCE=null,se}();function tt(){return JSON.parse("[0,0,0,51592,51592,11,44424,44424,11,72251,72254,5,7150,7150,7,48008,48008,11,55176,55176,11,128420,128420,14,3276,3277,5,9979,9980,14,46216,46216,11,49800,49800,11,53384,53384,11,70726,70726,5,122915,122916,5,129320,129327,14,2558,2558,5,5906,5908,5,9762,9763,14,43360,43388,8,45320,45320,11,47112,47112,11,48904,48904,11,50696,50696,11,52488,52488,11,54280,54280,11,70082,70083,1,71350,71350,7,73111,73111,5,127892,127893,14,128726,128727,14,129473,129474,14,2027,2035,5,2901,2902,5,3784,3789,5,6754,6754,5,8418,8420,5,9877,9877,14,11088,11088,14,44008,44008,5,44872,44872,11,45768,45768,11,46664,46664,11,47560,47560,11,48456,48456,11,49352,49352,11,50248,50248,11,51144,51144,11,52040,52040,11,52936,52936,11,53832,53832,11,54728,54728,11,69811,69814,5,70459,70460,5,71096,71099,7,71998,71998,5,72874,72880,5,119149,119149,7,127374,127374,14,128335,128335,14,128482,128482,14,128765,128767,14,129399,129400,14,129680,129685,14,1476,1477,5,2377,2380,7,2759,2760,5,3137,3140,7,3458,3459,7,4153,4154,5,6432,6434,5,6978,6978,5,7675,7679,5,9723,9726,14,9823,9823,14,9919,9923,14,10035,10036,14,42736,42737,5,43596,43596,5,44200,44200,11,44648,44648,11,45096,45096,11,45544,45544,11,45992,45992,11,46440,46440,11,46888,46888,11,47336,47336,11,47784,47784,11,48232,48232,11,48680,48680,11,49128,49128,11,49576,49576,11,50024,50024,11,50472,50472,11,50920,50920,11,51368,51368,11,51816,51816,11,52264,52264,11,52712,52712,11,53160,53160,11,53608,53608,11,54056,54056,11,54504,54504,11,54952,54952,11,68108,68111,5,69933,69940,5,70197,70197,7,70498,70499,7,70845,70845,5,71229,71229,5,71727,71735,5,72154,72155,5,72344,72345,5,73023,73029,5,94095,94098,5,121403,121452,5,126981,127182,14,127538,127546,14,127990,127990,14,128391,128391,14,128445,128449,14,128500,128505,14,128752,128752,14,129160,129167,14,129356,129356,14,129432,129442,14,129648,129651,14,129751,131069,14,173,173,4,1757,1757,1,2274,2274,1,2494,2494,5,2641,2641,5,2876,2876,5,3014,3016,7,3262,3262,7,3393,3396,5,3570,3571,7,3968,3972,5,4228,4228,7,6086,6086,5,6679,6680,5,6912,6915,5,7080,7081,5,7380,7392,5,8252,8252,14,9096,9096,14,9748,9749,14,9784,9786,14,9833,9850,14,9890,9894,14,9938,9938,14,9999,9999,14,10085,10087,14,12349,12349,14,43136,43137,7,43454,43456,7,43755,43755,7,44088,44088,11,44312,44312,11,44536,44536,11,44760,44760,11,44984,44984,11,45208,45208,11,45432,45432,11,45656,45656,11,45880,45880,11,46104,46104,11,46328,46328,11,46552,46552,11,46776,46776,11,47000,47000,11,47224,47224,11,47448,47448,11,47672,47672,11,47896,47896,11,48120,48120,11,48344,48344,11,48568,48568,11,48792,48792,11,49016,49016,11,49240,49240,11,49464,49464,11,49688,49688,11,49912,49912,11,50136,50136,11,50360,50360,11,50584,50584,11,50808,50808,11,51032,51032,11,51256,51256,11,51480,51480,11,51704,51704,11,51928,51928,11,52152,52152,11,52376,52376,11,52600,52600,11,52824,52824,11,53048,53048,11,53272,53272,11,53496,53496,11,53720,53720,11,53944,53944,11,54168,54168,11,54392,54392,11,54616,54616,11,54840,54840,11,55064,55064,11,65438,65439,5,69633,69633,5,69837,69837,1,70018,70018,7,70188,70190,7,70368,70370,7,70465,70468,7,70712,70719,5,70835,70840,5,70850,70851,5,71132,71133,5,71340,71340,7,71458,71461,5,71985,71989,7,72002,72002,7,72193,72202,5,72281,72283,5,72766,72766,7,72885,72886,5,73104,73105,5,92912,92916,5,113824,113827,4,119173,119179,5,121505,121519,5,125136,125142,5,127279,127279,14,127489,127490,14,127570,127743,14,127900,127901,14,128254,128254,14,128369,128370,14,128400,128400,14,128425,128432,14,128468,128475,14,128489,128494,14,128715,128720,14,128745,128745,14,128759,128760,14,129004,129023,14,129296,129304,14,129340,129342,14,129388,129392,14,129404,129407,14,129454,129455,14,129485,129487,14,129659,129663,14,129719,129727,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2363,2363,7,2402,2403,5,2507,2508,7,2622,2624,7,2691,2691,7,2786,2787,5,2881,2884,5,3006,3006,5,3072,3072,5,3170,3171,5,3267,3268,7,3330,3331,7,3406,3406,1,3538,3540,5,3655,3662,5,3897,3897,5,4038,4038,5,4184,4185,5,4352,4447,8,6068,6069,5,6155,6157,5,6448,6449,7,6742,6742,5,6783,6783,5,6966,6970,5,7042,7042,7,7143,7143,7,7212,7219,5,7412,7412,5,8206,8207,4,8294,8303,4,8596,8601,14,9410,9410,14,9742,9742,14,9757,9757,14,9770,9770,14,9794,9794,14,9828,9828,14,9855,9855,14,9882,9882,14,9900,9903,14,9929,9933,14,9963,9967,14,9987,9988,14,10006,10006,14,10062,10062,14,10175,10175,14,11744,11775,5,42607,42607,5,43043,43044,7,43263,43263,5,43444,43445,7,43569,43570,5,43698,43700,5,43766,43766,5,44032,44032,11,44144,44144,11,44256,44256,11,44368,44368,11,44480,44480,11,44592,44592,11,44704,44704,11,44816,44816,11,44928,44928,11,45040,45040,11,45152,45152,11,45264,45264,11,45376,45376,11,45488,45488,11,45600,45600,11,45712,45712,11,45824,45824,11,45936,45936,11,46048,46048,11,46160,46160,11,46272,46272,11,46384,46384,11,46496,46496,11,46608,46608,11,46720,46720,11,46832,46832,11,46944,46944,11,47056,47056,11,47168,47168,11,47280,47280,11,47392,47392,11,47504,47504,11,47616,47616,11,47728,47728,11,47840,47840,11,47952,47952,11,48064,48064,11,48176,48176,11,48288,48288,11,48400,48400,11,48512,48512,11,48624,48624,11,48736,48736,11,48848,48848,11,48960,48960,11,49072,49072,11,49184,49184,11,49296,49296,11,49408,49408,11,49520,49520,11,49632,49632,11,49744,49744,11,49856,49856,11,49968,49968,11,50080,50080,11,50192,50192,11,50304,50304,11,50416,50416,11,50528,50528,11,50640,50640,11,50752,50752,11,50864,50864,11,50976,50976,11,51088,51088,11,51200,51200,11,51312,51312,11,51424,51424,11,51536,51536,11,51648,51648,11,51760,51760,11,51872,51872,11,51984,51984,11,52096,52096,11,52208,52208,11,52320,52320,11,52432,52432,11,52544,52544,11,52656,52656,11,52768,52768,11,52880,52880,11,52992,52992,11,53104,53104,11,53216,53216,11,53328,53328,11,53440,53440,11,53552,53552,11,53664,53664,11,53776,53776,11,53888,53888,11,54000,54000,11,54112,54112,11,54224,54224,11,54336,54336,11,54448,54448,11,54560,54560,11,54672,54672,11,54784,54784,11,54896,54896,11,55008,55008,11,55120,55120,11,64286,64286,5,66272,66272,5,68900,68903,5,69762,69762,7,69817,69818,5,69927,69931,5,70003,70003,5,70070,70078,5,70094,70094,7,70194,70195,7,70206,70206,5,70400,70401,5,70463,70463,7,70475,70477,7,70512,70516,5,70722,70724,5,70832,70832,5,70842,70842,5,70847,70848,5,71088,71089,7,71102,71102,7,71219,71226,5,71231,71232,5,71342,71343,7,71453,71455,5,71463,71467,5,71737,71738,5,71995,71996,5,72000,72000,7,72145,72147,7,72160,72160,5,72249,72249,7,72273,72278,5,72330,72342,5,72752,72758,5,72850,72871,5,72882,72883,5,73018,73018,5,73031,73031,5,73109,73109,5,73461,73462,7,94031,94031,5,94192,94193,7,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,126976,126979,14,127184,127231,14,127344,127345,14,127405,127461,14,127514,127514,14,127561,127567,14,127778,127779,14,127896,127896,14,127985,127986,14,127995,127999,5,128326,128328,14,128360,128366,14,128378,128378,14,128394,128397,14,128405,128406,14,128422,128423,14,128435,128443,14,128453,128464,14,128479,128480,14,128484,128487,14,128496,128498,14,128640,128709,14,128723,128724,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129096,129103,14,129292,129292,14,129311,129311,14,129329,129330,14,129344,129349,14,129360,129374,14,129394,129394,14,129402,129402,14,129413,129425,14,129445,129450,14,129466,129471,14,129483,129483,14,129511,129535,14,129653,129655,14,129667,129670,14,129705,129711,14,129731,129743,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2307,2307,7,2366,2368,7,2382,2383,7,2434,2435,7,2497,2500,5,2519,2519,5,2563,2563,7,2631,2632,5,2677,2677,5,2750,2752,7,2763,2764,7,2817,2817,5,2879,2879,5,2891,2892,7,2914,2915,5,3008,3008,5,3021,3021,5,3076,3076,5,3146,3149,5,3202,3203,7,3264,3265,7,3271,3272,7,3298,3299,5,3390,3390,5,3402,3404,7,3426,3427,5,3535,3535,5,3544,3550,7,3635,3635,7,3763,3763,7,3893,3893,5,3953,3966,5,3981,3991,5,4145,4145,7,4157,4158,5,4209,4212,5,4237,4237,5,4520,4607,10,5970,5971,5,6071,6077,5,6089,6099,5,6277,6278,5,6439,6440,5,6451,6456,7,6683,6683,5,6744,6750,5,6765,6770,7,6846,6846,5,6964,6964,5,6972,6972,5,7019,7027,5,7074,7077,5,7083,7085,5,7146,7148,7,7154,7155,7,7222,7223,5,7394,7400,5,7416,7417,5,8204,8204,5,8233,8233,4,8288,8292,4,8413,8416,5,8482,8482,14,8986,8987,14,9193,9203,14,9654,9654,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9775,14,9792,9792,14,9800,9811,14,9825,9826,14,9831,9831,14,9852,9853,14,9872,9873,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9936,9936,14,9941,9960,14,9974,9974,14,9982,9985,14,9992,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10145,10145,14,11013,11015,14,11503,11505,5,12334,12335,5,12951,12951,14,42612,42621,5,43014,43014,5,43047,43047,7,43204,43205,5,43335,43345,5,43395,43395,7,43450,43451,7,43561,43566,5,43573,43574,5,43644,43644,5,43710,43711,5,43758,43759,7,44005,44005,5,44012,44012,7,44060,44060,11,44116,44116,11,44172,44172,11,44228,44228,11,44284,44284,11,44340,44340,11,44396,44396,11,44452,44452,11,44508,44508,11,44564,44564,11,44620,44620,11,44676,44676,11,44732,44732,11,44788,44788,11,44844,44844,11,44900,44900,11,44956,44956,11,45012,45012,11,45068,45068,11,45124,45124,11,45180,45180,11,45236,45236,11,45292,45292,11,45348,45348,11,45404,45404,11,45460,45460,11,45516,45516,11,45572,45572,11,45628,45628,11,45684,45684,11,45740,45740,11,45796,45796,11,45852,45852,11,45908,45908,11,45964,45964,11,46020,46020,11,46076,46076,11,46132,46132,11,46188,46188,11,46244,46244,11,46300,46300,11,46356,46356,11,46412,46412,11,46468,46468,11,46524,46524,11,46580,46580,11,46636,46636,11,46692,46692,11,46748,46748,11,46804,46804,11,46860,46860,11,46916,46916,11,46972,46972,11,47028,47028,11,47084,47084,11,47140,47140,11,47196,47196,11,47252,47252,11,47308,47308,11,47364,47364,11,47420,47420,11,47476,47476,11,47532,47532,11,47588,47588,11,47644,47644,11,47700,47700,11,47756,47756,11,47812,47812,11,47868,47868,11,47924,47924,11,47980,47980,11,48036,48036,11,48092,48092,11,48148,48148,11,48204,48204,11,48260,48260,11,48316,48316,11,48372,48372,11,48428,48428,11,48484,48484,11,48540,48540,11,48596,48596,11,48652,48652,11,48708,48708,11,48764,48764,11,48820,48820,11,48876,48876,11,48932,48932,11,48988,48988,11,49044,49044,11,49100,49100,11,49156,49156,11,49212,49212,11,49268,49268,11,49324,49324,11,49380,49380,11,49436,49436,11,49492,49492,11,49548,49548,11,49604,49604,11,49660,49660,11,49716,49716,11,49772,49772,11,49828,49828,11,49884,49884,11,49940,49940,11,49996,49996,11,50052,50052,11,50108,50108,11,50164,50164,11,50220,50220,11,50276,50276,11,50332,50332,11,50388,50388,11,50444,50444,11,50500,50500,11,50556,50556,11,50612,50612,11,50668,50668,11,50724,50724,11,50780,50780,11,50836,50836,11,50892,50892,11,50948,50948,11,51004,51004,11,51060,51060,11,51116,51116,11,51172,51172,11,51228,51228,11,51284,51284,11,51340,51340,11,51396,51396,11,51452,51452,11,51508,51508,11,51564,51564,11,51620,51620,11,51676,51676,11,51732,51732,11,51788,51788,11,51844,51844,11,51900,51900,11,51956,51956,11,52012,52012,11,52068,52068,11,52124,52124,11,52180,52180,11,52236,52236,11,52292,52292,11,52348,52348,11,52404,52404,11,52460,52460,11,52516,52516,11,52572,52572,11,52628,52628,11,52684,52684,11,52740,52740,11,52796,52796,11,52852,52852,11,52908,52908,11,52964,52964,11,53020,53020,11,53076,53076,11,53132,53132,11,53188,53188,11,53244,53244,11,53300,53300,11,53356,53356,11,53412,53412,11,53468,53468,11,53524,53524,11,53580,53580,11,53636,53636,11,53692,53692,11,53748,53748,11,53804,53804,11,53860,53860,11,53916,53916,11,53972,53972,11,54028,54028,11,54084,54084,11,54140,54140,11,54196,54196,11,54252,54252,11,54308,54308,11,54364,54364,11,54420,54420,11,54476,54476,11,54532,54532,11,54588,54588,11,54644,54644,11,54700,54700,11,54756,54756,11,54812,54812,11,54868,54868,11,54924,54924,11,54980,54980,11,55036,55036,11,55092,55092,11,55148,55148,11,55216,55238,9,65056,65071,5,65529,65531,4,68097,68099,5,68159,68159,5,69446,69456,5,69688,69702,5,69808,69810,7,69815,69816,7,69821,69821,1,69888,69890,5,69932,69932,7,69957,69958,7,70016,70017,5,70067,70069,7,70079,70080,7,70089,70092,5,70095,70095,5,70191,70193,5,70196,70196,5,70198,70199,5,70367,70367,5,70371,70378,5,70402,70403,7,70462,70462,5,70464,70464,5,70471,70472,7,70487,70487,5,70502,70508,5,70709,70711,7,70720,70721,7,70725,70725,7,70750,70750,5,70833,70834,7,70841,70841,7,70843,70844,7,70846,70846,7,70849,70849,7,71087,71087,5,71090,71093,5,71100,71101,5,71103,71104,5,71216,71218,7,71227,71228,7,71230,71230,7,71339,71339,5,71341,71341,5,71344,71349,5,71351,71351,5,71456,71457,7,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123628,123631,5,125252,125258,5,126980,126980,14,127183,127183,14,127245,127247,14,127340,127343,14,127358,127359,14,127377,127386,14,127462,127487,6,127491,127503,14,127535,127535,14,127548,127551,14,127568,127569,14,127744,127777,14,127780,127891,14,127894,127895,14,127897,127899,14,127902,127984,14,127987,127989,14,127991,127994,14,128000,128253,14,128255,128317,14,128329,128334,14,128336,128359,14,128367,128368,14,128371,128377,14,128379,128390,14,128392,128393,14,128398,128399,14,128401,128404,14,128407,128419,14,128421,128421,14,128424,128424,14,128433,128434,14,128444,128444,14,128450,128452,14,128465,128467,14,128476,128478,14,128481,128481,14,128483,128483,14,128488,128488,14,128495,128495,14,128499,128499,14,128506,128591,14,128710,128714,14,128721,128722,14,128725,128725,14,128728,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129664,129666,14,129671,129679,14,129686,129704,14,129712,129718,14,129728,129730,14,129744,129750,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2259,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3134,3136,5,3142,3144,5,3157,3158,5,3201,3201,5,3260,3260,5,3263,3263,5,3266,3266,5,3270,3270,5,3274,3275,7,3285,3286,5,3328,3329,5,3387,3388,5,3391,3392,7,3398,3400,7,3405,3405,5,3415,3415,5,3457,3457,5,3530,3530,5,3536,3537,7,3542,3542,5,3551,3551,5,3633,3633,5,3636,3642,5,3761,3761,5,3764,3772,5,3864,3865,5,3895,3895,5,3902,3903,7,3967,3967,7,3974,3975,5,3993,4028,5,4141,4144,5,4146,4151,5,4155,4156,7,4182,4183,7,4190,4192,5,4226,4226,5,4229,4230,5,4253,4253,5,4448,4519,9,4957,4959,5,5938,5940,5,6002,6003,5,6070,6070,7,6078,6085,7,6087,6088,7,6109,6109,5,6158,6158,4,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6848,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7673,5,8203,8203,4,8205,8205,13,8232,8232,4,8234,8238,4,8265,8265,14,8293,8293,4,8400,8412,5,8417,8417,5,8421,8432,5,8505,8505,14,8617,8618,14,9000,9000,14,9167,9167,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9776,9783,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9935,14,9937,9937,14,9939,9940,14,9961,9962,14,9968,9973,14,9975,9978,14,9981,9981,14,9986,9986,14,9989,9989,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10084,14,10133,10135,14,10160,10160,14,10548,10549,14,11035,11036,14,11093,11093,14,11647,11647,5,12330,12333,5,12336,12336,14,12441,12442,5,12953,12953,14,42608,42610,5,42654,42655,5,43010,43010,5,43019,43019,5,43045,43046,5,43052,43052,5,43188,43203,7,43232,43249,5,43302,43309,5,43346,43347,7,43392,43394,5,43443,43443,5,43446,43449,5,43452,43453,5,43493,43493,5,43567,43568,7,43571,43572,7,43587,43587,5,43597,43597,7,43696,43696,5,43703,43704,5,43713,43713,5,43756,43757,5,43765,43765,7,44003,44004,7,44006,44007,7,44009,44010,7,44013,44013,5,44033,44059,12,44061,44087,12,44089,44115,12,44117,44143,12,44145,44171,12,44173,44199,12,44201,44227,12,44229,44255,12,44257,44283,12,44285,44311,12,44313,44339,12,44341,44367,12,44369,44395,12,44397,44423,12,44425,44451,12,44453,44479,12,44481,44507,12,44509,44535,12,44537,44563,12,44565,44591,12,44593,44619,12,44621,44647,12,44649,44675,12,44677,44703,12,44705,44731,12,44733,44759,12,44761,44787,12,44789,44815,12,44817,44843,12,44845,44871,12,44873,44899,12,44901,44927,12,44929,44955,12,44957,44983,12,44985,45011,12,45013,45039,12,45041,45067,12,45069,45095,12,45097,45123,12,45125,45151,12,45153,45179,12,45181,45207,12,45209,45235,12,45237,45263,12,45265,45291,12,45293,45319,12,45321,45347,12,45349,45375,12,45377,45403,12,45405,45431,12,45433,45459,12,45461,45487,12,45489,45515,12,45517,45543,12,45545,45571,12,45573,45599,12,45601,45627,12,45629,45655,12,45657,45683,12,45685,45711,12,45713,45739,12,45741,45767,12,45769,45795,12,45797,45823,12,45825,45851,12,45853,45879,12,45881,45907,12,45909,45935,12,45937,45963,12,45965,45991,12,45993,46019,12,46021,46047,12,46049,46075,12,46077,46103,12,46105,46131,12,46133,46159,12,46161,46187,12,46189,46215,12,46217,46243,12,46245,46271,12,46273,46299,12,46301,46327,12,46329,46355,12,46357,46383,12,46385,46411,12,46413,46439,12,46441,46467,12,46469,46495,12,46497,46523,12,46525,46551,12,46553,46579,12,46581,46607,12,46609,46635,12,46637,46663,12,46665,46691,12,46693,46719,12,46721,46747,12,46749,46775,12,46777,46803,12,46805,46831,12,46833,46859,12,46861,46887,12,46889,46915,12,46917,46943,12,46945,46971,12,46973,46999,12,47001,47027,12,47029,47055,12,47057,47083,12,47085,47111,12,47113,47139,12,47141,47167,12,47169,47195,12,47197,47223,12,47225,47251,12,47253,47279,12,47281,47307,12,47309,47335,12,47337,47363,12,47365,47391,12,47393,47419,12,47421,47447,12,47449,47475,12,47477,47503,12,47505,47531,12,47533,47559,12,47561,47587,12,47589,47615,12,47617,47643,12,47645,47671,12,47673,47699,12,47701,47727,12,47729,47755,12,47757,47783,12,47785,47811,12,47813,47839,12,47841,47867,12,47869,47895,12,47897,47923,12,47925,47951,12,47953,47979,12,47981,48007,12,48009,48035,12,48037,48063,12,48065,48091,12,48093,48119,12,48121,48147,12,48149,48175,12,48177,48203,12,48205,48231,12,48233,48259,12,48261,48287,12,48289,48315,12,48317,48343,12,48345,48371,12,48373,48399,12,48401,48427,12,48429,48455,12,48457,48483,12,48485,48511,12,48513,48539,12,48541,48567,12,48569,48595,12,48597,48623,12,48625,48651,12,48653,48679,12,48681,48707,12,48709,48735,12,48737,48763,12,48765,48791,12,48793,48819,12,48821,48847,12,48849,48875,12,48877,48903,12,48905,48931,12,48933,48959,12,48961,48987,12,48989,49015,12,49017,49043,12,49045,49071,12,49073,49099,12,49101,49127,12,49129,49155,12,49157,49183,12,49185,49211,12,49213,49239,12,49241,49267,12,49269,49295,12,49297,49323,12,49325,49351,12,49353,49379,12,49381,49407,12,49409,49435,12,49437,49463,12,49465,49491,12,49493,49519,12,49521,49547,12,49549,49575,12,49577,49603,12,49605,49631,12,49633,49659,12,49661,49687,12,49689,49715,12,49717,49743,12,49745,49771,12,49773,49799,12,49801,49827,12,49829,49855,12,49857,49883,12,49885,49911,12,49913,49939,12,49941,49967,12,49969,49995,12,49997,50023,12,50025,50051,12,50053,50079,12,50081,50107,12,50109,50135,12,50137,50163,12,50165,50191,12,50193,50219,12,50221,50247,12,50249,50275,12,50277,50303,12,50305,50331,12,50333,50359,12,50361,50387,12,50389,50415,12,50417,50443,12,50445,50471,12,50473,50499,12,50501,50527,12,50529,50555,12,50557,50583,12,50585,50611,12,50613,50639,12,50641,50667,12,50669,50695,12,50697,50723,12,50725,50751,12,50753,50779,12,50781,50807,12,50809,50835,12,50837,50863,12,50865,50891,12,50893,50919,12,50921,50947,12,50949,50975,12,50977,51003,12,51005,51031,12,51033,51059,12,51061,51087,12,51089,51115,12,51117,51143,12,51145,51171,12,51173,51199,12,51201,51227,12,51229,51255,12,51257,51283,12,51285,51311,12,51313,51339,12,51341,51367,12,51369,51395,12,51397,51423,12,51425,51451,12,51453,51479,12,51481,51507,12,51509,51535,12,51537,51563,12,51565,51591,12,51593,51619,12,51621,51647,12,51649,51675,12,51677,51703,12,51705,51731,12,51733,51759,12,51761,51787,12,51789,51815,12,51817,51843,12,51845,51871,12,51873,51899,12,51901,51927,12,51929,51955,12,51957,51983,12,51985,52011,12,52013,52039,12,52041,52067,12,52069,52095,12,52097,52123,12,52125,52151,12,52153,52179,12,52181,52207,12,52209,52235,12,52237,52263,12,52265,52291,12,52293,52319,12,52321,52347,12,52349,52375,12,52377,52403,12,52405,52431,12,52433,52459,12,52461,52487,12,52489,52515,12,52517,52543,12,52545,52571,12,52573,52599,12,52601,52627,12,52629,52655,12,52657,52683,12,52685,52711,12,52713,52739,12,52741,52767,12,52769,52795,12,52797,52823,12,52825,52851,12,52853,52879,12,52881,52907,12,52909,52935,12,52937,52963,12,52965,52991,12,52993,53019,12,53021,53047,12,53049,53075,12,53077,53103,12,53105,53131,12,53133,53159,12,53161,53187,12,53189,53215,12,53217,53243,12,53245,53271,12,53273,53299,12,53301,53327,12,53329,53355,12,53357,53383,12,53385,53411,12,53413,53439,12,53441,53467,12,53469,53495,12,53497,53523,12,53525,53551,12,53553,53579,12,53581,53607,12,53609,53635,12,53637,53663,12,53665,53691,12,53693,53719,12,53721,53747,12,53749,53775,12,53777,53803,12,53805,53831,12,53833,53859,12,53861,53887,12,53889,53915,12,53917,53943,12,53945,53971,12,53973,53999,12,54001,54027,12,54029,54055,12,54057,54083,12,54085,54111,12,54113,54139,12,54141,54167,12,54169,54195,12,54197,54223,12,54225,54251,12,54253,54279,12,54281,54307,12,54309,54335,12,54337,54363,12,54365,54391,12,54393,54419,12,54421,54447,12,54449,54475,12,54477,54503,12,54505,54531,12,54533,54559,12,54561,54587,12,54589,54615,12,54617,54643,12,54645,54671,12,54673,54699,12,54701,54727,12,54729,54755,12,54757,54783,12,54785,54811,12,54813,54839,12,54841,54867,12,54869,54895,12,54897,54923,12,54925,54951,12,54953,54979,12,54981,55007,12,55009,55035,12,55037,55063,12,55065,55091,12,55093,55119,12,55121,55147,12,55149,55175,12,55177,55203,12,55243,55291,10,65024,65039,5,65279,65279,4,65520,65528,4,66045,66045,5,66422,66426,5,68101,68102,5,68152,68154,5,68325,68326,5,69291,69292,5,69632,69632,7,69634,69634,7,69759,69761,5]")}},Ot1p:function(mt,Ee,Q){"use strict";var ne=Q("2qtc"),$=Q("kLXV"),O=Q("rAM+"),V=Q("miYZ"),_=Q("tsqr"),P=Q("9og8"),F=Q("tJVT"),N=Q("jrin"),M=Q("WmNS"),k=Q.n(M),d=Q("q1tI"),h=Q.n(d),S=Q("VrN/"),m=Q.n(S),p=Q("bdgK"),v=Q("p77/"),a=Q("Bd2K"),i=Q("ELLl"),s=Q("19Vz"),l=Q("lZu9"),C=Q("+NIl"),g=Q("kSUc"),y=Q("9Bee"),R=function(xe){var Be=xe.value,Ye=Be===void 0?"":Be,ut=xe.className,qe=xe.showTextOnly,yt=xe.showLines,xt=xe.style,et=xt===void 0?{}:xt,Wt=Object(d.useMemo)(function(){return""},[Ye]);return h.a.createElement(h.a.Fragment,null,h.a.createElement("div",{dangerouslySetInnerHTML:{__html:Wt}}))},w=Q("0Owb"),T=Q("dejd"),b=Q("C+DQ"),f=Q("1vsH"),u=Q("m3rI"),L=[{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 x(xe){var Be=xe.onActionCallback,Ye=xe.title,ut=xe.icon,qe=xe.actionName,yt=xe.className,xt=yt===void 0?"":yt,et=xe.children;function Wt(){Be(qe)}return h.a.createElement("a",{title:Ye,className:xt,onClick:Wt},h.a.createElement("i",{className:"md-iconfont ".concat(ut)}),et)}var A=function(xe){var Be=xe.watch,Ye=xe.showNullButton,ut=xe.onActionCallback,qe=xe.fullScreen,yt=xe.insertTemp,xt=xe.hidetoolBar,et=xe.uuid,Wt=xe.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(f.D)("_educoder_session_login"),"&_educoder_session=").concat(Object(f.D)("_educoder_session"),"&key=").concat(et,"&api=").concat(encodeURIComponent(u.a.PROXY_SERVER)));var kt=[].concat(L,[{title:"".concat(Be?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Be?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return h.a.createElement("ul",{className:"markdown-toolbar-container"},!xt&&kt.map(function(Gt,Kt){return h.a.createElement("li",{key:Kt},Gt.actionName?h.a.createElement(x,Object(w.a)({},Gt,{onActionCallback:ut})):h.a.createElement("span",{className:"v-line"}))}),Ye?h.a.createElement("li",null,h.a.createElement(x,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:ut},h.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,yt&&h.a.createElement("li",null,h.a.createElement(x,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(yt),onActionCallback:ut},h.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),h.a.createElement("li",{className:"btn-full-screen"},h.a.createElement(x,{icon:"".concat(qe?"icon-shrink":"icon-enlarge"),title:qe?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:ut})))},I=Q("M8RZ"),W=Q("+L6B"),K=Q("2/Rp"),Z=Q("y8nQ"),z=Q("Vl3Y"),B=Q("5NDa"),ee=Q("5rEg"),ie={labelCol:{span:4},wrapperCol:{span:20}},de=function(xe){var Be=xe.callback,Ye=xe.onCancel;function ut(qe){Be(qe)}return h.a.createElement(z.a,Object(w.a)({},ie,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:ut}),h.a.createElement(z.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},h.a.createElement(ee.a,null)),h.a.createElement(z.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},h.a.createElement(ee.a,null)),h.a.createElement("div",{className:"flex-container flex-end"},h.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),h.a.createElement(K.a,{type:"ghost",onClick:Ye},"\u53D6\u6D88")))},be=Q("7ahc"),Ie=Q("k1fw"),Ae=Q("HmJG"),Re=Q("BjJ7"),ke=z.a.useForm,De={width:280,marginRight:10},ge={labelCol:{span:5},wrapperCol:{span:19}},ue=function(xe){var Be=xe.callback,Ye=xe.onCancel,ut=ke(),qe=Object(F.a)(ut,1),yt=qe[0],xt=Object(d.useRef)();function et(Gt){Be(Object(Ie.a)(Object(Ie.a)({},Gt),{},{name:xt.current}))}function Wt(Gt,Kt){yt.setFieldsValue({src:"/api/attachments/".concat(Gt.id,"?type=").concat(Gt.content_type),type:Kt.type})}function kt(Gt){var Kt=Gt.target.files[0];xt.current=Kt.name,$e(Kt,Wt)}return h.a.createElement(z.a,Object(w.a)({form:yt},ge,{className:"upload-image-panel",onFinish:et}),h.a.createElement(z.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},h.a.createElement("div",{className:"flex-container"},h.a.createElement(z.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},h.a.createElement(ee.a,{style:De})),h.a.createElement(Me,{onFileChange:kt}))),h.a.createElement(z.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},h.a.createElement(ee.a,{style:{width:264}})),h.a.createElement(z.a.Item,{style:{textAlign:"right"}},h.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),h.a.createElement(K.a,{type:"ghost",onClick:Ye},"\u53D6\u6D88")))};function Me(xe){var Be=xe.onFileChange;return h.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",h.a.createElement("input",{type:"file",onChange:Be}))}function $e(xe,Be){if(!xe)throw new String("\u6CA1\u6709\u6587\u4EF6");var Ye=new FormData;Ye.append("editormd-image-file",xe),Ye.append("file_param_name","editormd-image-file"),Ye.append("byxhr","true");var ut=new window.XMLHttpRequest;ut.withCredentials=!0,ut.addEventListener("load",function(qe){Be(JSON.parse(qe.target.responseText),xe)},!1),ut.addEventListener("error",function(qe){console.error(qe)},!1),ut.open("POST","".concat(Re.a,"/api/attachments.json")),ut.send(Ye)}var Ke=Q("giR+"),tt=Q("fyUT"),se=Q("7Kak"),ae=Q("9yH6"),ve=ae.a.Group,we={margin:"0 8px"},Pe=function(xe){var Be=xe.callback,Ye=xe.onCancel;function ut(qe){Be(qe)}return h.a.createElement(z.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:ut},h.a.createElement("div",{className:"flex-container"},h.a.createElement("span",{style:we},"\u5355\u5143\u683C\u6570\uFF1A"),h.a.createElement("span",{style:we},"\u884C\u6570"),h.a.createElement(z.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},h.a.createElement(tt.a,null)),h.a.createElement("span",{style:we},"\u5217\u6570"),h.a.createElement(z.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},h.a.createElement(tt.a,null))),h.a.createElement("div",{className:"flex-container",style:{marginTop:12}},h.a.createElement("span",{style:we},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),h.a.createElement(z.a.Item,{name:"align"},h.a.createElement(ve,null,h.a.createElement(ae.a,{value:"default"},h.a.createElement("i",{className:"fa fa-align-justify"})),h.a.createElement(ae.a,{value:"left"},h.a.createElement("i",{className:"fa fa-align-left"})),h.a.createElement(ae.a,{value:"center"},h.a.createElement("i",{className:"fa fa-align-center"})),h.a.createElement(ae.a,{value:"right"},h.a.createElement("i",{className:"fa fa-align-right"}))))),h.a.createElement("div",{className:"flex-container flex-end"},h.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),h.a.createElement(K.a,{type:"ghost",onClick:Ye},"\u53D6\u6D88")))},_e=Q("ErOA"),Ue=Q("7Cbv"),je="link",at="upload-image",Je="code-block",Qe="add-table",Ve="------------",ht={default:Ve,left:":".concat(Ve),center:":".concat(Ve,":"),right:"".concat(Ve,":")},it=Q("9VGf"),rt,Le;function Xe(){}var lt=0,Oe=1e4,He="\u2581",ye=` **\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 ce(xe){return/^\d+$/.test(xe)?"".concat(xe,"px"):xe}var me=navigator.platform.toUpperCase().indexOf("MAC")>=0,te=me?"Cmd":"Ctrl",re=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],oe=(rt={},Object(N.a)(rt,te+"-B","bold"),Object(N.a)(rt,te+"-I","italic"),rt),he=(Le={},Object(N.a)(Le,je,"\u6DFB\u52A0\u94FE\u63A5"),Object(N.a)(Le,Je,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(N.a)(Le,at,"\u6DFB\u52A0\u6587\u4EF6"),Object(N.a)(Le,Qe,"\u6DFB\u52A0\u8868\u683C"),Le),Te=Ee.a=function(xe){var Be=xe.defaultValue,Ye=Be===void 0?"":Be,ut=xe.onChange,qe=xe.width,yt=qe===void 0?"100%":qe,xt=xe.height,et=xt===void 0?400:xt,Wt=xe.miniToolbar,kt=Wt===void 0?!1:Wt,Gt=xe.isFocus,Kt=Gt===void 0?!1:Gt,Pt=xe.watch,wr=xe.insertTemp,Wr=xe.mode,St=Wr===void 0?"markdown":Wr,Et=xe.id,dt=Et===void 0?"markdown-editor-id":Et,Ct=xe.showResizeBar,Rt=Ct===void 0?!1:Ct,Bt=xe.noStorage,Mt=Bt===void 0?!1:Bt,Tt=xe.showNullButton,pt=Tt===void 0?!1:Tt,lr=xe.hidetoolBar,Lr=lr===void 0?!1:lr,Ar=xe.fullScreen,_t=Ar===void 0?!1:Ar,kr=xe.onBlur,Vr=xe.onCMBeforeChange,rn=xe.onFullScreen,Fe=xe.className,ct=Fe===void 0?"":Fe,Nt=xe.disablePaste,$t=Nt===void 0?!1:Nt,Qt=xe.placeholder,tr=Qt===void 0?"":Qt,H=xe.values,c=H===void 0?"":H,E=Object(d.useState)(null),j=Object(F.a)(E,2),X=j[0],G=j[1],pe=Object(d.useState)(Ye),We=Object(F.a)(pe,2),nt=We[0],gt=We[1],Ge=Object(d.useState)(Pt),Dt=Object(F.a)(Ge,2),Ut=Dt[0],rr=Dt[1],Xr=Object(d.useState)(_t),Yr=Object(F.a)(Xr,2),mr=Yr[0],qr=Yr[1],Gn=Object(d.useState)(""),Pr=Object(F.a)(Gn,2),$r=Pr[0],Hr=Pr[1],bn=Object(d.useState)(0),nn=Object(F.a)(bn,2),mn=nn[0],dn=nn[1],hi=Object(d.useState)(et),zn=Object(F.a)(hi,2),an=zn[0],Jr=zn[1],kn=Object(d.useState)(!1),On=Object(F.a)(kn,2),ci=On[0],or=On[1],Vt=Object(d.useRef)(Object(Ue.a)()),Sr=Object(d.useRef)(!1),zt=Object(d.useRef)(),hr=Object(d.useRef)(),Jt=Object(d.useRef)(),hn=Object(d.useRef)(),ur=Object(d.useRef)(),_r=function(){var bt=Object(P.a)(k.a.mark(function Ot(){var Lt,Ft;return k.a.wrap(function(qt){for(;;)switch(qt.prev=qt.next){case 0:return qt.next=2,Object(_e.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Vt.current}});case 2:Ft=qt.sent,Ft!=null&&(Lt=Ft.attachments)!==null&&Lt!==void 0&&Lt.length&&(console.log("cm:",X,hr),Ft.attachments.map(function(Ht){Ht.content_type.indexOf("image")>-1?X.replaceSelection("![,](/api/attachments/".concat(Ht.id,"?type=").concat(Ht.content_type,")")):Ht.content_type.indexOf("video")>-1?X.replaceSelection('')):Ht.content_type.indexOf("pdf")>-1?X.replaceSelection('
    ').concat(Ht.name,"")):X.replaceSelection("[".concat(Ht.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(Ht.id,"?type=").concat(Ht.content_type,")"))}));case 4:case"end":return qt.stop()}},Ot)}));return function(){return bt.apply(this,arguments)}}();Object(d.useEffect)(function(){gt(c),X==null||X.setValue(c)},[c]),Object(d.useEffect)(function(){rn==null||rn(mr)},[mr]),Object(d.useEffect)(function(){if(hr.current){var bt=m.a.fromTextArea(hr.current,{mode:St,lineNumbers:!kt,lineWrapping:!0,value:Ye,autoCloseTags:!0,autoCloseBrackets:!0});Kt&&bt.focus();function Ot(Lt,Ft){if($t){Ft.preventDefault();return}var Xt=Ft.clipboardData;if(Xt){var qt=Xt.types.toString(),Ht=Xt.items;if(qt==="Files"||Xt.types.indexOf("Files")>-1){if(Ft.preventDefault(),St=="stex")return;try{var cr,Ir=Ht[1];((cr=Ht[0])===null||cr===void 0?void 0:cr.kind)==="file"&&(Ir=Ht[0]);var jt=Ir.getAsFile(),En=jt.name.split(".").pop();$e(jt,function(Yt){if(Yt.id){var vr,en,tn;(jt==null||((vr=jt.type)===null||vr===void 0)?void 0:vr.indexOf("image"))>-1?bt.replaceSelection("![,](/api/attachments/".concat(Yt.id,"?type=").concat(Yt.content_type,")")):(jt==null||((en=jt.type)===null||en===void 0)?void 0:en.indexOf("video"))>-1?bt.replaceSelection('')):(jt==null||((tn=jt.type)===null||tn===void 0)?void 0:tn.indexOf("pdf"))>-1?bt.replaceSelection('').concat(jt.name,"")):re.includes(En)?bt.replaceSelection('').concat(jt.name,"")):bt.replaceSelection("[".concat(jt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(Yt.id,"?type=").concat(Yt.content_type,")"))}else(Yt==null?void 0:Yt.status)===401&&(document.location.href="/user/login")})}catch(Yt){_.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return bt.on("paste",Ot),bt.on("dragleave",function(Lt,Ft){Jt.current.classList.remove("mouse-hover-md")}),bt.on("dragover",function(Lt,Ft){Jt.current.classList.add("mouse-hover-md")}),bt.on("drop",function(Lt,Ft){Jt.current.classList.add("mouse-hover-md");var Xt;if(Xt=Ft.dataTransfer.files,Xt.length>0){Ft.preventDefault(),Ft.stopPropagation();for(var qt=function(Ir){var jt=Xt[Ir],En=jt.name.split(".").pop();$e(jt,function(Yt){if(Yt.id){var vr,en,tn;(jt==null||((vr=jt.type)===null||vr===void 0)?void 0:vr.indexOf("image"))>-1?bt.replaceSelection("![,](/api/attachments/".concat(Yt.id,"?type=").concat(Yt.content_type,")")):(jt==null||((en=jt.type)===null||en===void 0)?void 0:en.indexOf("video"))>-1?bt.replaceSelection('')):(jt==null||((tn=jt.type)===null||tn===void 0)?void 0:tn.indexOf("pdf"))>-1?bt.replaceSelection('').concat(jt.name,"")):re.includes(En)?bt.replaceSelection('').concat(jt.name,"")):bt.replaceSelection("[".concat(jt.name,"](").concat(u.a.API_SERVER,"/api/attachments/").concat(Yt.id,"?type=").concat(Yt.content_type,")"))}else(Yt==null?void 0:Yt.status)===401&&(document.location.href="/user/login")})},Ht=0;Ht0||Ht.target.offsetWidth>0)&&(Kn(),X.setSize("100%","100%"),X.refresh())}}catch(cr){Xt.e(cr)}finally{Xt.f()}});return Lt.observe(hr.current.parentElement),Lt}if(X){var Ot=bt();return function(){Ot.unobserve(hr.current.parentElement)}}},[X,Kn]),Object(d.useEffect)(function(){if(X){for(var bt=[],Ot=function(){var Ht=Ft[Lt];Xt=Object(F.a)(Ht,2);var cr=Xt[0],Ir=Xt[1],jt=Object(N.a)({},cr,function(){Vn(Ir)});bt.push(jt),X.addKeyMap(jt)},Lt=0,Ft=Object.entries(oe);Lt0){var bt=new Date().getTime(),Ot=window.sessionStorage.getItem(dt);bt>=mn+Oe&&(!Ot||Ot!==nt)&&(window.sessionStorage.setItem(dt,nt),or(!0))}},Oe),Object(d.useEffect)(function(){rr(Pt)},[X,Pt]),Object(d.useEffect)(function(){X&&(Kt&&X.focus())},[X,Kt]),Object(d.useEffect)(function(){if(Ut&&X){var bt=X.getScrollerElement();function Ot(Lt){var Ft=Lt.target;if(ur.current){var Xt=Ft.scrollTop/Ft.scrollHeight;ur.current.scrollTop=ur.current.scrollHeight*Xt}}return bt.addEventListener("scroll",Ot),function(){bt.removeEventListener("scroll",Ot)}}},[X,Ut]),Object(d.useEffect)(function(){if(X&&Vr){function bt(Ot,Lt){Vr(Ot,Lt)}return X.on("beforeChange",bt),function(){X.off("beforeChange",bt)}}},[X,Vr]),Object(d.useEffect)(function(){if(X&&kr){function bt(){kr(X.getValue())}return X.on("blur",bt),function(){X.off("blur",bt)}}},[X,kr]),Object(d.useEffect)(function(){if(X){function bt(Ot){var Lt=Ot.getValue();gt(Lt),dn(new Date().getTime()),Ot.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),ut&&ut(Lt)}return X.on("change",bt),function(){X.off("change",bt)}}},[X,ut]),Object(d.useEffect)(function(){X&&(Ye==null?(X.setValue(""),gt("")):Ye!==X.getValue()&&(X.setValue(Ye),gt(Ye),X.setCursor(X.lineCount(),0)))},[X,Ye]);var Vn=Object(d.useCallback)(function(bt){var Ot=X.getCursor(),Lt=X.getSelection(),Ft=Lt.split(` `);switch(bt){case"bold":return X.replaceSelection("**"+Lt+"**"),Lt===""&&X.setCursor(Ot.line,Ot.ch+2),X.focus();case"italic":return X.replaceSelection("*"+Lt+"*"),Lt===""&&X.setCursor(Ot.line,Ot.ch+1),X.focus();case"code":return X.replaceSelection("`"+Lt+"`"),Lt===""&&X.setCursor(Ot.line,Ot.ch+1),X.focus();case"inline-latex":return X.replaceSelection("`$$"+Lt+"$$`"),Lt===""&&X.setCursor(Ot.line,Ot.ch+3),X.focus();case"latex":return X.replaceSelection("```latex\n"+Lt+"\n```"),X.setCursor(Ot.line+1,Lt.length+1),X.focus();case"line-break":return X.replaceSelection(`
    `),X.focus();case"list-ul":return Lt===""?X.replaceSelection("- "+Lt):X.replaceSelection(Ft.map(function(Xt){return Xt===""?"":"- ".concat(Xt)}).join(` `)),X.focus();case"list-ol":return Lt===""?X.replaceSelection("1. "+Lt):X.replaceSelection(Ft.map(function(Xt,qt){return Xt===""?"":"".concat(qt+1,". ").concat(Xt)}).join(` `)),X.focus();case"add-null-ch":return Lt===""&&X.setCursor(Ot.line,Ot.ch+1),X.replaceSelection(He),X.focus();case"inster-template-1":return Lt===""&&X.setCursor(Ot.line,Ot.ch),X.replaceSelection(ye),X.focus();case"eraser":return X.setValue(""),X.focus();case"trigger-watch":return rr(!Ut),X.focus();case"trigger-full-screen":return qr(!mr),X.focus();case je:Hr(je);return;case Je:Hr(Je);return;case at:Hr(at);return;case Qe:Hr(Qe);return;default:throw new Error}},[X,Ut,mr]),xn=Object(d.useCallback)(function(bt){Hr("");switch($r){case je:var Ot=bt.title,Lt=bt.link;return X.replaceSelection("[".concat(Ot,"](").concat(Lt,")")),X.focus();case Je:var Ft=bt.language,Xt=bt.content;return X.replaceSelection(["```"+Ft,Xt,"```"].join(` `)),X.focus();case at:var qt=bt.src,Ht=bt.alt,cr=bt.name;return qt.indexOf("type=image")>-1?X.replaceSelection("![ ".concat(Ht||""," ]( ").concat(qt,' "').concat(Ht||"",'" )')):qt.indexOf("type=application/pdf")>-1?X.replaceSelection('').concat(cr,"")):X.replaceSelection('').concat(cr,"")),X.focus();case Qe:for(var Ir=bt.row,jt=bt.col,En=bt.align,Yt=` `,vr=0;vr300&&(cr=300);var Ir=et+cr+"px";Jr(Ir)}}return bt.addEventListener("mousedown",Ft),document.addEventListener("mousemove",qt),document.addEventListener("mouseup",Xt),function(){bt.removeEventListener("mousedown",Ft),document.removeEventListener("mousemove",qt),document.removeEventListener("mouseup",Xt)}}},[X,hn]),Object(d.useEffect)(function(){Jr(et)},[et]);var fi=ce(yt),on=ce(an),Xn={width:fi,height:on},ji=Object(d.useMemo)(function(){if(mn){var bt=new Date(mn),Ot=bt.getHours(),Lt=bt.getMinutes(),Ft=bt.getSeconds();return Ot=Ot<10?"0"+Ot:Ot,Lt=Lt<10?"0"+Lt:Lt,Ft=Ft<10?"0"+Ft:Ft,"".concat(Ot,":").concat(Lt,":").concat(Ft)}return 0},[mn]);function Mn(){window.sessionStorage.removeItem(dt),or(!1),dn(0)}function $a(){or(!1),dn(0),X.setValue(window.sessionStorage.getItem(dt))}function da(bt,Ot){var Lt=X.getValue();Lt=Lt.replace(bt,Ot),gt(Lt),X==null||X.setValue(Lt)}return h.a.createElement(d.Fragment,null,h.a.createElement("div",{className:"markdown-editor-wrapper",ref:Jt},h.a.createElement("div",{className:"markdown-editor-container ".concat(ct," ").concat(Ut?"on-preview":""," ").concat(kt?"mini":""," ").concat(mr?"full-screen":""),style:Xn},h.a.createElement(A,{insertTemp:wr,watch:Ut,fullScreen:mr,showNullButton:pt,onActionCallback:Vn,hidetoolBar:Lr,uuid:Vt.current,setOpenPhones:function(){Sr.current=!0}}),h.a.createElement("div",{className:"markdown-editor-body"},h.a.createElement("div",{className:"codemirror-container"},h.a.createElement("textarea",{ref:hr,placeholder:tr})),Ut?h.a.createElement("div",{ref:ur,className:"preview-container"},St==="stex"&&h.a.createElement(R,{value:nt}),St!=="stex"&&h.a.createElement(y.a,{edit:!0,value:nt,replaces:da})):null))),Rt?h.a.createElement("a",{ref:hn,className:"editor-resize"}):null,h.a.createElement(I.a,null,he[$r]?h.a.createElement($.a,{centered:!0,title:he[$r],visible:!0,onCancel:Gr,footer:null},Ui):null))}},QDVR:function(mt,Ee,Q){"use strict";Q.d(Ee,"e",function(){return $}),Q.d(Ee,"d",function(){return O}),Q.d(Ee,"c",function(){return F}),Q.d(Ee,"b",function(){return N}),Q.d(Ee,"a",function(){return k});var ne=function(){var d=function(h,S){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,p){m.__proto__=p}||function(m,p){for(var v in p)p.hasOwnProperty(v)&&(m[v]=p[v])},d(h,S)};return function(h,S){d(h,S);function m(){this.constructor=h}h.prototype=S===null?Object.create(S):(m.prototype=S.prototype,new m)}}();function $(d){var h=[];return d.forEach(function(S){return h.push(S)}),h}function O(d){var h=[];return d.forEach(function(S,m){return h.push(m)}),h}var V=function(){function d(){this._value="",this._pos=0}return d.prototype.reset=function(h){return this._value=h,this._pos=0,this},d.prototype.next=function(){return this._pos+=1,this},d.prototype.hasNext=function(){return this._pos0)p.left||(p.left=new P,p.left.segment=m.value()),p=p.left;else if(v<0)p.right||(p.right=new P,p.right.segment=m.value()),p=p.right;else if(m.hasNext())m.next(),p.mid||(p.mid=new P,p.mid.segment=m.value()),p=p.mid;else break}var a=p.value;return p.value=S,p.key=h,a},d.prototype.get=function(h){for(var S=this._iter.reset(h),m=this._root;m;){var p=S.cmp(m.segment);if(p>0)m=m.left;else if(p<0)m=m.right;else if(S.hasNext())S.next(),m=m.mid;else break}return m?m.value:void 0},d.prototype.findSubstr=function(h){for(var S=this._iter.reset(h),m=this._root,p=void 0;m;){var v=S.cmp(m.segment);if(v>0)m=m.left;else if(v<0)m=m.right;else if(S.hasNext())S.next(),p=m.value||p,m=m.mid;else break}return m&&m.value||p},d.prototype.forEach=function(h){this._forEach(this._root,h)},d.prototype._forEach=function(h,S){h&&(this._forEach(h.left,S),h.value&&S(h.value,h.key),this._forEach(h.mid,S),this._forEach(h.right,S))},d}(),N=function(){function d(){this.map=new Map,this.ignoreCase=!1}return d.prototype.set=function(h,S){this.map.set(this.toKey(h),S)},d.prototype.get=function(h){return this.map.get(this.toKey(h))},d.prototype.toKey=function(h){var S=h.toString();return this.ignoreCase&&(S=S.toLowerCase()),S},d}(),M=function(){function d(){this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0}return d.prototype.clear=function(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0},Object.defineProperty(d.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),d.prototype.get=function(h,S){S===void 0&&(S=0);var m=this._map.get(h);return m?(S!==0&&this.touch(m,S),m.value):void 0},d.prototype.set=function(h,S,m){m===void 0&&(m=0);var p=this._map.get(h);if(p)p.value=S,m!==0&&this.touch(p,m);else{p={key:h,value:S,next:void 0,previous:void 0};switch(m){case 0:this.addItemLast(p);break;case 1:this.addItemFirst(p);break;case 2:this.addItemLast(p);break;default:this.addItemLast(p);break}this._map.set(h,p),this._size++}},d.prototype.delete=function(h){return!!this.remove(h)},d.prototype.remove=function(h){var S=this._map.get(h);return S?(this._map.delete(h),this.removeItem(S),this._size--,S.value):void 0},d.prototype.forEach=function(h,S){for(var m=this._head;m;)S?h.bind(S)(m.value,m.key,this):h(m.value,m.key,this),m=m.next},d.prototype.trimOld=function(h){if(h>=this.size)return;if(h===0){this.clear();return}for(var S=this._head,m=this.size;S&&m>h;)this._map.delete(S.key),S=S.next,m--;this._head=S,this._size=m,S&&(S.previous=void 0)},d.prototype.addItemFirst=function(h){if(!this._head&&!this._tail)this._tail=h;else if(this._head)h.next=this._head,this._head.previous=h;else throw new Error("Invalid list");this._head=h},d.prototype.addItemLast=function(h){if(!this._head&&!this._tail)this._head=h;else if(this._tail)h.previous=this._tail,this._tail.next=h;else throw new Error("Invalid list");this._tail=h},d.prototype.removeItem=function(h){if(h===this._head&&h===this._tail)this._head=void 0,this._tail=void 0;else if(h===this._head){if(!h.next)throw new Error("Invalid list");h.next.previous=void 0,this._head=h.next}else if(h===this._tail){if(!h.previous)throw new Error("Invalid list");h.previous.next=void 0,this._tail=h.previous}else{var S=h.next,m=h.previous;if(!S||!m)throw new Error("Invalid list");S.previous=m,m.next=S}h.next=void 0,h.previous=void 0},d.prototype.touch=function(h,S){if(!this._head||!this._tail)throw new Error("Invalid list");if(S!==1&&S!==2)return;if(S===1){if(h===this._head)return;var m=h.next,p=h.previous;h===this._tail?(p.next=void 0,this._tail=p):(m.previous=p,p.next=m),h.previous=void 0,h.next=this._head,this._head.previous=h,this._head=h}else if(S===2){if(h===this._tail)return;var m=h.next,p=h.previous;h===this._head?(m.previous=void 0,this._head=m):(m.previous=p,p.next=m),h.next=void 0,h.previous=this._tail,this._tail.next=h,this._tail=h}},d.prototype.toJSON=function(){var h=[];return this.forEach(function(S,m){h.push([m,S])}),h},d}(),k=function(d){ne(h,d);function h(S,m){m===void 0&&(m=1);var p=d.call(this)||this;return p._limit=S,p._ratio=Math.min(Math.max(0,m),1),p}return h.prototype.get=function(S){return d.prototype.get.call(this,S,2)},h.prototype.peek=function(S){return d.prototype.get.call(this,S,0)},h.prototype.set=function(S,m){d.prototype.set.call(this,S,m,2),this.checkTrim()},h.prototype.checkTrim=function(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))},h}(M)},RotF:function(mt,Ee,Q){mt.exports=Q("LSTS")},SJMd:function(mt,Ee){/** * @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 Q,ne,$,O=!1,V,_;window.PR_SHOULD_USE_CONTINUATION=!0;var P,F;(function(){var N=window,M=["break,continue,do,else,for,if,return,while"],k=[M,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],d=[k,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],h=[d,"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"],S=[d,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],m=[d,"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"],p="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",v=[d,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],a="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",i=[M,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],s=[M,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],l=[M,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],C=[h,m,S,v,a,i,s,l],g=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,y="str",R="kwd",w="com",T="typ",b="lit",f="pun",u="pln",L="tag",x="dec",A="src",I="atn",W="atv",K="nocode",Z="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function z(ae){for(var ve=0,we=!1,Pe=!1,_e=0,Ue=ae.length;_e122||(te<65||me>90||Xe.push([Math.max(65,me)|32,Math.min(te,90)|32]),te<97||me>122||Xe.push([Math.max(97,me)&~32,Math.min(te,122)&~32]))}}Xe.sort(function(Te,xe){return Te[0]-xe[0]||xe[1]-Te[1]});for(var re=[],oe=[],He=0;Hehe[0]&&(he[1]+1>he[0]&&Oe.push("-"),Oe.push(Qe(he[1])))}return Oe.push("]"),Oe.join("")}function ht(rt){for(var Le=rt.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")),Xe=Le.length,lt=[],Oe=0,He=0;Oe=2&&me==="["?Le[Oe]=Ve(ye):me!=="\\"&&(Le[Oe]=ye.replace(/[a-zA-Z]/g,function(oe){var he=oe.charCodeAt(0);return"["+String.fromCharCode(he&~32,he|32)+"]"}))}return Le.join("")}for(var it=[],_e=0,Ue=ae.length;_e=0;)we[it.charAt(rt)]=ht;var Le=ht[1],Xe=""+Le;Je.hasOwnProperty(Xe)||(at.push(Le),Je[Xe]=null)}at.push(/[\0-\uffff]/),Pe=z(at)})();var _e=ve.length,Ue=function(je){for(var at=je.sourceCode,Je=je.basePos,Qe=je.sourceNode,Ve=[Je,u],ht=0,it=at.match(Pe)||[],rt={},Le=0,Xe=it.length;Le=5&&Oe.substring(0,5)==="lang-",ye&&!(He&&typeof He[1]=="string")&&(ye=!1,Oe=A),ye||(rt[lt]=Oe)}var te=ht;if(ht+=lt.length,!ye)Ve.push(Je+te,Oe);else{var re=He[1],oe=lt.indexOf(re),he=oe+re.length;He[2]&&(he=lt.length-He[2].length,oe=he-re.length);var Te=Oe.substring(5);ee(Qe,Je+te,lt.substring(0,oe),Ue,Ve),ee(Qe,Je+te+oe,re,ue(Te,re),Ve),ee(Qe,Je+te+he,lt.substring(he),Ue,Ve)}}je.decorations=Ve};return Ue}function Ie(ae){var ve=[],we=[];ae.tripleQuotedStrings?ve.push([y,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ae.multiLineStrings?ve.push([y,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):ve.push([y,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ae.verbatimStrings&&we.push([y,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Pe=ae.hashComments;Pe&&(ae.cStyleComments?(Pe>1?ve.push([w,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):ve.push([w,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),we.push([y,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):ve.push([w,/^#[^\r\n]*/,null,"#"])),ae.cStyleComments&&(we.push([w,/^\/\/[^\r\n]*/,null]),we.push([w,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var _e=ae.regexLiterals;if(_e){var Ue=_e>1?"":` \r`,je=Ue?".":"[\\S\\s]",at="/(?=[^/*"+Ue+"])(?:[^/\\x5B\\x5C"+Ue+"]|\\x5C"+je+"|\\x5B(?:[^\\x5C\\x5D"+Ue+"]|\\x5C"+je+")*(?:\\x5D|$))+/";we.push(["lang-regex",RegExp("^"+Z+"("+at+")")])}var Je=ae.types;Je&&we.push([T,Je]);var Qe=(""+ae.keywords).replace(/^ | $/g,"");Qe.length&&we.push([R,new RegExp("^(?:"+Qe.replace(/[\s,]+/g,"|")+")\\b"),null]),ve.push([u,/^\s+/,null,` \r \xA0`]);var Ve="^.[^\\s\\w.$@'\"`/\\\\]*";return ae.regexLiterals&&(Ve+="(?!s*/)"),we.push([b,/^@[a-z_$][a-z_$@0-9]*/i,null],[T,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[u,/^[a-z_$][a-z_$@0-9]*/i,null],[b,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[u,/^\\[\s\S]?/,null],[f,new RegExp(Ve),null]),be(ve,we)}var Ae=Ie({keywords:C,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Re(ae,ve,we){for(var Pe=/(?:^|\s)nocode(?:\s|$)/,_e=/\r\n?|\n/,Ue=ae.ownerDocument,je=Ue.createElement("li");ae.firstChild;)je.appendChild(ae.firstChild);var at=[je];function Je(Le){var Xe=Le.nodeType;if(Xe==1&&!Pe.test(Le.className))if(Le.nodeName==="br")Qe(Le),Le.parentNode&&Le.parentNode.removeChild(Le);else for(var lt=Le.firstChild;lt;lt=lt.nextSibling)Je(lt);else if((Xe==3||Xe==4)&&we){var Oe=Le.nodeValue,He=Oe.match(_e);if(He){var ye=Oe.substring(0,He.index);Le.nodeValue=ye;var ce=Oe.substring(He.index+He[0].length);if(ce){var me=Le.parentNode;me.insertBefore(Ue.createTextNode(ce),Le.nextSibling)}Qe(Le),ye||Le.parentNode.removeChild(Le)}}}function Qe(Le){for(;!Le.nextSibling;)if(Le=Le.parentNode,!Le)return;function Xe(He,ye){var ce=ye?He.cloneNode(!1):He,me=He.parentNode;if(me){var te=Xe(me,1),re=He.nextSibling;te.appendChild(ce);for(var oe=re;oe;oe=re)re=oe.nextSibling,te.appendChild(oe)}return ce}for(var lt=Xe(Le.nextSibling,0),Oe;(Oe=lt.parentNode)&&Oe.nodeType===1;)lt=Oe;at.push(lt)}for(var Ve=0;Ve=me&&(Je+=2),Ue>=te&&(ht+=2)}}finally{Oe&&(Oe.style.display=He)}}var De={};function ge(ae,ve){for(var we=ve.length;--we>=0;){var Pe=ve[we];De.hasOwnProperty(Pe)?N.console&&console.warn("cannot override language handler %s",Pe):De[Pe]=ae}}function ue(ae,ve){return ae&&De.hasOwnProperty(ae)||(ae=/^\s*]*(?:>|$)/],[w,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[f,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ge(be([[u,/^[\s]+/,null,` \r `],[W,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[L,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[I,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[f,/^[=<>\/]+/],["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"]),ge(be([],[[W,/^[\s\S]+/]]),["uq.val"]),ge(Ie({keywords:h,hashComments:!0,cStyleComments:!0,types:g}),["c","cc","cpp","cxx","cyc","m"]),ge(Ie({keywords:"null,true,false"}),["json"]),ge(Ie({keywords:m,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:g}),["cs"]),ge(Ie({keywords:S,cStyleComments:!0}),["java"]),ge(Ie({keywords:l,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ge(Ie({keywords:i,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ge(Ie({keywords:a,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ge(Ie({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ge(Ie({keywords:v,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ge(Ie({keywords:p,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ge(be([],[[y,/^[\s\S]+/]]),["regex"]);function Me(ae){var ve=ae.langExtension;try{var we=B(ae.sourceNode,ae.pre),Pe=we.sourceCode;ae.sourceCode=Pe,ae.spans=we.spans,ae.basePos=0,ue(ve,Pe)(ae),ke(ae)}catch(_e){N.console&&console.log(_e&&_e.stack||_e)}}function $e(ae,ve,we){var Pe=we||!1,_e=ve||null,Ue=document.createElement("div");Ue.innerHTML="
    "+ae+"
    ",Ue=Ue.firstChild,Pe&&Re(Ue,Pe,!0);var je={langExtension:_e,numberLines:Pe,sourceNode:Ue,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Me(je),Ue.innerHTML}function Ke(ae,ve){var we=ve||document.body,Pe=we.ownerDocument||document;function _e(ce){return we.getElementsByTagName(ce)}for(var Ue=[_e("pre"),_e("code"),_e("xmp")],je=[],at=0;at=0){var l=i.split("!=");return N.create(l[0].trim(),this._deserializeValue(l[1],s))}if(i.indexOf("==")>=0){var l=i.split("==");return F.create(l[0].trim(),this._deserializeValue(l[1],s))}if(i.indexOf("=~")>=0){var l=i.split("=~");return k.create(l[0].trim(),this._deserializeRegexValue(l[1],s))}return/^\!\s*/.test(i)?M.create(i.substr(1).trim()):P.create(i)},a._deserializeValue=function(i,s){if(i=i.trim(),i==="true")return!0;if(i==="false")return!1;var l=/^'([^']*)'$/.exec(i);return l?l[1].trim():i},a._deserializeRegexValue=function(i,s){if(Object(ne.x)(i)){if(s)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}var l=i.indexOf("/"),C=i.lastIndexOf("/");if(l===C||l<0){if(s)throw new Error("bad regexp-value '"+i+"', missing /-enclosure");return console.warn("bad regexp-value '"+i+"', missing /-enclosure"),null}var g=i.slice(l+1,C),y=i[C+1]==="i"?"i":"";try{return new RegExp(g,y)}catch(R){if(s)throw new Error("bad regexp-value '"+i+"', parse error: "+R);return console.warn("bad regexp-value '"+i+"', parse error: "+R),null}},a}();function _(a,i){var s=a.getType(),l=i.getType();if(s!==l)return s-l;switch(s){case 1:return a.cmp(i);case 2:return a.cmp(i);case 3:return a.cmp(i);case 4:return a.cmp(i);case 6:return a.cmp(i);case 7:return a.cmp(i);case 5:return a.cmp(i);default:throw new Error("Unknown ContextKeyExpr!")}}var P=function(){function a(i){this.key=i}return a.create=function(i){return new a(i)},a.prototype.getType=function(){return 1},a.prototype.cmp=function(i){return this.keyi.key?1:0},a.prototype.equals=function(i){return i instanceof a?this.key===i.key:!1},a.prototype.evaluate=function(i){return!!i.getValue(this.key)},a.prototype.keys=function(){return[this.key]},a.prototype.negate=function(){return M.create(this.key)},a}(),F=function(){function a(i,s){this.key=i,this.value=s}return a.create=function(i,s){return typeof s=="boolean"?s?P.create(i):M.create(i):new a(i,s)},a.prototype.getType=function(){return 3},a.prototype.cmp=function(i){return this.keyi.key?1:this.valuei.value?1:0},a.prototype.equals=function(i){return i instanceof a?this.key===i.key&&this.value===i.value:!1},a.prototype.evaluate=function(i){return i.getValue(this.key)==this.value},a.prototype.keys=function(){return[this.key]},a.prototype.negate=function(){return N.create(this.key,this.value)},a}(),N=function(){function a(i,s){this.key=i,this.value=s}return a.create=function(i,s){return typeof s=="boolean"?s?M.create(i):P.create(i):new a(i,s)},a.prototype.getType=function(){return 4},a.prototype.cmp=function(i){return this.keyi.key?1:this.valuei.value?1:0},a.prototype.equals=function(i){return i instanceof a?this.key===i.key&&this.value===i.value:!1},a.prototype.evaluate=function(i){return i.getValue(this.key)!=this.value},a.prototype.keys=function(){return[this.key]},a.prototype.negate=function(){return F.create(this.key,this.value)},a}(),M=function(){function a(i){this.key=i}return a.create=function(i){return new a(i)},a.prototype.getType=function(){return 2},a.prototype.cmp=function(i){return this.keyi.key?1:0},a.prototype.equals=function(i){return i instanceof a?this.key===i.key:!1},a.prototype.evaluate=function(i){return!i.getValue(this.key)},a.prototype.keys=function(){return[this.key]},a.prototype.negate=function(){return P.create(this.key)},a}(),k=function(){function a(i,s){this.key=i,this.regexp=s}return a.create=function(i,s){return new a(i,s)},a.prototype.getType=function(){return 6},a.prototype.cmp=function(i){if(this.keyi.key)return 1;var s=this.regexp?this.regexp.source:"",l=i.regexp?i.regexp.source:"";return sl?1:0},a.prototype.equals=function(i){if(i instanceof a){var s=this.regexp?this.regexp.source:"",l=i.regexp?i.regexp.source:"";return this.key===i.key&&s===l}return!1},a.prototype.evaluate=function(i){var s=i.getValue(this.key);return this.regexp?this.regexp.test(s):!1},a.prototype.keys=function(){return[this.key]},a.prototype.negate=function(){return d.create(this)},a}(),d=function(){function a(i){this._actual=i}return a.create=function(i){return new a(i)},a.prototype.getType=function(){return 7},a.prototype.cmp=function(i){return this._actual.cmp(i._actual)},a.prototype.equals=function(i){return i instanceof a?this._actual.equals(i._actual):!1},a.prototype.evaluate=function(i){return!this._actual.evaluate(i)},a.prototype.keys=function(){return this._actual.keys()},a.prototype.negate=function(){return this._actual},a}(),h=function(){function a(i){this.expr=i}return a.create=function(i){var s=a._normalizeArr(i);return s.length===0?void 0:s.length===1?s[0]:new a(s)},a.prototype.getType=function(){return 5},a.prototype.cmp=function(i){if(this.expr.lengthi.expr.length)return 1;for(var s=0,l=this.expr.length;s1;){for(var y=i.shift(),R=i.shift(),w=[],T=0,b=g(y);T=15&&(h=!1,M=!0);var y=s&&(k||h&&(g==null||g<12.11)),R=O||F&&N>=9;function w(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var T=function(e,t){var n=e.className,r=w(t).exec(n);if(r){var o=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(o?r[1]+o:"")}};function b(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function f(e,t){return b(e).appendChild(t)}function u(e,t,n,r){var o=document.createElement(e);if(n&&(o.className=n),r&&(o.style.cssText=r),typeof t=="string")o.appendChild(document.createTextNode(t));else if(t)for(var D=0;D=t)return U+(t-D);U+=Y-D,U+=n-U%n,D=Y+1}}var ie=function(){this.id=null,this.f=null,this.time=0,this.handler=z(this.onTimeout,this)};ie.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ie.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n=t)return r+Math.min(U,t-o);if(o+=D-r,o+=n-o%n,r=D+1,o>=t)return r}}var ge=[""];function ue(e){for(;ge.length<=e;)ge.push(Me(ge)+" ");return ge[e]}function Me(e){return e[e.length-1]}function $e(e,t){for(var n=[],r=0;r"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ae.test(e))}function we(e,t){return t?t.source.indexOf("\\w")>-1&&ve(e)?!0:t.test(e):ve(e)}function Pe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var _e=/[\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 Ue(e){return e.charCodeAt(0)>=768&&_e.test(e)}function je(e,t,n){for(;(n<0?t>0:tn?-1:1;;){if(t==n)return t;var o=(t+n)/2,D=r<0?Math.ceil(o):Math.floor(o);if(D==t)return e(D)?t:n;e(D)?n=D:t=D+r}}function Je(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var o=!1,D=0;Dt||t==n&&U.to==t)&&(r(Math.max(U.from,t),Math.min(U.to,n),U.level==1?"rtl":"ltr",D),o=!0)}o||r(t,n,"ltr")}var Qe=null;function Ve(e,t,n){var r;Qe=null;for(var o=0;ot)return o;D.to==t&&(D.from!=D.to&&n=="before"?r=o:Qe=o),D.from==t&&(D.from!=D.to&&n!="before"?r=o:Qe=o)}return r!=null?r:Qe}var ht=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(q){return q<=247?e.charAt(q):1424<=q&&q<=1524?"R":1536<=q&&q<=1785?t.charAt(q-1536):1774<=q&&q<=2220?"r":8192<=q&&q<=8203?"w":q==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,D=/[LRr]/,U=/[Lb1n]/,Y=/[1n]/;function J(q,le,fe){this.level=q,this.from=le,this.to=fe}return function(q,le){var fe=le=="ltr"?"L":"R";if(q.length==0||le=="ltr"&&!r.test(q))return!1;for(var Ce=q.length,Se=[],Ne=0;Ne-1&&(r[t]=o.slice(0,D).concat(o.slice(D+1)))}}}function Oe(e,t){var n=Xe(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),o=0;o0}function me(e){e.prototype.on=function(t,n){Le(this,t,n)},e.prototype.off=function(t,n){lt(this,t,n)}}function te(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function re(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function oe(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function he(e){te(e),re(e)}function Te(e){return e.target||e.srcElement}function xe(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 Be=function(){if(F&&N<9)return!1;var e=u("div");return"draggable"in e||"dragDrop"in e}(),Ye;function ut(e){if(Ye==null){var t=u("span","\u200B");f(e,u("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ye=t.offsetWidth<=1&&t.offsetHeight>2&&!(F&&N<8))}var n=Ye?u("span","\u200B"):u("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var qe;function yt(e){if(qe!=null)return qe;var t=f(e,document.createTextNode("A\u062EA")),n=x(t,0,1).getBoundingClientRect(),r=x(t,1,2).getBoundingClientRect();return b(e),!n||n.left==n.right?!1:qe=r.right-n.right<3}var xt=` b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var o=e.indexOf(` `,t);o==-1&&(o=e.length);var D=e.slice(t,e.charAt(o-1)=="\r"?o-1:o),U=D.indexOf("\r");U!=-1?(n.push(D.slice(0,U)),t+=U+1):(n.push(D),t=o+1)}return n}:function(e){return e.split(/\r\n?|\n/)},et=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},Wt=function(){var e=u("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),kt=null;function Gt(e){if(kt!=null)return kt;var t=f(e,u("span","x")),n=t.getBoundingClientRect(),r=x(t,0,1).getBoundingClientRect();return kt=Math.abs(n.left-r.left)>1}var Kt={},Pt={};function wr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Kt[e]=t}function Wr(e,t){Pt[e]=t}function St(e){if(typeof e=="string"&&Pt.hasOwnProperty(e))e=Pt[e];else if(e&&typeof e.name=="string"&&Pt.hasOwnProperty(e.name)){var t=Pt[e.name];typeof t=="string"&&(t={name:t}),e=se(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return St("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return St("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Et(e,t){t=St(t);var n=Kt[t.name];if(!n)return Et(e,"text/plain");var r=n(e,t);if(dt.hasOwnProperty(t.name)){var o=dt[t.name];for(var D in o){if(!o.hasOwnProperty(D))continue;r.hasOwnProperty(D)&&(r["_"+D]=r[D]),r[D]=o[D]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var U in t.modeProps)r[U]=t.modeProps[U];return r}var dt={};function Ct(e,t){var n=dt.hasOwnProperty(e)?dt[e]:dt[e]={};B(t,n)}function Rt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var o=t[r];o instanceof Array&&(o=o.concat([])),n[r]=o}return n}function Bt(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 Mt(e,t,n){return e.startState?e.startState(t,n):!0}var Tt=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};Tt.prototype.eol=function(){return this.pos>=this.string.length},Tt.prototype.sol=function(){return this.pos==this.lineStart},Tt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Tt.prototype.next=function(){if(this.post},Tt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Tt.prototype.skipToEnd=function(){this.pos=this.string.length},Tt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Tt.prototype.backUp=function(e){this.pos-=e},Tt.prototype.column=function(){return this.lastColumnPos0?null:(D&&t!==!1&&(this.pos+=D[0].length),D)}},Tt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Tt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Tt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Tt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function pt(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 o=n.children[r],D=o.chunkSize();if(t=e.first&&tn?Fe(n,pt(e,n).text.length):E(t,pt(e,t.line).text.length)}function E(e,t){var n=e.ch;return n==null||n>t?Fe(e.line,t):n<0?Fe(e.line,0):e}function j(e,t){for(var n=[],r=0;rthis.maxLookAhead&&(this.maxLookAhead=e),t},G.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},G.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},G.fromSaved=function(e,t,n){return t instanceof X?new G(e,Rt(e.mode,t.state),n,t.lookAhead):new G(e,Rt(e.mode,t),n)},G.prototype.save=function(e){var t=e!==!1?Rt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new X(t,this.maxLookAhead):t};function pe(e,t,n,r){var o=[e.state.modeGen],D={};Yr(e,t.text,e.doc.mode,n,function(q,le){return o.push(q,le)},D,r);for(var U=n.state,Y=function(q){n.baseTokens=o;var le=e.state.overlays[q],fe=1,Ce=0;n.state=!0,Yr(e,t.text,le.mode,n,function(Se,Ne){for(var ze=fe;CeSe&&o.splice(fe,1,Se,o[fe+1],Ze),fe+=2,Ce=Math.min(Se,Ze)}if(!Ne)return;if(le.opaque)o.splice(ze,fe-ze,Se,"overlay "+Ne),fe=ze+2;else for(;zee.options.maxHighlightLength&&Rt(e.doc.mode,r.state),D=pe(e,t,r);o&&(r.state=o),t.stateAfter=r.save(!o),t.styles=D.styles,D.classes?t.styleClasses=D.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function nt(e,t,n){var r=e.doc,o=e.display;if(!r.mode.startState)return new G(r,!0,t);var D=mr(e,t,n),U=D>r.first&&pt(r,D-1).stateAfter,Y=U?G.fromSaved(r,U,D):new G(r,Mt(r.mode),D);return r.iter(D,t,function(J){gt(e,J.text,Y);var q=Y.line;J.stateAfter=q==t-1||q%5==0||q>=o.viewFrom&&qt.start)return D}throw new Error("Mode "+e.name+" failed to advance stream.")}var Ut=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function rr(e,t,n,r){var o=e.doc,D=o.mode,U;t=c(o,t);var Y=pt(o,t.line),J=nt(e,t.line,n),q=new Tt(Y.text,e.options.tabSize,J),le;for(r&&(le=[]);(r||q.pose.options.maxHighlightLength?(Y=!1,U&>(e,t,r,le.pos),le.pos=t.length,fe=null):fe=Xr(Dt(n,le,r.state,Ce),D),Ce){var Se=Ce[0].name;Se&&(fe="m-"+(fe?Se+" "+fe:Se))}if(!Y||q!=fe){for(;JU;--Y){if(Y<=D.first)return D.first;var J=pt(D,Y-1),q=J.stateAfter;if(q&&(!n||Y+(q instanceof X?q.lookAhead:0)<=D.modeFrontier))return Y;var le=ee(J.text,null,e.options.tabSize);(o==null||r>le)&&(o=Y-1,r=le)}return o}function qr(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontiern;r--){var o=pt(e,r).stateAfter;if(o&&(!(o instanceof X)||r+o.lookAhead=t:D.to>t);(r||(r=[])).push(new bn(U,D.from,J?null:D.to))}}return r}function zn(e,t,n){var r;if(e)for(var o=0;o=t:D.to>t);if(Y||D.from==t&&U.type=="bookmark"&&(!n||D.marker.insertLeft)){var J=D.from==null||(U.inclusiveLeft?D.from<=t:D.from0&&Y)for(var vt=0;vt0)continue;var le=[J,1],fe=ct(q.from,Y.from),Ce=ct(q.to,Y.to);(fe<0||!U.inclusiveLeft&&!fe)&&le.push({from:q.from,to:Y.from}),(Ce>0||!U.inclusiveRight&&!Ce)&&le.push({from:Y.to,to:q.to}),o.splice.apply(o,le),J+=le.length-3}return o}function On(e){var t=e.markedSpans;if(!t)return;for(var n=0;nt)&&(!r||Sr(r,D.marker)<0)&&(r=D.marker)}return r}function ur(e,t,n,r,o){var D=pt(e,t),U=Pr&&D.markedSpans;if(U)for(var Y=0;Y=0&&fe<=0||le<=0&&fe>=0)continue;if(le<=0&&(J.marker.inclusiveRight&&o.inclusiveLeft?ct(q.to,n)>=0:ct(q.to,n)>0)||le>=0&&(J.marker.inclusiveRight&&o.inclusiveLeft?ct(q.from,r)<=0:ct(q.from,r)<0))return!0}}function _r(e){for(var t;t=hr(e);)e=t.find(-1,!0).line;return e}function Kn(e){for(var t;t=Jt(e);)e=t.find(1,!0).line;return e}function Vn(e){for(var t,n;t=Jt(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function xn(e,t){var n=pt(e,t),r=_r(n);return n==r?t:_t(r)}function Ui(e,t){if(t>e.lastLine())return t;var n=pt(e,t),r;if(!Gr(e,n))return t;for(;r=Jt(n);)n=r.find(1,!0).line;return _t(n)+1}function Gr(e,t){var n=Pr&&t.markedSpans;if(n)for(var r=void 0,o=0;ot.maxLineLength&&(t.maxLineLength=o,t.maxLine=r)})}var Mn=function(e,t,n){this.text=e,ci(this,t),this.height=n?n(this):1};Mn.prototype.lineNo=function(){return _t(this)},me(Mn);function $a(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),On(e),ci(e,n);var o=r?r(e):1;o!=e.height&&Ar(e,o)}function da(e){e.parent=null,On(e)}var bt={},Ot={};function Lt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Ot:bt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Ft(e,t){var n=L("span",null,null,M?"padding-right: .1px":null),r={pre:L("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var o=0;o<=(t.rest?t.rest.length:0);o++){var D=o?t.rest[o-1]:t.line,U=void 0;r.pos=0,r.addToken=qt,yt(e.display.measure)&&(U=it(D,e.doc.direction))&&(r.addToken=cr(r.addToken,U)),r.map=[];var Y=t!=e.display.externalMeasured&&_t(D);jt(D,r,We(e,D,Y)),D.styleClasses&&(D.styleClasses.bgClass&&(r.bgClass=K(D.styleClasses.bgClass,r.bgClass||"")),D.styleClasses.textClass&&(r.textClass=K(D.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ut(e.display.measure))),o==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(M){var J=r.content.lastChild;(/\bcm-tab\b/.test(J.className)||J.querySelector&&J.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Oe(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=K(r.pre.className,r.textClass||"")),r}function Xt(e){var t=u("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,o,D,U){if(!t)return;var Y=e.splitSpaces?Ht(t,e.trailingSpace):t,J=e.cm.state.specialChars,q=!1,le;if(!J.test(t))e.col+=t.length,le=document.createTextNode(Y),e.map.push(e.pos,e.pos+t.length,le),F&&N<9&&(q=!0),e.pos+=t.length;else{le=document.createDocumentFragment();for(var fe=0;;){J.lastIndex=fe;var Ce=J.exec(t),Se=Ce?Ce.index-fe:t.length-fe;if(Se){var Ne=document.createTextNode(Y.slice(fe,fe+Se));F&&N<9?le.appendChild(u("span",[Ne])):le.appendChild(Ne),e.map.push(e.pos,e.pos+Se,Ne),e.col+=Se,e.pos+=Se}if(!Ce)break;fe+=Se+1;var ze=void 0;if(Ce[0]==" "){var Ze=e.cm.options.tabSize,ot=Ze-e.col%Ze;ze=le.appendChild(u("span",ue(ot),"cm-tab")),ze.setAttribute("role","presentation"),ze.setAttribute("cm-text"," "),e.col+=ot}else Ce[0]=="\r"||Ce[0]==` `?(ze=le.appendChild(u("span",Ce[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),ze.setAttribute("cm-text",Ce[0]),e.col+=1):(ze=e.cm.options.specialCharPlaceholder(Ce[0]),ze.setAttribute("cm-text",Ce[0]),F&&N<9?le.appendChild(u("span",[ze])):le.appendChild(ze),e.col+=1);e.map.push(e.pos,e.pos+1,ze),e.pos++}}if(e.trailingSpace=Y.charCodeAt(t.length-1)==32,n||r||o||q||D||U){var ft=n||"";r&&(ft+=r),o&&(ft+=o);var st=u("span",[le],ft,D);if(U)for(var vt in U)U.hasOwnProperty(vt)&&vt!="style"&&vt!="class"&&st.setAttribute(vt,U[vt]);return e.content.appendChild(st)}e.content.appendChild(le)}function Ht(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",o=0;oq&&fe.from<=q);Ce++);if(fe.to>=le)return e(n,r,o,D,U,Y,J);e(n,r.slice(0,fe.to-q),o,D,null,Y,J),D=null,r=r.slice(fe.to-q),q=fe.to}}}function Ir(e,t,n,r){var o=!r&&n.widgetNode;o&&e.map.push(e.pos,e.pos+t,o),!r&&e.cm.display.input.needsContentAttribute&&(o||(o=e.content.appendChild(document.createElement("span"))),o.setAttribute("cm-marker",n.id)),o&&(e.cm.display.input.setUneditable(o),e.content.appendChild(o)),e.pos+=t,e.trailingSpace=!1}function jt(e,t,n){var r=e.markedSpans,o=e.text,D=0;if(!r){for(var U=1;UJ||It.collapsed&&wt.to==J&&wt.from==J)){if(wt.to!=null&&wt.to!=J&&Se>wt.to&&(Se=wt.to,ze=""),It.className&&(Ne+=" "+It.className),It.css&&(Ce=(Ce?Ce+";":"")+It.css),It.startStyle&&wt.from==J&&(Ze+=" "+It.startStyle),It.endStyle&&wt.to==Se&&(vt||(vt=[])).push(It.endStyle,wt.to),It.title&&((ft||(ft={})).title=It.title),It.attributes)for(var nr in It.attributes)(ft||(ft={}))[nr]=It.attributes[nr];It.collapsed&&(!ot||Sr(ot.marker,It)<0)&&(ot=wt)}else wt.from>J&&Se>wt.from&&(Se=wt.from)}if(vt)for(var xr=0;xr=Y)break;for(var Kr=Math.min(Y,Se);;){if(le){var Br=J+le.length;if(!ot){var fr=Br>Kr?le.slice(0,Kr-J):le;t.addToken(t,fr,fe?fe+Ne:Ne,Ze,J+fr.length==Se?ze:"",Ce,ft)}if(Br>=Kr){le=le.slice(Kr-J),J=Kr;break}J=Br,Ze=""}le=o.slice(D,D=n[q++]),fe=Lt(n[q++],t.cm.options)}}}function En(e,t,n){this.line=t,this.rest=Vn(t),this.size=this.rest?_t(Me(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Gr(e,t)}function Yt(e,t,n){for(var r=[],o,D=t;D2&&D.push((J.bottom+q.top)/2-n.top)}}D.push(n.bottom-n.top)}}function ro(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;rn)return{map:e.measure.maps[o],cache:e.measure.caches[o],before:!0}}function Us(e,t){t=_r(t);var n=_t(t),r=e.display.externalMeasured=new En(e.doc,t,n);r.lineN=n;var o=r.built=Ft(e,r);return r.text=o.pre,f(e.display.lineMeasure,o.pre),r}function no(e,t,n,r){return fn(e,Yn(e,t),n,r)}function pa(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt)&&(D=J-Y,o=D-1,t>=J&&(U="right")),o!=null){if(r=e[q+2],Y==J&&n==(r.insertLeft?"left":"right")&&(U=n),n=="left"&&o==0)for(;q&&e[q-2]==e[q-3]&&e[q-1].insertLeft;)r=e[(q-=3)+2],U="left";if(n=="right"&&o==J-Y)for(;q=0&&!((n=e[o]).left!=n.right);o--);return n}function Ws(e,t,n,r){var o=ao(t.map,n,r),D=o.node,U=o.start,Y=o.end,J=o.collapse,q;if(D.nodeType==3){for(var le=0;le<4;le++){for(;U&&Ue(t.line.text.charAt(o.coverStart+U));)--U;for(;o.coverStart+Y0&&(J=r="right");var fe;e.options.lineWrapping&&(fe=D.getClientRects()).length>1?q=fe[r=="right"?fe.length-1:0]:q=D.getBoundingClientRect()}if(F&&N<9&&!U&&(!q||!q.left&&!q.right)){var Ce=D.parentNode.getClientRects()[0];Ce?q={left:Ce.left,right:Ce.left+Jn(e.display),top:Ce.top,bottom:Ce.bottom}:q=io}for(var Se=q.top-t.rect.top,Ne=q.bottom-t.rect.top,ze=(Se+Ne)/2,Ze=t.view.measure.heights,ot=0;ot=r.text.length?(J=r.text.length,q="before"):J<=0&&(J=0,q="after"),!Y)return U(q=="before"?J-1:J,q=="before");function le(Ne,ze,Ze){var ot=Y[ze],ft=ot.level==1;return U(Ze?Ne-1:Ne,ft!=Ze)}var fe=Ve(Y,J,q),Ce=Qe,Se=le(J,fe,q=="before");return Ce!=null&&(Se.other=le(J,Ce,q!="before")),Se}function co(e,t){var n=0;t=c(e.doc,t),e.options.lineWrapping||(n=Jn(e.display)*t.ch);var r=pt(e.doc,t.line),o=on(r)+Hi(e.display);return{left:n,right:n,top:o,bottom:o+r.height}}function va(e,t,n,r,o){var D=Fe(e,t,n);return D.xRel=o,r&&(D.outside=r),D}function ya(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return va(r.first,0,null,-1,-1);var o=kr(r,n),D=r.first+r.size-1;if(o>D)return va(r.first+r.size-1,pt(r,D).text.length,null,1,1);t<0&&(t=0);for(var U=pt(r,o);;){var Y=Gs(e,U,o,t,n),J=hn(U,Y.ch+(Y.xRel>0||Y.outside>0?1:0));if(!J)return Y;var q=J.find(1);if(q.line==o)return q;U=pt(r,o=q.line)}}function fo(e,t,n,r){r-=ma(t);var o=t.text.length,D=at(function(U){return fn(e,n,U-1).bottom<=r},o,0);return o=at(function(U){return fn(e,n,U).top>r},D,o),{begin:D,end:o}}function po(e,t,n,r){n||(n=Yn(e,t));var o=Gi(e,t,fn(e,n,r),"line").top;return fo(e,t,n,o)}function ba(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Gs(e,t,n,r,o){o-=on(t);var D=Yn(e,t),U=ma(t),Y=0,J=t.text.length,q=!0,le=it(t,e.doc.direction);if(le){var fe=(e.options.lineWrapping?Ks:zs)(e,t,n,D,le,r,o);q=fe.level!=1,Y=q?fe.from:fe.to-1,J=q?fe.to:fe.from-1}var Ce=null,Se=null,Ne=at(function(At){var wt=fn(e,D,At);return wt.top+=U,wt.bottom+=U,ba(wt,r,o,!1)?(wt.top<=o&&wt.left<=r&&(Ce=At,Se=wt),!0):!1},Y,J),ze,Ze,ot=!1;if(Se){var ft=r-Se.left=vt.bottom?1:0}return Ne=je(t.text,Ne,1),va(n,Ne,Ze,ot,r-ze)}function zs(e,t,n,r,o,D,U){var Y=at(function(fe){var Ce=o[fe],Se=Ce.level!=1;return ba(sn(e,Fe(n,Se?Ce.to:Ce.from,Se?"before":"after"),"line",t,r),D,U,!0)},0,o.length-1),J=o[Y];if(Y>0){var q=J.level!=1,le=sn(e,Fe(n,q?J.from:J.to,q?"after":"before"),"line",t,r);ba(le,D,U,!0)&&le.top>U&&(J=o[Y-1])}return J}function Ks(e,t,n,r,o,D,U){var Y=fo(e,t,r,U),J=Y.begin,q=Y.end;/\s/.test(t.text.charAt(q-1))&&q--;for(var le=null,fe=null,Ce=0;Ce=q||Se.to<=J)continue;var Ne=Se.level!=1,ze=fn(e,r,Ne?Math.min(q,Se.to)-1:Math.max(J,Se.from)).right,Ze=zeZe)&&(le=Se,fe=Ze)}return le||(le=o[o.length-1]),le.fromq&&(le={from:le.from,to:q,level:le.level}),le}var _n;function $n(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(_n==null){_n=u("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)_n.appendChild(document.createTextNode("x")),_n.appendChild(u("br"));_n.appendChild(document.createTextNode("x"))}f(e.measure,_n);var n=_n.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),b(e.measure),n||1}function Jn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=u("span","xxxxxxxxxx"),n=u("pre",[t],"CodeMirror-line-like");f(e.measure,n);var r=t.getBoundingClientRect(),o=(r.right-r.left)/10;return o>2&&(e.cachedCharWidth=o),o||10}function xa(e){for(var t=e.display,n={},r={},o=t.gutters.clientLeft,D=t.gutters.firstChild,U=0;D;D=D.nextSibling,++U){var Y=e.display.gutterSpecs[U].className;n[Y]=D.offsetLeft+D.clientLeft+o,r[Y]=D.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function mo(e){var t=$n(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Jn(e.display)-3);return function(o){if(Gr(e.doc,o))return 0;var D=0;if(o.widgets)for(var U=0;U0&&(q=pt(e.doc,J.line).text).length==J.ch){var le=ee(q,q.length,e.options.tabSize)-q.length;J=Fe(J.line,Math.max(0,Math.round((D-to(e.display).left)/Jn(e.display))-le))}return J}function Nn(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;rt)&&(o.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=o.viewTo)Pr&&xn(e.doc,t)o.viewFrom?Cn(e):(o.viewFrom+=r,o.viewTo+=r);else if(t<=o.viewFrom&&n>=o.viewTo)Cn(e);else if(t<=o.viewFrom){var D=zi(e,n,n+r,1);D?(o.view=o.view.slice(D.index),o.viewFrom=D.lineN,o.viewTo+=r):Cn(e)}else if(n>=o.viewTo){var U=zi(e,t,t,-1);U?(o.view=o.view.slice(0,U.index),o.viewTo=U.lineN):Cn(e)}else{var Y=zi(e,t,t,-1),J=zi(e,n,n+r,1);Y&&J?(o.view=o.view.slice(0,Y.index).concat(Yt(e,Y.lineN,J.lineN)).concat(o.view.slice(J.index)),o.viewTo+=r):Cn(e)}var q=o.externalMeasured;q&&(n=o.lineN&&t=r.viewTo)return;var D=r.view[Nn(e,t)];if(D.node==null)return;var U=D.changes||(D.changes=[]);de(U,n)==-1&&U.push(n)}function Cn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function zi(e,t,n,r){var o=Nn(e,t),D,U=e.display.view;if(!Pr||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var Y=e.display.viewFrom,J=0;J0){if(o==U.length-1)return null;D=Y+U[o].size-t,o++}else D=Y-t;t+=D,n+=D}for(;xn(e.doc,n)!=n;){if(o==(r<0?0:U.length-1))return null;n+=r*U[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function Vs(e,t,n){var r=e.display,o=r.view;o.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=Yt(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Yt(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,Nn(e,n)))),r.viewTo=n}function go(e){for(var t=e.display.view,n=0,r=0;r=e.display.viewTo||Y.to().line0?t.blinker=setInterval(function(){e.hasFocus()||Zn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function bo(e){e.state.focused||(e.display.input.focus(),Ta(e))}function xo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Zn(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Oe(e,"focus",e,t),e.state.focused=!0,W(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),M&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ca(e)}function Zn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Oe(e,"blur",e,t),e.state.focused=!1,T(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Vi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r.005||le<-.005)&&(Ar(o.line,U),Eo(o.line),o.rest))for(var fe=0;fee.display.sizerWidth){var Ce=Math.ceil(Y/Jn(e.display));Ce>e.display.maxLineLength&&(e.display.maxLineLength=Ce,e.display.maxLine=o.line,e.display.maxLineChanged=!0)}}}function Eo(e){if(e.widgets)for(var t=0;t=U&&(D=kr(t,on(pt(t,J))-e.wrapper.clientHeight),U=J)}return{from:D,to:Math.max(U,D+1)}}function Ys(e,t){if(He(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),o=null;if(t.top+r.top<0?o=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(o=!1),o!=null&&!p){var D=u("div","\u200B",null,`position: absolute; top: `+(t.top-n.viewOffset-Hi(e.display))+`px; height: `+(t.bottom-t.top+cn(e)+n.barHeight)+`px; left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(D),D.scrollIntoView(o),e.display.lineSpace.removeChild(D)}}function $s(e,t,n,r){r==null&&(r=0);var o;!e.options.lineWrapping&&t==n&&(t=t.ch?Fe(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Fe(t.line,t.ch+1,"before"):t);for(var D=0;D<5;D++){var U=!1,Y=sn(e,t),J=!n||n==t?Y:sn(e,n);o={left:Math.min(Y.left,J.left),top:Math.min(Y.top,J.top)-r,right:Math.max(Y.left,J.left),bottom:Math.max(Y.bottom,J.bottom)+r};var q=wa(e,o),le=e.doc.scrollTop,fe=e.doc.scrollLeft;if(q.scrollTop!=null&&(xi(e,q.scrollTop),Math.abs(e.doc.scrollTop-le)>1&&(U=!0)),q.scrollLeft!=null&&(Fn(e,q.scrollLeft),Math.abs(e.doc.scrollLeft-fe)>1&&(U=!0)),!U)break}return o}function Js(e,t){var n=wa(e,t);n.scrollTop!=null&&xi(e,n.scrollTop),n.scrollLeft!=null&&Fn(e,n.scrollLeft)}function wa(e,t){var n=e.display,r=$n(e.display);t.top<0&&(t.top=0);var o=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,D=fa(e),U={};t.bottom-t.top>D&&(t.bottom=t.top+D);var Y=e.doc.height+ca(n),J=t.topY-r;if(t.topo+D){var le=Math.min(t.top,(q?Y:t.bottom)-D);le!=o&&(U.scrollTop=le)}var fe=e.options.fixedGutter?0:n.gutters.offsetWidth,Ce=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-fe,Se=Pn(e)-n.gutters.offsetWidth,Ne=t.right-t.left>Se;return Ne&&(t.right=t.left+Se),t.left<10?U.scrollLeft=0:t.leftSe+Ce-3&&(U.scrollLeft=t.right+(Ne?0:10)-Se),U}function La(e,t){if(t==null)return;Yi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Qn(e){Yi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function bi(e,t,n){(t!=null||n!=null)&&Yi(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Zs(e,t){Yi(e),e.curOp.scrollToPos=t}function Yi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=co(e,t.from),r=co(e,t.to);So(e,n,r,t.margin)}}function So(e,t,n,r){var o=wa(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});bi(e,o.scrollLeft,o.scrollTop)}function xi(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;O||Da(e,{top:t}),Co(e,t,!0),O&&Da(e),Ci(e,100)}function Co(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 Fn(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,Do(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function Ei(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ca(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+cn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Bn=function(e,t,n){this.cm=n;var r=this.vert=u("div",[u("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),o=this.horiz=u("div",[u("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=o.tabIndex=-1,e(r),e(o),Le(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Le(o,"scroll",function(){o.clientWidth&&t(o.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,F&&N<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Bn.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 o=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+o)+"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 D=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+D)+"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}},Bn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Bn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Bn.prototype.zeroWidthHack=function(){var e=s&&!m?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ie,this.disableVert=new ie},Bn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var o=e.getBoundingClientRect(),D=n=="vert"?document.elementFromPoint(o.right-1,(o.top+o.bottom)/2):document.elementFromPoint((o.right+o.left)/2,o.bottom-1);D!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Bn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Si=function(){};Si.prototype.update=function(){return{bottom:0,right:0}},Si.prototype.setScrollLeft=function(){},Si.prototype.setScrollTop=function(){},Si.prototype.clear=function(){};function qn(e,t){t||(t=Ei(e));var n=e.display.barWidth,r=e.display.barHeight;To(e,t);for(var o=0;o<4&&n!=e.display.barWidth||r!=e.display.barHeight;o++)n!=e.display.barWidth&&e.options.lineWrapping&&Vi(e),To(e,Ei(e)),n=e.display.barWidth,r=e.display.barHeight}function To(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 wo={native:Bn,null:Si};function Lo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&T(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new wo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Le(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?Fn(e,t):xi(e,t)},e),e.display.scrollbars.addClass&&W(e.display.wrapper,e.display.scrollbars.addClass)}var Qs=0;function Un(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Qs},en(e.curOp)}function jn(e){var t=e.curOp;t&&Wi(t,function(n){for(var r=0;r=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new $i(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Aa(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Vi(t),e.barMeasure=Ei(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=no(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+cn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Pn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=nt(e,t.highlightFrontier),o=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(D){if(r.line>=e.display.viewFrom){var U=D.styles,Y=D.text.length>e.options.maxHighlightLength?Rt(t.mode,r.state):null,J=pe(e,D,r,!0);Y&&(r.state=Y),D.styles=J.styles;var q=D.styleClasses,le=J.classes;le?D.styleClasses=le:q&&(D.styleClasses=null);for(var fe=!U||U.length!=D.styles.length||q!=le&&(!q||!le||q.bgClass!=le.bgClass||q.textClass!=le.textClass),Ce=0;!fe&&Cen)return Ci(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),o.length&&zr(e,function(){for(var D=0;D=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&go(e)==0)return!1;Ro(e)&&(Cn(e),t.dims=xa(e));var o=r.first+r.size,D=Math.max(t.visible.from-e.options.viewportMargin,r.first),U=Math.min(o,t.visible.to+e.options.viewportMargin);n.viewFromU&&n.viewTo-U<20&&(U=Math.min(o,n.viewTo)),Pr&&(D=xn(e.doc,D),U=Ui(e.doc,U));var Y=D!=n.viewFrom||U!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,D,U),n.viewOffset=on(pt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var J=go(e);if(!Y&&J==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var q=sl(e);return J>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),J>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(q),b(n.cursorDiv),b(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,Y&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Ci(e,400)),n.updateLineNumbers=null,!0}function Ao(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Pn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ca(e.display)-fa(e),n.top)}),t.visible=Xi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Xi(e.display,e.doc,n));if(!Aa(e,t))break;Vi(e);var o=Ei(e);yi(e),qn(e,o),ka(e,o),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 Da(e,t){var n=new $i(e,t);if(Aa(e,n)){Vi(e),Ao(e,n);var r=Ei(e);yi(e),qn(e,r),ka(e,r),n.finish()}}function ul(e,t,n){var r=e.display,o=e.options.lineNumbers,D=r.lineDiv,U=D.firstChild;function Y(Ne){var ze=Ne.nextSibling;return M&&s&&e.display.currentWheelTarget==Ne?Ne.style.display="none":Ne.parentNode.removeChild(Ne),ze}for(var J=r.view,q=r.viewFrom,le=0;le-1&&(Se=!1),Ja(e,fe,q,n)),Se&&(b(fe.lineNumber),fe.lineNumber.appendChild(document.createTextNode(rn(e.options,q)))),U=fe.node.nextSibling}q+=fe.size}for(;U;)U=Y(U)}function Ra(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function ka(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+cn(e)+"px"}function Do(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,o=t.gutters.offsetWidth,D=r+"px",U=0;UU.clientWidth,J=U.scrollHeight>U.clientHeight;if(!(r&&Y||o&&J))return;if(o&&s&&M){e:for(var q=t.target,le=D.view;q!=U;q=q.parentNode)for(var fe=0;fe=0&&ct(e,r.to())<=0)return n}return-1};var Zt=function(e,t){this.anchor=e,this.head=t};Zt.prototype.from=function(){return tr(this.anchor,this.head)},Zt.prototype.to=function(){return Qt(this.anchor,this.head)},Zt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function ln(e,t,n){var r=e&&e.options.selectionsMayTouch,o=t[n];t.sort(function(Ce,Se){return ct(Ce.from(),Se.from())}),n=de(t,o);for(var D=1;D0:J>=0){var q=tr(Y.from(),U.from()),le=Qt(Y.to(),U.to()),fe=Y.empty()?U.from()==U.head:Y.from()==Y.head;D<=n&&--n,t.splice(--D,2,new Zt(fe?le:q,fe?q:le))}}return new Qr(t,n)}function Tn(e,t){return new Qr([new Zt(e,t||e)],0)}function wn(e){return e.text?Fe(e.from.line+e.text.length-1,Me(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Po(e,t){if(ct(e,t.from)<0)return e;if(ct(e,t.to)<=0)return wn(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+=wn(t).ch-t.to.ch),Fe(n,r)}function Ma(e,t){for(var n=[],r=0;r1&&e.remove(Y.line+1,Ne-1),e.insert(Y.line+1,ot)}Cr(e,"change",e,t)}function Ln(e,t,n){function r(o,D,U){if(o.linked)for(var Y=0;Y1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Me(e.done)}function Uo(e,t,n,r){var o=e.history;o.undone.length=0;var D=+new Date,U,Y;if((o.lastOp==r||o.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&o.lastModTime>D-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(U=pl(o,o.lastOp==r)))Y=Me(U.changes),ct(t.from,t.to)==0&&ct(t.from,Y.to)==0?Y.to=wn(t):U.changes.push(Ia(e,t));else{var J=Me(o.done);for((!J||!J.ranges)&&Qi(e.sel,o.done),U={changes:[Ia(e,t)],generation:o.generation},o.done.push(U);o.done.length>o.undoDepth;)o.done.shift(),o.done[0].ranges||o.done.shift()}o.done.push(n),o.generation=++o.maxGeneration,o.lastModTime=o.lastSelTime=D,o.lastOp=o.lastSelOp=r,o.lastOrigin=o.lastSelOrigin=t.origin,Y||Oe(e,"historyAdded")}function ml(e,t,n,r){var o=t.charAt(0);return o=="*"||o=="+"&&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 o=e.history,D=r&&r.origin;n==o.lastSelOp||D&&o.lastSelOrigin==D&&(o.lastModTime==o.lastSelTime&&o.lastOrigin==D||ml(e,D,Me(o.done),t))?o.done[o.done.length-1]=t:Qi(t,o.done),o.lastSelTime=+new Date,o.lastSelOrigin=D,o.lastSelOp=n,r&&r.clearRedo!==!1&&Bo(o.undone)}function Qi(e,t){var n=Me(t);n&&n.ranges&&n.equals(e)||t.push(e)}function jo(e,t,n,r){var o=t["spans_"+e.id],D=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(U){U.markedSpans&&((o||(o=t["spans_"+e.id]={}))[D]=U.markedSpans),++D})}function vl(e){if(!e)return null;for(var t,n=0;n-1&&(Me(Y)[fe]=q[fe],delete q[fe]))}}return r}function Na(e,t,n,r){if(r){var o=e.anchor;if(n){var D=ct(t,o)<0;D!=ct(n,o)<0?(o=t,t=n):D!=ct(t,n)<0&&(t=n)}return new Zt(o,t)}else return new Zt(n||t,t)}function qi(e,t,n,r,o){o==null&&(o=e.cm&&(e.cm.display.shift||e.extend)),Dr(e,new Qr([Na(e.sel.primary(),t,n,o)],0),r)}function Ho(e,t,n){for(var r=[],o=e.cm&&(e.cm.display.shift||e.extend),D=0;D=t.ch:Y.to>t.ch))){if(o&&(Oe(J,"beforeCursorEnter"),J.explicitlyCleared))if(D.markedSpans){--U;continue}else break;if(!J.atomic)continue;if(n){var fe=J.find(r<0?1:-1),Ce=void 0;if((r<0?le:q)&&(fe=Yo(e,fe,-r,fe&&fe.line==t.line?D:null)),fe&&fe.line==t.line&&(Ce=ct(fe,n))&&(r<0?Ce<0:Ce>0))return ti(e,fe,t,r,o)}var Se=J.find(r<0?-1:1);return(r<0?q:le)&&(Se=Yo(e,Se,r,Se.line==t.line?D:null)),Se?ti(e,Se,t,r,o):null}}return t}function ta(e,t,n,r,o){var D=r||1,U=ti(e,t,n,D,o)||!o&&ti(e,t,n,D,!0)||ti(e,t,n,-D,o)||!o&&ti(e,t,n,-D,!0);return U||(e.cantEdit=!0,Fe(e.first,0))}function Yo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?c(e,Fe(t.line-1)):null:n>0&&t.ch==(r||pt(e,t.line)).text.length?t.line=0;--o)Zo(e,{from:r[o].from,to:r[o].to,text:o?[""]:t.text,origin:t.origin});else Zo(e,t)}function Zo(e,t){if(t.text.length==1&&t.text[0]==""&&ct(t.from,t.to)==0)return;var n=Ma(e,t);Uo(e,t,n,e.cm?e.cm.curOp.id:NaN),Li(e,t,n,an(e,t));var r=[];Ln(e,function(o,D){!D&&de(r,o.history)==-1&&(ts(o.history,t),r.push(o.history)),Li(o,t,null,an(o,t))})}function ra(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var o=e.history,D,U=e.sel,Y=t=="undo"?o.done:o.undone,J=t=="undo"?o.undone:o.done,q=0;q=0;--Se){var Ne=Ce(Se);if(Ne)return Ne.v}}function Qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new Qr($e(e.sel.ranges,function(o){return new Zt(Fe(o.anchor.line+t,o.anchor.ch),Fe(o.head.line+t,o.head.ch))}),e.sel.primIndex),e.cm){Nr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())return;if(t.from.lineD&&(t={from:t.from,to:Fe(D,pt(e,D).text.length),text:[t.text[0]],origin:t.origin}),t.removed=lr(e,t.from,t.to),n||(n=Ma(e,t)),e.cm?xl(e.cm,t,r):_a(e,t,r),ea(e,n,Ae),e.cantEdit&&ta(e,Fe(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,n){var r=e.doc,o=e.display,D=t.from,U=t.to,Y=!1,J=D.line;e.options.lineWrapping||(J=_t(_r(pt(r,D.line))),r.iter(J,U.line+1,function(Se){if(Se==o.maxLine)return Y=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ye(e),_a(r,t,n,mo(e)),e.options.lineWrapping||(r.iter(J,D.line+t.text.length,function(Se){var Ne=Xn(Se);Ne>o.maxLineLength&&(o.maxLine=Se,o.maxLineLength=Ne,o.maxLineChanged=!0,Y=!1)}),Y&&(e.curOp.updateMaxLine=!0)),qr(r,D.line),Ci(e,400);var q=t.text.length-(U.line-D.line)-1;t.full?Nr(e):D.line==U.line&&t.text.length==1&&!Io(e.doc,t)?Sn(e,D.line,"text"):Nr(e,D.line,U.line+1,q);var le=ce(e,"changes"),fe=ce(e,"change");if(fe||le){var Ce={from:D,to:U,text:t.text,removed:t.removed,origin:t.origin};fe&&Cr(e,"change",e,Ce),le&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Ce)}e.display.selForContextMenu=null}function ni(e,t,n,r,o){var D;r||(r=n),ct(r,n)<0&&(D=[r,n],n=D[0],r=D[1]),typeof t=="string"&&(t=e.splitLines(t)),ri(e,{from:n,to:r,text:t,origin:o})}function qo(e,t,n,r){n1||!(this.children[0]instanceof Di))){var Y=[];this.collapse(Y),this.children=[new Di(Y)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var U=o.lines.length%25+25,Y=U;Y10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;re.display.maxLineLength&&(e.display.maxLine=q,e.display.maxLineLength=le,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Nr(e,r,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Vo(e.doc)),e&&Cr(e,"markerCleared",e,this,r,o),t&&jn(e),this.parent&&this.parent.clear()},An.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,o=0;o0||U==0&&D.clearWhenEmpty!==!1)return D;if(D.replacedWith&&(D.collapsed=!0,D.widgetNode=L("span",[D.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||D.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(D.widgetNode.insertLeft=!0)),D.collapsed){if(ur(e,t.line,t,n,D)||t.line!=n.line&&ur(e,n.line,t,n,D))throw new Error("Inserting collapsed marker partially overlapping an existing one");Hr()}D.addToHistory&&Uo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var Y=t.line,J=e.cm,q;if(e.iter(Y,n.line+1,function(fe){J&&D.collapsed&&!J.options.lineWrapping&&_r(fe)==J.display.maxLine&&(q=!0),D.collapsed&&Y!=t.line&&Ar(fe,0),dn(fe,new bn(D,Y==t.line?t.ch:null,Y==n.line?n.ch:null)),++Y}),D.collapsed&&e.iter(t.line,n.line+1,function(fe){Gr(e,fe)&&Ar(fe,0)}),D.clearOnEnter&&Le(D,"beforeCursorEnter",function(){return D.clear()}),D.readOnly&&($r(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),D.collapsed&&(D.id=++ns,D.atomic=!0),J){if(q&&(J.curOp.updateMaxLine=!0),D.collapsed)Nr(J,t.line,n.line+1);else if(D.className||D.startStyle||D.endStyle||D.css||D.attributes||D.title)for(var le=t.line;le<=n.line;le++)Sn(J,le,"text");D.atomic&&Vo(J.doc),Cr(J,"markerAdded",J,D)}return D}var Oi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n=0;J--)ri(this,r[J]);Y?zo(this,Y):this.cm&&Qn(this.cm)}),undo:br(function(){ra(this,"undo")}),redo:br(function(){ra(this,"redo")}),undoSelection:br(function(){ra(this,"undo",!0)}),redoSelection:br(function(){ra(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.ch)&&t.push(o.marker.parent||o.marker)}return t},findMarks:function(e,t,n){e=c(this,e),t=c(this,t);var r=[],o=e.line;return this.iter(e.line,t.line+1,function(D){var U=D.markedSpans;if(U)for(var Y=0;Y=J.to||J.from==null&&o!=e.line||J.from!=null&&o==t.line&&J.from>=t.ch)&&(!n||n(J.marker))&&r.push(J.marker.parent||J.marker)}++o}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;re)return t=e,!0;e-=D,++n}),c(this,Fe(n,t))},indexFromPos:function(e){e=c(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var le=e.dataTransfer.getData("Text");if(le){var fe;if(t.state.draggingText&&!t.state.draggingText.copy&&(fe=t.listSelections()),ea(t.doc,Tn(n,n)),fe)for(var Ce=0;Ce=0;Y--)ni(e.doc,"",r[Y].from,r[Y].to,"+delete");Qn(e)})}function Ba(e,t,n){var r=je(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ua(e,t,n){var r=Ba(e,t.ch,n);return r==null?null:new Fe(t.line,r,n<0?"after":"before")}function ja(e,t,n,r,o){if(e){t.doc.direction=="rtl"&&(o=-o);var D=it(n,t.doc.direction);if(D){var U=o<0?Me(D):D[0],Y=o<0==(U.level==1),J=Y?"after":"before",q;if(U.level>0||t.doc.direction=="rtl"){var le=Yn(t,n);q=o<0?n.text.length-1:0;var fe=fn(t,le,q).top;q=at(function(Ce){return fn(t,le,Ce).top==fe},o<0==(U.level==1)?U.from:U.to-1,q),J=="before"&&(q=Ba(n,q,1))}else q=o<0?U.to:U.from;return new Fe(r,q,J)}}return new Fe(r,o<0?n.text.length:0,o<0?"before":"after")}function _l(e,t,n,r){var o=it(t,e.doc.direction);if(!o)return Ua(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 D=Ve(o,n.ch,n.sticky),U=o[D];if(e.doc.direction=="ltr"&&U.level%2==0&&(r>0?U.to>n.ch:U.from=U.from&&Ce>=le.begin)){var Se=fe?"before":"after";return new Fe(n.line,Ce,Se)}}var Ne=function(ot,ft,st){for(var vt=function(nr,xr){return xr?new Fe(n.line,Y(nr,1),"before"):new Fe(n.line,nr,"after")};ot>=0&&ot0==(At.level!=1),It=wt?st.begin:Y(st.end,-1);if(At.from<=It&&It0?le.end:Y(le.begin,-1);return Ze!=null&&!(r>0&&Ze==t.text.length)&&(ze=Ne(r>0?0:o.length-1,r,q(Ze)),ze)?ze:null}var _i={selectAll:$o,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Ae)},killLine:function(e){return oi(e,function(t){if(t.empty()){var n=pt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)o=new Fe(o.line,o.ch+1),e.replaceRange(D.charAt(o.ch-1)+D.charAt(o.ch-2),Fe(o.line,o.ch-2),o,"+transpose");else if(o.line>e.doc.first){var U=pt(e.doc,o.line-1).text;U&&(o=new Fe(o.line,1),e.replaceRange(D.charAt(0)+e.doc.lineSeparator()+U.charAt(U.length-1),Fe(o.line-1,U.length-1),o,"+transpose"))}}n.push(new Zt(o,o))}e.setSelections(n)})},newlineAndIndent:function(e){return zr(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;re&&ct(t,this.pos)==0&&n==this.button};var Ni,Fi;function Wl(e,t){var n=+new Date;return Fi&&Fi.compare(n,e,t)?(Ni=Fi=null,"triple"):Ni&&Ni.compare(n,e,t)?(Fi=new Ha(n,e,t),Ni=null,"double"):(Ni=new Ha(n,e,t),Fi=null,"single")}function bs(e){var t=this,n=t.display;if(He(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,gn(n,e)){M||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ga(t,e))return;var r=In(t,e),o=xe(e),D=r?Wl(r,o):"single";if(window.focus(),o==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,o,r,D,e))return;o==1?r?zl(t,r,D,e):Te(e)==n.scroller&&te(e):o==2?(r&&qi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):o==3&&(R?t.display.input.onContextMenu(e):xo(t))}function Hl(e,t,n,r,o){var D="Click";return r=="double"?D="Double"+D:r=="triple"&&(D="Triple"+D),D=(t==1?"Left":t==2?"Middle":"Right")+D,Ii(e,ds(D,o),o,function(U){if(typeof U=="string"&&(U=_i[U]),!U)return!1;var Y=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Y=U(e,n)!=Ie}finally{e.state.suppressEdits=!1}return Y})}function Gl(e,t,n){var r=e.getOption("configureMouse"),o=r?r(e,t,n):{};if(o.unit==null){var D=l?n.shiftKey&&n.metaKey:n.altKey;o.unit=D?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(o.extend==null||e.doc.extend)&&(o.extend=e.doc.extend||n.shiftKey),o.addNew==null&&(o.addNew=s?n.metaKey:n.ctrlKey),o.moveOnDrag==null&&(o.moveOnDrag=!(s?n.altKey:n.ctrlKey)),o}function zl(e,t,n,r){F?setTimeout(z(bo,e),0):e.curOp.focus=I();var o=Gl(e,n,r),D=e.doc.sel,U;e.options.dragDrop&&Be&&!e.isReadOnly()&&n=="single"&&(U=D.contains(t))>-1&&(ct((U=D.ranges[U]).from(),t)<0||t.xRel>0)&&(ct(U.to(),t)>0||t.xRel<0)?Kl(e,r,t,o):Vl(e,r,t,o)}function Kl(e,t,n,r){var o=e.display,D=!1,U=yr(e,function(q){M&&(o.scroller.draggable=!1),e.state.draggingText=!1,lt(o.wrapper.ownerDocument,"mouseup",U),lt(o.wrapper.ownerDocument,"mousemove",Y),lt(o.scroller,"dragstart",J),lt(o.scroller,"drop",U),D||(te(q),r.addNew||qi(e.doc,n,null,null,r.extend),M&&!S||F&&N==9?setTimeout(function(){o.wrapper.ownerDocument.body.focus({preventScroll:!0}),o.input.focus()},20):o.input.focus())}),Y=function(q){D=D||Math.abs(t.clientX-q.clientX)+Math.abs(t.clientY-q.clientY)>=10},J=function(){return D=!0};M&&(o.scroller.draggable=!0),e.state.draggingText=U,U.copy=!r.moveOnDrag,o.scroller.dragDrop&&o.scroller.dragDrop(),Le(o.wrapper.ownerDocument,"mouseup",U),Le(o.wrapper.ownerDocument,"mousemove",Y),Le(o.scroller,"dragstart",J),Le(o.scroller,"drop",U),xo(e),setTimeout(function(){return o.input.focus()},20)}function xs(e,t,n){if(n=="char")return new Zt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new Zt(Fe(t.line,0),c(e.doc,Fe(t.line+1,0)));var r=n(e,t);return new Zt(r.from,r.to)}function Vl(e,t,n,r){var o=e.display,D=e.doc;te(t);var U,Y,J=D.sel,q=J.ranges;if(r.addNew&&!r.extend?(Y=D.sel.contains(n),Y>-1?U=q[Y]:U=new Zt(n,n)):(U=D.sel.primary(),Y=D.sel.primIndex),r.unit=="rectangle")r.addNew||(U=new Zt(n,n)),n=In(e,t,!0,!0),Y=-1;else{var le=xs(e,n,r.unit);r.extend?U=Na(U,le.anchor,le.head,r.extend):U=le}r.addNew?Y==-1?(Y=q.length,Dr(D,ln(e,q.concat([U]),Y),{scroll:!1,origin:"*mouse"})):q.length>1&&q[Y].empty()&&r.unit=="char"&&!r.extend?(Dr(D,ln(e,q.slice(0,Y).concat(q.slice(Y+1)),0),{scroll:!1,origin:"*mouse"}),J=D.sel):Fa(D,Y,U,Re):(Y=0,Dr(D,new Qr([U],0),Re),J=D.sel);var fe=n;function Ce(st){if(ct(fe,st)==0)return;if(fe=st,r.unit=="rectangle"){for(var vt=[],At=e.options.tabSize,wt=ee(pt(D,n.line).text,n.ch,At),It=ee(pt(D,st.line).text,st.ch,At),nr=Math.min(wt,It),xr=Math.max(wt,It),ar=Math.min(n.line,st.line),Kr=Math.min(e.lastLine(),Math.max(n.line,st.line));ar<=Kr;ar++){var Br=pt(D,ar).text,fr=De(Br,nr,At);nr==xr?vt.push(new Zt(Fe(ar,fr),Fe(ar,fr))):Br.length>fr&&vt.push(new Zt(Fe(ar,fr),Fe(ar,De(Br,xr,At))))}vt.length||vt.push(new Zt(n,n)),Dr(D,ln(e,J.ranges.slice(0,Y).concat(vt),Y),{origin:"*mouse",scroll:!1}),e.scrollIntoView(st)}else{var Ur=U,Tr=xs(e,st,r.unit),gr=Ur.anchor,pr;ct(Tr.anchor,gr)>0?(pr=Tr.head,gr=tr(Ur.from(),Tr.anchor)):(pr=Tr.anchor,gr=Qt(Ur.to(),Tr.head));var sr=J.ranges.slice(0);sr[Y]=Xl(e,new Zt(c(D,gr),pr)),Dr(D,ln(e,sr,Y),Re)}}var Se=o.wrapper.getBoundingClientRect(),Ne=0;function ze(st){var vt=++Ne,At=In(e,st,!0,r.unit=="rectangle");if(!At)return;if(ct(At,fe)!=0){e.curOp.focus=I(),Ce(At);var wt=Xi(o,D);(At.line>=wt.to||At.lineSe.bottom?20:0;It&&setTimeout(yr(e,function(){if(Ne!=vt)return;o.scroller.scrollTop+=It,ze(st)}),50)}}function Ze(st){e.state.selectingText=!1,Ne=Infinity,st&&(te(st),o.input.focus()),lt(o.wrapper.ownerDocument,"mousemove",ot),lt(o.wrapper.ownerDocument,"mouseup",ft),D.history.lastSelOrigin=null}var ot=yr(e,function(st){st.buttons===0||!xe(st)?Ze(st):ze(st)}),ft=yr(e,Ze);e.state.selectingText=ft,Le(o.wrapper.ownerDocument,"mousemove",ot),Le(o.wrapper.ownerDocument,"mouseup",ft)}function Xl(e,t){var n=t.anchor,r=t.head,o=pt(e.doc,n.line);if(ct(n,r)==0&&n.sticky==r.sticky)return t;var D=it(o);if(!D)return t;var U=Ve(D,n.ch,n.sticky),Y=D[U];if(Y.from!=n.ch&&Y.to!=n.ch)return t;var J=U+(Y.from==n.ch==(Y.level!=1)?0:1);if(J==0||J==D.length)return t;var q;if(r.line!=n.line)q=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var le=Ve(D,r.ch,r.sticky),fe=le-U||(r.ch-n.ch)*(Y.level==1?-1:1);le==J-1||le==J?q=fe<0:q=fe>0}var Ce=D[J+(q?-1:0)],Se=q==(Ce.level==1),Ne=Se?Ce.from:Ce.to,ze=Se?"after":"before";return n.ch==Ne&&n.sticky==ze?t:new Zt(new Fe(n.line,Ne,ze),r)}function Es(e,t,n,r){var o,D;if(t.touches)o=t.touches[0].clientX,D=t.touches[0].clientY;else try{o=t.clientX,D=t.clientY}catch(Ce){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&te(t);var U=e.display,Y=U.lineDiv.getBoundingClientRect();if(D>Y.bottom||!ce(e,n))return oe(t);D-=Y.top-U.viewOffset;for(var J=0;J=o){var le=kr(e.doc,D),fe=e.display.gutterSpecs[J];return Oe(e,n,e,le,fe.className,t),oe(t)}}}function Ga(e,t){return Es(e,t,"gutterClick",!0)}function Ss(e,t){if(gn(e.display,t)||Yl(e,t))return;if(He(e,t,"contextmenu"))return;R||e.display.input.onContextMenu(t)}function Yl(e,t){return ce(e,"gutterContextMenu")?Es(e,t,"gutterContextMenu",!1):!1}function Cs(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),vi(e)}var si={toString:function(){return"CodeMirror.Init"}},Ts={},oa={};function $l(e){var t=e.optionHandlers;function n(r,o,D,U){e.defaults[r]=o,D&&(t[r]=U?function(Y,J,q){q!=si&&D(Y,J,q)}:D)}e.defineOption=n,e.Init=si,n("value","",function(r,o){return r.setValue(o)},!0),n("mode",null,function(r,o){r.doc.modeOption=o,Pa(r)},!0),n("indentUnit",2,Pa,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){wi(r),vi(r),Nr(r)},!0),n("lineSeparator",null,function(r,o){if(r.doc.lineSep=o,!o)return;var D=[],U=r.doc.first;r.doc.iter(function(J){for(var q=0;;){var le=J.text.indexOf(o,q);if(le==-1)break;q=le+o.length,D.push(Fe(U,le))}U++});for(var Y=D.length-1;Y>=0;Y--)ni(r.doc,o,D[Y],Fe(D[Y].line,D[Y].ch+o.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,o,D){r.state.specialChars=new RegExp(o.source+(o.test(" ")?"":"| "),"g"),D!=si&&r.refresh()}),n("specialCharPlaceholder",Xt,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",i?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,o){return r.getInputField().spellcheck=o},!0),n("autocorrect",!1,function(r,o){return r.getInputField().autocorrect=o},!0),n("autocapitalize",!1,function(r,o){return r.getInputField().autocapitalize=o},!0),n("rtlMoveVisually",!C),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){Cs(r),Ti(r)},!0),n("keyMap","default",function(r,o,D){var U=ia(o),Y=D!=si&&ia(D);Y&&Y.detach&&Y.detach(r,U),U.attach&&U.attach(r,Y||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Zl,!0),n("gutters",[],function(r,o){r.display.gutterSpecs=Oa(o,r.options.lineNumbers),Ti(r)},!0),n("fixedGutter",!0,function(r,o){r.display.gutters.style.left=o?Ea(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return qn(r)},!0),n("scrollbarStyle","native",function(r){Lo(r),qn(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,o){r.display.gutterSpecs=Oa(r.options.gutters,o),Ti(r)},!0),n("firstLineNumber",1,Ti,!0),n("lineNumberFormatter",function(r){return r},Ti,!0),n("showCursorWhenSelecting",!1,yi,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,o){o=="nocursor"&&(Zn(r),r.display.input.blur()),r.display.input.readOnlyChanged(o)}),n("screenReaderLabel",null,function(r,o){o=o===""?null:o,r.display.input.screenReaderLabelChanged(o)}),n("disableInput",!1,function(r,o){o||r.display.input.reset()},!0),n("dragDrop",!0,Jl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,yi,!0),n("singleCursorHeightPerLine",!0,yi,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,wi,!0),n("addModeClass",!1,wi,!0),n("pollInterval",100),n("undoDepth",200,function(r,o){return r.doc.history.undoDepth=o}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,wi,!0),n("moveInputWithCursor",!0,function(r,o){o||r.display.input.resetPosition()}),n("tabindex",null,function(r,o){return r.display.input.getField().tabIndex=o||""}),n("autofocus",null),n("direction","ltr",function(r,o){return r.doc.setDirection(o)},!0),n("phrases",null)}function Jl(e,t,n){var r=n&&n!=si;if(!t!=!r){var o=e.display.dragFunctions,D=t?Le:lt;D(e.display.scroller,"dragstart",o.start),D(e.display.scroller,"dragenter",o.enter),D(e.display.scroller,"dragover",o.over),D(e.display.scroller,"dragleave",o.leave),D(e.display.scroller,"drop",o.drop)}}function Zl(e){e.options.lineWrapping?(W(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(T(e.display.wrapper,"CodeMirror-wrap"),ji(e)),Sa(e),Nr(e),vi(e),setTimeout(function(){return qn(e)},100)}function ir(e,t){var n=this;if(!(this instanceof ir))return new ir(e,t);this.options=t=t?B(t):{},B(Ts,t,!1);var r=t.value;typeof r=="string"?r=new Fr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var o=new ir.inputStyles[t.inputStyle](this),D=this.display=new dl(e,r,o,t);D.wrapper.CodeMirror=this,Cs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Lo(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new ie,keySeq:null,specialChars:null},t.autofocus&&!i&&D.input.focus(),F&&N<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Ql(this),Rl(),Un(this),this.curOp.forceUpdate=!0,No(this,r),t.autofocus&&!i||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Ta(n)},20):Zn(this);for(var U in oa)oa.hasOwnProperty(U)&&oa[U](this,t[U],si);Ro(this),t.finishInit&&t.finishInit(this);for(var Y=0;Y20*20}Le(t.scroller,"touchstart",function(J){if(!He(e,J)&&!D(J)&&!Ga(e,J)){t.input.ensurePolled(),clearTimeout(n);var q=+new Date;t.activeTouch={start:q,moved:!1,prev:q-r.end<=300?r:null},J.touches.length==1&&(t.activeTouch.left=J.touches[0].pageX,t.activeTouch.top=J.touches[0].pageY)}}),Le(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Le(t.scroller,"touchend",function(J){var q=t.activeTouch;if(q&&!gn(t,J)&&q.left!=null&&!q.moved&&new Date-q.start<300){var le=e.coordsChar(t.activeTouch,"page"),fe;!q.prev||U(q,q.prev)?fe=new Zt(le,le):!q.prev.prev||U(q,q.prev.prev)?fe=e.findWordAt(le):fe=new Zt(Fe(le.line,0),c(e.doc,Fe(le.line+1,0))),e.setSelection(fe.anchor,fe.head),e.focus(),te(J)}o()}),Le(t.scroller,"touchcancel",o),Le(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xi(e,t.scroller.scrollTop),Fn(e,t.scroller.scrollLeft,!0),Oe(e,"scroll",e))}),Le(t.scroller,"mousewheel",function(J){return Mo(e,J)}),Le(t.scroller,"DOMMouseScroll",function(J){return Mo(e,J)}),Le(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(J){He(e,J)||he(J)},over:function(J){He(e,J)||(Dl(e,J),he(J))},start:function(J){return Al(e,J)},drop:yr(e,Ll),leave:function(J){He(e,J)||os(e)}};var Y=t.input.getField();Le(Y,"keyup",function(J){return vs.call(e,J)}),Le(Y,"keydown",yr(e,gs)),Le(Y,"keypress",yr(e,ys)),Le(Y,"focus",function(J){return Ta(e,J)}),Le(Y,"blur",function(J){return Zn(e,J)})}var za=[];ir.defineInitHook=function(e){return za.push(e)};function Bi(e,t,n,r){var o=e.doc,D;n==null&&(n="add"),n=="smart"&&(o.mode.indent?D=nt(e,t).state:n="prev");var U=e.options.tabSize,Y=pt(o,t),J=ee(Y.text,null,U);Y.stateAfter&&(Y.stateAfter=null);var q=Y.text.match(/^\s*/)[0],le;if(!r&&!/\S/.test(Y.text))le=0,n="not";else if(n=="smart"&&(le=o.mode.indent(D,Y.text.slice(q.length),Y.text),le==Ie||le>150)){if(!r)return;n="prev"}n=="prev"?t>o.first?le=ee(pt(o,t-1).text,null,U):le=0:n=="add"?le=J+e.options.indentUnit:n=="subtract"?le=J-e.options.indentUnit:typeof n=="number"&&(le=J+n),le=Math.max(0,le);var fe="",Ce=0;if(e.options.indentWithTabs)for(var Se=Math.floor(le/U);Se;--Se)Ce+=U,fe+=" ";if(CeU,J=xt(t),q=null;if(Y&&r.ranges.length>1)if(un&&un.text.join(` `)==t){if(r.ranges.length%un.text.length==0){q=[];for(var le=0;le=0;Ce--){var Se=r.ranges[Ce],Ne=Se.from(),ze=Se.to();Se.empty()&&(n&&n>0?Ne=Fe(Ne.line,Ne.ch-n):e.state.overwrite&&!Y?ze=Fe(ze.line,Math.min(pt(D,ze.line).text.length,ze.ch+Me(J).length)):Y&&un&&un.lineWise&&un.text.join(` `)==J.join(` `)&&(Ne=ze=Fe(Ne.line,0)));var Ze={from:Ne,to:ze,text:q?q[Ce%q.length]:J,origin:o||(Y?"paste":e.state.cutIncoming>U?"cut":"+input")};ri(e.doc,Ze),Cr(e,"inputRead",e,Ze)}t&&!Y&&Ls(e,t),Qn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=fe),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ws(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&zr(t,function(){return Ka(t,n,0,null,"paste")}),!0}function Ls(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var o=n.ranges[r];if(o.head.ch>100||r&&n.ranges[r-1].head.line==o.head.line)continue;var D=e.getModeAt(o.head),U=!1;if(D.electricChars){for(var Y=0;Y-1){U=Bi(e,o.head.line,"smart");break}}else D.electricInput&&(D.electricInput.test(pt(e.doc,o.head.line).text.slice(0,o.head.ch))&&(U=Bi(e,o.head.line,"smart")));U&&Cr(e,"electricInput",e,o.head.line)}}function As(e){for(var t=[],n=[],r=0;rD&&(Bi(this,Y.head.line,r,!0),D=Y.head.line,U==this.doc.sel.primIndex&&Qn(this));else{var J=Y.from(),q=Y.to(),le=Math.max(D,J.line);D=Math.min(this.lastLine(),q.line-(q.ch?0:1))+1;for(var fe=le;fe0&&Fa(this.doc,U,new Zt(J,Ce[U].to()),Ae)}}}),getTokenAt:function(r,o){return rr(this,r,o)},getLineTokens:function(r,o){return rr(this,Fe(r),o,!0)},getTokenTypeAt:function(r){r=c(this.doc,r);var o=We(this,pt(this.doc,r.line)),D=0,U=(o.length-1)/2,Y=r.ch,J;if(Y==0)J=o[2];else for(;;){var q=D+U>>1;if((q?o[q*2-1]:0)>=Y)U=q;else if(o[q*2+1]J&&(r=J,U=!0),Y=pt(this.doc,r)}else Y=r;return Gi(this,Y,{top:0,left:0},o||"page",D||U).top+(U?this.doc.height-on(Y):0)},defaultTextHeight:function(){return $n(this.display)},defaultCharWidth:function(){return Jn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,o,D,U,Y){var J=this.display;r=sn(this,c(this.doc,r));var q=r.bottom,le=r.left;if(o.style.position="absolute",o.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(o),J.sizer.appendChild(o),U=="over")q=r.top;else if(U=="above"||U=="near"){var fe=Math.max(J.wrapper.clientHeight,this.doc.height),Ce=Math.max(J.sizer.clientWidth,J.lineSpace.clientWidth);(U=="above"||r.bottom+o.offsetHeight>fe)&&r.top>o.offsetHeight?q=r.top-o.offsetHeight:r.bottom+o.offsetHeight<=fe&&(q=r.bottom),le+o.offsetWidth>Ce&&(le=Ce-o.offsetWidth)}o.style.top=q+"px",o.style.left=o.style.right="",Y=="right"?(le=J.sizer.clientWidth-o.offsetWidth,o.style.right="0px"):(Y=="left"?le=0:Y=="middle"&&(le=(J.sizer.clientWidth-o.offsetWidth)/2),o.style.left=le+"px"),D&&Js(this,{left:le,top:q,right:le+o.offsetWidth,bottom:q+o.offsetHeight})},triggerOnKeyDown:Or(gs),triggerOnKeyPress:Or(ys),triggerOnKeyUp:vs,triggerOnMouseDown:Or(bs),execCommand:function(r){if(_i.hasOwnProperty(r))return _i[r].call(null,this)},triggerElectric:Or(function(r){Ls(this,r)}),findPosH:function(r,o,D,U){var Y=1;o<0&&(Y=-1,o=-o);for(var J=c(this.doc,r),q=0;q0&&le(D.charAt(U-1));)--U;for(;Y.5||this.options.lineWrapping)&&Sa(this),Oe(this,"refresh",this)}),swapDoc:Or(function(r){var o=this.doc;return o.cm=null,this.state.selectingText&&this.state.selectingText(),No(this,r),vi(this),this.display.input.reset(),bi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Cr(this,"swapDoc",this,o),o}),phrase:function(r){var o=this.options.phrases;return o&&Object.prototype.hasOwnProperty.call(o,r)?o[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}},me(e),e.registerHelper=function(r,o,D){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][o]=D},e.registerGlobalHelper=function(r,o,D,U){e.registerHelper(r,o,U),n[r]._global.push({pred:D,val:U})}}function Va(e,t,n,r,o){var D=t,U=n,Y=pt(e,t.line),J=o&&e.direction=="rtl"?-n:n;function q(){var ft=t.line+J;return ft=e.first+e.size?!1:(t=new Fe(ft,t.ch,t.sticky),Y=pt(e,ft))}function le(ft){var st;if(r=="codepoint"){var vt=Y.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(vt)?st=null:st=new Fe(t.line,Math.max(0,Math.min(Y.text.length,t.ch+n*(vt>=55296&&vt<56320?2:1))),-n)}else o?st=_l(e.cm,Y,t,n):st=Ua(Y,t,n);if(st==null)if(!ft&&q())t=ja(o,e.cm,Y,t.line,J);else return!1;else t=st;return!0}if(r=="char"||r=="codepoint")le();else if(r=="column")le(!0);else if(r=="word"||r=="group")for(var fe=null,Ce=r=="group",Se=e.cm&&e.cm.getHelper(t,"wordChars"),Ne=!0;!(n<0&&!le(!Ne));Ne=!1){var ze=Y.text.charAt(t.ch)||` `,Ze=we(ze,Se)?"w":Ce&&ze==` `?"n":!Ce||/\s/.test(ze)?null:"p";if(Ce&&!Ne&&!Ze&&(Ze="s"),fe&&fe!=Ze){n<0&&(n=1,le(),t.sticky="after");break}if(Ze&&(fe=Ze),n>0&&!le(!Ne))break}var ot=ta(e,t,D,U,!0);return Nt(D,ot)&&(ot.hitSide=!0),ot}function ks(e,t,n,r){var o=e.doc,D=t.left,U;if(r=="page"){var Y=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),J=Math.max(Y-.5*$n(e.display),3);U=(n>0?t.bottom:t.top)+n*J}else r=="line"&&(U=n>0?t.bottom+3:t.top-3);for(var q;!(q=ya(e,D,U),!q.outside);){if(n<0?U<=0:U>=o.height){q.hitSide=!0;break}U+=n*5}return q}var er=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ie,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};er.prototype.init=function(e){var t=this,n=this,r=n.cm,o=n.div=e.lineDiv;Ds(o,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function D(Y){for(var J=Y.target;J;J=J.parentNode){if(J==o)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(J.className))break}return!1}Le(o,"paste",function(Y){if(!D(Y)||He(r,Y)||ws(Y,r))return;N<=11&&setTimeout(yr(r,function(){return t.updateFromDOM()}),20)}),Le(o,"compositionstart",function(Y){t.composing={data:Y.data,done:!1}}),Le(o,"compositionupdate",function(Y){t.composing||(t.composing={data:Y.data,done:!1})}),Le(o,"compositionend",function(Y){t.composing&&(Y.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Le(o,"touchstart",function(){return n.forceCompositionEnd()}),Le(o,"input",function(){t.composing||t.readFromDOMSoon()});function U(Y){if(!D(Y)||He(r,Y))return;if(r.somethingSelected())sa({lineWise:!1,text:r.getSelections()}),Y.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var J=As(r);sa({lineWise:!0,text:J.text}),Y.type=="cut"&&r.operation(function(){r.setSelections(J.ranges,0,Ae),r.replaceSelection("",null,"cut")})}else return;if(Y.clipboardData){Y.clipboardData.clearData();var q=un.text.join(` `);if(Y.clipboardData.setData("Text",q),Y.clipboardData.getData("Text")==q){Y.preventDefault();return}}var le=Rs(),fe=le.firstChild;r.display.lineSpace.insertBefore(le,r.display.lineSpace.firstChild),fe.value=un.text.join(` `);var Ce=document.activeElement;Z(fe),setTimeout(function(){r.display.lineSpace.removeChild(le),Ce.focus(),Ce==o&&n.showPrimarySelection()},50)}Le(o,"copy",U),Le(o,"cut",U)},er.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},er.prototype.prepareSelection=function(){var e=vo(this.cm,!1);return e.focus=document.activeElement==this.div,e},er.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},er.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},er.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),o=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||o.line=t.display.viewFrom&&Os(t,r)||{node:Y[0].measure.map[2],offset:0},q=o.linee.firstLine()&&(r=Fe(r.line-1,pt(e.doc,r.line-1).length)),o.ch==pt(e.doc,o.line).text.length&&o.linet.viewTo-1)return!1;var D,U,Y;r.line==t.viewFrom||(D=Nn(e,r.line))==0?(U=_t(t.view[0].line),Y=t.view[0].node):(U=_t(t.view[D].line),Y=t.view[D-1].node.nextSibling);var J=Nn(e,o.line),q,le;if(J==t.view.length-1?(q=t.viewTo-1,le=t.lineDiv.lastChild):(q=_t(t.view[J+1].line)-1,le=t.view[J+1].node.previousSibling),!Y)return!1;for(var fe=e.doc.splitLines(tu(e,Y,le,U,q)),Ce=lr(e.doc,Fe(U,0),Fe(q,pt(e.doc,q).text.length));fe.length>1&&Ce.length>1;)if(Me(fe)==Me(Ce))fe.pop(),Ce.pop(),q--;else if(fe[0]==Ce[0])fe.shift(),Ce.shift(),U++;else break;for(var Se=0,Ne=0,ze=fe[0],Ze=Ce[0],ot=Math.min(ze.length,Ze.length);Ser.ch&&ft.charCodeAt(ft.length-Ne-1)==st.charCodeAt(st.length-Ne-1);)Se--,Ne++;fe[fe.length-1]=ft.slice(0,ft.length-Ne).replace(/^\u200b+/,""),fe[0]=fe[0].slice(Se).replace(/\u200b+$/,"");var At=Fe(U,Se),wt=Fe(q,Ce.length?Me(Ce).length-Ne:0);if(fe.length>1||fe[0]||ct(At,wt))return ni(e.doc,fe,At,wt,"+input"),!0},er.prototype.ensurePolled=function(){this.forceCompositionEnd()},er.prototype.reset=function(){this.forceCompositionEnd()},er.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},er.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)},er.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&zr(this.cm,function(){return Nr(e.cm)})},er.prototype.setUneditable=function(e){e.contentEditable="false"},er.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||yr(this.cm,Ka)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},er.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},er.prototype.onContextMenu=function(){},er.prototype.resetPosition=function(){},er.prototype.needsContentAttribute=!0;function Os(e,t){var n=pa(e,t.line);if(!n||n.hidden)return null;var r=pt(e.doc,t.line),o=ro(n,r,t.line),D=it(r,e.doc.direction),U="left";if(D){var Y=Ve(D,t.ch);U=Y%2?"right":"left"}var J=ao(o.map,t.ch,U);return J.offset=J.collapse=="right"?J.end:J.start,J}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function li(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,o){var D="",U=!1,Y=e.doc.lineSeparator(),J=!1;function q(Se){return function(Ne){return Ne.id==Se}}function le(){U&&(D+=Y,J&&(D+=Y),U=J=!1)}function fe(Se){Se&&(le(),D+=Se)}function Ce(Se){if(Se.nodeType==1){var Ne=Se.getAttribute("cm-text");if(Ne){fe(Ne);return}var ze=Se.getAttribute("cm-marker"),Ze;if(ze){var ot=e.findMarks(Fe(r,0),Fe(o+1,0),q(+ze));ot.length&&(Ze=ot[0].find(0))&&fe(lr(e.doc,Ze.from,Ze.to).join(Y));return}if(Se.getAttribute("contenteditable")=="false")return;var ft=/^(pre|div|p|li|table|br)$/i.test(Se.nodeName);if(!/^br$/i.test(Se.nodeName)&&Se.textContent.length==0)return;ft&&le();for(var st=0;st=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Le(o,"paste",function(U){if(He(r,U)||ws(U,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function D(U){if(He(r,U))return;if(r.somethingSelected())sa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var Y=As(r);sa({lineWise:!0,text:Y.text}),U.type=="cut"?r.setSelections(Y.ranges,null,Ae):(n.prevInput="",o.value=Y.text.join(` `),Z(o))}else return;U.type=="cut"&&(r.state.cutIncoming=+new Date)}Le(o,"cut",D),Le(o,"copy",D),Le(e.scroller,"paste",function(U){if(gn(e,U)||He(r,U))return;if(!o.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var Y=new Event("paste");Y.clipboardData=U.clipboardData,o.dispatchEvent(Y)}),Le(e.lineSpace,"selectstart",function(U){gn(e,U)||te(U)}),Le(o,"compositionstart",function(){var U=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:U,range:r.markText(U,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Le(o,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},dr.prototype.createField=function(e){this.wrapper=Rs(),this.textarea=this.wrapper.firstChild},dr.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},dr.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=vo(e);if(e.options.moveInputWithCursor){var o=sn(e,n.sel.primary().head,"div"),D=t.wrapper.getBoundingClientRect(),U=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,o.top+U.top-D.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,o.left+U.left-D.left))}return r},dr.prototype.showSelection=function(e){var t=this.cm,n=t.display;f(n.cursorDiv,e.cursors),f(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},dr.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&&Z(this.textarea),F&&N>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",F&&N>=9&&(this.hasSelection=null))},dr.prototype.getField=function(){return this.textarea},dr.prototype.supportsTouch=function(){return!1},dr.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!i||I()!=this.textarea))try{this.textarea.focus()}catch(e){}},dr.prototype.blur=function(){this.textarea.blur()},dr.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},dr.prototype.receivedFocus=function(){this.slowPoll()},dr.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()})},dr.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)},dr.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||et(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var o=n.value;if(o==r&&!t.somethingSelected())return!1;if(F&&N>=9&&this.hasSelection===o||s&&/[\uf700-\uf7ff]/.test(o))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var D=o.charCodeAt(0);if(D==8203&&!r&&(r="\u200B"),D==8666)return this.reset(),this.cm.execCommand("undo")}for(var U=0,Y=Math.min(r.length,o.length);U1e3||o.indexOf(` `)>-1?n.value=e.prevInput="":e.prevInput=o,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},dr.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},dr.prototype.onKeyPress=function(){F&&N>=9&&(this.hasSelection=null),this.fastPoll()},dr.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,o=t.textarea;t.contextMenuPending&&t.contextMenuPending();var D=In(n,e),U=r.scroller.scrollTop;if(!D||h)return;var Y=n.options.resetSelectionOnContextMenu;Y&&n.doc.sel.contains(D)==-1&&yr(n,Dr)(n.doc,Tn(D),Ae);var J=o.style.cssText,q=t.wrapper.style.cssText,le=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",o.style.cssText=`position: absolute; width: 30px; height: 30px; top: `+(e.clientY-le.top-5)+"px; left: "+(e.clientX-le.left-5)+`px; z-index: 1000; background: `+(F?"rgba(255, 255, 255, .05)":"transparent")+`; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var fe;M&&(fe=window.scrollY),r.input.focus(),M&&window.scrollTo(null,fe),r.input.reset(),n.somethingSelected()||(o.value=t.prevInput=" "),t.contextMenuPending=Se,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function Ce(){if(o.selectionStart!=null){var ze=n.somethingSelected(),Ze="\u200B"+(ze?o.value:"");o.value="\u21DA",o.value=Ze,t.prevInput=ze?"":"\u200B",o.selectionStart=1,o.selectionEnd=Ze.length,r.selForContextMenu=n.doc.sel}}function Se(){if(t.contextMenuPending!=Se)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=q,o.style.cssText=J,F&&N<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=U),o.selectionStart!=null){(!F||F&&N<9)&&Ce();var ze=0,Ze=function(){r.selForContextMenu==n.doc.sel&&o.selectionStart==0&&o.selectionEnd>0&&t.prevInput=="\u200B"?yr(n,$o)(n):ze++<10?r.detectingSelectAll=setTimeout(Ze,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Ze,200)}}if(F&&N>=9&&Ce(),R){he(e);var Ne=function(){lt(window,"mouseup",Ne),setTimeout(Se,20)};Le(window,"mouseup",Ne)}else setTimeout(Se,50)},dr.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},dr.prototype.setUneditable=function(){},dr.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?B(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=I();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=Y.getValue()}var o;if(e.form&&(Le(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var D=e.form;o=D.submit;try{var U=D.submit=function(){r(),D.submit=o,D.submit(),D.submit=U}}catch(J){}}t.finishInit=function(J){J.save=r,J.getTextArea=function(){return e},J.toTextArea=function(){J.toTextArea=isNaN,r(),e.parentNode.removeChild(J.getWrapperElement()),e.style.display="",e.form&&(lt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=o))}},e.style.display="none";var Y=ir(function(J){return e.parentNode.insertBefore(J,e.nextSibling)},t);return Y}function iu(e){e.off=lt,e.on=Le,e.wheelEventPixels=hl,e.Doc=Fr,e.splitLines=xt,e.countColumn=ee,e.findColumn=De,e.isWordChar=ve,e.Pass=Ie,e.signal=Oe,e.Line=Mn,e.changeEnd=wn,e.scrollbarModel=wo,e.Pos=Fe,e.cmpPos=ct,e.modes=Kt,e.mimeModes=Pt,e.resolveMode=St,e.getMode=Et,e.modeExtensions=dt,e.extendMode=Ct,e.copyState=Rt,e.startState=Mt,e.innerMode=Bt,e.commands=_i,e.keyMap=vn,e.keyName=hs,e.isModifierKey=us,e.lookupKey=ai,e.normalizeKeyMap=Pl,e.StringStream=Tt,e.SharedTextMarker=Oi,e.TextMarker=An,e.LineWidget=ki,e.e_preventDefault=te,e.e_stopPropagation=re,e.e_stop=he,e.addClass=W,e.contains=A,e.rmClass=T,e.keyNames=Dn}$l(ir),ql(ir);var au="iter insert remove copy getEditor constructor".split(" ");for(var ua in Fr.prototype)Fr.prototype.hasOwnProperty(ua)&&de(au,ua)<0&&(ir.prototype[ua]=function(e){return function(){return e.apply(this.doc,arguments)}}(Fr.prototype[ua]));return me(Fr),ir.inputStyles={textarea:dr,contenteditable:er},ir.defineMode=function(e){!ir.defaults.mode&&e!="null"&&(ir.defaults.mode=e),wr.apply(this,arguments)},ir.defineMIME=Wr,ir.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),ir.defineMIME("text/plain","null"),ir.defineExtension=function(e,t){ir.prototype[e]=t},ir.defineDocExtension=function(e,t){Fr.prototype[e]=t},ir.fromTextArea=nu,iu(ir),ir.version="5.58.2",ir})},XFxt:function(mt,Ee,Q){mt.exports={"image-preview-container":"image-preview-container___1L8o9","image-preview":"image-preview___3YjNO","button-group":"button-group___3y9R5","preview-wrp-group":"preview-wrp-group___19bWd"}},Y1PL:function(mt,Ee,Q){"use strict";Q.r(Ee),Q.d(Ee,"ResizableTextArea",function(){return de});var ne=Q("wx14"),$=Q("1OyB"),O=Q("vuIU"),V=Q("Ji7U"),_=Q("LK+K"),P=Q("q1tI"),F=Q("VTBJ"),N=Q("rePB"),M=Q("Zm9Q"),k=Q("Kwbf"),d=Q("c+Xe"),h=Q("m+aA"),S=Q("bdgK"),m=new Map;function p(Ae){Ae.forEach(function(Re){var ke,De=Re.target;(ke=m.get(De))===null||ke===void 0||ke.forEach(function(ge){return ge(De)})})}var v=new S.default(p),a=null,i=null;function s(Ae,Re){m.has(Ae)||(m.set(Ae,new Set),v.observe(Ae)),m.get(Ae).add(Re)}function l(Ae,Re){m.has(Ae)&&(m.get(Ae).delete(Re),m.get(Ae).size||(v.unobserve(Ae),m.delete(Ae)))}var C=function(Ae){Object(V.a)(ke,Ae);var Re=Object(_.a)(ke);function ke(){return Object($.a)(this,ke),Re.apply(this,arguments)}return Object(O.a)(ke,[{key:"render",value:function(){return this.props.children}}]),ke}(P.Component),g=P.createContext(null);function y(Ae){var Re=Ae.children,ke=Ae.onBatchResize,De=P.useRef(0),ge=P.useRef([]),ue=P.useContext(g),Me=P.useCallback(function($e,Ke,tt){De.current+=1;var se=De.current;ge.current.push({size:$e,element:Ke,data:tt}),Promise.resolve().then(function(){se===De.current&&(ke==null||ke(ge.current),ge.current=[])}),ue==null||ue($e,Ke,tt)},[ke,ue]);return P.createElement(g.Provider,{value:Me},Re)}function R(Ae){var Re=Ae.children,ke=Ae.disabled,De=P.useRef(null),ge=P.useRef(null),ue=P.useContext(g),Me=P.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),$e=P.isValidElement(Re)&&Object(d.c)(Re),Ke=$e?Re.ref:null,tt=P.useMemo(function(){return Object(d.a)(Ke,De)},[Ke,De]),se=P.useRef(Ae);se.current=Ae;var ae=P.useCallback(function(ve){var we=se.current,Pe=we.onResize,_e=we.data,Ue=ve.getBoundingClientRect(),je=Ue.width,at=Ue.height,Je=ve.offsetWidth,Qe=ve.offsetHeight,Ve=Math.floor(je),ht=Math.floor(at);if(Me.current.width!==Ve||Me.current.height!==ht||Me.current.offsetWidth!==Je||Me.current.offsetHeight!==Qe){var it={width:Ve,height:ht,offsetWidth:Je,offsetHeight:Qe};Me.current=it;var rt=Je===Math.round(je)?je:Je,Le=Qe===Math.round(at)?at:Qe,Xe=Object(F.a)(Object(F.a)({},it),{},{offsetWidth:rt,offsetHeight:Le});ue==null||ue(Xe,ve,_e),Pe&&Promise.resolve().then(function(){Pe(Xe,ve)})}},[]);return P.useEffect(function(){var ve=Object(h.a)(De.current)||Object(h.a)(ge.current);return ve&&!ke&&s(ve,ae),function(){return l(ve,ae)}},[De.current,ke]),P.createElement(C,{ref:ge},$e?P.cloneElement(Re,{ref:tt}):Re)}var w="rc-observer-key";function T(Ae){var Re=Ae.children,ke=Object(M.a)(Re);return ke.map(function(De,ge){var ue=(De==null?void 0:De.key)||"".concat(w,"-").concat(ge);return P.createElement(R,Object(ne.a)({},Ae,{key:ue}),De)})}T.Collection=y;var b=T,f=Q("bT9E"),u=Q("TSYQ"),L=Q.n(u),x=` 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 `,A=["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={},W;function K(Ae){var Re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ke=Ae.getAttribute("id")||Ae.getAttribute("data-reactid")||Ae.getAttribute("name");if(Re&&I[ke])return I[ke];var De=window.getComputedStyle(Ae),ge=De.getPropertyValue("box-sizing")||De.getPropertyValue("-moz-box-sizing")||De.getPropertyValue("-webkit-box-sizing"),ue=parseFloat(De.getPropertyValue("padding-bottom"))+parseFloat(De.getPropertyValue("padding-top")),Me=parseFloat(De.getPropertyValue("border-bottom-width"))+parseFloat(De.getPropertyValue("border-top-width")),$e=A.map(function(tt){return"".concat(tt,":").concat(De.getPropertyValue(tt))}).join(";"),Ke={sizingStyle:$e,paddingSize:ue,borderSize:Me,boxSizing:ge};return Re&&ke&&(I[ke]=Ke),Ke}function Z(Ae){var Re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ke=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,De=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;W||(W=document.createElement("textarea"),W.setAttribute("tab-index","-1"),W.setAttribute("aria-hidden","true"),document.body.appendChild(W)),Ae.getAttribute("wrap")?W.setAttribute("wrap",Ae.getAttribute("wrap")):W.removeAttribute("wrap");var ge=K(Ae,Re),ue=ge.paddingSize,Me=ge.borderSize,$e=ge.boxSizing,Ke=ge.sizingStyle;W.setAttribute("style","".concat(Ke,";").concat(x)),W.value=Ae.value||Ae.placeholder||"";var tt=Number.MIN_SAFE_INTEGER,se=Number.MAX_SAFE_INTEGER,ae=W.scrollHeight,ve;if($e==="border-box"?ae+=Me:$e==="content-box"&&(ae-=ue),ke!==null||De!==null){W.value=" ";var we=W.scrollHeight-ue;ke!==null&&(tt=we*ke,$e==="border-box"&&(tt=tt+ue+Me),ae=Math.max(tt,ae)),De!==null&&(se=we*De,$e==="border-box"&&(se=se+ue+Me),ve=ae>se?"":"hidden",ae=Math.min(se,ae))}return{height:ae,minHeight:tt,maxHeight:se,overflowY:ve,resize:"none"}}var z=Q("Gytx"),B=Q.n(z),ee;(function(Ae){Ae[Ae.NONE=0]="NONE",Ae[Ae.RESIZING=1]="RESIZING",Ae[Ae.RESIZED=2]="RESIZED"})(ee||(ee={}));var ie=function(Ae){Object(V.a)(ke,Ae);var Re=Object(_.a)(ke);function ke(De){var ge;return Object($.a)(this,ke),ge=Re.call(this,De),ge.nextFrameActionId=void 0,ge.resizeFrameId=void 0,ge.textArea=void 0,ge.saveTextArea=function(ue){ge.textArea=ue},ge.handleResize=function(ue){var Me=ge.state.resizeStatus,$e=ge.props,Ke=$e.autoSize,tt=$e.onResize;if(Me!==ee.NONE)return;typeof tt=="function"&&tt(ue),Ke&&ge.resizeOnNextFrame()},ge.resizeOnNextFrame=function(){cancelAnimationFrame(ge.nextFrameActionId),ge.nextFrameActionId=requestAnimationFrame(ge.resizeTextarea)},ge.resizeTextarea=function(){var ue=ge.props.autoSize;if(!ue||!ge.textArea)return;var Me=ue.minRows,$e=ue.maxRows,Ke=Z(ge.textArea,!1,Me,$e);ge.setState({textareaStyles:Ke,resizeStatus:ee.RESIZING},function(){cancelAnimationFrame(ge.resizeFrameId),ge.resizeFrameId=requestAnimationFrame(function(){ge.setState({resizeStatus:ee.RESIZED},function(){ge.resizeFrameId=requestAnimationFrame(function(){ge.setState({resizeStatus:ee.NONE}),ge.fixFirefoxAutoScroll()})})})})},ge.renderTextArea=function(){var ue=ge.props,Me=ue.prefixCls,$e=Me===void 0?"rc-textarea":Me,Ke=ue.autoSize,tt=ue.onResize,se=ue.className,ae=ue.disabled,ve=ge.state,we=ve.textareaStyles,Pe=ve.resizeStatus,_e=Object(f.a)(ge.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ue=L()($e,se,Object(N.a)({},"".concat($e,"-disabled"),ae));"value"in _e&&(_e.value=_e.value||"");var je=Object(F.a)(Object(F.a)(Object(F.a)({},ge.props.style),we),Pe===ee.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return P.createElement(b,{onResize:ge.handleResize,disabled:!(Ke||tt)},P.createElement("textarea",Object(ne.a)({},_e,{className:Ue,style:je,ref:ge.saveTextArea})))},ge.state={textareaStyles:{},resizeStatus:ee.NONE},ge}return Object(O.a)(ke,[{key:"componentDidUpdate",value:function(ge){(ge.value!==this.props.value||!B()(ge.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 ge=this.textArea.selectionStart,ue=this.textArea.selectionEnd;this.textArea.setSelectionRange(ge,ue)}}catch(Me){}}},{key:"render",value:function(){return this.renderTextArea()}}]),ke}(P.Component),de=ie,be=function(Ae){Object(V.a)(ke,Ae);var Re=Object(_.a)(ke);function ke(De){var ge;Object($.a)(this,ke),ge=Re.call(this,De),ge.resizableTextArea=void 0,ge.focus=function(){ge.resizableTextArea.textArea.focus()},ge.saveTextArea=function(Me){ge.resizableTextArea=Me},ge.handleChange=function(Me){var $e=ge.props.onChange;ge.setValue(Me.target.value,function(){ge.resizableTextArea.resizeTextarea()}),$e&&$e(Me)},ge.handleKeyDown=function(Me){var $e=ge.props,Ke=$e.onPressEnter,tt=$e.onKeyDown;Me.keyCode===13&&Ke&&Ke(Me),tt&&tt(Me)};var ue=typeof De.value=="undefined"||De.value===null?De.defaultValue:De.value;return ge.state={value:ue},ge}return Object(O.a)(ke,[{key:"setValue",value:function(ge,ue){"value"in this.props||this.setState({value:ge},ue)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return P.createElement(de,Object(ne.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ge){return"value"in ge?{value:ge.value}:null}}]),ke}(P.Component),Ie=Ee.default=be},ZW9T:function(mt,Ee,Q){"use strict";Q.d(Ee,"a",function(){return b});var ne=Q("k1fw"),$=Q("oBTY"),O=Q("9og8"),V=Q("miYZ"),_=Q("tsqr"),P=Q("rAM+"),F=Q("tJVT"),N=Q("PpiC"),M=Q("WmNS"),k=Q.n(M),d=Q("q1tI"),h=Q.n(d),S=Q("bdgK");function m(f,u,L,x,A){var I=u.getWordUntilPosition(L),W={startLineNumber:L.lineNumber,endLineNumber:L.lineNumber,startColumn:I.startColumn,endColumn:I.endColumn},K=x.map(function(Z){return{label:Z,kind:f.languages.CompletionItemKind.Keyword,insertText:Z,insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:W}});return A.map(function(Z){K.push(Object(ne.a)(Object(ne.a)({},Z),{},{range:W}))}),K}var p=function(f){var u={label:"ifelse",kind:f.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(` `),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},L=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];f.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(W,K){var Z=m(f,W,K,L,[u]);return{suggestions:Z}}});var x=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];f.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(W,K){var Z=[{label:"print",kind:f.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(` `),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],z=m(f,W,K,x,Z);return{suggestions:z}}});var A=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];f.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(W,K){var Z=[u,{label:"main",kind:f.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(` `),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:f.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(` `),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],z=m(f,W,K,A,Z);return{suggestions:z}}})},v="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",a=Q("fjLI"),i=Q("LvDl"),s=Q("+ua5");function l(f){return/^\d+$/.test(f)?"".concat(f,"px"):f}function C(){}var g=!1,y={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python",Scala:"scale"};function R(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],u=f;if(Array.isArray(f)){for(var L=0;L0||Bt.target.offsetWidth>0)&&Xe.current.instance.layout()}}catch(Mt){Ct.e(Mt)}finally{Ct.f()}}),Et.observe(Le.current)),Et}function Te(){_.b.warn({content:decodeURIComponent(v),key:"monaco-editor-tip"})}var xe=function(){var dt=Xe.current.instance;if(I!=null&&dt&&re){var Ct=dt.getModel();Ct&&I!==Ct.getValue()&&(g=!0,Ct.setValue(I),dt.layout(),g=!1)}};Object(d.useEffect)(function(){try{var Et,dt=Xe.current.instance;Oe.current&&clearTimeout(Oe.current),Oe.current=setTimeout(function(){xe()},500),dt==null||((Et=dt.updateOptions)===null||Et===void 0)||Et.call(dt,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(I.split(/\r\n|\r|\n/g).length))+3,5)})}catch(Ct){debugger}},[I,re,Xe.current]),Object(d.useEffect)(function(){try{if(at&&Xe.current&&Xe.current.instance){var Et=Xe.current.instance;Et.changeViewZones(function(Ct){var Rt=document.createElement("div");Rt.style.padding="10px 20px",Rt.style.width="calc(100% - 20px)",Rt.className="my-error-line-wrp",Rt.innerHTML=Qe,Ct.addZone({afterLineNumber:at||11,heightInLines:3,domNode:Rt})});var dt={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};Et.addOverlayWidget(dt),Et.revealPositionInCenter({lineNumber:20,column:1})}}catch(Ct){debugger}},[at,Xe.current,re]),Object(d.useEffect)(function(){var Et;if((Et=Xe.current)!==null&&Et!==void 0&&Et.instance&&re&&it){var dt=Xe.current.instance,Ct=dt.getModel();if(!Ct)return;var Rt=function(){var ct=[],Nt=[],$t=Ct.getAllDecorations(),Qt=Object(P.a)($t),tr;try{for(Qt.s();!(tr=Qt.n()).done;){var H=tr.value;if(H.options.className==="highlighted-line"){var c;ct.push(H==null||((c=H.range)===null||c===void 0)?void 0:c.startLineNumber),Nt.push(H==null?void 0:H.id)}}}catch(j){Qt.e(j)}finally{Qt.f()}Ct.deltaDecorations(Nt,[]);var E=Ct.getLineCount();!!Ve&&Ve<=E&&(dt.deltaDecorations([],[{range:new w.Range(Ve,1,Ve,Ct.getLineMaxColumn(Ve)),options:{isWholeLine:!0,className:"highlighted-line"}}]),dt.revealLineInCenter(Ve))};Rt();var Bt=function(){var ct=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,Nt=[],$t=[],Qt=Ct.getAllDecorations(),tr=Object(P.a)(Qt),H;try{for(tr.s();!(H=tr.n()).done;){var c=H.value;if(c.options.linesDecorationsClassName==="breakpoints"){var E;Nt.push(c==null||((E=c.range)===null||E===void 0)?void 0:E.startLineNumber),$t.push(c==null?void 0:c.id)}}}catch(j){tr.e(j)}finally{tr.f()}if(ct)return{lines:Nt,ids:$t};we(Nt)},Mt=function(){var Fe=Object(O.a)(k.a.mark(function ct(Nt){var $t;return k.a.wrap(function(tr){for(;;)switch(tr.prev=tr.next){case 0:return $t={range:new w.Range(Nt,1,Nt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints"}},tr.next=3,Ct.deltaDecorations([],[$t]);case 3:Bt();case 4:case"end":return tr.stop()}},ct)}));return function(Nt){return Fe.apply(this,arguments)}}(),Tt=function(){var Fe=Object(O.a)(k.a.mark(function ct(Nt){var $t,Qt,tr,H,c;return k.a.wrap(function(j){for(;;)switch(j.prev=j.next){case 0:$t=[],Qt=dt.getLineDecorations(Nt),tr=Object(P.a)(Qt);try{for(tr.s();!(H=tr.n()).done;)c=H.value,c.options.linesDecorationsClassName==="breakpoints"&&$t.push(c.id)}catch(X){tr.e(X)}finally{tr.f()}return j.next=6,Ct.deltaDecorations($t,[]);case 6:Bt();case 7:case"end":return j.stop()}},ct)}));return function(Nt){return Fe.apply(this,arguments)}}(),pt=function(ct){var Nt=dt.getLineDecorations(ct),$t=Object(P.a)(Nt),Qt;try{for($t.s();!(Qt=$t.n()).done;){var tr=Qt.value;if(tr.options.linesDecorationsClassName==="breakpoints")return!0}}catch(H){$t.e(H)}finally{$t.f()}return!1};if(!Object(i.isEqual)(_e,Bt(!0).lines)){Ct.deltaDecorations(Bt(!0).ids,[]);var lr=_e.map(function(Fe){return{range:new w.Range(Fe,1,Fe,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints"}}});Ct.deltaDecorations([],lr)}var Lr=dt.onDidChangeModelContent(function(Fe){var ct=dt.getPosition();if(ct){var Nt=ct.lineNumber;Ct.getLineContent(Nt).trim()===""?Tt(Nt):pt(Nt)&&(Tt(Nt),Mt(Nt))}}),Ar=dt.onMouseDown(function(Fe){var ct,Nt,$t;if(Fe.target.detail&&(ct=Fe.target)!==null&&ct!==void 0&&(Nt=ct.element)!==null&&Nt!==void 0&&($t=Nt.className)!==null&&$t!==void 0&&$t.includes("line-numbers")){var Qt=Fe.target.position.lineNumber;if(Ct.getLineContent(Qt).trim()==="")return;pt(Qt)?Tt(Qt):Mt(Qt)}}),_t=function(ct){var Nt={range:new w.Range(ct,1,ct,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};He.current=dt.deltaDecorations(He.current,[Nt])},kr=function(){He.current=dt.deltaDecorations(He.current,[])},Vr=dt.onMouseMove(function(Fe){var ct,Nt,$t;if(kr(),Fe.target.detail&&(ct=Fe.target)!==null&&ct!==void 0&&(Nt=ct.element)!==null&&Nt!==void 0&&($t=Nt.className)!==null&&$t!==void 0&&$t.includes("line-numbers")){var Qt=Fe.target.position.lineNumber;if(Ct.getLineContent(Qt).trim()==="")return;_t(Qt)}}),rn=dt.onMouseLeave(function(){kr()});return function(){Lr.dispose(),Ar.dispose(),Vr.dispose(),rn.dispose()}}},[Xe.current,re,_e,Ve,it]);function Be(){var Et=Xe.current.instance;if(Et){var dt=Et.getSelection(),Ct=Xe.current.pastePos||{},Rt=new w.Range(Ct.startLineNumber||dt.endLineNumber,Ct.startColumn||dt.endColumn,Ct.endLineNumber||dt.endLineNumber,Ct.endColumn||dt.endColumn);setTimeout(function(){Et.executeEdits("",[{range:Rt,text:""}])},300)}}function Ye(Et){(window.navigator.platform.match("Mac")?Et.metaKey:Et.ctrlKey)&&Et.keyCode==83&&(Et.preventDefault(),Re())}var ut=function(){if(De&&Xe.current.instance){var dt=Xe.current.instance.getContentHeight();Wr(dt0||Ke.target.offsetWidth>0)&&De.layout()}}catch(tt){Me.e(tt)}finally{Me.f()}}),ge.observe(B.current)),ge}Object(d.useEffect)(function(){return B.current&&Q.e(27).then(Q.t.bind(null,"M/lh",7)).then(function(De){w=De;var ge=w.editor.createDiffEditor(B.current,Object(ne.a)(Object(ne.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",wordWrap:"off",ignoreTrimWhitespace:!1,"semanticHighlighting.enabled":!0,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},z),{},{wordWrap:!0}));be(ge);var ue=Ie(ge);return function(){ge.dispose();var Me=ge.getModel();Me&&Me.dispose(),ue.unobserve(B.current)}}),function(){window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}},[]),Object(d.useEffect)(function(){de&&de.setModel({original:w.editor.createModel(I,K),modified:w.editor.createModel(W,K)})},[I,W,K,de]);var Ae=l(L),Re=l(A),ke={width:Ae,height:Re};return h.a.createElement("div",{className:"my-diff-editor",ref:B,style:ke})}},ZpRC:function(mt,Ee,Q){"use strict";function ne(d){return typeof d=="object"&&d!=null&&d.nodeType===1}function $(d,h){return(!h||d!=="hidden")&&d!=="visible"&&d!=="clip"}function O(d,h){if(d.clientHeighth||v>d&&a=h&&i>=S?v-d-m:a>h&&iS?a-h+p:0}var _=function(d,h){var S=window,m=h.scrollMode,p=h.block,v=h.inline,a=h.boundary,i=h.skipOverflowHiddenElements,s=typeof a=="function"?a:function(we){return we!==a};if(!ne(d))throw new TypeError("Invalid target");for(var l=document.scrollingElement||document.documentElement,C=[],g=d;ne(g)&&s(g);){if((g=g.parentElement)===l){C.push(g);break}g!=null&&g===document.body&&O(g)&&!O(document.documentElement)||g!=null&&O(g,i)&&C.push(g)}for(var y=S.visualViewport?S.visualViewport.width:innerWidth,R=S.visualViewport?S.visualViewport.height:innerHeight,w=window.scrollX||pageXOffset,T=window.scrollY||pageYOffset,b=d.getBoundingClientRect(),f=b.height,u=b.width,L=b.top,x=b.right,A=b.bottom,I=b.left,W=p==="start"||p==="nearest"?L:p==="end"?A:L+f/2,K=v==="center"?I+u/2:v==="end"?x:I,Z=[],z=0;z=0&&I>=0&&A<=R&&x<=y&&L>=be&&A<=Ae&&I>=Re&&x<=Ie)return Z;var ke=getComputedStyle(B),De=parseInt(ke.borderLeftWidth,10),ge=parseInt(ke.borderTopWidth,10),ue=parseInt(ke.borderRightWidth,10),Me=parseInt(ke.borderBottomWidth,10),$e=0,Ke=0,tt="offsetWidth"in B?B.offsetWidth-B.clientWidth-De-ue:0,se="offsetHeight"in B?B.offsetHeight-B.clientHeight-ge-Me:0;if(l===B)$e=p==="start"?W:p==="end"?W-R:p==="nearest"?V(T,T+R,R,ge,Me,T+W,T+W+f,f):W-R/2,Ke=v==="start"?K:v==="center"?K-y/2:v==="end"?K-y:V(w,w+y,y,De,ue,w+K,w+K+u,u),$e=Math.max(0,$e+T),Ke=Math.max(0,Ke+w);else{$e=p==="start"?W-be-ge:p==="end"?W-Ae+Me+se:p==="nearest"?V(be,Ae,ie,ge,Me+se,W,W+f,f):W-(be+ie/2)+se/2,Ke=v==="start"?K-Re-De:v==="center"?K-(Re+de/2)+tt/2:v==="end"?K-Ie+ue+tt:V(Re,Ie,de,De,ue+tt,K,K+u,u);var ae=B.scrollLeft,ve=B.scrollTop;W+=ve-($e=Math.max(0,Math.min(ve+$e,B.scrollHeight-ie+se))),K+=ae-(Ke=Math.max(0,Math.min(ae+Ke,B.scrollWidth-de+tt)))}Z.push({el:B,top:$e,left:Ke})}return Z};function P(d){return d===Object(d)&&Object.keys(d).length!==0}function F(d,h){h===void 0&&(h="auto");var S="scrollBehavior"in document.body.style;d.forEach(function(m){var p=m.el,v=m.top,a=m.left;p.scroll&&S?p.scroll({top:v,left:a,behavior:h}):(p.scrollTop=v,p.scrollLeft=a)})}function N(d){return d===!1?{block:"end",inline:"nearest"}:P(d)?d:{block:"start",inline:"nearest"}}function M(d,h){var S=!d.ownerDocument.documentElement.contains(d);if(P(h)&&typeof h.behavior=="function")return h.behavior(S?[]:_(d,h));if(S)return;var m=N(h);return F(_(d,m),m.behavior)}var k=Ee.a=M},bT9E:function(mt,Ee,Q){"use strict";Q.d(Ee,"a",function(){return $});var ne=Q("VTBJ");function $(O,V){var _=Object(ne.a)({},O);return Array.isArray(V)&&V.forEach(function(P){delete _[P]}),_}},c5Ni:function(mt,Ee,Q){},dejd:function(mt,Ee,Q){},dmUQ:function(mt,Ee,Q){"use strict";var ne=Q("Ff2n"),$=Q("rePB"),O=Q("1OyB"),V=Q("vuIU"),_=Q("Ji7U"),P=Q("md7G"),F=Q("foSv"),N=Q("q1tI"),M=Q.n(N),k=Q("TSYQ"),d=Q.n(k),h=Q("4IlW");function S(f,u){var L=Object.keys(f);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(f);u&&(x=x.filter(function(A){return Object.getOwnPropertyDescriptor(f,A).enumerable})),L.push.apply(L,x)}return L}function m(f){for(var u=1;u1?de-1:0),Ie=1;Ie1?z-1:0),ee=1;ee=0)return parseInt(Z.slice(Z.indexOf("e-")+2),10);var z=0;return Z.indexOf(".")>=0&&(z=Z.length-Z.indexOf(".")-1),z},A.getInputDisplayValue=function(K){var Z=K||A.state,z=Z.focused,B=Z.inputValue,ee=Z.value,ie;z?ie=B:ie=A.toPrecisionAsStep(ee),ie==null&&(ie="");var de=A.formatWrapper(ie);return y(A.props.decimalSeparator)&&(de=de.toString().replace(".",A.props.decimalSeparator)),de},A.recordCursorPosition=function(){try{A.cursorStart=A.input.selectionStart,A.cursorEnd=A.input.selectionEnd,A.currentValue=A.input.value,A.cursorBefore=A.input.value.substring(0,A.cursorStart),A.cursorAfter=A.input.value.substring(A.cursorEnd)}catch(K){}},A.restoreByAfter=function(K){if(K===void 0)return!1;var Z=A.input.value,z=Z.lastIndexOf(K);if(z===-1)return!1;var B=A.cursorBefore.length;return A.lastKeyCode===h.a.DELETE&&A.cursorBefore.charAt(B-1)===K[0]?(A.fixCaret(B,B),!0):z+K.length===Z.length?(A.fixCaret(z,z),!0):!1},A.partRestoreByAfter=function(K){return K===void 0?!1:Array.prototype.some.call(K,function(Z,z){var B=K.substring(z);return A.restoreByAfter(B)})},A.isNotCompleteNumber=function(K){return isNaN(K)||K===""||K===null||K&&K.toString().indexOf(".")===K.toString().length-1},A.stop=function(){A.autoStepTimer&&clearTimeout(A.autoStepTimer)},A.down=function(K,Z,z){A.pressingUpOrDown=!0,A.step("down",K,Z,z)},A.up=function(K,Z,z){A.pressingUpOrDown=!0,A.step("up",K,Z,z)},A.saveInput=function(K){A.input=K};var I=x.value;I===void 0&&(I=x.defaultValue),A.state={focused:x.autoFocus};var W=A.getValidValue(A.toNumber(I));return A.state=m(m({},A.state),{},{inputValue:A.toPrecisionAsStep(W),value:W}),A}return Object(V.a)(L,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(A){var I=this.props,W=I.value,K=I.onChange,Z=I.max,z=I.min,B=this.state.focused;if(A){if(!R(A.value,W)||!R(A.max,Z)||!R(A.min,z)){var ee=B?W:this.getValidValue(W),ie;this.pressingUpOrDown?ie=ee:this.inputting?ie=this.rawInput:ie=this.toPrecisionAsStep(ee),this.setState({value:ee,inputValue:ie})}var de="value"in this.props?W:this.state.value;"max"in this.props&&A.max!==Z&&typeof de=="number"&&de>Z&&K&&K(Z),"min"in this.props&&A.min!==z&&typeof de=="number"&&de1&&arguments[1]!==void 0?arguments[1]:this.props.min,W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,K=parseFloat(A);return isNaN(K)?A:(KW&&(K=W),K)}},{key:"setValue",value:function(A,I){var W=this.props.precision,K=this.isNotCompleteNumber(parseFloat(A))?null:parseFloat(A),Z=this.state.value,z=Z===void 0?null:Z,B=this.state.inputValue,ee=B===void 0?null:B,ie=typeof K=="number"?K.toFixed(W):"".concat(K),de=K!==z||ie!=="".concat(ee);return"value"in this.props?(ee=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:ee},I)):this.setState({value:K,inputValue:this.toPrecisionAsStep(A)},I),de&&this.props.onChange(K),K}},{key:"getMaxPrecision",value:function(A){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,W=this.props,K=W.precision,Z=W.step;if(y(K))return K;var z=this.getPrecision(I),B=this.getPrecision(Z),ee=this.getPrecision(A);return A?Math.max(ee,z+B):z+B}},{key:"getPrecisionFactor",value:function(A){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,W=this.getMaxPrecision(A,I);return Math.pow(10,W)}},{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(A){return this.props.formatter?this.props.formatter(A):A}},{key:"toPrecisionAsStep",value:function(A){if(this.isNotCompleteNumber(A)||A==="")return A;var I=Math.abs(this.getMaxPrecision(A));return isNaN(I)?A.toString():Number(A).toFixed(I)}},{key:"toNumber",value:function(A){var I=this.props.precision,W=this.state.focused,K=A&&A.length>16&&W;return this.isNotCompleteNumber(A)||K?A:y(I)?Math.round(A*Math.pow(10,I))/Math.pow(10,I):Number(A)}},{key:"upStep",value:function(A,I){var W=this.props.step,K=this.getPrecisionFactor(A,I),Z=Math.abs(this.getMaxPrecision(A,I)),z=((K*A+K*W*I)/K).toFixed(Z);return this.toNumber(z)}},{key:"downStep",value:function(A,I){var W=this.props.step,K=this.getPrecisionFactor(A,I),Z=Math.abs(this.getMaxPrecision(A,I)),z=((K*A-K*W*I)/K).toFixed(Z);return this.toNumber(z)}},{key:"step",value:function(A,I){var W=this,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,Z=arguments.length>3?arguments[3]:void 0;this.stop(),I&&(I.persist(),I.preventDefault());var z=this.props;if(z.disabled)return;var B=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(B))return;var ee=this["".concat(A,"Step")](B,K),ie=ee>z.max||eez.max?ee=z.max:ee=be),He=(ht||ht===0)&&(isNaN(ht)||Number(ht)<=Ie),ye=Oe||K||Z,ce=He||K||Z,me=d()("".concat(W,"-handler"),"".concat(W,"-handler-up"),Object($.a)({},"".concat(W,"-handler-up-disabled"),ye)),te=d()("".concat(W,"-handler"),"".concat(W,"-handler-down"),Object($.a)({},"".concat(W,"-handler-down-disabled"),ce)),re=z?{onTouchStart:ye?a:this.up,onTouchEnd:this.stop}:{onMouseDown:ye?a:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},oe=z?{onTouchStart:ce?a:this.down,onTouchEnd:this.stop}:{onMouseDown:ce?a:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return M.a.createElement("div",{className:rt,style:Ae,title:Re,onMouseEnter:ke,onMouseLeave:De,onMouseOver:ge,onMouseOut:ue,onFocus:function(){return null},onBlur:function(){return null}},M.a.createElement("div",{className:"".concat(W,"-handler-wrap")},M.a.createElement("span",Object.assign({unselectable:"on"},re,{role:"button","aria-label":"Increase Value","aria-disabled":ye,className:me}),ee||M.a.createElement("span",{unselectable:"on",className:"".concat(W,"-handler-up-inner"),onClick:i})),M.a.createElement("span",Object.assign({unselectable:"on"},oe,{role:"button","aria-label":"Decrease Value","aria-disabled":ce,className:te}),ie||M.a.createElement("span",{unselectable:"on",className:"".concat(W,"-handler-down-inner"),onClick:i}))),M.a.createElement("div",{className:"".concat(W,"-input-wrap")},M.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ie,"aria-valuemax":be,"aria-valuenow":ht,required:Me,type:tt,placeholder:se,onPaste:at,onClick:$e,onMouseUp:this.onMouseUp,className:"".concat(W,"-input"),tabIndex:Ke,autoComplete:B,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Xe?this.onKeyDown:a,onKeyUp:Xe?this.onKeyUp:a,autoFocus:Ue,maxLength:_e,readOnly:Z,disabled:K,max:be,min:Ie,step:Pe,name:je,title:Re,id:ae,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(lt),pattern:we,inputMode:ve,onInput:Je},Le))))}}]),L}(M.a.Component);w.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:g,min:-g,step:1,style:{},onChange:a,onKeyDown:a,onPressEnter:a,onFocus:a,onBlur:a,parser:s,required:!1,autoComplete:"off"};var T=w,b=Ee.a=T},fB9n:function(mt,Ee,Q){"use strict";Q.r(Ee);var ne=Q("14J3"),$=Q("BMrR"),O=Q("jCWc"),V=Q("kPKH"),_=Q("k1fw"),P=Q("9og8"),F=Q("tJVT"),N=Q("PpiC"),M=Q("WmNS"),k=Q.n(M),d=Q("q1tI"),h=Q.n(d),S=Q("55Ip"),m=Q("9kvl"),p=Q("T2oS"),v=Q("W9HT"),a=Q("oBTY"),i=Q("B9cy"),s=Q("Ol7k"),l=Q("lUTK"),C=Q("BvKs"),g=Q("Ty5D"),y=Q("wd/R"),R=Q.n(y),w=Q("RotF"),T=Q.n(w),b=Q("m3rI"),f=Q("9Bee"),u=Q("SbmS"),L=Q.n(u),x=C.a.SubMenu,A=s.a.Sider,I=s.a.Content,W=function(ve){var we=ve.messages,Pe=ve.globalSetting,_e=ve.loading,Ue=ve.user,je=ve.dispatch,at=Object(N.a)(ve,["messages","globalSetting","loading","user","dispatch"]),Je=Object(g.i)(),Qe=Object(g.h)(),Ve=Ue.userInfo,ht=Object(d.useState)(!1),it=Object(F.a)(ht,2),rt=it[0],Le=it[1],Xe=Object(d.useState)({per_page:20,page:1}),lt=Object(F.a)(Xe,2),Oe=lt[0],He=lt[1],ye=Object(d.useState)({per_page:20,page:1}),ce=Object(F.a)(ye,2),me=ce[0],te=ce[1],re=Object(d.useState)([]),oe=Object(F.a)(re,2),he=oe[0],Te=oe[1];Object(d.useEffect)(function(){Oe.page=1,Be()},[Je.userId]);var xe=function(ut){var qe,yt;m.d.push("/messages/".concat(Ue==null||((qe=Ue.userInfo)===null||qe===void 0)?void 0:qe.login,"/message_detail?target_ids=").concat(ut==null||((yt=ut.target)===null||yt===void 0)?void 0:yt.id))},Be=function(){var Ye=Object(P.a)(k.a.mark(function ut(){var qe,yt;return k.a.wrap(function(et){for(;;)switch(et.prev=et.next){case 0:return Le(!1),et.next=3,je({type:"messages/getPrivateMessages",payload:Object(_.a)(Object(_.a)({},Je),me)});case 3:qe=et.sent,qe!=null&&qe.private_messages&&(Te([].concat(Object(a.a)(he),Object(a.a)(qe.private_messages))),((yt=qe.private_messages)===null||yt===void 0?void 0:yt.length)===20&&Le(!0));case 5:case"end":return et.stop()}},ut)}));return function(){return Ye.apply(this,arguments)}}();return h.a.createElement("aside",{className:L.a.listRightMessage},h.a.createElement(T.a,{loadMore:function(){me.page++,Be()},hasMore:rt,useWindow:!1},h.a.createElement(v.a,{spinning:_e["messages/getPrivateMessages"]},h.a.createElement("div",{className:"minH500"},he==null?void 0:he.map(function(Ye,ut){var qe,yt;return h.a.createElement("aside",{key:ut},h.a.createElement($.a,{onClick:function(){return xe(Ye)}},h.a.createElement(V.a,{flex:"58px"},h.a.createElement("img",{src:b.a.IMG_SERVER+"/images/"+(Ye==null||((qe=Ye.target)===null||qe===void 0)?void 0:qe.image_url),alt:""})),h.a.createElement(V.a,{flex:"1"},h.a.createElement($.a,null,h.a.createElement(V.a,{span:24},h.a.createElement($.a,null,h.a.createElement(V.a,{flex:"1"},h.a.createElement("span",{className:L.a.userName},Ye==null||((yt=Ye.target)===null||yt===void 0)?void 0:yt.name)),h.a.createElement(V.a,null,h.a.createElement("span",{className:"ml15 c-grey-c"},R()(Ye.send_time).fromNow())))),h.a.createElement(V.a,{span:24},h.a.createElement("div",{className:["mt15",L.a.content].join(" ")},h.a.createElement(f.a,{value:Ye.content||""})))))))})))))},K=Object(m.a)(function(ae){var ve=ae.messages,we=ae.loading,Pe=ae.user,_e=ae.globalSetting;return{messages:ve,globalSetting:_e,user:Pe,loading:we.effects}})(W),Z=Q("+L6B"),z=Q("2/Rp"),B=Q("miYZ"),ee=Q("tsqr"),ie=Q("y8nQ"),de=Q("Vl3Y"),be=Q("kaH+"),Ie=Q("1vsH"),Ae=Q("5WQS"),Re=Q("Ot1p"),ke=Q("dhSg"),De=C.a.SubMenu,ge=s.a.Sider,ue=s.a.Content,Me=function(ve){var we=ve.messages,Pe=ve.globalSetting,_e=ve.loading,Ue=ve.user,je=ve.dispatch,at=Object(N.a)(ve,["messages","globalSetting","loading","user","dispatch"]),Je=Object(g.i)(),Qe=Object(g.h)(),Ve=Qe.query,ht=Object(d.useState)({per_page:20,page:1}),it=Object(F.a)(ht,2),rt=it[0],Le=it[1],Xe=Object(d.useState)([]),lt=Object(F.a)(Xe,2),Oe=lt[0],He=lt[1],ye=Object(d.useState)(!1),ce=Object(F.a)(ye,2),me=ce[0],te=ce[1],re=Object(d.useState)(!1),oe=Object(F.a)(re,2),he=oe[0],Te=oe[1],xe=Object(d.useState)(""),Be=Object(F.a)(xe,2),Ye=Be[0],ut=Be[1],qe=Object(d.useRef)(),yt=de.a.useForm(),xt=Object(F.a)(yt,1),et=xt[0],Wt=Object(d.useState)([]),kt=Object(F.a)(Wt,2),Gt=kt[0],Kt=kt[1],Pt=Object(d.useState)(!0),wr=Object(F.a)(Pt,2),Wr=wr[0],St=wr[1];Object(d.useEffect)(function(){rt.page=1,Et()},[Ve.target_ids]);var Et=function(){var Rt=Object(P.a)(k.a.mark(function Bt(){var Mt,Tt;return k.a.wrap(function(lr){for(;;)switch(lr.prev=lr.next){case 0:return te(!1),lr.next=3,je({type:"messages/getPrivateMessageDetails",payload:Object(_.a)(Object(_.a)({},Je),{},{target_id:Ve==null?void 0:Ve.target_ids},rt)});case 3:Mt=lr.sent,Mt!=null&&Mt.messages&&(Gt=Mt==null?void 0:Mt.messages,((Tt=Gt)===null||Tt===void 0?void 0:Tt.length)===20&&setTimeout(function(){te(!0),St(!1)},500),rt.page===1?He(Object(a.a)(Mt==null?void 0:Mt.messages.reverse())):He([].concat(Object(a.a)(Oe),Object(a.a)(Mt==null?void 0:Mt.messages.reverse()))));case 5:case"end":return lr.stop()}},Bt)}));return function(){return Rt.apply(this,arguments)}}();Object(d.useEffect)(function(){console.log("newData.length:",rt,Gt.length,Gt),rt.page===1&&Wr&&(qe.current.scrollTop=qe.current.scrollHeight)},[Oe]),Object(d.useEffect)(function(){qe.current.onclick=function(Rt){Rt.target.nodeName==="IMG"&&Rt.target.alt!==""&&ke.a.publish("preview-image",Rt.target.src)}},[]);var dt=function(){var Rt=Object(P.a)(k.a.mark(function Bt(Mt,Tt){var pt;return k.a.wrap(function(Lr){for(;;)switch(Lr.prev=Lr.next){case 0:return Lr.next=2,Object(Ae.a)(Object(_.a)(Object(_.a)({},Je),{},{id:Mt.id}));case 2:pt=Lr.sent,pt.status===0&&(Oe.splice(Tt,1),He(Object(a.a)(Oe)));case 5:case"end":return Lr.stop()}},Bt)}));return function(Mt,Tt){return Rt.apply(this,arguments)}}(),Ct=function(){var Rt=Object(P.a)(k.a.mark(function Bt(){return k.a.wrap(function(Tt){for(;;)switch(Tt.prev=Tt.next){case 0:if(!(Ye==="")){Tt.next=3;break}return ee.b.error("\u8BF7\u8F93\u5165\u60A8\u7684\u56DE\u590D"),Tt.abrupt("return",!1);case 3:return ut(""),Te(!0),Tt.next=8,Object(Ae.g)(Object(_.a)(Object(_.a)({},Je),{},{content:Ye,target_id:Ve==null?void 0:Ve.target_ids}));case 8:Te(!1),rt.page=1,et.resetFields(),Et();case 12:case"end":return Tt.stop()}},Bt)}));return function(){return Rt.apply(this,arguments)}}();return h.a.createElement("section",null,h.a.createElement("aside",{className:L.a.listMessage,ref:qe},h.a.createElement(T.a,{isReverse:!0,loadMore:function(){rt.page++,Et()},hasMore:me,useWindow:!1},!me&&h.a.createElement("div",{className:"tc mt20 animated fadeIn"},h.a.createElement("span",{className:L.a.msgDate},"\u6CA1\u6709\u4FE1\u606F\u4E86\uFF5E\uFF5E")),h.a.createElement(v.a,{spinning:_e["messages/getPrivateMessageDetails"]},h.a.createElement("aside",{className:"minH500"},Oe==null?void 0:Oe.map(function(Rt,Bt){var Mt;return h.a.createElement("aside",{key:Bt},h.a.createElement($.a,{justify:"center"},h.a.createElement(V.a,{flex:"1",className:"tc"},h.a.createElement("span",{className:L.a.msgDate},R()(Rt.send_time).format("YYYY-MM-DD")))),h.a.createElement($.a,{onClick:function(){return Object(Ie.G)(Rt)}},h.a.createElement(V.a,{flex:"58px"},h.a.createElement("img",{src:b.a.IMG_SERVER+"/images/"+(Rt==null||((Mt=Rt.sender)===null||Mt===void 0)?void 0:Mt.image_url),alt:""})),h.a.createElement(V.a,null,h.a.createElement("div",{className:L.a.msg},h.a.createElement(f.a,{value:Rt.content||""}),h.a.createElement("span",{onClick:function(){return dt(Rt,Bt)},className:["current",L.a.deleteMsg].join(" ")},"\u5220\u9664"))),h.a.createElement(V.a,null,h.a.createElement("span",{className:"c-grey-c ml10"},R()(Rt.send_time).format("HH:mm")))))}))))),h.a.createElement("aside",{className:"pl30 pr30 mb30 mt30"},h.a.createElement(de.a,{form:et},h.a.createElement(de.a.Item,{name:"content"},h.a.createElement(Re.a,{placeholder:"\u8BF7\u8F93\u5165\u4F60\u7684\u56DE\u590D",height:150,onChange:function(Bt){return ut(Bt)}})),h.a.createElement($.a,null,h.a.createElement(V.a,{flex:"1"},h.a.createElement("span",{className:"c-red font14"},"\u5728\u95EE\u9898\u53CD\u9988\u65F6\uFF0C\u8BF7\u540C\u65F6\u53D1\u9001\u95EE\u9898\u53D1\u751F\u9875\u7684\u7F51\u5740\u94FE\u63A5\uFF0C\u4EE5\u4FBF\u6211\u4EEC\u9AD8\u6548\u7684\u4E3A\u60A8\u670D\u52A1")),h.a.createElement(V.a,null,h.a.createElement(z.a,{loading:he,type:"primary",onClick:function(){return Ct()}},"\u56DE\u590D"))))),h.a.createElement(be.a,null))},$e=Object(m.a)(function(ae){var ve=ae.messages,we=ae.loading,Pe=ae.user,_e=ae.globalSetting;return{messages:ve,globalSetting:_e,user:Pe,loading:we.effects}})(Me),Ke=Q("30zm"),tt=function(ve){var we,Pe=ve.messages,_e=ve.globalSetting,Ue=ve.loading,je=ve.user,at=ve.dispatch,Je=Object(N.a)(ve,["messages","globalSetting","loading","user","dispatch"]),Qe=Je.match.params,Ve=Je.location.query,ht=je.userInfo,it=Pe.tidingsList,rt=Pe.privateMessageDetails,Le=Object(d.useState)({per_page:20,page:1}),Xe=Object(F.a)(Le,2),lt=Xe[0],Oe=Xe[1],He=Object(d.useState)({per_page:20,page:1}),ye=Object(F.a)(He,2),ce=ye[0],me=ye[1],te=Object(d.useState)([]),re=Object(F.a)(te,2),oe=re[0],he=re[1],Te=Object(d.useState)([]),xe=Object(F.a)(Te,2),Be=xe[0],Ye=xe[1];Object(d.useEffect)(function(){lt.page=1},[Qe.userId]);var ut=function(){var yt=Object(P.a)(k.a.mark(function xt(){var et;return k.a.wrap(function(kt){for(;;)switch(kt.prev=kt.next){case 0:return kt.next=2,at({type:"messages/getPrivateMessageDetails",payload:Object(_.a)(Object(_.a)({},Qe),{},{target_id:Ve==null?void 0:Ve.target_ids})});case 2:et=kt.sent,et!=null&&et.messages&&he(et.messages);case 4:case"end":return kt.stop()}},xt)}));return function(){return yt.apply(this,arguments)}}(),qe=function(){var yt=Object(P.a)(k.a.mark(function xt(){var et;return k.a.wrap(function(kt){for(;;)switch(kt.prev=kt.next){case 0:return kt.next=2,at({type:"messages/getPrivateMessages",payload:Object(_.a)(Object(_.a)({},Qe),ce)});case 2:et=kt.sent,et!=null&&et.private_messages&&Ye(et.private_messages);case 4:case"end":return kt.stop()}},xt)}));return function(){return yt.apply(this,arguments)}}();return h.a.createElement("section",{className:L.a.bg},h.a.createElement("section",{className:"edu-container mt20"},h.a.createElement($.a,{gutter:[20,20]},h.a.createElement(Ke.a,null),h.a.createElement(V.a,{flex:"1"},h.a.createElement("aside",{className:"bg-white"},h.a.createElement("aside",{className:["font16",L.a.topBar].join(" ")},h.a.createElement($.a,null,h.a.createElement(V.a,{flex:"30px",className:"tc"},h.a.createElement(S.a,{to:"/messages/".concat(Qe.userId,"/private_messages"),className:"iconfont icon-zuojiantou c-black pl10"})),h.a.createElement(V.a,{flex:"1",className:"tc"},rt==null||((we=rt.target)===null||we===void 0)?void 0:we.name,"\u4E0E\u4F60\u7684\u79C1\u4FE1"),h.a.createElement(V.a,{flex:"290px",className:"tl"},h.a.createElement("span",{className:"pl30"},"\u79C1\u4FE1\u5217\u8868")))),h.a.createElement($.a,null,h.a.createElement(V.a,{flex:"1"},h.a.createElement($e,null)),h.a.createElement(V.a,{flex:"290px"},h.a.createElement(K,null))))))))},se=Ee.default=Object(m.a)(function(ae){var ve=ae.messages,we=ae.loading,Pe=ae.user,_e=ae.globalSetting;return{messages:ve,globalSetting:_e,user:Pe,loading:we.effects}})(tt)},fjLI:function(mt,Ee,Q){"use strict";Q.d(Ee,"e",function(){return k}),Q.d(Ee,"a",function(){return d}),Q.d(Ee,"c",function(){return h}),Q.d(Ee,"d",function(){return m}),Q.d(Ee,"b",function(){return p});var ne=Q("8HAY"),$=Q("Cg/j"),O=Q("T8No"),V=Q("nnTU"),_=Q("MI8n"),P=function(){var v=function(a,i){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,l){s.__proto__=l}||function(s,l){for(var C in l)l.hasOwnProperty(C)&&(s[C]=l[C])},v(a,i)};return function(a,i){v(a,i);function s(){this.constructor=a}a.prototype=i===null?Object.create(i):(s.prototype=i.prototype,new s)}}(),F=function(v,a,i,s){var l=arguments.length,C=l<3?a:s===null?s=Object.getOwnPropertyDescriptor(a,i):s,g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(v,a,i,s);else for(var y=v.length-1;y>=0;y--)(g=v[y])&&(C=(l<3?g(C):l>3?g(a,i,C):g(a,i))||C);return l>3&&C&&Object.defineProperty(a,i,C),C},N=function(v,a){return function(i,s){a(i,s,v)}},M=function(){for(var v=0,a=0,i=arguments.length;a=0&&(l.splice(C,1),s._onDidChangeMenu.fire(a))}}},v.prototype.getMenuItems=function(a){var i=(this._menuItems.get(a)||[]).slice(0);return a===0&&this._appendImplicitItems(i),i},v.prototype._appendImplicitItems=function(a){for(var i=new Set,s=a.filter(function(w){return k(w)}),l=0,C=s;l` "'(~:]+/,p=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,v=/^\s*\[[^\]]+?\]:.*$/,a=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/,i=" ";function s(z,B,ee){return B.f=B.inline=ee,ee(z,B)}function l(z,B,ee){return B.f=B.block=ee,ee(z,B)}function C(z){return!z||!/\S/.test(z.string)}function g(z){if(z.linkTitle=!1,z.linkHref=!1,z.linkText=!1,z.em=!1,z.strong=!1,z.strikethrough=!1,z.quote=0,z.indentedCode=!1,z.f==R){var B=_;if(!B){var ee=ne.innerMode(V,z.htmlState);B=ee.mode.name=="xml"&&ee.state.tagStart===null&&!ee.state.context&&ee.state.tokenize.isInText}B&&(z.f=f,z.block=y,z.htmlState=null)}return z.trailingSpace=0,z.trailingSpaceNewLine=!1,z.prevLine=z.thisLine,z.thisLine={stream:null},null}function y(z,B){var ee=z.column()===B.indentation,ie=C(B.prevLine.stream),de=B.indentedCode,be=B.prevLine.hr,Ie=B.list!==!1,Ae=(B.listStack[B.listStack.length-1]||0)+3;B.indentedCode=!1;var Re=B.indentation;if(B.indentationDiff===null&&(B.indentationDiff=B.indentation,Ie)){for(B.list=null;Re=4&&(de||B.prevLine.fencedCodeEnd||B.prevLine.header||ie))return z.skipToEnd(),B.indentedCode=!0,F.code;if(z.eatSpace())return null;if(ee&&B.indentation<=Ae&&(ge=z.match(h))&&ge[1].length<=6)return B.quote=0,B.header=ge[1].length,B.thisLine.header=!0,O.highlightFormatting&&(B.formatting="header"),B.f=B.inline,T(B);if(B.indentation<=Ae&&z.eat(">"))return B.quote=ee?1:B.quote+1,O.highlightFormatting&&(B.formatting="quote"),z.eatSpace(),T(B);if(!De&&!B.setext&&ee&&B.indentation<=Ae&&(ge=z.match(k))){var ue=ge[1]?"ol":"ul";return B.indentation=Re+z.current().length,B.list=!0,B.quote=0,B.listStack.push(B.indentation),B.em=!1,B.strong=!1,B.code=!1,B.strikethrough=!1,O.taskLists&&z.match(d,!1)&&(B.taskList=!0),B.f=B.inline,O.highlightFormatting&&(B.formatting=["list","list-"+ue]),T(B)}else{if(ee&&B.indentation<=Ae&&(ge=z.match(p,!0)))return B.quote=0,B.fencedEndRE=new RegExp(ge[1]+"+ *$"),B.localMode=O.fencedCodeBlockHighlighting&&P(ge[2]||O.fencedCodeBlockDefaultMode),B.localMode&&(B.localState=ne.startState(B.localMode)),B.f=B.block=w,O.highlightFormatting&&(B.formatting="code-block"),B.code=-1,T(B);if(B.setext||(!ke||!Ie)&&!B.quote&&B.list===!1&&!B.code&&!De&&!v.test(z.string)&&(ge=z.lookAhead(1))&&(ge=ge.match(S)))return B.setext?(B.header=B.setext,B.setext=0,z.skipToEnd(),O.highlightFormatting&&(B.formatting="header")):(B.header=ge[0].charAt(0)=="="?1:2,B.setext=B.header),B.thisLine.header=!0,B.f=B.inline,T(B);if(De)return z.skipToEnd(),B.hr=!0,B.thisLine.hr=!0,F.hr;if(z.peek()==="[")return s(z,B,I)}return s(z,B,B.inline)}function R(z,B){var ee=V.token(z,B.htmlState);if(!_){var ie=ne.innerMode(V,B.htmlState);(ie.mode.name=="xml"&&ie.state.tagStart===null&&!ie.state.context&&ie.state.tokenize.isInText||B.md_inside&&z.current().indexOf(">")>-1)&&(B.f=f,B.block=y,B.htmlState=null)}return ee}function w(z,B){var ee=B.listStack[B.listStack.length-1]||0,ie=B.indentation=z.quote?B.push(F.formatting+"-"+z.formatting[ee]+"-"+z.quote):B.push("error"))}if(z.taskOpen)return B.push("meta"),B.length?B.join(" "):null;if(z.taskClosed)return B.push("property"),B.length?B.join(" "):null;if(z.linkHref?B.push(F.linkHref,"url"):(z.strong&&B.push(F.strong),z.em&&B.push(F.em),z.strikethrough&&B.push(F.strikethrough),z.emoji&&B.push(F.emoji),z.linkText&&B.push(F.linkText),z.code&&B.push(F.code),z.image&&B.push(F.image),z.imageAltText&&B.push(F.imageAltText,"link"),z.imageMarker&&B.push(F.imageMarker)),z.header&&B.push(F.header,F.header+"-"+z.header),z.quote&&(B.push(F.quote),!O.maxBlockquoteDepth||O.maxBlockquoteDepth>=z.quote?B.push(F.quote+"-"+z.quote):B.push(F.quote+"-"+O.maxBlockquoteDepth)),z.list!==!1){var ie=(z.listStack.length-1)%3;ie?ie===1?B.push(F.list2):B.push(F.list3):B.push(F.list1)}return z.trailingSpaceNewLine?B.push("trailing-space-new-line"):z.trailingSpace&&B.push("trailing-space-"+(z.trailingSpace%2?"a":"b")),B.length?B.join(" "):null}function b(z,B){return z.match(m,!0)?T(B):void 0}function f(z,B){var ee=B.text(z,B);if(typeof ee!="undefined")return ee;if(B.list)return B.list=null,T(B);if(B.taskList){var ie=z.match(d,!0)[1]===" ";return ie?B.taskOpen=!0:B.taskClosed=!0,O.highlightFormatting&&(B.formatting="task"),B.taskList=!1,T(B)}if(B.taskOpen=!1,B.taskClosed=!1,B.header&&z.match(/^#+$/,!0))return O.highlightFormatting&&(B.formatting="header"),T(B);var de=z.next();if(B.linkTitle){B.linkTitle=!1;var be=de;de==="("&&(be=")"),be=(be+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ie="^\\s*(?:[^"+be+"\\\\]+|\\\\\\\\|\\\\.)"+be;if(z.match(new RegExp(Ie),!0))return F.linkHref}if(de==="`"){var Ae=B.formatting;O.highlightFormatting&&(B.formatting="code"),z.eatWhile("`");var Re=z.current().length;if(B.code==0&&(!B.quote||Re==1))return B.code=Re,T(B);if(Re==B.code){var ke=T(B);return B.code=0,ke}else return B.formatting=Ae,T(B)}else if(B.code)return T(B);if(de==="\\"&&(z.next(),O.highlightFormatting)){var De=T(B),ge=F.formatting+"-escape";return De?De+" "+ge:ge}if(de==="!"&&z.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return B.imageMarker=!0,B.image=!0,O.highlightFormatting&&(B.formatting="image"),T(B);if(de==="["&&B.imageMarker&&z.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return B.imageMarker=!1,B.imageAltText=!0,O.highlightFormatting&&(B.formatting="image"),T(B);if(de==="]"&&B.imageAltText){O.highlightFormatting&&(B.formatting="image");var De=T(B);return B.imageAltText=!1,B.image=!1,B.inline=B.f=L,De}if(de==="["&&!B.image)return B.linkText&&z.match(/^.*?\]/)||(B.linkText=!0,O.highlightFormatting&&(B.formatting="link")),T(B);if(de==="]"&&B.linkText){O.highlightFormatting&&(B.formatting="link");var De=T(B);return B.linkText=!1,B.inline=B.f=z.match(/\(.*?\)| ?\[.*?\]/,!1)?L:f,De}if(de==="<"&&z.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){B.f=B.inline=u,O.highlightFormatting&&(B.formatting="link");var De=T(B);return De?De+=" ":De="",De+F.linkInline}if(de==="<"&&z.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){B.f=B.inline=u,O.highlightFormatting&&(B.formatting="link");var De=T(B);return De?De+=" ":De="",De+F.linkEmail}if(O.xml&&de==="<"&&z.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ue=z.string.indexOf(">",z.pos);if(ue!=-1){var Me=z.string.substring(z.start,ue);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Me)&&(B.md_inside=!0)}return z.backUp(1),B.htmlState=ne.startState(V),l(z,B,R)}if(O.xml&&de==="<"&&z.match(/^\/\w*?>/))return B.md_inside=!1,"tag";if(de==="*"||de==="_"){for(var $e=1,Ke=z.pos==1?" ":z.string.charAt(z.pos-2);$e<3&&z.eat(de);)$e++;var tt=z.peek()||" ",se=!/\s/.test(tt)&&(!a.test(tt)||/\s/.test(Ke)||a.test(Ke)),ae=!/\s/.test(Ke)&&(!a.test(Ke)||/\s/.test(tt)||a.test(tt)),ve=null,we=null;if($e%2&&(!B.em&&se&&(de==="*"||!ae||a.test(Ke))?ve=!0:B.em==de&&ae&&(de==="*"||!se||a.test(tt))&&(ve=!1)),$e>1&&(!B.strong&&se&&(de==="*"||!ae||a.test(Ke))?we=!0:B.strong==de&&ae&&(de==="*"||!se||a.test(tt))&&(we=!1)),we!=null||ve!=null){O.highlightFormatting&&(B.formatting=ve==null?"strong":we==null?"em":"strong em"),ve===!0&&(B.em=de),we===!0&&(B.strong=de);var ke=T(B);return ve===!1&&(B.em=!1),we===!1&&(B.strong=!1),ke}}else if(de===" "&&(z.eat("*")||z.eat("_"))){if(z.peek()===" ")return T(B);z.backUp(1)}if(O.strikethrough){if(de==="~"&&z.eatWhile(de)){if(B.strikethrough){O.highlightFormatting&&(B.formatting="strikethrough");var ke=T(B);return B.strikethrough=!1,ke}else if(z.match(/^[^\s]/,!1))return B.strikethrough=!0,O.highlightFormatting&&(B.formatting="strikethrough"),T(B)}else if(de===" "&&z.match(/^~~/,!0)){if(z.peek()===" ")return T(B);z.backUp(2)}}if(O.emoji&&de===":"&&z.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){B.emoji=!0,O.highlightFormatting&&(B.formatting="emoji");var Pe=T(B);return B.emoji=!1,Pe}return de===" "&&(z.match(/^ +$/,!1)?B.trailingSpace++:B.trailingSpace&&(B.trailingSpaceNewLine=!0)),T(B)}function u(z,B){var ee=z.next();if(ee===">"){B.f=B.inline=f,O.highlightFormatting&&(B.formatting="link");var ie=T(B);return ie?ie+=" ":ie="",ie+F.linkInline}return z.match(/^[^>]+/,!0),F.linkInline}function L(z,B){if(z.eatSpace())return null;var ee=z.next();return ee==="("||ee==="["?(B.f=B.inline=A(ee==="("?")":"]"),O.highlightFormatting&&(B.formatting="link-string"),B.linkHref=!0,T(B)):"error"}var x={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function A(z){return function(B,ee){var ie=B.next();if(ie===z){ee.f=ee.inline=f,O.highlightFormatting&&(ee.formatting="link-string");var de=T(ee);return ee.linkHref=!1,de}return B.match(x[z]),ee.linkHref=!0,T(ee)}}function I(z,B){return z.match(/^([^\]\\]|\\.)*\]:/,!1)?(B.f=W,z.next(),O.highlightFormatting&&(B.formatting="link"),B.linkText=!0,T(B)):s(z,B,f)}function W(z,B){if(z.match(/^\]:/,!0)){B.f=B.inline=K,O.highlightFormatting&&(B.formatting="link");var ee=T(B);return B.linkText=!1,ee}return z.match(/^([^\]\\]|\\.)+/,!0),F.linkText}function K(z,B){return z.eatSpace()?null:(z.match(/^[^\s]+/,!0),z.peek()===void 0?B.linkTitle=!0:z.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),B.f=B.inline=f,F.linkHref+" url")}var Z={startState:function(){return{f:y,prevLine:{stream:null},thisLine:{stream:null},block:y,htmlState:null,indentation:0,inline:f,text:b,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(z){return{f:z.f,prevLine:z.prevLine,thisLine:z.thisLine,block:z.block,htmlState:z.htmlState&&ne.copyState(V,z.htmlState),indentation:z.indentation,localMode:z.localMode,localState:z.localMode?ne.copyState(z.localMode,z.localState):null,inline:z.inline,text:z.text,formatting:!1,linkText:z.linkText,linkTitle:z.linkTitle,linkHref:z.linkHref,code:z.code,em:z.em,strong:z.strong,strikethrough:z.strikethrough,emoji:z.emoji,header:z.header,setext:z.setext,hr:z.hr,taskList:z.taskList,list:z.list,listStack:z.listStack.slice(0),quote:z.quote,indentedCode:z.indentedCode,trailingSpace:z.trailingSpace,trailingSpaceNewLine:z.trailingSpaceNewLine,md_inside:z.md_inside,fencedEndRE:z.fencedEndRE}},token:function(z,B){if(B.formatting=!1,z!=B.thisLine.stream){if(B.header=0,B.hr=!1,z.match(/^\s*$/,!0))return g(B),null;if(B.prevLine=B.thisLine,B.thisLine={stream:z},B.taskList=!1,B.trailingSpace=0,B.trailingSpaceNewLine=!1,!B.localState&&(B.f=B.block,B.f!=R)){var ee=z.match(/^\s*/,!0)[0].replace(/\t/g,i).length;if(B.indentation=ee,B.indentationDiff=null,ee>0)return null}}return B.f(z,B)},innerMode:function(z){return z.block==R?{state:z.htmlState,mode:V}:z.localState?{state:z.localState,mode:z.localMode}:{state:z,mode:Z}},indent:function(z,B,ee){return z.block==R&&V.indent?V.indent(z.htmlState,B,ee):z.localState&&z.localMode.indent?z.localMode.indent(z.localState,B,ee):ne.Pass},blankLine:g,getType:T,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Z},"xml"),ne.defineMIME("text/markdown","markdown"),ne.defineMIME("text/x-markdown","markdown")})},nnTU:function(mt,Ee,Q){"use strict";Q.d(Ee,"b",function(){return N}),Q.d(Ee,"a",function(){return M});var ne=Q("pmY6"),$=Q("746U"),O=Q("Cg/j"),V=Q("MI8n"),_=Q("24hK"),P=Q("QDVR"),F=function(){for(var k=0,d=0,h=arguments.length;d=a.max?void 0:(a.ch=0,a.text=a.cm.getLine(++a.line),!0)}function k(a){return a.line<=a.min?void 0:(a.text=a.cm.getLine(--a.line),a.ch=a.text.length,!0)}function d(a){for(;;){var i=a.text.indexOf(">",a.ch);if(i==-1){if(M(a))continue;return}if(!N(a,i+1)){a.ch=i+1;continue}var s=a.text.lastIndexOf("/",i),l=s>-1&&!/\S/.test(a.text.slice(s+1,i));return a.ch=i+1,l?"selfClose":"regular"}}function h(a){for(;;){var i=a.ch?a.text.lastIndexOf("<",a.ch-1):-1;if(i==-1){if(k(a))continue;return}if(!N(a,i+1)){a.ch=i;continue}P.lastIndex=i,a.ch=i;var s=P.exec(a.text);if(s&&s.index==i)return s}}function S(a){for(;;){P.lastIndex=a.ch;var i=P.exec(a.text);if(!i){if(M(a))continue;return}if(!N(a,i.index+1)){a.ch=i.index+1;continue}return a.ch=i.index+i[0].length,i}}function m(a){for(;;){var i=a.ch?a.text.lastIndexOf(">",a.ch-1):-1;if(i==-1){if(k(a))continue;return}if(!N(a,i+1)){a.ch=i;continue}var s=a.text.lastIndexOf("/",i),l=s>-1&&!/\S/.test(a.text.slice(s+1,i));return a.ch=i+1,l?"selfClose":"regular"}}function p(a,i){for(var s=[];;){var l=S(a),C,g=a.line,y=a.ch-(l?l[0].length:0);if(!l||!(C=d(a)))return;if(C=="selfClose")continue;if(l[1]){for(var R=s.length-1;R>=0;--R)if(s[R]==l[2]){s.length=R;break}if(R<0&&(!i||i==l[2]))return{tag:l[2],from:$(g,y),to:$(a.line,a.ch)}}else s.push(l[2])}}function v(a,i){for(var s=[];;){var l=m(a);if(!l)return;if(l=="selfClose"){h(a);continue}var C=a.line,g=a.ch,y=h(a);if(!y)return;if(y[1])s.push(y[2]);else{for(var R=s.length-1;R>=0;--R)if(s[R]==y[2]){s.length=R;break}if(R<0&&(!i||i==y[2]))return{tag:y[2],from:$(a.line,a.ch),to:$(C,g)}}}}ne.registerHelper("fold","xml",function(a,i){for(var s=new F(a,i.line,0);;){var l=S(s);if(!l||s.line!=i.line)return;var C=d(s);if(!C)return;if(!l[1]&&C!="selfClose"){var g=$(s.line,s.ch),y=p(s,l[2]);return y&&O(y.from,g)>0?{from:g,to:y.from}:null}}}),ne.findMatchingTag=function(a,i,s){var l=new F(a,i.line,i.ch,s);if(l.text.indexOf(">")==-1&&l.text.indexOf("<")==-1)return;var C=d(l),g=C&&$(l.line,l.ch),y=C&&h(l);if(!C||!y||O(l,i)>0)return;var R={from:$(l.line,l.ch),to:g,tag:y[2]};return C=="selfClose"?{open:R,close:null,at:"open"}:y[1]?{open:v(l,y[2]),close:R,at:"close"}:(l=new F(a,g.line,g.ch,s),{open:R,close:p(l,y[2]),at:"open"})},ne.findEnclosingTag=function(a,i,s,l){for(var C=new F(a,i.line,i.ch,s);;){var g=v(C,l);if(!g)break;var y=new F(a,i.line,i.ch,s),R=p(y,g.tag);if(R)return{open:g,close:R}}},ne.scanForClosingTag=function(a,i,s,l){var C=new F(a,i.line,i.ch,l?{from:0,to:l}:null);return p(C,s)}})},p5ED:function(mt,Ee,Q){"use strict";var ne=Q("+L6B"),$=Q("2/Rp"),O=Q("5Dmo"),V=Q("3S7+"),_=Q("k1fw"),P=Q("9og8"),F=Q("tJVT"),N=Q("WmNS"),M=Q.n(N),k=Q("q1tI"),d=Q.n(k),h=Q("vHTk"),S=Q.n(h),m=Q("yEEn"),p=Q("ZW9T"),v=Q("1vsH"),a=Q("V0Rq"),i=Q("m3rI");Ee.a=function(s){var l,C,g,y,R,w,T=s.editOffice,b=T===void 0?"view":T,f=s.name,u=s.data,L=s.theme,x=s.type,A=s.filename,I=s.monacoEditor,W=s.className,K=s.style,Z=s.close,z=s.onClose,B=s.hasMask,ee=s.disabledDownload,ie=s.onImgDimensions,de=s.otherData,be=Object(k.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),Ie=Object(F.a)(be,2),Ae=Ie[0],Re=Ie[1],ke=Object(k.useState)(""),De=Object(F.a)(ke,2),ge=De[0],ue=De[1],Me=Object(k.useState)(),$e=Object(F.a)(Me,2),Ke=$e[0],tt=$e[1],se=window.ENV==="build"?"/react/build":"",ae=location.host.startsWith("localhost")?i.a.PROXY_SERVER:i.a.API_SERVER,ve,we=1024*1024,Pe=10*we,_e=Object(k.useRef)();(l=u)!==null&&l!==void 0&&l.startsWith("/api")&&x!=="txt"&&(u=i.a.API_SERVER+u),x==="office"&&(ve=Object(v.P)(u).filesize,ve>Pe&&(x="other")),A&&(I.filename=A),Object(k.useEffect)(function(){var Je,Qe,Ve=(Je=document.cookie)===null||Je===void 0||((Qe=Je.replace(/\s/g,""))===null||Qe===void 0)?void 0:Qe.split(";");Ve==null||Ve.map(function(ht){var it=ht.split("=");it[0]==="_educoder_session"&&ue(it[1])})},[]),Object(k.useEffect)(function(){x==="office"&&Ue()},[x,u]);var Ue=function(){var Je=Object(P.a)(M.a.mark(function Qe(){var Ve,ht,it;return M.a.wrap(function(Le){for(;;)switch(Le.prev=Le.next){case 0:return console.log("data:",u),Ve=u,u.startsWith("http")||(Ve=location.origin+Ve),ht=new URL(Ve).pathname.split("/").pop(),Le.next=6,Object(a.U)({attachment_id:ht});case 6:it=Le.sent,tt(it);case 8:case"end":return Le.stop()}},Qe)}));return function(){return Je.apply(this,arguments)}}(),je=function(){if(u.startsWith("http")||u.startsWith("blob:")){at();return}Object(v.x)(A||"educoder",u,A)},at=function(){Object(v.v)(A||"educoder",decodeURIComponent(u))};return d.a.createElement("div",{style:Object(_.a)({},K||{}),className:"".concat(B&&S.a.bgBlack," ").concat(x?S.a.wrp:"hide")},Z&&d.a.createElement("div",{className:S.a.close,ref:_e},!!ie&&d.a.createElement(V.a,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:function(){return _e.current}},d.a.createElement("span",{onClick:function(){z(),ie()}},d.a.createElement("i",{className:"icon-yulanpizhu"}))),!ee&&d.a.createElement(V.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return _e.current}},d.a.createElement("span",{onClick:at},d.a.createElement("i",{className:"icon-quxiaozhiding"}))),d.a.createElement(V.a,{title:"\u5173\u95ED",getPopupContainer:function(){return _e.current}},d.a.createElement("span",{className:"",onClick:z},d.a.createElement("i",{className:"icon-guanbi1"})))),d.a.createElement("div",{className:"".concat(S.a[W]," ").concat(W," ").concat(S.a.monaco," ").concat(x==="txt"?"show":"hide")},x==="txt"&&d.a.createElement(p.b,I)),x==="audio"&&d.a.createElement("audio",{src:"".concat(((C=u)===null||C===void 0?void 0:C.indexOf("http://"))>-1||((g=u)===null||g===void 0?void 0:g.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(u),autoPlay:!0}),x==="video"&&d.a.createElement(d.a.Fragment,null,((y=u)===null||y===void 0?void 0:y.indexOf("http"))>-1?d.a.createElement("video",{controls:!0,src:"".concat(u),autoPlay:!0}):d.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(u),autoPlay:!0})),x==="office"&&Ke&&d.a.createElement("iframe",{src:"".concat(se,"/office.html?key=").concat(Ke.key,"&url=").concat(ae+Ke.url,"&callbackUrl=").concat(ae+Ke.callbackUrl,"&fileType=").concat(Ke.fileType,"&title=").concat(Ke.title,"&model=").concat(b,"&officeServer=").concat(i.a.OFFICE_SERVER,"&disabledDownload=").concat(!!ee)}),(x==="xlsx"||x==="doc"||x==="pptx"||x==="docx")&&d.a.createElement("iframe",{src:"/react/build/office.html?key=".concat(de.key,"&url=").concat(i.a.API_SERVER+de.url,"&callbackUrl=").concat(i.a.API_SERVER+de.callbackUrl,"&fileType=").concat(de.fileType,"&title=").concat(de.title,"&model=").concat(de.model)}),x==="html"&&d.a.createElement("iframe",{src:u+"&disposition=inline"}),x==="pdf"&&d.a.createElement("embed",{className:S.a.embed,src:u}),x==="image"&&d.a.createElement("img",{src:"".concat(((R=u)===null||R===void 0?void 0:R.indexOf("http://"))>-1||((w=u)===null||w===void 0?void 0:w.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(u)}),x==="other"&&d.a.createElement("div",null,d.a.createElement($.a,{type:"primary",size:"large",onClick:je},d.a.createElement(m.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),x==="download"&&d.a.createElement($.a,{type:"primary",size:"large",onClick:je},d.a.createElement(m.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(mt,Ee,Q){},pmY6:function(mt,Ee,Q){"use strict";Q.d(Ee,"g",function(){return _}),Q.d(Ee,"f",function(){return P}),Q.d(Ee,"e",function(){return F}),Q.d(Ee,"h",function(){return N}),Q.d(Ee,"b",function(){return M}),Q.d(Ee,"a",function(){return k}),Q.d(Ee,"d",function(){return d}),Q.d(Ee,"c",function(){return h});var ne=!1,$="__is_disposable_tracked__";function O(S){if(!ne)return;if(S&&S!==k.None)try{S[$]=!0}catch(m){}}function V(S){if(!ne)return S;var m=new Error("Potentially leaked disposable").stack;return setTimeout(function(){S[$]||console.log(m)},3e3),S}function _(S){return typeof S.dispose=="function"&&S.dispose.length===0}function P(S){return Array.isArray(S)?(S.forEach(function(m){m&&(O(m),m.dispose())}),[]):S?(O(S),S.dispose(),S):void 0}function F(){for(var S=[],m=0;m=O.length?{done:!0}:{done:!1,value:O[P++]}},e:function(h){throw h},f:F}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var N=!0,M=!1,k;return{s:function(){_=O[Symbol.iterator]()},n:function(){var h=_.next();return N=h.done,h},e:function(h){M=!0,k=h},f:function(){try{!N&&_.return!=null&&_.return()}finally{if(M)throw k}}}}},rUJ1:function(mt,Ee){const Q=/[&<>"']/,ne=/[&<>"']/g,$=/[<>"']|&(?!#?\w+;)/,O=/[<>"']|&(?!#?\w+;)/g,V={"&":"&","<":"<",">":">",'"':""","'":"'"},_=w=>V[w];function P(w,T){if(T){if(Q.test(w))return w.replace(ne,_)}else if($.test(w))return w.replace(O,_);return w}const F=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function N(w){return w.replace(F,(T,b)=>(b=b.toLowerCase(),b==="colon"?":":b.charAt(0)==="#"?b.charAt(1)==="x"?String.fromCharCode(parseInt(b.substring(2),16)):String.fromCharCode(+b.substring(1)):""))}const M=/(^|[^\[])\^/g;function k(w,T){w=w.source||w,T=T||"";const b={replace:(f,u)=>(u=u.source||u,u=u.replace(M,"$1"),w=w.replace(f,u),b),getRegex:()=>new RegExp(w,T)};return b}const d=/[^\w:]/g,h=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function S(w,T,b){if(w){let f;try{f=decodeURIComponent(N(b)).replace(d,"").toLowerCase()}catch(u){return null}if(f.indexOf("javascript:")===0||f.indexOf("vbscript:")===0||f.indexOf("data:")===0)return null}T&&!h.test(b)&&(b=i(T,b));try{b=encodeURI(b).replace(/%25/g,"%")}catch(f){return null}return b}const m={},p=/^[^:]+:\/*[^/]*$/,v=/^([^:]+:)[\s\S]*$/,a=/^([^:]+:\/*[^/]*)[\s\S]*$/;function i(w,T){m[" "+w]||(p.test(w)?m[" "+w]=w+"/":m[" "+w]=g(w,"/",!0)),w=m[" "+w];const b=w.indexOf(":")===-1;return T.substring(0,2)==="//"?b?T:w.replace(v,"$1")+T:T.charAt(0)==="/"?b?T:w.replace(a,"$1")+T:w+T}const s={exec:function(){}};function l(w){let T=1,b,f;for(;T{let I=!1,W=x;for(;--W>=0&&A[W]==="\\";)I=!I;return I?"|":" |"}),f=b.split(/ \|/);let u=0;if(f.length>T)f.splice(T);else for(;f.length0},!1)}function d(h,S){for(var m={main:[S]},p={main:[]},v={main:{}};k(m);)for(var a=Object.keys(m),i=0;i=2*R/T||A<=W)return;var K=Number.POSITIVE_INFINITY,Z;for(Z=a.level-1;Z>f;Z--){var z=b[Z].maxBitrate;if(K=R*z/(8*.8*x),K=A)return;var B=this.bwEstimator.getEstimate();k.logger.warn("Fragment "+a.sn+(i?" part "+i.index:"")+" of level "+a.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+Z+` Current BW estimate: `+(Object(V.isFiniteNumber)(B)?(B/1024).toFixed(3):"Unknown")+` Kb/s Estimated load time for current fragment: `+A.toFixed(3)+` s Estimated load time for the next fragment: `+K.toFixed(3)+` s Time to underbuffer: `+W.toFixed(3)+" s"),s.nextLoadLevel=Z,this.bwEstimator.sample(w,y.loaded),this.clearTimer(),a.loader&&(this.fragCurrent=this.partCurrent=null,a.loader.abort()),s.trigger(P.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:a,part:i,stats:y})},p.onFragLoaded=function(a,i){var s=i.frag,l=i.part;if(s.type===M.PlaylistLevelType.MAIN&&Object(V.isFiniteNumber)(s.sn)){var C=l?l.stats:s.stats,g=l?l.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var y=this.hls.levels[s.level],R=(y.loaded?y.loaded.bytes:0)+C.loaded,w=(y.loaded?y.loaded.duration:0)+g;y.loaded={bytes:R,duration:w},y.realBitrate=Math.round(8*R/w)}if(s.bitrateTest){var T={stats:C,frag:s,part:l,id:s.type};this.onFragBuffered(P.Events.FRAG_BUFFERED,T),s.bitrateTest=!1}}},p.onFragBuffered=function(a,i){var s=i.frag,l=i.part,C=l?l.stats:s.stats;if(C.aborted)return;if(s.type!==M.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var g=C.parsing.end-C.loading.start;this.bwEstimator.sample(g,C.loaded),C.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=g/1e3:this.bitrateTestDelay=0},p.onError=function(a,i){switch(i.details){case N.ErrorDetails.FRAG_LOAD_ERROR:case N.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},p.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},p.getNextABRAutoLevel=function(){var a=this.fragCurrent,i=this.partCurrent,s=this.hls,l=s.maxAutoLevel,C=s.config,g=s.minAutoLevel,y=s.media,R=i?i.duration:a?a.duration:0,w=y?y.currentTime:0,T=y&&y.playbackRate!==0?Math.abs(y.playbackRate):1,b=this.bwEstimator?this.bwEstimator.getEstimate():C.abrEwmaDefaultEstimate,f=(F.BufferHelper.bufferInfo(y,w,C.maxBufferHole).end-w)/T,u=this.findBestLevel(b,g,l,f,C.abrBandWidthFactor,C.abrBandWidthUpFactor);if(u>=0)return u;k.logger.trace((f?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var L=R?Math.min(R,C.maxStarvationDelay):C.maxStarvationDelay,x=C.abrBandWidthFactor,A=C.abrBandWidthUpFactor;if(!f){var I=this.bitrateTestDelay;if(I){var W=R?Math.min(R,C.maxLoadingDelay):C.maxLoadingDelay;L=W-I,k.logger.trace("bitrate test took "+Math.round(1e3*I)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*L)+" ms"),x=A=1}}return u=this.findBestLevel(b,g,l,f+L,x,A),Math.max(u,0)},p.findBestLevel=function(a,i,s,l,C,g){for(var y,R=this.fragCurrent,w=this.partCurrent,T=this.lastLoadedFragLevel,b=this.hls.levels,f=b[T],u=!!(f!=null&&(y=f.details)!==null&&y!==void 0&&y.live),L=f==null?void 0:f.codecSet,x=w?w.duration:R?R.duration:0,A=s;A>=i;A--){var I=b[A];if(!I||L&&I.codecSet!==L)continue;var W=I.details,K=(w?W==null?void 0:W.partTarget:W==null?void 0:W.averagetargetduration)||x,Z=void 0;A<=T?Z=C*a:Z=g*a;var z=b[A].maxBitrate,B=z*K/Z;if(k.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+A+"/"+Math.round(Z)+"/"+z+"/"+K+"/"+l+"/"+B),Z>z&&(!B||u&&!this.bitrateTestDelay||B0&&f===-1?(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),this.state=_.State.IDLE):(this.loadedmetadata=!1,this.state=_.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=f,this.tick()},T.doTick=function(){switch(this.state){case _.State.IDLE:this.doTickIdle();break;case _.State.WAITING_TRACK:{var f,u=this.levels,L=this.trackId,x=u==null||((f=u[L])===null||f===void 0)?void 0:f.details;if(x){if(this.waitForCdnTuneIn(x))break;this.state=_.State.WAITING_INIT_PTS}break}case _.State.FRAG_LOADING_WAITING_RETRY:{var A,I=performance.now(),W=this.retryDate;(!W||I>=W||(A=this.media)!==null&&A!==void 0&&A.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=_.State.IDLE);break}case _.State.WAITING_INIT_PTS:{var K=this.waitingData;if(K){var Z=K.frag,z=K.part,B=K.cache,ee=K.complete;if(this.initPTS[Z.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=_.State.FRAG_LOADING;var ie=B.flush(),de={frag:Z,part:z,payload:ie,networkDetails:null};this._handleFragmentLoadProgress(de),ee&&R.prototype._handleFragmentLoadComplete.call(this,de)}else if(this.videoTrackCC!==this.waitingVideoCC)i.logger.log("Waiting fragment cc ("+Z.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var be=this.getLoadPosition(),Ie=F.BufferHelper.bufferInfo(this.mediaBuffer,be,this.config.maxBufferHole),Ae=Object(p.fragmentWithinToleranceTest)(Ie.end,this.config.maxFragLookUpTolerance,Z);Ae<0&&(i.logger.log("Waiting fragment cc ("+Z.cc+") @ "+Z.start+" cancelled because another fragment at "+Ie.end+" is needed"),this.clearWaitingFragment())}}else this.state=_.State.IDLE}}this.onTickEnd()},T.clearWaitingFragment=function(){var f=this.waitingData;f&&(this.fragmentTracker.removeFragment(f.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=_.State.IDLE)},T.onTickEnd=function(){var f=this.media;if(!f||!f.readyState)return;var u=this.mediaBuffer?this.mediaBuffer:f,L=u.buffered;!this.loadedmetadata&&L.length&&(this.loadedmetadata=!0),this.lastCurrentTime=f.currentTime},T.doTickIdle=function(){var f,u,L=this.hls,x=this.levels,A=this.media,I=this.trackId,W=L.config;if(!x||!x[I])return;if(!A&&(this.startFragRequested||!W.startFragPrefetch))return;var K=x[I],Z=K.details;if(!Z||Z.live&&this.levelLastLoaded!==I||this.waitForCdnTuneIn(Z)){this.state=_.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,d.ElementaryStreamTypes.AUDIO,k.PlaylistLevelType.AUDIO));var z=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,k.PlaylistLevelType.AUDIO);if(z===null)return;var B=z.len,ee=this.getMaxBufferLength(),ie=this.audioSwitch;if(B>=ee&&!ie)return;if(!ie&&this._streamEnded(z,Z)){L.trigger(P.Events.BUFFER_EOS,{type:"audio"}),this.state=_.State.ENDED;return}var de=Z.fragments,be=de[0].start,Ie=z.end;if(ie){var Ae=this.getLoadPosition();Ie=Ae,Z.PTSKnown&&Aebe||z.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),A.currentTime=be+.05))}var Re=this.getNextFragment(Ie,Z);if(!Re){this.bufferFlushed=!0;return}((f=Re.decryptdata)===null||f===void 0?void 0:f.keyFormat)==="identity"&&!((u=Re.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(Re,Z):this.loadFragment(Re,Z,Ie)},T.getMaxBufferLength=function(){var f=R.prototype.getMaxBufferLength.call(this),u=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,k.PlaylistLevelType.MAIN);return u===null?f:Math.max(f,u.len)},T.onMediaDetaching=function(){this.videoBuffer=null,R.prototype.onMediaDetaching.call(this)},T.onAudioTracksUpdated=function(f,u){var L=u.audioTracks;this.resetTransmuxer(),this.levels=L.map(function(x){return new M.Level(x)})},T.onAudioTrackSwitching=function(f,u){var L=!!u.url;this.trackId=u.id;var x=this.fragCurrent;x!=null&&x.loader&&x.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),L?this.setInterval(g):this.resetTransmuxer(),L?(this.audioSwitch=!0,this.state=_.State.IDLE):this.state=_.State.STOPPED,this.tick()},T.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},T.onLevelLoaded=function(f,u){this.mainDetails=u.details},T.onAudioTrackLoaded=function(f,u){var L,x=this.levels,A=u.details,I=u.id;if(!x){this.warn("Audio tracks were reset while loading level "+I);return}this.log("Track "+I+" loaded ["+A.startSN+","+A.endSN+"],duration:"+A.totalduration);var W=x[I],K=0;if(A.live||(L=W.details)!==null&&L!==void 0&&L.live){var Z=this.mainDetails;if(A.fragments[0]||(A.deltaUpdateFailed=!0),A.deltaUpdateFailed||!Z)return;!W.details&&A.hasProgramDateTime&&Z.hasProgramDateTime?(Object(v.alignMediaPlaylistByPDT)(A,Z),K=A.fragments[0].start):K=this.alignPlaylists(A,W.details)}W.details=A,this.levelLastLoaded=I,!this.startFragRequested&&(this.mainDetails||!A.live)&&this.setStartPosition(W.details,K),this.state===_.State.WAITING_TRACK&&!this.waitForCdnTuneIn(A)&&(this.state=_.State.IDLE),this.tick()},T._handleFragmentLoadProgress=function(f){var u,L=f.frag,x=f.part,A=f.payload,I=this.config,W=this.trackId,K=this.levels;if(!K){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+L.sn+" of level "+L.level+" will not be buffered");return}var Z=K[W];console.assert(Z,"Audio track is defined on fragment load progress");var z=Z.details;console.assert(z,"Audio track details are defined on fragment load progress");var B=I.defaultAudioCodec||Z.audioCodec||"mp4a.40.2",ee=this.transmuxer;ee||(ee=this.transmuxer=new S.default(this.hls,k.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ie=this.initPTS[L.cc],de=(u=L.initSegment)===null||u===void 0?void 0:u.data;if(ie!==void 0){var be=!1,Ie=x?x.index:-1,Ae=Ie!==-1,Re=new m.ChunkMetadata(L.level,L.sn,L.stats.chunkCount,A.byteLength,Ie,Ae);ee.push(A,de,B,"",L,x,z.totalduration,be,Re,ie)}else{i.logger.log("Unknown video PTS for cc "+L.cc+", waiting for video PTS before demuxing audio frag "+L.sn+" of ["+z.startSN+" ,"+z.endSN+"],track "+W);var ke=this.waitingData=this.waitingData||{frag:L,part:x,cache:new h.default,complete:!1},De=ke.cache;De.push(new Uint8Array(A)),this.waitingVideoCC=this.videoTrackCC,this.state=_.State.WAITING_INIT_PTS}},T._handleFragmentLoadComplete=function(f){if(this.waitingData){this.waitingData.complete=!0;return}R.prototype._handleFragmentLoadComplete.call(this,f)},T.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},T.onBufferCreated=function(f,u){var L=u.tracks.audio;L&&(this.mediaBuffer=L.buffer),u.tracks.video&&(this.videoBuffer=u.tracks.video.buffer)},T.onFragBuffered=function(f,u){var L=u.frag,x=u.part;if(L.type!==k.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(L)){this.warn("Fragment "+L.sn+(x?" p: "+x.index:"")+" of level "+L.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}L.sn!=="initSegment"&&(this.fragPrevious=L,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(L,x)},T.onError=function(f,u){switch(u.details){case a.ErrorDetails.FRAG_LOAD_ERROR:case a.ErrorDetails.FRAG_LOAD_TIMEOUT:case a.ErrorDetails.KEY_LOAD_ERROR:case a.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(k.PlaylistLevelType.AUDIO,u);break;case a.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case a.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==_.State.ERROR&&this.state!==_.State.STOPPED&&(this.state=u.fatal?_.State.ERROR:_.State.IDLE,this.warn(u.details+" while loading frag, switching to "+this.state+" state"));break;case a.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="audio"&&(this.state===_.State.PARSING||this.state===_.State.PARSED)){var L=!0,x=this.getFwdBufferInfo(this.mediaBuffer,k.PlaylistLevelType.AUDIO);x&&x.len>.5&&(L=!this.reduceMaxBufferLength(x.len)),L&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,R.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},T.onBufferFlushed=function(f,u){var L=u.type;L===d.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},T._handleTransmuxComplete=function(f){var u,L="audio",x=this.hls,A=f.remuxResult,I=f.chunkMeta,W=this.getCurrentContext(I);if(!W){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 K=W.frag,Z=W.part,z=A.audio,B=A.text,ee=A.id3,ie=A.initSegment;if(this.fragContextChanged(K))return;if(this.state=_.State.PARSING,this.audioSwitch&&z&&this.completeAudioSwitch(),ie!=null&&ie.tracks&&(this._bufferInitSegment(ie.tracks,K,I),x.trigger(P.Events.FRAG_PARSING_INIT_SEGMENT,{frag:K,id:L,tracks:ie.tracks})),z){var de=z.startPTS,be=z.endPTS,Ie=z.startDTS,Ae=z.endDTS;Z&&(Z.elementaryStreams[d.ElementaryStreamTypes.AUDIO]={startPTS:de,endPTS:be,startDTS:Ie,endDTS:Ae}),K.setElementaryStreamInfo(d.ElementaryStreamTypes.AUDIO,de,be,Ie,Ae),this.bufferFragmentData(z,K,Z,I)}if(ee!=null&&(u=ee.samples)!==null&&u!==void 0&&u.length){var Re=s({frag:K,id:L},ee);x.trigger(P.Events.FRAG_PARSING_METADATA,Re)}if(B){var ke=s({frag:K,id:L},B);x.trigger(P.Events.FRAG_PARSING_USERDATA,ke)}},T._bufferInitSegment=function(f,u,L){if(this.state!==_.State.PARSING)return;f.video&&delete f.video;var x=f.audio;if(!x)return;x.levelCodec=x.codec,x.id="audio",this.log("Init audio buffer, container:"+x.container+", codecs[parsed]=["+x.codec+"]"),this.hls.trigger(P.Events.BUFFER_CODECS,f);var A=x.initSegment;if(A!=null&&A.byteLength){var I={type:"audio",frag:u,part:null,chunkMeta:L,parent:u.type,data:A};this.hls.trigger(P.Events.BUFFER_APPENDING,I)}this.tick()},T.loadFragment=function(f,u,L){var x=this.fragmentTracker.getState(f);this.fragCurrent=f,(this.audioSwitch||x===N.FragmentState.NOT_LOADED||x===N.FragmentState.PARTIAL)&&(f.sn==="initSegment"?this._loadInitSegment(f):u.live&&!Object(V.isFiniteNumber)(this.initPTS[f.cc])?(this.log("Waiting for video PTS in continuity counter "+f.cc+" of live stream before loading audio fragment "+f.sn+" of level "+this.trackId),this.state=_.State.WAITING_INIT_PTS):(this.startFragRequested=!0,R.prototype.loadFragment.call(this,f,u,L)))},T.completeAudioSwitch=function(){var f=this.hls,u=this.media,L=this.trackId;u&&(this.log("Switching audio track : flushing all audio"),R.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,f.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:L})},w}(_.default);$.default=y},"./src/controller/audio-track-controller.ts":function(ne,$,O){"use strict";O.r($);var V=O("./src/events.ts"),_=O("./src/errors.ts"),P=O("./src/controller/base-playlist-controller.ts"),F=O("./src/types/loader.ts");function N(S,m){for(var p=0;p=i.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=i[this.trackId];this.log("Now switching to audio-track index "+a);var l=i[a],C=l.id,g=l.groupId,y=g===void 0?"":g,R=l.name,w=l.type,T=l.url;if(this.trackId=a,this.trackName=R,this.selectDefaultTrack=!1,this.hls.trigger(V.Events.AUDIO_TRACK_SWITCHING,{id:C,groupId:y,name:R,type:w,url:T}),l.details&&!l.details.live)return;var b=this.switchParams(l.url,s==null?void 0:s.details);this.loadPlaylist(b)},p.selectInitialTrack=function(){var a=this.tracksInGroup;console.assert(a.length,"Initial audio track should be selected when tracks are known");var i=this.trackName,s=this.findTrackId(i)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(V.Events.ERROR,{type:_.ErrorTypes.MEDIA_ERROR,details:_.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},p.findTrackId=function(a){for(var i=this.tracksInGroup,s=0;sm.partTarget&&(l+=1)}if(Object(V.isFiniteNumber)(s))return new _.HlsUrlParameters(s,Object(V.isFiniteNumber)(l)?l:void 0,_.HlsSkip.No)}}},d.loadPlaylist=function(S){},d.shouldLoadTrack=function(S){return this.canLoad&&S&&!!S.url&&(!S.details||S.details.live)},d.playlistLoaded=function(S,m,p){var v=this,a=m.details,i=m.stats,s=i.loading.end?Math.max(0,self.performance.now()-i.loading.end):0;if(a.advancedDateTime=Date.now()-s,a.live||p!=null&&p.live){if(a.reloaded(p),p&&this.log("live playlist "+S+" "+(a.advanced?"REFRESHED "+a.lastPartSn+"-"+a.lastPartIndex:"MISSED")),p&&a.fragments.length>0&&Object(P.mergeDetails)(p,a),!this.canLoad||!a.live)return;var l,C=void 0,g=void 0;if(a.canBlockReload&&a.endSN&&a.advanced){var y=this.hls.config.lowLatencyMode,R=a.lastPartSn,w=a.endSN,T=a.lastPartIndex,b=T!==-1,f=R===w,u=y?0:T;b?(C=f?w+1:R,g=f?u:T+1):C=w+1;var L=a.age,x=L+a.ageHeader,A=Math.min(x-a.partTarget,a.targetduration*1.5);if(A>0){if(p&&A>p.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+p.tuneInGoal+" to: "+A+" with playlist age: "+a.age),A=0;else{var I=Math.floor(A/a.targetduration);if(C+=I,g!==void 0){var W=Math.round(A%a.targetduration/a.partTarget);g+=W}this.log("CDN Tune-in age: "+a.ageHeader+"s last advanced "+L.toFixed(2)+"s goal: "+A+" skip sn "+I+" to part "+g)}a.tuneInGoal=A}if(l=this.getDeliveryDirectives(a,m.deliveryDirectives,C,g),y||!f){this.loadPlaylist(l);return}}else l=this.getDeliveryDirectives(a,m.deliveryDirectives,C,g);var K=Object(P.computeReloadInterval)(a,i);C!==void 0&&a.canBlockReload&&(K-=a.partTarget||1),this.log("reload live playlist "+S+" in "+Math.round(K)+" ms"),this.timer=self.setTimeout(function(){return v.loadPlaylist(l)},K)}else this.clearTimer()},d.getDeliveryDirectives=function(S,m,p,v){var a=Object(_.getSkipValue)(S,p);return m!=null&&m.skip&&S.deltaUpdateFailed&&(p=m.msn,v=m.part,a=_.HlsSkip.No),new _.HlsUrlParameters(p,v,a)},d.retryLoadingOrFail=function(S){var m=this,p=this.hls.config,v=this.retryCount-1&&(a=S.context)!==null&&a!==void 0&&a.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+S.details+'"'),this.loadPlaylist();else{var i=Math.min(Math.pow(2,this.retryCount)*p.levelLoadingRetryDelay,p.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return m.loadPlaylist()},i),this.warn("retry playlist loading #"+this.retryCount+" in "+i+' ms after "'+S.details+'"')}}else this.warn('cannot recover from error "'+S.details+'"'),this.clearTimer(),S.fatal=!0;return v},k}()},"./src/controller/base-stream-controller.ts":function(ne,$,O){"use strict";O.r($),O.d($,"State",function(){return w}),O.d($,"default",function(){return T});var V=O("./src/polyfills/number.ts"),_=O("./src/task-loop.ts"),P=O("./src/controller/fragment-tracker.ts"),F=O("./src/utils/buffer-helper.ts"),N=O("./src/utils/logger.ts"),M=O("./src/events.ts"),k=O("./src/errors.ts"),d=O("./src/types/transmuxer.ts"),h=O("./src/utils/mp4-tools.ts"),S=O("./src/utils/discontinuities.ts"),m=O("./src/controller/fragment-finders.ts"),p=O("./src/controller/level-helper.ts"),v=O("./src/loader/fragment-loader.ts"),a=O("./src/crypt/decrypter.ts"),i=O("./src/utils/time-ranges.ts"),s=O("./src/types/loader.ts");function l(b,f){for(var u=0;uie;(Z0&&Z&&Z.key&&Z.iv&&Z.method==="AES-128"){var z=self.performance.now();return A.decrypter.webCryptoDecrypt(new Uint8Array(K),Z.key.buffer,Z.iv.buffer).then(function(B){var ee=self.performance.now();return W.trigger(M.Events.FRAG_DECRYPTED,{frag:x,payload:B,stats:{tstart:z,tdecrypt:ee}}),I.payload=B,I})}return I}).then(function(I){var W=A.fragCurrent,K=A.hls,Z=A.levels;if(!Z)throw new Error("init load aborted, missing levels");var z=Z[x.level].details;console.assert(z,"Level details are defined when init segment is loaded");var B=x.stats;A.state=w.IDLE,A.fragLoadError=0,x.data=new Uint8Array(I.payload),B.parsing.start=B.buffering.start=self.performance.now(),B.parsing.end=B.buffering.end=self.performance.now(),I.frag===W&&K.trigger(M.Events.FRAG_BUFFERED,{stats:B,frag:W,part:null,id:x.type}),A.tick()}).catch(function(I){A.warn(I),A.resetFragmentLoading(x)})},u.fragContextChanged=function(x){var A=this.fragCurrent;return!x||!A||x.level!==A.level||x.sn!==A.sn||x.urlId!==A.urlId},u.fragBufferedComplete=function(x,A){var I=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+x.type+" sn: "+x.sn+(A?" part: "+A.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+x.level+" "+i.default.toString(F.BufferHelper.getBuffered(I))),this.state=w.IDLE,this.tick()},u._handleFragmentLoadComplete=function(x){var A=this.transmuxer;if(!A)return;var I=x.frag,W=x.part,K=x.partsLoaded,Z=!K||K.length===0||K.some(function(B){return!B}),z=new d.ChunkMetadata(I.level,I.sn,I.stats.chunkCount+1,0,W?W.index:-1,!Z);A.flush(z)},u._handleFragmentLoadProgress=function(x){},u._doFragLoad=function(x,A,I,W){var K=this;if(I===void 0&&(I=null),!this.levels)throw new Error("frag load aborted, missing levels");if(I=Math.max(x.start,I||0),this.config.lowLatencyMode&&A){var Z=A.partList;if(Z&&W){I>x.end&&A.fragmentHint&&(x=A.fragmentHint);var z=this.getNextPart(Z,x,I);if(z>-1){var B=Z[z];return this.log("Loading part sn: "+x.sn+" p: "+B.index+" cc: "+x.cc+" of playlist ["+A.startSN+"-"+A.endSN+"] parts [0-"+z+"-"+(Z.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+x.level+", target: "+parseFloat(I.toFixed(3))),this.nextLoadPosition=B.start+B.duration,this.state=w.FRAG_LOADING,this.hls.trigger(M.Events.FRAG_LOADING,{frag:x,part:Z[z],targetBufferTime:I}),this.doFragPartsLoad(x,Z,z,W).catch(function(ee){return K.handleFragLoadError(ee)})}else if(!x.url||this.loadedEndOfParts(Z,I))return Promise.resolve(null)}}return this.log("Loading fragment "+x.sn+" cc: "+x.cc+" "+(A?"of ["+A.startSN+"-"+A.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+x.level+", target: "+parseFloat(I.toFixed(3))),Object(V.isFiniteNumber)(x.sn)&&!this.bitrateTest&&(this.nextLoadPosition=x.start+x.duration),this.state=w.FRAG_LOADING,this.hls.trigger(M.Events.FRAG_LOADING,{frag:x,targetBufferTime:I}),this.fragmentLoader.load(x,W).catch(function(ee){return K.handleFragLoadError(ee)})},u.doFragPartsLoad=function(x,A,I,W){var K=this;return new Promise(function(Z,z){var B=[],ee=function ie(de){var be=A[de];K.fragmentLoader.loadPart(x,be,W).then(function(Ie){B[be.index]=Ie;var Ae=Ie.part;K.hls.trigger(M.Events.FRAG_LOADED,Ie);var Re=A[de+1];if(Re&&Re.fragment===x)ie(de+1);else return Z({frag:x,part:Ae,partsLoaded:B})}).catch(z)};ee(I)})},u.handleFragLoadError=function(x){var A=x.data;return A&&A.details===k.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(A.frag,A.part):this.hls.trigger(M.Events.ERROR,A),null},u._handleTransmuxerFlush=function(x){var A=this.getCurrentContext(x);if(!A||this.state!==w.PARSING){this.fragCurrent||(this.state=w.IDLE);return}var I=A.frag,W=A.part,K=A.level,Z=self.performance.now();I.stats.parsing.end=Z,W&&(W.stats.parsing.end=Z),this.updateLevelTiming(I,W,K,x.partial)},u.getCurrentContext=function(x){var A=this.levels,I=x.level,W=x.sn,K=x.part;if(!A||!A[I])return this.warn("Levels object was unset while buffering fragment "+W+" of level "+I+". The current chunk will not be buffered."),null;var Z=A[I],z=K>-1?Object(p.getPartWith)(Z,W,K):null,B=z?z.fragment:Object(p.getFragmentWithSN)(Z,W,this.fragCurrent);return B?{frag:B,part:z,level:Z}:null},u.bufferFragmentData=function(x,A,I,W){if(!x||this.state!==w.PARSING)return;var K=x.data1,Z=x.data2,z=K;if(K&&Z&&(z=Object(h.appendUint8Array)(K,Z)),!z||!z.length)return;var B={type:x.type,frag:A,part:I,chunkMeta:W,parent:A.type,data:z};this.hls.trigger(M.Events.BUFFER_APPENDING,B),x.dropped&&x.independent&&!I&&this.flushBufferGap(A)},u.flushBufferGap=function(x){var A=this.media;if(!A)return;if(!F.BufferHelper.isBuffered(A,A.currentTime)){this.flushMainBuffer(0,x.start);return}var I=A.currentTime,W=F.BufferHelper.bufferInfo(A,I,0),K=x.duration,Z=Math.min(this.config.maxFragLookUpTolerance*2,K*.25),z=Math.max(Math.min(x.start-Z,W.end-Z),I+Z);x.start-z>Z&&this.flushMainBuffer(z,x.start)},u.getFwdBufferInfo=function(x,A){var I=this.config,W=this.getLoadPosition();if(!Object(V.isFiniteNumber)(W))return null;var K=F.BufferHelper.bufferInfo(x,W,I.maxBufferHole);if(K.len===0&&K.nextStart!==void 0){var Z=this.fragmentTracker.getBufferedFrag(W,A);if(Z&&K.nextStart=I?(A.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+A.maxMaxBufferLength+"s"),!0):!1},u.getNextFragment=function(x,A){var I,W,K=A.fragments,Z=K.length;if(!Z)return null;var z=this.config,B=K[0].start,ee;if(A.live){var ie=z.initialLiveManifestSize;if(Z-1&&II.start&&I.loaded},u.getInitialLiveFragment=function(x,A){var I=this.fragPrevious,W=null;if(I){if(x.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+I.programDateTime),W=Object(m.findFragmentByPDT)(A,I.endProgramDateTime,this.config.maxFragLookUpTolerance)),!W){var K=I.sn+1;if(K>=x.startSN&&K<=x.endSN){var Z=A[K-x.startSN];I.cc===Z.cc&&(W=Z,this.log("Live playlist, switching playlist, load frag with next SN: "+W.sn))}W||(W=Object(m.findFragWithCC)(A,I.cc),W&&this.log("Live playlist, switching playlist, load frag with same CC: "+W.sn))}}else{var z=this.hls.liveSyncPosition;z!==null&&(W=this.getFragmentAtPosition(z,this.bitrateTest?x.fragmentEnd:x.edge,x))}return W},u.getFragmentAtPosition=function(x,A,I){var W=this.config,K=this.fragPrevious,Z=I.fragments,z=I.endSN,B=I.fragmentHint,ee=W.maxFragLookUpTolerance,ie=!!(W.lowLatencyMode&&I.partList&&B);ie&&B&&!this.bitrateTest&&(Z=Z.concat(B),z=B.sn);var de;if(xA-ee?0:ee;de=Object(m.findFragmentByPTS)(K,Z,x,be)}else de=Z[Z.length-1];if(de){var Ie=de.sn-I.startSN,Ae=K&&de.level===K.level,Re=Z[Ie+1],ke=this.fragmentTracker.getState(de);if(ke===P.FragmentState.BACKTRACKED){de=null;for(var De=Ie;Z[De]&&this.fragmentTracker.getState(Z[De])===P.FragmentState.BACKTRACKED;)K?de=Z[De--]:de=Z[--De];de||(de=Re)}else K&&de.sn===K.sn&&!ie&&(Ae&&(de.sn=Z-A.maxFragLookUpTolerance&&K<=z;if(W!==null&&I.duration>W&&(K"+x.startSN+" prev-sn: "+(K?K.sn:"na")+" fragments: "+z),de}return B},u.waitForCdnTuneIn=function(x){var A=3;return x.live&&x.canBlockReload&&x.tuneInGoal>Math.max(x.partHoldBack,x.partTarget*A)},u.setStartPosition=function(x,A){var I=this.startPosition;if(I"+x))}}]),f}(_.default)},"./src/controller/buffer-controller.ts":function(ne,$,O){"use strict";O.r($),O.d($,"default",function(){return m});var V=O("./src/polyfills/number.ts"),_=O("./src/events.ts"),P=O("./src/utils/logger.ts"),F=O("./src/errors.ts"),N=O("./src/utils/buffer-helper.ts"),M=O("./src/utils/mediasource-helper.ts"),k=O("./src/loader/fragment.ts"),d=O("./src/controller/buffer-operation-queue.ts"),h=Object(M.getMediaSource)(),S=/([ha]vc.)(?:\.[^.,]+)+/,m=function(){function p(a){var i=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=i.hls,l=i.media,C=i.mediaSource;P.logger.log("[buffer-controller]: Media source opened"),l&&(i.updateMediaElementDuration(),s.trigger(_.Events.MEDIA_ATTACHED,{media:l})),C&&C.removeEventListener("sourceopen",i._onMediaSourceOpen),i.checkPendingTracks()},this._onMediaSourceClose=function(){P.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){P.logger.log("[buffer-controller]: Media source ended")},this.hls=a,this._initSourceBuffer(),this.registerListeners()}var v=p.prototype;return v.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},v.destroy=function(){this.unregisterListeners(),this.details=null},v.registerListeners=function(){var i=this.hls;i.on(_.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.on(_.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(_.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.on(_.Events.BUFFER_RESET,this.onBufferReset,this),i.on(_.Events.BUFFER_APPENDING,this.onBufferAppending,this),i.on(_.Events.BUFFER_CODECS,this.onBufferCodecs,this),i.on(_.Events.BUFFER_EOS,this.onBufferEos,this),i.on(_.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),i.on(_.Events.LEVEL_UPDATED,this.onLevelUpdated,this),i.on(_.Events.FRAG_PARSED,this.onFragParsed,this),i.on(_.Events.FRAG_CHANGED,this.onFragChanged,this)},v.unregisterListeners=function(){var i=this.hls;i.off(_.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.off(_.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.off(_.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.off(_.Events.BUFFER_RESET,this.onBufferReset,this),i.off(_.Events.BUFFER_APPENDING,this.onBufferAppending,this),i.off(_.Events.BUFFER_CODECS,this.onBufferCodecs,this),i.off(_.Events.BUFFER_EOS,this.onBufferEos,this),i.off(_.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),i.off(_.Events.LEVEL_UPDATED,this.onLevelUpdated,this),i.off(_.Events.FRAG_PARSED,this.onFragParsed,this),i.off(_.Events.FRAG_CHANGED,this.onFragChanged,this)},v._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new d.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},v.onManifestParsed=function(i,s){var l=2;(s.audio&&!s.video||!s.altAudio)&&(l=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=l,this.details=null,P.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},v.onMediaAttaching=function(i,s){var l=this.media=s.media;if(l&&h){var C=this.mediaSource=new h;C.addEventListener("sourceopen",this._onMediaSourceOpen),C.addEventListener("sourceended",this._onMediaSourceEnded),C.addEventListener("sourceclose",this._onMediaSourceClose),l.src=self.URL.createObjectURL(C),this._objectUrl=l.src}},v.onMediaDetaching=function(){var i=this.media,s=this.mediaSource,l=this._objectUrl;if(s){if(P.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(C){P.logger.warn("[buffer-controller]: onMediaDetaching: "+C.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),i&&(l&&self.URL.revokeObjectURL(l),i.src===l?(i.removeAttribute("src"),i.load()):P.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(_.Events.MEDIA_DETACHED,void 0)},v.onBufferReset=function(){var i=this;this.getSourceBufferTypes().forEach(function(s){var l=i.sourceBuffer[s];try{l&&(i.removeBufferListeners(s),i.mediaSource&&i.mediaSource.removeSourceBuffer(l),i.sourceBuffer[s]=void 0)}catch(C){P.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",C)}}),this._initSourceBuffer()},v.onBufferCodecs=function(i,s){var l=this,C=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(g){if(C){var y=l.tracks[g];if(y&&typeof y.buffer.changeType=="function"){var R=s[g],w=R.codec,T=R.levelCodec,b=R.container,f=(y.levelCodec||y.codec).replace(S,"$1"),u=(T||w).replace(S,"$1");if(f!==u){var L=b+";codecs="+(T||w);l.appendChangeType(g,L)}}}else l.pendingTracks[g]=s[g]}),C)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},v.appendChangeType=function(i,s){var l=this,C=this.operationQueue,g={execute:function(){var R=l.sourceBuffer[i];R&&(P.logger.log("[buffer-controller]: changing "+i+" sourceBuffer type to "+s),R.changeType(s)),C.shiftAndExecuteNext(i)},onStart:function(){},onComplete:function(){},onError:function(R){P.logger.warn("[buffer-controller]: Failed to change "+i+" SourceBuffer type",R)}};C.append(g,i)},v.onBufferAppending=function(i,s){var l=this,C=this.hls,g=this.operationQueue,y=this.tracks,R=s.data,w=s.type,T=s.frag,b=s.part,f=s.chunkMeta,u=f.buffering[w],L=self.performance.now();u.start=L;var x=T.stats.buffering,A=b?b.stats.buffering:null;x.start===0&&(x.start=L),A&&A.start===0&&(A.start=L);var I=y.audio,W=w==="audio"&&f.id===1&&(I==null?void 0:I.container)==="audio/mpeg",K={execute:function(){if(u.executeStart=self.performance.now(),W){var z=l.sourceBuffer[w];if(z){var B=T.start-z.timestampOffset;Math.abs(B)>=.1&&(P.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+T.start+" (delta: "+B+") sn: "+T.sn+")"),z.timestampOffset=T.start)}}l.appendExecutor(R,w)},onStart:function(){},onComplete:function(){var z=self.performance.now();u.executeEnd=u.end=z,x.first===0&&(x.first=z),A&&A.first===0&&(A.first=z);var B=l.sourceBuffer,ee={};for(var ie in B)ee[ie]=N.BufferHelper.getBuffered(B[ie]);l.appendError=0,l.hls.trigger(_.Events.BUFFER_APPENDED,{type:w,frag:T,part:b,chunkMeta:f,parent:T.type,timeRanges:ee})},onError:function(z){P.logger.error("[buffer-controller]: Error encountered while trying to append to the "+w+" SourceBuffer",z);var B={type:F.ErrorTypes.MEDIA_ERROR,parent:T.type,details:F.ErrorDetails.BUFFER_APPEND_ERROR,err:z,fatal:!1};z.code===DOMException.QUOTA_EXCEEDED_ERR?B.details=F.ErrorDetails.BUFFER_FULL_ERROR:(l.appendError++,B.details=F.ErrorDetails.BUFFER_APPEND_ERROR,l.appendError>C.config.appendErrorMaxRetry&&(P.logger.error("[buffer-controller]: Failed "+C.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),B.fatal=!0)),C.trigger(_.Events.ERROR,B)}};g.append(K,w)},v.onBufferFlushing=function(i,s){var l=this,C=this.operationQueue,g=function(R){return{execute:l.removeExecutor.bind(l,R,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){l.hls.trigger(_.Events.BUFFER_FLUSHED,{type:R})},onError:function(T){P.logger.warn("[buffer-controller]: Failed to remove from "+R+" SourceBuffer",T)}}};s.type?C.append(g(s.type),s.type):this.getSourceBufferTypes().forEach(function(y){C.append(g(y),y)})},v.onFragParsed=function(i,s){var l=this,C=s.frag,g=s.part,y=[],R=g?g.elementaryStreams:C.elementaryStreams;R[k.ElementaryStreamTypes.AUDIOVIDEO]?y.push("audiovideo"):(R[k.ElementaryStreamTypes.AUDIO]&&y.push("audio"),R[k.ElementaryStreamTypes.VIDEO]&&y.push("video"));var w=function(){var b=self.performance.now();C.stats.buffering.end=b,g&&(g.stats.buffering.end=b);var f=g?g.stats:C.stats;l.hls.trigger(_.Events.FRAG_BUFFERED,{frag:C,part:g,stats:f,id:C.type})};y.length===0&&P.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+C.type+" level: "+C.level+" sn: "+C.sn),this.blockBuffers(w,y)},v.onFragChanged=function(i,s){this.flushBackBuffer()},v.onBufferEos=function(i,s){var l=this,C=this.getSourceBufferTypes().reduce(function(g,y){var R=l.sourceBuffer[y];return(!s.type||s.type===y)&&(R&&!R.ended&&(R.ended=!0,P.logger.log("[buffer-controller]: "+y+" sourceBuffer now EOS"))),g&&!!(!R||R.ended)},!0);C&&this.blockBuffers(function(){var g=l.mediaSource;if(!g||g.readyState!=="open")return;g.endOfStream()})},v.onLevelUpdated=function(i,s){var l=s.details;if(!l.fragments.length)return;this.details=l,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},v.flushBackBuffer=function(){var i=this.hls,s=this.details,l=this.media,C=this.sourceBuffer;if(!l||s===null)return;var g=this.getSourceBufferTypes();if(!g.length)return;var y=s.live&&i.config.liveBackBufferLength!==null?i.config.liveBackBufferLength:i.config.backBufferLength;if(!Object(V.isFiniteNumber)(y)||y<0)return;var R=l.currentTime,w=s.levelTargetDuration,T=Math.max(y,w),b=Math.floor(R/w)*w-T;g.forEach(function(f){var u=C[f];if(u){var L=N.BufferHelper.getBuffered(u);L.length>0&&b>L.start(0)&&(i.trigger(_.Events.BACK_BUFFER_REACHED,{bufferEnd:b}),s.live&&i.trigger(_.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:b}),i.trigger(_.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:b,type:f}))}})},v.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var i=this.details,s=this.hls,l=this.media,C=this.mediaSource,g=i.fragments[0].start+i.totalduration,y=l.duration,R=Object(V.isFiniteNumber)(C.duration)?C.duration:0;i.live&&s.config.liveDurationInfinity?(P.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),C.duration=Infinity,this.updateSeekableRange(i)):(g>R&&g>y||!Object(V.isFiniteNumber)(y))&&(P.logger.log("[buffer-controller]: Updating Media Source duration to "+g.toFixed(3)),C.duration=g)},v.updateSeekableRange=function(i){var s=this.mediaSource,l=i.fragments,C=l.length;if(C&&i.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var g=Math.max(0,l[0].start),y=Math.max(g,g+i.totalduration);s.setLiveSeekableRange(g,y)}},v.checkPendingTracks=function(){var i=this.bufferCodecEventsExpected,s=this.operationQueue,l=this.pendingTracks,C=Object.keys(l).length;if(C&&!i||C===2){this.createSourceBuffers(l),this.pendingTracks={};var g=this.getSourceBufferTypes();if(g.length===0){this.hls.trigger(_.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}g.forEach(function(y){s.executeNext(y)})}},v.createSourceBuffers=function(i){var s=this.sourceBuffer,l=this.mediaSource;if(!l)throw Error("createSourceBuffers called when mediaSource was null");var C=0;for(var g in i)if(!s[g]){var y=i[g];if(!y)throw Error("source buffer exists for track "+g+", however track does not");var R=y.levelCodec||y.codec,w=y.container+";codecs="+R;P.logger.log("[buffer-controller]: creating sourceBuffer("+w+")");try{var T=s[g]=l.addSourceBuffer(w),b=g;this.addBufferListener(b,"updatestart",this._onSBUpdateStart),this.addBufferListener(b,"updateend",this._onSBUpdateEnd),this.addBufferListener(b,"error",this._onSBUpdateError),this.tracks[g]={buffer:T,codec:R,container:y.container,levelCodec:y.levelCodec,id:y.id},C++}catch(f){P.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+f.message),this.hls.trigger(_.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:f,mimeType:w})}}C&&this.hls.trigger(_.Events.BUFFER_CREATED,{tracks:this.tracks})},v._onSBUpdateStart=function(i){var s=this.operationQueue,l=s.current(i);l.onStart()},v._onSBUpdateEnd=function(i){var s=this.operationQueue,l=s.current(i);l.onComplete(),s.shiftAndExecuteNext(i)},v._onSBUpdateError=function(i,s){P.logger.error("[buffer-controller]: "+i+" SourceBuffer error",s),this.hls.trigger(_.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var l=this.operationQueue.current(i);l&&l.onError(s)},v.removeExecutor=function(i,s,l){var C=this.media,g=this.mediaSource,y=this.operationQueue,R=this.sourceBuffer,w=R[i];if(!C||!g||!w){P.logger.warn("[buffer-controller]: Attempting to remove from the "+i+" SourceBuffer, but it does not exist"),y.shiftAndExecuteNext(i);return}var T=Object(V.isFiniteNumber)(C.duration)?C.duration:Infinity,b=Object(V.isFiniteNumber)(g.duration)?g.duration:Infinity,f=Math.max(0,s),u=Math.min(l,T,b);u>f?(P.logger.log("[buffer-controller]: Removing ["+f+","+u+"] from the "+i+" SourceBuffer"),console.assert(!w.updating,i+" sourceBuffer must not be updating"),w.remove(f,u)):y.shiftAndExecuteNext(i)},v.appendExecutor=function(i,s){var l=this.operationQueue,C=this.sourceBuffer,g=C[s];if(!g){P.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),l.shiftAndExecuteNext(s);return}g.ended=!1,console.assert(!g.updating,s+" sourceBuffer must not be updating"),g.appendBuffer(i)},v.blockBuffers=function(i,s){var l=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){P.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(i);return}var C=this.operationQueue,g=s.map(function(y){return C.appendBlocker(y)});Promise.all(g).then(function(){i(),s.forEach(function(y){var R=l.sourceBuffer[y];(!R||!R.updating)&&C.shiftAndExecuteNext(y)})})},v.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},v.addBufferListener=function(i,s,l){var C=this.sourceBuffer[i];if(!C)return;var g=l.bind(this,i);this.listeners[i].push({event:s,listener:g}),C.addEventListener(s,g)},v.removeBufferListeners=function(i){var s=this.sourceBuffer[i];if(!s)return;this.listeners[i].forEach(function(l){s.removeEventListener(l.event,l.listener)})},p}()},"./src/controller/buffer-operation-queue.ts":function(ne,$,O){"use strict";O.r($),O.d($,"default",function(){return _});var V=O("./src/utils/logger.ts"),_=function(){function P(N){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=N}var F=P.prototype;return F.append=function(M,k){var d=this.queues[k];d.push(M),d.length===1&&this.buffers[k]&&this.executeNext(k)},F.insertAbort=function(M,k){var d=this.queues[k];d.unshift(M),this.executeNext(k)},F.appendBlocker=function(M){var k,d=new Promise(function(S){k=S}),h={execute:k,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(h,M),d},F.executeNext=function(M){var k=this.buffers,d=this.queues,h=k[M],S=d[M];if(S.length){var m=S[0];try{m.execute()}catch(p){V.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),m.onError(p),(!h||!h.updating)&&(S.shift(),this.executeNext(M))}}},F.shiftAndExecuteNext=function(M){this.queues[M].shift(),this.executeNext(M)},F.current=function(M){return this.queues[M][0]},P}()},"./src/controller/cap-level-controller.ts":function(ne,$,O){"use strict";O.r($);var V=O("./src/events.ts");function _(N,M){for(var k=0;k0&&this.mediaWidth>0){var d=this.hls.levels;if(d.length){var h=this.hls;h.autoLevelCapping=this.getMaxLevel(d.length-1),h.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=h.autoLevelCapping}}},M.getMaxLevel=function(d){var h=this,S=this.hls.levels;if(!S.length)return-1;var m=S.filter(function(p,v){return N.isLevelAllowed(v,h.restrictedLevels)&&v<=d});return this.clientRect=null,N.getMaxLevelByMediaSize(m,this.mediaWidth,this.mediaHeight)},M.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},M.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},M.getDimensions=function(){if(this.clientRect)return this.clientRect;var d=this.media,h={width:0,height:0};if(d){var S=d.getBoundingClientRect();h.width=S.width,h.height=S.height,!h.width&&!h.height&&(h.width=S.right-S.left||d.width||0,h.height=S.bottom-S.top||d.height||0)}return this.clientRect=h,h},N.isLevelAllowed=function(d,h){return h===void 0&&(h=[]),h.indexOf(d)===-1},N.getMaxLevelByMediaSize=function(d,h,S){if(!d||!d.length)return-1;for(var m=function(s,l){return l?s.width!==l.width||s.height!==l.height:!0},p=d.length-1,v=0;v=h||a.height>=S)&&m(a,d[v+1])){p=v;break}}return p},P(N,[{key:"mediaWidth",get:function(){return this.getDimensions().width*N.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*N.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var d=1;try{d=self.devicePixelRatio}catch(h){}return d}}]),N}();$.default=F},"./src/controller/cmcd-controller.ts":function(ne,$,O){"use strict";O.r($),O.d($,"default",function(){return m});var V=O("./src/events.ts"),_=O("./src/types/cmcd.ts"),P=O("./src/utils/buffer-helper.ts"),F=O("./src/utils/logger.ts");function N(p,v){for(var a=0;a=p.length?{done:!0}:{done:!1,value:p[i++]}}}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 d(p,v){if(!p)return;if(typeof p=="string")return h(p,v);var a=Object.prototype.toString.call(p).slice(8,-1);if(a==="Object"&&p.constructor&&(a=p.constructor.name),a==="Map"||a==="Set")return Array.from(p);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return h(p,v)}function h(p,v){(v==null||v>p.length)&&(v=p.length);for(var a=0,i=new Array(v);as&&(s=y.bitrate)}return s>0?s:NaN},v.getBufferLength=function(i){var s=this.hls.media,l=i===_.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!l||!s)return NaN;var C=P.BufferHelper.bufferInfo(l,s.currentTime,this.config.maxBufferHole);return C.len*1e3},v.createPlaylistLoader=function(){var i=this.config.pLoader,s=this.applyPlaylistData,l=i||this.config.loader;return function(){function C(y){this.loader=void 0,this.loader=new l(y)}var g=C.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(R,w,T){s(R),this.loader.load(R,w,T)},M(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},v.createFragmentLoader=function(){var i=this.config.fLoader,s=this.applyFragmentData,l=i||this.config.loader;return function(){function C(y){this.loader=void 0,this.loader=new l(y)}var g=C.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(R,w,T){s(R),this.loader.load(R,w,T)},M(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},p.uuid=function(){var i=URL.createObjectURL(new Blob),s=i.toString();return URL.revokeObjectURL(i),s.substr(s.lastIndexOf("/")+1)},p.serialize=function(i){for(var s=[],l=function(W){return!Number.isNaN(W)&&W!=null&&W!==""&&W!==!1},C=function(W){return Math.round(W)},g=function(W){return C(W/100)*100},y=function(W){return encodeURIComponent(W)},R={br:C,d:C,bl:g,dl:g,mtp:g,nor:y,rtp:g,tb:C},w=Object.keys(i||{}).sort(),T=k(w),b;!(b=T()).done;){var f=b.value,u=i[f];if(!l(u))continue;if(f==="v"&&u===1)continue;if(f=="pr"&&u===1)continue;var L=R[f];L&&(u=L(u));var x=typeof u,A=void 0;f==="ot"||f==="sf"||f==="st"?A=f+"="+u:x==="boolean"?A=f:x==="number"?A=f+"="+u:A=f+"="+JSON.stringify(u),s.push(A)}return s.join(",")},p.toHeaders=function(i){for(var s=Object.keys(i),l={},C=["Object","Request","Session","Status"],g=[{},{},{},{}],y={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},R=0,w=s;Rk){this.hls.trigger(V.Events.ERROR,{type:_.ErrorTypes.KEY_SYSTEM_ERROR,details:_.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var y=k-this._requestLicenseFailureCount+1;P.logger.warn("Retrying license request, "+y+" attempts left"),this._requestLicense(s,l)}break}},p._generateLicenseRequestChallenge=function(a,i){switch(a.mediaKeySystemDomain){case F.KeySystems.WIDEVINE:return i}throw new Error("unsupported key-system: "+a.mediaKeySystemDomain)},p._requestLicense=function(a,i){P.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){P.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(V.Events.ERROR,{type:_.ErrorTypes.KEY_SYSTEM_ERROR,details:_.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var l=this.getLicenseServerUrl(s.mediaKeySystemDomain),C=this._createLicenseXhr(l,a,i);P.logger.log("Sending license request to URL: "+l);var g=this._generateLicenseRequestChallenge(s,a);C.send(g)}catch(y){P.logger.error("Failure requesting DRM license: "+y),this.hls.trigger(V.Events.ERROR,{type:_.ErrorTypes.KEY_SYSTEM_ERROR,details:_.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},p.onMediaAttached=function(a,i){if(!this._emeEnabled)return;var s=i.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},p.onMediaDetached=function(){var a=this._media,i=this._mediaKeysList;if(!a)return;a.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(i.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return a.setMediaKeys(null)}).catch(function(){})},p.onManifestParsed=function(a,i){if(!this._emeEnabled)return;var s=i.levels.map(function(C){return C.audioCodec}).filter(function(C){return!!C}),l=i.levels.map(function(C){return C.videoCodec}).filter(function(C){return!!C});this._attemptKeySystemAccess(F.KeySystems.WIDEVINE,s,l)},M(m,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),m}();$.default=S},"./src/controller/fps-controller.ts":function(ne,$,O){"use strict";O.r($);var V=O("./src/events.ts"),_=O("./src/utils/logger.ts"),P=function(){function F(M){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=M,this.registerListeners()}var N=F.prototype;return N.setStreamController=function(k){this.streamController=k},N.registerListeners=function(){this.hls.on(V.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},N.unregisterListeners=function(){this.hls.off(V.Events.MEDIA_ATTACHING,this.onMediaAttaching)},N.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},N.onMediaAttaching=function(k,d){var h=this.hls.config;if(h.capLevelOnFPSDrop){var S=d.media instanceof self.HTMLVideoElement?d.media:null;this.media=S,S&&typeof S.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),h.fpsDroppedMonitoringPeriod)}},N.checkFPS=function(k,d,h){var S=performance.now();if(d){if(this.lastTime){var m=S-this.lastTime,p=h-this.lastDroppedFrames,v=d-this.lastDecodedFrames,a=1e3*p/m,i=this.hls;if(i.trigger(V.Events.FPS_DROP,{currentDropped:p,currentDecoded:v,totalDroppedFrames:h}),a>0&&p>i.config.fpsDroppedMonitoringThreshold*v){var s=i.currentLevel;_.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(i.autoLevelCapping===-1||i.autoLevelCapping>=s)&&(s=s-1,i.trigger(V.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:i.currentLevel}),i.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=S,this.lastDroppedFrames=h,this.lastDecodedFrames=d}},N.checkFPSInterval=function(){var k=this.media;if(k)if(this.isVideoPlaybackQualityAvailable){var d=k.getVideoPlaybackQuality();this.checkFPS(k,d.totalVideoFrames,d.droppedVideoFrames)}else this.checkFPS(k,k.webkitDecodedFrameCount,k.webkitDroppedFrameCount)},F}();$.default=P},"./src/controller/fragment-finders.ts":function(ne,$,O){"use strict";O.r($),O.d($,"findFragmentByPDT",function(){return P}),O.d($,"findFragmentByPTS",function(){return F}),O.d($,"fragmentWithinToleranceTest",function(){return N}),O.d($,"pdtWithinToleranceTest",function(){return M}),O.d($,"findFragWithCC",function(){return k});var V=O("./src/polyfills/number.ts"),_=O("./src/utils/binary-search.ts");function P(d,h,S){if(h===null||!Array.isArray(d)||!d.length||!Object(V.isFiniteNumber)(h))return null;var m=d[0].programDateTime;if(h<(m||0))return null;var p=d[d.length-1].endProgramDateTime;if(h>=(p||0))return null;S=S||0;for(var v=0;vd&&S.start?-1:0}function M(d,h,S){var m=Math.min(h,S.duration+(S.deltaPTS?S.deltaPTS:0))*1e3,p=S.endProgramDateTime||0;return p-m>d}function k(d,h){return _.default.search(d,function(S){return S.cch?-1:0})}},"./src/controller/fragment-tracker.ts":function(ne,$,O){"use strict";O.r($),O.d($,"FragmentState",function(){return P}),O.d($,"FragmentTracker",function(){return F});var V=O("./src/events.ts"),_=O("./src/types/loader.ts"),P;(function(k){k.NOT_LOADED="NOT_LOADED",k.BACKTRACKED="BACKTRACKED",k.APPENDING="APPENDING",k.PARTIAL="PARTIAL",k.OK="OK"})(P||(P={}));var F=function(){function k(h){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=h,this._registerListeners()}var d=k.prototype;return d._registerListeners=function(){var S=this.hls;S.on(V.Events.BUFFER_APPENDED,this.onBufferAppended,this),S.on(V.Events.FRAG_BUFFERED,this.onFragBuffered,this),S.on(V.Events.FRAG_LOADED,this.onFragLoaded,this)},d._unregisterListeners=function(){var S=this.hls;S.off(V.Events.BUFFER_APPENDED,this.onBufferAppended,this),S.off(V.Events.FRAG_BUFFERED,this.onFragBuffered,this),S.off(V.Events.FRAG_LOADED,this.onFragLoaded,this)},d.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},d.getAppendedFrag=function(S,m){if(m===_.PlaylistLevelType.MAIN){var p=this.activeFragment,v=this.activeParts;if(!p)return null;if(v)for(var a=v.length;a--;){var i=v[a],s=i?i.end:p.appendedPTS;if(i.start<=S&&s!==void 0&&S<=s)return a>9&&(this.activeParts=v.slice(a-9)),i}else if(p.start<=S&&p.appendedPTS!==void 0&&S<=p.appendedPTS)return p}return this.getBufferedFrag(S,m)},d.getBufferedFrag=function(S,m){for(var p=this.fragments,v=Object.keys(p),a=v.length;a--;){var i=p[v[a]];if((i==null?void 0:i.body.type)===m&&i.buffered){var s=i.body;if(s.start<=S&&S<=s.end)return s}}return null},d.detectEvictedFragments=function(S,m,p){var v=this;Object.keys(this.fragments).forEach(function(a){var i=v.fragments[a];if(!i)return;if(!i.buffered){i.body.type===p&&v.removeFragment(i.body);return}var s=i.range[S];if(!s)return;s.time.some(function(l){var C=!v.isTimeBuffered(l.startPTS,l.endPTS,m);return C&&v.removeFragment(i.body),C})})},d.detectPartialFragments=function(S){var m=this,p=this.timeRanges,v=S.frag,a=S.part;if(!p||v.sn==="initSegment")return;var i=M(v),s=this.fragments[i];if(!s)return;Object.keys(p).forEach(function(l){var C=v.elementaryStreams[l];if(!C)return;var g=p[l],y=a!==null||C.partial===!0;s.range[l]=m.getBufferedTimes(v,a,y,g)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},d.fragBuffered=function(S){var m=M(S),p=this.fragments[m];p&&(p.backtrack=p.loaded=null,p.buffered=!0)},d.getBufferedTimes=function(S,m,p,v){for(var a={time:[],partial:p},i=m?m.start:S.start,s=m?m.end:S.end,l=S.minEndPTS||s,C=S.maxStartPTS||i,g=0;g=y&&l<=R){a.time.push({startPTS:Math.max(i,v.start(g)),endPTS:Math.min(s,v.end(g))});break}else if(iy)a.partial=!0,a.time.push({startPTS:Math.max(i,v.start(g)),endPTS:Math.min(s,v.end(g))});else if(s<=y)break}return a},d.getPartialFragment=function(S){var m=null,p,v,a,i=0,s=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach(function(C){var g=l[C];if(!g)return;N(g)&&(v=g.body.start-s,a=g.body.end+s,S>=v&&S<=a&&(p=Math.min(S-v,a-S),i<=p&&(m=g.body,i=p)))}),m},d.getState=function(S){var m=M(S),p=this.fragments[m];return p?p.buffered?N(p)?P.PARTIAL:P.OK:p.backtrack?P.BACKTRACKED:P.APPENDING:P.NOT_LOADED},d.backtrack=function(S,m){var p=M(S),v=this.fragments[p];if(!v||v.backtrack)return null;var a=v.backtrack=m||v.loaded;return v.loaded=null,a},d.getBacktrackData=function(S){var m=M(S),p=this.fragments[m];if(p){var v,a=p.backtrack;if(a!=null&&(v=a.payload)!==null&&v!==void 0&&v.byteLength)return a;this.removeFragment(S)}return null},d.isTimeBuffered=function(S,m,p){for(var v,a,i=0;i=v&&m<=a)return!0;if(m<=v)return!1}return!1},d.onFragLoaded=function(S,m){var p=m.frag,v=m.part;if(p.sn==="initSegment"||p.bitrateTest||v)return;var a=M(p);this.fragments[a]={body:p,loaded:m,backtrack:null,buffered:!1,range:Object.create(null)}},d.onBufferAppended=function(S,m){var p=this,v=m.frag,a=m.part,i=m.timeRanges;if(v.type===_.PlaylistLevelType.MAIN)if(this.activeFragment=v,a){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(a)}else this.activeParts=null;this.timeRanges=i,Object.keys(i).forEach(function(l){var C=i[l];if(p.detectEvictedFragments(l,C),!a)for(var g=0;gS&&v.removeFragment(s)}})},d.removeFragment=function(S){var m=M(S);S.stats.loaded=0,S.clearElementaryStreamInfo(),delete this.fragments[m]},d.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},k}();function N(k){var d,h;return k.buffered&&(((d=k.range.video)===null||d===void 0?void 0:d.partial)||((h=k.range.audio)===null||h===void 0?void 0:h.partial))}function M(k){return k.type+"_"+k.level+"_"+k.urlId+"_"+k.sn}},"./src/controller/gap-controller.ts":function(ne,$,O){"use strict";O.r($),O.d($,"STALL_MINIMUM_DURATION_MS",function(){return N}),O.d($,"MAX_START_GAP_JUMP",function(){return M}),O.d($,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return k}),O.d($,"SKIP_BUFFER_RANGE_START",function(){return d}),O.d($,"default",function(){return h});var V=O("./src/utils/buffer-helper.ts"),_=O("./src/errors.ts"),P=O("./src/events.ts"),F=O("./src/utils/logger.ts"),N=250,M=2,k=.1,d=.05,h=function(){function S(p,v,a,i){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=p,this.media=v,this.fragmentTracker=a,this.hls=i}var m=S.prototype;return m.destroy=function(){this.hls=this.fragmentTracker=this.media=null},m.poll=function(v){var a=this.config,i=this.media,s=this.stalled,l=i.currentTime,C=i.seeking,g=this.seeking&&!C,y=!this.seeking&&C;if(this.seeking=C,l!==v){if(this.moved=!0,s!==null){if(this.stallReported){var R=self.performance.now()-s;F.logger.warn("playback not stuck anymore @"+l+", after "+Math.round(R)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((y||g)&&(this.stalled=null),i.paused||i.ended||i.playbackRate===0||!V.BufferHelper.getBuffered(i).length)return;var w=V.BufferHelper.bufferInfo(i,l,0),T=w.len>0,b=w.nextStart||0;if(!T&&!b)return;if(C){var f=w.len>M,u=!b||b-l>M&&!this.fragmentTracker.getPartialFragment(l);if(f||u)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var L,x=Math.max(b,w.start||0)-l,A=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,I=A==null||((L=A.details)===null||L===void 0)?void 0:L.live,W=I?A.details.targetduration*2:M;if(x>0&&x<=W){this._trySkipBufferHole(null);return}}var K=self.performance.now();if(s===null){this.stalled=K;return}var Z=K-s;!C&&Z>=N&&this._reportStall(w.len);var z=V.BufferHelper.bufferInfo(i,l,a.maxBufferHole);this._tryFixBufferStall(z,Z)},m._tryFixBufferStall=function(v,a){var i=this.config,s=this.fragmentTracker,l=this.media,C=l.currentTime,g=s.getPartialFragment(C);if(g){var y=this._trySkipBufferHole(g);if(y)return}v.len>i.maxBufferHole&&a>i.highBufferWatchdogPeriod*1e3&&(F.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},m._reportStall=function(v){var a=this.hls,i=this.media,s=this.stallReported;s||(this.stallReported=!0,F.logger.warn("Playback stalling at @"+i.currentTime+" due to low buffer (buffer="+v+")"),a.trigger(P.Events.ERROR,{type:_.ErrorTypes.MEDIA_ERROR,details:_.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:v}))},m._trySkipBufferHole=function(v){for(var a=this.config,i=this.hls,s=this.media,l=s.currentTime,C=0,g=V.BufferHelper.getBuffered(s),y=0;y=C&&l.05&&this.forwardBufferLength>1){var y=Math.min(2,Math.max(1,i)),R=Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20;S.playbackRate=Math.min(y,Math.max(1,R))}else S.playbackRate!==1&&S.playbackRate!==0&&(S.playbackRate=1)},d.estimateLiveEdge=function(){var S=this.levelDetails;return S===null?null:S.edge+S.age},d.computeLatency=function(){var S=this.estimateLiveEdge();return S===null?null:S-this.currentTime},N(k,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var S=this.config,m=this.levelDetails;return S.liveMaxLatencyDuration!==void 0?S.liveMaxLatencyDuration:m?S.liveMaxLatencyDurationCount*m.targetduration:0}},{key:"targetLatency",get:function(){var S=this.levelDetails;if(S===null)return null;var m=S.holdBack,p=S.partHoldBack,v=S.targetduration,a=this.config,i=a.liveSyncDuration,s=a.liveSyncDurationCount,l=a.lowLatencyMode,C=this.hls.userConfig,g=l&&p||m;(C.liveSyncDuration||C.liveSyncDurationCount||g===0)&&(g=i!==void 0?i:s*v);var y=v,R=1;return g+Math.min(this.stallCount*R,y)}},{key:"liveSyncPosition",get:function(){var S=this.estimateLiveEdge(),m=this.targetLatency,p=this.levelDetails;if(S===null||m===null||p===null)return null;var v=p.edge,a=S-m-this.edgeStalled,i=v-p.totalduration,s=v-(this.config.lowLatencyMode&&p.partTarget||p.targetduration);return Math.min(Math.max(i,a),s)}},{key:"drift",get:function(){var S=this.levelDetails;return S===null?1:S.drift}},{key:"edgeStalled",get:function(){var S=this.levelDetails;if(S===null)return 0;var m=(this.config.lowLatencyMode&&S.partTarget||S.targetduration)*3;return Math.max(S.age-m,0)}},{key:"forwardBufferLength",get:function(){var S=this.media,m=this.levelDetails;if(!S||!m)return 0;var p=S.buffered.length;return p?S.buffered.end(p-1):m.edge-this.currentTime}}]),k}()},"./src/controller/level-controller.ts":function(ne,$,O){"use strict";O.r($),O.d($,"default",function(){return a});var V=O("./src/types/level.ts"),_=O("./src/events.ts"),P=O("./src/errors.ts"),F=O("./src/utils/codecs.ts"),N=O("./src/controller/level-helper.ts"),M=O("./src/controller/base-playlist-controller.ts"),k=O("./src/types/loader.ts");function d(){return d=Object.assign||function(i){for(var s=1;s0){b=R[0].bitrate,R.sort(function(Z,z){return Z.bitrate-z.bitrate}),this._levels=R;for(var I=0;Ithis.hls.config.fragLoadingMaxRetry&&(f=y.frag.level)):f=y.frag.level}break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:R&&(R.deliveryDirectives&&(b=!1),f=R.level),T=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:f=y.level,T=!0;break}f!==void 0&&this.recoverLevel(y,f,T,b)},l.recoverLevel=function(g,y,R,w){var T=g.details,b=this._levels[y];if(b.loadError++,R){var f=this.retryLoadingOrFail(g);if(f)g.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(w){var u=b.url.length;if(u>1&&b.loadError1){var w=(y.urlId+1)%R;this.warn("Switching to redundant URL-id "+w),this._levels.forEach(function(T){T.urlId=w}),this.level=g}},l.onFragLoaded=function(g,y){var R=y.frag;if(R!==void 0&&R.type===k.PlaylistLevelType.MAIN){var w=this._levels[R.level];w!==void 0&&(w.fragmentError=0,w.loadError=0)}},l.onLevelLoaded=function(g,y){var R,w=y.level,T=y.details,b=this._levels[w];if(!b){var f;this.warn("Invalid level index "+w),(f=y.deliveryDirectives)!==null&&f!==void 0&&f.skip&&(T.deltaUpdateFailed=!0);return}w===this.currentLevelIndex?(b.fragmentError===0&&(b.loadError=0,this.retryCount=0),this.playlistLoaded(w,y,b.details)):(R=y.deliveryDirectives)!==null&&R!==void 0&&R.skip&&(T.deltaUpdateFailed=!0)},l.onAudioTrackSwitched=function(g,y){var R=this.hls.levels[this.currentLevelIndex];if(!R)return;if(R.audioGroupIds){for(var w=-1,T=this.hls.audioTracks[y.id].groupId,b=0;b0){var w=R.urlId,T=R.url[w];if(g)try{T=g.addDirectives(T)}catch(b){this.warn("Could not construct new URL with HLS Delivery Directives: "+b)}this.log("Attempt loading level index "+y+(g?" at sn "+g.msn+" part "+g.part:"")+" with URL-id "+w+" "+T),this.clearTimer(),this.hls.trigger(_.Events.LEVEL_LOADING,{url:T,level:y,id:w,deliveryDirectives:g||null})}},l.removeLevel=function(g,y){var R=function(b,f){return f!==y},w=this._levels.filter(function(T,b){return b!==g?!0:T.url.length>1&&y!==void 0?(T.url=T.url.filter(R),T.audioGroupIds&&(T.audioGroupIds=T.audioGroupIds.filter(R)),T.textGroupIds&&(T.textGroupIds=T.textGroupIds.filter(R)),T.urlId=0,!0):!1}).map(function(T,b){var f=T.details;return f!=null&&f.fragments&&f.fragments.forEach(function(u){u.level=b}),T});this._levels=w,this.hls.trigger(_.Events.LEVELS_UPDATED,{levels:w})},S(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(g){var y,R=this._levels;if(R.length===0)return;if(this.currentLevelIndex===g&&(y=R[g])!==null&&y!==void 0&&y.details)return;if(g<0||g>=R.length){var w=g<0;if(this.hls.trigger(_.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:g,fatal:w,reason:"invalid level idx"}),w)return;g=Math.min(g,R.length-1)}this.clearTimer();var T=this.currentLevelIndex,b=R[T],f=R[g];this.log("switching to level "+g+" from "+T),this.currentLevelIndex=g;var u=d({},f,{level:g,maxBitrate:f.maxBitrate,uri:f.uri,urlId:f.urlId});delete u._urlId,this.hls.trigger(_.Events.LEVEL_SWITCHING,u);var L=f.details;if(!L||L.live){var x=this.switchParams(f.uri,b==null?void 0:b.details);this.loadPlaylist(x)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(g){this.manualLevelIndex=g,this._startLevel===void 0&&(this._startLevel=g),g!==-1&&(this.level=g)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(g){this._firstLevel=g}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var g=this.hls.config.startLevel;return g!==void 0?g:this._firstLevel}else return this._startLevel},set:function(g){this._startLevel=g}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(g){this.level=g,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=g)}}]),s}(M.default)},"./src/controller/level-helper.ts":function(ne,$,O){"use strict";O.r($),O.d($,"addGroupId",function(){return P}),O.d($,"assignTrackIdsByGroup",function(){return F}),O.d($,"updatePTS",function(){return N}),O.d($,"updateFragPTSDTS",function(){return k}),O.d($,"mergeDetails",function(){return d}),O.d($,"mapPartIntersection",function(){return h}),O.d($,"mapFragmentIntersection",function(){return S}),O.d($,"adjustSliding",function(){return m}),O.d($,"addSliding",function(){return p}),O.d($,"computeReloadInterval",function(){return v}),O.d($,"getFragmentWithSN",function(){return a}),O.d($,"getPartWith",function(){return i});var V=O("./src/polyfills/number.ts"),_=O("./src/utils/logger.ts");function P(s,l,C){switch(l){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(C);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(C);break}}function F(s){var l={};s.forEach(function(C){var g=C.groupId||"";C.id=l[g]=l[g]||0,l[g]++})}function N(s,l,C){var g=s[l],y=s[C];M(g,y)}function M(s,l){var C=l.startPTS;if(Object(V.isFiniteNumber)(C)){var g=0,y;l.sn>s.sn?(g=C-s.start,y=s):(g=s.start-C,y=l),y.duration!==g&&(y.duration=g)}else if(l.sn>s.sn){var R=s.cc===l.cc;R&&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 k(s,l,C,g,y,R){var w=g-C;w<=0&&(_.logger.warn("Fragment should have a positive duration",l),g=C+l.duration,R=y+l.duration);var T=C,b=g,f=l.startPTS,u=l.endPTS;if(Object(V.isFiniteNumber)(f)){var L=Math.abs(f-C);Object(V.isFiniteNumber)(l.deltaPTS)?l.deltaPTS=Math.max(L,l.deltaPTS):l.deltaPTS=L,T=Math.max(C,f),C=Math.min(C,f),y=Math.min(y,l.startDTS),b=Math.min(g,u),g=Math.max(g,u),R=Math.max(R,l.endDTS)}l.duration=g-C;var x=C-l.start;l.appendedPTS=g,l.start=l.startPTS=C,l.maxStartPTS=T,l.startDTS=y,l.endPTS=g,l.minEndPTS=b,l.endDTS=R;var A=l.sn;if(!s||As.endSN)return 0;var I,W=A-s.startSN,K=s.fragments;for(K[W]=l,I=W;I>0;I--)M(K[I],K[I-1]);for(I=W;I=0;y--){var R=g[y].initSegment;if(R){C=R;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var w=0,T;if(S(s,l,function(I,W){I.relurl&&(w=I.cc-W.cc),Object(V.isFiniteNumber)(I.startPTS)&&Object(V.isFiniteNumber)(I.endPTS)&&(W.start=W.startPTS=I.startPTS,W.startDTS=I.startDTS,W.appendedPTS=I.appendedPTS,W.maxStartPTS=I.maxStartPTS,W.endPTS=I.endPTS,W.endDTS=I.endDTS,W.minEndPTS=I.minEndPTS,W.duration=I.endPTS-I.startPTS,W.duration&&(T=W),l.PTSKnown=l.alignedSliding=!0),W.elementaryStreams=I.elementaryStreams,W.loader=I.loader,W.stats=I.stats,W.urlId=I.urlId,I.initSegment&&(W.initSegment=I.initSegment,C=I.initSegment)}),C){var b=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments;b.forEach(function(I){var W;(!I.initSegment||I.initSegment.relurl===((W=C)===null||W===void 0?void 0:W.relurl))&&(I.initSegment=C)})}if(l.skippedSegments&&(l.deltaUpdateFailed=l.fragments.some(function(I){return!I}),l.deltaUpdateFailed)){_.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var f=l.skippedSegments;f--;)l.fragments.shift();l.startSN=l.fragments[0].sn,l.startCC=l.fragments[0].cc}var u=l.fragments;if(w){_.logger.warn("discontinuity sliding from playlist, take drift into account");for(var L=0;L=g.length)return;p(l,g[C].start)}function p(s,l){if(l){for(var C=s.fragments,g=s.skippedSegments;g0&&y0&&b===-1&&(this.log("Override startPosition with lastCurrentTime @"+f.toFixed(3)),b=f),this.state=_.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=b,this.tick()}else this._forceStartLoad=!0,this.state=_.State.STOPPED},w.stopLoad=function(){this._forceStartLoad=!1,y.prototype.stopLoad.call(this)},w.doTick=function(){switch(this.state){case _.State.IDLE:this.doTickIdle();break;case _.State.WAITING_LEVEL:{var b,f=this.levels,u=this.level,L=f==null||((b=f[u])===null||b===void 0)?void 0:b.details;if(L&&(!L.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(L))break;this.state=_.State.IDLE;break}break}case _.State.FRAG_LOADING_WAITING_RETRY:{var x,A=self.performance.now(),I=this.retryDate;(!I||A>=I||(x=this.media)!==null&&x!==void 0&&x.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=_.State.IDLE)}break;default:break}this.onTickEnd()},w.onTickEnd=function(){y.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},w.doTickIdle=function(){var b,f,u=this.hls,L=this.levelLastLoaded,x=this.levels,A=this.media,I=u.config,W=u.nextLoadLevel;if(L===null||!A&&(this.startFragRequested||!I.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!x||!x[W])return;var K=x[W];this.level=u.nextLoadLevel=W;var Z=K.details;if(!Z||this.state===_.State.WAITING_LEVEL||Z.live&&this.levelLastLoaded!==W){this.state=_.State.WAITING_LEVEL;return}var z=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:A,k.PlaylistLevelType.MAIN);if(z===null)return;var B=z.len,ee=this.getMaxBufferLength(K.maxBitrate);if(B>=ee)return;if(this._streamEnded(z,Z)){var ie={};this.altAudio&&(ie.type="video"),this.hls.trigger(F.Events.BUFFER_EOS,ie),this.state=_.State.ENDED;return}var de=z.end,be=this.getNextFragment(de,Z);if(this.couldBacktrack&&!this.fragPrevious&&be&&be.sn!=="initSegment"){var Ie=be.sn-Z.startSN;Ie>1&&(be=Z.fragments[Ie-1],this.fragmentTracker.removeFragment(be))}if(be&&this.fragmentTracker.getState(be)===M.FragmentState.OK&&this.nextLoadPosition>de){var Ae=this.audioOnly&&!this.altAudio?d.ElementaryStreamTypes.AUDIO:d.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(A,Ae,k.PlaylistLevelType.MAIN),be=this.getNextFragment(this.nextLoadPosition,Z)}if(!be)return;be.initSegment&&!be.initSegment.data&&!this.bitrateTest&&(be=be.initSegment),((b=be.decryptdata)===null||b===void 0?void 0:b.keyFormat)==="identity"&&!((f=be.decryptdata)!==null&&f!==void 0&&f.key)?this.loadKey(be,Z):this.loadFragment(be,Z,de)},w.loadFragment=function(b,f,u){var L,x=this.fragmentTracker.getState(b);if(this.fragCurrent=b,x===M.FragmentState.BACKTRACKED){var A=this.fragmentTracker.getBacktrackData(b);if(A){this._handleFragmentLoadProgress(A),this._handleFragmentLoadComplete(A);return}else x=M.FragmentState.NOT_LOADED}x===M.FragmentState.NOT_LOADED||x===M.FragmentState.PARTIAL?b.sn==="initSegment"?this._loadInitSegment(b):this.bitrateTest?(b.bitrateTest=!0,this.log("Fragment "+b.sn+" of level "+b.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(b)):(this.startFragRequested=!0,y.prototype.loadFragment.call(this,b,f,u)):x===M.FragmentState.APPENDING?this.reduceMaxBufferLength(b.duration)&&this.fragmentTracker.removeFragment(b):((L=this.media)===null||L===void 0?void 0:L.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},w.getAppendedFrag=function(b){var f=this.fragmentTracker.getAppendedFrag(b,k.PlaylistLevelType.MAIN);return f&&"fragment"in f?f.fragment:f},w.getBufferedFrag=function(b){return this.fragmentTracker.getBufferedFrag(b,k.PlaylistLevelType.MAIN)},w.followingBufferedFrag=function(b){return b?this.getBufferedFrag(b.end+.5):null},w.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},w.nextLevelSwitch=function(){var b=this.levels,f=this.media;if(f!=null&&f.readyState){var u,L=this.getAppendedFrag(f.currentTime);if(L&&L.start>1&&this.flushMainBuffer(0,L.start-1),!f.paused&&b){var x=this.hls.nextLoadLevel,A=b[x],I=this.fragLastKbps;I&&this.fragCurrent?u=this.fragCurrent.duration*A.maxBitrate/(1e3*I)+1:u=0}else u=0;var W=this.getBufferedFrag(f.currentTime+u);if(W){var K=this.followingBufferedFrag(W);if(K){this.abortCurrentFrag();var Z=K.maxStartPTS?K.maxStartPTS:K.start,z=K.duration,B=Math.max(W.end,Z+Math.min(Math.max(z-this.config.maxFragLookUpTolerance,z*.5),z*.75));this.flushMainBuffer(B,Number.POSITIVE_INFINITY)}}}},w.abortCurrentFrag=function(){var b=this.fragCurrent;this.fragCurrent=null,b!=null&&b.loader&&b.loader.abort(),this.state===_.State.KEY_LOADING&&(this.state=_.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},w.flushMainBuffer=function(b,f){y.prototype.flushMainBuffer.call(this,b,f,this.altAudio?"video":null)},w.onMediaAttached=function(b,f){y.prototype.onMediaAttached.call(this,b,f);var u=f.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),u.addEventListener("playing",this.onvplaying),u.addEventListener("seeked",this.onvseeked),this.gapController=new m.default(this.config,u,this.fragmentTracker,this.hls)},w.onMediaDetaching=function(){var b=this.media;b&&(b.removeEventListener("playing",this.onvplaying),b.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),y.prototype.onMediaDetaching.call(this)},w.onMediaPlaying=function(){this.tick()},w.onMediaSeeked=function(){var b=this.media,f=b?b.currentTime:null;Object(V.isFiniteNumber)(f)&&this.log("Media seeked to "+f.toFixed(3)),this.tick()},w.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(F.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},w.onManifestParsed=function(b,f){var u=!1,L=!1,x;f.levels.forEach(function(A){x=A.audioCodec,x&&(x.indexOf("mp4a.40.2")!==-1&&(u=!0),x.indexOf("mp4a.40.5")!==-1&&(L=!0))}),this.audioCodecSwitch=u&&L&&!Object(P.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=f.levels,this.startFragRequested=!1},w.onLevelLoading=function(b,f){var u=this.levels;if(!u||this.state!==_.State.IDLE)return;var L=u[f.level];(!L.details||L.details.live&&this.levelLastLoaded!==f.level||this.waitForCdnTuneIn(L.details))&&(this.state=_.State.WAITING_LEVEL)},w.onLevelLoaded=function(b,f){var u,L=this.levels,x=f.level,A=f.details,I=A.totalduration;if(!L){this.warn("Levels were reset while loading level "+x);return}this.log("Level "+x+" loaded ["+A.startSN+","+A.endSN+"], cc ["+A.startCC+", "+A.endCC+"] duration:"+I);var W=this.fragCurrent;W&&(this.state===_.State.FRAG_LOADING||this.state===_.State.FRAG_LOADING_WAITING_RETRY)&&(W.level!==f.level&&W.loader&&(this.state=_.State.IDLE,W.loader.abort()));var K=L[x],Z=0;if(A.live||(u=K.details)!==null&&u!==void 0&&u.live){if(A.fragments[0]||(A.deltaUpdateFailed=!0),A.deltaUpdateFailed)return;Z=this.alignPlaylists(A,K.details)}if(K.details=A,this.levelLastLoaded=x,this.hls.trigger(F.Events.LEVEL_UPDATED,{details:A,level:x}),this.state===_.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(A))return;this.state=_.State.IDLE}this.startFragRequested?A.live&&this.synchronizeToLiveEdge(A):this.setStartPosition(A,Z),this.tick()},w._handleFragmentLoadProgress=function(b){var f,u=b.frag,L=b.part,x=b.payload,A=this.levels;if(!A){this.warn("Levels were reset while fragment load was in progress. Fragment "+u.sn+" of level "+u.level+" will not be buffered");return}var I=A[u.level],W=I.details;if(!W){this.warn("Dropping fragment "+u.sn+" of level "+u.level+" after level details were reset");return}var K=I.videoCodec,Z=W.PTSKnown||!W.live,z=(f=u.initSegment)===null||f===void 0?void 0:f.data,B=this._getAudioCodec(I),ee=this.transmuxer=this.transmuxer||new h.default(this.hls,k.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ie=L?L.index:-1,de=ie!==-1,be=new S.ChunkMetadata(u.level,u.sn,u.stats.chunkCount,x.byteLength,ie,de),Ie=this.initPTS[u.cc];ee.push(x,z,B,K,u,L,W.totalduration,Z,be,Ie)},w.onAudioTrackSwitching=function(b,f){var u=this.altAudio,L=!!f.url,x=f.id;if(!L){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var A=this.fragCurrent;A!=null&&A.loader&&(this.log("Switching to main audio track, cancel main fragment load"),A.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var I=this.hls;u&&I.trigger(F.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),I.trigger(F.Events.AUDIO_TRACK_SWITCHED,{id:x})}},w.onAudioTrackSwitched=function(b,f){var u=f.id,L=!!this.hls.audioTracks[u].url;if(L){var x=this.videoBuffer;x&&this.mediaBuffer!==x&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=x)}this.altAudio=L,this.tick()},w.onBufferCreated=function(b,f){var u=f.tracks,L,x,A=!1;for(var I in u){var W=u[I];if(W.id==="main"){if(x=I,L=W,I==="video"){var K=u[I];K&&(this.videoBuffer=K.buffer)}}else A=!0}A&&L?(this.log("Alternate track found, use "+x+".buffered to schedule main fragment loading"),this.mediaBuffer=L.buffer):this.mediaBuffer=this.media},w.onFragBuffered=function(b,f){var u=f.frag,L=f.part;if(u&&u.type!==k.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(u)){this.warn("Fragment "+u.sn+(L?" p: "+L.index:"")+" of level "+u.level+" finished buffering, but was aborted. state: "+this.state),this.state===_.State.PARSED&&(this.state=_.State.IDLE);return}var x=L?L.stats:u.stats;this.fragLastKbps=Math.round(8*x.total/(x.buffering.end-x.loading.first)),u.sn!=="initSegment"&&(this.fragPrevious=u),this.fragBufferedComplete(u,L)},w.onError=function(b,f){switch(f.details){case p.ErrorDetails.FRAG_LOAD_ERROR:case p.ErrorDetails.FRAG_LOAD_TIMEOUT:case p.ErrorDetails.KEY_LOAD_ERROR:case p.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(k.PlaylistLevelType.MAIN,f);break;case p.ErrorDetails.LEVEL_LOAD_ERROR:case p.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==_.State.ERROR&&(f.fatal?(this.warn(""+f.details),this.state=_.State.ERROR):!f.levelRetry&&this.state===_.State.WAITING_LEVEL&&(this.state=_.State.IDLE));break;case p.ErrorDetails.BUFFER_FULL_ERROR:if(f.parent==="main"&&(this.state===_.State.PARSING||this.state===_.State.PARSED)){var u=!0,L=this.getFwdBufferInfo(this.media,k.PlaylistLevelType.MAIN);L&&L.len>.5&&(u=!this.reduceMaxBufferLength(L.len)),u&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},w.checkBuffer=function(){var b=this.media,f=this.gapController;if(!b||!f||!b.readyState)return;var u=N.BufferHelper.getBuffered(b);!this.loadedmetadata&&u.length?(this.loadedmetadata=!0,this.seekToStartPos()):f.poll(this.lastCurrentTime),this.lastCurrentTime=b.currentTime},w.onFragLoadEmergencyAborted=function(){this.state=_.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},w.onBufferFlushed=function(b,f){var u=f.type;if(u!==d.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var L=(u===d.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(L,u,k.PlaylistLevelType.MAIN)}},w.onLevelsUpdated=function(b,f){this.levels=f.levels},w.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},w.seekToStartPos=function(){var b=this.media,f=b.currentTime,u=this.startPosition;if(u>=0&&f0&&(A1&&b.seeking===!1){var u=b.currentTime;if(N.BufferHelper.isBuffered(b,u)?f=this.getAppendedFrag(u):N.BufferHelper.isBuffered(b,u+.1)&&(f=this.getAppendedFrag(u+.1)),f){var L=this.fragPlaying,x=f.level;(!L||f.sn!==L.sn||L.level!==x||f.urlId!==L.urlId)&&(this.hls.trigger(F.Events.FRAG_CHANGED,{frag:f}),(!L||L.level!==x)&&this.hls.trigger(F.Events.LEVEL_SWITCHED,{level:x}),this.fragPlaying=f)}}},i(R,[{key:"nextLevel",get:function(){var b=this.nextBufferedFrag;return b?b.level:-1}},{key:"currentLevel",get:function(){var b=this.media;if(b){var f=this.getAppendedFrag(b.currentTime);if(f)return f.level}return-1}},{key:"nextBufferedFrag",get:function(){var b=this.media;if(b){var f=this.getAppendedFrag(b.currentTime);return this.followingBufferedFrag(f)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),R}(_.default)},"./src/controller/subtitle-stream-controller.ts":function(ne,$,O){"use strict";O.r($),O.d($,"SubtitleStreamController",function(){return s});var V=O("./src/events.ts"),_=O("./src/utils/logger.ts"),P=O("./src/utils/buffer-helper.ts"),F=O("./src/controller/fragment-finders.ts"),N=O("./src/utils/discontinuities.ts"),M=O("./src/controller/level-helper.ts"),k=O("./src/controller/fragment-tracker.ts"),d=O("./src/controller/base-stream-controller.ts"),h=O("./src/types/loader.ts"),S=O("./src/types/level.ts");function m(l,C){for(var g=0;g=f[x].start&&L<=f[x].end){u=f[x];break}var A=T.start+T.duration;u?u.end=A:(u={start:L,end:A},f.push(u)),this.fragmentTracker.fragBuffered(T)},g.onBufferFlushing=function(R,w){var T=w.startOffset,b=w.endOffset;if(T===0&&b!==Number.POSITIVE_INFINITY){var f=this.currentTrackId,u=this.levels;if(!u.length||!u[f]||!u[f].details)return;var L=u[f].details,x=L.targetduration,A=b-x;if(A<=0)return;w.endOffsetSubtitles=Math.max(0,A),this.tracksBuffered.forEach(function(I){for(var W=0;W=L.length||f!==u||!x)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,b.live||(T=x.details)!==null&&T!==void 0&&T.live){var A=this.mainDetails;if(b.deltaUpdateFailed||!A)return;var I=A.fragments[0];if(!x.details)b.hasProgramDateTime&&A.hasProgramDateTime?Object(N.alignMediaPlaylistByPDT)(b,A):I&&Object(M.addSliding)(b,I.start);else{var W=this.alignPlaylists(b,x.details);W===0&&I&&Object(M.addSliding)(b,I.start)}}if(x.details=b,this.levelLastLoaded=f,this.tick(),b.live&&!this.fragCurrent&&this.media&&this.state===d.State.IDLE){var K=Object(F.findFragmentByPTS)(null,b.fragments,this.media.currentTime,0);K||(this.warn("Subtitle playlist not aligned with playback"),x.details=void 0)}},g._handleFragmentLoadComplete=function(R){var w=R.frag,T=R.payload,b=w.decryptdata,f=this.hls;if(this.fragContextChanged(w))return;if(T&&T.byteLength>0&&b&&b.key&&b.iv&&b.method==="AES-128"){var u=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(T),b.key.buffer,b.iv.buffer).then(function(L){var x=performance.now();f.trigger(V.Events.FRAG_DECRYPTED,{frag:w,payload:L,stats:{tstart:u,tdecrypt:x}})})}},g.doTick=function(){if(!this.media){this.state=d.State.IDLE;return}if(this.state===d.State.IDLE){var R,w=this.currentTrackId,T=this.levels;if(!T.length||!T[w]||!T[w].details)return;var b=T[w].details,f=b.targetduration,u=this.config,L=this.media,x=P.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,L.currentTime-f,u.maxBufferHole),A=x.end,I=x.len,W=this.getMaxBufferLength()+f;if(I>W)return;console.assert(b,"Subtitle track details are defined on idle subtitle stream controller tick");var K=b.fragments,Z=K.length,z=b.edge,B,ee=this.fragPrevious;if(A-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)},v.pollTrackChange=function(i){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,i)},v.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 i=S(this.media.textTracks);i.forEach(function(s){Object(_.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},v.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},v.onManifestParsed=function(i,s){this.tracks=s.subtitleTracks},v.onSubtitleTrackLoaded=function(i,s){var l=s.id,C=s.details,g=this.trackId,y=this.tracksInGroup[g];if(!y){this.warn("Invalid subtitle track id "+l);return}var R=y.details;y.details=s.details,this.log("subtitle track "+l+" loaded ["+C.startSN+"-"+C.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,s,R))},v.onLevelLoading=function(i,s){this.switchLevel(s.level)},v.onLevelSwitching=function(i,s){this.switchLevel(s.level)},v.switchLevel=function(i){var s=this.hls.levels[i];if(!(s!=null&&s.textGroupIds))return;var l=s.textGroupIds[s.urlId];if(this.groupId!==l){var C=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,g=this.tracks.filter(function(w){return!l||w.groupId===l});this.tracksInGroup=g;var y=this.findTrackId(C==null?void 0:C.name)||this.findTrackId();this.groupId=l;var R={subtitleTracks:g};this.log("Updating subtitle tracks, "+g.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(V.Events.SUBTITLE_TRACKS_UPDATED,R),y!==-1&&this.setSubtitleTrack(y,C)}},v.findTrackId=function(i){for(var s=this.tracksInGroup,l=0;l=C.length)return;this.clearTimer();var g=C[i];if(this.log("Switching to subtitle track "+i),this.trackId=i,g){var y=g.id,R=g.groupId,w=R===void 0?"":R,T=g.name,b=g.type,f=g.url;this.hls.trigger(V.Events.SUBTITLE_TRACK_SWITCH,{id:y,groupId:w,name:T,type:b,url:f});var u=this.switchParams(g.url,s==null?void 0:s.details);this.loadPlaylist(u)}else this.hls.trigger(V.Events.SUBTITLE_TRACK_SWITCH,{id:i})},v.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var i=-1,s=S(this.media.textTracks),l=0;l=0&&(b[0]=Math.min(b[0],C),b[1]=Math.max(b[1],g),w=!0,f/(g-C)>.5))return}if(w||R.push([C,g]),this.config.renderTextTracksNatively){var u=this.captionsTracks[l];this.Cues.newCue(u,C,g,y)}else{var L=this.Cues.newCue(null,C,g,y);this.hls.trigger(_.Events.CUES_PARSED,{type:"captions",cues:L,track:l})}},i.onInitPtsFound=function(l,C){var g=this,y=C.frag,R=C.id,w=C.initPTS,T=C.timescale,b=this.unparsedVttFrags;R==="main"&&(this.initPTS[y.cc]=w,this.timescale[y.cc]=T),b.length&&(this.unparsedVttFrags=[],b.forEach(function(f){g.onFragLoaded(_.Events.FRAG_LOADED,f)}))},i.getExistingTrack=function(l){var C=this.media;if(C)for(var g=0;g>>8^T&255^99,k[y]=T,d[T]=y;var b=g[y],f=g[b],u=g[f],L=g[T]*257^T*16843008;S[y]=L<<24|L>>>8,m[y]=L<<16|L>>>16,p[y]=L<<8|L>>>24,v[y]=L,L=u*16843009^f*65537^b*257^y*16843008,i[T]=L<<24|L>>>8,s[T]=L<<16|L>>>16,l[T]=L<<8|L>>>24,C[T]=L,y?(y=b^g[g[g[u^b]]],R^=g[g[R]]):y=R=1}},N.expandKey=function(k){for(var d=this.uint8ArrayToUint32Array_(k),h=!0,S=0;S>>6)+1;var L=(l[C+2]&60)>>>2;if(L>u.length-1){s.trigger(P.Events.ERROR,{type:_.ErrorTypes.MEDIA_ERROR,details:_.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+L});return}return w=(l[C+2]&1)<<2,w|=(l[C+3]&192)>>>6,V.logger.log("manifest codec:"+g+", ADTS type:"+y+", samplingIndex:"+L),/firefox/i.test(b)?L>=6?(y=5,T=new Array(4),R=L-3):(y=2,T=new Array(2),R=L):b.indexOf("android")!==-1?(y=2,T=new Array(2),R=L):(y=5,T=new Array(4),g&&(g.indexOf("mp4a.40.29")!==-1||g.indexOf("mp4a.40.5")!==-1)||!g&&L>=6?R=L-3:((g&&g.indexOf("mp4a.40.2")!==-1&&(L>=6&&w===1||/vivaldi/i.test(b))||!g&&w===1)&&(y=2,T=new Array(2)),R=L)),T[0]=y<<3,T[0]|=(L&14)>>1,T[1]|=(L&1)<<7,T[1]|=w<<3,y===5&&(T[1]|=(R&14)>>1,T[2]=(R&1)<<7,T[2]|=2<<2,T[3]=0),{config:T,samplerate:u[L],channelCount:w,codec:"mp4a.40."+y,manifestCodec:f}}function N(s,l){return s[l]===255&&(s[l+1]&246)===240}function M(s,l){return s[l+1]&1?7:9}function k(s,l){return(s[l+3]&3)<<11|s[l+4]<<3|(s[l+5]&224)>>>5}function d(s,l){return l+5=s.length)return!1;var g=k(s,l);if(g<=C)return!1;var y=l+g;return y===s.length||h(s,y)}return!1}function p(s,l,C,g,y){if(!s.samplerate){var R=F(l,C,g,y);if(!R)return;s.config=R.config,s.samplerate=R.samplerate,s.channelCount=R.channelCount,s.codec=R.codec,s.manifestCodec=R.manifestCodec,V.logger.log("parsed codec:"+s.codec+", rate:"+R.samplerate+", channels:"+R.channelCount)}}function v(s){return 1024*9e4/s}function a(s,l,C,g,y){var R=M(s,l),w=k(s,l);if(w-=R,w>0){var T=C+g*y;return{headerLength:R,frameLength:w,stamp:T}}}function i(s,l,C,g,y){var R=v(s.samplerate),w=a(l,C,g,y,R);if(w){var T=w.frameLength,b=w.headerLength,f=w.stamp,u=b+T,L=Math.max(0,C+u-l.length),x;L?(x=new Uint8Array(u-b),x.set(l.subarray(C+b,l.length),0)):x=l.subarray(C+b,C+u);var A={unit:x,pts:f};return L||s.samples.push(A),{sample:A,length:u,missing:L}}}},"./src/demux/base-audio-demuxer.ts":function(ne,$,O){"use strict";O.r($),O.d($,"initPTSFn",function(){return k});var V=O("./src/polyfills/number.ts"),_=O("./src/demux/id3.ts"),P=O("./src/demux/dummy-demuxed-track.ts"),F=O("./src/utils/mp4-tools.ts"),N=O("./src/utils/typed-array.ts"),M=function(){function d(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var h=d.prototype;return h.resetInitSegment=function(m,p,v){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},h.resetTimeStamp=function(){},h.resetContiguity=function(){},h.canParse=function(m,p){return!1},h.appendFrame=function(m,p,v){},h.demux=function(m,p){this.cachedData&&(m=Object(F.appendUint8Array)(this.cachedData,m),this.cachedData=null);var v=_.getID3Data(m,0),a=v?v.length:0,i,s,l=this._audioTrack,C=this._id3Track,g=v?_.getTimeStamp(v):void 0,y=m.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=k(g,p)),v&&v.length>0&&C.samples.push({pts:this.initPTS,dts:this.initPTS,data:v}),s=this.initPTS;aM?(this.word<<=M,this.bitsAvailable-=M):(M-=this.bitsAvailable,k=M>>3,M-=k>>3,this.bytesAvailable-=k,this.loadWord(),this.word<<=M,this.bitsAvailable-=M)},F.readBits=function(M){var k=Math.min(this.bitsAvailable,M),d=this.word>>>32-k;return M>32&&V.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=k,this.bitsAvailable>0?this.word<<=k:this.bytesAvailable>0&&this.loadWord(),k=M-k,k>0&&this.bitsAvailable?d<>>M)!==0)return this.word<<=M,this.bitsAvailable-=M,M;return this.loadWord(),M+this.skipLZ()},F.skipUEG=function(){this.skipBits(1+this.skipLZ())},F.skipEG=function(){this.skipBits(1+this.skipLZ())},F.readUEG=function(){var M=this.skipLZ();return this.readBits(M+1)-1},F.readEG=function(){var M=this.readUEG();return 1&M?1+M>>>1:-1*(M>>>1)},F.readBoolean=function(){return this.readBits(1)===1},F.readUByte=function(){return this.readBits(8)},F.readUShort=function(){return this.readBits(16)},F.readUInt=function(){return this.readBits(32)},F.skipScalingList=function(M){for(var k=8,d=8,h,S=0;S0?y.subarray(w,w+T):void 0},F=function(y,R){var w=0;return w=(y[R]&127)<<21,w|=(y[R+1]&127)<<14,w|=(y[R+2]&127)<<7,w|=y[R+3]&127,w},N=function(y,R){return V(y,R)&&F(y,R+6)+10<=y.length-R},M=function(y){for(var R=h(y),w=0;w>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:A+=String.fromCharCode(u);break;case 12:case 13:L=y[I++],A+=String.fromCharCode((u&31)<<6|L&63);break;case 14:L=y[I++],x=y[I++],A+=String.fromCharCode((u&15)<<12|(L&63)<<6|(x&63)<<0);break;default:}}return A},s={decodeTextFrame:p},l;function C(){return!l&&typeof self.TextDecoder!="undefined"&&(l=new self.TextDecoder("utf-8")),l}},"./src/demux/mp3demuxer.ts":function(ne,$,O){"use strict";O.r($);var V=O("./src/demux/base-audio-demuxer.ts"),_=O("./src/demux/id3.ts"),P=O("./src/utils/logger.ts"),F=O("./src/demux/mpegaudio.ts");function N(d,h){d.prototype=Object.create(h.prototype),d.prototype.constructor=d,M(d,h)}function M(d,h){return M=Object.setPrototypeOf||function(m,p){return m.__proto__=p,m},M(d,h)}var k=function(d){N(h,d);function h(){return d.apply(this,arguments)||this}var S=h.prototype;return S.resetInitSegment=function(p,v,a){d.prototype.resetInitSegment.call(this,p,v,a),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:p,duration:a,inputTimeScale:9e4,dropped:0}},h.probe=function(p){if(!p)return!1;for(var v=_.getID3Data(p,0)||[],a=v.length,i=p.length;a0},N.demux=function(k){var d=k,h=Object(_.dummyTrack)();if(this.config.progressive){this.remainderData&&(d=Object(V.appendUint8Array)(this.remainderData,k));var S=Object(V.segmentValidRange)(d);this.remainderData=S.remainder,h.samples=S.valid||new Uint8Array}else h.samples=d;return{audioTrack:Object(_.dummyTrack)(),avcTrack:h,id3Track:Object(_.dummyTrack)(),textTrack:Object(_.dummyTrack)()}},N.flush=function(){var k=Object(_.dummyTrack)();return k.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(_.dummyTrack)(),avcTrack:k,id3Track:Object(_.dummyTrack)(),textTrack:Object(_.dummyTrack)()}},N.demuxSampleAes=function(k,d,h){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},N.destroy=function(){},F}();P.minProbeByteLength=1024,$.default=P},"./src/demux/mpegaudio.ts":function(ne,$,O){"use strict";O.r($),O.d($,"appendFrame",function(){return M}),O.d($,"parseHeader",function(){return k}),O.d($,"isHeaderPattern",function(){return d}),O.d($,"isHeader",function(){return h}),O.d($,"canParse",function(){return S}),O.d($,"probe",function(){return m});var V=null,_=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],P=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],F=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],N=[0,1,1,4];function M(p,v,a,i,s){if(a+24>v.length)return;var l=k(v,a);if(l&&a+l.frameLength<=v.length){var C=l.samplesPerFrame*9e4/l.sampleRate,g=i+s*C,y={unit:v.subarray(a,a+l.frameLength),pts:g,dts:g};return p.config=[],p.channelCount=l.channelCount,p.samplerate=l.sampleRate,p.samples.push(y),{sample:y,length:l.frameLength,missing:0}}}function k(p,v){var a=p[v+1]>>3&3,i=p[v+1]>>1&3,s=p[v+2]>>4&15,l=p[v+2]>>2&3;if(a!==1&&s!==0&&s!==15&&l!==3){var C=p[v+2]>>1&1,g=p[v+3]>>6,y=a===3?3-i:i===3?3:4,R=_[y*14+s-1]*1e3,w=a===3?0:a===2?1:2,T=P[w*3+l],b=g===3?1:2,f=F[a][i],u=N[i],L=f*8*u,x=Math.floor(f*R/T+C)*u;if(V===null){var A=navigator.userAgent||"",I=A.match(/Chrome\/(\d+)/i);V=I?parseInt(I[1]):0}var W=!!V&&V<=87;return W&&i===2&&R>=224e3&&g===0&&(p[v+3]=p[v+3]|128),{sampleRate:T,channelCount:b,frameLength:x,samplesPerFrame:L}}}function d(p,v){return p[v]===255&&(p[v+1]&224)===224&&(p[v+1]&6)!==0}function h(p,v){return v+1=k.length){h();return}if(k[d].unit.length<32)continue;var S=this.decrypter.isSync();if(this.decryptAacSample(k,d,h,S),!S)return}},N.getAvcEncryptedData=function(k){for(var d=Math.floor((k.length-48)/160)*16+16,h=new Int8Array(d),S=0,m=32;m<=k.length-16;m+=160,S+=16)h.set(k.subarray(m,m+16),S);return h},N.getAvcDecryptedUnit=function(k,d){for(var h=new Uint8Array(d),S=0,m=32;m<=k.length-16;m+=160,S+=16)k.set(h.subarray(S,S+16),m);return k},N.decryptAvcSample=function(k,d,h,S,m,p){var v=Object(_.discardEPB)(m.data),a=this.getAvcEncryptedData(v),i=this;this.decryptBuffer(a.buffer,function(s){m.data=i.getAvcDecryptedUnit(v,s),p||i.decryptAvcSamples(k,d,h+1,S)})},N.decryptAvcSamples=function(k,d,h,S){if(k instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;d++,h=0){if(d>=k.length){S();return}for(var m=k[d].units;!(h>=m.length);h++){var p=m[h];if(p.data.length<=48||p.type!==1&&p.type!==5)continue;var v=this.decrypter.isSync();if(this.decryptAvcSample(k,d,h,S,p,v),!v)return}}},F}();$.default=P},"./src/demux/transmuxer-interface.ts":function(ne,$,O){"use strict";O.r($),O.d($,"default",function(){return m});var V=O("./node_modules/webworkify-webpack/index.js"),_=O.n(V),P=O("./src/events.ts"),F=O("./src/demux/transmuxer.ts"),N=O("./src/utils/logger.ts"),M=O("./src/errors.ts"),k=O("./src/utils/mediasource-helper.ts"),d=O("./node_modules/eventemitter3/index.js"),h=O.n(d),S=Object(k.getMediaSource)()||{isTypeSupported:function(){return!1}},m=function(){function p(a,i,s,l){var C=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=a,this.id=i,this.onTransmuxComplete=s,this.onFlush=l;var g=a.config,y=function(f,u){u=u||{},u.frag=C.frag,u.id=C.id,a.trigger(f,u)};this.observer=new d.EventEmitter,this.observer.on(P.Events.FRAG_DECRYPTED,y),this.observer.on(P.Events.ERROR,y);var R={mp4:S.isTypeSupported("video/mp4"),mpeg:S.isTypeSupported("audio/mpeg"),mp3:S.isTypeSupported('audio/mp4; codecs="mp3"')},w=navigator.vendor;if(g.enableWorker&&typeof Worker!="undefined"){N.logger.log("demuxing in webworker");var T;try{T=this.worker=V("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),T.addEventListener("message",this.onwmsg),T.onerror=function(b){a.trigger(P.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(b.message+" ("+b.filename+":"+b.lineno+")")})},T.postMessage({cmd:"init",typeSupported:R,vendor:w,id:i,config:JSON.stringify(g)})}catch(b){N.logger.warn("Error in worker:",b),N.logger.error("Error while initializing DemuxerWorker, fallback to inline"),T&&self.URL.revokeObjectURL(T.objectURL),this.transmuxer=new F.default(this.observer,R,g,w,i),this.worker=null}}else this.transmuxer=new F.default(this.observer,R,g,w,i)}var v=p.prototype;return v.destroy=function(){var i=this.worker;if(i)i.removeEventListener("message",this.onwmsg),i.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},v.push=function(i,s,l,C,g,y,R,w,T,b){var f=this;T.transmuxing.start=self.performance.now();var u=this.transmuxer,L=this.worker,x=y?y.start:g.start,A=g.decryptdata,I=this.frag,W=!(I&&g.cc===I.cc),K=!(I&&T.level===I.level),Z=I?T.sn-I.sn:-1,z=this.part?T.part-this.part.index:1,B=!K&&(Z===1||Z===0&&z===1),ee=self.performance.now();(K||Z||g.stats.parsing.start===0)&&(g.stats.parsing.start=ee),y&&(z||!B)&&(y.stats.parsing.start=ee);var ie=new F.TransmuxState(W,B,w,K,x);if(!B||W){N.logger.log("[transmuxer-interface, "+g.type+"]: Starting new transmux session for sn: "+T.sn+" p: "+T.part+" level: "+T.level+" id: "+T.id+` discontinuity: `+W+` trackSwitch: `+K+` contiguous: `+B+` accurateTimeOffset: `+w+` timeOffset: `+x);var de=new F.TransmuxConfig(l,C,s,R,b);this.configureTransmuxer(de)}if(this.frag=g,this.part=y,L)L.postMessage({cmd:"demux",data:i,decryptdata:A,chunkMeta:T,state:ie},i instanceof ArrayBuffer?[i]:[]);else if(u){var be=u.push(i,A,T,ie);Object(F.isPromise)(be)?be.then(function(Ie){f.handleTransmuxComplete(Ie)}):this.handleTransmuxComplete(be)}},v.flush=function(i){var s=this;i.transmuxing.start=self.performance.now();var l=this.transmuxer,C=this.worker;if(C)C.postMessage({cmd:"flush",chunkMeta:i});else if(l){var g=l.flush(i);Object(F.isPromise)(g)?g.then(function(y){s.handleFlushResult(y,i)}):this.handleFlushResult(g,i)}},v.handleFlushResult=function(i,s){var l=this;i.forEach(function(C){l.handleTransmuxComplete(C)}),this.onFlush(s)},v.onWorkerMessage=function(i){var s=i.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}}},v.configureTransmuxer=function(i){var s=this.worker,l=this.transmuxer;s?s.postMessage({cmd:"configure",config:i}):l&&l.configure(i)},v.handleTransmuxComplete=function(i){i.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(i)},p}()},"./src/demux/transmuxer-worker.ts":function(ne,$,O){"use strict";O.r($),O.d($,"default",function(){return M});var V=O("./src/demux/transmuxer.ts"),_=O("./src/events.ts"),P=O("./src/utils/logger.ts"),F=O("./node_modules/eventemitter3/index.js"),N=O.n(F);function M(m){var p=new F.EventEmitter,v=function(i,s){m.postMessage({event:i,data:s})};p.on(_.Events.FRAG_DECRYPTED,v),p.on(_.Events.ERROR,v),m.addEventListener("message",function(a){var i=a.data;switch(i.cmd){case"init":{var s=JSON.parse(i.config);m.transmuxer=new V.default(p,i.typeSupported,s,i.vendor,i.id),Object(P.enableLogs)(s.debug),v("init",null);break}case"configure":{m.transmuxer.configure(i.config);break}case"demux":{var l=m.transmuxer.push(i.data,i.decryptdata,i.chunkMeta,i.state);Object(V.isPromise)(l)?l.then(function(y){k(m,y)}):k(m,l);break}case"flush":{var C=i.chunkMeta,g=m.transmuxer.flush(C);Object(V.isPromise)(g)?g.then(function(y){h(m,y,C)}):h(m,g,C);break}default:break}})}function k(m,p){if(S(p.remuxResult))return;var v=[],a=p.remuxResult,i=a.audio,s=a.video;i&&d(v,i),s&&d(v,s),m.postMessage({event:"transmuxComplete",data:p},v)}function d(m,p){p.data1&&m.push(p.data1.buffer),p.data2&&m.push(p.data2.buffer)}function h(m,p,v){p.forEach(function(a){k(m,a)}),m.postMessage({event:"flush",data:v})}function S(m){return!m.audio&&!m.video&&!m.text&&!m.id3&&!m.initSegment}},"./src/demux/transmuxer.ts":function(ne,$,O){"use strict";O.r($),O.d($,"default",function(){return s}),O.d($,"isPromise",function(){return g}),O.d($,"TransmuxConfig",function(){return y}),O.d($,"TransmuxState",function(){return R});var V=O("./src/events.ts"),_=O("./src/errors.ts"),P=O("./src/crypt/decrypter.ts"),F=O("./src/demux/aacdemuxer.ts"),N=O("./src/demux/mp4demuxer.ts"),M=O("./src/demux/tsdemuxer.ts"),k=O("./src/demux/mp3demuxer.ts"),d=O("./src/remux/mp4-remuxer.ts"),h=O("./src/remux/passthrough-remuxer.ts"),S=O("./src/demux/chunk-cache.ts"),m=O("./src/utils/mp4-tools.ts"),p=O("./src/utils/logger.ts"),v;try{v=self.performance.now.bind(self.performance)}catch(w){p.logger.debug("Unable to use Performance API on this environment"),v=self.Date.now}var a=[{demux:M.default,remux:d.default},{demux:N.default,remux:h.default},{demux:F.default,remux:d.default},{demux:k.default,remux:d.default}],i=1024;a.forEach(function(w){var T=w.demux;i=Math.max(i,T.minProbeByteLength)});var s=function(){function w(b,f,u,L,x){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 S.default,this.observer=b,this.typeSupported=f,this.config=u,this.vendor=L,this.id=x}var T=w.prototype;return T.configure=function(f){this.transmuxConfig=f,this.decrypter&&this.decrypter.reset()},T.push=function(f,u,L,x){var A=this,I=L.transmuxing;I.executeStart=v();var W=new Uint8Array(f),K=this.cache,Z=this.config,z=this.currentTransmuxState,B=this.transmuxConfig;x&&(this.currentTransmuxState=x);var ee=l(W,u);if(ee&&ee.method==="AES-128"){var ie=this.getDecrypter();if(Z.enableSoftwareAES){var de=ie.softwareDecrypt(W,ee.key.buffer,ee.iv.buffer);if(!de)return I.executeEnd=v(),C(L);W=new Uint8Array(de)}else return this.decryptionPromise=ie.webCryptoDecrypt(W,ee.key.buffer,ee.iv.buffer).then(function(ve){var we=A.push(ve,null,L);return A.decryptionPromise=null,we}),this.decryptionPromise}var be=x||z,Ie=be.contiguous,Ae=be.discontinuity,Re=be.trackSwitch,ke=be.accurateTimeOffset,De=be.timeOffset,ge=B.audioCodec,ue=B.videoCodec,Me=B.defaultInitPts,$e=B.duration,Ke=B.initSegmentData;if((Ae||Re)&&this.resetInitSegment(Ke,ge,ue,$e),Ae&&this.resetInitialTimestamp(Me),Ie||this.resetContiguity(),this.needsProbing(W,Ae,Re)){if(K.dataLength){var tt=K.flush();W=Object(m.appendUint8Array)(tt,W)}this.configureTransmuxer(W,B)}var se=this.transmux(W,ee,De,ke,L),ae=this.currentTransmuxState;return ae.contiguous=!0,ae.discontinuity=!1,ae.trackSwitch=!1,I.executeEnd=v(),se},T.flush=function(f){var u=this,L=f.transmuxing;L.executeStart=v();var x=this.decrypter,A=this.cache,I=this.currentTransmuxState,W=this.decryptionPromise;if(W)return W.then(function(){return u.flush(f)});var K=[],Z=I.timeOffset;if(x){var z=x.flush();z&&K.push(this.push(z,null,f))}var B=A.dataLength;A.reset();var ee=this.demuxer,ie=this.remuxer;if(!ee||!ie)return B>=i&&this.observer.emit(V.Events.ERROR,V.Events.ERROR,{type:_.ErrorTypes.MEDIA_ERROR,details:_.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),L.executeEnd=v(),[C(f)];var de=ee.flush(Z);return g(de)?de.then(function(be){return u.flushRemux(K,be,f),K}):(this.flushRemux(K,de,f),K)},T.flushRemux=function(f,u,L){var x=u.audioTrack,A=u.avcTrack,I=u.id3Track,W=u.textTrack,K=this.currentTransmuxState,Z=K.accurateTimeOffset,z=K.timeOffset;p.logger.log("[transmuxer.ts]: Flushed fragment "+L.sn+(L.part>-1?" p: "+L.part:"")+" of level "+L.level);var B=this.remuxer.remux(x,A,I,W,z,Z,!0,this.id);f.push({remuxResult:B,chunkMeta:L}),L.transmuxing.executeEnd=v()},T.resetInitialTimestamp=function(f){var u=this.demuxer,L=this.remuxer;if(!u||!L)return;u.resetTimeStamp(f),L.resetTimeStamp(f)},T.resetContiguity=function(){var f=this.demuxer,u=this.remuxer;if(!f||!u)return;f.resetContiguity(),u.resetNextTimestamp()},T.resetInitSegment=function(f,u,L,x){var A=this.demuxer,I=this.remuxer;if(!A||!I)return;A.resetInitSegment(u,L,x),I.resetInitSegment(f,u,L)},T.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},T.transmux=function(f,u,L,x,A){var I;return u&&u.method==="SAMPLE-AES"?I=this.transmuxSampleAes(f,u,L,x,A):I=this.transmuxUnencrypted(f,L,x,A),I},T.transmuxUnencrypted=function(f,u,L,x){var A=this.demuxer.demux(f,u,!1,!this.config.progressive),I=A.audioTrack,W=A.avcTrack,K=A.id3Track,Z=A.textTrack,z=this.remuxer.remux(I,W,K,Z,u,L,!1,this.id);return{remuxResult:z,chunkMeta:x}},T.transmuxSampleAes=function(f,u,L,x,A){var I=this;return this.demuxer.demuxSampleAes(f,u,L).then(function(W){var K=I.remuxer.remux(W.audioTrack,W.avcTrack,W.id3Track,W.textTrack,L,x,!1,I.id);return{remuxResult:K,chunkMeta:A}})},T.configureTransmuxer=function(f,u){for(var L=this.config,x=this.observer,A=this.typeSupported,I=this.vendor,W=u.audioCodec,K=u.defaultInitPts,Z=u.duration,z=u.initSegmentData,B=u.videoCodec,ee,ie=0,de=a.length;ie0&&T!=null&&T.key!=null&&T.iv!==null&&T.method!=null&&(b=T),b}var C=function(T){return{remuxResult:{},chunkMeta:T}};function g(w){return"then"in w&&w.then instanceof Function}var y=function(T,b,f,u,L){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=T,this.videoCodec=b,this.initSegmentData=f,this.duration=u,this.defaultInitPts=L},R=function(T,b,f,u,L){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=T,this.contiguous=b,this.accurateTimeOffset=f,this.trackSwitch=u,this.timeOffset=L}},"./src/demux/tsdemuxer.ts":function(ne,$,O){"use strict";O.r($),O.d($,"discardEPB",function(){return C});var V=O("./src/demux/adts.ts"),_=O("./src/demux/mpegaudio.ts"),P=O("./src/demux/exp-golomb.ts"),F=O("./src/demux/id3.ts"),N=O("./src/demux/sample-aes.ts"),M=O("./src/events.ts"),k=O("./src/utils/mp4-tools.ts"),d=O("./src/utils/logger.ts"),h=O("./src/errors.ts"),S={video:1,audio:2,id3:3,text:4},m=function(){function g(R,w,T){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=R,this.config=w,this.typeSupported=T}g.probe=function(w){var T=g.syncOffset(w);return T<0?!1:(T&&d.logger.warn("MPEG2-TS detected but first sync word found @ offset "+T+", junk ahead ?"),!0)},g.syncOffset=function(w){for(var T=Math.min(1e3,w.length-3*188),b=0;b>4,ge=void 0;if(De>1){if(ge=Ae+5+w[Ae+4],ge===Ae+188)continue}else ge=Ae+4;switch(ke){case I:Re&&(W&&(u=i(W))&&this.parseAVCPES(u,!1),W={data:[],size:0}),W&&(W.data.push(w.subarray(ge,Ae+188)),W.size+=Ae+188-ge);break;case K:Re&&(z&&(u=i(z))&&(x.isAAC?this.parseAACPES(u):this.parseMPEGPES(u)),z={data:[],size:0}),z&&(z.data.push(w.subarray(ge,Ae+188)),z.size+=Ae+188-ge);break;case Z:Re&&(B&&(u=i(B))&&this.parseID3PES(u),B={data:[],size:0}),B&&(B.data.push(w.subarray(ge,Ae+188)),B.size+=Ae+188-ge);break;case 0:Re&&(ge+=w[ge]+1),de=this._pmtId=v(w,ge);break;case de:{Re&&(ge+=w[ge]+1);var ue=a(w,ge,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,b);I=ue.avc,I>0&&(L.pid=I),K=ue.audio,K>0&&(x.pid=K,x.isAAC=ue.isAAC),Z=ue.id3,Z>0&&(A.pid=Z),ee&&!ie&&(d.logger.log("reparse from beginning"),ee=!1,Ae=Ie-188),ie=this.pmtParsed=!0;break}case 17:case 8191:break;default:ee=!0;break}}else this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,details:h.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});L.pesData=W,x.pesData=z,A.pesData=B;var Me={audioTrack:x,avcTrack:L,id3Track:A,textTrack:this._txtTrack};return f&&this.extractRemainingSamples(Me),Me},y.flush=function(){var w=this.remainderData;this.remainderData=null;var T;return w?T=this.demux(w,-1,!1,!0):T={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(T),this.sampleAes?this.decrypt(T,this.sampleAes):T},y.extractRemainingSamples=function(w){var T=w.audioTrack,b=w.avcTrack,f=w.id3Track,u=b.pesData,L=T.pesData,x=f.pesData,A;u&&(A=i(u))?(this.parseAVCPES(A,!0),b.pesData=null):b.pesData=u,L&&(A=i(L))?(T.isAAC?this.parseAACPES(A):this.parseMPEGPES(A),T.pesData=null):(L!=null&&L.size&&d.logger.log("last AAC PES packet truncated,might overlap between fragments"),T.pesData=L),x&&(A=i(x))?(this.parseID3PES(A),f.pesData=null):f.pesData=x},y.demuxSampleAes=function(w,T,b){var f=this.demux(w,b,!0,!this.config.progressive),u=this.sampleAes=new N.default(this.observer,this.config,T);return this.decrypt(f,u)},y.decrypt=function(w,T){return new Promise(function(b){var f=w.audioTrack,u=w.avcTrack;f.samples&&f.isAAC?T.decryptAacSamples(f.samples,0,function(){u.samples?T.decryptAvcSamples(u.samples,0,0,function(){b(w)}):b(w)}):u.samples&&T.decryptAvcSamples(u.samples,0,0,function(){b(w)})})},y.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},y.parseAVCPES=function(w,T){var b=this,f=this._avcTrack,u=this.parseAVCNALu(w.data),L=!1,x=this.avcSample,A,I=!1;w.data=null,x&&u.length&&!f.audFound&&(s(x,f),x=this.avcSample=p(!1,w.pts,w.dts,"")),u.forEach(function(W){switch(W.type){case 1:{A=!0,x||(x=b.avcSample=p(!0,w.pts,w.dts,"")),L&&(x.debug+="NDR "),x.frame=!0;var K=W.data;if(I&&K.length>4){var Z=new P.default(K).readSliceType();(Z===2||Z===4||Z===7||Z===9)&&(x.key=!0)}break}case 5:A=!0,x||(x=b.avcSample=p(!0,w.pts,w.dts,"")),L&&(x.debug+="IDR "),x.key=!0,x.frame=!0;break;case 6:{A=!0,L&&x&&(x.debug+="SEI ");var z=new P.default(C(W.data));z.readUByte();for(var B=0,ee=0,ie=!1,de=0;!ie&&z.bytesAvailable>1;){B=0;do de=z.readUByte(),B+=de;while(de===255);ee=0;do de=z.readUByte(),ee+=de;while(de===255);if(B===4&&z.bytesAvailable!==0){ie=!0;var be=z.readUByte();if(be===181){var Ie=z.readUShort();if(Ie===49){var Ae=z.readUInt();if(Ae===1195456820){var Re=z.readUByte();if(Re===3){for(var ke=z.readUByte(),De=z.readUByte(),ge=31&ke,ue=[ke,De],Me=0;Me16){for(var $e=[],Ke=0;Ke<16;Ke++)$e.push(z.readUByte().toString(16)),(Ke===3||Ke===5||Ke===7||Ke===9)&&$e.push("-");for(var tt=ee-16,se=new Uint8Array(tt),ae=0;ae=0){var z={data:w.subarray(K,x-f-1),type:Z};L.push(z)}else{var B=this.getLastNalUnit();if(B&&(u&&x<=4-u&&(B.state&&(B.data=B.data.subarray(0,B.data.byteLength-u))),I=x-f-1,I>0)){var ee=new Uint8Array(B.data.byteLength+I);ee.set(B.data,0),ee.set(w.subarray(0,I),B.data.byteLength),B.data=ee,B.state=0}}x=0&&f>=0){var ie={data:w.subarray(K,T),type:Z,state:f};L.push(ie)}if(L.length===0){var de=this.getLastNalUnit();if(de){var be=new Uint8Array(de.data.byteLength+w.byteLength);be.set(de.data,0),be.set(w,de.data.byteLength),de.data=be}}return b.naluState=f,L},y.parseAACPES=function(w){var T=0,b=this._audioTrack,f=this.aacOverFlow,u=w.data;if(f){this.aacOverFlow=null;var L=f.sample.unit.byteLength,x=Math.min(f.missing,L),A=L-x;f.sample.unit.set(u.subarray(0,x),A),b.samples.push(f.sample),T=f.missing}var I,W;for(I=T,W=u.length;I1;){var L=new Uint8Array(u[0].length+u[1].length);L.set(u[0]),L.set(u[1],u[0].length),u[0]=L,u.splice(1,1)}R=u[0];var x=(R[0]<<16)+(R[1]<<8)+R[2];if(x===1){if(w=(R[4]<<8)+R[5],w&&w>g.size-6)return null;var A=R[7];A&192&&(b=(R[9]&14)*536870912+(R[10]&255)*4194304+(R[11]&254)*16384+(R[12]&255)*128+(R[13]&254)/2,A&64?(f=(R[14]&14)*536870912+(R[15]&255)*4194304+(R[16]&254)*16384+(R[17]&255)*128+(R[18]&254)/2,b-f>60*9e4&&(d.logger.warn(Math.round((b-f)/9e4)+"s delta between PTS and DTS, align them"),b=f)):f=b),T=R[8];var I=T+9;if(g.size<=I)return null;g.size-=I;for(var W=new Uint8Array(g.size),K=0,Z=u.length;Kz){I-=z;continue}else R=R.subarray(I),z-=I,I=0;W.set(R,y),y+=z}return w&&(w-=T+3),{data:W,pts:b,dts:f,len:w}}return null}function s(g,y){if(g.units.length&&g.frame){if(g.pts===void 0){var R=y.samples,w=R.length;if(w){var T=R[w-1];g.pts=T.pts,g.dts=T.dts}else{y.dropped++;return}}y.samples.push(g)}g.debug.length&&d.logger.log(g.pts+"/"+g.dts+":"+g.debug)}function l(g,y){var R=g.length;if(R>0){if(y.pts>=g[R-1].pts)g.push(y);else for(var w=R-1;w>=0;w--)if(y.ptsb)return u;return 0}},{key:"maxAutoLevel",get:function(){var T=this.levels,b=this.autoLevelCapping,f;return b===-1&&T&&T.length?f=T.length-1:f=b,f}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(T){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,T)}},{key:"audioTracks",get:function(){var T=this.audioTrackController;return T?T.audioTracks:[]}},{key:"audioTrack",get:function(){var T=this.audioTrackController;return T?T.audioTrack:-1},set:function(T){var b=this.audioTrackController;b&&(b.audioTrack=T)}},{key:"subtitleTracks",get:function(){var T=this.subtitleTrackController;return T?T.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var T=this.subtitleTrackController;return T?T.subtitleTrack:-1},set:function(T){var b=this.subtitleTrackController;b&&(b.subtitleTrack=T)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var T=this.subtitleTrackController;return T?T.subtitleDisplay:!1},set:function(T){var b=this.subtitleTrackController;b&&(b.subtitleDisplay=T)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(T){this.config.lowLatencyMode=T}},{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 i.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return y.defaultConfig?y.defaultConfig:p.hlsDefaultConfig},set:function(T){y.defaultConfig=T}}]),y}();g.defaultConfig=void 0},"./src/is-supported.ts":function(ne,$,O){"use strict";O.r($),O.d($,"isSupported",function(){return P}),O.d($,"changeTypeSupported",function(){return F});var V=O("./src/utils/mediasource-helper.ts");function _(){return self.SourceBuffer||self.WebKitSourceBuffer}function P(){var N=Object(V.getMediaSource)();if(!N)return!1;var M=_(),k=N&&typeof N.isTypeSupported=="function"&&N.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),d=!M||M.prototype&&typeof M.prototype.appendBuffer=="function"&&typeof M.prototype.remove=="function";return!!k&&!!d}function F(){var N,M=_();return typeof(M==null||((N=M.prototype)===null||N===void 0)?void 0:N.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ne,$,O){"use strict";O.r($),O.d($,"default",function(){return m}),O.d($,"LoadError",function(){return v});var V=O("./src/polyfills/number.ts"),_=O("./src/errors.ts");function P(a,i){a.prototype=Object.create(i.prototype),a.prototype.constructor=a,d(a,i)}function F(a){var i=typeof Map=="function"?new Map:void 0;return F=function(l){if(l===null||!k(l))return l;if(typeof l!="function")throw new TypeError("Super expression must either be null or a function");if(typeof i!="undefined"){if(i.has(l))return i.get(l);i.set(l,C)}function C(){return N(l,arguments,h(this).constructor)}return C.prototype=Object.create(l.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),d(C,l)},F(a)}function N(a,i,s){return M()?N=Reflect.construct:N=function(C,g,y){var R=[null];R.push.apply(R,g);var w=Function.bind.apply(C,R),T=new w;return y&&d(T,y.prototype),T},N.apply(null,arguments)}function M(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}function k(a){return Function.toString.call(a).indexOf("[native code]")!==-1}function d(a,i){return d=Object.setPrototypeOf||function(l,C){return l.__proto__=C,l},d(a,i)}function h(a){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},h(a)}var S=Math.pow(2,17),m=function(){function a(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var i=a.prototype;return i.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},i.abort=function(){this.loader&&this.loader.abort()},i.load=function(l,C){var g=this,y=l.url;if(!y)return Promise.reject(new v({type:_.ErrorTypes.NETWORK_ERROR,details:_.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,networkDetails:null},"Fragment does not have a "+(y?"part list":"url")));this.abort();var R=this.config,w=R.fLoader,T=R.loader;return new Promise(function(b,f){g.loader&&g.loader.destroy();var u=g.loader=l.loader=w?new w(R):new T(R),L=p(l),x={timeout:R.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:R.fragLoadingMaxRetryTimeout,highWaterMark:S};l.stats=u.stats,u.load(L,x,{onSuccess:function(I,W,K,Z){g.resetLoader(l,u),b({frag:l,part:null,payload:I.data,networkDetails:Z})},onError:function(I,W,K){g.resetLoader(l,u),f(new v({type:_.ErrorTypes.NETWORK_ERROR,details:_.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,response:I,networkDetails:K}))},onAbort:function(I,W,K){g.resetLoader(l,u),f(new v({type:_.ErrorTypes.NETWORK_ERROR,details:_.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,networkDetails:K}))},onTimeout:function(I,W,K){g.resetLoader(l,u),f(new v({type:_.ErrorTypes.NETWORK_ERROR,details:_.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,networkDetails:K}))},onProgress:function(I,W,K,Z){C&&C({frag:l,part:null,payload:K,networkDetails:Z})}})})},i.loadPart=function(l,C,g){var y=this;this.abort();var R=this.config,w=R.fLoader,T=R.loader;return new Promise(function(b,f){y.loader&&y.loader.destroy();var u=y.loader=l.loader=w?new w(R):new T(R),L=p(l,C),x={timeout:R.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:R.fragLoadingMaxRetryTimeout,highWaterMark:S};C.stats=u.stats,u.load(L,x,{onSuccess:function(I,W,K,Z){y.resetLoader(l,u),y.updateStatsFromPart(l,C);var z={frag:l,part:C,payload:I.data,networkDetails:Z};g(z),b(z)},onError:function(I,W,K){y.resetLoader(l,u),f(new v({type:_.ErrorTypes.NETWORK_ERROR,details:_.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,part:C,response:I,networkDetails:K}))},onAbort:function(I,W,K){l.stats.aborted=C.stats.aborted,y.resetLoader(l,u),f(new v({type:_.ErrorTypes.NETWORK_ERROR,details:_.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,part:C,networkDetails:K}))},onTimeout:function(I,W,K){y.resetLoader(l,u),f(new v({type:_.ErrorTypes.NETWORK_ERROR,details:_.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,part:C,networkDetails:K}))}})})},i.updateStatsFromPart=function(l,C){var g=l.stats,y=C.stats,R=y.total;if(g.loaded+=y.loaded,R){var w=Math.round(l.duration/C.duration),T=Math.min(Math.round(g.loaded/R),w),b=w-T,f=b*Math.round(g.loaded/T);g.total=g.loaded+f}else g.total=Math.max(g.loaded,g.total);var u=g.loading,L=y.loading;u.start?u.first+=L.first-L.start:(u.start=L.start,u.first=L.first),u.end=L.end},i.resetLoader=function(l,C){l.loader=null,this.loader===C&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),C.destroy()},a}();function p(a,i){i===void 0&&(i=null);var s=i||a,l={frag:a,part:i,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},C=s.byteRangeStartOffset,g=s.byteRangeEndOffset;return Object(V.isFiniteNumber)(C)&&Object(V.isFiniteNumber)(g)&&(l.rangeStart=C,l.rangeEnd=g),l}var v=function(a){P(i,a);function i(s){for(var l,C=arguments.length,g=new Array(C>1?C-1:0),y=1;y>8*(15-R)&255;return y},l.setDecryptDataFromLevelKey=function(g,y){var R=g;return(g==null?void 0:g.method)==="AES-128"&&g.uri&&!g.iv&&(R=N.LevelKey.fromURI(g.uri),R.method=g.method,R.iv=this.createInitializationVector(y),R.keyFormat="identity"),R},l.setElementaryStreamInfo=function(g,y,R,w,T,b){b===void 0&&(b=!1);var f=this.elementaryStreams,u=f[g];if(!u){f[g]={startPTS:y,endPTS:R,startDTS:w,endDTS:T,partial:b};return}u.startPTS=Math.min(u.startPTS,y),u.endPTS=Math.max(u.endPTS,R),u.startDTS=Math.min(u.startDTS,w),u.endDTS=Math.max(u.endDTS,T)},l.clearElementaryStreamInfo=function(){var g=this.elementaryStreams;g[m.AUDIO]=null,g[m.VIDEO]=null,g[m.AUDIOVIDEO]=null},S(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var g=this.sn;typeof g!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&F.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),g=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,g)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(V.isFiniteNumber)(this.programDateTime))return null;var g=Object(V.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+g*1e3}},{key:"encrypted",get:function(){var g;return!!((g=this.decryptdata)!==null&&g!==void 0&&g.keyFormat&&this.decryptdata.uri)}}]),s}(p),a=function(i){k(s,i);function s(l,C,g,y,R){var w;w=i.call(this,g)||this,w.fragOffset=0,w.duration=0,w.gap=!1,w.independent=!1,w.relurl=void 0,w.fragment=void 0,w.index=void 0,w.stats=new M.LoadStats,w.duration=l.decimalFloatingPoint("DURATION"),w.gap=l.bool("GAP"),w.independent=l.bool("INDEPENDENT"),w.relurl=l.enumeratedString("URI"),w.fragment=C,w.index=y;var T=l.enumeratedString("BYTERANGE");return T&&w.setByteRange(T,R),R&&(w.fragOffset=R.fragOffset+R.duration),w}return S(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 C=this.elementaryStreams;return!!(C.audio||C.video||C.audiovideo)}}]),s}(p)},"./src/loader/key-loader.ts":function(ne,$,O){"use strict";O.r($),O.d($,"default",function(){return F});var V=O("./src/events.ts"),_=O("./src/errors.ts"),P=O("./src/utils/logger.ts"),F=function(){function N(k){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=k,this._registerListeners()}var M=N.prototype;return M._registerListeners=function(){this.hls.on(V.Events.KEY_LOADING,this.onKeyLoading,this)},M._unregisterListeners=function(){this.hls.off(V.Events.KEY_LOADING,this.onKeyLoading)},M.destroy=function(){this._unregisterListeners();for(var d in this.loaders){var h=this.loaders[d];h&&h.destroy()}this.loaders={}},M.onKeyLoading=function(d,h){var S=h.frag,m=S.type,p=this.loaders[m];if(!S.decryptdata){P.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var v=S.decryptdata.uri;if(v!==this.decrypturl||this.decryptkey===null){var a=this.hls.config;if(p&&(P.logger.warn("abort previous key loader for type:"+m),p.abort()),!v){P.logger.warn("key uri is falsy");return}var i=a.loader,s=S.loader=this.loaders[m]=new i(a);this.decrypturl=v,this.decryptkey=null;var l={url:v,frag:S,responseType:"arraybuffer"},C={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:a.fragLoadingRetryDelay,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(l,C,g)}else this.decryptkey&&(S.decryptdata.key=this.decryptkey,this.hls.trigger(V.Events.KEY_LOADED,{frag:S}))},M.loadsuccess=function(d,h,S){var m=S.frag;if(!m.decryptdata){P.logger.error("after key load, decryptdata unset");return}this.decryptkey=m.decryptdata.key=new Uint8Array(d.data),m.loader=null,delete this.loaders[m.type],this.hls.trigger(V.Events.KEY_LOADED,{frag:m})},M.loaderror=function(d,h){var S=h.frag,m=S.loader;m&&m.abort(),delete this.loaders[S.type],this.hls.trigger(V.Events.ERROR,{type:_.ErrorTypes.NETWORK_ERROR,details:_.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:S,response:d})},M.loadtimeout=function(d,h){var S=h.frag,m=S.loader;m&&m.abort(),delete this.loaders[S.type],this.hls.trigger(V.Events.ERROR,{type:_.ErrorTypes.NETWORK_ERROR,details:_.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:S})},N}()},"./src/loader/level-details.ts":function(ne,$,O){"use strict";O.r($),O.d($,"LevelDetails",function(){return N});var V=O("./src/polyfills/number.ts");function _(M,k){for(var d=0;dh.endSN||S>0||S===0&&m>0,this.updated||this.advanced?this.misses=Math.floor(h.misses*.6):this.misses=h.misses+1,this.availabilityDelay=h.availabilityDelay},P(M,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(V.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||F}},{key:"drift",get:function(){var h=this.driftEndTime-this.driftStartTime;if(h>0){var S=this.driftEnd-this.driftStart;return S*1e3/h}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var h;return(h=this.partList)!==null&&h!==void 0&&h.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var h;return(h=this.fragments)!==null&&h!==void 0&&h.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 h;return(h=this.partList)!==null&&h!==void 0&&h.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var h;return(h=this.partList)!==null&&h!==void 0&&h.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),M}()},"./src/loader/level-key.ts":function(ne,$,O){"use strict";O.r($),O.d($,"LevelKey",function(){return N});var V=O("./node_modules/url-toolkit/src/url-toolkit.js"),_=O.n(V);function P(M,k){for(var d=0;d2){var f=b.shift()+".";return f+=parseInt(b.shift()).toString(16),f+=("000"+parseInt(b.shift()).toString(16)).substr(-4),f}return T},R.resolve=function(T,b){return _.buildAbsoluteURL(b,T,{alwaysNormalize:!0})},R.parseMasterPlaylist=function(T,b){var f=[],u={},L=!1;S.lastIndex=0;for(var x;(x=S.exec(T))!=null;)if(x[1]){var A=new k.AttrList(x[1]),I={attrs:A,bitrate:A.decimalInteger("AVERAGE-BANDWIDTH")||A.decimalInteger("BANDWIDTH"),name:A.NAME,url:R.resolve(x[2],b)},W=A.decimalResolution("RESOLUTION");W&&(I.width=W.width,I.height=W.height),l((A.CODECS||"").split(/[ ,]+/).filter(function(Z){return Z}),I),I.videoCodec&&I.videoCodec.indexOf("avc1")!==-1&&(I.videoCodec=R.convertAVC1ToAVCOTI(I.videoCodec)),f.push(I)}else if(x[3]){var K=new k.AttrList(x[3]);K["DATA-ID"]&&(L=!0,u[K["DATA-ID"]]=K)}return{levels:f,sessionData:L?u:null}},R.parseMasterPlaylistMedia=function(T,b,f,u){u===void 0&&(u=[]);var L,x=[],A=0;for(m.lastIndex=0;(L=m.exec(T))!==null;){var I=new k.AttrList(L[1]);if(I.TYPE===f){var W={attrs:I,bitrate:0,id:A++,groupId:I["GROUP-ID"],instreamId:I["INSTREAM-ID"],name:I.NAME||I.LANGUAGE||"",type:f,default:I.bool("DEFAULT"),autoselect:I.bool("AUTOSELECT"),forced:I.bool("FORCED"),lang:I.LANGUAGE,url:I.URI?R.resolve(I.URI,b):""};if(u.length){var K=R.findGroup(u,W.groupId)||u[0];C(W,K,"audioCodec"),C(W,K,"textCodec")}x.push(W)}}return x},R.parseLevelPlaylist=function(T,b,f,u,L){var x=new N.LevelDetails(b),A=x.fragments,I=null,W=0,K=0,Z=0,z=0,B=null,ee=new F.Fragment(u,b),ie,de,be,Ie=-1,Ae=!1;for(p.lastIndex=0,x.m3u8=T;(ie=p.exec(T))!==null;){Ae&&(Ae=!1,ee=new F.Fragment(u,b),ee.start=Z,ee.sn=W,ee.cc=z,ee.level=f,I&&(ee.initSegment=I,ee.rawProgramDateTime=I.rawProgramDateTime));var Re=ie[1];if(Re){ee.duration=parseFloat(Re);var ke=(" "+ie[2]).slice(1);ee.title=ke||null,ee.tagList.push(ke?["INF",Re,ke]:["INF",Re])}else if(ie[3])Object(V.isFiniteNumber)(ee.duration)&&(ee.start=Z,be&&(ee.levelkey=be),ee.sn=W,ee.level=f,ee.cc=z,ee.urlId=L,A.push(ee),ee.relurl=(" "+ie[3]).slice(1),y(ee,B),B=ee,Z+=ee.duration,W++,K=0,Ae=!0);else if(ie[4]){var De=(" "+ie[4]).slice(1);B?ee.setByteRange(De,B):ee.setByteRange(De)}else if(ie[5])ee.rawProgramDateTime=(" "+ie[5]).slice(1),ee.tagList.push(["PROGRAM-DATE-TIME",ee.rawProgramDateTime]),Ie===-1&&(Ie=A.length);else{if(ie=ie[0].match(v),!ie){d.logger.warn("No matches on slow regex match for level playlist!");continue}for(de=1;de-1){d.logger.warn("Keyformat "+at+" is not supported from the manifest");continue}else if(at!=="identity")continue;we&&(be=M.LevelKey.fromURL(b,Pe),Pe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(we)>=0&&(be.method=we,be.keyFormat=at,je&&(be.keyID=je),Ue&&(be.keyFormatVersions=Ue),be.iv=_e));break}case"START":{var Qe=new k.AttrList(ue),Ve=Qe.decimalFloatingPoint("TIME-OFFSET");Object(V.isFiniteNumber)(Ve)&&(x.startTimeOffset=Ve);break}case"MAP":{var ht=new k.AttrList(ue);ee.relurl=ht.URI,ht.BYTERANGE&&ee.setByteRange(ht.BYTERANGE),ee.level=f,ee.sn="initSegment",be&&(ee.levelkey=be),ee.initSegment=null,I=ee,Ae=!0;break}case"SERVER-CONTROL":{var it=new k.AttrList(ue);x.canBlockReload=it.bool("CAN-BLOCK-RELOAD"),x.canSkipUntil=it.optionalFloat("CAN-SKIP-UNTIL",0),x.canSkipDateRanges=x.canSkipUntil>0&&it.bool("CAN-SKIP-DATERANGES"),x.partHoldBack=it.optionalFloat("PART-HOLD-BACK",0),x.holdBack=it.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var rt=new k.AttrList(ue);x.partTarget=rt.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Le=x.partList;Le||(Le=x.partList=[]);var Xe=K>0?Le[Le.length-1]:void 0,lt=K++,Oe=new F.Part(new k.AttrList(ue),ee,b,lt,Xe);Le.push(Oe),ee.duration+=Oe.duration;break}case"PRELOAD-HINT":{var He=new k.AttrList(ue);x.preloadHint=He;break}case"RENDITION-REPORT":{var ye=new k.AttrList(ue);x.renditionReports=x.renditionReports||[],x.renditionReports.push(ye);break}default:d.logger.warn("line parsed but not handled: "+ie);break}}}B&&!B.relurl?(A.pop(),Z-=B.duration,x.partList&&(x.fragmentHint=B)):x.partList&&(y(ee,B),ee.cc=z,x.fragmentHint=ee);var ce=A.length,me=A[0],te=A[ce-1];if(Z+=x.skippedSegments*x.targetduration,Z>0&&ce&&te){x.averagetargetduration=Z/ce;var re=te.sn;x.endSN=re!=="initSegment"?re:0,me&&(x.startCC=me.cc,me.initSegment||x.fragments.every(function(oe){return oe.relurl&&i(oe.relurl)})&&(d.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),ee=new F.Fragment(u,b),ee.relurl=te.relurl,ee.level=f,ee.sn="initSegment",me.initSegment=ee,x.needSidxRanges=!0))}else x.endSN=0,x.startCC=0;return x.fragmentHint&&(Z+=x.fragmentHint.duration),x.totalduration=Z,x.endCC=z,Ie>0&&g(A,Ie),x},R}();function l(R,w){["video","audio","text"].forEach(function(T){var b=R.filter(function(u){return Object(h.isCodecType)(u,T)});if(b.length){var f=b.filter(function(u){return u.lastIndexOf("avc1",0)===0||u.lastIndexOf("mp4a",0)===0});w[T+"Codec"]=f.length>0?f[0]:b[0],R=R.filter(function(u){return b.indexOf(u)===-1})}}),w.unknownCodecs=R}function C(R,w,T){var b=w[T];b&&(R[T]=b)}function g(R,w){for(var T=R[w],b=w;b--;){var f=R[b];if(!f)return;f.programDateTime=T.programDateTime-f.duration*1e3,T=f}}function y(R,w){R.rawProgramDateTime?R.programDateTime=Date.parse(R.rawProgramDateTime):w!=null&&w.programDateTime&&(R.programDateTime=w.endProgramDateTime),Object(V.isFiniteNumber)(R.programDateTime)||(R.programDateTime=null,R.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ne,$,O){"use strict";O.r($);var V=O("./src/polyfills/number.ts"),_=O("./src/events.ts"),P=O("./src/errors.ts"),F=O("./src/utils/logger.ts"),N=O("./src/utils/mp4-tools.ts"),M=O("./src/loader/m3u8-parser.ts"),k=O("./src/types/loader.ts"),d=O("./src/utils/attr-list.ts");function h(p){var v=p.type;switch(v){case k.PlaylistContextType.AUDIO_TRACK:return k.PlaylistLevelType.AUDIO;case k.PlaylistContextType.SUBTITLE_TRACK:return k.PlaylistLevelType.SUBTITLE;default:return k.PlaylistLevelType.MAIN}}function S(p,v){var a=p.url;return(a===void 0||a.indexOf("data:")===0)&&(a=v.url),a}var m=function(){function p(a){this.hls=void 0,this.loaders=Object.create(null),this.hls=a,this.registerListeners()}var v=p.prototype;return v.registerListeners=function(){var i=this.hls;i.on(_.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(_.Events.LEVEL_LOADING,this.onLevelLoading,this),i.on(_.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),i.on(_.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},v.unregisterListeners=function(){var i=this.hls;i.off(_.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(_.Events.LEVEL_LOADING,this.onLevelLoading,this),i.off(_.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),i.off(_.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},v.createInternalLoader=function(i){var s=this.hls.config,l=s.pLoader,C=s.loader,g=l||C,y=new g(s);return i.loader=y,this.loaders[i.type]=y,y},v.getInternalLoader=function(i){return this.loaders[i.type]},v.resetInternalLoader=function(i){this.loaders[i]&&delete this.loaders[i]},v.destroyInternalLoaders=function(){for(var i in this.loaders){var s=this.loaders[i];s&&s.destroy(),this.resetInternalLoader(i)}},v.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},v.onManifestLoading=function(i,s){var l=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:k.PlaylistContextType.MANIFEST,url:l,deliveryDirectives:null})},v.onLevelLoading=function(i,s){var l=s.id,C=s.level,g=s.url,y=s.deliveryDirectives;this.load({id:l,groupId:null,level:C,responseType:"text",type:k.PlaylistContextType.LEVEL,url:g,deliveryDirectives:y})},v.onAudioTrackLoading=function(i,s){var l=s.id,C=s.groupId,g=s.url,y=s.deliveryDirectives;this.load({id:l,groupId:C,level:null,responseType:"text",type:k.PlaylistContextType.AUDIO_TRACK,url:g,deliveryDirectives:y})},v.onSubtitleTrackLoading=function(i,s){var l=s.id,C=s.groupId,g=s.url,y=s.deliveryDirectives;this.load({id:l,groupId:C,level:null,responseType:"text",type:k.PlaylistContextType.SUBTITLE_TRACK,url:g,deliveryDirectives:y})},v.load=function(i){var s,l=this.hls.config,C=this.getInternalLoader(i);if(C){var g=C.context;if(g&&g.url===i.url){F.logger.trace("[playlist-loader]: playlist request ongoing");return}F.logger.log("[playlist-loader]: aborting previous loader for type: "+i.type),C.abort()}var y,R,w,T;switch(i.type){case k.PlaylistContextType.MANIFEST:y=l.manifestLoadingMaxRetry,R=l.manifestLoadingTimeOut,w=l.manifestLoadingRetryDelay,T=l.manifestLoadingMaxRetryTimeout;break;case k.PlaylistContextType.LEVEL:case k.PlaylistContextType.AUDIO_TRACK:case k.PlaylistContextType.SUBTITLE_TRACK:y=0,R=l.levelLoadingTimeOut;break;default:y=l.levelLoadingMaxRetry,R=l.levelLoadingTimeOut,w=l.levelLoadingRetryDelay,T=l.levelLoadingMaxRetryTimeout;break}if(C=this.createInternalLoader(i),(s=i.deliveryDirectives)!==null&&s!==void 0&&s.part){var b;if(i.type===k.PlaylistContextType.LEVEL&&i.level!==null?b=this.hls.levels[i.level].details:i.type===k.PlaylistContextType.AUDIO_TRACK&&i.id!==null?b=this.hls.audioTracks[i.id].details:i.type===k.PlaylistContextType.SUBTITLE_TRACK&&i.id!==null&&(b=this.hls.subtitleTracks[i.id].details),b){var f=b.partTarget,u=b.targetduration;f&&u&&(R=Math.min(Math.max(f*3,u*.8)*1e3,R))}}var L={timeout:R,maxRetry:y,retryDelay:w,maxRetryDelay:T,highWaterMark:0},x={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};C.load(i,L,x)},v.loadsuccess=function(i,s,l,C){if(C===void 0&&(C=null),l.isSidxRequest){this.handleSidxRequest(i,l),this.handlePlaylistLoaded(i,s,l,C);return}this.resetInternalLoader(l.type);var g=i.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(i,l,"no EXTM3U delimiter",C);return}s.parsing.start=performance.now(),g.indexOf("#EXTINF:")>0||g.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(i,s,l,C):this.handleMasterPlaylist(i,s,l,C)},v.loaderror=function(i,s,l){l===void 0&&(l=null),this.handleNetworkError(s,l,!1,i)},v.loadtimeout=function(i,s,l){l===void 0&&(l=null),this.handleNetworkError(s,l,!0)},v.handleMasterPlaylist=function(i,s,l,C){var g=this.hls,y=i.data,R=S(i,l),w=M.default.parseMasterPlaylist(y,R),T=w.levels,b=w.sessionData;if(!T.length){this.handleManifestParsingError(i,l,"no level found in manifest",C);return}var f=T.map(function(W){return{id:W.attrs.AUDIO,audioCodec:W.audioCodec}}),u=T.map(function(W){return{id:W.attrs.SUBTITLES,textCodec:W.textCodec}}),L=M.default.parseMasterPlaylistMedia(y,R,"AUDIO",f),x=M.default.parseMasterPlaylistMedia(y,R,"SUBTITLES",u),A=M.default.parseMasterPlaylistMedia(y,R,"CLOSED-CAPTIONS");if(L.length){var I=L.some(function(W){return!W.url});!I&&T[0].audioCodec&&!T[0].attrs.AUDIO&&(F.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),L.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new d.AttrList({}),bitrate:0,url:""}))}g.trigger(_.Events.MANIFEST_LOADED,{levels:T,audioTracks:L,subtitles:x,captions:A,url:R,stats:s,networkDetails:C,sessionData:b})},v.handleTrackOrLevelPlaylist=function(i,s,l,C){var g=this.hls,y=l.id,R=l.level,w=l.type,T=S(i,l),b=Object(V.isFiniteNumber)(y)?y:0,f=Object(V.isFiniteNumber)(R)?R:b,u=h(l),L=M.default.parseLevelPlaylist(i.data,T,f,u,b);if(!L.fragments.length){g.trigger(_.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:T,reason:"no fragments found in level",level:typeof l.level=="number"?l.level:void 0});return}if(w===k.PlaylistContextType.MANIFEST){var x={attrs:new d.AttrList({}),bitrate:0,details:L,name:"",url:T};g.trigger(_.Events.MANIFEST_LOADED,{levels:[x],audioTracks:[],url:T,stats:s,networkDetails:C,sessionData:null})}if(s.parsing.end=performance.now(),L.needSidxRanges){var A,I=(A=L.fragments[0].initSegment)===null||A===void 0?void 0:A.url;this.load({url:I,isSidxRequest:!0,type:w,level:R,levelDetails:L,id:y,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}l.levelDetails=L,this.handlePlaylistLoaded(i,s,l,C)},v.handleSidxRequest=function(i,s){var l=Object(N.parseSegmentIndex)(new Uint8Array(i.data));if(!l)return;var C=l.references,g=s.levelDetails;C.forEach(function(y,R){var w=y.info,T=g.fragments[R];T.byteRange.length===0&&T.setByteRange(String(1+w.end-w.start)+"@"+String(w.start)),T.initSegment&&T.initSegment.setByteRange(String(l.moovEndOffset)+"@0")})},v.handleManifestParsingError=function(i,s,l,C){this.hls.trigger(_.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===k.PlaylistContextType.MANIFEST,url:i.url,reason:l,response:i,context:s,networkDetails:C})},v.handleNetworkError=function(i,s,l,C){l===void 0&&(l=!1),F.logger.warn("[playlist-loader]: A network "+(l?"timeout":"error")+" occurred while loading "+i.type+" level: "+i.level+" id: "+i.id+' group-id: "'+i.groupId+'"');var g=P.ErrorDetails.UNKNOWN,y=!1,R=this.getInternalLoader(i);switch(i.type){case k.PlaylistContextType.MANIFEST:g=l?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,y=!0;break;case k.PlaylistContextType.LEVEL:g=l?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,y=!1;break;case k.PlaylistContextType.AUDIO_TRACK:g=l?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,y=!1;break;case k.PlaylistContextType.SUBTITLE_TRACK:g=l?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,y=!1;break}R&&this.resetInternalLoader(i.type);var w={type:P.ErrorTypes.NETWORK_ERROR,details:g,fatal:y,url:i.url,loader:R,context:i,networkDetails:s};C&&(w.response=C),this.hls.trigger(_.Events.ERROR,w)},v.handlePlaylistLoaded=function(i,s,l,C){var g=l.type,y=l.level,R=l.id,w=l.groupId,T=l.loader,b=l.levelDetails,f=l.deliveryDirectives;if(!(b!=null&&b.targetduration)){this.handleManifestParsingError(i,l,"invalid target duration",C);return}if(!T)return;b.live&&(T.getCacheAge&&(b.ageHeader=T.getCacheAge()||0),(!T.getCacheAge||isNaN(b.ageHeader))&&(b.ageHeader=0));switch(g){case k.PlaylistContextType.MANIFEST:case k.PlaylistContextType.LEVEL:this.hls.trigger(_.Events.LEVEL_LOADED,{details:b,level:y||0,id:R||0,stats:s,networkDetails:C,deliveryDirectives:f});break;case k.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(_.Events.AUDIO_TRACK_LOADED,{details:b,id:R||0,groupId:w||"",stats:s,networkDetails:C,deliveryDirectives:f});break;case k.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(_.Events.SUBTITLE_TRACK_LOADED,{details:b,id:R||0,groupId:w||"",stats:s,networkDetails:C,deliveryDirectives:f});break}},p}();$.default=m},"./src/polyfills/number.ts":function(ne,$,O){"use strict";O.r($),O.d($,"isFiniteNumber",function(){return V}),O.d($,"MAX_SAFE_INTEGER",function(){return _});var V=Number.isFinite||function(P){return typeof P=="number"&&isFinite(P)},_=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ne,$,O){"use strict";O.r($);var V=function(){function _(){}return _.getSilentFrame=function(F,N){switch(F){case"mp4a.40.2":if(N===1)return new Uint8Array([0,200,0,128,35,128]);if(N===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(N===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(N===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(N===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(N===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(N===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(N===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(N===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},_}();$.default=V},"./src/remux/mp4-generator.ts":function(ne,$,O){"use strict";O.r($);var V=Math.pow(2,32)-1,_=function(){function P(){}return P.init=function(){P.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var N;for(N in P.types)P.types.hasOwnProperty(N)&&(P.types[N]=[N.charCodeAt(0),N.charCodeAt(1),N.charCodeAt(2),N.charCodeAt(3)]);var M=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),k=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);P.HDLR_TYPES={video:M,audio:k};var d=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),h=new Uint8Array([0,0,0,0,0,0,0,0]);P.STTS=P.STSC=P.STCO=h,P.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),P.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),P.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),P.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var S=new Uint8Array([105,115,111,109]),m=new Uint8Array([97,118,99,49]),p=new Uint8Array([0,0,0,1]);P.FTYP=P.box(P.types.ftyp,S,p,S,m),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,d))},P.box=function(N){for(var M=8,k=arguments.length,d=new Array(k>1?k-1:0),h=1;h>24&255,p[1]=M>>16&255,p[2]=M>>8&255,p[3]=M&255,p.set(N,4),S=0,M=8;S>24&255,N>>16&255,N>>8&255,N&255,k>>24,k>>16&255,k>>8&255,k&255,d>>24,d>>16&255,d>>8&255,d&255,85,196,0,0]))},P.mdia=function(N){return P.box(P.types.mdia,P.mdhd(N.timescale,N.duration),P.hdlr(N.type),P.minf(N))},P.mfhd=function(N){return P.box(P.types.mfhd,new Uint8Array([0,0,0,0,N>>24,N>>16&255,N>>8&255,N&255]))},P.minf=function(N){return N.type==="audio"?P.box(P.types.minf,P.box(P.types.smhd,P.SMHD),P.DINF,P.stbl(N)):P.box(P.types.minf,P.box(P.types.vmhd,P.VMHD),P.DINF,P.stbl(N))},P.moof=function(N,M,k){return P.box(P.types.moof,P.mfhd(N),P.traf(k,M))},P.moov=function(N){for(var M=N.length,k=[];M--;)k[M]=P.trak(N[M]);return P.box.apply(null,[P.types.moov,P.mvhd(N[0].timescale,N[0].duration)].concat(k).concat(P.mvex(N)))},P.mvex=function(N){for(var M=N.length,k=[];M--;)k[M]=P.trex(N[M]);return P.box.apply(null,[P.types.mvex].concat(k))},P.mvhd=function(N,M){M*=N;var k=Math.floor(M/(V+1)),d=Math.floor(M%(V+1)),h=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,N>>24&255,N>>16&255,N>>8&255,N&255,k>>24,k>>16&255,k>>8&255,k&255,d>>24,d>>16&255,d>>8&255,d&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return P.box(P.types.mvhd,h)},P.sdtp=function(N){var M=N.samples||[],k=new Uint8Array(4+M.length),d,h;for(d=0;d>>8&255),M.push(S&255),M=M.concat(Array.prototype.slice.call(h));for(d=0;d>>8&255),k.push(S&255),k=k.concat(Array.prototype.slice.call(h));var m=P.box(P.types.avcC,new Uint8Array([1,M[3],M[4],M[5],252|3,224|N.sps.length].concat(M).concat([N.pps.length]).concat(k))),p=N.width,v=N.height,a=N.pixelRatio[0],i=N.pixelRatio[1];return P.box(P.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,p>>8&255,p&255,v>>8&255,v&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]),m,P.box(P.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),P.box(P.types.pasp,new Uint8Array([a>>24,a>>16&255,a>>8&255,a&255,i>>24,i>>16&255,i>>8&255,i&255])))},P.esds=function(N){var M=N.config.length;return new Uint8Array([0,0,0,0,3,23+M,0,1,0,4,15+M,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([M]).concat(N.config).concat([6,1,2]))},P.mp4a=function(N){var M=N.samplerate;return P.box(P.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,N.channelCount,0,16,0,0,0,0,M>>8&255,M&255,0,0]),P.box(P.types.esds,P.esds(N)))},P.mp3=function(N){var M=N.samplerate;return P.box(P.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,N.channelCount,0,16,0,0,0,0,M>>8&255,M&255,0,0]))},P.stsd=function(N){return N.type==="audio"?!N.isAAC&&N.codec==="mp3"?P.box(P.types.stsd,P.STSD,P.mp3(N)):P.box(P.types.stsd,P.STSD,P.mp4a(N)):P.box(P.types.stsd,P.STSD,P.avc1(N))},P.tkhd=function(N){var M=N.id,k=N.duration*N.timescale,d=N.width,h=N.height,S=Math.floor(k/(V+1)),m=Math.floor(k%(V+1));return P.box(P.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,M&255,0,0,0,0,S>>24,S>>16&255,S>>8&255,S&255,m>>24,m>>16&255,m>>8&255,m&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,d>>8&255,d&255,0,0,h>>8&255,h&255,0,0]))},P.traf=function(N,M){var k=P.sdtp(N),d=N.id,h=Math.floor(M/(V+1)),S=Math.floor(M%(V+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,d>>24,d>>16&255,d>>8&255,d&255])),P.box(P.types.tfdt,new Uint8Array([1,0,0,0,h>>24,h>>16&255,h>>8&255,h&255,S>>24,S>>16&255,S>>8&255,S&255])),P.trun(N,k.length+16+20+8+16+8+8),k)},P.trak=function(N){return N.duration=N.duration||4294967295,P.box(P.types.trak,P.tkhd(N),P.mdia(N))},P.trex=function(N){var M=N.id;return P.box(P.types.trex,new Uint8Array([0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},P.trun=function(N,M){var k=N.samples||[],d=k.length,h=12+16*d,S=new Uint8Array(h),m,p,v,a,i,s;for(M+=8+h,S.set([0,0,15,1,d>>>24&255,d>>>16&255,d>>>8&255,d&255,M>>>24&255,M>>>16&255,M>>>8&255,M&255],0),m=0;m>>24&255,v>>>16&255,v>>>8&255,v&255,a>>>24&255,a>>>16&255,a>>>8&255,a&255,i.isLeading<<2|i.dependsOn,i.isDependedOn<<6|i.hasRedundancy<<4|i.paddingValue<<1|i.isNonSync,i.degradPrio&240<<8,i.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*m);return P.box(P.types.trun,S)},P.initSegment=function(N){P.types||P.init();var M=P.moov(N),k=new Uint8Array(P.FTYP.byteLength+M.byteLength);return k.set(P.FTYP),k.set(M,P.FTYP.byteLength),k},P}();_.types=void 0,_.HDLR_TYPES=void 0,_.STTS=void 0,_.STSC=void 0,_.STCO=void 0,_.STSZ=void 0,_.VMHD=void 0,_.SMHD=void 0,_.STSD=void 0,_.FTYP=void 0,_.DINF=void 0,$.default=_},"./src/remux/mp4-remuxer.ts":function(ne,$,O){"use strict";O.r($),O.d($,"default",function(){return s}),O.d($,"normalizePts",function(){return l});var V=O("./src/polyfills/number.ts"),_=O("./src/remux/aac-helper.ts"),P=O("./src/remux/mp4-generator.ts"),F=O("./src/events.ts"),N=O("./src/errors.ts"),M=O("./src/utils/logger.ts"),k=O("./src/types/loader.ts"),d=O("./src/utils/timescale-conversion.ts");function h(){return h=Object.assign||function(R){for(var w=1;w0?L:x.pts},b[0].pts);return f&&M.logger.debug("PTS rollover detected"),u},w.remux=function(b,f,u,L,x,A,I,W){var K,Z,z,B,ee,ie,de=x,be=x,Ie=b.pid>-1,Ae=f.pid>-1,Re=f.samples.length,ke=b.samples.length>0,De=Re>1,ge=(!Ie||ke)&&(!Ae||De)||this.ISGenerated||I;if(ge){this.ISGenerated||(z=this.generateIS(b,f,x));var ue=this.isVideoContiguous,Me=-1;if(De&&(Me=C(f.samples),!ue&&this.config.forceKeyFrameOnDiscontinuity))if(ie=!0,Me>0){M.logger.warn("[mp4-remuxer]: Dropped "+Me+" out of "+Re+" video samples due to a missing keyframe");var $e=this.getVideoStartPts(f.samples);f.samples=f.samples.slice(Me),f.dropped+=Me,be+=(f.samples[0].pts-$e)/(f.timescale||9e4)}else Me===-1&&(M.logger.warn("[mp4-remuxer]: No keyframe found out of "+Re+" video samples"),ie=!1);if(this.ISGenerated){if(ke&&De){var Ke=this.getVideoStartPts(f.samples),tt=l(b.samples[0].pts,Ke)-Ke,se=tt/f.inputTimeScale;de+=Math.max(0,se),be+=Math.max(0,-se)}if(ke){if(b.samplerate||(M.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),z=this.generateIS(b,f,x)),Z=this.remuxAudio(b,de,this.isAudioContiguous,A,Ae||De||W===k.PlaylistLevelType.AUDIO?be:void 0),De){var ae=Z?Z.endPTS-Z.startPTS:0;f.inputTimeScale||(M.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),z=this.generateIS(b,f,x)),K=this.remuxVideo(f,be,ue,ae)}}else De&&(K=this.remuxVideo(f,be,ue,0));K&&(K.firstKeyFrame=Me,K.independent=Me!==-1)}}return this.ISGenerated&&(u.samples.length&&(ee=this.remuxID3(u,x)),L.samples.length&&(B=this.remuxText(L,x))),{audio:Z,video:K,initSegment:z,independent:ie,text:B,id3:ee}},w.generateIS=function(b,f,u){var L=b.samples,x=f.samples,A=this.typeSupported,I={},W=!Object(V.isFiniteNumber)(this._initPTS),K="audio/mp4",Z,z,B;if(W&&(Z=z=Infinity),b.config&&L.length&&(b.timescale=b.samplerate,b.isAAC||(A.mpeg?(K="audio/mpeg",b.codec=""):A.mp3&&(b.codec="mp3")),I.audio={id:"audio",container:K,codec:b.codec,initSegment:!b.isAAC&&A.mpeg?new Uint8Array(0):P.default.initSegment([b]),metadata:{channelCount:b.channelCount}},W&&(B=b.inputTimeScale,Z=z=L[0].pts-Math.round(B*u))),f.sps&&f.pps&&x.length&&(f.timescale=f.inputTimeScale,I.video={id:"main",container:"video/mp4",codec:f.codec,initSegment:P.default.initSegment([f]),metadata:{width:f.width,height:f.height}},W)){B=f.inputTimeScale;var ee=this.getVideoStartPts(x),ie=Math.round(B*u);z=Math.min(z,l(x[0].dts,ee)-ie),Z=Math.min(Z,ee-ie)}if(Object.keys(I).length)return this.ISGenerated=!0,W&&(this._initPTS=Z,this._initDTS=z),{tracks:I,initPTS:Z,timescale:B}},w.remuxVideo=function(b,f,u,L){var x=b.inputTimeScale,A=b.samples,I=[],W=A.length,K=this._initPTS,Z=this.nextAvcDts,z=8,B,ee,ie,de=Number.POSITIVE_INFINITY,be=Number.NEGATIVE_INFINITY,Ie=0,Ae=!1;if(!u||Z===null){var Re=f*x,ke=A[0].pts-l(A[0].dts,A[0].pts);Z=Re-ke}for(var De=0;Dege.pts){var ue=9e4*.2;Ie=Math.max(Math.min(Ie,ge.pts-ge.dts),-1*ue)}ge.dts0?De-1:De].dts&&(Ae=!0)}Ae&&A.sort(function(yt,xt){var et=yt.dts-xt.dts,Wt=yt.pts-xt.pts;return et||Wt}),ee=A[0].dts,ie=A[A.length-1].dts;var Me=Math.round((ie-ee)/(W-1));if(Ie<0){if(IeMe,ve=se<-1;if(ae||ve){ae?M.logger.warn("AVC: "+Object(d.toMsFromMpegTsClock)(se,!0)+" ms ("+se+"dts) hole between fragments detected, filling it"):M.logger.warn("AVC: "+Object(d.toMsFromMpegTsClock)(-se,!0)+" ms ("+se+"dts) overlapping between fragments detected"),ee=Z;var we=A[0].pts-se;A[0].dts=ee,A[0].pts=we,M.logger.log("Video: First PTS/DTS adjusted: "+Object(d.toMsFromMpegTsClock)(we,!0)+"/"+Object(d.toMsFromMpegTsClock)(ee,!0)+", delta: "+Object(d.toMsFromMpegTsClock)(se,!0)+" ms")}}i&&(ee=Math.max(0,ee));for(var Pe=0,_e=0,Ue=0;Ue0?Le-1:Le].dts;if(re.stretchShortVideoTrack&&this.nextAudioPts!==null){var he=Math.floor(re.maxBufferHole*x),Te=(L?de+L*x:this.nextAudioPts)-Xe.pts;Te>he?(B=Te-oe,B<0&&(B=oe),M.logger.log("[mp4-remuxer]: It is approximately "+Te/90+" ms to the next segment; using duration "+B/90+" ms for the last video frame.")):B=oe}else B=oe}var xe=Math.round(Xe.pts-Xe.dts);I.push(new g(Xe.key,B,Oe,xe))}if(I.length&&v&&v<70){var Be=I[0].flags;Be.dependsOn=2,Be.isNonSync=0}console.assert(B!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=Z=ie+B,this.isVideoContiguous=!0;var Ye=P.default.moof(b.sequenceNumber++,ee,h({},b,{samples:I})),ut="video",qe={data1:Ye,data2:it,startPTS:de/x,endPTS:(be+B)/x,startDTS:ee/x,endDTS:Z/x,type:ut,hasAudio:!1,hasVideo:!0,nb:I.length,dropped:b.dropped};return b.samples=[],b.dropped=0,console.assert(it.length,"MDAT length must not be zero"),qe},w.remuxAudio=function(b,f,u,L,x){var A=b.inputTimeScale,I=b.samplerate?b.samplerate:A,W=A/I,K=b.isAAC?m:p,Z=K*W,z=this._initPTS,B=!b.isAAC&&this.typeSupported.mpeg,ee=[],ie=b.samples,de=B?0:8,be=this.nextAudioPts||-1,Ie=f*A;if(this.isAudioContiguous=u=u||ie.length&&be>0&&(L&&Math.abs(Ie-be)<9e3||Math.abs(l(ie[0].pts-z,Ie)-be)<20*Z),ie.forEach(function(me){me.pts=l(me.pts-z,Ie)}),!u||be<0){if(ie=ie.filter(function(me){return me.pts>=0}),!ie.length)return;x===0?be=0:L?be=Math.max(0,Ie):be=ie[0].pts}if(b.isAAC)for(var Ae=x!==void 0,Re=this.config.maxAudioFramesDrift,ke=0,De=be;ke=Re*Z&&$e0){_e+=de;try{Pe=new Uint8Array(_e)}catch(me){this.observer.emit(F.Events.ERROR,F.Events.ERROR,{type:N.ErrorTypes.MUX_ERROR,details:N.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:_e,reason:"fail allocating audio mdat "+_e});return}if(!B){var it=new DataView(Pe.buffer);it.setUint32(0,_e),Pe.set(P.default.types.mdat,4)}}else return;Pe.set(Qe,de);var rt=Qe.byteLength;de+=rt,ee.push(new g(!0,K,rt,0)),we=Ve}var Le=ee.length;if(!Le)return;var Xe=ee[ee.length-1];this.nextAudioPts=be=we+W*Xe.duration;var lt=B?new Uint8Array(0):P.default.moof(b.sequenceNumber++,ve/W,h({},b,{samples:ee}));b.samples=[];var Oe=ve/A,He=be/A,ye="audio",ce={data1:lt,data2:Pe,startPTS:Oe,endPTS:He,startDTS:Oe,endDTS:He,type:ye,hasAudio:!0,hasVideo:!1,nb:Le};return this.isAudioContiguous=!0,console.assert(Pe.length,"MDAT length must not be zero"),ce},w.remuxEmptyAudio=function(b,f,u,L){var x=b.inputTimeScale,A=b.samplerate?b.samplerate:x,I=x/A,W=this.nextAudioPts,K=(W!==null?W:L.startDTS*x)+this._initDTS,Z=L.endDTS*x+this._initDTS,z=I*m,B=Math.ceil((Z-K)/z),ee=_.default.getSilentFrame(b.manifestCodec||b.codec,b.channelCount);if(M.logger.warn("[mp4-remuxer]: remux empty Audio"),!ee){M.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ie=[],de=0;de4294967296;)R+=T;return R}function C(R){for(var w=0;w0?this.lastEndDTS=b:(F.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var f=!!R.audio,u=!!R.video,L="";f&&(L+="audio"),u&&(L+="video");var x={data1:g,startPTS:T,startDTS:T,endPTS:b,endDTS:b,type:L,hasAudio:f,hasVideo:u,nb:1,dropped:0};return C.audio=x.type==="audio"?x:void 0,C.video=x.type!=="audio"?x:void 0,C.text=a,C.id3=v,C.initSegment=y,C},d}(),M=function(h,S,m){return Object(_.getStartDTS)(h,S)-m};function k(d,h){var S=d==null?void 0:d.codec;return S&&S.length>4?S:S==="hvc1"?"hvc1.1.c.L120.90":S==="av01"?"av01.0.04M.08":S==="avc1"||h===P.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}$.default=N},"./src/task-loop.ts":function(ne,$,O){"use strict";O.r($),O.d($,"default",function(){return V});var V=function(){function _(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var P=_.prototype;return P.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},P.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},P.onHandlerDestroyed=function(){},P.hasInterval=function(){return!!this._tickInterval},P.hasNextTick=function(){return!!this._tickTimer},P.setInterval=function(N){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,N),!0)},P.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},P.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},P.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},P.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},P.doTick=function(){},_}()},"./src/types/cmcd.ts":function(ne,$,O){"use strict";O.r($),O.d($,"CMCDVersion",function(){return V}),O.d($,"CMCDObjectType",function(){return _}),O.d($,"CMCDStreamingFormat",function(){return P}),O.d($,"CMCDStreamType",function(){return F});var V=1,_;(function(N){N.MANIFEST="m",N.AUDIO="a",N.VIDEO="v",N.MUXED="av",N.INIT="i",N.CAPTION="c",N.TIMED_TEXT="tt",N.KEY="k",N.OTHER="o"})(_||(_={}));var P;(function(N){N.DASH="d",N.HLS="h",N.SMOOTH="s",N.OTHER="o"})(P||(P={}));var F;(function(N){N.VOD="v",N.LIVE="l"})(F||(F={}))},"./src/types/level.ts":function(ne,$,O){"use strict";O.r($),O.d($,"HlsSkip",function(){return P}),O.d($,"getSkipValue",function(){return F}),O.d($,"HlsUrlParameters",function(){return N}),O.d($,"Level",function(){return M});function V(k,d){for(var h=0;hNumber.MAX_SAFE_INTEGER?Infinity:d},N.hexadecimalInteger=function(k){if(this[k]){var d=(this[k]||"0x").slice(2);d=(d.length&1?"0":"")+d;for(var h=new Uint8Array(d.length/2),S=0;SNumber.MAX_SAFE_INTEGER?Infinity:d},N.decimalFloatingPoint=function(k){return parseFloat(this[k])},N.optionalFloat=function(k,d){var h=this[k];return h?parseFloat(h):d},N.enumeratedString=function(k){return this[k]},N.bool=function(k){return this[k]==="YES"},N.decimalResolution=function(k){var d=V.exec(this[k]);return d===null?void 0:{width:parseInt(d[1],10),height:parseInt(d[2],10)}},F.parseAttrList=function(k){var d,h={},S='"';for(_.lastIndex=0;(d=_.exec(k))!==null;){var m=d[2];m.indexOf(S)===0&&m.lastIndexOf(S)===m.length-1&&(m=m.slice(1,-1)),h[d[1]]=m}return h},F}()},"./src/utils/binary-search.ts":function(ne,$,O){"use strict";O.r($);var V={search:function(P,F){for(var N=0,M=P.length-1,k=null,d=null;N<=M;){k=(N+M)/2|0,d=P[k];var h=F(d);if(h>0)N=k+1;else if(h<0)M=k-1;else return d}return null}};$.default=V},"./src/utils/buffer-helper.ts":function(ne,$,O){"use strict";O.r($),O.d($,"BufferHelper",function(){return P});var V=O("./src/utils/logger.ts"),_={length:0,start:function(){return 0},end:function(){return 0}},P=function(){function F(){}return F.isBuffered=function(M,k){try{if(M){for(var d=F.getBuffered(M),h=0;h=d.start(h)&&k<=d.end(h))return!0}}catch(S){}return!1},F.bufferInfo=function(M,k,d){try{if(M){var h=F.getBuffered(M),S=[],m;for(m=0;mp&&(h[m-1].end=M[S].end):h.push(M[S])}else h.push(M[S])}else h=M;for(var v=0,a,i=k,s=k,l=0;l=C&&k=u&&V.logger.log(this.time+" ["+u+"] "+L)},T}(),v=function(b){for(var f=[],u=0;uN&&(this.logger.log(m.DEBUG,"Too large cursor position "+this.pos),this.pos=N)},b.moveCursor=function(u){var L=this.pos+u;if(u>1)for(var x=this.pos+1;x=144&&this.backSpace();var L=P(u);if(this.pos>=N){this.logger.log(m.ERROR,"Cannot insert "+u.toString(16)+" ("+L+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(L,this.currPenState),this.moveCursor(1)},b.clearFromPos=function(u){var L;for(L=u;L0&&(u?x="["+L.join(" | ")+"]":x=L.join(` `)),x},b.getTextAndFormat=function(){return this.rows},T}(),C=function(){function T(f,u,L){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=f,this.outputFilter=u,this.mode=null,this.verbose=0,this.displayedMemory=new l(L),this.nonDisplayedMemory=new l(L),this.lastOutputScreen=new l(L),this.currRollUpRow=this.displayedMemory.rows[F-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=L}var b=T.prototype;return b.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[F-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},b.getHandler=function(){return this.outputFilter},b.setHandler=function(u){this.outputFilter=u},b.setPAC=function(u){this.writeScreen.setPAC(u)},b.setBkgData=function(u){this.writeScreen.setBkgData(u)},b.setMode=function(u){if(u===this.mode)return;this.mode=u,this.logger.log(m.INFO,"MODE="+u),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=u},b.insertChars=function(u){for(var L=0;L=46,L.italics)L.foreground="white";else{var x=Math.floor(u/2)-16,A=["white","green","blue","cyan","red","yellow","magenta"];L.foreground=A[x]}this.logger.log(m.INFO,"MIDROW: "+JSON.stringify(L)),this.writeScreen.setPen(L)},b.outputDataUpdate=function(u){u===void 0&&(u=!1);var L=this.logger.time;if(L===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=L:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,L,this.lastOutputScreen),u&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:L),this.lastOutputScreen.copy(this.displayedMemory))},b.cueSplitAtTime=function(u){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,u,this.displayedMemory),this.cueStartTime=u))},T}(),g=function(){function T(f,u,L){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var x=new p;this.channels=[null,new C(f,u,x),new C(f+1,L,x)],this.cmdHistory=w(),this.logger=x}var b=T.prototype;return b.getHandler=function(u){return this.channels[u].getHandler()},b.setHandler=function(u,L){this.channels[u].setHandler(L)},b.addData=function(u,L){var x,A,I,W=!1;this.logger.time=u;for(var K=0;K ("+v([A,I])+")"),x=this.parseCmd(A,I),x||(x=this.parseMidrow(A,I)),x||(x=this.parsePAC(A,I)),x||(x=this.parseBackgroundAttributes(A,I)),!x&&(W=this.parseChars(A,I),W)){var Z=this.currentChannel;if(Z&&Z>0){var z=this.channels[Z];z.insertChars(W)}else this.logger.log(m.WARNING,"No channel found yet. TEXT-MODE?")}!x&&!W&&this.logger.log(m.WARNING,"Couldn't parse cleaned data "+v([A,I])+" orig: "+v([L[K],L[K+1]]))}},b.parseCmd=function(u,L){var x=this.cmdHistory,A=(u===20||u===28||u===21||u===29)&&L>=32&&L<=47,I=(u===23||u===31)&&L>=33&&L<=35;if(!(A||I))return!1;if(R(u,L,x))return y(null,null,x),this.logger.log(m.DEBUG,"Repeated command ("+v([u,L])+") is dropped"),!0;var W=u===20||u===21||u===23?1:2,K=this.channels[W];return u===20||u===21||u===28||u===29?L===32?K.ccRCL():L===33?K.ccBS():L===34?K.ccAOF():L===35?K.ccAON():L===36?K.ccDER():L===37?K.ccRU(2):L===38?K.ccRU(3):L===39?K.ccRU(4):L===40?K.ccFON():L===41?K.ccRDC():L===42?K.ccTR():L===43?K.ccRTD():L===44?K.ccEDM():L===45?K.ccCR():L===46?K.ccENM():L===47&&K.ccEOC():K.ccTO(L-32),y(u,L,x),this.currentChannel=W,!0},b.parseMidrow=function(u,L){var x=0;if((u===17||u===25)&&L>=32&&L<=47){if(u===17?x=1:x=2,x!==this.currentChannel)return this.logger.log(m.ERROR,"Mismatch channel in midrow parsing"),!1;var A=this.channels[x];return A?(A.ccMIDROW(L),this.logger.log(m.DEBUG,"MIDROW ("+v([u,L])+")"),!0):!1}return!1},b.parsePAC=function(u,L){var x,A=this.cmdHistory,I=(u>=17&&u<=23||u>=25&&u<=31)&&L>=64&&L<=127,W=(u===16||u===24)&&L>=64&&L<=95;if(!(I||W))return!1;if(R(u,L,A))return y(null,null,A),!0;var K=u<=23?1:2;L>=64&&L<=95?x=K===1?M[u]:d[u]:x=K===1?k[u]:h[u];var Z=this.channels[K];return Z?(Z.setPAC(this.interpretPAC(x,L)),y(u,L,A),this.currentChannel=K,!0):!1},b.interpretPAC=function(u,L){var x,A={color:null,italics:!1,indent:null,underline:!1,row:u};return L>95?x=L-96:x=L-64,A.underline=(x&1)===1,x<=13?A.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(x/2)]:x<=15?(A.italics=!0,A.color="white"):A.indent=Math.floor((x-16)/2)*4,A},b.parseChars=function(u,L){var x,A=null,I=null;if(u>=25?(x=2,I=u-8):(x=1,I=u),I>=17&&I<=19){var W;I===17?W=L+80:I===18?W=L+112:W=L+144,this.logger.log(m.INFO,"Special char '"+P(W)+"' in channel "+x),A=[W]}else u>=32&&u<=127&&(A=L===0?[u]:[u,L]);if(A){var K=v(A);this.logger.log(m.DEBUG,"Char codes = "+K.join(",")),y(u,L,this.cmdHistory)}return A},b.parseBackgroundAttributes=function(u,L){var x=(u===16||u===24)&&L>=32&&L<=47,A=(u===23||u===31)&&L>=45&&L<=47;if(!(x||A))return!1;var I,W={};u===16||u===24?(I=Math.floor((L-32)/2),W.background=S[I],L%2===1&&(W.background=W.background+"_semi")):L===45?W.background="transparent":(W.foreground="black",L===47&&(W.underline=!0));var K=u<=23?1:2,Z=this.channels[K];return Z.setBkgData(W),y(u,L,this.cmdHistory),!0},b.reset=function(){for(var u=0;u=16?i--:i++;var y=Object(V.fixLineBreaks)(s.trim()),R=Object(_.generateCueId)(d,h,y);(!k||!k.cues||!k.cues.getCueById(R))&&(v=new l(d,h,y),v.id=R,v.line=C+1,v.align="left",v.position=10+Math.min(80,Math.floor(i*8/32)*10),m.push(v))}return k&&m.length&&(m.sort(function(w,T){return w.line==="auto"||T.line==="auto"?0:w.line>8&&T.line>8?T.line-w.line:w.line-T.line}),m.forEach(function(w){return Object(P.addCueToTrack)(k,w)})),m}};$.default=N},"./src/utils/discontinuities.ts":function(ne,$,O){"use strict";O.r($),O.d($,"findFirstFragWithCC",function(){return F}),O.d($,"shouldAlignOnDiscontinuities",function(){return N}),O.d($,"findDiscontinuousReferenceFrag",function(){return M}),O.d($,"adjustSlidingStart",function(){return d}),O.d($,"alignStream",function(){return h}),O.d($,"alignPDT",function(){return m}),O.d($,"alignFragmentByPDTDelta",function(){return p}),O.d($,"alignMediaPlaylistByPDT",function(){return v});var V=O("./src/polyfills/number.ts"),_=O("./src/utils/logger.ts"),P=O("./src/controller/level-helper.ts");function F(a,i){for(var s=null,l=0,C=a.length;ls.startCC||a&&a.cc=this.minWeight_},F.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},F.destroy=function(){},P}();$.default=_},"./src/utils/ewma.ts":function(ne,$,O){"use strict";O.r($);var V=function(){function _(F,N,M){N===void 0&&(N=0),M===void 0&&(M=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=F,this.alpha_=F?Math.exp(Math.log(.5)/F):0,this.estimate_=N,this.totalWeight_=M}var P=_.prototype;return P.sample=function(N,M){var k=Math.pow(this.alpha_,N);this.estimate_=M*(1-k)+k*this.estimate_,this.totalWeight_+=N},P.getTotalWeight=function(){return this.totalWeight_},P.getEstimate=function(){if(this.alpha_){var N=1-Math.pow(this.alpha_,this.totalWeight_);if(N)return this.estimate_/N}return this.estimate_},_}();$.default=V},"./src/utils/fetch-loader.ts":function(ne,$,O){"use strict";O.r($),O.d($,"fetchSupported",function(){return p});var V=O("./src/polyfills/number.ts"),_=O("./src/loader/load-stats.ts"),P=O("./src/demux/chunk-cache.ts");function F(l,C){l.prototype=Object.create(C.prototype),l.prototype.constructor=l,h(l,C)}function N(l){var C=typeof Map=="function"?new Map:void 0;return N=function(y){if(y===null||!d(y))return y;if(typeof y!="function")throw new TypeError("Super expression must either be null or a function");if(typeof C!="undefined"){if(C.has(y))return C.get(y);C.set(y,R)}function R(){return M(y,arguments,S(this).constructor)}return R.prototype=Object.create(y.prototype,{constructor:{value:R,enumerable:!1,writable:!0,configurable:!0}}),h(R,y)},N(l)}function M(l,C,g){return k()?M=Reflect.construct:M=function(R,w,T){var b=[null];b.push.apply(b,w);var f=Function.bind.apply(R,b),u=new f;return T&&h(u,T.prototype),u},M.apply(null,arguments)}function k(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(l){return!1}}function d(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function h(l,C){return h=Object.setPrototypeOf||function(y,R){return y.__proto__=R,y},h(l,C)}function S(l){return S=Object.setPrototypeOf?Object.getPrototypeOf:function(g){return g.__proto__||Object.getPrototypeOf(g)},S(l)}function m(){return m=Object.assign||function(l){for(var C=1;C=T&&b(R,w,f.flush(),y)):b(R,w,I,y),x()}).catch(function(){return Promise.reject()})};return L()},l}();function a(l,C){var g={method:"GET",mode:"cors",credentials:"same-origin",signal:C,headers:new self.Headers(m({},l.headers))};return l.rangeEnd&&g.headers.set("Range","bytes="+l.rangeStart+"-"+String(l.rangeEnd-1)),g}function i(l,C){return new self.Request(l.url,C)}var s=function(l){F(C,l);function C(g,y,R){var w;return w=l.call(this,g)||this,w.code=void 0,w.details=void 0,w.code=y,w.details=R,w}return C}(N(Error));$.default=v},"./src/utils/imsc1-ttml-parser.ts":function(ne,$,O){"use strict";O.r($),O.d($,"IMSC1_CODEC",function(){return d}),O.d($,"parseIMSC1",function(){return p});var V=O("./src/utils/mp4-tools.ts"),_=O("./src/utils/vttparser.ts"),P=O("./src/utils/vttcue.ts"),F=O("./src/demux/id3.ts"),N=O("./src/utils/timescale-conversion.ts"),M=O("./src/utils/webvtt-parser.ts");function k(){return k=Object.assign||function(T){for(var b=1;b"):V}function N(d){for(var h=arguments.length,S=new Array(h>1?h-1:0),m=1;m>24,C[g+1]=y>>16&255,C[g+2]=y>>8&255,C[g+3]=y&255}function h(C,g){var y=[];if(!g.length)return y;var R,w,T;"data"in C?(R=C.data,w=C.start,T=C.end):(R=C,w=0,T=R.byteLength);for(var b=w;b1?b+f:T;if(u===g[0])if(g.length===1)y.push({data:R,start:b+8,end:L});else{var x=h({data:R,start:b+8,end:L},g.slice(1));x.length&&F.apply(y,x)}b=L}return y}function S(C){var g=h(C,["moov"]),y=g[0],R=y?y.end:null,w=h(C,["sidx"]);if(!w||!w[0])return null;var T=[],b=w[0],f=b.data[0],u=f===0?8:16,L=k(b,u);u+=4;var x=0,A=0;f===0?u+=8:u+=16,u+=2;var I=b.end+A,W=M(b,u);u+=2;for(var K=0;K>>31;if(ee===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ie=k(b,Z);Z+=4,T.push({referenceSize:B,subsegmentDuration:ie,info:{duration:ie/L,start:I,end:I+B-1}}),I+=B,Z+=4,u=Z}return{earliestPresentationTime:x,timescale:L,version:f,referencesCount:W,references:T,moovEndOffset:R}}function m(C){for(var g=[],y=h(C,["moov","trak"]),R=0;RN)&&(this.startTime=N),this.endTime=M,this.screen=k,this.timelineController.createCaptionsTrack(this.trackName)},P.reset=function(){this.cueRanges=[]},_}()},"./src/utils/texttrack-utils.ts":function(ne,$,O){"use strict";O.r($),O.d($,"sendAddTrackEvent",function(){return _}),O.d($,"addCueToTrack",function(){return P}),O.d($,"clearCurrentCues",function(){return F}),O.d($,"removeCuesInRange",function(){return N}),O.d($,"getCuesInRange",function(){return k});var V=O("./src/utils/logger.ts");function _(d,h){var S;try{S=new Event("addtrack")}catch(m){S=document.createEvent("Event"),S.initEvent("addtrack",!1,!1)}S.track=d,h.dispatchEvent(S)}function P(d,h){var S=d.mode;if(S==="disabled"&&(d.mode="hidden"),d.cues&&!d.cues.getCueById(h.id))try{if(d.addCue(h),!d.cues.getCueById(h.id))throw new Error("addCue is failed for: "+h)}catch(p){V.logger.debug("[texttrack-utils]: "+p);var m=new self.TextTrackCue(h.startTime,h.endTime,h.text);m.id=h.id,d.addCue(m)}S==="disabled"&&(d.mode=S)}function F(d){var h=d.mode;if(h==="disabled"&&(d.mode="hidden"),d.cues)for(var S=d.cues.length;S--;)d.removeCue(d.cues[S]);h==="disabled"&&(d.mode=h)}function N(d,h,S){var m=d.mode;if(m==="disabled"&&(d.mode="hidden"),d.cues&&d.cues.length>0)for(var p=k(d.cues,h,S),v=0;vd[S].endTime)return-1;for(var m=0,p=S;m<=p;){var v=Math.floor((p+m)/2);if(hd[v].startTime&&m-1)for(var v=p,a=d.length;v=h&&i.endTime<=S)m.push(i);else if(i.startTime>S)return m}return m}},"./src/utils/time-ranges.ts":function(ne,$,O){"use strict";O.r($);var V={toString:function(P){for(var F="",N=P.length,M=0;M1?h-1:0),m=1;m100)throw new Error("Position must be between 0 and 100.");T=x,this.hasBeenReset=!0}})),Object.defineProperty(m,"positionAlign",M({},p,{get:function(){return b},set:function(x){var A=N(x);if(!A)throw new SyntaxError("An invalid or illegal string was specified.");b=A,this.hasBeenReset=!0}})),Object.defineProperty(m,"size",M({},p,{get:function(){return f},set:function(x){if(x<0||x>100)throw new Error("Size must be between 0 and 100.");f=x,this.hasBeenReset=!0}})),Object.defineProperty(m,"align",M({},p,{get:function(){return u},set:function(x){var A=N(x);if(!A)throw new SyntaxError("An invalid or illegal string was specified.");u=A,this.hasBeenReset=!0}})),m.displayState=void 0}return k.prototype.getCueAsHTML=function(){var d=self.WebVTT;return d.convertCueToDOMTree(self,this.text)},k}()},"./src/utils/vttparser.ts":function(ne,$,O){"use strict";O.r($),O.d($,"parseTimeStamp",function(){return P}),O.d($,"fixLineBreaks",function(){return h}),O.d($,"VTTParser",function(){return S});var V=O("./src/utils/vttcue.ts"),_=function(){function m(){}var p=m.prototype;return p.decode=function(a,i){if(!a)return"";if(typeof a!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(a))},m}();function P(m){function p(a,i,s,l){return(a|0)*3600+(i|0)*60+(s|0)+parseFloat(l||0)}var v=m.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return v?parseFloat(v[2])>59?p(v[2],v[3],0,v[4]):p(v[1],v[2],v[3],v[4]):null}var F=function(){function m(){this.values=Object.create(null)}var p=m.prototype;return p.set=function(a,i){!this.get(a)&&i!==""&&(this.values[a]=i)},p.get=function(a,i,s){return s?this.has(a)?this.values[a]:i[s]:this.has(a)?this.values[a]:i},p.has=function(a){return a in this.values},p.alt=function(a,i,s){for(var l=0;l=0&&s<=100)return this.set(a,s),!0}return!1},m}();function N(m,p,v,a){var i=a?m.split(a):[m];for(var s in i){if(typeof i[s]!="string")continue;var l=i[s].split(v);if(l.length!==2)continue;var C=l[0],g=l[1];p(C,g)}}var M=new V.default(0,0,""),k=M.align==="middle"?"middle":"center";function d(m,p,v){var a=m;function i(){var C=P(m);if(C===null)throw new Error("Malformed timestamp: "+a);return m=m.replace(/^[^\sa-zA-Z-]+/,""),C}function s(C,g){var y=new F;N(C,function(T,b){var f;switch(T){case"region":for(var u=v.length-1;u>=0;u--)if(v[u].id===b){y.set(T,v[u].region);break}break;case"vertical":y.alt(T,b,["rl","lr"]);break;case"line":f=b.split(","),y.integer(T,f[0]),y.percent(T,f[0])&&y.set("snapToLines",!1),y.alt(T,f[0],["auto"]),f.length===2&&y.alt("lineAlign",f[1],["start",k,"end"]);break;case"position":f=b.split(","),y.percent(T,f[0]),f.length===2&&y.alt("positionAlign",f[1],["start",k,"end","line-left","line-right","auto"]);break;case"size":y.percent(T,b);break;case"align":y.alt(T,b,["start",k,"end","left","right"]);break}},/:/,/\s/),g.region=y.get("region",null),g.vertical=y.get("vertical","");var R=y.get("line","auto");R==="auto"&&M.line===-1&&(R=-1),g.line=R,g.lineAlign=y.get("lineAlign","start"),g.snapToLines=y.get("snapToLines",!0),g.size=y.get("size",100),g.align=y.get("align",k);var w=y.get("position","auto");w==="auto"&&M.position===50&&(w=g.align==="start"||g.align==="left"?0:g.align==="end"||g.align==="right"?100:50),g.position=w}function l(){m=m.replace(/^\s+/,"")}if(l(),p.startTime=i(),l(),m.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+a);m=m.substr(3),l(),p.endTime=i(),l(),s(m,p)}function h(m){return m.replace(//gi,` `)}var S=function(){function m(){this.state="INITIAL",this.buffer="",this.decoder=new _,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var p=m.prototype;return p.parse=function(a){var i=this;a&&(i.buffer+=i.decoder.decode(a,{stream:!0}));function s(){var w=i.buffer,T=0;for(w=h(w);T")===-1){i.cue.id=C;continue}case"CUE":if(!i.cue){i.state="BADCUE";continue}try{d(C,i.cue,i.regionList)}catch(w){i.cue=null,i.state="BADCUE";continue}i.state="CUETEXT";continue;case"CUETEXT":{var R=C.indexOf("-->")!==-1;if(!C||R&&(y=!0)){i.oncue&&i.cue&&i.oncue(i.cue),i.cue=null,i.state="ID";continue}if(i.cue===null)continue;i.cue.text&&(i.cue.text+=` `),i.cue.text+=C}continue;case"BADCUE":C||(i.state="ID")}}}catch(w){i.state==="CUETEXT"&&i.cue&&i.oncue&&i.oncue(i.cue),i.cue=null,i.state=i.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},p.flush=function(){var a=this;try{if((a.cue||a.state==="HEADER")&&(a.buffer+=` `,a.parse()),a.state==="INITIAL"||a.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(i){a.onparsingerror&&a.onparsingerror(i)}return a.onflush&&a.onflush(),this},m}()},"./src/utils/webvtt-parser.ts":function(ne,$,O){"use strict";O.r($),O.d($,"generateCueId",function(){return S}),O.d($,"parseWebVTT",function(){return p});var V=O("./src/polyfills/number.ts"),_=O("./src/utils/vttparser.ts"),P=O("./src/demux/id3.ts"),F=O("./src/utils/timescale-conversion.ts"),N=O("./src/remux/mp4-remuxer.ts"),M=/\r\n|\n\r|\n|\r/g,k=function(a,i,s){return s===void 0&&(s=0),a.substr(s,i.length)===i},d=function(a){var i=parseInt(a.substr(-3)),s=parseInt(a.substr(-6,2)),l=parseInt(a.substr(-9,2)),C=a.length>9?parseInt(a.substr(0,a.indexOf(":"))):0;if(!Object(V.isFiniteNumber)(i)||!Object(V.isFiniteNumber)(s)||!Object(V.isFiniteNumber)(l)||!Object(V.isFiniteNumber)(C))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+a);return i+=1e3*s,i+=60*1e3*l,i+=60*60*1e3*C,i},h=function(a){for(var i=5381,s=a.length;s;)i=i*33^a.charCodeAt(--s);return(i>>>0).toString()};function S(v,a,i){return h(v.toString())+h(a.toString())+h(i)}var m=function(a,i,s){var l=a[i],C=a[l.prevCC];if(!C||!C.new&&l.new){a.ccOffset=a.presentationOffset=l.start,l.new=!1;return}for(;(g=C)!==null&&g!==void 0&&g.new;){var g;a.ccOffset+=l.start-C.start,l.new=!1,l=C,C=a[l.prevCC]}a.presentationOffset=s};function p(v,a,i,s,l,C,g,y){var R=new _.VTTParser,w=Object(P.utf8ArrayToStr)(new Uint8Array(v)).trim().replace(M,` `).split(` `),T=[],b=Object(F.toMpegTsClockFromTimescale)(a,i),f="00:00.000",u=0,L=0,x,A=!0,I=!1;R.oncue=function(W){var K=s[l],Z=s.ccOffset,z=(u-b)/9e4;if(K!=null&&K.new&&(L!==void 0?Z=s.ccOffset=K.start:m(s,l,z)),z&&(Z=z-s.presentationOffset),I){var B=W.endTime-W.startTime,ee=Object(N.normalizePts)((W.startTime+Z-L)*9e4,C*9e4)/9e4;W.startTime=ee,W.endTime=ee+B}var ie=W.text.trim();W.text=decodeURIComponent(encodeURIComponent(ie)),W.id||(W.id=S(W.startTime,W.endTime,ie)),W.endTime>0&&T.push(W)},R.onparsingerror=function(W){x=W},R.onflush=function(){if(x){y(x);return}g(T)},w.forEach(function(W){if(A)if(k(W,"X-TIMESTAMP-MAP=")){A=!1,I=!0,W.substr(16).split(",").forEach(function(K){k(K,"LOCAL:")?f=K.substr(6):k(K,"MPEGTS:")&&(u=parseInt(K.substr(7)))});try{L=d(f)/1e3}catch(K){I=!1,x=K}return}else W===""&&(A=!1);R.parse(W+` `)}),R.flush()}},"./src/utils/xhr-loader.ts":function(ne,$,O){"use strict";O.r($);var V=O("./src/utils/logger.ts"),_=O("./src/loader/load-stats.ts"),P=/^age:\s*[\d.]+\s*$/m,F=function(){function N(k){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=k?k.xhrSetup:null,this.stats=new _.LoadStats,this.retryDelay=0}var M=N.prototype;return M.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},M.abortInternal=function(){var d=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),d&&(d.onreadystatechange=null,d.onprogress=null,d.readyState!==4&&(this.stats.aborted=!0,d.abort()))},M.abort=function(){var d;this.abortInternal(),(d=this.callbacks)!==null&&d!==void 0&&d.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},M.load=function(d,h,S){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=d,this.config=h,this.callbacks=S,this.retryDelay=h.retryDelay,this.loadInternal()},M.loadInternal=function(){var d=this.config,h=this.context;if(!d)return;var S=this.loader=new self.XMLHttpRequest,m=this.stats;m.loading.first=0,m.loaded=0;var p=this.xhrSetup;try{if(p)try{p(S,h.url)}catch(i){S.open("GET",h.url,!0),p(S,h.url)}S.readyState||S.open("GET",h.url,!0);var v=this.context.headers;if(v)for(var a in v)S.setRequestHeader(a,v[a])}catch(i){this.callbacks.onError({code:S.status,text:i.message},h,S);return}h.rangeEnd&&S.setRequestHeader("Range","bytes="+h.rangeStart+"-"+(h.rangeEnd-1)),S.onreadystatechange=this.readystatechange.bind(this),S.onprogress=this.loadprogress.bind(this),S.responseType=h.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),d.timeout),S.send()},M.readystatechange=function(){var d=this.context,h=this.loader,S=this.stats;if(!d||!h)return;var m=h.readyState,p=this.config;if(S.aborted)return;if(m>=2)if(self.clearTimeout(this.requestTimeout),S.loading.first===0&&(S.loading.first=Math.max(self.performance.now(),S.loading.start)),m===4){h.onreadystatechange=null,h.onprogress=null;var v=h.status;if(v>=200&&v<300){S.loading.end=Math.max(self.performance.now(),S.loading.first);var a,i;if(d.responseType==="arraybuffer"?(a=h.response,i=a.byteLength):(a=h.responseText,i=a.length),S.loaded=S.total=i,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(S,d,a,h),!this.callbacks)return;var l={url:h.responseURL,data:a};this.callbacks.onSuccess(l,S,d,h)}else S.retry>=p.maxRetry||v>=400&&v<499?(V.logger.error(v+" while loading "+d.url),this.callbacks.onError({code:v,text:h.statusText},d,h)):(V.logger.warn(v+" while loading "+d.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,p.maxRetryDelay),S.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),p.timeout)},M.loadtimeout=function(){V.logger.warn("timeout while loading "+this.context.url);var d=this.callbacks;d&&(this.abortInternal(),d.onTimeout(this.stats,this.context,this.loader))},M.loadprogress=function(d){var h=this.stats;h.loaded=d.loaded,d.lengthComputable&&(h.total=d.total)},M.getCacheAge=function(){var d=null;if(this.loader&&P.test(this.loader.getAllResponseHeaders())){var h=this.loader.getResponseHeader("age");d=h?parseFloat(h):null}return d},N}();$.default=F}}).default})},vHTk:function(mt,Ee,Q){mt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);